From 8e80cfdfd989d72f174b503f181635ff8d7a0cdd Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 27 Aug 2024 15:30:26 +0200 Subject: [PATCH] EEVEE: Enable Shader Specialization Spatial Denoise Spatial denoise uses shader specialization. The current shader had this disabled for OpenGL and Vulkan. As OpenGL and Vulkan supports shader specialization it is fine to enable them. Would result in better optimized shaders. I checked other shaders as well. This was the only one ignoring shader specialization. Pull Request: https://projects.blender.org/blender/blender/pulls/126830 --- .../shaders/eevee_ray_denoise_spatial_comp.glsl | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_ray_denoise_spatial_comp.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_ray_denoise_spatial_comp.glsl index 6dd797f544a..f7bc098f72b 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_ray_denoise_spatial_comp.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_ray_denoise_spatial_comp.glsl @@ -51,21 +51,10 @@ void main() const uint tile_size = RAYTRACE_GROUP_SIZE; uvec2 tile_coord = unpackUvec2x16(tiles_coord_buf[gl_WorkGroupID.x]); -#ifdef GPU_METAL - int rt_resolution_scale = raytrace_resolution_scale; -#else /* TODO(fclem): Support specialization on OpenGL and Vulkan. */ - int rt_resolution_scale = uniform_buf.raytrace.resolution_scale; -#endif - ivec2 texel_fullres = ivec2(gl_LocalInvocationID.xy + tile_coord * tile_size); - ivec2 texel = (texel_fullres) / rt_resolution_scale; + ivec2 texel = (texel_fullres) / raytrace_resolution_scale; -#ifdef GPU_METAL - bool do_skip_denoise = skip_denoise; -#else /* TODO(fclem): Support specialization on OpenGL and Vulkan. */ - bool do_skip_denoise = uniform_buf.raytrace.skip_denoise; -#endif - if (do_skip_denoise) { + if (skip_denoise) { imageStore(out_radiance_img, texel_fullres, imageLoad(ray_radiance_img, texel)); return; } @@ -126,7 +115,7 @@ void main() /* NOTE: filter_size should never be greater than twice RAYTRACE_GROUP_SIZE. Otherwise, the * reconstruction can becomes ill defined since we don't know if further tiles are valid. */ float filter_size = 12.0 * sqrt(filter_size_factor); - if (rt_resolution_scale > 1) { + if (raytrace_resolution_scale > 1) { /* Filter at least 1 trace pixel to fight the undersampling. */ filter_size = max(filter_size, 3.0); sample_count = max(sample_count, 5u);