diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-04-18 20:13:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-04-18 22:33:09 +0300 |
commit | 5bbc803ff0538c3363dcf785d53be0d1804bd37e (patch) | |
tree | e3e7c7f67cbc8588e36cf53d84b31564a714bfdc /source/blender/draw/engines | |
parent | 85b4398d90be1d11399e94c4d641e5ce0fd69189 (diff) |
Eevee: Fix crash on core profile.
Diffstat (limited to 'source/blender/draw/engines')
3 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index 96402f5ada2..0f47a341764 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -153,9 +153,9 @@ void make_orthonormal_basis(vec3 N, out vec3 T, out vec3 B) } /* ---- Opengl Depth conversion ---- */ -float linear_depth(float z, float zf, float zn) +float linear_depth(bool is_persp, float z, float zf, float zn) { - if (gl_ProjectionMatrix[3][3] == 0.0) { + if (is_persp) { return (zn * zf) / (z * (zn - zf) + zf); } else { @@ -163,9 +163,9 @@ float linear_depth(float z, float zf, float zn) } } -float buffer_depth(float z, float zf, float zn) +float buffer_depth(bool is_persp, float z, float zf, float zn) { - if (gl_ProjectionMatrix[3][3] == 0.0) { + if (is_persp) { return (zf * (zn - z)) / (z * (zn - zf)); } else { diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl index da14a2dfee4..898c7bfc578 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl @@ -8,7 +8,7 @@ vec2 jitternoise = vec2(0.0); void setup_noise(void) { - jitternoise = texture(texJitter, gl_FragCoord.xy / NOISE_SIZE, 0).rg; /* Global variable */ + jitternoise = texture(texJitter, gl_FragCoord.xy / NOISE_SIZE).rg; /* Global variable */ } vec3 hammersley_3d(float i, float invsamplenbr) diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl index 9bd8dba452d..598d34941eb 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl @@ -153,7 +153,8 @@ float light_visibility(LightData ld, ShadingData sd) /* Depth in lightspace to compare against shadow map */ float w = dot(maj_axis, sd.l_vector); w -= scd.sh_map_bias * w; - float shdepth = buffer_depth(w, scd.sh_cube_far, scd.sh_cube_near); + bool is_persp = (ProjectionMatrix[3][3] == 0.0); + float shdepth = buffer_depth(is_persp, w, scd.sh_cube_far, scd.sh_cube_near); vis *= texture(shadowCubes, vec4(uvs, shid * 6.0 + face, shdepth)); } |