diff options
| author | 2018-08-02 20:56:38 +0200 | |
|---|---|---|
| committer | 2018-08-02 14:56:38 -0400 | |
| commit | fe64e1d38ee7e2cb5c96b42a4107949a29898e81 (patch) | |
| tree | 4e69cce051d0e79f54a7ad0626af9c3f901dedfe /src | |
| parent | Merge pull request #893 from lioncash/psc (diff) | |
| download | yuzu-fe64e1d38ee7e2cb5c96b42a4107949a29898e81.tar.gz yuzu-fe64e1d38ee7e2cb5c96b42a4107949a29898e81.tar.xz yuzu-fe64e1d38ee7e2cb5c96b42a4107949a29898e81.zip | |
Implement RGB32F PixelFormat (#886) (used by Go Vacation)
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 19 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 4 |
3 files changed, 23 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index a4d9707cb..c8f0c4e28 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -118,6 +118,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 118 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI | 118 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI |
| 119 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I | 119 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I |
| 120 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S | 120 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S |
| 121 | {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F | ||
| 121 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 | 122 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 |
| 122 | 123 | ||
| 123 | // DepthStencil formats | 124 | // DepthStencil formats |
| @@ -218,9 +219,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 218 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, | 219 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, |
| 219 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, | 220 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, |
| 220 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, | 221 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, |
| 221 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>, | 222 | MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, |
| 222 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | 223 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, |
| 223 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | 224 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, |
| 225 | MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 224 | }; | 226 | }; |
| 225 | 227 | ||
| 226 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 228 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -253,6 +255,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 253 | MortonCopy<false, PixelFormat::RG16UI>, | 255 | MortonCopy<false, PixelFormat::RG16UI>, |
| 254 | MortonCopy<false, PixelFormat::RG16I>, | 256 | MortonCopy<false, PixelFormat::RG16I>, |
| 255 | MortonCopy<false, PixelFormat::RG16S>, | 257 | MortonCopy<false, PixelFormat::RG16S>, |
| 258 | MortonCopy<false, PixelFormat::RGB32F>, | ||
| 256 | MortonCopy<false, PixelFormat::SRGBA8>, | 259 | MortonCopy<false, PixelFormat::SRGBA8>, |
| 257 | MortonCopy<false, PixelFormat::Z24S8>, | 260 | MortonCopy<false, PixelFormat::Z24S8>, |
| 258 | MortonCopy<false, PixelFormat::S8Z24>, | 261 | MortonCopy<false, PixelFormat::S8Z24>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index b73dc2b06..4e1e18d9c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -48,16 +48,17 @@ struct SurfaceParams { | |||
| 48 | RG16UI = 23, | 48 | RG16UI = 23, |
| 49 | RG16I = 24, | 49 | RG16I = 24, |
| 50 | RG16S = 25, | 50 | RG16S = 25, |
| 51 | SRGBA8 = 26, | 51 | RGB32F = 26, |
| 52 | SRGBA8 = 27, | ||
| 52 | 53 | ||
| 53 | MaxColorFormat, | 54 | MaxColorFormat, |
| 54 | 55 | ||
| 55 | // DepthStencil formats | 56 | // DepthStencil formats |
| 56 | Z24S8 = 27, | 57 | Z24S8 = 28, |
| 57 | S8Z24 = 28, | 58 | S8Z24 = 29, |
| 58 | Z32F = 29, | 59 | Z32F = 30, |
| 59 | Z16 = 30, | 60 | Z16 = 31, |
| 60 | Z32FS8 = 31, | 61 | Z32FS8 = 32, |
| 61 | 62 | ||
| 62 | MaxDepthStencilFormat, | 63 | MaxDepthStencilFormat, |
| 63 | 64 | ||
| @@ -121,6 +122,7 @@ struct SurfaceParams { | |||
| 121 | 1, // RG16UI | 122 | 1, // RG16UI |
| 122 | 1, // RG16I | 123 | 1, // RG16I |
| 123 | 1, // RG16S | 124 | 1, // RG16S |
| 125 | 1, // RGB32F | ||
| 124 | 1, // SRGBA8 | 126 | 1, // SRGBA8 |
| 125 | 1, // Z24S8 | 127 | 1, // Z24S8 |
| 126 | 1, // S8Z24 | 128 | 1, // S8Z24 |
| @@ -164,6 +166,7 @@ struct SurfaceParams { | |||
| 164 | 32, // RG16UI | 166 | 32, // RG16UI |
| 165 | 32, // RG16I | 167 | 32, // RG16I |
| 166 | 32, // RG16S | 168 | 32, // RG16S |
| 169 | 96, // RGB32F | ||
| 167 | 32, // SRGBA8 | 170 | 32, // SRGBA8 |
| 168 | 32, // Z24S8 | 171 | 32, // Z24S8 |
| 169 | 32, // S8Z24 | 172 | 32, // S8Z24 |
| @@ -272,6 +275,8 @@ struct SurfaceParams { | |||
| 272 | UNREACHABLE(); | 275 | UNREACHABLE(); |
| 273 | case Tegra::Texture::TextureFormat::R32_G32: | 276 | case Tegra::Texture::TextureFormat::R32_G32: |
| 274 | return PixelFormat::RG32F; | 277 | return PixelFormat::RG32F; |
| 278 | case Tegra::Texture::TextureFormat::R32_G32_B32: | ||
| 279 | return PixelFormat::RGB32F; | ||
| 275 | case Tegra::Texture::TextureFormat::R16: | 280 | case Tegra::Texture::TextureFormat::R16: |
| 276 | switch (component_type) { | 281 | switch (component_type) { |
| 277 | case Tegra::Texture::ComponentType::FLOAT: | 282 | case Tegra::Texture::ComponentType::FLOAT: |
| @@ -363,6 +368,8 @@ struct SurfaceParams { | |||
| 363 | return Tegra::Texture::TextureFormat::A8R8G8B8; | 368 | return Tegra::Texture::TextureFormat::A8R8G8B8; |
| 364 | case PixelFormat::RGBA32F: | 369 | case PixelFormat::RGBA32F: |
| 365 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | 370 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; |
| 371 | case PixelFormat::RGB32F: | ||
| 372 | return Tegra::Texture::TextureFormat::R32_G32_B32; | ||
| 366 | case PixelFormat::RG32F: | 373 | case PixelFormat::RG32F: |
| 367 | return Tegra::Texture::TextureFormat::R32_G32; | 374 | return Tegra::Texture::TextureFormat::R32_G32; |
| 368 | case PixelFormat::R32F: | 375 | case PixelFormat::R32F: |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index d794f8402..65db84ad3 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -57,6 +57,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 57 | case TextureFormat::BC7U: | 57 | case TextureFormat::BC7U: |
| 58 | // In this case a 'pixel' actually refers to a 4x4 tile. | 58 | // In this case a 'pixel' actually refers to a 4x4 tile. |
| 59 | return 16; | 59 | return 16; |
| 60 | case TextureFormat::R32_G32_B32: | ||
| 61 | return 12; | ||
| 60 | case TextureFormat::ASTC_2D_4X4: | 62 | case TextureFormat::ASTC_2D_4X4: |
| 61 | case TextureFormat::A8R8G8B8: | 63 | case TextureFormat::A8R8G8B8: |
| 62 | case TextureFormat::A2B10G10R10: | 64 | case TextureFormat::A2B10G10R10: |
| @@ -131,6 +133,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 131 | case TextureFormat::R16_G16: | 133 | case TextureFormat::R16_G16: |
| 132 | case TextureFormat::BF10GF11RF11: | 134 | case TextureFormat::BF10GF11RF11: |
| 133 | case TextureFormat::ASTC_2D_4X4: | 135 | case TextureFormat::ASTC_2D_4X4: |
| 136 | case TextureFormat::R32_G32_B32: | ||
| 134 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 137 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 135 | unswizzled_data.data(), true, block_height); | 138 | unswizzled_data.data(), true, block_height); |
| 136 | break; | 139 | break; |
| @@ -190,6 +193,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 190 | case TextureFormat::R32: | 193 | case TextureFormat::R32: |
| 191 | case TextureFormat::R16: | 194 | case TextureFormat::R16: |
| 192 | case TextureFormat::R16_G16: | 195 | case TextureFormat::R16_G16: |
| 196 | case TextureFormat::R32_G32_B32: | ||
| 193 | // TODO(Subv): For the time being just forward the same data without any decoding. | 197 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 194 | rgba_data = texture_data; | 198 | rgba_data = texture_data; |
| 195 | break; | 199 | break; |