Problematic glsl code snippet:
for (int i = a; i < b; ++i) { // a, b and i can also be uint
//... do something or nothing
traceRayEXT(...);
//... do something or nothing
}
If all of the following conditions are fulfilled:
- the values of
a
andb
can be determined at compile time (e.g. macro or literal, or direct assigned with macro or literal right before the loop); - and
a >= b
; - and
VkRayTracingPipelineCreateInfoKHR::pStages
has other stages aside from the problematicraygen
stage;
vkCreateRayTracingPipelinesKHR
will throw: Exception thrown at 0x00007FF88F850D36 (nvrtum64.dll) in basic_test.exe: 0xC0000005: Access violation reading location 0x0000000000000030
.
Platform: Windows 11, RTX 2070 (notebook), Vulkan SDK 1.2.198.1, VS 2019 version 16.11.9.
I didn’t have this issue with driver version 497.29. Seems like erroneous shader optimization by the Vulkan driver.