diff options
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.cpp | 26 | ||||
-rw-r--r-- | drivers/gles2/shaders/scene.glsl | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index aea89ddaa1..23b01b4e09 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -2287,19 +2287,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, prev_unshaded = unshaded; } - bool depth_prepass = false; - - if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { - depth_prepass = true; - } - - if (depth_prepass != prev_depth_prepass) { - - state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass); - prev_depth_prepass = depth_prepass; - rebind = true; - } - bool base_pass = !accum_pass && !unshaded; //conditions for a base pass if (base_pass != prev_base_pass) { @@ -2434,6 +2421,19 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, } } + bool depth_prepass = false; + + if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + depth_prepass = true; + } + + if (depth_prepass != prev_depth_prepass) { + + state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass); + prev_depth_prepass = depth_prepass; + rebind = true; + } + bool instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH; if (instancing != prev_instancing) { diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index ca222362e7..b7f8ec3ce9 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -1549,7 +1549,7 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS - if (alpha < 0.99) { + if (alpha < 0.1) { discard; } #endif // USE_DEPTH_PREPASS @@ -2112,7 +2112,7 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS - if (alpha < 0.99) { + if (alpha < 0.1) { discard; } #endif // USE_DEPTH_PREPASS |