KhronosGroup / KhronosGroup/glslang

StorageBufferArrayDynamicIndexing capability missing

Open
#981 2 comments 0 reactions 0 assignees View on GitHub
bug SPIR-V
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

Given the following glsl compute shader
```glsl
#version 430
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

layout (set = 0, binding = 0) buffer dat {
uint data[];
} ssboData[5];

void main() {
uint index = gl_GlobalInvocationID.x;
uint output_value = 0;
for (int i = 0; i < 4; ++i) {
output_value += ssboData[i].data[index];
}
ssboData[4].data[index] = output_value;
}
```

The StorageBufferArrayDynamicIndexing is not declared in the resulting SPIR-V module, meaning that indexing into ssboData must be with constant values.

Either StorageBufferArrayDynamicIndexing should be declared, or the module should fail compilation.
Alternatively the loop could be unrolled since every iteration is known at compile time.

It would also be nice to have a way to specify which features are available to be used in order to prevent accidentally emiting SPIR-V that cannot be consumed by a target environment. (I.e. similar to the limits).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided GLSL compute shader and inspecting its generated SPIR-V module. Determine whether dynamic indexing should declare StorageBufferArrayDynamicIndexing or cause compilation to fail; the issue also raises loop unrolling and target-feature configuration as alternatives.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.