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.
diff --git a/Test/hlsl.structbuffer.coherent.frag b/Test/hlsl.structbuffer.coherent.frag
new file mode 100644
index 0000000..1c60ef5
--- /dev/null
+++ b/Test/hlsl.structbuffer.coherent.frag
@@ -0,0 +1,23 @@
+struct sb_t
+{
+ float3 color;
+ bool test;
+};
+
+
+globallycoherent RWStructuredBuffer<sb_t> sbuf;
+globallycoherent RWStructuredBuffer<float> sbuf2;
+
+float4 main(uint pos : FOO) : SV_Target0
+{
+ sbuf2[pos+1] = 42;
+
+ uint size;
+ uint stride;
+ sbuf.GetDimensions(size, stride);
+
+ if (sbuf[pos].test)
+ return float4(sbuf[pos].color + sbuf2[pos], 0);
+ else
+ return size + stride;
+}