Fix shadow disabling on mobile renderer

This commit is contained in:
Joan Fons 2021-10-26 15:37:22 +02:00
parent c2640e2b21
commit 95bc9c40d9

View file

@ -1046,7 +1046,7 @@ void main() {
#if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) #if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
if (!sc_disable_directional_lights) { //directional light if (!sc_disable_directional_lights) { //directional light
#ifndef SHADOWS_DISABLED
// Do shadow and lighting in two passes to reduce register pressure // Do shadow and lighting in two passes to reduce register pressure
uint shadow0 = 0; uint shadow0 = 0;
uint shadow1 = 0; uint shadow1 = 0;
@ -1322,6 +1322,8 @@ void main() {
} }
} }
#endif // SHADOWS_DISABLED
for (uint i = 0; i < 8; i++) { for (uint i = 0; i < 8; i++) {
if (i >= scene_data.directional_light_count) { if (i >= scene_data.directional_light_count) {
break; break;
@ -1334,13 +1336,13 @@ void main() {
// We're not doing light transmittence // We're not doing light transmittence
float shadow = 1.0; float shadow = 1.0;
#ifndef SHADOWS_DISABLED
if (i < 4) { if (i < 4) {
shadow = float(shadow0 >> (i * 8) & 0xFF) / 255.0; shadow = float(shadow0 >> (i * 8) & 0xFF) / 255.0;
} else { } else {
shadow = float(shadow1 >> ((i - 4) * 8) & 0xFF) / 255.0; shadow = float(shadow1 >> ((i - 4) * 8) & 0xFF) / 255.0;
} }
#endif
blur_shadow(shadow); blur_shadow(shadow);
light_compute(normal, directional_lights.data[i].direction, normalize(view), 0.0, directional_lights.data[i].color * directional_lights.data[i].energy, shadow, f0, orms, 1.0, light_compute(normal, directional_lights.data[i].direction, normalize(view), 0.0, directional_lights.data[i].color * directional_lights.data[i].energy, shadow, f0, orms, 1.0,