VK_NV_raytracing rgen shaders generating invalid SPIR-V(?)

Hi there,

I’m following the VkRay tutorials (VkRayTutorials-25259758-v2.zip)… and there seem to be some issues that have carried over to the tutorials found here: NVIDIA Vulkan Ray Tracing Tutorial | NVIDIA Developer

I’m getting the following SPIR-V validation error:

ERROR: [Validation] Code 0 :  [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object: VK_NULL_HANDLE (Type = 0) | SPIR-V module not valid: UniformConstant id '73' is missing DescriptorSet decoration.
From Vulkan spec, section 14.5.2:
These variables must have DescriptorSet and Binding decorations specified
  %73 = OpVariable %_ptr_UniformConstant_71 UniformConstant

Seems to be around the call to traceNV(). The new tutorials seem to have similar a issue:

[vulkan] ObjectType: 0
Message:  [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object: VK_NULL_HANDLE (Type = 0) | SPIR-V module not valid: UniformConstant id '359' is missing DescriptorSet decoration.
From Vulkan spec, section 14.5.2:
These variables must have DescriptorSet and Binding decorations specified
  %topLevelAS = OpVariable %_ptr_UniformConstant_357 UniformConstant

I’m using Vulkan SDK 1.1.97.0. I understand that this is not a showstopper but it would be great if the validation layer came back with a clean bill of health. Also, I’ve noticed that the tutorial is not requesting VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME
and VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME instance and device extensions. Requesting those definitely reduce a lot of errors for me.

Hopefully these are of some use to resolving the issues. If there’s a GitHub version of the tutorials that I’m missing, a link would be highly appreciated.

Much thanks,
Baktash.

Yes, I noticed the same. The tutorial is full of validation errors. Doesn’t inspire much confidence.

In this particular case, I’ve got rid of this error with the following code (notice the set=0):

layout(binding = 0, set = 0) uniform accelerationStructureNV Scene;

I’ve also got the following validation errors when creating the acceleration structures. They claim it has been fixed in the SDK 1.1.97, but I still get them (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/532).

ERROR: VALIDATION: vkCmdPipelineBarrier(): pMemBarriers[0].srcAccessMask (0x600000) is not supported by srcStageMask (0x200000).

These are caused by the vkCmdPipelineBarrier calls in the helper classes (NVIDIA Vulkan Ray Tracing Helpers: Introduction | NVIDIA Developer). The validation errors go away when I replace the stage bits with VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV, but I do not know wether that is the correct thing to do in this case.

vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV,
                       VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV, 0, 1, &memoryBarrier, 0, nullptr, 0,
                       nullptr);

I guess adding set = 0 for accelerationStructureNV fixed things!