HLSL: matrix swizzle (_12, _m23) syntax, partial semantics.
This partially addressess issue #670, for when the matrix swizzle degenerates to a component or column: m[c], m[c][r] (where HLSL swaps rows and columns for user's view). An error message is given for the arbitrary cases not covered. These cases will work for arbitrary use of l-values. Future work will handle more arbitrary swizzles, which might not work as arbitrary l-values.
This commit is contained in:
148
Test/baseResults/hlsl.matrixSwizzle.vert.out
Executable file
148
Test/baseResults/hlsl.matrixSwizzle.vert.out
Executable file
@@ -0,0 +1,148 @@
|
||||
hlsl.matrixSwizzle.vert
|
||||
Shader version: 450
|
||||
0:? Sequence
|
||||
0:2 Function Definition: ShaderFunction(f1; (temp void)
|
||||
0:2 Function Parameters:
|
||||
0:2 'inf' (layout(location=0 ) in float)
|
||||
0:? Sequence
|
||||
0:5 move second child to first child (temp float)
|
||||
0:5 direct index (temp float)
|
||||
0:5 direct index (temp 4-component vector of float)
|
||||
0:5 'm' (temp 3X4 matrix of float)
|
||||
0:5 Constant:
|
||||
0:5 2 (const int)
|
||||
0:5 Constant:
|
||||
0:5 3 (const int)
|
||||
0:5 Constant:
|
||||
0:5 1.000000
|
||||
0:6 move second child to first child (temp float)
|
||||
0:6 direct index (temp float)
|
||||
0:6 direct index (temp 4-component vector of float)
|
||||
0:6 'm' (temp 3X4 matrix of float)
|
||||
0:6 Constant:
|
||||
0:6 2 (const int)
|
||||
0:6 Constant:
|
||||
0:6 3 (const int)
|
||||
0:6 Constant:
|
||||
0:6 2.000000
|
||||
0:8 move second child to first child (temp 4-component vector of float)
|
||||
0:8 direct index (temp 4-component vector of float)
|
||||
0:8 'm' (temp 3X4 matrix of float)
|
||||
0:8 Constant:
|
||||
0:8 0 (const int)
|
||||
0:8 Constant:
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:9 move second child to first child (temp 4-component vector of float)
|
||||
0:9 direct index (temp 4-component vector of float)
|
||||
0:9 'm' (temp 3X4 matrix of float)
|
||||
0:9 Constant:
|
||||
0:9 1 (const int)
|
||||
0:9 Constant:
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:? Linker Objects
|
||||
0:? 'inf' (layout(location=0 ) in float)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
0:? Sequence
|
||||
0:2 Function Definition: ShaderFunction(f1; (temp void)
|
||||
0:2 Function Parameters:
|
||||
0:2 'inf' (layout(location=0 ) in float)
|
||||
0:? Sequence
|
||||
0:5 move second child to first child (temp float)
|
||||
0:5 direct index (temp float)
|
||||
0:5 direct index (temp 4-component vector of float)
|
||||
0:5 'm' (temp 3X4 matrix of float)
|
||||
0:5 Constant:
|
||||
0:5 2 (const int)
|
||||
0:5 Constant:
|
||||
0:5 3 (const int)
|
||||
0:5 Constant:
|
||||
0:5 1.000000
|
||||
0:6 move second child to first child (temp float)
|
||||
0:6 direct index (temp float)
|
||||
0:6 direct index (temp 4-component vector of float)
|
||||
0:6 'm' (temp 3X4 matrix of float)
|
||||
0:6 Constant:
|
||||
0:6 2 (const int)
|
||||
0:6 Constant:
|
||||
0:6 3 (const int)
|
||||
0:6 Constant:
|
||||
0:6 2.000000
|
||||
0:8 move second child to first child (temp 4-component vector of float)
|
||||
0:8 direct index (temp 4-component vector of float)
|
||||
0:8 'm' (temp 3X4 matrix of float)
|
||||
0:8 Constant:
|
||||
0:8 0 (const int)
|
||||
0:8 Constant:
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:8 3.000000
|
||||
0:9 move second child to first child (temp 4-component vector of float)
|
||||
0:9 direct index (temp 4-component vector of float)
|
||||
0:9 'm' (temp 3X4 matrix of float)
|
||||
0:9 Constant:
|
||||
0:9 1 (const int)
|
||||
0:9 Constant:
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:9 3.000000
|
||||
0:? Linker Objects
|
||||
0:? 'inf' (layout(location=0 ) in float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 29
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "ShaderFunction" 28
|
||||
Name 4 "ShaderFunction"
|
||||
Name 10 "m"
|
||||
Name 28 "inf"
|
||||
Decorate 28(inf) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeMatrix 7(fvec4) 3
|
||||
9: TypePointer Function 8
|
||||
11: TypeInt 32 1
|
||||
12: 11(int) Constant 2
|
||||
13: 6(float) Constant 1065353216
|
||||
14: TypeInt 32 0
|
||||
15: 14(int) Constant 3
|
||||
16: TypePointer Function 6(float)
|
||||
18: 6(float) Constant 1073741824
|
||||
20: 11(int) Constant 0
|
||||
21: 6(float) Constant 1077936128
|
||||
22: 7(fvec4) ConstantComposite 21 21 21 21
|
||||
23: TypePointer Function 7(fvec4)
|
||||
25: 11(int) Constant 1
|
||||
27: TypePointer Input 6(float)
|
||||
28(inf): 27(ptr) Variable Input
|
||||
4(ShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
10(m): 9(ptr) Variable Function
|
||||
17: 16(ptr) AccessChain 10(m) 12 15
|
||||
Store 17 13
|
||||
19: 16(ptr) AccessChain 10(m) 12 15
|
||||
Store 19 18
|
||||
24: 23(ptr) AccessChain 10(m) 20
|
||||
Store 24 22
|
||||
26: 23(ptr) AccessChain 10(m) 25
|
||||
Store 26 22
|
||||
Return
|
||||
FunctionEnd
|
||||
10
Test/hlsl.matrixSwizzle.vert
Normal file
10
Test/hlsl.matrixSwizzle.vert
Normal file
@@ -0,0 +1,10 @@
|
||||
void ShaderFunction(float inf) : COLOR0
|
||||
{
|
||||
float3x4 m;
|
||||
|
||||
m._34 = 1.0; // AST should have a normal component select
|
||||
m._m23 = 2.0; // same code
|
||||
|
||||
m._11_12_13_14 = float4(3.0); // AST should have normal column selection (first row)
|
||||
m._m10_m11_m12_m13 = float4(3.0); // AST should have normal column selection (second row)
|
||||
}
|
||||
Reference in New Issue
Block a user