dx11: convert 16-bit textures to 32 bits on windows7

1555, 4444 and 565 aren't supported on win7
Issue: https://github.com/libretro/flycast/issues/1123
This commit is contained in:
Flyinghead 2022-01-16 09:54:39 +01:00
parent d70d2ad405
commit e538242962
2 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,7 @@
*/
#include "dx11_texture.h"
#include "dx11context.h"
#include <VersionHelpers.h>
void DX11Texture::UploadToGPU(int width, int height, u8* temp_tex_buffer, bool mipmapped, bool mipmapsIncluded)
{
@ -108,6 +109,15 @@ void DX11Texture::UploadToGPU(int width, int height, u8* temp_tex_buffer, bool m
theDX11Context.getDeviceContext()->GenerateMips(textureView);
}
bool DX11Texture::Force32BitTexture(TextureType type) const
{
if (IsWindows8OrGreater())
return false;
// DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM and DXGI_FORMAT_B5G6R5_UNORM
// are not supported on Windows 7
return type == TextureType::_565 || type == TextureType::_5551 || type == TextureType::_4444;
}
bool DX11Texture::Delete()
{
if (!BaseTextureCacheData::Delete())

View File

@ -33,6 +33,7 @@ public:
bool mipmapsIncluded = false) override;
bool Delete() override;
void loadCustomTexture();
bool Force32BitTexture(TextureType type) const override;
};
class DX11TextureCache final : public BaseTextureCache<DX11Texture>