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
This commit is contained in:
Jeroen Bakker
2024-08-27 15:30:26 +02:00
parent f8af00e61b
commit 8e80cfdfd9

View File

@@ -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);