summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-07-26 12:44:05 -0700
committerGraham Linden <graham@lindenlab.com>2013-07-26 12:44:05 -0700
commit73703191e0fc91e022d01c91740c1deade8cbaf5 (patch)
treeb46c2fbda922eed76077e6435c0127dc9c3b8b86 /indra/newview/app_settings/shaders
parent3045dd6c5113d03fd0b0453ce916fc2a1c27c4e0 (diff)
NORSPEC-327 modify 'select' ops in srgb shader code to mollify the doddering mac GLSL compiler
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/srgb.glsl24
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
index 177f6c25f8..d532835bf1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
@@ -23,6 +23,8 @@
* $/LicenseInfo$
*/
+// OLD_SELECT work-around missing mix(vec3,vec,bvec3) in older GLSL versions (*cough* MAC *cough*)
+
vec3 srgb_to_linear(vec3 cs)
{
@@ -32,7 +34,17 @@ vec3 srgb_to_linear(vec3 cs)
vec3 low_range = cs / vec3(12.92);
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
+
+ bvec3 lte = lessThanEqual(cs,vec3(0.04045));
+#ifdef OLD_SELECT
+ vec3 result;
+ result.r = lte.r ? low_range.r : high_range.r;
+ result.g = lte.g ? low_range.g : high_range.g;
+ result.b = lte.b ? low_range.b : high_range.b;
+ return result;
+#else
return mix(high_range, low_range, lessThanEqual(cs,vec3(0.04045)));
+#endif
}
vec3 linear_to_srgb(vec3 cl)
@@ -45,5 +57,17 @@ vec3 linear_to_srgb(vec3 cl)
cl = clamp(cl, vec3(0), vec3(1));
vec3 low_range = cl * 12.92;
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
+
+ bvec3 lt = lessThan(cl,vec3(0.0031308));
+
+#ifdef OLD_SELECT
+ vec3 result;
+ result.r = lt.r ? low_range.r : high_range.r;
+ result.g = lt.g ? low_range.g : high_range.g;
+ result.b = lt.b ? low_range.b : high_range.b;
+ return result;
+#else
return mix(high_range, low_range, lessThan(cl,vec3(0.0031308)));
+#endif
}
+