diff --git a/src/d3d9/d3d9_texture.h b/src/d3d9/d3d9_texture.h index abad69f3..be19d327 100644 --- a/src/d3d9/d3d9_texture.h +++ b/src/d3d9/d3d9_texture.h @@ -189,15 +189,13 @@ namespace dxvk { if (ptr == nullptr) return nullptr; - switch (ptr->GetType()) { - case D3DRTYPE_TEXTURE: return static_cast (ptr)->GetCommonTexture(); - case D3DRTYPE_CUBETEXTURE: return static_cast(ptr)->GetCommonTexture(); - case D3DRTYPE_VOLUMETEXTURE: return static_cast (ptr)->GetCommonTexture(); - default: - Logger::warn("Unknown texture resource type."); break; - } - - return nullptr; + D3DRESOURCETYPE type = ptr->GetType(); + if (type == D3DRTYPE_TEXTURE) + return static_cast (ptr)->GetCommonTexture(); + else if (type == D3DRTYPE_CUBETEXTURE) + return static_cast(ptr)->GetCommonTexture(); + else //if(type == D3DRTYPE_VOLUMETEXTURE) + return static_cast (ptr)->GetCommonTexture(); } inline D3D9CommonTexture* GetCommonTexture(D3D9Surface* ptr) { @@ -215,13 +213,13 @@ namespace dxvk { if (tex == nullptr) return; - switch (tex->GetType()) { - case D3DRTYPE_TEXTURE: CastRefPrivate (tex, AddRef); break; - case D3DRTYPE_CUBETEXTURE: CastRefPrivate(tex, AddRef); break; - case D3DRTYPE_VOLUMETEXTURE: CastRefPrivate (tex, AddRef); break; - default: - Logger::warn("Unknown texture resource type."); break; - } + D3DRESOURCETYPE type = tex->GetType(); + if (type == D3DRTYPE_TEXTURE) + return CastRefPrivate (tex, AddRef); + else if (type == D3DRTYPE_CUBETEXTURE) + return CastRefPrivate(tex, AddRef); + else //if(type == D3DRTYPE_VOLUMETEXTURE) + return CastRefPrivate (tex, AddRef); } inline void TextureChangePrivate(IDirect3DBaseTexture9*& dst, IDirect3DBaseTexture9* src) {