dx warning fixes

This commit is contained in:
Mikulas Florek 2021-03-30 23:23:30 +02:00
parent 2f9ffb55e4
commit 4893cb9aaf
5 changed files with 11 additions and 11 deletions

View file

@ -53,7 +53,7 @@ fragment_shader [[
float a = 3.0*(1.0-g*g);
float b = 2.0*(2.0+g*g);
float c = 1.0+alpha*alpha;
float d = pow(1.0+g*g-2.0*g*alpha, 1.5);
float d = pow(abs(1.0+g*g-2.0*g*alpha), 1.5);
return (a/b)*(c/d);
}

View file

@ -178,7 +178,7 @@ vec4 fullscreenQuad(int vertexID, out vec2 uv) {
float packEmission(float emission)
{
return log2(1 + emission / 64);
return log2(1 + emission / 64.0);
}
@ -207,10 +207,10 @@ float toLinearDepth(mat4 inv_proj, float ndc_depth)
fragcoord.y = Global.framebuffer_size.y - fragcoord.y - 1;
#endif
cluster = ivec3(fragcoord.xy / 64, 0);
cluster = ivec3(fragcoord.xy / 64.0, 0);
float linear_depth = toLinearDepth(Global.inv_projection, ndc_depth);
cluster.z = int(log(linear_depth) * 16 / (log(10000 / 0.1)) - 16 * log(0.1) / log(10000 / 0.1));
ivec2 tiles = (Global.framebuffer_size + 63) / 64;
ivec2 tiles = ivec2((Global.framebuffer_size + 63) / 64.0);
cluster.y = tiles.y - 1 - cluster.y;
return b_clusters[cluster.x + cluster.y * tiles.x + cluster.z * tiles.x * tiles.y];
}
@ -223,9 +223,9 @@ float toLinearDepth(mat4 inv_proj, float ndc_depth)
fragcoord.y = Global.framebuffer_size.y - fragcoord.y - 1;
#endif
cluster = ivec3(fragcoord.xy / 64, 0);
cluster = ivec3(fragcoord.xy / 64.0, 0);
cluster.z = int(log(linear_depth) * 16 / (log(10000 / 0.1)) - 16 * log(0.1) / log(10000 / 0.1));
ivec2 tiles = (Global.framebuffer_size + 63) / 64;
ivec2 tiles = ivec2((Global.framebuffer_size + 63) / 64.0);
cluster.y = tiles.y - 1 - cluster.y;
return b_clusters[cluster.x + cluster.y * tiles.x + cluster.z * tiles.x * tiles.y];
}
@ -331,7 +331,7 @@ float getShadow(sampler2D shadowmap, vec3 wpos, vec3 N)
float occluder = textureLod(shadowmap, uv, 0).r;
shadow += receiver > occluder - length(pcf_offset) * bias * 3 ? 1 : 0;
}
return shadow / 16;
return shadow / 16.0;
}
}
#endif
@ -538,7 +538,7 @@ vec3 pointLightsLighting(Cluster cluster, Surface surface, sampler2D shadow_atla
float occluder = textureLod(shadow_atlas, uv, 0).r;
shadow += receiver * 1.02 > occluder ? 1 : 0;
}
attn *= shadow / 16;
attn *= shadow / 16.0;
}
float fov = b_lights[light_idx].fov;

View file

@ -10,7 +10,7 @@ vertex_shader [[
layout (location = 0) out vec4 v_color;
void main() {
v_color = vec4(pow(a_color.rgb, vec3(2.2)), a_color.a);
v_color = vec4(pow(abs(a_color.rgb), vec3(2.2)), a_color.a);
gl_Position = Pass.view_projection * u_model * vec4(a_position, 1);
}
]]

View file

@ -83,7 +83,7 @@ fragment_shader [[
{
vec2 uv = v_uv * 2 - 1;
uv.y *= -1;
vec3 N;
vec3 N = vec3(0);
switch(u_face) {
case 0: N = vec3(1, -uv.y, -uv.x); break;

View file

@ -102,7 +102,7 @@ vertex_shader [[
v_lod = i_lod;
#endif
#if defined GRASS && defined VEGETATION
p = vegetationAnim(i_pos_scale.xyz, p, 1.0 / (1.0 + u_stiffness));
p = vegetationAnim(i_pos_scale.xyz, p, 1 / (1.0 + u_stiffness));
v_darken = a_position.y > 0.1 ? 1 : 0.0;
#elif defined VEGETATION
#ifdef DEPTH