summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h8
-rw-r--r--src/video_core/textures/decoders.cpp3
3 files changed, 15 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 323ff7408..361a09626 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -112,6 +112,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
112 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 112 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
113 false}, // S8Z24 113 false}, // S8Z24
114 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F 114 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
115 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
116 false}, // Z16
115}}; 117}};
116 118
117static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { 119static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
@@ -195,7 +197,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
195 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 197 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
196 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 198 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
197 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, 199 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
198 MortonCopy<true, PixelFormat::Z32F>, 200 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
199}; 201};
200 202
201static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 203static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -219,6 +221,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
219 MortonCopy<false, PixelFormat::Z24S8>, 221 MortonCopy<false, PixelFormat::Z24S8>,
220 MortonCopy<false, PixelFormat::S8Z24>, 222 MortonCopy<false, PixelFormat::S8Z24>,
221 MortonCopy<false, PixelFormat::Z32F>, 223 MortonCopy<false, PixelFormat::Z32F>,
224 MortonCopy<false, PixelFormat::Z16>,
222}; 225};
223 226
224// Allocate an uninitialized texture of appropriate size and format for the surface 227// 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 1bedae992..0f5b1ff32 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -44,6 +44,7 @@ struct SurfaceParams {
44 Z24S8 = 14, 44 Z24S8 = 14,
45 S8Z24 = 15, 45 S8Z24 = 15,
46 Z32F = 16, 46 Z32F = 16,
47 Z16 = 17,
47 48
48 MaxDepthStencilFormat, 49 MaxDepthStencilFormat,
49 50
@@ -98,6 +99,7 @@ struct SurfaceParams {
98 1, // Z24S8 99 1, // Z24S8
99 1, // S8Z24 100 1, // S8Z24
100 1, // Z32F 101 1, // Z32F
102 1, // Z16
101 }}; 103 }};
102 104
103 ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); 105 ASSERT(static_cast<size_t>(format) < compression_factor_table.size());
@@ -126,6 +128,7 @@ struct SurfaceParams {
126 32, // Z24S8 128 32, // Z24S8
127 32, // S8Z24 129 32, // S8Z24
128 32, // Z32F 130 32, // Z32F
131 16, // Z16
129 }}; 132 }};
130 133
131 ASSERT(static_cast<size_t>(format) < bpp_table.size()); 134 ASSERT(static_cast<size_t>(format) < bpp_table.size());
@@ -143,6 +146,8 @@ struct SurfaceParams {
143 return PixelFormat::Z24S8; 146 return PixelFormat::Z24S8;
144 case Tegra::DepthFormat::Z32_FLOAT: 147 case Tegra::DepthFormat::Z32_FLOAT:
145 return PixelFormat::Z32F; 148 return PixelFormat::Z32F;
149 case Tegra::DepthFormat::Z16_UNORM:
150 return PixelFormat::Z16;
146 default: 151 default:
147 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 152 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
148 UNREACHABLE(); 153 UNREACHABLE();
@@ -249,6 +254,8 @@ struct SurfaceParams {
249 return Tegra::DepthFormat::Z24_S8_UNORM; 254 return Tegra::DepthFormat::Z24_S8_UNORM;
250 case PixelFormat::Z32F: 255 case PixelFormat::Z32F:
251 return Tegra::DepthFormat::Z32_FLOAT; 256 return Tegra::DepthFormat::Z32_FLOAT;
257 case PixelFormat::Z16:
258 return Tegra::DepthFormat::Z16_UNORM;
252 default: 259 default:
253 UNREACHABLE(); 260 UNREACHABLE();
254 } 261 }
@@ -295,6 +302,7 @@ struct SurfaceParams {
295 302
296 static ComponentType ComponentTypeFromDepthFormat(Tegra::DepthFormat format) { 303 static ComponentType ComponentTypeFromDepthFormat(Tegra::DepthFormat format) {
297 switch (format) { 304 switch (format) {
305 case Tegra::DepthFormat::Z16_UNORM:
298 case Tegra::DepthFormat::S8_Z24_UNORM: 306 case Tegra::DepthFormat::S8_Z24_UNORM:
299 case Tegra::DepthFormat::Z24_S8_UNORM: 307 case Tegra::DepthFormat::Z24_S8_UNORM:
300 return ComponentType::UNorm; 308 return ComponentType::UNorm;
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index b3937b2fe..a4ba9f66a 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -77,6 +77,8 @@ u32 BytesPerPixel(TextureFormat format) {
77 77
78static u32 DepthBytesPerPixel(DepthFormat format) { 78static u32 DepthBytesPerPixel(DepthFormat format) {
79 switch (format) { 79 switch (format) {
80 case DepthFormat::Z16_UNORM:
81 return 2;
80 case DepthFormat::S8_Z24_UNORM: 82 case DepthFormat::S8_Z24_UNORM:
81 case DepthFormat::Z24_S8_UNORM: 83 case DepthFormat::Z24_S8_UNORM:
82 case DepthFormat::Z32_FLOAT: 84 case DepthFormat::Z32_FLOAT:
@@ -133,6 +135,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid
133 std::vector<u8> unswizzled_data(width * height * bytes_per_pixel); 135 std::vector<u8> unswizzled_data(width * height * bytes_per_pixel);
134 136
135 switch (format) { 137 switch (format) {
138 case DepthFormat::Z16_UNORM:
136 case DepthFormat::S8_Z24_UNORM: 139 case DepthFormat::S8_Z24_UNORM:
137 case DepthFormat::Z24_S8_UNORM: 140 case DepthFormat::Z24_S8_UNORM:
138 case DepthFormat::Z32_FLOAT: 141 case DepthFormat::Z32_FLOAT: