diff --git a/samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp b/samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp index ab66c0481f..cbcee9f424 100644 --- a/samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp +++ b/samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp @@ -71,6 +71,17 @@ void RaytracingBasic::request_gpu_features(vkb::core::PhysicalDeviceC &gpu) REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceRayTracingPipelineFeaturesKHR, rayTracingPipeline); REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceAccelerationStructureFeaturesKHR, accelerationStructure); + + // Using this removes the need to explicitly force an image format inside the shader + if (gpu.get_features().shaderStorageImageReadWithoutFormat && gpu.get_features().shaderStorageImageWriteWithoutFormat) + { + gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; + gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE; + } + else + { + throw std::runtime_error("Requested required feature shaderStorageImageReadWithoutFormat or shaderStorageImageWriteWithoutFormat is not supported"); + } } /* diff --git a/samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp b/samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp index ef8afdb626..fcd8cd7940 100644 --- a/samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp +++ b/samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp @@ -149,6 +149,17 @@ void RaytracingExtended::request_gpu_features(vkb::core::PhysicalDeviceC &gpu) { gpu.get_mutable_requested_features().samplerAnisotropy = true; } + + // Using this removes the need to explicitly force an image format inside the shader + if (gpu.get_features().shaderStorageImageReadWithoutFormat && gpu.get_features().shaderStorageImageWriteWithoutFormat) + { + gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; + gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE; + } + else + { + throw std::runtime_error("Requested required feature shaderStorageImageReadWithoutFormat or shaderStorageImageWriteWithoutFormat is not supported"); + } } /* diff --git a/samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.cpp b/samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.cpp index 8d326e6327..c91d982896 100644 --- a/samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.cpp +++ b/samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.cpp @@ -69,6 +69,17 @@ void RayTracingPositionFetch::request_gpu_features(vkb::core::PhysicalDeviceC &g // Sample sepcific feature REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR, rayTracingPositionFetch); + + // Using this removes the need to explicitly force an image format inside the shader + if (gpu.get_features().shaderStorageImageReadWithoutFormat && gpu.get_features().shaderStorageImageWriteWithoutFormat) + { + gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; + gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE; + } + else + { + throw std::runtime_error("Requested required feature shaderStorageImageReadWithoutFormat or shaderStorageImageWriteWithoutFormat is not supported"); + } } /* diff --git a/samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp b/samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp index 31a6ded930..b08493053a 100644 --- a/samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp +++ b/samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp @@ -143,6 +143,17 @@ void RaytracingReflection::request_gpu_features(vkb::core::PhysicalDeviceC &gpu) { throw std::runtime_error("Requested required feature is not supported"); } + + // Using this removes the need to explicitly force an image format inside the shader + if (gpu.get_features().shaderStorageImageReadWithoutFormat && gpu.get_features().shaderStorageImageWriteWithoutFormat) + { + gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; + gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE; + } + else + { + throw std::runtime_error("Requested required feature shaderStorageImageReadWithoutFormat or shaderStorageImageWriteWithoutFormat is not supported"); + } } /* diff --git a/shaders/ray_tracing_basic/glsl/raygen.rgen b/shaders/ray_tracing_basic/glsl/raygen.rgen index 1f0cda6949..158b5dd7ad 100644 --- a/shaders/ray_tracing_basic/glsl/raygen.rgen +++ b/shaders/ray_tracing_basic/glsl/raygen.rgen @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2024, Sascha Willems +/* Copyright (c) 2019-2025, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * @@ -19,7 +19,7 @@ #extension GL_EXT_ray_tracing : enable layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS; -layout(binding = 1, set = 0, rgba8) uniform image2D image; +layout(binding = 1, set = 0) uniform writeonly image2D image; layout(binding = 2, set = 0) uniform CameraProperties { mat4 viewInverse; diff --git a/shaders/ray_tracing_basic/glsl/raygen.rgen.spv b/shaders/ray_tracing_basic/glsl/raygen.rgen.spv index cec392359b..ef00f85e1d 100644 Binary files a/shaders/ray_tracing_basic/glsl/raygen.rgen.spv and b/shaders/ray_tracing_basic/glsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_basic/hlsl/raygen.rgen.hlsl b/shaders/ray_tracing_basic/hlsl/raygen.rgen.hlsl index 8e0f6bc318..99db5dcb12 100644 --- a/shaders/ray_tracing_basic/hlsl/raygen.rgen.hlsl +++ b/shaders/ray_tracing_basic/hlsl/raygen.rgen.hlsl @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Sascha Willems +/* Copyright (c) 2024-2025, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * @@ -16,6 +16,7 @@ */ RaytracingAccelerationStructure rs : register(t0); +[[vk::image_format("unknown")]] RWTexture2D image : register(u1); struct CameraProperties diff --git a/shaders/ray_tracing_basic/hlsl/raygen.rgen.spv b/shaders/ray_tracing_basic/hlsl/raygen.rgen.spv index 23f7b86d40..afb3b90fbe 100644 Binary files a/shaders/ray_tracing_basic/hlsl/raygen.rgen.spv and b/shaders/ray_tracing_basic/hlsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_extended/glsl/raygen.rgen b/shaders/ray_tracing_extended/glsl/raygen.rgen index 017fc369e5..f274cd7f4f 100644 --- a/shaders/ray_tracing_extended/glsl/raygen.rgen +++ b/shaders/ray_tracing_extended/glsl/raygen.rgen @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2024 Holochip Corporation +/* Copyright (c) 2021-2025 Holochip Corporation * * SPDX-License-Identifier: Apache-2.0 * @@ -26,7 +26,7 @@ #define RENDER_AO 6 layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS; -layout(binding = 1, set = 0, rgba8) uniform image2D image; +layout(binding = 1, set = 0) uniform writeonly image2D image; layout(binding = 2, set = 0) uniform CameraProperties { mat4 viewInverse; diff --git a/shaders/ray_tracing_extended/glsl/raygen.rgen.spv b/shaders/ray_tracing_extended/glsl/raygen.rgen.spv index 2c3e35b897..76117de5f3 100644 Binary files a/shaders/ray_tracing_extended/glsl/raygen.rgen.spv and b/shaders/ray_tracing_extended/glsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_extended/hlsl/raygen.rgen.hlsl b/shaders/ray_tracing_extended/hlsl/raygen.rgen.hlsl index 1165e54628..0765dbf01a 100644 --- a/shaders/ray_tracing_extended/hlsl/raygen.rgen.hlsl +++ b/shaders/ray_tracing_extended/hlsl/raygen.rgen.hlsl @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Sascha Willems +/* Copyright (c) 2024-2025, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * @@ -24,6 +24,7 @@ #define RENDER_AO 6 RaytracingAccelerationStructure rs : register(t0); +[[vk::image_format("unknown")]] RWTexture2D image : register(u1); struct CameraProperties diff --git a/shaders/ray_tracing_extended/hlsl/raygen.rgen.spv b/shaders/ray_tracing_extended/hlsl/raygen.rgen.spv index b5891f0404..b72f044a66 100644 Binary files a/shaders/ray_tracing_extended/hlsl/raygen.rgen.spv and b/shaders/ray_tracing_extended/hlsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_position_fetch/glsl/raygen.rgen b/shaders/ray_tracing_position_fetch/glsl/raygen.rgen index 2e22e7e8d3..8be6b2e87f 100644 --- a/shaders/ray_tracing_position_fetch/glsl/raygen.rgen +++ b/shaders/ray_tracing_position_fetch/glsl/raygen.rgen @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Sascha Willems +/* Copyright (c) 2024-2025, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * @@ -19,7 +19,7 @@ #extension GL_EXT_ray_tracing : enable layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS; -layout(binding = 1, set = 0, rgba8) uniform image2D image; +layout(binding = 1, set = 0) uniform writeonly image2D image; layout(binding = 2, set = 0) uniform CameraProperties { mat4 viewInverse; diff --git a/shaders/ray_tracing_position_fetch/glsl/raygen.rgen.spv b/shaders/ray_tracing_position_fetch/glsl/raygen.rgen.spv index 6b1708343d..0937073bdb 100644 Binary files a/shaders/ray_tracing_position_fetch/glsl/raygen.rgen.spv and b/shaders/ray_tracing_position_fetch/glsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.hlsl b/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.hlsl index 51be3f2f0f..9922dcf572 100644 --- a/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.hlsl +++ b/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.hlsl @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Sascha Willems +/* Copyright (c) 2024-2025, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * @@ -16,6 +16,7 @@ */ RaytracingAccelerationStructure rs : register(t0); +[[vk::image_format("unknown")]] RWTexture2D image : register(u1); struct CameraProperties diff --git a/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.spv b/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.spv index 5535f2ed86..6b1d9c5df4 100644 Binary files a/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.spv and b/shaders/ray_tracing_position_fetch/hlsl/raygen.rgen.spv differ diff --git a/shaders/ray_tracing_reflection/raygen.rgen b/shaders/ray_tracing_reflection/raygen.rgen index b3368fe414..7711255ea9 100644 --- a/shaders/ray_tracing_reflection/raygen.rgen +++ b/shaders/ray_tracing_reflection/raygen.rgen @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION + * SPDX-FileCopyrightText: Copyright (c) 2014-2025 NVIDIA CORPORATION * SPDX-License-Identifier: Apache-2.0 */ @@ -21,7 +21,7 @@ #extension GL_EXT_ray_tracing : enable layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; -layout(set = 0, binding = 1, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform writeonly image2D image; layout(set = 0, binding = 2) uniform CameraProperties { mat4 viewInverse; diff --git a/shaders/ray_tracing_reflection/raygen.rgen.spv b/shaders/ray_tracing_reflection/raygen.rgen.spv index 31b0285003..d623474fa1 100644 Binary files a/shaders/ray_tracing_reflection/raygen.rgen.spv and b/shaders/ray_tracing_reflection/raygen.rgen.spv differ