KhronosGroup / KhronosGroup/SPIRV-Tools

Validator does not check for offset through decorations groups.

Open
#2,376 1 comment 0 reactions 0 assignees View on GitHub
bug component:validation
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

When I run the code below through the validator, it says

> error: line 18: Structure id 6 decorated as Block must be explicitly laid out with Offset decorations.
%_struct_6 = OpTypeStruct %float %float %float

However, the offset are there through group decorations.

```
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %1 "main"
OpSource HLSL 600
%2 = OpDecorationGroup
%3 = OpDecorationGroup
%4 = OpDecorationGroup
OpDecorate %5 DescriptorSet 0
OpDecorate %5 Binding 0
OpDecorate %2 Offset 0
OpDecorate %3 Offset 4
OpDecorate %4 Offset 8
OpDecorate %6 Block
OpGroupMemberDecorate %2 %6 0
OpGroupMemberDecorate %3 %6 1
OpGroupMemberDecorate %4 %6 2
%7 = OpTypeFloat 32
%6 = OpTypeStruct %7 %7 %7
%8 = OpTypePointer Uniform %6
%9 = OpTypeVoid
%10 = OpTypeFunction %9
%5 = OpVariable %8 Uniform
%1 = OpFunction %9 None %10
%11 = OpLabel
OpReturn
OpFunctionEnd
```

Contributor guide

Open the contributing guide

Research direction

Start by running the provided SPIR-V module through the validator and tracing how OpGroupMemberDecorate is handled when checking the Block structure. Verify whether the grouped Offset decorations are considered for each member; done means the example validates without the reported missing-offset error and coverage exists for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.