diff options
author | clayjohn <claynjohn@gmail.com> | 2022-11-13 12:46:52 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-11-13 14:09:21 -0800 |
commit | 4abf47f407d45289c4900e3025013f452f563c86 (patch) | |
tree | 5a936c6a7c0988b585c310e12d9fee1e6ae36f39 /drivers/gles3/storage/material_storage.cpp | |
parent | b05e1e7d6982c1a0ebbba2e1da60bf05fd2a009a (diff) |
Implement is_animated and casts_shadows
This allows the renderer to correctly decide when to update shadow maps
This PR also adds TIME to a few missing places
Diffstat (limited to 'drivers/gles3/storage/material_storage.cpp')
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 6748eb3676..3ea61e252b 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -3418,6 +3418,8 @@ void SceneShaderData::set_code(const String &p_code) { vertex_input_mask |= uses_bones << 9; vertex_input_mask |= uses_weights << 10; uses_screen_texture_mipmaps = gen_code.uses_screen_texture_mipmaps; + uses_vertex_time = gen_code.uses_vertex_time; + uses_fragment_time = gen_code.uses_fragment_time; #if 0 print_line("**compiling shader:"); @@ -3538,11 +3540,15 @@ bool SceneShaderData::is_parameter_texture(const StringName &p_param) const { } bool SceneShaderData::is_animated() const { - return false; + return (uses_fragment_time && uses_discard) || (uses_vertex_time && uses_vertex); } bool SceneShaderData::casts_shadows() const { - return false; + bool has_read_screen_alpha = uses_screen_texture || uses_depth_texture || uses_normal_texture; + bool has_base_alpha = (uses_alpha && !uses_alpha_clip) || has_read_screen_alpha; + bool has_alpha = has_base_alpha || uses_blend_alpha; + + return !has_alpha || (uses_depth_pre_pass && !(depth_draw == DEPTH_DRAW_DISABLED || depth_test == DEPTH_TEST_DISABLED)); } Variant SceneShaderData::get_default_parameter(const StringName &p_parameter) const { |