summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorClay <claynjohn@gmail.com>2023-07-24 23:21:04 +0200
committerClay <claynjohn@gmail.com>2023-07-24 23:21:04 +0200
commit7c812cd7e9aaa5145f5309bb6254d0570620bec9 (patch)
tree18cf99ecabb8fe06c6713b35c810b09ff8e3671f /drivers
parentf6187014ec1d7a47b7201f64f3a8376a5da2f42d (diff)
downloadredot-engine-7c812cd7e9aaa5145f5309bb6254d0570620bec9.tar.gz
Fix use of discard in shaders
discard was being included in all shaders set to depth pass opaque, which is the majority of shaders Instead it should only be used with alpha prepass materials
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/shaders/scene.glsl18
-rw-r--r--drivers/gles3/storage/material_storage.cpp2
2 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index aa68febec8..7cba77be2f 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1039,17 +1039,16 @@ void main() {
if (alpha < alpha_scissor_threshold) {
discard;
}
-#endif // ALPHA_SCISSOR_USED
-
+#else
+#ifdef MODE_RENDER_DEPTH
#ifdef USE_OPAQUE_PREPASS
-#if !defined(ALPHA_SCISSOR_USED)
if (alpha < opaque_prepass_threshold) {
discard;
}
-
-#endif // not ALPHA_SCISSOR_USED
#endif // USE_OPAQUE_PREPASS
+#endif // MODE_RENDER_DEPTH
+#endif // !ALPHA_SCISSOR_USED
#endif // !USE_SHADOW_TO_OPACITY
@@ -1270,17 +1269,16 @@ void main() {
if (alpha < alpha_scissor) {
discard;
}
-#endif // ALPHA_SCISSOR_USED
-
+#else
+#ifdef MODE_RENDER_DEPTH
#ifdef USE_OPAQUE_PREPASS
-#if !defined(ALPHA_SCISSOR_USED)
if (alpha < opaque_prepass_threshold) {
discard;
}
-
-#endif // not ALPHA_SCISSOR_USED
#endif // USE_OPAQUE_PREPASS
+#endif // MODE_RENDER_DEPTH
+#endif // !ALPHA_SCISSOR_USED
#endif // USE_SHADOW_TO_OPACITY
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index d0746a8fc8..aa6319f0ef 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1338,7 +1338,7 @@ MaterialStorage::MaterialStorage() {
actions.render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
actions.render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
actions.render_mode_defines["particle_trails"] = "#define USE_PARTICLE_TRAILS\n";
- actions.render_mode_defines["depth_draw_opaque"] = "#define USE_OPAQUE_PREPASS\n";
+ actions.render_mode_defines["depth_prepass_alpha"] = "#define USE_OPAQUE_PREPASS\n";
bool force_lambert = GLOBAL_GET("rendering/shading/overrides/force_lambert_over_burley");