This adds infrastructure suitable for any front end to create SPIR-V loop control flags. The only current front end doing so is HLSL. [unroll] turns into spv::LoopControlUnrollMask [loop] turns into spv::LoopControlDontUnrollMask no specification means spv::LoopControlMaskNone
		
			
				
	
	
		
			197 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			197 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
hlsl.whileLoop.frag
 | 
						|
Shader version: 500
 | 
						|
gl_FragCoord origin is upper left
 | 
						|
0:? Sequence
 | 
						|
0:2  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 | 
						|
0:2    Function Parameters: 
 | 
						|
0:2      'input' ( in 4-component vector of float)
 | 
						|
0:?     Sequence
 | 
						|
0:3      Loop with condition tested first
 | 
						|
0:3        Loop Condition
 | 
						|
0:3        any ( temp bool)
 | 
						|
0:3          NotEqual ( temp 4-component vector of bool)
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:3        Loop Body
 | 
						|
0:?         Sequence
 | 
						|
0:3          Branch: Return with expression
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:4      Loop with condition tested first
 | 
						|
0:4        Loop Condition
 | 
						|
0:4        Constant:
 | 
						|
0:4          false (const bool)
 | 
						|
0:4        No loop body
 | 
						|
0:5      Loop with condition tested first
 | 
						|
0:5        Loop Condition
 | 
						|
0:5        Constant:
 | 
						|
0:5          false (const bool)
 | 
						|
0:5        No loop body
 | 
						|
0:6      Loop with condition tested first
 | 
						|
0:6        Loop Condition
 | 
						|
0:6        Constant:
 | 
						|
0:6          false (const bool)
 | 
						|
0:6        No loop body
 | 
						|
0:2  Function Definition: PixelShaderFunction( ( temp void)
 | 
						|
0:2    Function Parameters: 
 | 
						|
0:?     Sequence
 | 
						|
0:2      move second child to first child ( temp 4-component vector of float)
 | 
						|
0:?         'input' ( temp 4-component vector of float)
 | 
						|
0:?         'input' (layout( location=0) in 4-component vector of float)
 | 
						|
0:2      move second child to first child ( temp 4-component vector of float)
 | 
						|
0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 | 
						|
0:2        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 | 
						|
0:?           'input' ( temp 4-component vector of float)
 | 
						|
0:?   Linker Objects
 | 
						|
0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 | 
						|
0:?     'input' (layout( location=0) in 4-component vector of float)
 | 
						|
 | 
						|
 | 
						|
Linked fragment stage:
 | 
						|
 | 
						|
 | 
						|
Shader version: 500
 | 
						|
gl_FragCoord origin is upper left
 | 
						|
0:? Sequence
 | 
						|
0:2  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 | 
						|
0:2    Function Parameters: 
 | 
						|
0:2      'input' ( in 4-component vector of float)
 | 
						|
0:?     Sequence
 | 
						|
0:3      Loop with condition tested first
 | 
						|
0:3        Loop Condition
 | 
						|
0:3        any ( temp bool)
 | 
						|
0:3          NotEqual ( temp 4-component vector of bool)
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:3        Loop Body
 | 
						|
0:?         Sequence
 | 
						|
0:3          Branch: Return with expression
 | 
						|
0:3            'input' ( in 4-component vector of float)
 | 
						|
0:4      Loop with condition tested first
 | 
						|
0:4        Loop Condition
 | 
						|
0:4        Constant:
 | 
						|
0:4          false (const bool)
 | 
						|
0:4        No loop body
 | 
						|
0:5      Loop with condition tested first
 | 
						|
0:5        Loop Condition
 | 
						|
0:5        Constant:
 | 
						|
0:5          false (const bool)
 | 
						|
0:5        No loop body
 | 
						|
0:6      Loop with condition tested first
 | 
						|
0:6        Loop Condition
 | 
						|
0:6        Constant:
 | 
						|
0:6          false (const bool)
 | 
						|
0:6        No loop body
 | 
						|
0:2  Function Definition: PixelShaderFunction( ( temp void)
 | 
						|
0:2    Function Parameters: 
 | 
						|
0:?     Sequence
 | 
						|
0:2      move second child to first child ( temp 4-component vector of float)
 | 
						|
0:?         'input' ( temp 4-component vector of float)
 | 
						|
0:?         'input' (layout( location=0) in 4-component vector of float)
 | 
						|
0:2      move second child to first child ( temp 4-component vector of float)
 | 
						|
0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 | 
						|
0:2        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 | 
						|
0:?           'input' ( temp 4-component vector of float)
 | 
						|
0:?   Linker Objects
 | 
						|
0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 | 
						|
0:?     'input' (layout( location=0) in 4-component vector of float)
 | 
						|
 | 
						|
// Module Version 10000
 | 
						|
// Generated by (magic number): 80001
 | 
						|
// Id's are bound by 52
 | 
						|
 | 
						|
                              Capability Shader
 | 
						|
               1:             ExtInstImport  "GLSL.std.450"
 | 
						|
                              MemoryModel Logical GLSL450
 | 
						|
                              EntryPoint Fragment 4  "PixelShaderFunction" 45 48
 | 
						|
                              ExecutionMode 4 OriginUpperLeft
 | 
						|
                              Source HLSL 500
 | 
						|
                              Name 4  "PixelShaderFunction"
 | 
						|
                              Name 11  "@PixelShaderFunction(vf4;"
 | 
						|
                              Name 10  "input"
 | 
						|
                              Name 43  "input"
 | 
						|
                              Name 45  "input"
 | 
						|
                              Name 48  "@entryPointOutput"
 | 
						|
                              Name 49  "param"
 | 
						|
                              Decorate 45(input) Location 0
 | 
						|
                              Decorate 48(@entryPointOutput) Location 0
 | 
						|
               2:             TypeVoid
 | 
						|
               3:             TypeFunction 2
 | 
						|
               6:             TypeFloat 32
 | 
						|
               7:             TypeVector 6(float) 4
 | 
						|
               8:             TypePointer Function 7(fvec4)
 | 
						|
               9:             TypeFunction 7(fvec4) 8(ptr)
 | 
						|
              20:             TypeBool
 | 
						|
              21:             TypeVector 20(bool) 4
 | 
						|
              31:    20(bool) ConstantFalse
 | 
						|
              44:             TypePointer Input 7(fvec4)
 | 
						|
       45(input):     44(ptr) Variable Input
 | 
						|
              47:             TypePointer Output 7(fvec4)
 | 
						|
48(@entryPointOutput):     47(ptr) Variable Output
 | 
						|
4(PixelShaderFunction):           2 Function None 3
 | 
						|
               5:             Label
 | 
						|
       43(input):      8(ptr) Variable Function
 | 
						|
       49(param):      8(ptr) Variable Function
 | 
						|
              46:    7(fvec4) Load 45(input)
 | 
						|
                              Store 43(input) 46
 | 
						|
              50:    7(fvec4) Load 43(input)
 | 
						|
                              Store 49(param) 50
 | 
						|
              51:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 49(param)
 | 
						|
                              Store 48(@entryPointOutput) 51
 | 
						|
                              Return
 | 
						|
                              FunctionEnd
 | 
						|
11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
 | 
						|
       10(input):      8(ptr) FunctionParameter
 | 
						|
              12:             Label
 | 
						|
                              Branch 13
 | 
						|
              13:             Label
 | 
						|
                              LoopMerge 15 16 None
 | 
						|
                              Branch 17
 | 
						|
              17:             Label
 | 
						|
              18:    7(fvec4) Load 10(input)
 | 
						|
              19:    7(fvec4) Load 10(input)
 | 
						|
              22:   21(bvec4) FOrdNotEqual 18 19
 | 
						|
              23:    20(bool) Any 22
 | 
						|
                              BranchConditional 23 14 15
 | 
						|
              14:               Label
 | 
						|
              24:    7(fvec4)   Load 10(input)
 | 
						|
                                ReturnValue 24
 | 
						|
              16:               Label
 | 
						|
                                Branch 13
 | 
						|
              15:             Label
 | 
						|
                              Branch 26
 | 
						|
              26:             Label
 | 
						|
                              LoopMerge 28 29 None
 | 
						|
                              Branch 30
 | 
						|
              30:             Label
 | 
						|
                              BranchConditional 31 27 28
 | 
						|
              27:               Label
 | 
						|
                                Branch 29
 | 
						|
              29:               Label
 | 
						|
                                Branch 26
 | 
						|
              28:             Label
 | 
						|
                              Branch 32
 | 
						|
              32:             Label
 | 
						|
                              LoopMerge 34 35 Unroll 
 | 
						|
                              Branch 36
 | 
						|
              36:             Label
 | 
						|
                              BranchConditional 31 33 34
 | 
						|
              33:               Label
 | 
						|
                                Branch 35
 | 
						|
              35:               Label
 | 
						|
                                Branch 32
 | 
						|
              34:             Label
 | 
						|
                              Branch 37
 | 
						|
              37:             Label
 | 
						|
                              LoopMerge 39 40 None
 | 
						|
                              Branch 41
 | 
						|
              41:             Label
 | 
						|
                              BranchConditional 31 38 39
 | 
						|
              38:               Label
 | 
						|
                                Branch 40
 | 
						|
              40:               Label
 | 
						|
                                Branch 37
 | 
						|
              39:             Label
 | 
						|
              42:    7(fvec4) Undef
 | 
						|
                              ReturnValue 42
 | 
						|
                              FunctionEnd
 |