]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
bouncegrid now uses high precision 48bpp accumulation array while also
[xonotic/darkplaces.git] / gl_textures.c
index 8122db468a80916ff12802667ee1354bc5fb62ae..0f08b5f9ea3df9047df57644a6861c286cb30425 100644 (file)
@@ -302,7 +302,6 @@ void R_FreeTexture(rtexture_t *rt)
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                if (glt->texnum)
                {
@@ -456,7 +455,6 @@ static void GL_TextureMode_f (void)
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                // change all the existing mipmap texture objects
                // FIXME: force renderer(/client/something?) restart instead?
@@ -582,7 +580,6 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int miplevel, i
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_D3D10:
        case RENDERPATH_D3D11:
        case RENDERPATH_SOFT:
@@ -703,7 +700,6 @@ static void r_textures_start(void)
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                // LordHavoc: allow any alignment
                CHECKGLERROR
@@ -771,7 +767,6 @@ static void r_textures_devicelost(void)
                case RENDERPATH_GL11:
                case RENDERPATH_GL13:
                case RENDERPATH_GL20:
-               case RENDERPATH_CGGL:
                case RENDERPATH_GLES2:
                        break;
                case RENDERPATH_D3D9:
@@ -814,7 +809,6 @@ static void r_textures_devicerestored(void)
                case RENDERPATH_GL11:
                case RENDERPATH_GL13:
                case RENDERPATH_GL20:
-               case RENDERPATH_CGGL:
                case RENDERPATH_GLES2:
                        break;
                case RENDERPATH_D3D9:
@@ -925,7 +919,6 @@ void R_Textures_Frame (void)
                case RENDERPATH_GL11:
                case RENDERPATH_GL13:
                case RENDERPATH_GL20:
-               case RENDERPATH_CGGL:
                case RENDERPATH_GLES2:
                        CHECKGLERROR
                        GL_ActiveTexture(0);
@@ -1081,7 +1074,6 @@ static void R_UploadPartialTexture(gltexture_t *glt, const unsigned char *data,
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                {
                        int oldbindtexnum;
@@ -1164,7 +1156,7 @@ static void R_UploadFullTexture(gltexture_t *glt, const unsigned char *data)
        {
                // multiply RGB channels by A channel before uploading
                int alpha;
-               for (i = 0;i < width*height*depth*4;i += 4)
+               for (i = 0;i < glt->inputwidth*glt->inputheight*glt->inputdepth*4;i += 4)
                {
                        alpha = prevbuffer[i+3];
                        colorconvertbuffer[i] = (prevbuffer[i] * alpha) >> 8;
@@ -1194,7 +1186,6 @@ static void R_UploadFullTexture(gltexture_t *glt, const unsigned char *data)
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                CHECKGLERROR
 
@@ -1617,7 +1608,6 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                CHECKGLERROR
                qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR
@@ -2250,7 +2240,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                CHECKGLERROR
                GL_ActiveTexture(0);
@@ -2303,7 +2292,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
                case RENDERPATH_GL11:
                case RENDERPATH_GL13:
                case RENDERPATH_GL20:
-               case RENDERPATH_CGGL:
                case RENDERPATH_GLES2:
                        if (bytesperblock)
                        {
@@ -2360,7 +2348,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
        case RENDERPATH_GL20:
-       case RENDERPATH_CGGL:
        case RENDERPATH_GLES2:
                if (dds_miplevels >= 1 && !mipcomplete)
                {
@@ -2438,7 +2425,7 @@ int R_TextureHeight(rtexture_t *rt)
        return rt ? ((gltexture_t *)rt)->inputheight : 0;
 }
 
-void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int width, int height)
+void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth)
 {
        gltexture_t *glt = (gltexture_t *)rt;
        if (data == NULL)
@@ -2459,6 +2446,8 @@ void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, in
                int outputskip = glt->tilewidth*bpp;
                const unsigned char *input = data;
                unsigned char *output = glt->bufferpixels;
+               if (glt->inputdepth != 1 || glt->sides != 1)
+                       Sys_Error("R_UpdateTexture on buffered texture that is not 2D\n");
                if (x < 0)
                {
                        width += x;
@@ -2483,8 +2472,8 @@ void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, in
                for (j = 0;j < height;j++, output += outputskip, input += inputskip)
                        memcpy(output, input, width*bpp);
        }
-       else if (x || y || width != glt->inputwidth || height != glt->inputheight)
-               R_UploadPartialTexture(glt, data, x, y, 0, width, height, 1);
+       else if (x || y || z || width != glt->inputwidth || height != glt->inputheight || depth != glt->inputdepth)
+               R_UploadPartialTexture(glt, data, x, y, z, width, height, depth);
        else
                R_UploadFullTexture(glt, data);
 }