summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer_cache.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-10 17:44:43 +0200
committerbunnei <bunneidev@gmail.com>2018-08-12 00:59:14 +0200
commit0471976b48d14327455bfaede7bab3a3c667f866 (patch)
tree3b79dc6e1ef09b0474e26606581a35eae1a0640f /src/video_core/renderer_opengl/gl_rasterizer_cache.h
parentMerge pull request #1016 from lioncash/video (diff)
downloadyuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar.gz
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar.bz2
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar.lz
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar.xz
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.tar.zst
yuzu-0471976b48d14327455bfaede7bab3a3c667f866.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h100
1 files changed, 57 insertions, 43 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index e24ba8cfe..826ad2930 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -23,48 +23,49 @@ using PageMap = boost::icl::interval_map<u64, int>;
struct SurfaceParams {
enum class PixelFormat {
- ABGR8 = 0,
- B5G6R5 = 1,
- A2B10G10R10 = 2,
- A1B5G5R5 = 3,
- R8 = 4,
- RGBA16F = 5,
- R11FG11FB10F = 6,
- RGBA32UI = 7,
- DXT1 = 8,
- DXT23 = 9,
- DXT45 = 10,
- DXN1 = 11, // This is also known as BC4
- DXN2UNORM = 12,
- DXN2SNORM = 13,
- BC7U = 14,
- ASTC_2D_4X4 = 15,
- G8R8 = 16,
- BGRA8 = 17,
- RGBA32F = 18,
- RG32F = 19,
- R32F = 20,
- R16F = 21,
- R16UNORM = 22,
- R16S = 23,
- R16UI = 24,
- R16I = 25,
- RG16 = 26,
- RG16F = 27,
- RG16UI = 28,
- RG16I = 29,
- RG16S = 30,
- RGB32F = 31,
- SRGBA8 = 32,
+ ABGR8U = 0,
+ ABGR8S = 1,
+ B5G6R5 = 2,
+ A2B10G10R10 = 3,
+ A1B5G5R5 = 4,
+ R8 = 5,
+ RGBA16F = 6,
+ R11FG11FB10F = 7,
+ RGBA32UI = 8,
+ DXT1 = 9,
+ DXT23 = 10,
+ DXT45 = 11,
+ DXN1 = 12, // This is also known as BC4
+ DXN2UNORM = 13,
+ DXN2SNORM = 14,
+ BC7U = 15,
+ ASTC_2D_4X4 = 16,
+ G8R8 = 17,
+ BGRA8 = 18,
+ RGBA32F = 19,
+ RG32F = 20,
+ R32F = 21,
+ R16F = 22,
+ R16UNORM = 23,
+ R16S = 24,
+ R16UI = 25,
+ R16I = 26,
+ RG16 = 27,
+ RG16F = 28,
+ RG16UI = 29,
+ RG16I = 30,
+ RG16S = 31,
+ RGB32F = 32,
+ SRGBA8 = 33,
MaxColorFormat,
// DepthStencil formats
- Z24S8 = 33,
- S8Z24 = 34,
- Z32F = 35,
- Z16 = 36,
- Z32FS8 = 37,
+ Z24S8 = 34,
+ S8Z24 = 35,
+ Z32F = 36,
+ Z16 = 37,
+ Z32FS8 = 38,
MaxDepthStencilFormat,
@@ -102,7 +103,8 @@ struct SurfaceParams {
return 0;
constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{
- 1, // ABGR8
+ 1, // ABGR8U
+ 1, // ABGR8S
1, // B5G6R5
1, // A2B10G10R10
1, // A1B5G5R5
@@ -151,7 +153,8 @@ struct SurfaceParams {
return 0;
constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
- 32, // ABGR8
+ 32, // ABGR8U
+ 32, // ABGR8S
16, // B5G6R5
32, // A2B10G10R10
16, // A1B5G5R5
@@ -223,7 +226,9 @@ struct SurfaceParams {
// gamma.
case Tegra::RenderTargetFormat::RGBA8_SRGB:
case Tegra::RenderTargetFormat::RGBA8_UNORM:
- return PixelFormat::ABGR8;
+ return PixelFormat::ABGR8U;
+ case Tegra::RenderTargetFormat::RGBA8_SNORM:
+ return PixelFormat::ABGR8S;
case Tegra::RenderTargetFormat::BGRA8_UNORM:
return PixelFormat::BGRA8;
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
@@ -275,7 +280,15 @@ struct SurfaceParams {
// TODO(Subv): Properly implement this
switch (format) {
case Tegra::Texture::TextureFormat::A8R8G8B8:
- return PixelFormat::ABGR8;
+ switch (component_type) {
+ case Tegra::Texture::ComponentType::UNORM:
+ return PixelFormat::ABGR8U;
+ case Tegra::Texture::ComponentType::SNORM:
+ return PixelFormat::ABGR8S;
+ }
+ LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
+ static_cast<u32>(component_type));
+ UNREACHABLE();
case Tegra::Texture::TextureFormat::B5G6R5:
return PixelFormat::B5G6R5;
case Tegra::Texture::TextureFormat::A2B10G10R10:
@@ -402,6 +415,7 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::R16_UNORM:
case Tegra::RenderTargetFormat::B5G6R5_UNORM:
return ComponentType::UNorm;
+ case Tegra::RenderTargetFormat::RGBA8_SNORM:
case Tegra::RenderTargetFormat::RG16_SNORM:
case Tegra::RenderTargetFormat::R16_SNORM:
return ComponentType::SNorm;
@@ -429,7 +443,7 @@ struct SurfaceParams {
static PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) {
switch (format) {
case Tegra::FramebufferConfig::PixelFormat::ABGR8:
- return PixelFormat::ABGR8;
+ return PixelFormat::ABGR8U;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();