Skip to content

Commit e35c795

Browse files
committed
Moved accumulation buffer clear hack to more appropriate place.
1 parent 55bcf01 commit e35c795

16 files changed

Lines changed: 80 additions & 32 deletions

File tree

Nu/Nu.Gaia/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Pipe/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Template.ImSim.Empty/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Template.ImSim.Game/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Template.Mmcc.Empty/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Template.Mmcc.Game/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Nu/Nu.Tests/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Projects/Blaze Vector ImSim/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Projects/Blaze Vector Mmcc/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

Projects/Breakout ImSim/Assets/Default/PhysicallyBasedDeferredLighting.glsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ void main()
762762
float roughness = material.r;
763763
float metallic = material.g;
764764

765+
// clear accumulation buffers because there seems to exist a Mesa bug where glClear doesn't work on certain
766+
// platforms on this buffer - https://github.com/bryanedds/Nu/issues/800#issuecomment-3239861861
767+
lightAccum = vec4(0.0);
768+
fogAccum = vec4(0.0);
769+
765770
// compute light accumulation
766771
vec3 v = normalize(eyeCenter - position.xyz);
767772
float nDotV = max(dot(normal, v), 0.0);
@@ -835,7 +840,6 @@ void main()
835840

836841
// accumulate light, clearing on first light (HACK: seems to fix glClear not working on the respective buffer
837842
// on certain platforms)
838-
if (i == 0) lightAccum = vec4(0.0);
839843
lightAccum.rgb += (kD * albedo / PI + specular) * radiance * nDotL * shadowScalar;
840844

841845
// accumulate light from subsurface scattering
@@ -848,7 +852,6 @@ void main()
848852

849853
// accumulate fog, clearing on first light (HACK: seems to fix glClear not working on the respective buffer on
850854
// certain platforms)
851-
if (i == 0) fogAccum = vec4(0.0);
852855
if (ssvfEnabled == 1 && lightDesireFogs[i] == 1)
853856
{
854857
switch (lightType)

0 commit comments

Comments
 (0)