mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
GPU: Use the right texture format for sRGBA framebuffers.
This commit is contained in:
parent
0686183c3e
commit
c5b838aeef
|
@ -113,6 +113,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
||||||
{GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
|
{GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
|
||||||
{GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
|
{GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
|
||||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
|
{GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
|
||||||
|
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
|
||||||
|
@ -209,9 +210,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
||||||
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
|
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
|
||||||
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
|
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
|
||||||
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
|
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
|
||||||
MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
|
MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::SRGBA8>,
|
||||||
MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
|
MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
|
||||||
MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
|
MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
|
||||||
|
MortonCopy<true, PixelFormat::Z32FS8>,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
||||||
|
@ -239,6 +241,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
|
||||||
MortonCopy<false, PixelFormat::R32F>,
|
MortonCopy<false, PixelFormat::R32F>,
|
||||||
MortonCopy<false, PixelFormat::R16F>,
|
MortonCopy<false, PixelFormat::R16F>,
|
||||||
MortonCopy<false, PixelFormat::R16UNORM>,
|
MortonCopy<false, PixelFormat::R16UNORM>,
|
||||||
|
MortonCopy<false, PixelFormat::SRGBA8>,
|
||||||
MortonCopy<false, PixelFormat::Z24S8>,
|
MortonCopy<false, PixelFormat::Z24S8>,
|
||||||
MortonCopy<false, PixelFormat::S8Z24>,
|
MortonCopy<false, PixelFormat::S8Z24>,
|
||||||
MortonCopy<false, PixelFormat::Z32F>,
|
MortonCopy<false, PixelFormat::Z32F>,
|
||||||
|
|
|
@ -43,15 +43,16 @@ struct SurfaceParams {
|
||||||
R32F = 18,
|
R32F = 18,
|
||||||
R16F = 19,
|
R16F = 19,
|
||||||
R16UNORM = 20,
|
R16UNORM = 20,
|
||||||
|
SRGBA8 = 21,
|
||||||
|
|
||||||
MaxColorFormat,
|
MaxColorFormat,
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
Z24S8 = 21,
|
Z24S8 = 22,
|
||||||
S8Z24 = 22,
|
S8Z24 = 23,
|
||||||
Z32F = 23,
|
Z32F = 24,
|
||||||
Z16 = 24,
|
Z16 = 25,
|
||||||
Z32FS8 = 25,
|
Z32FS8 = 26,
|
||||||
|
|
||||||
MaxDepthStencilFormat,
|
MaxDepthStencilFormat,
|
||||||
|
|
||||||
|
@ -110,6 +111,7 @@ struct SurfaceParams {
|
||||||
1, // R32F
|
1, // R32F
|
||||||
1, // R16F
|
1, // R16F
|
||||||
1, // R16UNORM
|
1, // R16UNORM
|
||||||
|
1, // SRGBA8
|
||||||
1, // Z24S8
|
1, // Z24S8
|
||||||
1, // S8Z24
|
1, // S8Z24
|
||||||
1, // Z32F
|
1, // Z32F
|
||||||
|
@ -147,6 +149,7 @@ struct SurfaceParams {
|
||||||
32, // R32F
|
32, // R32F
|
||||||
16, // R16F
|
16, // R16F
|
||||||
16, // R16UNORM
|
16, // R16UNORM
|
||||||
|
32, // SRGBA8
|
||||||
32, // Z24S8
|
32, // Z24S8
|
||||||
32, // S8Z24
|
32, // S8Z24
|
||||||
32, // Z32F
|
32, // Z32F
|
||||||
|
@ -182,8 +185,9 @@ struct SurfaceParams {
|
||||||
|
|
||||||
static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
|
static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case Tegra::RenderTargetFormat::RGBA8_UNORM:
|
|
||||||
case Tegra::RenderTargetFormat::RGBA8_SRGB:
|
case Tegra::RenderTargetFormat::RGBA8_SRGB:
|
||||||
|
return PixelFormat::SRGBA8;
|
||||||
|
case Tegra::RenderTargetFormat::RGBA8_UNORM:
|
||||||
return PixelFormat::ABGR8;
|
return PixelFormat::ABGR8;
|
||||||
case Tegra::RenderTargetFormat::BGRA8_UNORM:
|
case Tegra::RenderTargetFormat::BGRA8_UNORM:
|
||||||
return PixelFormat::BGRA8;
|
return PixelFormat::BGRA8;
|
||||||
|
@ -276,6 +280,7 @@ struct SurfaceParams {
|
||||||
// TODO(Subv): Properly implement this
|
// TODO(Subv): Properly implement this
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case PixelFormat::ABGR8:
|
case PixelFormat::ABGR8:
|
||||||
|
case PixelFormat::SRGBA8:
|
||||||
return Tegra::Texture::TextureFormat::A8R8G8B8;
|
return Tegra::Texture::TextureFormat::A8R8G8B8;
|
||||||
case PixelFormat::B5G6R5:
|
case PixelFormat::B5G6R5:
|
||||||
return Tegra::Texture::TextureFormat::B5G6R5;
|
return Tegra::Texture::TextureFormat::B5G6R5;
|
||||||
|
|
Loading…
Reference in a new issue