summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_scene_gles3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_scene_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index d1d063ad5b..966466d9bc 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1832,6 +1832,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
storage->info.render.vertices_count += s->index_array_len * amount;
} else
#endif
+
if (s->index_array_len > 0) {
glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount);
@@ -2677,11 +2678,6 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
-// Drop -O3 for this function as it triggers a GCC bug up until at least GCC 8.2.1.
-// This refers to GH issue #19633.
-// The bug has been reported to the GCC project.
-#pragma GCC push_options
-#pragma GCC optimize ("-O2")
void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows) {
LightInstance *li = directional_lights[p_index];
@@ -2782,7 +2778,7 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform
CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview;
- store_camera(shadow_mtx, &ubo_data.shadow_matrix1[16 * j]);
+ store_camera(shadow_mtx, &ubo_data.shadow.matrix[16 * j]);
ubo_data.light_clamp[0] = atlas_rect.position.x;
ubo_data.light_clamp[1] = atlas_rect.position.y;
@@ -2799,7 +2795,6 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform
glBindBufferBase(GL_UNIFORM_BUFFER, 3, state.directional_ubo);
}
-#pragma GCC pop_options
void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas) {
@@ -2894,7 +2889,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
Transform proj = (p_camera_inverse_transform * li->transform).inverse();
- store_transform(proj, ubo_data.shadow_matrix1);
+ store_transform(proj, ubo_data.shadow.matrix1);
ubo_data.light_params[3] = 1.0; //means it has shadow
ubo_data.light_clamp[0] = float(x) / atlas_size;
@@ -2983,7 +2978,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[0].camera * modelview;
- store_camera(shadow_mtx, ubo_data.shadow_matrix1);
+ store_camera(shadow_mtx, ubo_data.shadow.matrix1);
}
li->light_index = state.spot_light_count;
@@ -4137,9 +4132,19 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glDepthFunc(GL_LEQUAL);
- state.used_contact_shadows = true;
+ state.used_contact_shadows = false;
+
+ for (int i = 0; i < p_light_cull_count; i++) {
+
+ ERR_BREAK(i >= RenderList::MAX_LIGHTS);
+
+ LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]);
+ if (li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] > CMP_EPSILON) {
+ state.used_contact_shadows = true;
+ }
+ }
- if (!storage->config.no_depth_prepass && storage->frame.current_rt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) { //detect with state.used_contact_shadows too
+ if (!storage->config.no_depth_prepass && storage->frame.current_rt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS]) { //detect with state.used_contact_shadows too
//pre z pass
glDisable(GL_BLEND);