1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[d3d9] Use Texture2D for CommonTexture resolution

Using the generic texture type was a nice idea in theory, but some compilers did not give it a vtable as it was abstract, resulting in a crash here.
This commit is contained in:
Joshua Ashton 2021-08-11 04:25:29 +01:00
parent ab7fc42f2f
commit 2c8099adf1
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D

View File

@ -196,11 +196,8 @@ namespace dxvk {
};
using D3D9TextureGeneric = D3D9BaseTexture<D3D9Surface, IDirect3DBaseTexture9>;
static_assert(sizeof(D3D9Texture2D) == sizeof(D3D9Texture3D) &&
sizeof(D3D9Texture2D) == sizeof(D3D9TextureCube) &&
sizeof(D3D9Texture2D) == sizeof(D3D9TextureGeneric));
sizeof(D3D9Texture2D) == sizeof(D3D9TextureCube));
inline D3D9CommonTexture* GetCommonTexture(IDirect3DBaseTexture9* ptr) {
if (ptr == nullptr)
@ -210,7 +207,7 @@ namespace dxvk {
// no matter the texture type.
// The compiler is not smart enough to eliminate the call to GetType as it is
// not marked const.
return static_cast<D3D9TextureGeneric*>(ptr)->GetCommonTexture();
return static_cast<D3D9Texture2D*>(ptr)->GetCommonTexture();
}
inline D3D9CommonTexture* GetCommonTexture(D3D9Surface* ptr) {
@ -232,7 +229,7 @@ namespace dxvk {
// no matter the texture type.
// The compiler is not smart enough to eliminate the call to GetType as it is
// not marked const.
return CastRefPrivate<D3D9TextureGeneric>(tex, AddRef);
return CastRefPrivate<D3D9Texture2D>(tex, AddRef);
}
inline void TextureChangePrivate(IDirect3DBaseTexture9*& dst, IDirect3DBaseTexture9* src) {