Browse Source

Enable depth writes during shadow pass and depth pass. Disable during color pass

This fixes an unreported performance bug. Basically, without this change, the depth prepass did nothing
clayjohn 2 năm trước cách đây
mục cha
commit
b986afed46
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      drivers/gles3/rasterizer_scene_gles3.cpp

+ 3 - 1
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -2170,7 +2170,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
 		if (scene_state.current_depth_draw != shader->depth_draw) {
 			switch (shader->depth_draw) {
 				case GLES3::SceneShaderData::DEPTH_DRAW_OPAQUE: {
-					glDepthMask(p_pass_mode == PASS_MODE_COLOR);
+					glDepthMask((p_pass_mode == PASS_MODE_COLOR && !GLES3::Config::get_singleton()->use_depth_prepass) ||
+							p_pass_mode == PASS_MODE_DEPTH ||
+							p_pass_mode == PASS_MODE_SHADOW);
 				} break;
 				case GLES3::SceneShaderData::DEPTH_DRAW_ALWAYS: {
 					glDepthMask(GL_TRUE);