]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
Multisampling initialisation moved from vid_sdl to gl_backend. Make cubemaps array...
[xonotic/darkplaces.git] / gl_draw.c
index 2e1ce7a65d3c1779cbf2a1ca0c0d5e0547cf35a7..6e09f839a12726aabf2aa7c8ec394fce0ec14017 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -404,7 +404,7 @@ reload:
                pic->height = image_height;
                if (!pic->autoload)
                {
-                       pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, image_width, image_height, pixels, r_texture_sRGB_2d.integer ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, pic->texflags & (pic->hasalpha ? ~0 : ~TEXF_ALPHA), -1, NULL);
+                       pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, image_width, image_height, pixels, vid.sRGB2D ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, pic->texflags & (pic->hasalpha ? ~0 : ~TEXF_ALPHA), -1, NULL);
                        if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex)
                                R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha);
                }
@@ -431,8 +431,11 @@ reload:
                        pic->width = lmpdata[0] + lmpdata[1] * 256 + lmpdata[2] * 65536 + lmpdata[3] * 16777216;
                        pic->height = lmpdata[4] + lmpdata[5] * 256 + lmpdata[6] * 65536 + lmpdata[7] * 16777216;
                        // if no high quality replacement image was found, upload the original low quality texture
-                       if (!pixels)
-                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, pic->width, pic->height, lmpdata + 8, TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_transparent);
+                       if (!loaded)
+                       {
+                               loaded = true;
+                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, pic->width, pic->height, lmpdata + 8, vid.sRGB2D ? TEXTYPE_SRGB_PALETTE : TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_transparent);
+                       }
                }
                Mem_Free(lmpdata);
        }
@@ -447,16 +450,22 @@ reload:
                        pic->width = 128;
                        pic->height = 128;
                        // if no high quality replacement image was found, upload the original low quality texture
-                       if (!pixels)
-                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, 128, 128, lmpdata, TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_font);
+                       if (!loaded)
+                       {
+                               loaded = true;
+                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, 128, 128, lmpdata, vid.sRGB2D != 0 ? TEXTYPE_SRGB_PALETTE : TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_font);
+                       }
                }
                else
                {
                        pic->width = lmpdata[0] + lmpdata[1] * 256 + lmpdata[2] * 65536 + lmpdata[3] * 16777216;
                        pic->height = lmpdata[4] + lmpdata[5] * 256 + lmpdata[6] * 65536 + lmpdata[7] * 16777216;
                        // if no high quality replacement image was found, upload the original low quality texture
-                       if (!pixels)
-                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, pic->width, pic->height, lmpdata + 8, TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_transparent);
+                       if (!loaded)
+                       {
+                               loaded = true;
+                               pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, pic->width, pic->height, lmpdata + 8, vid.sRGB2D != 0 ? TEXTYPE_SRGB_PALETTE : TEXTYPE_PALETTE, pic->texflags, -1, palette_bgra_transparent);
+                       }
                }
        }
 
@@ -493,13 +502,13 @@ rtexture_t *Draw_GetPicTexture(cachepic_t *pic)
                }
                if (pic->tex == NULL)
                {
-                       pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, r_texture_sRGB_2d.integer != 0);
+                       pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, vid.sRGB2D);
                        if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex)
                                R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha);
                }
                if (pic->tex == NULL && !strncmp(pic->name, "gfx/", 4))
                {
-                       pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, r_texture_sRGB_2d.integer != 0);
+                       pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, vid.sRGB2D);
                        if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex)
                                R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha);
                }