diff options
| author | 2018-07-23 22:21:31 -0500 | |
|---|---|---|
| committer | 2018-07-23 22:21:31 -0500 | |
| commit | ccc42702b53ac7585cc3a0db6dc5691875528167 (patch) | |
| tree | e9e9ac49fe9de96ab3fcfbcee4e6307370b87d23 /src | |
| parent | Merge pull request #791 from bunnei/rg32f-rgba32f-bgra8 (diff) | |
| download | yuzu-ccc42702b53ac7585cc3a0db6dc5691875528167.tar.gz yuzu-ccc42702b53ac7585cc3a0db6dc5691875528167.tar.xz yuzu-ccc42702b53ac7585cc3a0db6dc5691875528167.zip | |
GPU: Implement texture format R32F.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 15 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 8f99864a0..1d3aff97b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -110,6 +110,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 110 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 | 110 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 |
| 111 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F | 111 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F |
| 112 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F | 112 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F |
| 113 | {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F | ||
| 113 | 114 | ||
| 114 | // DepthStencil formats | 115 | // DepthStencil formats |
| 115 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, | 116 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, |
| @@ -203,8 +204,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 203 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 204 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 204 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, | 205 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 205 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, | 206 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, |
| 206 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, | 207 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>, |
| 207 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, | 208 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, |
| 209 | MortonCopy<true, PixelFormat::Z16>, | ||
| 208 | }; | 210 | }; |
| 209 | 211 | ||
| 210 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 212 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -229,6 +231,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 229 | MortonCopy<false, PixelFormat::BGRA8>, | 231 | MortonCopy<false, PixelFormat::BGRA8>, |
| 230 | MortonCopy<false, PixelFormat::RGBA32F>, | 232 | MortonCopy<false, PixelFormat::RGBA32F>, |
| 231 | MortonCopy<false, PixelFormat::RG32F>, | 233 | MortonCopy<false, PixelFormat::RG32F>, |
| 234 | MortonCopy<false, PixelFormat::R32F>, | ||
| 232 | MortonCopy<false, PixelFormat::Z24S8>, | 235 | MortonCopy<false, PixelFormat::Z24S8>, |
| 233 | MortonCopy<false, PixelFormat::S8Z24>, | 236 | MortonCopy<false, PixelFormat::S8Z24>, |
| 234 | MortonCopy<false, PixelFormat::Z32F>, | 237 | MortonCopy<false, PixelFormat::Z32F>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 23efbe67c..800d239d9 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -40,14 +40,15 @@ struct SurfaceParams { | |||
| 40 | BGRA8 = 15, | 40 | BGRA8 = 15, |
| 41 | RGBA32F = 16, | 41 | RGBA32F = 16, |
| 42 | RG32F = 17, | 42 | RG32F = 17, |
| 43 | R32F = 18, | ||
| 43 | 44 | ||
| 44 | MaxColorFormat, | 45 | MaxColorFormat, |
| 45 | 46 | ||
| 46 | // DepthStencil formats | 47 | // DepthStencil formats |
| 47 | Z24S8 = 18, | 48 | Z24S8 = 19, |
| 48 | S8Z24 = 19, | 49 | S8Z24 = 20, |
| 49 | Z32F = 20, | 50 | Z32F = 21, |
| 50 | Z16 = 21, | 51 | Z16 = 22, |
| 51 | 52 | ||
| 52 | MaxDepthStencilFormat, | 53 | MaxDepthStencilFormat, |
| 53 | 54 | ||
| @@ -103,6 +104,7 @@ struct SurfaceParams { | |||
| 103 | 1, // BGRA8 | 104 | 1, // BGRA8 |
| 104 | 1, // RGBA32F | 105 | 1, // RGBA32F |
| 105 | 1, // RG32F | 106 | 1, // RG32F |
| 107 | 1, // R32F | ||
| 106 | 1, // Z24S8 | 108 | 1, // Z24S8 |
| 107 | 1, // S8Z24 | 109 | 1, // S8Z24 |
| 108 | 1, // Z32F | 110 | 1, // Z32F |
| @@ -136,6 +138,7 @@ struct SurfaceParams { | |||
| 136 | 32, // BGRA8 | 138 | 32, // BGRA8 |
| 137 | 128, // RGBA32F | 139 | 128, // RGBA32F |
| 138 | 64, // RG32F | 140 | 64, // RG32F |
| 141 | 32, // R32F | ||
| 139 | 32, // Z24S8 | 142 | 32, // Z24S8 |
| 140 | 32, // S8Z24 | 143 | 32, // S8Z24 |
| 141 | 32, // Z32F | 144 | 32, // Z32F |
| @@ -223,6 +226,8 @@ struct SurfaceParams { | |||
| 223 | UNREACHABLE(); | 226 | UNREACHABLE(); |
| 224 | case Tegra::Texture::TextureFormat::R32_G32: | 227 | case Tegra::Texture::TextureFormat::R32_G32: |
| 225 | return PixelFormat::RG32F; | 228 | return PixelFormat::RG32F; |
| 229 | case Tegra::Texture::TextureFormat::R32: | ||
| 230 | return PixelFormat::R32F; | ||
| 226 | case Tegra::Texture::TextureFormat::DXT1: | 231 | case Tegra::Texture::TextureFormat::DXT1: |
| 227 | return PixelFormat::DXT1; | 232 | return PixelFormat::DXT1; |
| 228 | case Tegra::Texture::TextureFormat::DXT23: | 233 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -283,6 +288,8 @@ struct SurfaceParams { | |||
| 283 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | 288 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; |
| 284 | case PixelFormat::RG32F: | 289 | case PixelFormat::RG32F: |
| 285 | return Tegra::Texture::TextureFormat::R32_G32; | 290 | return Tegra::Texture::TextureFormat::R32_G32; |
| 291 | case PixelFormat::R32F: | ||
| 292 | return Tegra::Texture::TextureFormat::R32; | ||
| 286 | default: | 293 | default: |
| 287 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 294 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 288 | UNREACHABLE(); | 295 | UNREACHABLE(); |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index e5e9e1898..cda2646ad 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -61,6 +61,7 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 61 | case TextureFormat::A8R8G8B8: | 61 | case TextureFormat::A8R8G8B8: |
| 62 | case TextureFormat::A2B10G10R10: | 62 | case TextureFormat::A2B10G10R10: |
| 63 | case TextureFormat::BF10GF11RF11: | 63 | case TextureFormat::BF10GF11RF11: |
| 64 | case TextureFormat::R32: | ||
| 64 | return 4; | 65 | return 4; |
| 65 | case TextureFormat::A1B5G5R5: | 66 | case TextureFormat::A1B5G5R5: |
| 66 | case TextureFormat::B5G6R5: | 67 | case TextureFormat::B5G6R5: |
| @@ -121,6 +122,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 121 | case TextureFormat::R16_G16_B16_A16: | 122 | case TextureFormat::R16_G16_B16_A16: |
| 122 | case TextureFormat::R32_G32_B32_A32: | 123 | case TextureFormat::R32_G32_B32_A32: |
| 123 | case TextureFormat::R32_G32: | 124 | case TextureFormat::R32_G32: |
| 125 | case TextureFormat::R32: | ||
| 124 | case TextureFormat::BF10GF11RF11: | 126 | case TextureFormat::BF10GF11RF11: |
| 125 | case TextureFormat::ASTC_2D_4X4: | 127 | case TextureFormat::ASTC_2D_4X4: |
| 126 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 128 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| @@ -178,6 +180,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 178 | case TextureFormat::BF10GF11RF11: | 180 | case TextureFormat::BF10GF11RF11: |
| 179 | case TextureFormat::R32_G32_B32_A32: | 181 | case TextureFormat::R32_G32_B32_A32: |
| 180 | case TextureFormat::R32_G32: | 182 | case TextureFormat::R32_G32: |
| 183 | case TextureFormat::R32: | ||
| 181 | // TODO(Subv): For the time being just forward the same data without any decoding. | 184 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 182 | rgba_data = texture_data; | 185 | rgba_data = texture_data; |
| 183 | break; | 186 | break; |