From e21190f47f2fdc0b24f1220700640ed854972ccc Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 13 Jul 2018 23:25:11 -0400 Subject: gl_rasterizer_cache: Implement depth format Z16_UNORM. --- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 5 ++++- src/video_core/renderer_opengl/gl_rasterizer_cache.h | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/video_core/renderer_opengl') 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 tex_form {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, false}, // S8Z24 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F + {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, + false}, // Z16 }}; static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { @@ -195,7 +197,7 @@ static constexpr std::array, MortonCopy, MortonCopy, MortonCopy, MortonCopy, MortonCopy, - MortonCopy, + MortonCopy, MortonCopy, }; static constexpr std::array, MortonCopy, MortonCopy, + MortonCopy, }; // 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 { Z24S8 = 14, S8Z24 = 15, Z32F = 16, + Z16 = 17, MaxDepthStencilFormat, @@ -98,6 +99,7 @@ struct SurfaceParams { 1, // Z24S8 1, // S8Z24 1, // Z32F + 1, // Z16 }}; ASSERT(static_cast(format) < compression_factor_table.size()); @@ -126,6 +128,7 @@ struct SurfaceParams { 32, // Z24S8 32, // S8Z24 32, // Z32F + 16, // Z16 }}; ASSERT(static_cast(format) < bpp_table.size()); @@ -143,6 +146,8 @@ struct SurfaceParams { return PixelFormat::Z24S8; case Tegra::DepthFormat::Z32_FLOAT: return PixelFormat::Z32F; + case Tegra::DepthFormat::Z16_UNORM: + return PixelFormat::Z16; default: LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format)); UNREACHABLE(); @@ -249,6 +254,8 @@ struct SurfaceParams { return Tegra::DepthFormat::Z24_S8_UNORM; case PixelFormat::Z32F: return Tegra::DepthFormat::Z32_FLOAT; + case PixelFormat::Z16: + return Tegra::DepthFormat::Z16_UNORM; default: UNREACHABLE(); } @@ -295,6 +302,7 @@ struct SurfaceParams { static ComponentType ComponentTypeFromDepthFormat(Tegra::DepthFormat format) { switch (format) { + case Tegra::DepthFormat::Z16_UNORM: case Tegra::DepthFormat::S8_Z24_UNORM: case Tegra::DepthFormat::Z24_S8_UNORM: return ComponentType::UNorm; -- cgit v1.2.3