rtx: move push constant definition to a common place; specialize shader constants

This commit is contained in:
Ivan Avdeev 2021-10-03 10:30:06 -07:00 committed by Ivan Avdeev
parent 417caad50b
commit 20369dd9ab
4 changed files with 14 additions and 14 deletions

View File

@ -59,12 +59,9 @@ layout (set = 0, binding = 8, align = 1) readonly buffer UBOLightClusters {
layout(set = 0, binding = 9, rgba8) uniform readonly image2D previous_frame;
layout (push_constant) uniform PushConstants {
uint random_seed;
int bounces;
float prev_frame_blend_factor;
float pixel_cone_spread_angle;
} push_constants;
layout (push_constant) uniform PC__ {
PushConstants push_constants;
};
layout(location = 0) rayPayloadEXT RayPayload payload;
layout(location = 1) rayPayloadEXT bool shadow;

View File

@ -35,6 +35,13 @@ struct PointLight {
vec4 color;
};
struct PushConstants {
uint random_seed;
int bounces;
float prev_frame_blend_factor;
float pixel_cone_spread_angle;
};
#ifndef GLSL
#undef uint
#undef vec3

View File

@ -12,5 +12,5 @@
#define MAX_POINT_LIGHTS 255
#define MAX_VISIBLE_POINT_LIGHTS 31
#define MAX_VISIBLE_SURFACE_LIGHTS 255
#define MAX_LIGHT_CLUSTERS 32768
#define LIGHT_GRID_CELL_SIZE 256
#define MAX_LIGHT_CLUSTERS 262144 //131072 //32768
#define LIGHT_GRID_CELL_SIZE 128

View File

@ -45,12 +45,7 @@ typedef struct {
float padding_;
} vk_light_t;
typedef struct {
uint32_t random_seed;
int bounces;
float prev_frame_blend_factor;
float pixel_cone_spread_angle;
} vk_rtx_push_constants_t;
typedef struct PushConstants vk_rtx_push_constants_t;
typedef struct {
int min_cell[4], size[3]; // 4th element is padding
@ -377,6 +372,7 @@ static void createPipeline( void )
.stage = VK_SHADER_STAGE_##bit##_BIT_KHR, \
.module = loadShader(filename), \
.pName = "main", \
.pSpecializationInfo = &spec, \
}
VkPipelineShaderStageCreateInfo shaders[ShaderStageIndex_COUNT];