mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Ensure depth reads go via alpha render list, fixes #14759
This commit is contained in:
parent
50b975548d
commit
9cf19f8dee
@ -2230,7 +2230,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
|
||||
|
||||
void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass, bool p_shadow_pass) {
|
||||
|
||||
bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture;
|
||||
bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture || p_material->shader->spatial.uses_depth_texture;
|
||||
bool has_blend_alpha = p_material->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX;
|
||||
bool has_alpha = has_base_alpha || has_blend_alpha;
|
||||
|
||||
@ -2254,7 +2254,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
|
||||
|
||||
if (p_depth_pass) {
|
||||
|
||||
if (has_blend_alpha || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS))
|
||||
if (has_blend_alpha || p_material->shader->spatial.uses_depth_texture || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS))
|
||||
return; //bye
|
||||
|
||||
if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
|
||||
|
@ -1619,6 +1619,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
|
||||
p_shader->spatial.uses_time = false;
|
||||
p_shader->spatial.uses_vertex_lighting = false;
|
||||
p_shader->spatial.uses_screen_texture = false;
|
||||
p_shader->spatial.uses_depth_texture = false;
|
||||
p_shader->spatial.uses_vertex = false;
|
||||
p_shader->spatial.writes_modelview_or_projection = false;
|
||||
p_shader->spatial.uses_world_coordinates = false;
|
||||
@ -1650,6 +1651,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
|
||||
shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"] = &p_shader->spatial.uses_sss;
|
||||
shaders.actions_scene.usage_flag_pointers["DISCARD"] = &p_shader->spatial.uses_discard;
|
||||
shaders.actions_scene.usage_flag_pointers["SCREEN_TEXTURE"] = &p_shader->spatial.uses_screen_texture;
|
||||
shaders.actions_scene.usage_flag_pointers["DEPTH_TEXTURE"] = &p_shader->spatial.uses_depth_texture;
|
||||
shaders.actions_scene.usage_flag_pointers["TIME"] = &p_shader->spatial.uses_time;
|
||||
|
||||
shaders.actions_scene.write_flag_pointers["MODELVIEW_MATRIX"] = &p_shader->spatial.writes_modelview_or_projection;
|
||||
|
@ -473,6 +473,7 @@ public:
|
||||
bool uses_discard;
|
||||
bool uses_sss;
|
||||
bool uses_screen_texture;
|
||||
bool uses_depth_texture;
|
||||
bool uses_time;
|
||||
bool writes_modelview_or_projection;
|
||||
bool uses_vertex_lighting;
|
||||
|
@ -112,8 +112,8 @@ int BitMap::get_true_bit_count() const {
|
||||
|
||||
void BitMap::set_bit(const Point2 &p_pos, bool p_value) {
|
||||
|
||||
int x = Math::fast_ftoi(p_pos.x);
|
||||
int y = Math::fast_ftoi(p_pos.y);
|
||||
int x = p_pos.x;
|
||||
int y = p_pos.y;
|
||||
|
||||
ERR_FAIL_INDEX(x, width);
|
||||
ERR_FAIL_INDEX(y, height);
|
||||
|
Loading…
Reference in New Issue
Block a user