summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-06-02 11:10:26 +0800
committerErik Kundiman <erik@megapahit.org>2024-06-02 11:10:26 +0800
commitaebd601a9399433146933510dcfdb04abe7e03d5 (patch)
tree2e8b755151a5b1f92297cd477565d7fb246292b9
parent30e33e279b1b2d04951c399f548c3afc3b17fd1b (diff)
More float operands for float operations
This is so that it doesn't throw a compilation error at runtime for not defining consistently with float values, which would be uncastable on some certain other implementation.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl2
5 files changed, 15 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
index 49470f0e39..1c394e1de4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
@@ -79,10 +79,10 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen)
{
float ret = 1.0;
vec3 pos_world = pos.xyz;
- vec2 noise_reflect = texture(noiseMap, pos_screen.xy * (screen_res / 128)).xy;
+ vec2 noise_reflect = texture(noiseMap, pos_screen.xy * (screen_res / 128.0)).xy;
float angle_hidden = 0.0;
- float points = 0;
+ float points = 0.0;
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 5ef3d63eb2..e1a1fda602 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -145,24 +145,24 @@ vec2 getScreenCoordinate(vec2 screenpos)
vec3 getNorm(vec2 screenpos)
{
vec2 enc = texture(normalMap, screenpos.xy).xy;
- vec2 fenc = enc*4-2;
+ vec2 fenc = enc*4.0-2.0;
float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
+ float g = sqrt(1.0-f/4.0);
vec3 n;
n.xy = fenc*g;
- n.z = 1-f/2;
+ n.z = 1.0-f/2.0;
return n;
}
vec3 getNormalFromPacked(vec4 packedNormalEnvIntensityFlags)
{
vec2 enc = packedNormalEnvIntensityFlags.xy;
- vec2 fenc = enc*4-2;
+ vec2 fenc = enc*4.0-2.0;
float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
+ float g = sqrt(1.0-f/4.0);
vec3 n;
n.xy = fenc*g;
- n.z = 1-f/2;
+ n.z = 1.0-f/2.0;
return normalize(n); // TODO: Is this normalize redundant?
}
@@ -269,7 +269,7 @@ vec4 texture2DLodSpecular(vec2 tc, float lod)
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
float d = min(dist.x, dist.y);
- d *= min(1, d * (proj_lod - lod)); // BUG? extra factor compared to diffuse causes N repeats
+ d *= min(1.0, d * (proj_lod - lod)); // BUG? extra factor compared to diffuse causes N repeats
float edge = 0.25*det;
ret *= clamp(d/edge, 0.0, 1.0);
@@ -385,7 +385,7 @@ vec3 pbrIbl(vec3 diffuseColor,
float perceptualRough)
{
// retrieve a scale and bias to F0. See [1], Figure 3
- vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
+ vec2 brdf = BRDF(clamp(nv, 0.0, 1.0), 1.0-perceptualRough);
vec3 diffuseLight = irradiance;
vec3 specularLight = radiance;
@@ -545,7 +545,7 @@ uniform float waterSign;
void waterClip(vec3 pos)
{
// TODO: make this less branchy
- if (waterSign > 0)
+ if (waterSign > 0.0)
{
if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < 0.0)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
index cf0595ee45..178510f483 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
@@ -27,11 +27,11 @@
float random (vec2 uv)
{
- return 0;
+ return 0.0;
}
float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness)
{
collectedColor = vec4(0);
- return 0;
+ return 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl b/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
index ca3e4f6718..98604124e8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
@@ -28,7 +28,7 @@
// Also see: A_bit_more_deferred_-_CryEngine3.ppt
vec2 encode_normal(vec3 n)
{
- float f = sqrt(8 * n.z + 8);
+ float f = sqrt(8.0 * n.z + 8.0);
return n.xy / f + 0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
index 1372ddbcfa..bdc5b58060 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
@@ -47,7 +47,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 tmpaddlit = vec3(1);
vec3 tmpattenlit = vec3(1);
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
- calcAtmosphericVars(inPositionEye, light_dir, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);
+ calcAtmosphericVars(inPositionEye, light_dir, 1.0, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);
setSunlitColor(tmpsunlit);
setAmblitColor(tmpamblit);
setAdditiveColor(tmpaddlit);