shaderc
shaderc copied to clipboard
Internal error optimising SPIR-V1.4 shader with Vulkan 1.1 target
The following simple ray gen shader produces an error:
shaderc: internal error: compilation succeeded but failed to optimize: Invalid SPIR-V binary version 1.4 for target environment SPIR-V 1.3 (under Vulkan 1.1 semantics).
when built with the command line:
glslc -O --target-env=vulkan1.1 --target-spv=spirv1.4 test.rgen
#version 460
#extension GL_EXT_ray_tracing : require
struct Payload
{
int dummy;
};
layout(location = 0) rayPayloadEXT Payload payload;
layout(set = 0, binding = 0) uniform accelerationStructureEXT tlas;
void main()
{
vec3 org = vec3(0, 0, 0);
vec3 dir = vec3(0, 0, 1);
traceRayEXT(tlas, 0, 0xff, 0, 0, 0, org, 0.0, dir, 1.0e20, 0);
}
Leave out the -O
or change the target env to Vulkan 1.2 and it'll compile fine.
I think what's happening is that GetSpirvToolsTargetEnv
probably needs to return SPV_ENV_VULKAN_1_1_SPIRV_1_4
rather than SPV_ENV_VULKAN_1_1
for this case...