google / google/shaderc

Internal error optimising SPIR-V1.4 shader with Vulkan 1.1 target

Open
#1,222 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.