summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <mbrasser@ford.com>2018-12-04 16:37:53 -0600
committerMichael Brasser <michael.brasser@live.com>2018-12-05 14:29:15 +0000
commitdde33ab2eb631461f23ca29e826c99ad10a56521 (patch)
tree08d5e17263ffceafbbf82b575c028c53902df2d7
parentaac6ffa0310cd32d66623658b1a6ee33f51aba88 (diff)
Add missing precision specifiers for ES3
Change-Id: I008d42f09b587c0a6317ddb583b640b15e3b32ba Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/extras/shaders/es3/light.inc.frag16
-rw-r--r--src/extras/shaders/es3/metalrough.inc.frag6
2 files changed, 11 insertions, 11 deletions
diff --git a/src/extras/shaders/es3/light.inc.frag b/src/extras/shaders/es3/light.inc.frag
index 9d03fca54..18012ccc1 100644
--- a/src/extras/shaders/es3/light.inc.frag
+++ b/src/extras/shaders/es3/light.inc.frag
@@ -4,14 +4,14 @@ const int TYPE_DIRECTIONAL = 1;
const int TYPE_SPOT = 2;
struct Light {
int type;
- vec3 position;
- vec3 color;
- float intensity;
- vec3 direction;
- float constantAttenuation;
- float linearAttenuation;
- float quadraticAttenuation;
- float cutOffAngle;
+ FP vec3 position;
+ FP vec3 color;
+ FP float intensity;
+ FP vec3 direction;
+ FP float constantAttenuation;
+ FP float linearAttenuation;
+ FP float quadraticAttenuation;
+ FP float cutOffAngle;
};
uniform Light lights[MAX_LIGHTS];
uniform int lightCount;
diff --git a/src/extras/shaders/es3/metalrough.inc.frag b/src/extras/shaders/es3/metalrough.inc.frag
index f145e90f8..188a367f5 100644
--- a/src/extras/shaders/es3/metalrough.inc.frag
+++ b/src/extras/shaders/es3/metalrough.inc.frag
@@ -66,7 +66,7 @@ int mipLevelCount(const in FP samplerCube cube)
return nMips;
}
-float remapRoughness(const in FP float roughness)
+FP float remapRoughness(const in FP float roughness)
{
// As per page 14 of
// http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
@@ -177,7 +177,7 @@ FP vec3 pbrModel(const in int lightIndex,
if (lights[lightIndex].type != TYPE_DIRECTIONAL) {
// Point and Spot lights
- vec3 sUnnormalized = vec3(lights[lightIndex].position) - wPosition;
+ FP vec3 sUnnormalized = vec3(lights[lightIndex].position) - wPosition;
s = normalize(sUnnormalized);
// Calculate the attenuation factor
@@ -186,7 +186,7 @@ FP vec3 pbrModel(const in int lightIndex,
if (lights[lightIndex].constantAttenuation != 0.0
|| lights[lightIndex].linearAttenuation != 0.0
|| lights[lightIndex].quadraticAttenuation != 0.0) {
- float dist = length(sUnnormalized);
+ FP float dist = length(sUnnormalized);
att = 1.0 / (lights[lightIndex].constantAttenuation +
lights[lightIndex].linearAttenuation * dist +
lights[lightIndex].quadraticAttenuation * dist * dist);