mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-24 03:39:51 +00:00
5da1f038d8
This is a partial implemention of structurebuffers supporting: * structured buffer types of: * StructuredBuffer * RWStructuredBuffer * ByteAddressBuffer * RWByteAddressBuffer * Atomic operations on RWByteAddressBuffer * Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type) * globallycoherent flag But NOT yet supporting: * AppendStructuredBuffer / ConsumeStructuredBuffer types * IncrementCounter/DecrementCounter methods Please note: the stride returned by GetDimensions is as calculated by glslang for std430, and may not match other environments in all cases.
24 lines
451 B
GLSL
24 lines
451 B
GLSL
struct sb_t
|
|
{
|
|
float3 color;
|
|
bool test;
|
|
bool test2;
|
|
}; // stride = 20
|
|
|
|
StructuredBuffer<sb_t> sbuf : register(c10);
|
|
StructuredBuffer<float> sbuf2;
|
|
|
|
float4 main(uint pos : FOO) : SV_Target0
|
|
{
|
|
sb_t mydata = sbuf.Load(pos);
|
|
|
|
uint size;
|
|
uint stride;
|
|
sbuf.GetDimensions(size, stride);
|
|
|
|
if (sbuf[pos].test)
|
|
return float4(sbuf[pos].color + sbuf2[pos], 0);
|
|
else
|
|
return mydata.color.x + size + stride;
|
|
}
|