Browse Source

Fix for Light2D on WebGL

Josh Engebretson 10 years ago
parent
commit
8452e66972

+ 7 - 1
Data/AtomicPlayer/Resources/CoreData/Shaders/GLSL/PostProcess.glsl

@@ -11,7 +11,13 @@ vec2 Noise(vec2 coord)
 // Adapted: http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
 // Adapted: http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
 vec4 GaussianBlur(int blurKernelSize, vec2 blurDir, vec2 blurRadius, float sigma, sampler2D texSampler, vec2 texCoord)
 vec4 GaussianBlur(int blurKernelSize, vec2 blurDir, vec2 blurRadius, float sigma, sampler2D texSampler, vec2 texCoord)
 {
 {
+
+#if defined(GL_ES)
+    // hardcoded for GL_ES to avoid loop comparison issue below
+    const int blurKernelSizeHalfSize = 3 / 2;
+#else    
     int blurKernelSizeHalfSize = blurKernelSize / 2;
     int blurKernelSizeHalfSize = blurKernelSize / 2;
+#endif    
 
 
     // Incremental Gaussian Coefficent Calculation (See GPU Gems 3 pp. 877 - 889)
     // Incremental Gaussian Coefficent Calculation (See GPU Gems 3 pp. 877 - 889)
     vec3 gaussCoeff;
     vec3 gaussCoeff;
@@ -64,7 +70,7 @@ vec3 Uncharted2Tonemap(vec3 x)
    return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;
    return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;
 }
 }
 
 
-#ifndef GL_ES
+#if !defined(GL_ES)
 vec3 ColorCorrection(vec3 color, sampler3D lut)
 vec3 ColorCorrection(vec3 color, sampler3D lut)
 {
 {
     float lutSize = 16.0;
     float lutSize = 16.0;