first step for compute task

This commit is contained in:
zomseffen 2025-04-02 11:10:12 +02:00
parent 579820334d
commit c02522b6c2
16 changed files with 470 additions and 32 deletions

View file

@ -7,4 +7,6 @@ C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/cuboid.frag -o shaders/compiled/fra
C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/cuboid.geom -o shaders/compiled/geo_cuboid.spv
C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/rt_quad.vert -o shaders/compiled/vert_rt_quad.spv
C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/rt_quad.frag -o shaders/compiled/frag_rt_quad.spv
C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/rt_quad.frag -o shaders/compiled/frag_rt_quad.spv
C:/VulkanSDK/1.3.280.0/Bin/glslc.exe shaders/rt_compute.comp -o shaders/compiled/rt_compute.spv

Binary file not shown.

Binary file not shown.

27
shaders/rt_compute.comp Normal file
View file

@ -0,0 +1,27 @@
#version 450
layout(binding = 0) uniform UniformBufferObject {
mat4 model;
mat4 geom_rot;
mat4 view;
mat4 proj;
vec3 camera_pos;
bool[16] use_geom_shader;
} ubo;
layout(binding = 3) readonly buffer SceneInfoBuffer {
uint gridsIn[];
};
layout(binding = 4) buffer SceneInfoBuffer2 {
uint volumes[];
};
layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
void main() {
uint index = gl_GlobalInvocationID.x;
volumes[index] = gridsIn[index];
}

View file

@ -24,9 +24,13 @@ layout(binding = 0) uniform UniformBufferObject {
// 3 - diffuse raster size (float, needs to be decoded)
// 4 - max recursive rays
// 5 - diffuse rays per hit
layout(binding = 2) buffer SceneInfoBuffer{
layout(binding = 2) readonly buffer SceneInfoBuffer{
uint infos[];
} scene_info;
layout(binding = 4) buffer SceneInfoBuffer2 {
uint infos[];
} scene_info2;
uint max_num_lights = scene_info.infos[0];
uint max_iterations_per_light = scene_info.infos[1];
// diffuse raytracing using a quadratic raster of rays