From e5dcd917550c8dd72b3ccd2bc4bcc1d9a6be056c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 3 Feb 2022 00:08:27 +0100 Subject: DRW: Fix heatmap_gradient function messing error line number For some reason on some GL implementation (amdgpu) this particular syntaxes shift the error lines. Remove the context lines by default as they are not useful anymore. --- .../draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl | 4 ++-- .../blender/draw/engines/eevee/shaders/eevee_light_eval_lib.glsl | 4 ++-- .../eevee/shaders/eevee_shadow_tilemap_depth_scan_comp.glsl | 4 ++-- source/blender/draw/intern/shaders/common_math_lib.glsl | 8 +++++--- source/blender/gpu/intern/gpu_shader_log.cc | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl b/source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl index 21127cf65d0..b2fa2dea70d 100644 --- a/source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl @@ -19,8 +19,8 @@ void main(void) float lights_count = 0.0; uint lights_cull = 0u; - LIGHT_FOREACH_BEGIN_LOCAL ( - light_culling, lights_zbins, lights_culling_words, gl_FragCoord.xy, vP_z, l_idx) { + uvec2 px = uvec2(gl_FragCoord.xy); + LIGHT_FOREACH_BEGIN_LOCAL (light_culling, lights_zbins, lights_culling_words, px, vP_z, l_idx) { LightData light = lights[l_idx]; lights_cull |= 1u << l_idx; lights_count += 1.0; diff --git a/source/blender/draw/engines/eevee/shaders/eevee_light_eval_lib.glsl b/source/blender/draw/engines/eevee/shaders/eevee_light_eval_lib.glsl index 168ceb69d64..196564696f9 100644 --- a/source/blender/draw/engines/eevee/shaders/eevee_light_eval_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/eevee_light_eval_lib.glsl @@ -88,8 +88,8 @@ void light_eval(ClosureDiffuse diffuse, } LIGHT_FOREACH_END - LIGHT_FOREACH_BEGIN_LOCAL ( - light_culling, lights_zbins, lights_culling_words, gl_FragCoord.xy, vP_z, l_idx) { + uvec2 px = uvec2(gl_FragCoord.xy); + LIGHT_FOREACH_BEGIN_LOCAL (light_culling, lights_zbins, lights_culling_words, px, vP_z, l_idx) { light_eval_ex( diffuse, reflection, P, V, vP_z, thickness, ltc_mat, l_idx, out_diffuse, out_specular); } diff --git a/source/blender/draw/engines/eevee/shaders/eevee_shadow_tilemap_depth_scan_comp.glsl b/source/blender/draw/engines/eevee/shaders/eevee_shadow_tilemap_depth_scan_comp.glsl index 790028864c2..f423f9e6407 100644 --- a/source/blender/draw/engines/eevee/shaders/eevee_shadow_tilemap_depth_scan_comp.glsl +++ b/source/blender/draw/engines/eevee/shaders/eevee_shadow_tilemap_depth_scan_comp.glsl @@ -95,8 +95,8 @@ void main() } LIGHT_FOREACH_END - LIGHT_FOREACH_BEGIN_LOCAL ( - light_culling, lights_zbins, lights_culling_words, gl_GlobalInvocationID.xy, vP.z, l_idx) { + uvec2 px = gl_GlobalInvocationID.xy; + LIGHT_FOREACH_BEGIN_LOCAL (light_culling, lights_zbins, lights_culling_words, px, vP.z, l_idx) { tag_tilemap(l_idx, P, dist_to_cam, false); } LIGHT_FOREACH_END diff --git a/source/blender/draw/intern/shaders/common_math_lib.glsl b/source/blender/draw/intern/shaders/common_math_lib.glsl index e2941f1b049..72ba52804a1 100644 --- a/source/blender/draw/intern/shaders/common_math_lib.glsl +++ b/source/blender/draw/intern/shaders/common_math_lib.glsl @@ -250,9 +250,11 @@ vec3 neon_gradient(float t) } vec3 heatmap_gradient(float t) { - return saturate((pow(t, 1.5) * 0.8 + 0.2) * vec3(smoothstep(0.0, 0.35, t) + t * 0.5, - smoothstep(0.5, 1.0, t), - max(1.0 - t * 1.7, t * 7.0 - 6.0))); + float a = pow(t, 1.5) * 0.8 + 0.2; + float b = smoothstep(0.0, 0.35, t) + t * 0.5; + float c = smoothstep(0.5, 1.0, t); + float d = max(1.0 - t * 1.7, t * 7.0 - 6.0); + return saturate(a * vec3(b, c, d)); } vec3 hue_gradient(float t) { diff --git a/source/blender/gpu/intern/gpu_shader_log.cc b/source/blender/gpu/intern/gpu_shader_log.cc index 0c328876485..5220bae7afd 100644 --- a/source/blender/gpu/intern/gpu_shader_log.cc +++ b/source/blender/gpu/intern/gpu_shader_log.cc @@ -42,7 +42,7 @@ namespace blender::gpu { * \{ */ /* Number of lines before and after the error line to print for compilation errors. */ -#define DEBUG_CONTEXT_LINES 2 +#define DEBUG_CONTEXT_LINES 0 void Shader::print_log(Span sources, char *log, -- cgit v1.2.3