From 2d904372a9bd5da34e349cc665ebec7bea47027b Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Sun, 20 May 2018 14:16:43 +0200 Subject: [PATCH] Multipass issues: depth mask must be enabled for autosorted tr poly. Depth buffer must NOT be cleared b/w passes, same for stencil I guess. --- core/rend/gles/gldraw.cpp | 10 +++------- core/rend/gles/gles.cpp | 5 ++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index bcab5c94f..684addeb7 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -211,7 +211,7 @@ __forceinline #if TRIG_SORT if (SortingEnabled) - glcache.DepthMask(GL_FALSE); + glcache.DepthMask(GL_TRUE); else #endif glcache.DepthMask(!gp->isp.ZWriteDis); @@ -711,8 +711,6 @@ void DrawSorted() //if any drawing commands, draw them if (pidx_sort.size()) { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gl.vbo.idxs2); glCheck(); - u32 count=pidx_sort.size(); { @@ -748,6 +746,8 @@ void DrawSorted() params++; } } + // Re-bind the previous index buffer for subsequent render passes + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gl.vbo.idxs); } } @@ -1027,11 +1027,7 @@ void DrawStrips() //initial state glcache.Enable(GL_DEPTH_TEST); - - glClearDepthf(0.f); glcache.DepthMask(GL_TRUE); - glcache.StencilMask(0xFF); - glClear(GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCheck(); //Opaque DrawList(pvrrc.global_param_op, previous_pass.op_count, current_pass.op_count - previous_pass.op_count); diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index c7817896e..560e10906 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -1782,7 +1782,10 @@ bool RenderFrame() glcache.ClearColor(0,0,0,1.0f); glcache.Disable(GL_SCISSOR_TEST); - glClear(GL_COLOR_BUFFER_BIT); glCheck(); + + glClearDepthf(0.f); glCheck(); + glStencilMask(0xFF); glCheck(); + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCheck(); //move vertex to gpu