don't enable mipmaps for dynamic textures

This commit is contained in:
David Rose 2004-12-11 16:39:28 +00:00
parent 1a6e7ff58b
commit 60193c50ae
2 changed files with 155 additions and 141 deletions

View File

@ -3092,6 +3092,13 @@ apply_texture(TextureContext *tc) {
D3DTEXTUREFILTERTYPE newMipFilter = PandaToD3DMipType[(DWORD)ft]; D3DTEXTUREFILTERTYPE newMipFilter = PandaToD3DMipType[(DWORD)ft];
if (!tex->might_have_ram_image()) {
// If the texture is completely dynamic, don't try to issue
// mipmaps--pandadx doesn't support auto-generated mipmaps at this
// point.
newMipFilter = D3DTEXF_NONE;
}
#ifndef NDEBUG #ifndef NDEBUG
// sanity check // sanity check
extern char *PandaFilterNameStrs[]; extern char *PandaFilterNameStrs[];

View File

@ -2980,9 +2980,9 @@ apply_texture(TextureContext *tc) {
return; return;
} }
#ifdef DO_PSTATS #ifdef DO_PSTATS
add_to_texture_record(tc); add_to_texture_record(tc);
#endif #endif
// Note: if this code changes, make sure to change initialization // Note: if this code changes, make sure to change initialization
// SetTSS code in dx_init as well so DX TSS renderstate matches // SetTSS code in dx_init as well so DX TSS renderstate matches
@ -3050,11 +3050,11 @@ apply_texture(TextureContext *tc) {
if (aniso_degree<=1) { if (aniso_degree<=1) {
newMagFilter=((ft!=Texture::FT_nearest) ? D3DTEXF_LINEAR : D3DTEXF_POINT); newMagFilter=((ft!=Texture::FT_nearest) ? D3DTEXF_LINEAR : D3DTEXF_POINT);
#ifdef _DEBUG #ifdef _DEBUG
if((ft!=Texture::FT_linear)&&(ft!=Texture::FT_nearest)) { if((ft!=Texture::FT_linear)&&(ft!=Texture::FT_nearest)) {
dxgsg9_cat.error() << "MipMap filter type setting for texture magfilter makes no sense, texture: " << tex->get_name() << "\n"; dxgsg9_cat.error() << "MipMap filter type setting for texture magfilter makes no sense, texture: " << tex->get_name() << "\n";
} }
#endif #endif
} else { } else {
newMagFilter=D3DTEXF_ANISOTROPIC; newMagFilter=D3DTEXF_ANISOTROPIC;
} }
@ -3067,11 +3067,11 @@ apply_texture(TextureContext *tc) {
#ifdef _DEBUG #ifdef _DEBUG
assert(Texture::FT_linear_mipmap_linear < 8); assert(Texture::FT_linear_mipmap_linear < 8);
#endif #endif
/* /*
enum FilterType { enum FilterType {
FT_nearest,FT_linear,FT_nearest_mipmap_nearest,FT_linear_mipmap_nearest, FT_nearest,FT_linear,FT_nearest_mipmap_nearest,FT_linear_mipmap_nearest,
FT_nearest_mipmap_linear, FT_linear_mipmap_linear, }; FT_nearest_mipmap_linear, FT_linear_mipmap_linear, };
*/ */
// map Panda composite min+mip filter types to d3d's separate min & mip filter types // map Panda composite min+mip filter types to d3d's separate min & mip filter types
static D3DTEXTUREFILTERTYPE PandaToD3DMinType[8] = static D3DTEXTUREFILTERTYPE PandaToD3DMinType[8] =
{D3DTEXF_POINT,D3DTEXF_LINEAR,D3DTEXF_POINT,D3DTEXF_LINEAR,D3DTEXF_POINT,D3DTEXF_LINEAR}; {D3DTEXF_POINT,D3DTEXF_LINEAR,D3DTEXF_POINT,D3DTEXF_LINEAR,D3DTEXF_POINT,D3DTEXF_LINEAR};
@ -3089,14 +3089,21 @@ apply_texture(TextureContext *tc) {
D3DTEXTUREFILTERTYPE newMipFilter = PandaToD3DMipType[(DWORD)ft]; D3DTEXTUREFILTERTYPE newMipFilter = PandaToD3DMipType[(DWORD)ft];
#ifndef NDEBUG if (!tex->might_have_ram_image()) {
// If the texture is completely dynamic, don't try to issue
// mipmaps--pandadx doesn't support auto-generated mipmaps at this
// point.
newMipFilter = D3DTEXF_NONE;
}
#ifndef NDEBUG
// sanity check // sanity check
extern char *PandaFilterNameStrs[]; extern char *PandaFilterNameStrs[];
if((!(dtc->_bHasMipMaps))&&(newMipFilter!=D3DTEXF_NONE)) { if((!(dtc->_bHasMipMaps))&&(newMipFilter!=D3DTEXF_NONE)) {
dxgsg9_cat.error() << "Trying to set mipmap filtering for texture with no generated mipmaps!! texname[" << tex->get_name() << "], filter("<<PandaFilterNameStrs[ft]<<")\n"; dxgsg9_cat.error() << "Trying to set mipmap filtering for texture with no generated mipmaps!! texname[" << tex->get_name() << "], filter("<<PandaFilterNameStrs[ft]<<")\n";
newMipFilter=D3DTEXF_NONE; newMipFilter=D3DTEXF_NONE;
} }
#endif #endif
D3DTEXTUREFILTERTYPE newMinFilter = PandaToD3DMinType[(DWORD)ft]; D3DTEXTUREFILTERTYPE newMinFilter = PandaToD3DMinType[(DWORD)ft];