From 2b2d374eb642edf345f93fa559e8cd7d76a0c9d1 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 26 Jan 2025 22:14:47 +0100 Subject: Fix mesh loading for new API --- shaders/CMakeLists.txt | 2 +- shaders/compute.comp | 17 ++++++++++------- shaders/test.comp | 10 +++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'shaders') diff --git a/shaders/CMakeLists.txt b/shaders/CMakeLists.txt index f572ced..8f6985f 100644 --- a/shaders/CMakeLists.txt +++ b/shaders/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(GLSL ${GLSL_SOURCE_FILES}) set(SPIRV "${PROJECT_BINARY_DIR}/shaders/${FILE_NAME}.spv") add_custom_command( OUTPUT ${SPIRV} - COMMAND glslc --target-env=vulkan1.2 -std=460 ${GLSL} -o ${SPIRV} -I "../../shaders/include" # relative to build directory + COMMAND glslc --target-env=vulkan1.2 -g -O -std=460 ${GLSL} -o ${SPIRV} -I "../../shaders/include" # relative to build directory DEPENDS ${GLSL}) list(APPEND SPIRV_BINARY_FILES ${SPIRV}) endforeach(GLSL) diff --git a/shaders/compute.comp b/shaders/compute.comp index 92fa9db..14f1238 100644 --- a/shaders/compute.comp +++ b/shaders/compute.comp @@ -142,13 +142,15 @@ vec3 ray_color(ray r, uint seed) { vec3 diffuse_color = srgb_to_linear(texture( sampler2D( textures[nonuniformEXT(tri.mat.base_color_texture.texture_id)], - samplers[nonuniformEXT(tri.mat.base_color_texture.sampler_id)] + // samplers[nonuniformEXT(tri.mat.base_color_texture.sampler_id)] + samplers[1] ), uv ).xyz) * tri.mat.base_color.xyz; vec2 metalness_roughness = texture( sampler2D( textures[nonuniformEXT(tri.mat.metallic_roughness_texture.texture_id)], - samplers[nonuniformEXT(tri.mat.metallic_roughness_texture.sampler_id)] + // samplers[nonuniformEXT(tri.mat.metallic_roughness_texture.sampler_id)] + samplers[1] ), uv ).xy * vec2(tri.mat.metalness, tri.mat.roughness); @@ -281,9 +283,10 @@ void main() { vec3 acc_color = srgb_to_linear(imageLoad(images[nonuniformEXT(bufs.accumulation_image_index)], coords).xyz); out_color = linear_to_srgb(mix(acc_color, out_color, spp_scale)); - for (uint i = 0; i < bufs.scene.downscale_factor; i++) { - for (uint j = 0; j < bufs.scene.downscale_factor; j++) { - imageStore(images[nonuniformEXT(bufs.output_image_index)], coords + ivec2(i, j), vec4(out_color, 1.0)); - } - } + // for (uint i = 0; i < bufs.scene.downscale_factor; i++) { + // for (uint j = 0; j < bufs.scene.downscale_factor; j++) { + // imageStore(images[nonuniformEXT(bufs.output_image_index)], coords + ivec2(i, j), vec4(out_color, 1.0)); + // } + // } + imageStore(images[nonuniformEXT(bufs.output_image_index)], coords, vec4(out_color, 1.0)); } diff --git a/shaders/test.comp b/shaders/test.comp index b3d2089..a17de69 100644 --- a/shaders/test.comp +++ b/shaders/test.comp @@ -6,10 +6,18 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; layout(set = 0, binding = 0) uniform sampler samplers[]; layout(set = 0, binding = 1) uniform texture2D textures[]; layout(set = 0, binding = 2, rgba32f) uniform image2D images[]; -layout(set = 2, binding = 0) uniform parameters { +// layout(set = 2, binding = 0) uniform parameters { +// uint input_id1; +// uint input_id2; +// uint output_id; +// } params; +layout(push_constant) uniform parameters { uint input_id1; + uint padding1; uint input_id2; + uint padding2; uint output_id; + uint padding3; } params; void main() { -- cgit v1.3