#include "vk_denoiser.h" #include "ray_resources.h" #include "ray_pass.h" #define LIST_OUTPUTS(X) \ X(0, denoised) \ #define LIST_INPUTS(X) \ X(1, base_color_a) \ X(2, light_poly_diffuse) \ X(3, light_poly_specular) \ X(4, light_point_diffuse) \ X(5, light_point_specular) \ X(6, emissive) \ X(7, position_t) \ X(8, normals_gs) \ static const VkDescriptorSetLayoutBinding bindings[] = { #define BIND_IMAGE(index, name) \ { \ .binding = index, \ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, \ .descriptorCount = 1, \ .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, \ }, LIST_OUTPUTS(BIND_IMAGE) LIST_INPUTS(BIND_IMAGE) #undef BIND_IMAGE }; static const int semantics[] = { #define IN(index, name, ...) (RayResource_##name + 1), #define OUT(index, name, ...) -(RayResource_##name + 1), LIST_OUTPUTS(OUT) LIST_INPUTS(IN) #undef IN #undef OUT }; struct ray_pass_s *R_VkRayDenoiserCreate( void ) { const ray_pass_create_compute_t rpcc = { .debug_name = "denoiser", .layout = { .bindings = bindings, .bindings_semantics = semantics, .bindings_count = COUNTOF(bindings), .push_constants = {0}, }, .shader = "denoiser.comp.spv", .specialization = NULL, }; return RayPassCreateCompute( &rpcc ); }