diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/eevee_culling_debug_frag.glsl | 31 |
1 files changed, 20 insertions, 11 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 f559788145d..33734324445 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 @@ -2,25 +2,34 @@ /** * Debug Shader outputing a gradient of orange - white - blue to mark culling hotspots. * Green pixels are error pixels that are missing lights from the culling pass (i.e: when culling - * pass is not conservative enough). This shader will only work on the last light batch so remove - * some lights from the scene you are debugging to have below CULLING_ITEM_BATCH lights. + * pass is not conservative enough). */ #pragma BLENDER_REQUIRE(common_view_lib.glsl) #pragma BLENDER_REQUIRE(common_math_lib.glsl) +#pragma BLENDER_REQUIRE(eevee_light_lib.glsl) #pragma BLENDER_REQUIRE(eevee_culling_iter_lib.glsl) -layout(std140) uniform lights_block +layout(std430, binding = 0) readonly restrict buffer lights_buf { - LightData lights[CULLING_ITEM_BATCH]; + LightData lights[]; }; -layout(std140) uniform lights_culling_block +layout(std430, binding = 1) readonly restrict buffer lights_zbins_buf { - CullingData culling; + CullingZBin lights_zbins[]; +}; + +layout(std430, binding = 2) readonly restrict buffer lights_culling_buf +{ + CullingData light_culling; +}; + +layout(std430, binding = 3) readonly restrict buffer lights_tile_buf +{ + CullingWord lights_culling_words[]; }; -uniform usampler2D item_culling_tx; uniform sampler2D depth_tx; in vec4 uvcoordsvar; @@ -29,14 +38,14 @@ layout(location = 0) out vec4 out_debug_color; void main(void) { - float depth = textureLod(depth_tx, uvcoordsvar.xy, 0.0).r; + float depth = texelFetch(depth_tx, ivec2(gl_FragCoord.xy), 0).r; float vP_z = get_view_z_from_depth(depth); vec3 P = get_world_space_from_depth(uvcoordsvar.xy, depth); float lights_count = 0.0; uint lights_cull = 0u; - ITEM_FOREACH_BEGIN (culling, item_culling_tx, vP_z, l_idx) { + ITEM_FOREACH_BEGIN (light_culling, lights_zbins, lights_culling_words, vP_z, l_idx) { LightData light = lights[l_idx]; lights_cull |= 1u << l_idx; lights_count += 1.0; @@ -44,7 +53,7 @@ void main(void) ITEM_FOREACH_END uint lights_nocull = 0u; - ITEM_FOREACH_BEGIN_NO_CULL (culling, l_idx) { + ITEM_FOREACH_BEGIN_NO_CULL (light_culling, l_idx) { LightData light = lights[l_idx]; if (distance(light._position, P) < light.influence_radius_max) { lights_nocull |= 1u << l_idx; @@ -57,6 +66,6 @@ void main(void) out_debug_color = vec4(0.0, 1.0, 0.0, 1.0); } else { - out_debug_color = vec4(heatmap_gradient(lights_count / 16.0), 1.0); + out_debug_color = vec4(heatmap_gradient(lights_count / 4.0), 1.0); } }
\ No newline at end of file |