]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
make sure the return value of R_PicmipForFlags can't get negative
[xonotic/darkplaces.git] / gl_textures.c
index bf504d96f68f4f5ae6e54de29276c1c3bc56e774..e9b5d7101bc58961d6ce81f55fcfa7b134efb9e7 100644 (file)
@@ -479,6 +479,12 @@ static void GL_TextureMode_f (void)
                }
 #endif
                break;
+       case RENDERPATH_D3D10:
+               Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__);
+               break;
+       case RENDERPATH_D3D11:
+               Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__);
+               break;
        }
 }
 
@@ -1751,7 +1757,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        dds_height = BuffLittleLong(dds+12);
        ddspixels = dds + 128;
 
-       flags &= ~TEXF_ALPHA;
+       //flags &= ~TEXF_ALPHA; // disabled, as we DISABLE TEXF_ALPHA in the alpha detection, not enable it!
        if ((dds_format_flags & 0x40) && BuffLittleLong(dds+88) == 32)
        {
                // very sloppy BGRA 32bit identification
@@ -1888,7 +1894,11 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
                        mipheight >>= 1;
        }
 
-       if (dds_miplevels > 1)
+       // when not requesting mipmaps, do not load them
+       if(!(flags & TEXF_MIPMAP))
+               dds_miplevels = 0;
+
+       if (dds_miplevels >= 1)
                flags |= TEXF_MIPMAP;
        else
                flags &= ~TEXF_MIPMAP;
@@ -2196,5 +2206,5 @@ int R_PicmipForFlags(int flags)
                else
                        miplevel += gl_picmip_other.integer;
        }
-       return miplevel;
+       return max(0, miplevel);
 }