KhronosGroup / KhronosGroup/SPIRV-Cross

[GLSL] Vertex shader ssbo emulation

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

Description

Is it hard to implement read-only ssbo emulation via usampler2D/usamplerBuffer/uniformBuffer in a vertex shader if not supported? GLSL may not support ssbo in shaders other than fragment and compute.

Emulation example (via uniform buffer):

```
#define SSBO_SIZE (4 * 2)

buffer SSBO
{
float floats[2];
}

void main()
{
float f0 = floats[0];
float f1 = floats[1];
...
}

-->

uniform SSBO
{
uvec4 buf[(SSBO_SIZE + 15) / 16];
};

void main()
{
float f1 = uintBitsToFloat(buf[0].x);
float f2 = uintBitsToFloat(buf[0].y);
...
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Start by examining how vertex shaders and SSBOs are currently handled, then compare that with the issue's usampler2D, usamplerBuffer, and uniform-buffer emulation example; done means read-only SSBO access works in vertex shaders where native support is unavailable.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.