diff --git a/src/util/d3d_common.cpp b/src/util/d3d_common.cpp index 1bd942d29..937c52895 100644 --- a/src/util/d3d_common.cpp +++ b/src/util/d3d_common.cpp @@ -633,6 +633,7 @@ static constexpr std::array(GPUTe {DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN }, // BGRA8 {DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_UNKNOWN }, // RGB565 {DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN }, // RGB5A1 + {DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // A1BGR5 {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN }, // R8 {DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D16_UNORM }, // D16 {DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D24S8 diff --git a/src/util/gpu_texture.cpp b/src/util/gpu_texture.cpp index deeaec939..99f5623fc 100644 --- a/src/util/gpu_texture.cpp +++ b/src/util/gpu_texture.cpp @@ -31,6 +31,7 @@ const char* GPUTexture::GetFormatName(Format format) "BGRA8", // BGRA8 "RGB565", // RGB565 "RGB5A1", // RGB5A1 + "A1BGR5", // A1BGR5 "R8", // R8 "D16", // D16 "D24S8", // D24S8 @@ -152,6 +153,7 @@ GPUTexture::Format GPUTexture::GetTextureFormatForImageFormat(ImageFormat format Format::BGRA8, // BGRA8 Format::RGB565, // RGB565 Format::RGB5A1, // RGB5A1 + Format::A1BGR5, // A1BGR5 Format::Unknown, // BGR8 Format::BC1, // BC1 Format::BC2, // BC2 @@ -171,6 +173,7 @@ ImageFormat GPUTexture::GetImageFormatForTextureFormat(Format format) ImageFormat::BGRA8, // BGRA8 ImageFormat::RGB565, // RGB565 ImageFormat::RGB5A1, // RGB5A1 + ImageFormat::A1BGR5, // A1BGR5 ImageFormat::None, // R8 ImageFormat::None, // D16 ImageFormat::None, // D24S8 @@ -253,6 +256,7 @@ u32 GPUTexture::GetPixelSize(GPUTexture::Format format) 4, // BGRA8 2, // RGB565 2, // RGB5A1 + 2, // A1BGR5 1, // R8 2, // D16 4, // D24S8 diff --git a/src/util/gpu_texture.h b/src/util/gpu_texture.h index e243da148..40e4be872 100644 --- a/src/util/gpu_texture.h +++ b/src/util/gpu_texture.h @@ -44,6 +44,7 @@ public: BGRA8, RGB565, RGB5A1, + A1BGR5, R8, D16, D24S8, diff --git a/src/util/image.cpp b/src/util/image.cpp index 632e243b0..4b635a5bd 100644 --- a/src/util/image.cpp +++ b/src/util/image.cpp @@ -168,6 +168,7 @@ const char* Image::GetFormatName(ImageFormat format) "BGRA8", // BGRA8 "RGB565", // RGB565 "RGB5A1", // RGB5A1 + "A1BGR5", // A1BGR5 "BGR8", // BGR8 "BC1", // BC1 "BC2", // BC2 @@ -187,6 +188,7 @@ u32 Image::GetPixelSize(ImageFormat format) 4, // BGRA8 2, // RGB565 2, // RGB5A1 + 2, // A1BGR5 3, // BGR8 8, // BC1 - 16 pixels in 64 bits 16, // BC2 - 16 pixels in 128 bits diff --git a/src/util/image.h b/src/util/image.h index c57548e0f..bf02899d7 100644 --- a/src/util/image.h +++ b/src/util/image.h @@ -21,6 +21,7 @@ enum class ImageFormat : u8 BGRA8, RGB565, RGB5A1, + A1BGR5, BGR8, BC1, BC2, diff --git a/src/util/metal_device.mm b/src/util/metal_device.mm index 745606ba6..825476aae 100644 --- a/src/util/metal_device.mm +++ b/src/util/metal_device.mm @@ -51,6 +51,7 @@ static constexpr std::array(GPUTexture::Format: MTLPixelFormatBGRA8Unorm, // BGRA8 MTLPixelFormatB5G6R5Unorm, // RGB565 MTLPixelFormatBGR5A1Unorm, // RGB5A1 + MTLPixelFormatInvalid, // A1BGR5 MTLPixelFormatR8Unorm, // R8 MTLPixelFormatDepth16Unorm, // D16 MTLPixelFormatDepth24Unorm_Stencil8, // D24S8 diff --git a/src/util/opengl_texture.cpp b/src/util/opengl_texture.cpp index 1b04fb5f7..285466b16 100644 --- a/src/util/opengl_texture.cpp +++ b/src/util/opengl_texture.cpp @@ -37,7 +37,8 @@ const std::tuple& OpenGLTexture::GetPixelFormatMapping(G {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // RGBA8 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8 {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565 - {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGB5A1 + {}, // RGB5A1 + {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1}, // A1BGR5 {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT}, // D24S8 @@ -71,7 +72,8 @@ const std::tuple& OpenGLTexture::GetPixelFormatMapping(G {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // RGBA8 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8 {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565 - {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGB5A1 + {}, // RGB5A1 + {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1}, // A1BGR5 {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT}, // D24S8 diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index d88b0f2b9..00979ec85 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -76,6 +76,7 @@ const std::array(GPUTexture::Format::MaxCount)> Vulka VK_FORMAT_B8G8R8A8_UNORM, // BGRA8 VK_FORMAT_R5G6B5_UNORM_PACK16, // RGB565 VK_FORMAT_A1R5G5B5_UNORM_PACK16, // RGB5A1 + VK_FORMAT_B5G5R5A1_UNORM_PACK16, // A1BGR5 VK_FORMAT_R8_UNORM, // R8 VK_FORMAT_D16_UNORM, // D16 VK_FORMAT_D24_UNORM_S8_UINT, // D24S8