Fix depth pass for shaders that set POSITION

This commit is contained in:
Daniel Doran 2021-09-05 01:05:42 -06:00
parent f3ab094133
commit 3138b94058
3 changed files with 4 additions and 1 deletions

View File

@ -2552,7 +2552,7 @@ void RenderForwardClustered::_geometry_instance_add_surface_with_material(Geomet
SceneShaderForwardClustered::MaterialData *material_shadow = nullptr; SceneShaderForwardClustered::MaterialData *material_shadow = nullptr;
void *surface_shadow = nullptr; void *surface_shadow = nullptr;
if (!p_material->shader_data->uses_particle_trails && !p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_pre_pass) { if (!p_material->shader_data->uses_particle_trails && !p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_position && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_pre_pass) {
flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_SHARED_SHADOW_MATERIAL; flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_SHARED_SHADOW_MATERIAL;
material_shadow = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(scene_shader.default_material, RendererStorageRD::SHADER_TYPE_3D); material_shadow = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(scene_shader.default_material, RendererStorageRD::SHADER_TYPE_3D);

View File

@ -66,6 +66,7 @@ void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) {
unshaded = false; unshaded = false;
uses_vertex = false; uses_vertex = false;
uses_position = false;
uses_sss = false; uses_sss = false;
uses_transmittance = false; uses_transmittance = false;
uses_screen_texture = false; uses_screen_texture = false;
@ -126,6 +127,7 @@ void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) {
actions.write_flag_pointers["MODELVIEW_MATRIX"] = &writes_modelview_or_projection; actions.write_flag_pointers["MODELVIEW_MATRIX"] = &writes_modelview_or_projection;
actions.write_flag_pointers["PROJECTION_MATRIX"] = &writes_modelview_or_projection; actions.write_flag_pointers["PROJECTION_MATRIX"] = &writes_modelview_or_projection;
actions.write_flag_pointers["VERTEX"] = &uses_vertex; actions.write_flag_pointers["VERTEX"] = &uses_vertex;
actions.write_flag_pointers["POSITION"] = &uses_position;
actions.uniforms = &uniforms; actions.uniforms = &uniforms;

View File

@ -137,6 +137,7 @@ public:
bool unshaded; bool unshaded;
bool uses_vertex; bool uses_vertex;
bool uses_position;
bool uses_sss; bool uses_sss;
bool uses_transmittance; bool uses_transmittance;
bool uses_screen_texture; bool uses_screen_texture;