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.
This commit is contained in:
steve-lunarg 2017-02-12 17:50:28 -07:00
parent c8aed91524
commit 5da1f038d8
22 changed files with 3993 additions and 37 deletions

View File

@ -1125,7 +1125,8 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vec
Id Builder::createArrayLength(Id base, unsigned int member)
{
Instruction* length = new Instruction(getUniqueId(), makeIntType(32), OpArrayLength);
spv::Id intType = makeIntType(32);
Instruction* length = new Instruction(getUniqueId(), intType, OpArrayLength);
length->addIdOperand(base);
length->addImmediateOperand(member);
buildPoint->addInstruction(std::unique_ptr<Instruction>(length));

View File

@ -0,0 +1,599 @@
hlsl.structbuffer.atomics.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main(u1; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'pos' (in uint)
0:? Sequence
0:8 AtomicAdd (temp void)
0:8 indirect index (layout(row_major std430 ) buffer uint)
0:8 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:8 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:8 Constant:
0:8 0 (const uint)
0:8 right-shift (temp int)
0:8 Constant:
0:8 8 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 Constant:
0:8 1 (const int)
0:9 move second child to first child (temp uint)
0:9 'u' (temp uint)
0:9 AtomicAdd (temp uint)
0:9 indirect index (layout(row_major std430 ) buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
0:9 Constant:
0:9 8 (const int)
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 1 (const int)
0:10 AtomicAnd (temp void)
0:10 indirect index (layout(row_major std430 ) buffer uint)
0:10 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 right-shift (temp int)
0:10 Constant:
0:10 8 (const int)
0:10 Constant:
0:10 2 (const int)
0:10 Constant:
0:10 1 (const int)
0:11 move second child to first child (temp uint)
0:11 'u' (temp uint)
0:11 AtomicAnd (temp uint)
0:11 indirect index (layout(row_major std430 ) buffer uint)
0:11 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 right-shift (temp int)
0:11 Constant:
0:11 8 (const int)
0:11 Constant:
0:11 2 (const int)
0:11 Constant:
0:11 1 (const int)
0:12 move second child to first child (temp uint)
0:12 'u' (temp uint)
0:12 Convert int to uint (temp uint)
0:12 AtomicCompSwap (temp int)
0:12 indirect index (layout(row_major std430 ) buffer uint)
0:12 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 right-shift (temp int)
0:12 Constant:
0:12 8 (const int)
0:12 Constant:
0:12 2 (const int)
0:12 Constant:
0:12 1 (const int)
0:12 Constant:
0:12 2 (const int)
0:14 move second child to first child (temp uint)
0:14 'u' (temp uint)
0:14 AtomicExchange (temp uint)
0:14 indirect index (layout(row_major std430 ) buffer uint)
0:14 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:14 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:14 Constant:
0:14 0 (const uint)
0:14 right-shift (temp int)
0:14 Constant:
0:14 8 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 Constant:
0:14 1 (const int)
0:15 AtomicMax (temp void)
0:15 indirect index (layout(row_major std430 ) buffer uint)
0:15 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:15 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:15 Constant:
0:15 0 (const uint)
0:15 right-shift (temp int)
0:15 Constant:
0:15 8 (const int)
0:15 Constant:
0:15 2 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 move second child to first child (temp uint)
0:16 'u' (temp uint)
0:16 AtomicMax (temp uint)
0:16 indirect index (layout(row_major std430 ) buffer uint)
0:16 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:16 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:16 Constant:
0:16 0 (const uint)
0:16 right-shift (temp int)
0:16 Constant:
0:16 8 (const int)
0:16 Constant:
0:16 2 (const int)
0:16 Constant:
0:16 1 (const int)
0:17 AtomicMin (temp void)
0:17 indirect index (layout(row_major std430 ) buffer uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 right-shift (temp int)
0:17 Constant:
0:17 8 (const int)
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 1 (const int)
0:18 move second child to first child (temp uint)
0:18 'u' (temp uint)
0:18 AtomicMin (temp uint)
0:18 indirect index (layout(row_major std430 ) buffer uint)
0:18 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:18 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:18 Constant:
0:18 0 (const uint)
0:18 right-shift (temp int)
0:18 Constant:
0:18 8 (const int)
0:18 Constant:
0:18 2 (const int)
0:18 Constant:
0:18 1 (const int)
0:19 AtomicOr (temp void)
0:19 indirect index (layout(row_major std430 ) buffer uint)
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 right-shift (temp int)
0:19 Constant:
0:19 8 (const int)
0:19 Constant:
0:19 2 (const int)
0:19 Constant:
0:19 1 (const int)
0:20 move second child to first child (temp uint)
0:20 'u' (temp uint)
0:20 AtomicOr (temp uint)
0:20 indirect index (layout(row_major std430 ) buffer uint)
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 right-shift (temp int)
0:20 Constant:
0:20 8 (const int)
0:20 Constant:
0:20 2 (const int)
0:20 Constant:
0:20 1 (const int)
0:21 AtomicXor (temp void)
0:21 indirect index (layout(row_major std430 ) buffer uint)
0:21 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:21 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:21 Constant:
0:21 0 (const uint)
0:21 right-shift (temp int)
0:21 Constant:
0:21 8 (const int)
0:21 Constant:
0:21 2 (const int)
0:21 Constant:
0:21 1 (const int)
0:22 move second child to first child (temp uint)
0:22 'u' (temp uint)
0:22 AtomicXor (temp uint)
0:22 indirect index (layout(row_major std430 ) buffer uint)
0:22 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:22 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:22 Constant:
0:22 0 (const uint)
0:22 right-shift (temp int)
0:22 Constant:
0:22 8 (const int)
0:22 Constant:
0:22 2 (const int)
0:22 Constant:
0:22 1 (const int)
0:24 Branch: Return with expression
0:24 Construct vec4 (temp 4-component vector of float)
0:24 Convert uint to float (temp float)
0:24 indirect index (layout(row_major std430 ) buffer uint)
0:24 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:24 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:24 Constant:
0:24 0 (const uint)
0:24 right-shift (temp int)
0:24 'pos' (in uint)
0:24 Constant:
0:24 2 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main(u1; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'pos' (in uint)
0:? Sequence
0:8 AtomicAdd (temp void)
0:8 indirect index (layout(row_major std430 ) buffer uint)
0:8 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:8 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:8 Constant:
0:8 0 (const uint)
0:8 right-shift (temp int)
0:8 Constant:
0:8 8 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 Constant:
0:8 1 (const int)
0:9 move second child to first child (temp uint)
0:9 'u' (temp uint)
0:9 AtomicAdd (temp uint)
0:9 indirect index (layout(row_major std430 ) buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
0:9 Constant:
0:9 8 (const int)
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 1 (const int)
0:10 AtomicAnd (temp void)
0:10 indirect index (layout(row_major std430 ) buffer uint)
0:10 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 right-shift (temp int)
0:10 Constant:
0:10 8 (const int)
0:10 Constant:
0:10 2 (const int)
0:10 Constant:
0:10 1 (const int)
0:11 move second child to first child (temp uint)
0:11 'u' (temp uint)
0:11 AtomicAnd (temp uint)
0:11 indirect index (layout(row_major std430 ) buffer uint)
0:11 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 right-shift (temp int)
0:11 Constant:
0:11 8 (const int)
0:11 Constant:
0:11 2 (const int)
0:11 Constant:
0:11 1 (const int)
0:12 move second child to first child (temp uint)
0:12 'u' (temp uint)
0:12 Convert int to uint (temp uint)
0:12 AtomicCompSwap (temp int)
0:12 indirect index (layout(row_major std430 ) buffer uint)
0:12 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 right-shift (temp int)
0:12 Constant:
0:12 8 (const int)
0:12 Constant:
0:12 2 (const int)
0:12 Constant:
0:12 1 (const int)
0:12 Constant:
0:12 2 (const int)
0:14 move second child to first child (temp uint)
0:14 'u' (temp uint)
0:14 AtomicExchange (temp uint)
0:14 indirect index (layout(row_major std430 ) buffer uint)
0:14 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:14 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:14 Constant:
0:14 0 (const uint)
0:14 right-shift (temp int)
0:14 Constant:
0:14 8 (const int)
0:14 Constant:
0:14 2 (const int)
0:14 Constant:
0:14 1 (const int)
0:15 AtomicMax (temp void)
0:15 indirect index (layout(row_major std430 ) buffer uint)
0:15 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:15 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:15 Constant:
0:15 0 (const uint)
0:15 right-shift (temp int)
0:15 Constant:
0:15 8 (const int)
0:15 Constant:
0:15 2 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 move second child to first child (temp uint)
0:16 'u' (temp uint)
0:16 AtomicMax (temp uint)
0:16 indirect index (layout(row_major std430 ) buffer uint)
0:16 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:16 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:16 Constant:
0:16 0 (const uint)
0:16 right-shift (temp int)
0:16 Constant:
0:16 8 (const int)
0:16 Constant:
0:16 2 (const int)
0:16 Constant:
0:16 1 (const int)
0:17 AtomicMin (temp void)
0:17 indirect index (layout(row_major std430 ) buffer uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 right-shift (temp int)
0:17 Constant:
0:17 8 (const int)
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 1 (const int)
0:18 move second child to first child (temp uint)
0:18 'u' (temp uint)
0:18 AtomicMin (temp uint)
0:18 indirect index (layout(row_major std430 ) buffer uint)
0:18 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:18 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:18 Constant:
0:18 0 (const uint)
0:18 right-shift (temp int)
0:18 Constant:
0:18 8 (const int)
0:18 Constant:
0:18 2 (const int)
0:18 Constant:
0:18 1 (const int)
0:19 AtomicOr (temp void)
0:19 indirect index (layout(row_major std430 ) buffer uint)
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 right-shift (temp int)
0:19 Constant:
0:19 8 (const int)
0:19 Constant:
0:19 2 (const int)
0:19 Constant:
0:19 1 (const int)
0:20 move second child to first child (temp uint)
0:20 'u' (temp uint)
0:20 AtomicOr (temp uint)
0:20 indirect index (layout(row_major std430 ) buffer uint)
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 right-shift (temp int)
0:20 Constant:
0:20 8 (const int)
0:20 Constant:
0:20 2 (const int)
0:20 Constant:
0:20 1 (const int)
0:21 AtomicXor (temp void)
0:21 indirect index (layout(row_major std430 ) buffer uint)
0:21 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:21 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:21 Constant:
0:21 0 (const uint)
0:21 right-shift (temp int)
0:21 Constant:
0:21 8 (const int)
0:21 Constant:
0:21 2 (const int)
0:21 Constant:
0:21 1 (const int)
0:22 move second child to first child (temp uint)
0:22 'u' (temp uint)
0:22 AtomicXor (temp uint)
0:22 indirect index (layout(row_major std430 ) buffer uint)
0:22 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:22 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:22 Constant:
0:22 0 (const uint)
0:22 right-shift (temp int)
0:22 Constant:
0:22 8 (const int)
0:22 Constant:
0:22 2 (const int)
0:22 Constant:
0:22 1 (const int)
0:24 Branch: Return with expression
0:24 Construct vec4 (temp 4-component vector of float)
0:24 Convert uint to float (temp float)
0:24 indirect index (layout(row_major std430 ) buffer uint)
0:24 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:24 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:24 Constant:
0:24 0 (const uint)
0:24 right-shift (temp int)
0:24 'pos' (in uint)
0:24 Constant:
0:24 2 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint sbuf})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 87
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 80 83
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 15 "sbuf"
MemberName 15(sbuf) 0 "sbuf"
Name 17 ""
Name 29 "u"
Name 78 "pos"
Name 80 "pos"
Name 83 "@entryPointOutput"
Name 84 "param"
Decorate 14 ArrayStride 4
MemberDecorate 15(sbuf) 0 Offset 0
Decorate 15(sbuf) BufferBlock
Decorate 17 DescriptorSet 0
Decorate 80(pos) Location 0
Decorate 83(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeRuntimeArray 6(int)
15(sbuf): TypeStruct 14
16: TypePointer Uniform 15(sbuf)
17: 16(ptr) Variable Uniform
18: TypeInt 32 1
19: 18(int) Constant 0
20: 18(int) Constant 8
21: 18(int) Constant 2
23: TypePointer Uniform 6(int)
25: 18(int) Constant 1
26: 6(int) Constant 1
27: 6(int) Constant 0
79: TypePointer Input 6(int)
80(pos): 79(ptr) Variable Input
82: TypePointer Output 9(fvec4)
83(@entryPointOutput): 82(ptr) Variable Output
4(main): 2 Function None 3
5: Label
78(pos): 7(ptr) Variable Function
84(param): 7(ptr) Variable Function
81: 6(int) Load 80(pos)
Store 78(pos) 81
85: 6(int) Load 78(pos)
Store 84(param) 85
86: 9(fvec4) FunctionCall 12(@main(u1;) 84(param)
Store 83(@entryPointOutput) 86
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
29(u): 7(ptr) Variable Function
22: 18(int) ShiftRightArithmetic 20 21
24: 23(ptr) AccessChain 17 19 22
28: 2 AtomicIAdd 24 26 27 25
30: 18(int) ShiftRightArithmetic 20 21
31: 23(ptr) AccessChain 17 19 30
32: 6(int) AtomicIAdd 31 26 27 25
Store 29(u) 32
33: 18(int) ShiftRightArithmetic 20 21
34: 23(ptr) AccessChain 17 19 33
35: 2 AtomicAnd 34 26 27 25
36: 18(int) ShiftRightArithmetic 20 21
37: 23(ptr) AccessChain 17 19 36
38: 6(int) AtomicAnd 37 26 27 25
Store 29(u) 38
39: 18(int) ShiftRightArithmetic 20 21
40: 23(ptr) AccessChain 17 19 39
41: 18(int) AtomicCompareExchange 40 26 27 27 21 25
42: 6(int) Bitcast 41
Store 29(u) 42
43: 18(int) ShiftRightArithmetic 20 21
44: 23(ptr) AccessChain 17 19 43
45: 6(int) AtomicExchange 44 26 27 25
Store 29(u) 45
46: 18(int) ShiftRightArithmetic 20 21
47: 23(ptr) AccessChain 17 19 46
48: 2 AtomicSMax 47 26 27 25
49: 18(int) ShiftRightArithmetic 20 21
50: 23(ptr) AccessChain 17 19 49
51: 6(int) AtomicUMax 50 26 27 25
Store 29(u) 51
52: 18(int) ShiftRightArithmetic 20 21
53: 23(ptr) AccessChain 17 19 52
54: 2 AtomicSMin 53 26 27 25
55: 18(int) ShiftRightArithmetic 20 21
56: 23(ptr) AccessChain 17 19 55
57: 6(int) AtomicUMin 56 26 27 25
Store 29(u) 57
58: 18(int) ShiftRightArithmetic 20 21
59: 23(ptr) AccessChain 17 19 58
60: 2 AtomicOr 59 26 27 25
61: 18(int) ShiftRightArithmetic 20 21
62: 23(ptr) AccessChain 17 19 61
63: 6(int) AtomicOr 62 26 27 25
Store 29(u) 63
64: 18(int) ShiftRightArithmetic 20 21
65: 23(ptr) AccessChain 17 19 64
66: 2 AtomicXor 65 26 27 25
67: 18(int) ShiftRightArithmetic 20 21
68: 23(ptr) AccessChain 17 19 67
69: 6(int) AtomicXor 68 26 27 25
Store 29(u) 69
70: 6(int) Load 11(pos)
71: 18(int) ShiftRightLogical 70 21
72: 23(ptr) AccessChain 17 19 71
73: 6(int) Load 72
74: 8(float) ConvertUToF 73
75: 9(fvec4) CompositeConstruct 74 74 74 74
ReturnValue 75
FunctionEnd

View File

@ -0,0 +1,476 @@
hlsl.structbuffer.byte.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main(u1; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'pos' (in uint)
0:? Sequence
0:7 Sequence
0:7 move second child to first child (temp uint)
0:7 'size' (temp uint)
0:7 array length (temp uint)
0:7 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:7 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:7 Constant:
0:7 0 (const uint)
0:12 Branch: Return with expression
0:11 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 Convert uint to float (temp float)
0:9 indirect index (layout(row_major std430 ) readonly buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
0:9 'pos' (in uint)
0:9 Constant:
0:9 2 (const int)
0:? Construct vec4 (temp 4-component vector of float)
0:? Convert uint to float (temp 2-component vector of float)
0:? Sequence
0:10 move second child to first child (temp int)
0:10 'byteAddrTemp' (temp int)
0:10 right-shift (temp int)
0:10 add (temp uint)
0:10 'pos' (in uint)
0:10 Constant:
0:10 4 (const uint)
0:10 Constant:
0:10 2 (const int)
0:? Construct vec2 (temp 2-component vector of uint)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' (temp int)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 add (temp int)
0:10 'byteAddrTemp' (temp int)
0:10 Constant:
0:10 1 (const int)
0:10 Constant:
0:10 0.000000
0:10 Constant:
0:10 0.000000
0:? Construct vec4 (temp 4-component vector of float)
0:? Convert uint to float (temp 3-component vector of float)
0:? Sequence
0:11 move second child to first child (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 right-shift (temp int)
0:11 add (temp uint)
0:11 'pos' (in uint)
0:11 Constant:
0:11 8 (const uint)
0:11 Constant:
0:11 2 (const int)
0:? Construct vec3 (temp 3-component vector of uint)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' (temp int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 Constant:
0:11 1 (const int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 Constant:
0:11 2 (const int)
0:11 Constant:
0:11 0.000000
0:? Convert uint to float (temp 4-component vector of float)
0:? Sequence
0:12 move second child to first child (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 right-shift (temp int)
0:12 add (temp uint)
0:12 'pos' (in uint)
0:12 Constant:
0:12 12 (const uint)
0:12 Constant:
0:12 2 (const int)
0:? Construct vec4 (temp 4-component vector of uint)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' (temp int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 1 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 2 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 3 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main(u1; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'pos' (in uint)
0:? Sequence
0:7 Sequence
0:7 move second child to first child (temp uint)
0:7 'size' (temp uint)
0:7 array length (temp uint)
0:7 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:7 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:7 Constant:
0:7 0 (const uint)
0:12 Branch: Return with expression
0:11 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 Convert uint to float (temp float)
0:9 indirect index (layout(row_major std430 ) readonly buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
0:9 'pos' (in uint)
0:9 Constant:
0:9 2 (const int)
0:? Construct vec4 (temp 4-component vector of float)
0:? Convert uint to float (temp 2-component vector of float)
0:? Sequence
0:10 move second child to first child (temp int)
0:10 'byteAddrTemp' (temp int)
0:10 right-shift (temp int)
0:10 add (temp uint)
0:10 'pos' (in uint)
0:10 Constant:
0:10 4 (const uint)
0:10 Constant:
0:10 2 (const int)
0:? Construct vec2 (temp 2-component vector of uint)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' (temp int)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 Constant:
0:10 0 (const uint)
0:10 add (temp int)
0:10 'byteAddrTemp' (temp int)
0:10 Constant:
0:10 1 (const int)
0:10 Constant:
0:10 0.000000
0:10 Constant:
0:10 0.000000
0:? Construct vec4 (temp 4-component vector of float)
0:? Convert uint to float (temp 3-component vector of float)
0:? Sequence
0:11 move second child to first child (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 right-shift (temp int)
0:11 add (temp uint)
0:11 'pos' (in uint)
0:11 Constant:
0:11 8 (const uint)
0:11 Constant:
0:11 2 (const int)
0:? Construct vec3 (temp 3-component vector of uint)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' (temp int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 Constant:
0:11 1 (const int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
0:11 'byteAddrTemp' (temp int)
0:11 Constant:
0:11 2 (const int)
0:11 Constant:
0:11 0.000000
0:? Convert uint to float (temp 4-component vector of float)
0:? Sequence
0:12 move second child to first child (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 right-shift (temp int)
0:12 add (temp uint)
0:12 'pos' (in uint)
0:12 Constant:
0:12 12 (const uint)
0:12 Constant:
0:12 2 (const int)
0:? Construct vec4 (temp 4-component vector of uint)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' (temp int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 1 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 2 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
0:12 'byteAddrTemp' (temp int)
0:12 Constant:
0:12 3 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 114
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 107 110
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 14 "size"
Name 16 "sbuf"
MemberName 16(sbuf) 0 "sbuf"
Name 18 ""
Name 30 "byteAddrTemp"
Name 53 "byteAddrTemp"
Name 78 "byteAddrTemp"
Name 105 "pos"
Name 107 "pos"
Name 110 "@entryPointOutput"
Name 111 "param"
Decorate 15 ArrayStride 4
MemberDecorate 16(sbuf) 0 NonWritable
MemberDecorate 16(sbuf) 0 Offset 0
Decorate 16(sbuf) BufferBlock
Decorate 18 DescriptorSet 0
Decorate 107(pos) Location 0
Decorate 110(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
15: TypeRuntimeArray 6(int)
16(sbuf): TypeStruct 15
17: TypePointer Uniform 16(sbuf)
18: 17(ptr) Variable Uniform
19: TypeInt 32 1
21: 19(int) Constant 0
23: 19(int) Constant 2
25: TypePointer Uniform 6(int)
29: TypePointer Function 19(int)
32: 6(int) Constant 4
39: 19(int) Constant 1
43: TypeVector 6(int) 2
45: TypeVector 8(float) 2
47: 8(float) Constant 0
55: 6(int) Constant 8
69: TypeVector 6(int) 3
71: TypeVector 8(float) 3
80: 6(int) Constant 12
95: 19(int) Constant 3
99: TypeVector 6(int) 4
106: TypePointer Input 6(int)
107(pos): 106(ptr) Variable Input
109: TypePointer Output 9(fvec4)
110(@entryPointOutput): 109(ptr) Variable Output
4(main): 2 Function None 3
5: Label
105(pos): 7(ptr) Variable Function
111(param): 7(ptr) Variable Function
108: 6(int) Load 107(pos)
Store 105(pos) 108
112: 6(int) Load 105(pos)
Store 111(param) 112
113: 9(fvec4) FunctionCall 12(@main(u1;) 111(param)
Store 110(@entryPointOutput) 113
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
14(size): 7(ptr) Variable Function
30(byteAddrTemp): 29(ptr) Variable Function
53(byteAddrTemp): 29(ptr) Variable Function
78(byteAddrTemp): 29(ptr) Variable Function
20: 19(int) ArrayLength 18 0
Store 14(size) 20
22: 6(int) Load 11(pos)
24: 19(int) ShiftRightLogical 22 23
26: 25(ptr) AccessChain 18 21 24
27: 6(int) Load 26
28: 8(float) ConvertUToF 27
31: 6(int) Load 11(pos)
33: 6(int) IAdd 31 32
34: 19(int) ShiftRightLogical 33 23
Store 30(byteAddrTemp) 34
35: 19(int) Load 30(byteAddrTemp)
36: 25(ptr) AccessChain 18 21 35
37: 6(int) Load 36
38: 19(int) Load 30(byteAddrTemp)
40: 19(int) IAdd 38 39
41: 25(ptr) AccessChain 18 21 40
42: 6(int) Load 41
44: 43(ivec2) CompositeConstruct 37 42
46: 45(fvec2) ConvertUToF 44
48: 8(float) CompositeExtract 46 0
49: 8(float) CompositeExtract 46 1
50: 9(fvec4) CompositeConstruct 48 49 47 47
51: 9(fvec4) CompositeConstruct 28 28 28 28
52: 9(fvec4) FAdd 51 50
54: 6(int) Load 11(pos)
56: 6(int) IAdd 54 55
57: 19(int) ShiftRightLogical 56 23
Store 53(byteAddrTemp) 57
58: 19(int) Load 53(byteAddrTemp)
59: 25(ptr) AccessChain 18 21 58
60: 6(int) Load 59
61: 19(int) Load 53(byteAddrTemp)
62: 19(int) IAdd 61 39
63: 25(ptr) AccessChain 18 21 62
64: 6(int) Load 63
65: 19(int) Load 53(byteAddrTemp)
66: 19(int) IAdd 65 23
67: 25(ptr) AccessChain 18 21 66
68: 6(int) Load 67
70: 69(ivec3) CompositeConstruct 60 64 68
72: 71(fvec3) ConvertUToF 70
73: 8(float) CompositeExtract 72 0
74: 8(float) CompositeExtract 72 1
75: 8(float) CompositeExtract 72 2
76: 9(fvec4) CompositeConstruct 73 74 75 47
77: 9(fvec4) FAdd 52 76
79: 6(int) Load 11(pos)
81: 6(int) IAdd 79 80
82: 19(int) ShiftRightLogical 81 23
Store 78(byteAddrTemp) 82
83: 19(int) Load 78(byteAddrTemp)
84: 25(ptr) AccessChain 18 21 83
85: 6(int) Load 84
86: 19(int) Load 78(byteAddrTemp)
87: 19(int) IAdd 86 39
88: 25(ptr) AccessChain 18 21 87
89: 6(int) Load 88
90: 19(int) Load 78(byteAddrTemp)
91: 19(int) IAdd 90 23
92: 25(ptr) AccessChain 18 21 91
93: 6(int) Load 92
94: 19(int) Load 78(byteAddrTemp)
96: 19(int) IAdd 94 95
97: 25(ptr) AccessChain 18 21 96
98: 6(int) Load 97
100: 99(ivec4) CompositeConstruct 85 89 93 98
101: 9(fvec4) ConvertUToF 100
102: 9(fvec4) FAdd 77 101
ReturnValue 102
FunctionEnd

View File

@ -0,0 +1,308 @@
hlsl.structbuffer.coherent.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) coherent temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
0:13 'pos' (in uint)
0:13 Constant:
0:13 1 (const uint)
0:13 Constant:
0:13 42.000000
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 16 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) coherent temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) coherent temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) coherent temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 Convert uint to float (temp float)
0:22 add (temp uint)
0:22 'size' (temp uint)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) coherent temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
0:13 'pos' (in uint)
0:13 Constant:
0:13 1 (const uint)
0:13 Constant:
0:13 42.000000
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 16 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) coherent temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) coherent temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) coherent temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) coherent buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 Convert uint to float (temp float)
0:22 add (temp uint)
0:22 'size' (temp uint)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) coherent buffer block{layout(row_major std430 ) coherent buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 78
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 71 74
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 15 "sbuf2"
MemberName 15(sbuf2) 0 "sbuf2"
Name 17 ""
Name 26 "size"
Name 28 "sb_t"
MemberName 28(sb_t) 0 "color"
MemberName 28(sb_t) 1 "test"
Name 30 "sbuf"
MemberName 30(sbuf) 0 "sbuf"
Name 32 ""
Name 34 "stride"
Name 69 "pos"
Name 71 "pos"
Name 74 "@entryPointOutput"
Name 75 "param"
Decorate 14 ArrayStride 4
MemberDecorate 15(sbuf2) 0 Coherent
MemberDecorate 15(sbuf2) 0 Offset 0
Decorate 15(sbuf2) BufferBlock
Decorate 17 DescriptorSet 0
MemberDecorate 28(sb_t) 0 Coherent
MemberDecorate 28(sb_t) 0 Offset 0
MemberDecorate 28(sb_t) 1 Coherent
MemberDecorate 28(sb_t) 1 Offset 12
Decorate 29 ArrayStride 16
MemberDecorate 30(sbuf) 0 Coherent
MemberDecorate 30(sbuf) 0 Offset 0
Decorate 30(sbuf) BufferBlock
Decorate 32 DescriptorSet 0
Decorate 71(pos) Location 0
Decorate 74(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeRuntimeArray 8(float)
15(sbuf2): TypeStruct 14
16: TypePointer Uniform 15(sbuf2)
17: 16(ptr) Variable Uniform
18: TypeInt 32 1
19: 18(int) Constant 0
21: 6(int) Constant 1
23: 8(float) Constant 1109917696
24: TypePointer Uniform 8(float)
27: TypeVector 8(float) 3
28(sb_t): TypeStruct 27(fvec3) 6(int)
29: TypeRuntimeArray 28(sb_t)
30(sbuf): TypeStruct 29
31: TypePointer Uniform 30(sbuf)
32: 31(ptr) Variable Uniform
35: 6(int) Constant 16
37: 18(int) Constant 1
38: TypePointer Uniform 6(int)
41: TypeBool
42: 6(int) Constant 0
47: TypePointer Uniform 27(fvec3)
55: 8(float) Constant 0
70: TypePointer Input 6(int)
71(pos): 70(ptr) Variable Input
73: TypePointer Output 9(fvec4)
74(@entryPointOutput): 73(ptr) Variable Output
4(main): 2 Function None 3
5: Label
69(pos): 7(ptr) Variable Function
75(param): 7(ptr) Variable Function
72: 6(int) Load 71(pos)
Store 69(pos) 72
76: 6(int) Load 69(pos)
Store 75(param) 76
77: 9(fvec4) FunctionCall 12(@main(u1;) 75(param)
Store 74(@entryPointOutput) 77
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
26(size): 7(ptr) Variable Function
34(stride): 7(ptr) Variable Function
20: 6(int) Load 11(pos)
22: 6(int) IAdd 20 21
25: 24(ptr) AccessChain 17 19 22
Store 25 23
33: 18(int) ArrayLength 32 0
Store 26(size) 33
Store 34(stride) 35
36: 6(int) Load 11(pos)
39: 38(ptr) AccessChain 32 19 36 37
40: 6(int) Load 39
43: 41(bool) INotEqual 40 42
SelectionMerge 45 None
BranchConditional 43 44 61
44: Label
46: 6(int) Load 11(pos)
48: 47(ptr) AccessChain 32 19 46 19
49: 27(fvec3) Load 48
50: 6(int) Load 11(pos)
51: 24(ptr) AccessChain 17 19 50
52: 8(float) Load 51
53: 27(fvec3) CompositeConstruct 52 52 52
54: 27(fvec3) FAdd 49 53
56: 8(float) CompositeExtract 54 0
57: 8(float) CompositeExtract 54 1
58: 8(float) CompositeExtract 54 2
59: 9(fvec4) CompositeConstruct 56 57 58 55
ReturnValue 59
61: Label
62: 6(int) Load 26(size)
63: 6(int) Load 34(stride)
64: 6(int) IAdd 62 63
65: 8(float) ConvertUToF 64
66: 9(fvec4) CompositeConstruct 65 65 65 65
ReturnValue 66
45: Label
68: 9(fvec4) Undef
ReturnValue 68
FunctionEnd

View File

@ -0,0 +1,347 @@
hlsl.structbuffer.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 Sequence
0:13 move second child to first child (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 indirect index (layout(binding=10 row_major std430 ) readonly buffer structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:13 Constant:
0:13 0 (const uint)
0:13 'pos' (in uint)
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:17 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 32 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:19 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:19 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:20 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:20 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) readonly temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 add (temp float)
0:22 add (temp float)
0:22 direct index (temp float)
0:22 color: direct index for structure (temp 3-component vector of float)
0:22 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:22 Constant:
0:22 0 (const int)
0:22 Constant:
0:22 0 (const int)
0:22 Convert uint to float (temp float)
0:22 'size' (temp uint)
0:22 Convert uint to float (temp float)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:? 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 Sequence
0:13 move second child to first child (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 indirect index (layout(binding=10 row_major std430 ) readonly buffer structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:13 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:13 Constant:
0:13 0 (const uint)
0:13 'pos' (in uint)
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:17 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 32 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:19 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:19 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:20 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:20 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) readonly temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 add (temp float)
0:22 add (temp float)
0:22 direct index (temp float)
0:22 color: direct index for structure (temp 3-component vector of float)
0:22 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
0:22 Constant:
0:22 0 (const int)
0:22 Constant:
0:22 0 (const int)
0:22 Convert uint to float (temp float)
0:22 'size' (temp uint)
0:22 Convert uint to float (temp float)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
0:? 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 94
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 87 90
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 16 "sb_t"
MemberName 16(sb_t) 0 "color"
MemberName 16(sb_t) 1 "test"
MemberName 16(sb_t) 2 "test2"
Name 18 "mydata"
Name 19 "sb_t"
MemberName 19(sb_t) 0 "color"
MemberName 19(sb_t) 1 "test"
MemberName 19(sb_t) 2 "test2"
Name 21 "sbuf"
MemberName 21(sbuf) 0 "sbuf"
Name 23 ""
Name 40 "size"
Name 42 "stride"
Name 57 "sbuf2"
MemberName 57(sbuf2) 0 "sbuf2"
Name 59 ""
Name 85 "pos"
Name 87 "pos"
Name 90 "@entryPointOutput"
Name 91 "param"
MemberDecorate 19(sb_t) 0 NonWritable
MemberDecorate 19(sb_t) 0 Offset 0
MemberDecorate 19(sb_t) 1 NonWritable
MemberDecorate 19(sb_t) 1 Offset 12
MemberDecorate 19(sb_t) 2 NonWritable
MemberDecorate 19(sb_t) 2 Offset 16
Decorate 20 ArrayStride 32
MemberDecorate 21(sbuf) 0 NonWritable
MemberDecorate 21(sbuf) 0 Offset 0
Decorate 21(sbuf) BufferBlock
Decorate 23 DescriptorSet 0
Decorate 23 Binding 10
Decorate 56 ArrayStride 4
MemberDecorate 57(sbuf2) 0 NonWritable
MemberDecorate 57(sbuf2) 0 Offset 0
Decorate 57(sbuf2) BufferBlock
Decorate 59 DescriptorSet 0
Decorate 87(pos) Location 0
Decorate 90(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeVector 8(float) 3
15: TypeBool
16(sb_t): TypeStruct 14(fvec3) 15(bool) 15(bool)
17: TypePointer Function 16(sb_t)
19(sb_t): TypeStruct 14(fvec3) 6(int) 6(int)
20: TypeRuntimeArray 19(sb_t)
21(sbuf): TypeStruct 20
22: TypePointer Uniform 21(sbuf)
23: 22(ptr) Variable Uniform
24: TypeInt 32 1
25: 24(int) Constant 0
27: TypePointer Uniform 19(sb_t)
31: TypePointer Function 14(fvec3)
34: 24(int) Constant 1
35: TypePointer Function 15(bool)
38: 24(int) Constant 2
43: 6(int) Constant 32
45: TypePointer Uniform 6(int)
48: 6(int) Constant 0
53: TypePointer Uniform 14(fvec3)
56: TypeRuntimeArray 8(float)
57(sbuf2): TypeStruct 56
58: TypePointer Uniform 57(sbuf2)
59: 58(ptr) Variable Uniform
61: TypePointer Uniform 8(float)
66: 8(float) Constant 0
73: TypePointer Function 8(float)
86: TypePointer Input 6(int)
87(pos): 86(ptr) Variable Input
89: TypePointer Output 9(fvec4)
90(@entryPointOutput): 89(ptr) Variable Output
4(main): 2 Function None 3
5: Label
85(pos): 7(ptr) Variable Function
91(param): 7(ptr) Variable Function
88: 6(int) Load 87(pos)
Store 85(pos) 88
92: 6(int) Load 85(pos)
Store 91(param) 92
93: 9(fvec4) FunctionCall 12(@main(u1;) 91(param)
Store 90(@entryPointOutput) 93
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
18(mydata): 17(ptr) Variable Function
40(size): 7(ptr) Variable Function
42(stride): 7(ptr) Variable Function
26: 6(int) Load 11(pos)
28: 27(ptr) AccessChain 23 25 26
29: 19(sb_t) Load 28
30: 14(fvec3) CompositeExtract 29 0
32: 31(ptr) AccessChain 18(mydata) 25
Store 32 30
33: 6(int) CompositeExtract 29 1
36: 35(ptr) AccessChain 18(mydata) 34
Store 36 33
37: 6(int) CompositeExtract 29 2
39: 35(ptr) AccessChain 18(mydata) 38
Store 39 37
41: 24(int) ArrayLength 23 0
Store 40(size) 41
Store 42(stride) 43
44: 6(int) Load 11(pos)
46: 45(ptr) AccessChain 23 25 44 34
47: 6(int) Load 46
49: 15(bool) INotEqual 47 48
SelectionMerge 51 None
BranchConditional 49 50 72
50: Label
52: 6(int) Load 11(pos)
54: 53(ptr) AccessChain 23 25 52 25
55: 14(fvec3) Load 54
60: 6(int) Load 11(pos)
62: 61(ptr) AccessChain 59 25 60
63: 8(float) Load 62
64: 14(fvec3) CompositeConstruct 63 63 63
65: 14(fvec3) FAdd 55 64
67: 8(float) CompositeExtract 65 0
68: 8(float) CompositeExtract 65 1
69: 8(float) CompositeExtract 65 2
70: 9(fvec4) CompositeConstruct 67 68 69 66
ReturnValue 70
72: Label
74: 73(ptr) AccessChain 18(mydata) 25 48
75: 8(float) Load 74
76: 6(int) Load 40(size)
77: 8(float) ConvertUToF 76
78: 8(float) FAdd 75 77
79: 6(int) Load 42(stride)
80: 8(float) ConvertUToF 79
81: 8(float) FAdd 78 80
82: 9(fvec4) CompositeConstruct 81 81 81 81
ReturnValue 82
51: Label
84: 9(fvec4) Undef
ReturnValue 84
FunctionEnd

View File

@ -0,0 +1,304 @@
hlsl.structbuffer.rw.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
0:13 'pos' (in uint)
0:13 Constant:
0:13 1 (const uint)
0:13 Constant:
0:13 42.000000
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 16 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 Convert uint to float (temp float)
0:22 add (temp uint)
0:22 'size' (temp uint)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
0:12 Function Parameters:
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
0:13 'pos' (in uint)
0:13 Constant:
0:13 1 (const uint)
0:13 Constant:
0:13 42.000000
0:17 Sequence
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
0:17 'stride' (temp uint)
0:17 Constant:
0:17 16 (const uint)
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
0:19 Constant:
0:19 1 (const int)
0:19 true case
0:20 Branch: Return with expression
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0.000000
0:19 false case
0:22 Branch: Return with expression
0:22 Construct vec4 (temp 4-component vector of float)
0:22 Convert uint to float (temp float)
0:22 add (temp uint)
0:22 'size' (temp uint)
0:22 'stride' (temp uint)
0:12 Function Definition: main( (temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:12 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 78
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 71 74
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 15 "sbuf2"
MemberName 15(sbuf2) 0 "sbuf2"
Name 17 ""
Name 26 "size"
Name 28 "sb_t"
MemberName 28(sb_t) 0 "color"
MemberName 28(sb_t) 1 "test"
Name 30 "sbuf"
MemberName 30(sbuf) 0 "sbuf"
Name 32 ""
Name 34 "stride"
Name 69 "pos"
Name 71 "pos"
Name 74 "@entryPointOutput"
Name 75 "param"
Decorate 14 ArrayStride 4
MemberDecorate 15(sbuf2) 0 Offset 0
Decorate 15(sbuf2) BufferBlock
Decorate 17 DescriptorSet 0
MemberDecorate 28(sb_t) 0 Offset 0
MemberDecorate 28(sb_t) 1 Offset 12
Decorate 29 ArrayStride 16
MemberDecorate 30(sbuf) 0 Offset 0
Decorate 30(sbuf) BufferBlock
Decorate 32 DescriptorSet 0
Decorate 71(pos) Location 0
Decorate 74(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeRuntimeArray 8(float)
15(sbuf2): TypeStruct 14
16: TypePointer Uniform 15(sbuf2)
17: 16(ptr) Variable Uniform
18: TypeInt 32 1
19: 18(int) Constant 0
21: 6(int) Constant 1
23: 8(float) Constant 1109917696
24: TypePointer Uniform 8(float)
27: TypeVector 8(float) 3
28(sb_t): TypeStruct 27(fvec3) 6(int)
29: TypeRuntimeArray 28(sb_t)
30(sbuf): TypeStruct 29
31: TypePointer Uniform 30(sbuf)
32: 31(ptr) Variable Uniform
35: 6(int) Constant 16
37: 18(int) Constant 1
38: TypePointer Uniform 6(int)
41: TypeBool
42: 6(int) Constant 0
47: TypePointer Uniform 27(fvec3)
55: 8(float) Constant 0
70: TypePointer Input 6(int)
71(pos): 70(ptr) Variable Input
73: TypePointer Output 9(fvec4)
74(@entryPointOutput): 73(ptr) Variable Output
4(main): 2 Function None 3
5: Label
69(pos): 7(ptr) Variable Function
75(param): 7(ptr) Variable Function
72: 6(int) Load 71(pos)
Store 69(pos) 72
76: 6(int) Load 69(pos)
Store 75(param) 76
77: 9(fvec4) FunctionCall 12(@main(u1;) 75(param)
Store 74(@entryPointOutput) 77
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
26(size): 7(ptr) Variable Function
34(stride): 7(ptr) Variable Function
20: 6(int) Load 11(pos)
22: 6(int) IAdd 20 21
25: 24(ptr) AccessChain 17 19 22
Store 25 23
33: 18(int) ArrayLength 32 0
Store 26(size) 33
Store 34(stride) 35
36: 6(int) Load 11(pos)
39: 38(ptr) AccessChain 32 19 36 37
40: 6(int) Load 39
43: 41(bool) INotEqual 40 42
SelectionMerge 45 None
BranchConditional 43 44 61
44: Label
46: 6(int) Load 11(pos)
48: 47(ptr) AccessChain 32 19 46 19
49: 27(fvec3) Load 48
50: 6(int) Load 11(pos)
51: 24(ptr) AccessChain 17 19 50
52: 8(float) Load 51
53: 27(fvec3) CompositeConstruct 52 52 52
54: 27(fvec3) FAdd 49 53
56: 8(float) CompositeExtract 54 0
57: 8(float) CompositeExtract 54 1
58: 8(float) CompositeExtract 54 2
59: 9(fvec4) CompositeConstruct 56 57 58 55
ReturnValue 59
61: Label
62: 6(int) Load 26(size)
63: 6(int) Load 34(stride)
64: 6(int) IAdd 62 63
65: 8(float) ConvertUToF 64
66: 9(fvec4) CompositeConstruct 65 65 65 65
ReturnValue 66
45: Label
68: 9(fvec4) Undef
ReturnValue 68
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
RWByteAddressBuffer sbuf;
float4 main(uint pos : FOO) : SV_Target0
{
uint u;
sbuf.InterlockedAdd(8, 1);
sbuf.InterlockedAdd(8, 1, u);
sbuf.InterlockedAnd(8, 1);
sbuf.InterlockedAnd(8, 1, u);
sbuf.InterlockedCompareExchange(8, 1, 2, u);
// sbuf.InterlockedCompareStore(8, 1, 2); // TODO: ...
sbuf.InterlockedExchange(8, 1, u);
sbuf.InterlockedMax(8, 1);
sbuf.InterlockedMax(8, 1, u);
sbuf.InterlockedMin(8, 1);
sbuf.InterlockedMin(8, 1, u);
sbuf.InterlockedOr(8, 1);
sbuf.InterlockedOr(8, 1, u);
sbuf.InterlockedXor(8, 1);
sbuf.InterlockedXor(8, 1, u);
return sbuf.Load(pos);
}

View File

@ -0,0 +1,13 @@
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);
}

View File

@ -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;
}

View File

@ -0,0 +1,23 @@
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;
}

View File

@ -0,0 +1,23 @@
struct sb_t
{
float3 color;
bool test;
};
RWStructuredBuffer<sb_t> sbuf;
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;
}

View File

@ -0,0 +1,15 @@
RWByteAddressBuffer sbuf;
float4 main(uint pos : FOO) : SV_Target0
{
uint size;
sbuf.GetDimensions(size);
sbuf.Store(pos, sbuf.Load(pos));
sbuf.Store2(pos, sbuf.Load2(pos));
sbuf.Store3(pos, sbuf.Load3(pos));
sbuf.Store4(pos, sbuf.Load4(pos));
return sbuf.Load(pos);
}

View File

@ -624,6 +624,15 @@ enum TOperator {
EOpMethodCalculateLevelOfDetail, // ...
EOpMethodCalculateLevelOfDetailUnclamped, // ...
// Load already defined above for textures
EOpMethodLoad2, // Structure buffer object methods. These are translated to existing
EOpMethodLoad3, // AST methods, and exist to represent HLSL semantics until that
EOpMethodLoad4, // translation is performed. See HlslParseContext::decomposeSampleMethods().
EOpMethodStore, // ...
EOpMethodStore2, // ...
EOpMethodStore3, // ...
EOpMethodStore4, // ...
// SM5 texture methods
EOpMethodGatherRed, // These are covered under the above EOpMethodSample comment about
EOpMethodGatherGreen, // translation to existing AST opcodes. They exist temporarily

View File

@ -221,6 +221,12 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.struct.split.trivial.vert", "main"},
{"hlsl.structarray.flatten.frag", "main"},
{"hlsl.structarray.flatten.geom", "main"},
{"hlsl.structbuffer.frag", "main"},
{"hlsl.structbuffer.atomics.frag", "main"},
{"hlsl.structbuffer.byte.frag", "main"},
{"hlsl.structbuffer.coherent.frag", "main"},
{"hlsl.structbuffer.rw.frag", "main"},
{"hlsl.structbuffer.rwbyte.frag", "main"},
{"hlsl.structin.vert", "main"},
{"hlsl.structIoFourWay.frag", "main"},
{"hlsl.intrinsics.vert", "VertexShaderFunction"},

View File

@ -406,6 +406,27 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node, TIntermNode*& node2)
}
}
TString* blockName = idToken.string;
// For structbuffers, we couldn't create the block type while accepting the
// template type, because we need the identifier name. Now that we have that,
// we can create the buffer type.
// TODO: how to determine this without looking for implicit array sizes?
if (variableType.getBasicType() == EbtBlock) {
const int memberCount = variableType.getStruct()->size();
assert(memberCount > 0);
TType* contentType = (*variableType.getStruct())[memberCount-1].type;
// Set the field name and qualifier from the declaration, now that we know it.
if (contentType->isRuntimeSizedArray()) {
contentType->getQualifier() = variableType.getQualifier();
blockName = nullptr; // this will be an anonymous block...
contentType->setFieldName(*idToken.string); // field name is declaration name
variableType.setTypeName(*idToken.string);
}
}
// Hand off the actual declaration
// TODO: things scoped within an annotation need their own name space;
@ -414,7 +435,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node, TIntermNode*& node2)
if (typedefDecl)
parseContext.declareTypedef(idToken.loc, *idToken.string, variableType);
else if (variableType.getBasicType() == EbtBlock)
parseContext.declareBlock(idToken.loc, variableType, idToken.string);
parseContext.declareBlock(idToken.loc, variableType, blockName);
else {
if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) {
// this isn't really an individual variable, but a member of the $Global buffer
@ -533,8 +554,11 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type)
qualifier.layoutFormat = type.getQualifier().layoutFormat;
qualifier.precision = type.getQualifier().precision;
if (type.getQualifier().storage == EvqVaryingOut)
if (type.getQualifier().storage == EvqVaryingOut ||
type.getQualifier().storage == EvqBuffer) {
qualifier.storage = type.getQualifier().storage;
qualifier.readonly = type.getQualifier().readonly;
}
type.getQualifier() = qualifier;
}
@ -609,6 +633,9 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier)
if (! acceptLayoutQualifierList(qualifier))
return false;
continue;
case EHTokGloballyCoherent:
qualifier.coherent = true;
break;
// GS geometries: these are specified on stage input variables, and are an error (not verified here)
// for output variables.
@ -1246,11 +1273,19 @@ bool HlslGrammar::acceptType(TType& type)
return acceptTextureType(type);
break;
case EHTokAppendStructuredBuffer:
case EHTokByteAddressBuffer:
case EHTokConsumeStructuredBuffer:
case EHTokRWByteAddressBuffer:
case EHTokRWStructuredBuffer:
case EHTokStructuredBuffer:
return acceptStructBufferType(type);
break;
case EHTokStruct:
case EHTokCBuffer:
case EHTokTBuffer:
return acceptStruct(type);
break;
case EHTokIdentifier:
// An identifier could be for a user-defined type.
@ -1783,6 +1818,93 @@ bool HlslGrammar::acceptStruct(TType& type)
return true;
}
// struct_buffer
// : APPENDSTRUCTUREDBUFFER
// | BYTEADDRESSBUFFER
// | CONSUMESTRUCTUREDBUFFER
// | RWBYTEADDRESSBUFFER
// | RWSTRUCTUREDBUFFER
// | STRUCTUREDBUFFER
bool HlslGrammar::acceptStructBufferType(TType& type)
{
const EHlslTokenClass structBuffType = peek();
// TODO: globallycoherent
bool hasTemplateType = true;
bool readonly = false;
TStorageQualifier storage = EvqBuffer;
switch (structBuffType) {
case EHTokAppendStructuredBuffer:
unimplemented("AppendStructuredBuffer");
return false;
case EHTokByteAddressBuffer:
hasTemplateType = false;
readonly = true;
break;
case EHTokConsumeStructuredBuffer:
unimplemented("ConsumeStructuredBuffer");
return false;
case EHTokRWByteAddressBuffer:
hasTemplateType = false;
break;
case EHTokRWStructuredBuffer:
break;
case EHTokStructuredBuffer:
readonly = true;
break;
default:
return false; // not a structure buffer type
}
advanceToken(); // consume the structure keyword
// type on which this StructedBuffer is templatized. E.g, StructedBuffer<MyStruct> ==> MyStruct
TType* templateType = new TType;
if (hasTemplateType) {
if (! acceptTokenClass(EHTokLeftAngle)) {
expected("left angle bracket");
return false;
}
if (! acceptType(*templateType)) {
expected("type");
return false;
}
if (! acceptTokenClass(EHTokRightAngle)) {
expected("right angle bracket");
return false;
}
} else {
// byte address buffers have no explicit type.
TType uintType(EbtUint, storage);
templateType->shallowCopy(uintType);
}
// Create an unsized array out of that type.
// TODO: does this work if it's already an array type?
TArraySizes unsizedArray;
unsizedArray.addInnerSize(UnsizedArraySize);
templateType->newArraySizes(unsizedArray);
templateType->getQualifier().storage = storage;
templateType->getQualifier().readonly = readonly;
// Create block type. TODO: hidden internal uint member when needed
TTypeList* blockStruct = new TTypeList;
TTypeLoc member = { templateType, token.loc };
blockStruct->push_back(member);
TType blockType(blockStruct, "", templateType->getQualifier());
// It's not until we see the name during declaration that we can set the
// field name. That happens in HlslGrammar::acceptDeclaration.
type.shallowCopy(blockType);
return true;
}
// struct_declaration_list
// : struct_declaration SEMI_COLON struct_declaration SEMI_COLON ...
//

View File

@ -83,6 +83,7 @@ namespace glslang {
bool acceptAnnotations(TQualifier&);
bool acceptSamplerType(TType&);
bool acceptTextureType(TType&);
bool acceptStructBufferType(TType&);
bool acceptStruct(TType&);
bool acceptStructDeclarationList(TTypeList*&);
bool acceptFunctionParameters(TFunction&);

View File

@ -790,6 +790,61 @@ TIntermTyped* HlslParseContext::handleUnaryMath(const TSourceLoc& loc, const cha
return childNode;
}
//
// Return true if the name is a sampler method
//
bool HlslParseContext::isSamplerMethod(const TString& name) const
{
return
name == "CalculateLevelOfDetail" ||
name == "CalculateLevelOfDetailUnclamped" ||
name == "Gather" ||
name == "GatherRed" ||
name == "GatherGreen" ||
name == "GatherBlue" ||
name == "GatherAlpha" ||
name == "GatherCmp" ||
name == "GatherCmpRed" ||
name == "GatherCmpGreen" ||
name == "GatherCmpBlue" ||
name == "GatherCmpAlpha" ||
name == "GetDimensions" ||
name == "GetSamplePosition" ||
name == "Load" ||
name == "Sample" ||
name == "SampleBias" ||
name == "SampleCmp" ||
name == "SampleCmpLevelZero" ||
name == "SampleGrad" ||
name == "SampleLevel";
}
//
// Return true if the name is a struct buffer method
//
bool HlslParseContext::isStructBufferMethod(const TString& name) const
{
return
name == "GetDimensions" ||
name == "Load" ||
name == "Load2" ||
name == "Load3" ||
name == "Load4" ||
name == "Store" ||
name == "Store2" ||
name == "Store3" ||
name == "Store4" ||
name == "InterlockedAdd" ||
name == "InterlockedAnd" ||
name == "InterlockedCompareExchange" ||
name == "InterlockedCompareStore" ||
name == "InterlockedExchange" ||
name == "InterlockedMax" ||
name == "InterlockedMin" ||
name == "InterlockedOr" ||
name == "InterlockedXor";
}
//
// Handle seeing a base.field dereference in the grammar.
//
@ -804,35 +859,18 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
//
if (field == "length") {
return intermediate.addMethod(base, TType(EbtInt), &field, loc);
} else if (field == "CalculateLevelOfDetail" ||
field == "CalculateLevelOfDetailUnclamped" ||
field == "Gather" ||
field == "GatherRed" ||
field == "GatherGreen" ||
field == "GatherBlue" ||
field == "GatherAlpha" ||
field == "GatherCmp" ||
field == "GatherCmpRed" ||
field == "GatherCmpGreen" ||
field == "GatherCmpBlue" ||
field == "GatherCmpAlpha" ||
field == "GetDimensions" ||
field == "GetSamplePosition" ||
field == "Load" ||
field == "Sample" ||
field == "SampleBias" ||
field == "SampleCmp" ||
field == "SampleCmpLevelZero" ||
field == "SampleGrad" ||
field == "SampleLevel") {
// If it's not a method on a sampler object, we fall through in case it is a struct member.
if (base->getType().getBasicType() == EbtSampler) {
} else if (isSamplerMethod(field) && base->getType().getBasicType() == EbtSampler) {
// If it's not a method on a sampler object, we fall through to let other objects have a go.
const TSampler& sampler = base->getType().getSampler();
if (! sampler.isPureSampler()) {
const int vecSize = sampler.isShadow() ? 1 : 4; // TODO: handle arbitrary sample return sizes
return intermediate.addMethod(base, TType(sampler.type, EvqTemporary, vecSize), &field, loc);
}
}
} else if (isStructBufferMethod(field) &&
base->getType().isRuntimeSizedArray() &&
(base->getQualifier().storage == EvqUniform || base->getQualifier().storage == EvqBuffer)) {
TType retType(base->getType(), 0);
return intermediate.addMethod(base, retType, &field, loc);
} else if (field == "Append" ||
field == "RestartStrip") {
// We cannot check the type here: it may be sanitized if we're not compiling a geometry shader, but
@ -2236,6 +2274,236 @@ TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc
return txcombine;
}
//
// Decompose structure buffer methods into AST
//
void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
{
if (!node || !node->getAsOperator())
return;
const TOperator op = node->getAsOperator()->getOp();
TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
TIntermTyped* argArray = argAggregate ? argAggregate->getSequence()[0]->getAsTyped() : nullptr; // array
// Bail out if not a block method
if (argArray == nullptr || !argArray->getType().isRuntimeSizedArray())
return;
switch (op) {
case EOpMethodLoad:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // index
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// buffer then, but that's what it calls itself.
const bool isByteAddressBuffer = (argArray->getBasicType() == EbtUint);
if (isByteAddressBuffer)
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex, intermediate.addConstantUnion(2, loc, true),
loc, TType(EbtInt));
// Index into the array to find the item being loaded.
const TOperator idxOp = (argIndex->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
node = intermediate.addIndex(idxOp, argArray, argIndex, loc);
const TType derefType(argArray->getType(), 0);
node->setType(derefType);
}
break;
case EOpMethodLoad2:
case EOpMethodLoad3:
case EOpMethodLoad4:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // index
TOperator constructOp = EOpNull;
int size = 0;
switch (op) {
case EOpMethodLoad2: size = 2; constructOp = EOpConstructVec2; break;
case EOpMethodLoad3: size = 3; constructOp = EOpConstructVec3; break;
case EOpMethodLoad4: size = 4; constructOp = EOpConstructVec4; break;
default: assert(0);
}
TIntermTyped* body = nullptr;
// First, we'll store the address in a variable to avoid multiple shifts
// (we must convert the byte address to an item address)
TIntermTyped* byteAddrIdx = intermediate.addBinaryNode(EOpRightShift, argIndex,
intermediate.addConstantUnion(2, loc, true), loc, TType(EbtInt));
TVariable* byteAddrSym = makeInternalVariable("byteAddrTemp", TType(EbtInt, EvqTemporary));
TIntermTyped* byteAddrIdxVar = intermediate.addSymbol(*byteAddrSym, loc);
body = intermediate.growAggregate(body, intermediate.addAssign(EOpAssign, byteAddrIdxVar, byteAddrIdx, loc));
TIntermTyped* vec = nullptr;
// These are only valid on (rw)byteaddressbuffers, so we can always perform the >>2
// address conversion.
for (int idx=0; idx<size; ++idx) {
TIntermTyped* offsetIdx = byteAddrIdxVar;
// add index offset
if (idx != 0)
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx, intermediate.addConstantUnion(idx, loc, true),
loc, TType(EbtInt));
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
vec = intermediate.growAggregate(vec, intermediate.addIndex(idxOp, argArray, offsetIdx, loc));
}
vec->setType(TType(argArray->getBasicType(), EvqTemporary, size));
vec->getAsAggregate()->setOperator(constructOp);
body = intermediate.growAggregate(body, vec);
body->setType(vec->getType());
body->getAsAggregate()->setOperator(EOpSequence);
node = body;
}
break;
case EOpMethodStore:
case EOpMethodStore2:
case EOpMethodStore3:
case EOpMethodStore4:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // address
TIntermTyped* argValue = argAggregate->getSequence()[2]->getAsTyped(); // value
// Index into the array to find the item being loaded.
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// buffer then, but that's what it calls itself.
int size = 0;
switch (op) {
case EOpMethodStore: size = 1; break;
case EOpMethodStore2: size = 2; break;
case EOpMethodStore3: size = 3; break;
case EOpMethodStore4: size = 4; break;
default: assert(0);
}
TIntermAggregate* body = nullptr;
// First, we'll store the address in a variable to avoid multiple shifts
// (we must convert the byte address to an item address)
TIntermTyped* byteAddrIdx = intermediate.addBinaryNode(EOpRightShift, argIndex,
intermediate.addConstantUnion(2, loc, true), loc, TType(EbtInt));
TVariable* byteAddrSym = makeInternalVariable("byteAddrTemp", TType(EbtInt, EvqTemporary));
TIntermTyped* byteAddrIdxVar = intermediate.addSymbol(*byteAddrSym, loc);
body = intermediate.growAggregate(body, intermediate.addAssign(EOpAssign, byteAddrIdxVar, byteAddrIdx, loc));
for (int idx=0; idx<size; ++idx) {
TIntermTyped* offsetIdx = byteAddrIdxVar;
TIntermTyped* idxConst = intermediate.addConstantUnion(idx, loc, true);
// add index offset
if (idx != 0)
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx, idxConst, loc, TType(EbtInt));
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
TIntermTyped* lValue = intermediate.addIndex(idxOp, argArray, offsetIdx, loc);
TIntermTyped* rValue = (size == 1) ? argValue :
intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc);
TIntermTyped* assign = intermediate.addAssign(EOpAssign, lValue, rValue, loc);
body = intermediate.growAggregate(body, assign);
}
body->setOperator(EOpSequence);
node = body;
}
break;
case EOpMethodGetDimensions:
{
const int numArgs = argAggregate->getSequence().size();
TIntermTyped* argNumItems = argAggregate->getSequence()[1]->getAsTyped(); // out num items
TIntermTyped* argStride = numArgs > 2 ? argAggregate->getSequence()[2]->getAsTyped() : nullptr; // out stride
TIntermAggregate* body = nullptr;
// Length output:
if (argArray->getType().isRuntimeSizedArray()) {
TIntermTyped* lengthCall = intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, argArray,
argNumItems->getType());
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, lengthCall, loc);
body = intermediate.growAggregate(body, assign, loc);
} else {
const int length = argArray->getType().getOuterArraySize();
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, intermediate.addConstantUnion(length, loc, true), loc);
body = intermediate.growAggregate(body, assign, loc);
}
// Stride output:
if (argStride != nullptr) {
int size;
int stride;
intermediate.getBaseAlignment(argArray->getType(), size, stride, false,
argArray->getType().getQualifier().layoutMatrix == ElmRowMajor);
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argStride, intermediate.addConstantUnion(stride, loc, true), loc);
body = intermediate.growAggregate(body, assign);
}
body->setOperator(EOpSequence);
node = body;
}
break;
case EOpInterlockedAdd:
case EOpInterlockedAnd:
case EOpInterlockedExchange:
case EOpInterlockedMax:
case EOpInterlockedMin:
case EOpInterlockedOr:
case EOpInterlockedXor:
case EOpInterlockedCompareExchange:
case EOpInterlockedCompareStore:
{
// We'll replace the first argument with the block dereference, and let
// downstream decomposition handle the rest.
TIntermSequence& sequence = argAggregate->getSequence();
TIntermTyped* argIndex = sequence[1]->getAsTyped(); // index
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex, intermediate.addConstantUnion(2, loc, true),
loc, TType(EbtInt));
const TOperator idxOp = (argIndex->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
TIntermTyped* element = intermediate.addIndex(idxOp, argArray, argIndex, loc);
const TType derefType(argArray->getType(), 0);
element->setType(derefType);
// Replace the numeric byte offset parameter with array reference.
sequence[1] = element;
sequence.erase(sequence.begin(), sequence.begin()+1);
}
break;
default:
break; // most pass through unchanged
}
}
//
// Decompose DX9 and DX10 sample intrinsics & object methods into AST
//
@ -2264,6 +2532,15 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
const TOperator op = node->getAsOperator()->getOp();
const TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
// Bail out if not a sampler method
if (arguments != nullptr) {
if ((argAggregate != nullptr && argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler))
return;
if (argAggregate == nullptr && arguments->getAsTyped()->getBasicType() != EbtSampler)
return;
}
switch (op) {
// **** DX9 intrinsics: ****
case EOpTexture:
@ -3359,9 +3636,27 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
//
// Find it in the symbol table.
//
const TFunction* fnCandidate;
const TFunction* fnCandidate = nullptr;
bool builtIn;
// TODO: this needs improvement: there's no way at present to look up a signature in
// the symbol table for an arbitrary type. This is a temporary hack until that ability exists.
// It will have false positives, since it doesn't check arg counts or types.
if (arguments && arguments->getAsAggregate()) {
if (arguments->getAsAggregate()->getSequence()[0]->getAsTyped()->getType().isRuntimeSizedArray()) {
if (isStructBufferMethod(function->getName())) {
const TString mangle = function->getName() + "(";
TSymbol* symbol = symbolTable.find(mangle, &builtIn);
if (symbol)
fnCandidate = symbol->getAsFunction();
}
}
}
if (fnCandidate == nullptr)
fnCandidate = findFunction(loc, *function, builtIn, arguments);
if (fnCandidate) {
// This is a declared function that might map to
// - a built-in operator,
@ -3407,6 +3702,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
// output conversions.
const TIntermTyped* fnNode = result;
decomposeStructBufferMethods(loc, result, arguments); // HLSL->AST struct buffer method decompositions
decomposeIntrinsic(loc, result, arguments); // HLSL->AST intrinsic decompositions
decomposeSampleMethods(loc, result, arguments); // HLSL->AST sample method decompositions
decomposeGeometryMethods(loc, result, arguments); // HLSL->AST geometry method decompositions

View File

@ -84,6 +84,7 @@ public:
TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*);
void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
void decomposeGeometryMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
void addInputArgumentConversions(const TFunction&, TIntermTyped*&);
@ -243,6 +244,10 @@ protected:
void correctUniform(TQualifier& qualifier);
void clearUniformInputOutput(TQualifier& qualifier);
// Test method names
bool isSamplerMethod(const TString& name) const;
bool isStructBufferMethod(const TString& name) const;
// Pass through to base class after remembering builtin mappings.
using TParseContextBase::trackLinkage;
void trackLinkage(TSymbol& variable) override;

View File

@ -850,6 +850,26 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
{ "Append", "-", "-", "-", "-", EShLangGS },
{ "RestartStrip", "-", "-", "-", "-", EShLangGS },
// Methods for structurebuffers. TODO: wildcard type matching.
{ "Load", nullptr, nullptr, "-", "-", EShLangAll },
{ "Load2", nullptr, nullptr, "-", "-", EShLangAll },
{ "Load3", nullptr, nullptr, "-", "-", EShLangAll },
{ "Load4", nullptr, nullptr, "-", "-", EShLangAll },
{ "Store", nullptr, nullptr, "-", "-", EShLangAll },
{ "Store2", nullptr, nullptr, "-", "-", EShLangAll },
{ "Store3", nullptr, nullptr, "-", "-", EShLangAll },
{ "Store4", nullptr, nullptr, "-", "-", EShLangAll },
{ "GetDimensions", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedAdd", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedAnd", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedCompareExchange", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedCompareStore", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedExchange", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedMax", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedMin", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedOr", nullptr, nullptr, "-", "-", EShLangAll },
{ "InterlockedXor", nullptr, nullptr, "-", "-", EShLangAll },
// Mark end of list, since we want to avoid a range-based for, as some compilers don't handle it yet.
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 },
};
@ -1144,6 +1164,15 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
symbolTable.relateToOperator("CalculateLevelOfDetail", EOpMethodCalculateLevelOfDetail);
symbolTable.relateToOperator("CalculateLevelOfDetailUnclamped", EOpMethodCalculateLevelOfDetailUnclamped);
// Structure buffer methods (excluding associations already made above for texture methods w/ same name)
symbolTable.relateToOperator("Load2", EOpMethodLoad2);
symbolTable.relateToOperator("Load3", EOpMethodLoad3);
symbolTable.relateToOperator("Load4", EOpMethodLoad4);
symbolTable.relateToOperator("Store", EOpMethodStore);
symbolTable.relateToOperator("Store2", EOpMethodStore2);
symbolTable.relateToOperator("Store3", EOpMethodStore3);
symbolTable.relateToOperator("Store4", EOpMethodStore4);
// SM5 Texture methods
symbolTable.relateToOperator("GatherRed", EOpMethodGatherRed);
symbolTable.relateToOperator("GatherGreen", EOpMethodGatherGreen);

View File

@ -118,6 +118,7 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["out"] = EHTokOut;
(*KeywordMap)["inout"] = EHTokInOut;
(*KeywordMap)["layout"] = EHTokLayout;
(*KeywordMap)["globallycoherent"] = EHTokGloballyCoherent;
(*KeywordMap)["point"] = EHTokPoint;
(*KeywordMap)["line"] = EHTokLine;
@ -319,6 +320,13 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["RWTexture3D"] = EHTokRWTexture3d;
(*KeywordMap)["RWBuffer"] = EHTokRWBuffer;
(*KeywordMap)["AppendStructuredBuffer"] = EHTokAppendStructuredBuffer;
(*KeywordMap)["ByteAddressBuffer"] = EHTokByteAddressBuffer;
(*KeywordMap)["ConsumeStructuredBuffer"] = EHTokConsumeStructuredBuffer;
(*KeywordMap)["RWByteAddressBuffer"] = EHTokRWByteAddressBuffer;
(*KeywordMap)["RWStructuredBuffer"] = EHTokRWStructuredBuffer;
(*KeywordMap)["StructuredBuffer"] = EHTokStructuredBuffer;
(*KeywordMap)["struct"] = EHTokStruct;
(*KeywordMap)["cbuffer"] = EHTokCBuffer;
(*KeywordMap)["tbuffer"] = EHTokTBuffer;
@ -527,6 +535,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
case EHTokInOut:
case EHTokPrecise:
case EHTokLayout:
case EHTokGloballyCoherent:
return keyword;
// primitive types
@ -722,6 +731,12 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
case EHTokRWTexture2darray:
case EHTokRWTexture3d:
case EHTokRWBuffer:
case EHTokAppendStructuredBuffer:
case EHTokByteAddressBuffer:
case EHTokConsumeStructuredBuffer:
case EHTokRWByteAddressBuffer:
case EHTokRWStructuredBuffer:
case EHTokStructuredBuffer:
return keyword;
// variable, user type, ...

View File

@ -65,6 +65,7 @@ enum EHlslTokenClass {
EHTokOut,
EHTokInOut,
EHTokLayout,
EHTokGloballyCoherent,
// primitive types
EHTokPoint,
@ -256,6 +257,14 @@ enum EHlslTokenClass {
EHTokRWTexture3d,
EHTokRWBuffer,
// Structure buffer variants
EHTokAppendStructuredBuffer,
EHTokByteAddressBuffer,
EHTokConsumeStructuredBuffer,
EHTokRWByteAddressBuffer,
EHTokRWStructuredBuffer,
EHTokStructuredBuffer,
// variable, user type, ...
EHTokIdentifier,
EHTokTypeName,