From e538242962d0f68b8234dde14ccb808099812072 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Sun, 16 Jan 2022 09:54:39 +0100 Subject: [PATCH] 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 --- core/rend/dx11/dx11_texture.cpp | 10 ++++++++++ core/rend/dx11/dx11_texture.h | 1 + 2 files changed, 11 insertions(+) diff --git a/core/rend/dx11/dx11_texture.cpp b/core/rend/dx11/dx11_texture.cpp index 5056be283..1d7c59be7 100644 --- a/core/rend/dx11/dx11_texture.cpp +++ b/core/rend/dx11/dx11_texture.cpp @@ -18,6 +18,7 @@ */ #include "dx11_texture.h" #include "dx11context.h" +#include 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()) diff --git a/core/rend/dx11/dx11_texture.h b/core/rend/dx11/dx11_texture.h index c109c641d..689583ba2 100644 --- a/core/rend/dx11/dx11_texture.h +++ b/core/rend/dx11/dx11_texture.h @@ -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