KhronosGroup / KhronosGroup/SPIRV-Cross

[GLSL] `--flatten-ubo` with preserving names

Open
#2,020 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
GLSL
Stars
2.5k
Forks
713
Avg merge
2d 18h
Merged PRs (30d)
16

Description

Hi! Is it possible to flatten UBO with preserving member names? Or it's too complicated to support?

**GLSL (source) > SPIRV**:
```glsl
#version 450

layout (location = 0) uniform Constants
{
vec4 color;
// ...
};

layout (location = 0) out vec4 outColor;

void main()
{
outColor = color;
}
```

**SPIRV > GLSL (result)**:
```glsl
#version 110

// Instead of uniform vec4 Constants[...];
uniform vec4 color;
// uniform ...

void main()
{
gl_FragColor = color; // instead of Constants[0];
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the --flatten-ubo option handles UBO members during SPIR-V to GLSL translation. Compare the current flattened output with the requested preservation of member names in the issue example, then determine the required behavior and validation coverage. Done means flattened UBOs retain usable member names without breaking generated GLSL.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.