diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 9 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 50469c05c..57d7763ff 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -108,7 +108,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 108 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, | 108 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, |
| 109 | false}, // Z24S8 | 109 | false}, // Z24S8 |
| 110 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, | 110 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, |
| 111 | false}, // S8Z24 | 111 | false}, // S8Z24 |
| 112 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F | ||
| 112 | }}; | 113 | }}; |
| 113 | 114 | ||
| 114 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { | 115 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { |
| @@ -191,7 +192,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 191 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 192 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, |
| 192 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, | 193 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 193 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::Z24S8>, | 194 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::Z24S8>, |
| 194 | MortonCopy<true, PixelFormat::S8Z24>, | 195 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, |
| 195 | }; | 196 | }; |
| 196 | 197 | ||
| 197 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 198 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -213,6 +214,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 213 | MortonCopy<false, PixelFormat::ABGR8>, | 214 | MortonCopy<false, PixelFormat::ABGR8>, |
| 214 | MortonCopy<false, PixelFormat::Z24S8>, | 215 | MortonCopy<false, PixelFormat::Z24S8>, |
| 215 | MortonCopy<false, PixelFormat::S8Z24>, | 216 | MortonCopy<false, PixelFormat::S8Z24>, |
| 217 | MortonCopy<false, PixelFormat::Z32F>, | ||
| 216 | }; | 218 | }; |
| 217 | 219 | ||
| 218 | // Allocate an uninitialized texture of appropriate size and format for the surface | 220 | // Allocate an uninitialized texture of appropriate size and format for the surface |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 8005a81b8..b4d7f8ebe 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -42,6 +42,7 @@ struct SurfaceParams { | |||
| 42 | // DepthStencil formats | 42 | // DepthStencil formats |
| 43 | Z24S8 = 13, | 43 | Z24S8 = 13, |
| 44 | S8Z24 = 14, | 44 | S8Z24 = 14, |
| 45 | Z32F = 15, | ||
| 45 | 46 | ||
| 46 | MaxDepthStencilFormat, | 47 | MaxDepthStencilFormat, |
| 47 | 48 | ||
| @@ -94,6 +95,7 @@ struct SurfaceParams { | |||
| 94 | 4, // ASTC_2D_4X4 | 95 | 4, // ASTC_2D_4X4 |
| 95 | 1, // Z24S8 | 96 | 1, // Z24S8 |
| 96 | 1, // S8Z24 | 97 | 1, // S8Z24 |
| 98 | 1, // Z32F | ||
| 97 | }}; | 99 | }}; |
| 98 | 100 | ||
| 99 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); | 101 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); |
| @@ -120,6 +122,7 @@ struct SurfaceParams { | |||
| 120 | 32, // ASTC_2D_4X4 | 122 | 32, // ASTC_2D_4X4 |
| 121 | 32, // Z24S8 | 123 | 32, // Z24S8 |
| 122 | 32, // S8Z24 | 124 | 32, // S8Z24 |
| 125 | 32, // Z32F | ||
| 123 | }}; | 126 | }}; |
| 124 | 127 | ||
| 125 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); | 128 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); |
| @@ -135,6 +138,8 @@ struct SurfaceParams { | |||
| 135 | return PixelFormat::S8Z24; | 138 | return PixelFormat::S8Z24; |
| 136 | case Tegra::DepthFormat::Z24_S8_UNORM: | 139 | case Tegra::DepthFormat::Z24_S8_UNORM: |
| 137 | return PixelFormat::Z24S8; | 140 | return PixelFormat::Z24S8; |
| 141 | case Tegra::DepthFormat::Z32_FLOAT: | ||
| 142 | return PixelFormat::Z32F; | ||
| 138 | default: | 143 | default: |
| 139 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 144 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 140 | UNREACHABLE(); | 145 | UNREACHABLE(); |
| @@ -235,6 +240,8 @@ struct SurfaceParams { | |||
| 235 | return Tegra::DepthFormat::S8_Z24_UNORM; | 240 | return Tegra::DepthFormat::S8_Z24_UNORM; |
| 236 | case PixelFormat::Z24S8: | 241 | case PixelFormat::Z24S8: |
| 237 | return Tegra::DepthFormat::Z24_S8_UNORM; | 242 | return Tegra::DepthFormat::Z24_S8_UNORM; |
| 243 | case PixelFormat::Z32F: | ||
| 244 | return Tegra::DepthFormat::Z32_FLOAT; | ||
| 238 | default: | 245 | default: |
| 239 | UNREACHABLE(); | 246 | UNREACHABLE(); |
| 240 | } | 247 | } |
| @@ -284,6 +291,8 @@ struct SurfaceParams { | |||
| 284 | case Tegra::DepthFormat::S8_Z24_UNORM: | 291 | case Tegra::DepthFormat::S8_Z24_UNORM: |
| 285 | case Tegra::DepthFormat::Z24_S8_UNORM: | 292 | case Tegra::DepthFormat::Z24_S8_UNORM: |
| 286 | return ComponentType::UNorm; | 293 | return ComponentType::UNorm; |
| 294 | case Tegra::DepthFormat::Z32_FLOAT: | ||
| 295 | return ComponentType::Float; | ||
| 287 | default: | 296 | default: |
| 288 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 297 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); |
| 289 | UNREACHABLE(); | 298 | UNREACHABLE(); |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 7b06fea3e..d5ab4e4f9 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -78,6 +78,7 @@ static u32 DepthBytesPerPixel(DepthFormat format) { | |||
| 78 | switch (format) { | 78 | switch (format) { |
| 79 | case DepthFormat::S8_Z24_UNORM: | 79 | case DepthFormat::S8_Z24_UNORM: |
| 80 | case DepthFormat::Z24_S8_UNORM: | 80 | case DepthFormat::Z24_S8_UNORM: |
| 81 | case DepthFormat::Z32_FLOAT: | ||
| 81 | return 4; | 82 | return 4; |
| 82 | default: | 83 | default: |
| 83 | UNIMPLEMENTED_MSG("Format not implemented"); | 84 | UNIMPLEMENTED_MSG("Format not implemented"); |
| @@ -132,6 +133,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid | |||
| 132 | switch (format) { | 133 | switch (format) { |
| 133 | case DepthFormat::S8_Z24_UNORM: | 134 | case DepthFormat::S8_Z24_UNORM: |
| 134 | case DepthFormat::Z24_S8_UNORM: | 135 | case DepthFormat::Z24_S8_UNORM: |
| 136 | case DepthFormat::Z32_FLOAT: | ||
| 135 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 137 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 136 | unswizzled_data.data(), true, block_height); | 138 | unswizzled_data.data(), true, block_height); |
| 137 | break; | 139 | break; |