glslang/Test/hlsl.structbuffer.byte.frag
steve-lunarg 5da1f038d8 HLSL: implement 4 (of 6) structuredbuffer types
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.
2017-02-21 15:51:49 -07:00

14 lines
254 B
GLSL

ByteAddressBuffer sbuf;
float4 main(uint pos : FOO) : SV_Target0
{
uint size;
sbuf.GetDimensions(size);
return sbuf.Load(pos) +
float4(sbuf.Load2(pos+4), 0, 0) +
float4(sbuf.Load3(pos+8), 0) +
sbuf.Load4(pos+12);
}