GPUTexture: Add A1BGR5 format
Needed for GLES, since RGB5A1 + BGRA + REV isn't listed as a valid format.
This commit is contained in:
parent
dbba8deb4b
commit
8c5fadafba
|
@ -633,6 +633,7 @@ static constexpr std::array<D3DCommon::DXGIFormatMapping, static_cast<int>(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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
BGRA8,
|
||||
RGB565,
|
||||
RGB5A1,
|
||||
A1BGR5,
|
||||
R8,
|
||||
D16,
|
||||
D24S8,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,6 +21,7 @@ enum class ImageFormat : u8
|
|||
BGRA8,
|
||||
RGB565,
|
||||
RGB5A1,
|
||||
A1BGR5,
|
||||
BGR8,
|
||||
BC1,
|
||||
BC2,
|
||||
|
|
|
@ -51,6 +51,7 @@ static constexpr std::array<MTLPixelFormat, static_cast<u32>(GPUTexture::Format:
|
|||
MTLPixelFormatBGRA8Unorm, // BGRA8
|
||||
MTLPixelFormatB5G6R5Unorm, // RGB565
|
||||
MTLPixelFormatBGR5A1Unorm, // RGB5A1
|
||||
MTLPixelFormatInvalid, // A1BGR5
|
||||
MTLPixelFormatR8Unorm, // R8
|
||||
MTLPixelFormatDepth16Unorm, // D16
|
||||
MTLPixelFormatDepth24Unorm_Stencil8, // D24S8
|
||||
|
|
|
@ -37,7 +37,8 @@ const std::tuple<GLenum, GLenum, GLenum>& 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<GLenum, GLenum, GLenum>& 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
|
||||
|
|
|
@ -76,6 +76,7 @@ const std::array<VkFormat, static_cast<u32>(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
|
||||
|
|
Loading…
Reference in New Issue