KhronosGroup / KhronosGroup/SPIRV-Tools

[spirv-val] are values of different base types (underlying types) allowed to be packed in a location ?

Open
#6,558 7 comments 0 reactions 1 assignee Claimed by @spencer-lunarg View on GitHub
component:validation
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

Hi,

I have a question.

The Vulkan documentation page (https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-iointerfaces) has the following paragraph.

> Output Component words identified as 0, 1, 2, and 3 will be directed to the R, G, B, and A inputs to the blending unit, respectively, or to the output attachment if blending is disabled. _If two variables are placed within the same Location, they must have the same underlying type (floating-point or integer)._ Component words which do not correspond to any fragment shader output will also result in undefined values for blending or color attachment writes.

But when I run spirv-val on a vertex shader containing the following, it happily says the shader is valid.

` OpDecorate %TEXCOORD_2 Flat`
` OpDecorate %TEXCOORD_2 Location 1`
` OpDecorate %TEXCOORD_3 Flat`
` OpDecorate %TEXCOORD_3 Location 1`
` OpDecorate %TEXCOORD_3 Component 3`
` ...`
` %TEXCOORD_2 = OpVariable %_ptr_Output_v3float Output`
`%_ptr_Output_uint = OpTypePointer Output %uint`
`%TEXCOORD_3 = OpVariable %_ptr_Output_uint Output`

Notice that %TEXCOORD_2's underlying type is float, and %TEXCOORD_3's is uint.

I think the vulkan documentation says the two variables must have the same underlying type, either float or uint.

Did spirv-val incorrectly miss the type difference or am I reading the vulkan documentation incorrectly?

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.