diff options
| author | 2018-07-23 17:12:16 -0400 | |
|---|---|---|
| committer | 2018-07-23 21:22:53 -0400 | |
| commit | 3a19c1098d4d4242ad466f06f2b1df6c17728f4a (patch) | |
| tree | 897776d0987cfd35448da78af33b103e97c883c2 /src | |
| parent | gl_rasterizer_cache: Implement RenderTargetFormat BGRA8_UNORM. (diff) | |
| download | yuzu-3a19c1098d4d4242ad466f06f2b1df6c17728f4a.tar.gz yuzu-3a19c1098d4d4242ad466f06f2b1df6c17728f4a.tar.xz yuzu-3a19c1098d4d4242ad466f06f2b1df6c17728f4a.zip | |
gl_rasterizer_cache: Implement RenderTargetFormat RGBA32_FLOAT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 34 |
2 files changed, 34 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 02bd0fa7b..133a15a12 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -38,7 +38,8 @@ struct FormatTuple { | |||
| 38 | params.addr = config.tic.Address(); | 38 | params.addr = config.tic.Address(); |
| 39 | params.is_tiled = config.tic.IsTiled(); | 39 | params.is_tiled = config.tic.IsTiled(); |
| 40 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, | 40 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, |
| 41 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format); | 41 | params.pixel_format = |
| 42 | PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value()); | ||
| 42 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); | 43 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); |
| 43 | params.type = GetFormatType(params.pixel_format); | 44 | params.type = GetFormatType(params.pixel_format); |
| 44 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); | 45 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); |
| @@ -107,6 +108,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 107 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 | 108 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 |
| 108 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 | 109 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 |
| 109 | {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 | ||
| 110 | 112 | ||
| 111 | // DepthStencil formats | 113 | // DepthStencil formats |
| 112 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, | 114 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, |
| @@ -199,8 +201,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 199 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, | 201 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 200 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 202 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 201 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, | 203 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 202 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, | 204 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::Z24S8>, |
| 203 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, | 205 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, |
| 206 | MortonCopy<true, PixelFormat::Z16>, | ||
| 204 | }; | 207 | }; |
| 205 | 208 | ||
| 206 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 209 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -223,6 +226,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 223 | nullptr, | 226 | nullptr, |
| 224 | MortonCopy<false, PixelFormat::G8R8>, | 227 | MortonCopy<false, PixelFormat::G8R8>, |
| 225 | MortonCopy<false, PixelFormat::BGRA8>, | 228 | MortonCopy<false, PixelFormat::BGRA8>, |
| 229 | MortonCopy<false, PixelFormat::RGBA32F>, | ||
| 226 | MortonCopy<false, PixelFormat::Z24S8>, | 230 | MortonCopy<false, PixelFormat::Z24S8>, |
| 227 | MortonCopy<false, PixelFormat::S8Z24>, | 231 | MortonCopy<false, PixelFormat::S8Z24>, |
| 228 | MortonCopy<false, PixelFormat::Z32F>, | 232 | 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 c0f94936e..2feea3d4d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -38,14 +38,15 @@ struct SurfaceParams { | |||
| 38 | ASTC_2D_4X4 = 13, | 38 | ASTC_2D_4X4 = 13, |
| 39 | G8R8 = 14, | 39 | G8R8 = 14, |
| 40 | BGRA8 = 15, | 40 | BGRA8 = 15, |
| 41 | RGBA32F = 16, | ||
| 41 | 42 | ||
| 42 | MaxColorFormat, | 43 | MaxColorFormat, |
| 43 | 44 | ||
| 44 | // DepthStencil formats | 45 | // DepthStencil formats |
| 45 | Z24S8 = 16, | 46 | Z24S8 = 17, |
| 46 | S8Z24 = 17, | 47 | S8Z24 = 18, |
| 47 | Z32F = 18, | 48 | Z32F = 19, |
| 48 | Z16 = 19, | 49 | Z16 = 20, |
| 49 | 50 | ||
| 50 | MaxDepthStencilFormat, | 51 | MaxDepthStencilFormat, |
| 51 | 52 | ||
| @@ -99,6 +100,7 @@ struct SurfaceParams { | |||
| 99 | 4, // ASTC_2D_4X4 | 100 | 4, // ASTC_2D_4X4 |
| 100 | 1, // G8R8 | 101 | 1, // G8R8 |
| 101 | 1, // BGRA8 | 102 | 1, // BGRA8 |
| 103 | 1, // RGBA32F | ||
| 102 | 1, // Z24S8 | 104 | 1, // Z24S8 |
| 103 | 1, // S8Z24 | 105 | 1, // S8Z24 |
| 104 | 1, // Z32F | 106 | 1, // Z32F |
| @@ -130,6 +132,7 @@ struct SurfaceParams { | |||
| 130 | 32, // ASTC_2D_4X4 | 132 | 32, // ASTC_2D_4X4 |
| 131 | 16, // G8R8 | 133 | 16, // G8R8 |
| 132 | 32, // BGRA8 | 134 | 32, // BGRA8 |
| 135 | 128, // RGBA32F | ||
| 133 | 32, // Z24S8 | 136 | 32, // Z24S8 |
| 134 | 32, // S8Z24 | 137 | 32, // S8Z24 |
| 135 | 32, // Z32F | 138 | 32, // Z32F |
| @@ -171,6 +174,8 @@ struct SurfaceParams { | |||
| 171 | return PixelFormat::A2B10G10R10; | 174 | return PixelFormat::A2B10G10R10; |
| 172 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 175 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 173 | return PixelFormat::RGBA16F; | 176 | return PixelFormat::RGBA16F; |
| 177 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | ||
| 178 | return PixelFormat::RGBA32F; | ||
| 174 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 179 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 175 | return PixelFormat::R11FG11FB10F; | 180 | return PixelFormat::R11FG11FB10F; |
| 176 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 181 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| @@ -181,7 +186,8 @@ struct SurfaceParams { | |||
| 181 | } | 186 | } |
| 182 | } | 187 | } |
| 183 | 188 | ||
| 184 | static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format) { | 189 | static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format, |
| 190 | Tegra::Texture::ComponentType component_type) { | ||
| 185 | // TODO(Subv): Properly implement this | 191 | // TODO(Subv): Properly implement this |
| 186 | switch (format) { | 192 | switch (format) { |
| 187 | case Tegra::Texture::TextureFormat::A8R8G8B8: | 193 | case Tegra::Texture::TextureFormat::A8R8G8B8: |
| @@ -201,7 +207,15 @@ struct SurfaceParams { | |||
| 201 | case Tegra::Texture::TextureFormat::BF10GF11RF11: | 207 | case Tegra::Texture::TextureFormat::BF10GF11RF11: |
| 202 | return PixelFormat::R11FG11FB10F; | 208 | return PixelFormat::R11FG11FB10F; |
| 203 | case Tegra::Texture::TextureFormat::R32_G32_B32_A32: | 209 | case Tegra::Texture::TextureFormat::R32_G32_B32_A32: |
| 204 | return PixelFormat::RGBA32UI; | 210 | switch (component_type) { |
| 211 | case Tegra::Texture::ComponentType::FLOAT: | ||
| 212 | return PixelFormat::RGBA32F; | ||
| 213 | case Tegra::Texture::ComponentType::UINT: | ||
| 214 | return PixelFormat::RGBA32UI; | ||
| 215 | } | ||
| 216 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 217 | static_cast<u32>(component_type)); | ||
| 218 | UNREACHABLE(); | ||
| 205 | case Tegra::Texture::TextureFormat::DXT1: | 219 | case Tegra::Texture::TextureFormat::DXT1: |
| 206 | return PixelFormat::DXT1; | 220 | return PixelFormat::DXT1; |
| 207 | case Tegra::Texture::TextureFormat::DXT23: | 221 | case Tegra::Texture::TextureFormat::DXT23: |
| @@ -215,7 +229,8 @@ struct SurfaceParams { | |||
| 215 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: | 229 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: |
| 216 | return PixelFormat::ASTC_2D_4X4; | 230 | return PixelFormat::ASTC_2D_4X4; |
| 217 | default: | 231 | default: |
| 218 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 232 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", |
| 233 | static_cast<u32>(format), static_cast<u32>(component_type)); | ||
| 219 | UNREACHABLE(); | 234 | UNREACHABLE(); |
| 220 | } | 235 | } |
| 221 | } | 236 | } |
| @@ -257,6 +272,8 @@ struct SurfaceParams { | |||
| 257 | // TODO(bunnei): This is fine for unswizzling (since we just need the right component | 272 | // TODO(bunnei): This is fine for unswizzling (since we just need the right component |
| 258 | // sizes), but could be a bug if we used this function in different ways. | 273 | // sizes), but could be a bug if we used this function in different ways. |
| 259 | return Tegra::Texture::TextureFormat::A8R8G8B8; | 274 | return Tegra::Texture::TextureFormat::A8R8G8B8; |
| 275 | case PixelFormat::RGBA32F: | ||
| 276 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | ||
| 260 | default: | 277 | default: |
| 261 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 278 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 262 | UNREACHABLE(); | 279 | UNREACHABLE(); |
| @@ -284,6 +301,8 @@ struct SurfaceParams { | |||
| 284 | switch (type) { | 301 | switch (type) { |
| 285 | case Tegra::Texture::ComponentType::UNORM: | 302 | case Tegra::Texture::ComponentType::UNORM: |
| 286 | return ComponentType::UNorm; | 303 | return ComponentType::UNorm; |
| 304 | case Tegra::Texture::ComponentType::FLOAT: | ||
| 305 | return ComponentType::Float; | ||
| 287 | default: | 306 | default: |
| 288 | LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); | 307 | LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); |
| 289 | UNREACHABLE(); | 308 | UNREACHABLE(); |
| @@ -300,6 +319,7 @@ struct SurfaceParams { | |||
| 300 | return ComponentType::UNorm; | 319 | return ComponentType::UNorm; |
| 301 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 320 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 302 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 321 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 322 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | ||
| 303 | return ComponentType::Float; | 323 | return ComponentType::Float; |
| 304 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 324 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 305 | return ComponentType::UInt; | 325 | return ComponentType::UInt; |