HLSL: fix several issues in mat construction from scalars
This fixes: 1. A compilation error when assigning scalars to matricies 2. A semantic error in matrix construction from scalars. This was initializing the diagonal, where HLSL semantics require the scalar be replicated to every matrix element. 3. Functions accepting mats can be called with scalars, which will be shape-converted to the matrix type. This was previously failing to match the function signature. NOTE: this does not yet handle complex scalars (a function call, say) used to construct matricies. That'll be added when the node replicator service is available. For now, there's an assert. There's one new test (hlsl.scalar2matrix.frag). An existing test lsl.type.half.frag changes, because of (2) above, and a negative test error message changes due to (3) above. Fixes #923.
This commit is contained in:
parent
f7cd88a2b5
commit
e2713125b9
7 changed files with 617 additions and 45 deletions
|
|
@ -49,11 +49,11 @@ gl_FragCoord origin is upper left
|
|||
0:16 'h23' ( temp 2X3 matrix of float)
|
||||
0:16 Constant:
|
||||
0:16 4.900000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 4.900000
|
||||
0:16 0.000000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:27 Branch: Return with expression
|
||||
0:27 Construct vec4 ( temp 4-component vector of float)
|
||||
0:27 add ( temp float)
|
||||
|
|
@ -133,11 +133,11 @@ gl_FragCoord origin is upper left
|
|||
0:16 'h23' ( temp 2X3 matrix of float)
|
||||
0:16 Constant:
|
||||
0:16 4.900000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 4.900000
|
||||
0:16 0.000000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:16 4.900000
|
||||
0:27 Branch: Return with expression
|
||||
0:27 Construct vec4 ( temp 4-component vector of float)
|
||||
0:27 add ( temp float)
|
||||
|
|
@ -165,12 +165,12 @@ gl_FragCoord origin is upper left
|
|||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 61
|
||||
// Id's are bound by 60
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 59
|
||||
EntryPoint Fragment 4 "main" 58
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
|
|
@ -182,8 +182,8 @@ gl_FragCoord origin is upper left
|
|||
Name 27 "h4"
|
||||
Name 32 "h22"
|
||||
Name 38 "h23"
|
||||
Name 59 "@entryPointOutput"
|
||||
Decorate 59(@entryPointOutput) Location 0
|
||||
Name 58 "@entryPointOutput"
|
||||
Decorate 58(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
@ -211,20 +211,19 @@ gl_FragCoord origin is upper left
|
|||
36: TypeMatrix 21(fvec3) 2
|
||||
37: TypePointer Function 36
|
||||
39: 6(float) Constant 1084017869
|
||||
40: 21(fvec3) ConstantComposite 39 13 13
|
||||
41: 21(fvec3) ConstantComposite 13 39 13
|
||||
42: 36 ConstantComposite 40 41
|
||||
43: TypeInt 32 1
|
||||
44: 43(int) Constant 0
|
||||
45: TypeInt 32 0
|
||||
46: 45(int) Constant 0
|
||||
49: 45(int) Constant 1
|
||||
58: TypePointer Output 7(fvec4)
|
||||
59(@entryPointOutput): 58(ptr) Variable Output
|
||||
40: 21(fvec3) ConstantComposite 39 39 39
|
||||
41: 36 ConstantComposite 40 40
|
||||
42: TypeInt 32 1
|
||||
43: 42(int) Constant 0
|
||||
44: TypeInt 32 0
|
||||
45: 44(int) Constant 0
|
||||
48: 44(int) Constant 1
|
||||
57: TypePointer Output 7(fvec4)
|
||||
58(@entryPointOutput): 57(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
60: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 59(@entryPointOutput) 60
|
||||
59: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 58(@entryPointOutput) 59
|
||||
Return
|
||||
FunctionEnd
|
||||
9(@main(): 7(fvec4) Function None 8
|
||||
|
|
@ -242,14 +241,14 @@ gl_FragCoord origin is upper left
|
|||
Store 23(h3) 25
|
||||
Store 27(h4) 29
|
||||
Store 32(h22) 35
|
||||
Store 38(h23) 42
|
||||
47: 11(ptr) AccessChain 38(h23) 44 46
|
||||
48: 6(float) Load 47
|
||||
50: 11(ptr) AccessChain 27(h4) 49
|
||||
51: 6(float) Load 50
|
||||
52: 6(float) FAdd 48 51
|
||||
53: 6(float) Load 12(h0)
|
||||
54: 6(float) FAdd 52 53
|
||||
55: 7(fvec4) CompositeConstruct 54 54 54 54
|
||||
ReturnValue 55
|
||||
Store 38(h23) 41
|
||||
46: 11(ptr) AccessChain 38(h23) 43 45
|
||||
47: 6(float) Load 46
|
||||
49: 11(ptr) AccessChain 27(h4) 48
|
||||
50: 6(float) Load 49
|
||||
51: 6(float) FAdd 47 50
|
||||
52: 6(float) Load 12(h0)
|
||||
53: 6(float) FAdd 51 52
|
||||
54: 7(fvec4) CompositeConstruct 53 53 53 53
|
||||
ReturnValue 54
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue