diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-03-08 15:16:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 15:16:06 +0100 |
commit | 3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093 (patch) | |
tree | 81f921ed23f4926c5d3352ab804a0db029970a89 /src/video_core/renderer_opengl | |
parent | Merge pull request #9921 from liamwhite/override (diff) | |
parent | Check all swizzle components for red, not just [0], pass float border color rather than int (diff) | |
download | yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar.gz yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar.bz2 yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar.lz yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar.xz yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.tar.zst yuzu-3cf88a4d6ce9efd653ec9b49f1b06e3db4c81093.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index b047e7b3d..d3eabd686 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -112,13 +112,17 @@ GLenum ImageTarget(Shader::TextureType type, int num_samples = 1) { return GL_NONE; } -GLenum TextureMode(PixelFormat format, bool is_first) { +GLenum TextureMode(PixelFormat format, std::array<SwizzleSource, 4> swizzle) { + bool any_r = + std::ranges::any_of(swizzle, [](SwizzleSource s) { return s == SwizzleSource::R; }); switch (format) { case PixelFormat::D24_UNORM_S8_UINT: case PixelFormat::D32_FLOAT_S8_UINT: - return is_first ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX; + // R = depth, G = stencil + return any_r ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX; case PixelFormat::S8_UINT_D24_UNORM: - return is_first ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; + // R = stencil, G = depth + return any_r ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT; default: ASSERT(false); return GL_DEPTH_COMPONENT; @@ -208,8 +212,7 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 case PixelFormat::D32_FLOAT_S8_UINT: case PixelFormat::S8_UINT_D24_UNORM: UNIMPLEMENTED_IF(swizzle[0] != SwizzleSource::R && swizzle[0] != SwizzleSource::G); - glTextureParameteri(handle, GL_DEPTH_STENCIL_TEXTURE_MODE, - TextureMode(format, swizzle[0] == SwizzleSource::R)); + glTextureParameteri(handle, GL_DEPTH_STENCIL_TEXTURE_MODE, TextureMode(format, swizzle)); std::ranges::transform(swizzle, swizzle.begin(), ConvertGreenRed); break; case PixelFormat::A5B5G5R1_UNORM: { |