diff options
| author | 2018-06-30 14:23:13 -0500 | |
|---|---|---|
| committer | 2018-06-30 14:23:13 -0500 | |
| commit | c0e2d5275814e6d3fe15d1b8abb0f057c0e5d155 (patch) | |
| tree | 9fd9e83b437c5103fe4095d09dc111c91d95f221 /src | |
| parent | GLCache: Specify the component type along the texture type in the format tuple. (diff) | |
| download | yuzu-c0e2d5275814e6d3fe15d1b8abb0f057c0e5d155.tar.gz yuzu-c0e2d5275814e6d3fe15d1b8abb0f057c0e5d155.tar.xz yuzu-c0e2d5275814e6d3fe15d1b8abb0f057c0e5d155.zip | |
GPU: Implemented the RGBA32_UINT rendertarget format.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/gpu.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 21 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 4 |
4 files changed, 28 insertions, 9 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 7b4e9b842..d0a4ac267 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -16,6 +16,7 @@ namespace Tegra { | |||
| 16 | enum class RenderTargetFormat : u32 { | 16 | enum class RenderTargetFormat : u32 { |
| 17 | NONE = 0x0, | 17 | NONE = 0x0, |
| 18 | RGBA32_FLOAT = 0xC0, | 18 | RGBA32_FLOAT = 0xC0, |
| 19 | RGBA32_UINT = 0xC2, | ||
| 19 | RGBA16_FLOAT = 0xCA, | 20 | RGBA16_FLOAT = 0xCA, |
| 20 | RGB10_A2_UNORM = 0xD1, | 21 | RGB10_A2_UNORM = 0xD1, |
| 21 | RGBA8_UNORM = 0xD5, | 22 | RGBA8_UNORM = 0xD5, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 2864a7c8e..ae48378f3 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -74,7 +74,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 74 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 | 74 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 |
| 75 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F | 75 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F |
| 76 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, | 76 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, |
| 77 | false}, // R11FG11FB10F | 77 | false}, // R11FG11FB10F |
| 78 | {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RGBA32UI | ||
| 78 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, | 79 | {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| 79 | true}, // DXT1 | 80 | true}, // DXT1 |
| 80 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, | 81 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| @@ -170,9 +171,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 170 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, | 171 | MortonCopy<true, PixelFormat::ABGR8>, MortonCopy<true, PixelFormat::B5G6R5>, |
| 171 | MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>, | 172 | MortonCopy<true, PixelFormat::A2B10G10R10>, MortonCopy<true, PixelFormat::A1B5G5R5>, |
| 172 | MortonCopy<true, PixelFormat::R8>, MortonCopy<true, PixelFormat::RGBA16F>, | 173 | MortonCopy<true, PixelFormat::R8>, MortonCopy<true, PixelFormat::RGBA16F>, |
| 173 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::DXT1>, | 174 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, |
| 174 | MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, | 175 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, |
| 175 | MortonCopy<true, PixelFormat::DXN1>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 176 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 177 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | ||
| 176 | }; | 178 | }; |
| 177 | 179 | ||
| 178 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 180 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -185,6 +187,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 185 | MortonCopy<false, PixelFormat::R8>, | 187 | MortonCopy<false, PixelFormat::R8>, |
| 186 | MortonCopy<false, PixelFormat::RGBA16F>, | 188 | MortonCopy<false, PixelFormat::RGBA16F>, |
| 187 | MortonCopy<false, PixelFormat::R11FG11FB10F>, | 189 | MortonCopy<false, PixelFormat::R11FG11FB10F>, |
| 190 | MortonCopy<false, PixelFormat::RGBA32UI>, | ||
| 188 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1 formats is not yet supported | 191 | // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1 formats is not yet supported |
| 189 | nullptr, | 192 | nullptr, |
| 190 | nullptr, | 193 | nullptr, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 85e7c8888..99be250b4 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -30,11 +30,12 @@ struct SurfaceParams { | |||
| 30 | R8 = 4, | 30 | R8 = 4, |
| 31 | RGBA16F = 5, | 31 | RGBA16F = 5, |
| 32 | R11FG11FB10F = 6, | 32 | R11FG11FB10F = 6, |
| 33 | DXT1 = 7, | 33 | RGBA32UI = 7, |
| 34 | DXT23 = 8, | 34 | DXT1 = 8, |
| 35 | DXT45 = 9, | 35 | DXT23 = 9, |
| 36 | DXN1 = 10, // This is also known as BC4 | 36 | DXT45 = 10, |
| 37 | ASTC_2D_4X4 = 11, | 37 | DXN1 = 11, // This is also known as BC4 |
| 38 | ASTC_2D_4X4 = 12, | ||
| 38 | 39 | ||
| 39 | Max, | 40 | Max, |
| 40 | Invalid = 255, | 41 | Invalid = 255, |
| @@ -77,6 +78,7 @@ struct SurfaceParams { | |||
| 77 | 1, // R8 | 78 | 1, // R8 |
| 78 | 1, // RGBA16F | 79 | 1, // RGBA16F |
| 79 | 1, // R11FG11FB10F | 80 | 1, // R11FG11FB10F |
| 81 | 1, // RGBA32UI | ||
| 80 | 4, // DXT1 | 82 | 4, // DXT1 |
| 81 | 4, // DXT23 | 83 | 4, // DXT23 |
| 82 | 4, // DXT45 | 84 | 4, // DXT45 |
| @@ -100,6 +102,7 @@ struct SurfaceParams { | |||
| 100 | 8, // R8 | 102 | 8, // R8 |
| 101 | 64, // RGBA16F | 103 | 64, // RGBA16F |
| 102 | 32, // R11FG11FB10F | 104 | 32, // R11FG11FB10F |
| 105 | 128, // RGBA32UI | ||
| 103 | 64, // DXT1 | 106 | 64, // DXT1 |
| 104 | 128, // DXT23 | 107 | 128, // DXT23 |
| 105 | 128, // DXT45 | 108 | 128, // DXT45 |
| @@ -125,6 +128,8 @@ struct SurfaceParams { | |||
| 125 | return PixelFormat::RGBA16F; | 128 | return PixelFormat::RGBA16F; |
| 126 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 129 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 127 | return PixelFormat::R11FG11FB10F; | 130 | return PixelFormat::R11FG11FB10F; |
| 131 | case Tegra::RenderTargetFormat::RGBA32_UINT: | ||
| 132 | return PixelFormat::RGBA32UI; | ||
| 128 | default: | 133 | default: |
| 129 | NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 134 | NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 130 | UNREACHABLE(); | 135 | UNREACHABLE(); |
| @@ -148,6 +153,8 @@ struct SurfaceParams { | |||
| 148 | return PixelFormat::RGBA16F; | 153 | return PixelFormat::RGBA16F; |
| 149 | case Tegra::Texture::TextureFormat::BF10GF11RF11: | 154 | case Tegra::Texture::TextureFormat::BF10GF11RF11: |
| 150 | return PixelFormat::R11FG11FB10F; | 155 | return PixelFormat::R11FG11FB10F; |
| 156 | case Tegra::Texture::TextureFormat::R32_G32_B32_A32: | ||
| 157 | return PixelFormat::RGBA32UI; | ||
| 151 | case Tegra::Texture::TextureFormat::DXT1: | 158 | case Tegra::Texture::TextureFormat::DXT1: |
| 152 | return PixelFormat::DXT1; | 159 | return PixelFormat::DXT1; |
| 153 | case Tegra::Texture::TextureFormat::DXT23: | 160 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -181,6 +188,8 @@ struct SurfaceParams { | |||
| 181 | return Tegra::Texture::TextureFormat::R16_G16_B16_A16; | 188 | return Tegra::Texture::TextureFormat::R16_G16_B16_A16; |
| 182 | case PixelFormat::R11FG11FB10F: | 189 | case PixelFormat::R11FG11FB10F: |
| 183 | return Tegra::Texture::TextureFormat::BF10GF11RF11; | 190 | return Tegra::Texture::TextureFormat::BF10GF11RF11; |
| 191 | case PixelFormat::RGBA32UI: | ||
| 192 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | ||
| 184 | case PixelFormat::DXT1: | 193 | case PixelFormat::DXT1: |
| 185 | return Tegra::Texture::TextureFormat::DXT1; | 194 | return Tegra::Texture::TextureFormat::DXT1; |
| 186 | case PixelFormat::DXT23: | 195 | case PixelFormat::DXT23: |
| @@ -217,6 +226,8 @@ struct SurfaceParams { | |||
| 217 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 226 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 218 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 227 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 219 | return ComponentType::Float; | 228 | return ComponentType::Float; |
| 229 | case Tegra::RenderTargetFormat::RGBA32_UINT: | ||
| 230 | return ComponentType::UInt; | ||
| 220 | default: | 231 | default: |
| 221 | NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 232 | NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 222 | UNREACHABLE(); | 233 | UNREACHABLE(); |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 0db4367f1..eaf15da32 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -65,6 +65,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 65 | return 1; | 65 | return 1; |
| 66 | case TextureFormat::R16_G16_B16_A16: | 66 | case TextureFormat::R16_G16_B16_A16: |
| 67 | return 8; | 67 | return 8; |
| 68 | case TextureFormat::R32_G32_B32_A32: | ||
| 69 | return 16; | ||
| 68 | default: | 70 | default: |
| 69 | UNIMPLEMENTED_MSG("Format not implemented"); | 71 | UNIMPLEMENTED_MSG("Format not implemented"); |
| 70 | break; | 72 | break; |
| @@ -94,6 +96,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 94 | case TextureFormat::B5G6R5: | 96 | case TextureFormat::B5G6R5: |
| 95 | case TextureFormat::R8: | 97 | case TextureFormat::R8: |
| 96 | case TextureFormat::R16_G16_B16_A16: | 98 | case TextureFormat::R16_G16_B16_A16: |
| 99 | case TextureFormat::R32_G32_B32_A32: | ||
| 97 | case TextureFormat::BF10GF11RF11: | 100 | case TextureFormat::BF10GF11RF11: |
| 98 | case TextureFormat::ASTC_2D_4X4: | 101 | case TextureFormat::ASTC_2D_4X4: |
| 99 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 102 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| @@ -124,6 +127,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 124 | case TextureFormat::B5G6R5: | 127 | case TextureFormat::B5G6R5: |
| 125 | case TextureFormat::R8: | 128 | case TextureFormat::R8: |
| 126 | case TextureFormat::BF10GF11RF11: | 129 | case TextureFormat::BF10GF11RF11: |
| 130 | case TextureFormat::R32_G32_B32_A32: | ||
| 127 | // TODO(Subv): For the time being just forward the same data without any decoding. | 131 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 128 | rgba_data = texture_data; | 132 | rgba_data = texture_data; |
| 129 | break; | 133 | break; |