From 07692230caf23f9484c89d47fa58e6f94c4cfa90 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 29 Jan 2019 02:01:05 -0300 Subject: gl_rasterizer: Workaround invalid zeta clears Some games (like Xenoblade Chronicles 2) clear both depth and stencil buffers while there's a depth-only texture attached (e.g. D16 Unorm). This commit reads the zeta format of the bound surface on ConfigureFramebuffers and returns if depth and/or stencil attachments were set. This is ignored on DrawArrays but on Clear it's used to just clear those attachments, bypassing an OpenGL error. --- src/video_core/renderer_opengl/gl_rasterizer.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 21c51f874..f6824c402 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -122,10 +122,12 @@ private: * @param using_depth_fb If true, configure the depth/stencil framebuffer. * @param preserve_contents If true, tries to preserve data from a previously used framebuffer. * @param single_color_target Specifies if a single color buffer target should be used. + * @returns If depth (first) or stencil (second) are being stored in the bound zeta texture + * (requires using_depth_fb to be true) */ - void ConfigureFramebuffers(OpenGLState& current_state, bool use_color_fb = true, - bool using_depth_fb = true, bool preserve_contents = true, - std::optional single_color_target = {}); + std::pair ConfigureFramebuffers( + OpenGLState& current_state, bool use_color_fb = true, bool using_depth_fb = true, + bool preserve_contents = true, std::optional single_color_target = {}); /** * Configures the current constbuffers to use for the draw command. @@ -221,6 +223,7 @@ private: std::map framebuffer_cache; FramebufferConfigState current_framebuffer_config_state; + std::pair current_depth_stencil_usage{}; std::array texture_samplers; -- cgit v1.2.3