diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index da6d48bf0c..efa4b92763 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -168,10 +168,8 @@ void GLGSRender::begin() { rsx::thread::begin(); - if (skip_frame) - return; - - if (conditional_render_enabled && conditional_render_test_failed) + if (skip_frame || + (conditional_render_enabled && conditional_render_test_failed)) return; init_buffers(rsx::framebuffer_creation_context::context_draw); @@ -196,7 +194,9 @@ void GLGSRender::end() { std::chrono::time_point state_check_start = steady_clock::now(); - if (skip_frame || !framebuffer_status_valid || (conditional_render_enabled && conditional_render_test_failed) || !check_program_state()) + if (skip_frame || !framebuffer_status_valid || + (conditional_render_enabled && conditional_render_test_failed) || + !check_program_state()) { rsx::thread::end(); return; diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index eb04bf7b45..11d4284e35 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -191,7 +191,9 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk if (depth_address) { - if (!rsx::method_registers.depth_test_enabled() && target != rsx::surface_target::none) + if (!rsx::method_registers.depth_test_enabled() && + !rsx::method_registers.stencil_test_enabled() && + target != rsx::surface_target::none) { //Disable depth buffer if depth testing is not enabled, unless a clear command is targeting the depth buffer const bool is_depth_clear = !!(context & rsx::framebuffer_creation_context::context_clear_depth); @@ -214,7 +216,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk //TODO: Research clearing both depth AND color //TODO: If context is creation_draw, deal with possibility of a lost buffer clear if (context == rsx::framebuffer_creation_context::context_clear_depth || - rsx::method_registers.depth_test_enabled() || + rsx::method_registers.depth_test_enabled() || rsx::method_registers.stencil_test_enabled() || (!rsx::method_registers.color_write_enabled() && rsx::method_registers.depth_write_enabled())) { // Use address for depth data diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 37e5d2b216..f835d56eee 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -924,7 +924,8 @@ void VKGSRender::begin() { rsx::thread::begin(); - if (skip_frame || renderer_unavailable) + if (skip_frame || renderer_unavailable || + (conditional_render_enabled && conditional_render_test_failed)) return; init_buffers(rsx::framebuffer_creation_context::context_draw); @@ -1089,20 +1090,14 @@ void VKGSRender::close_render_pass() void VKGSRender::end() { - if (skip_frame || !framebuffer_status_valid || renderer_unavailable) + if (skip_frame || !framebuffer_status_valid || renderer_unavailable || + (conditional_render_enabled && conditional_render_test_failed) || + !check_program_status()) { rsx::thread::end(); return; } - //Load program here since it is dependent on vertex state - if (!check_program_status()) - { - LOG_ERROR(RSX, "No valid program bound to pipeline. Skipping draw"); - rsx::thread::end(); - return; - } - //Programs data is dependent on vertex state std::chrono::time_point vertex_start = steady_clock::now(); auto upload_info = upload_vertex_data(); @@ -2434,7 +2429,9 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) if (zeta_address) { - if (!rsx::method_registers.depth_test_enabled() && target != rsx::surface_target::none) + if (!rsx::method_registers.depth_test_enabled() && + !rsx::method_registers.stencil_test_enabled() && + target != rsx::surface_target::none) { //Disable depth buffer if depth testing is not enabled, unless a clear command is targeting the depth buffer const bool is_depth_clear = !!(context & rsx::framebuffer_creation_context::context_clear_depth); @@ -2455,7 +2452,7 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) { LOG_TRACE(RSX, "Framebuffer at 0x%X has aliasing color/depth targets, zeta_pitch = %d, color_pitch=%d", zeta_address, zeta_pitch, surface_pitchs[index]); if (context == rsx::framebuffer_creation_context::context_clear_depth || - rsx::method_registers.depth_test_enabled() || + rsx::method_registers.depth_test_enabled() || rsx::method_registers.stencil_test_enabled() || (!rsx::method_registers.color_write_enabled() && rsx::method_registers.depth_write_enabled())) { // Use address for depth data