 4c9876b34c
			
		
	
	
		4c9876b34c
		
	
	
	
	
		
			
			Consider the following code:
    layout(constant_id=0) const int Y = 1;
    layout(constant_id=1) const int Z = 2;
    layout(constant_id=3) const int X = Y + Z;
Previously, it would produce SPIR-V decorations like this:
    Decorate 21(Y) SpecId 1
    Decorate 22 SpecId 3
    Decorate 33(Z) SpecId 0
This seems inaccurate, since the spec constant `X` that is dependent on
the two others did not get a name in the SPIR-V decorations. This behavior
may potentially negatively affect shader introspection capabilities.
This change alters the behavior to always add a name, which results in the code
above producing the following decorations:
    Decorate 21(Y) SpecId 1
    Decorate 22(X) SpecId 3
    Decorate 33(Z) SpecId 0
		
	
			
		
			
				
	
	
		
			262 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			262 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| spv.specConstantOperations.vert
 | |
| // Module Version 10000
 | |
| // Generated by (magic number): 80007
 | |
| // Id's are bound by 162
 | |
| 
 | |
|                               Capability Shader
 | |
|                               Capability Float64
 | |
|                1:             ExtInstImport  "GLSL.std.450"
 | |
|                               MemoryModel Logical GLSL450
 | |
|                               EntryPoint Vertex 4  "main"
 | |
|                               Source GLSL 450
 | |
|                               Name 4  "main"
 | |
|                               Name 8  "non_const_array_size_from_spec_const("
 | |
|                               Name 11  "i"
 | |
|                               Name 19  "sp_int"
 | |
|                               Name 27  "array"
 | |
|                               Name 40  "sp_float"
 | |
|                               Name 42  "sp_uint"
 | |
|                               Name 43  "sp_sint"
 | |
|                               Name 45  "sp_double"
 | |
|                               Name 46  "float_from_double"
 | |
|                               Name 47  "double_from_float"
 | |
|                               Name 49  "bool_from_int"
 | |
|                               Name 50  "bool_from_uint"
 | |
|                               Name 51  "int_from_bool"
 | |
|                               Name 53  "uint_from_bool"
 | |
|                               Name 54  "sp_uint_from_sint"
 | |
|                               Name 55  "sp_sint_from_uint"
 | |
|                               Name 56  "negate_int"
 | |
|                               Name 57  "not_int"
 | |
|                               Name 58  "sp_int_add_two"
 | |
|                               Name 61  "sp_int_add_two_sub_three"
 | |
|                               Name 63  "sp_int_add_two_sub_four"
 | |
|                               Name 64  "sp_sint_mul_two"
 | |
|                               Name 66  "sp_uint_mul_two"
 | |
|                               Name 68  "sp_sint_mul_two_div_five"
 | |
|                               Name 70  "sp_uint_mul_two_div_five"
 | |
|                               Name 71  "sp_sint_rem_four"
 | |
|                               Name 73  "sp_uint_rem_four"
 | |
|                               Name 75  "sp_sint_mul_three_div_five"
 | |
|                               Name 77  "sp_sint_shift_right_arithmetic"
 | |
|                               Name 79  "sp_uint_shift_right_arithmetic"
 | |
|                               Name 80  "sp_sint_shift_left"
 | |
|                               Name 81  "sp_uint_shift_left"
 | |
|                               Name 83  "sp_sint_or_256"
 | |
|                               Name 85  "sp_uint_xor_512"
 | |
|                               Name 86  "sp_int_lt_sp_sint"
 | |
|                               Name 87  "sp_uint_equal_sp_uint"
 | |
|                               Name 88  "sp_int_gt_sp_sint"
 | |
|                               Name 91  "iv"
 | |
|                               Name 95  "uv"
 | |
|                               Name 98  "bv_from_iv"
 | |
|                               Name 99  "bv_from_uv"
 | |
|                               Name 102  "iv_from_bv"
 | |
|                               Name 104  "uv_from_bv"
 | |
|                               Name 105  "uv_from_iv"
 | |
|                               Name 106  "iv_from_uv"
 | |
|                               Name 107  "not_iv"
 | |
|                               Name 108  "negate_iv"
 | |
|                               Name 110  "iv_add_two"
 | |
|                               Name 113  "iv_add_two_sub_three"
 | |
|                               Name 115  "iv_add_two_sub_four"
 | |
|                               Name 116  "iv_mul_two"
 | |
|                               Name 118  "iv_mul_two_div_five"
 | |
|                               Name 119  "iv_rem_four"
 | |
|                               Name 121  "iv_shift_right_arithmetic"
 | |
|                               Name 122  "iv_shift_left"
 | |
|                               Name 125  "iv_or_1024"
 | |
|                               Name 128  "uv_xor_2048"
 | |
|                               Name 129  "iv_x"
 | |
|                               Name 131  "iv_yx"
 | |
|                               Name 133  "iv_zyx"
 | |
|                               Name 134  "iv_yzxw"
 | |
|                               Name 135  "a"
 | |
|                               Name 136  "b"
 | |
|                               Name 137  "c"
 | |
|                               Name 142  "ternayArray1"
 | |
|                               Name 145  "t1"
 | |
|                               Name 146  "t2"
 | |
|                               Name 148  "t3"
 | |
|                               Name 152  "t4"
 | |
|                               Name 161  "v2"
 | |
|                               Decorate 19(sp_int) SpecId 201
 | |
|                               Decorate 40(sp_float) SpecId 200
 | |
|                               Decorate 42(sp_uint) SpecId 202
 | |
|                               Decorate 43(sp_sint) SpecId 203
 | |
|                               Decorate 45(sp_double) SpecId 204
 | |
|                               Decorate 135(a) SpecId 210
 | |
|                               Decorate 136(b) SpecId 211
 | |
|                               Decorate 137(c) SpecId 212
 | |
|                2:             TypeVoid
 | |
|                3:             TypeFunction 2
 | |
|                6:             TypeInt 32 1
 | |
|                7:             TypeFunction 6(int)
 | |
|               10:             TypePointer Function 6(int)
 | |
|               12:      6(int) Constant 0
 | |
|       19(sp_int):      6(int) SpecConstant 10
 | |
|               20:      6(int) Constant 2
 | |
|               21:      6(int) SpecConstantOp 128 19(sp_int) 20
 | |
|               22:             TypeBool
 | |
|               24:      6(int) SpecConstantOp 128 19(sp_int) 20
 | |
|               25:             TypeArray 6(int) 24
 | |
|               26:             TypePointer Function 25
 | |
|               29:      6(int) Constant 1023
 | |
|               32:      6(int) Constant 1
 | |
|               34:      6(int) SpecConstantOp 128 19(sp_int) 32
 | |
|               39:             TypeFloat 32
 | |
|     40(sp_float):   39(float) SpecConstant 1078530010
 | |
|               41:             TypeInt 32 0
 | |
|      42(sp_uint):     41(int) SpecConstant 100
 | |
|      43(sp_sint):      6(int) SpecConstant 4294967286
 | |
|               44:             TypeFloat 64
 | |
|    45(sp_double):44(float64_t) SpecConstant 2333366019 1074118410
 | |
| 46(float_from_double):   39(float) SpecConstantOp 115 45(sp_double)
 | |
| 47(double_from_float):44(float64_t) SpecConstantOp 115 40(sp_float)
 | |
|               48:     41(int) Constant 0
 | |
| 49(bool_from_int):    22(bool) SpecConstantOp 171 19(sp_int) 48
 | |
| 50(bool_from_uint):    22(bool) SpecConstantOp 171 42(sp_uint) 48
 | |
| 51(int_from_bool):      6(int) SpecConstantOp 169 49(bool_from_int) 32 12
 | |
|               52:     41(int) Constant 1
 | |
| 53(uint_from_bool):     41(int) SpecConstantOp 169 49(bool_from_int) 52 48
 | |
| 54(sp_uint_from_sint):     41(int) SpecConstantOp 128 43(sp_sint) 48
 | |
| 55(sp_sint_from_uint):      6(int) SpecConstantOp 128 42(sp_uint) 48
 | |
|   56(negate_int):      6(int) SpecConstantOp 126 19(sp_int)
 | |
|      57(not_int):      6(int) SpecConstantOp 200 19(sp_int)
 | |
| 58(sp_int_add_two):      6(int) SpecConstantOp 128 19(sp_int) 20
 | |
|               59:      6(int) SpecConstantOp 128 19(sp_int) 20
 | |
|               60:      6(int) Constant 3
 | |
| 61(sp_int_add_two_sub_three):      6(int) SpecConstantOp 130 59 60
 | |
|               62:      6(int) Constant 4
 | |
| 63(sp_int_add_two_sub_four):      6(int) SpecConstantOp 130 58(sp_int_add_two) 62
 | |
| 64(sp_sint_mul_two):      6(int) SpecConstantOp 132 43(sp_sint) 20
 | |
|               65:     41(int) Constant 2
 | |
| 66(sp_uint_mul_two):     41(int) SpecConstantOp 132 42(sp_uint) 65
 | |
|               67:      6(int) Constant 5
 | |
| 68(sp_sint_mul_two_div_five):      6(int) SpecConstantOp 135 64(sp_sint_mul_two) 67
 | |
|               69:     41(int) Constant 5
 | |
| 70(sp_uint_mul_two_div_five):     41(int) SpecConstantOp 134 66(sp_uint_mul_two) 69
 | |
| 71(sp_sint_rem_four):      6(int) SpecConstantOp 139 43(sp_sint) 62
 | |
|               72:     41(int) Constant 4
 | |
| 73(sp_uint_rem_four):     41(int) SpecConstantOp 137 42(sp_uint) 72
 | |
|               74:      6(int) SpecConstantOp 132 43(sp_sint) 60
 | |
| 75(sp_sint_mul_three_div_five):      6(int) SpecConstantOp 135 74 67
 | |
|               76:      6(int) Constant 10
 | |
| 77(sp_sint_shift_right_arithmetic):      6(int) SpecConstantOp 195 43(sp_sint) 76
 | |
|               78:      6(int) Constant 20
 | |
| 79(sp_uint_shift_right_arithmetic):     41(int) SpecConstantOp 194 42(sp_uint) 78
 | |
| 80(sp_sint_shift_left):      6(int) SpecConstantOp 196 43(sp_sint) 32
 | |
| 81(sp_uint_shift_left):     41(int) SpecConstantOp 196 42(sp_uint) 20
 | |
|               82:      6(int) Constant 256
 | |
| 83(sp_sint_or_256):      6(int) SpecConstantOp 197 43(sp_sint) 82
 | |
|               84:     41(int) Constant 512
 | |
| 85(sp_uint_xor_512):     41(int) SpecConstantOp 198 42(sp_uint) 84
 | |
| 86(sp_int_lt_sp_sint):    22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint)
 | |
| 87(sp_uint_equal_sp_uint):    22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint)
 | |
| 88(sp_int_gt_sp_sint):    22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint)
 | |
|               89:      6(int) Constant 30
 | |
|               90:             TypeVector 6(int) 4
 | |
|           91(iv):   90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int)
 | |
|               92:     41(int) Constant 4294967295
 | |
|               93:     41(int) Constant 4294967294
 | |
|               94:             TypeVector 41(int) 4
 | |
|           95(uv):   94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93
 | |
|               96:             TypeVector 22(bool) 4
 | |
|               97:   94(ivec4) ConstantComposite 48 48 48 48
 | |
|   98(bv_from_iv):   96(bvec4) SpecConstantOp 171 91(iv) 97
 | |
|   99(bv_from_uv):   96(bvec4) SpecConstantOp 171 95(uv) 97
 | |
|              100:   90(ivec4) ConstantComposite 12 12 12 12
 | |
|              101:   90(ivec4) ConstantComposite 32 32 32 32
 | |
|  102(iv_from_bv):   90(ivec4) SpecConstantOp 169 98(bv_from_iv) 101 100
 | |
|              103:   94(ivec4) ConstantComposite 52 52 52 52
 | |
|  104(uv_from_bv):   94(ivec4) SpecConstantOp 169 98(bv_from_iv) 103 97
 | |
|  105(uv_from_iv):   94(ivec4) SpecConstantOp 128 91(iv) 97
 | |
|  106(iv_from_uv):   90(ivec4) SpecConstantOp 128 95(uv) 97
 | |
|      107(not_iv):   90(ivec4) SpecConstantOp 200 91(iv)
 | |
|   108(negate_iv):   90(ivec4) SpecConstantOp 126 91(iv)
 | |
|              109:   90(ivec4) ConstantComposite 20 20 20 20
 | |
|  110(iv_add_two):   90(ivec4) SpecConstantOp 128 91(iv) 109
 | |
|              111:   90(ivec4) SpecConstantOp 128 91(iv) 109
 | |
|              112:   90(ivec4) ConstantComposite 60 60 60 60
 | |
| 113(iv_add_two_sub_three):   90(ivec4) SpecConstantOp 130 111 112
 | |
|              114:   90(ivec4) ConstantComposite 62 62 62 62
 | |
| 115(iv_add_two_sub_four):   90(ivec4) SpecConstantOp 130 113(iv_add_two_sub_three) 114
 | |
|  116(iv_mul_two):   90(ivec4) SpecConstantOp 132 91(iv) 109
 | |
|              117:   90(ivec4) ConstantComposite 67 67 67 67
 | |
| 118(iv_mul_two_div_five):   90(ivec4) SpecConstantOp 135 116(iv_mul_two) 117
 | |
| 119(iv_rem_four):   90(ivec4) SpecConstantOp 139 91(iv) 114
 | |
|              120:   90(ivec4) ConstantComposite 76 76 76 76
 | |
| 121(iv_shift_right_arithmetic):   90(ivec4) SpecConstantOp 195 91(iv) 120
 | |
| 122(iv_shift_left):   90(ivec4) SpecConstantOp 196 91(iv) 109
 | |
|              123:      6(int) Constant 1024
 | |
|              124:   90(ivec4) ConstantComposite 123 123 123 123
 | |
|  125(iv_or_1024):   90(ivec4) SpecConstantOp 197 91(iv) 124
 | |
|              126:     41(int) Constant 2048
 | |
|              127:   94(ivec4) ConstantComposite 126 126 126 126
 | |
| 128(uv_xor_2048):   94(ivec4) SpecConstantOp 198 95(uv) 127
 | |
|        129(iv_x):      6(int) SpecConstantOp 81 91(iv) 0
 | |
|              130:             TypeVector 6(int) 2
 | |
|       131(iv_yx):  130(ivec2) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 0
 | |
|              132:             TypeVector 6(int) 3
 | |
|      133(iv_zyx):  132(ivec3) SpecConstantOp 79 91(iv) 91(iv) 2 1(GLSL.std.450) 0
 | |
|     134(iv_yzxw):   90(ivec4) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 2 0 3
 | |
|           135(a):      6(int) SpecConstant 4
 | |
|           136(b):      6(int) SpecConstant 6
 | |
|           137(c):    22(bool) SpecConstantTrue
 | |
|              138:    22(bool) SpecConstantOp 173 135(a) 136(b)
 | |
|              139:      6(int) SpecConstantOp 169 138 135(a) 136(b)
 | |
|              140:             TypeArray 6(int) 139
 | |
|              141:             TypePointer Private 140
 | |
| 142(ternayArray1):    141(ptr) Variable Private
 | |
|              143:      6(int) Constant 13
 | |
|              144:      6(int) Constant 17
 | |
|          145(t1):      6(int) SpecConstantOp 169 137(c) 143 144
 | |
|          146(t2):      6(int) SpecConstantOp 169 137(c) 135(a) 144
 | |
|              147:    22(bool) ConstantTrue
 | |
|          148(t3):      6(int) SpecConstantOp 169 147 135(a) 144
 | |
|              149:    22(bool) SpecConstantOp 173 135(a) 136(b)
 | |
|              150:      6(int) SpecConstantOp 128 143 135(a)
 | |
|              151:      6(int) SpecConstantOp 132 144 136(b)
 | |
|          152(t4):      6(int) SpecConstantOp 169 149 150 151
 | |
|              153:    22(bool) SpecConstantOp 168 137(c)
 | |
|              154:             TypeVector 39(float) 2
 | |
|              155:   39(float) Constant 1065353216
 | |
|              156:  154(fvec2) ConstantComposite 155 155
 | |
|              157:   39(float) Constant 1073741824
 | |
|              158:  154(fvec2) ConstantComposite 157 157
 | |
|              159:             TypeVector 22(bool) 2
 | |
|              160:  159(bvec2) SpecConstantComposite 153 153
 | |
|          161(v2):  154(fvec2) SpecConstantOp 169 160 156 158
 | |
|          4(main):           2 Function None 3
 | |
|                5:             Label
 | |
|                               Return
 | |
|                               FunctionEnd
 | |
| 8(non_const_array_size_from_spec_const():      6(int) Function None 7
 | |
|                9:             Label
 | |
|            11(i):     10(ptr) Variable Function
 | |
|        27(array):     26(ptr) Variable Function
 | |
|                               Store 11(i) 12
 | |
|                               Branch 13
 | |
|               13:             Label
 | |
|                               LoopMerge 15 16 None
 | |
|                               Branch 17
 | |
|               17:             Label
 | |
|               18:      6(int) Load 11(i)
 | |
|               23:    22(bool) SLessThan 18 21
 | |
|                               BranchConditional 23 14 15
 | |
|               14:               Label
 | |
|               28:      6(int)   Load 11(i)
 | |
|               30:     10(ptr)   AccessChain 27(array) 28
 | |
|                                 Store 30 29
 | |
|                                 Branch 16
 | |
|               16:               Label
 | |
|               31:      6(int)   Load 11(i)
 | |
|               33:      6(int)   IAdd 31 32
 | |
|                                 Store 11(i) 33
 | |
|                                 Branch 13
 | |
|               15:             Label
 | |
|               35:     10(ptr) AccessChain 27(array) 34
 | |
|               36:      6(int) Load 35
 | |
|                               ReturnValue 36
 | |
|                               FunctionEnd
 |