Skip to content

Commit 4e27835

Browse files
committed
Fix ray tracing validation
1 parent b2c6fa3 commit 4e27835

File tree

21 files changed

+30
-12
lines changed

21 files changed

+30
-12
lines changed

base/VulkanRaytracingSample.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Extended sample base class for ray tracing based samples
33
*
4-
* Copyright (C) 2020-2024 by Sascha Willems - www.saschawillems.de
4+
* Copyright (C) 2020-2025 by Sascha Willems - www.saschawillems.de
55
*
66
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
77
*/
@@ -139,6 +139,9 @@ void VulkanRaytracingSample::enableExtensions()
139139

140140
// Required by VK_KHR_spirv_1_4
141141
enabledDeviceExtensions.push_back(VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME);
142+
143+
// Format for the storage image is decided at runtime, so we can't explicilily state it in the shader
144+
enabledFeatures.shaderStorageImageWriteWithoutFormat = VK_TRUE;
142145
}
143146

144147
VulkanRaytracingSample::ScratchBuffer VulkanRaytracingSample::createScratchBuffer(VkDeviceSize size)

examples/raytracingbasic/raytracingbasic.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@ class VulkanExample : public VulkanExampleBase
743743
enabledAccelerationStructureFeatures.pNext = &enabledRayTracingPipelineFeatures;
744744

745745
deviceCreatepNextChain = &enabledAccelerationStructureFeatures;
746+
747+
// Format for the storage image is decided at runtime, so we can't explicilily state it in the shader
748+
enabledFeatures.shaderStorageImageWriteWithoutFormat = VK_TRUE;
746749
}
747750

748751
void prepare()

examples/raytracingsbtdata/raytracingsbtdata.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ class VulkanExample : public VulkanExampleBase
105105

106106
// Required by VK_KHR_spirv_1_4
107107
enabledDeviceExtensions.push_back(VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME);
108+
109+
// Format for the storage image is decided at runtime, so we can't explicilily state it in the shader
110+
enabledFeatures.shaderStorageImageWriteWithoutFormat = VK_TRUE;
108111
}
109112

110113
~VulkanExample()

shaders/glsl/raytracingbasic/raygen.rgen

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#version 460
22
#extension GL_EXT_ray_tracing : enable
3+
#extension GL_EXT_shader_image_load_formatted : enable
34

45
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
5-
layout(binding = 1, set = 0, rgba8) uniform image2D image;
6+
layout(binding = 1, set = 0) uniform image2D image;
67
layout(binding = 2, set = 0) uniform CameraProperties
78
{
89
mat4 viewInverse;
32 Bytes
Binary file not shown.

shaders/glsl/raytracingcallable/raygen.rgen

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#version 460
22
#extension GL_EXT_ray_tracing : require
3+
#extension GL_EXT_shader_image_load_formatted : enable
34

45
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
5-
layout(binding = 1, set = 0, rgba8) uniform image2D image;
6+
layout(binding = 1, set = 0) uniform image2D image;
67
layout(binding = 2, set = 0) uniform CameraProperties
78
{
89
mat4 viewInverse;
32 Bytes
Binary file not shown.

shaders/glsl/raytracinggltf/raygen.rgen

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Sascha Willems
1+
/* Copyright (c) 2023-2025, Sascha Willems
22
*
33
* SPDX-License-Identifier: MIT
44
*
@@ -7,9 +7,10 @@
77
#version 460
88
#extension GL_EXT_ray_tracing : enable
99
#extension GL_GOOGLE_include_directive : require
10+
#extension GL_EXT_shader_image_load_formatted : enable
1011

1112
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
12-
layout(binding = 1, set = 0, rgba8) uniform image2D image;
13+
layout(binding = 1, set = 0) uniform image2D image;
1314
layout(binding = 2, set = 0) uniform CameraProperties
1415
{
1516
mat4 viewInverse;
56 Bytes
Binary file not shown.

shaders/glsl/raytracingintersection/raygen.rgen

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#version 460
22
#extension GL_EXT_ray_tracing : require
3+
#extension GL_EXT_shader_image_load_formatted : enable
34

45
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
5-
layout(binding = 1, set = 0, rgba8) uniform image2D image;
6+
layout(binding = 1, set = 0) uniform image2D image;
67
layout(binding = 2, set = 0) uniform CameraProperties
78
{
89
mat4 viewInverse;

0 commit comments

Comments
 (0)