HLSL: Fix #1018: Give an error for mismatched return type.
This commit is contained in:
parent
b207daa5d3
commit
778806a692
@ -11,10 +11,13 @@ gl_FragCoord origin is upper left
|
|||||||
0:9 'input' ( in 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
0:9 'input' ( in 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:9 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
0:9 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:11 Branch: Return with expression
|
0:11 Branch: Return with expression
|
||||||
|
0:11 pos: direct index for structure ( temp 4-component vector of float)
|
||||||
|
0:11 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
|
||||||
|
0:11 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:11 Constant:
|
0:11 Constant:
|
||||||
0:11 1.000000
|
0:11 1 (const int)
|
||||||
0:11 1.000000
|
0:11 Constant:
|
||||||
0:11 1.000000
|
0:11 1 (const int)
|
||||||
0:7 Function Definition: main( ( temp void)
|
0:7 Function Definition: main( ( temp void)
|
||||||
0:7 Function Parameters:
|
0:7 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
@ -114,10 +117,13 @@ gl_FragCoord origin is upper left
|
|||||||
0:9 'input' ( in 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
0:9 'input' ( in 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:9 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
0:9 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:11 Branch: Return with expression
|
0:11 Branch: Return with expression
|
||||||
|
0:11 pos: direct index for structure ( temp 4-component vector of float)
|
||||||
|
0:11 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
|
||||||
|
0:11 'a' ( temp 3-element array of structure{ temp float f, temp 4-component vector of float pos})
|
||||||
0:11 Constant:
|
0:11 Constant:
|
||||||
0:11 1.000000
|
0:11 1 (const int)
|
||||||
0:11 1.000000
|
0:11 Constant:
|
||||||
0:11 1.000000
|
0:11 1 (const int)
|
||||||
0:7 Function Definition: main( ( temp void)
|
0:7 Function Definition: main( ( temp void)
|
||||||
0:7 Function Parameters:
|
0:7 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
@ -203,12 +209,12 @@ gl_FragCoord origin is upper left
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 69
|
// Id's are bound by 66
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 32 37 44 49 56 63
|
EntryPoint Fragment 4 "main" 30 35 41 46 53 60
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source HLSL 500
|
Source HLSL 500
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
@ -219,23 +225,23 @@ gl_FragCoord origin is upper left
|
|||||||
Name 16 "i"
|
Name 16 "i"
|
||||||
Name 17 "input"
|
Name 17 "input"
|
||||||
Name 20 "a"
|
Name 20 "a"
|
||||||
|
Name 28 "i"
|
||||||
Name 30 "i"
|
Name 30 "i"
|
||||||
Name 32 "i"
|
Name 32 "input"
|
||||||
Name 34 "input"
|
Name 35 "input[0].f"
|
||||||
Name 37 "input[0].f"
|
Name 41 "input.pos"
|
||||||
Name 44 "input.pos"
|
Name 46 "input[1].f"
|
||||||
Name 49 "input[1].f"
|
Name 53 "input[2].f"
|
||||||
Name 56 "input[2].f"
|
Name 60 "@entryPointOutput"
|
||||||
Name 63 "@entryPointOutput"
|
Name 61 "param"
|
||||||
Name 64 "param"
|
Name 63 "param"
|
||||||
Name 66 "param"
|
Decorate 30(i) Flat
|
||||||
Decorate 32(i) Flat
|
Decorate 30(i) Location 0
|
||||||
Decorate 32(i) Location 0
|
Decorate 35(input[0].f) Location 1
|
||||||
Decorate 37(input[0].f) Location 1
|
Decorate 41(input.pos) BuiltIn FragCoord
|
||||||
Decorate 44(input.pos) BuiltIn FragCoord
|
Decorate 46(input[1].f) Location 2
|
||||||
Decorate 49(input[1].f) Location 2
|
Decorate 53(input[2].f) Location 3
|
||||||
Decorate 56(input[2].f) Location 3
|
Decorate 60(@entryPointOutput) Location 0
|
||||||
Decorate 63(@entryPointOutput) Location 0
|
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeInt 32 1
|
6: TypeInt 32 1
|
||||||
@ -248,61 +254,58 @@ gl_FragCoord origin is upper left
|
|||||||
13: TypeArray 10(S) 12
|
13: TypeArray 10(S) 12
|
||||||
14: TypePointer Function 13
|
14: TypePointer Function 13
|
||||||
15: TypeFunction 9(fvec4) 7(ptr) 14(ptr)
|
15: TypeFunction 9(fvec4) 7(ptr) 14(ptr)
|
||||||
22: TypeVector 8(float) 3
|
22: 6(int) Constant 1
|
||||||
23: 8(float) Constant 1065353216
|
23: TypePointer Function 9(fvec4)
|
||||||
24: 22(fvec3) ConstantComposite 23 23 23
|
29: TypePointer Input 6(int)
|
||||||
25: TypePointer Function 9(fvec4)
|
30(i): 29(ptr) Variable Input
|
||||||
31: TypePointer Input 6(int)
|
33: 6(int) Constant 0
|
||||||
32(i): 31(ptr) Variable Input
|
34: TypePointer Input 8(float)
|
||||||
35: 6(int) Constant 0
|
35(input[0].f): 34(ptr) Variable Input
|
||||||
36: TypePointer Input 8(float)
|
37: TypePointer Function 8(float)
|
||||||
37(input[0].f): 36(ptr) Variable Input
|
39: TypeArray 9(fvec4) 12
|
||||||
39: TypePointer Function 8(float)
|
40: TypePointer Input 39
|
||||||
41: 6(int) Constant 1
|
41(input.pos): 40(ptr) Variable Input
|
||||||
42: TypeArray 9(fvec4) 12
|
42: TypePointer Input 9(fvec4)
|
||||||
43: TypePointer Input 42
|
46(input[1].f): 34(ptr) Variable Input
|
||||||
44(input.pos): 43(ptr) Variable Input
|
52: 6(int) Constant 2
|
||||||
45: TypePointer Input 9(fvec4)
|
53(input[2].f): 34(ptr) Variable Input
|
||||||
49(input[1].f): 36(ptr) Variable Input
|
59: TypePointer Output 9(fvec4)
|
||||||
55: 6(int) Constant 2
|
60(@entryPointOutput): 59(ptr) Variable Output
|
||||||
56(input[2].f): 36(ptr) Variable Input
|
|
||||||
62: TypePointer Output 9(fvec4)
|
|
||||||
63(@entryPointOutput): 62(ptr) Variable Output
|
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
30(i): 7(ptr) Variable Function
|
28(i): 7(ptr) Variable Function
|
||||||
34(input): 14(ptr) Variable Function
|
32(input): 14(ptr) Variable Function
|
||||||
64(param): 7(ptr) Variable Function
|
61(param): 7(ptr) Variable Function
|
||||||
66(param): 14(ptr) Variable Function
|
63(param): 14(ptr) Variable Function
|
||||||
33: 6(int) Load 32(i)
|
31: 6(int) Load 30(i)
|
||||||
Store 30(i) 33
|
Store 28(i) 31
|
||||||
38: 8(float) Load 37(input[0].f)
|
36: 8(float) Load 35(input[0].f)
|
||||||
40: 39(ptr) AccessChain 34(input) 35 35
|
38: 37(ptr) AccessChain 32(input) 33 33
|
||||||
Store 40 38
|
Store 38 36
|
||||||
46: 45(ptr) AccessChain 44(input.pos) 35
|
43: 42(ptr) AccessChain 41(input.pos) 33
|
||||||
47: 9(fvec4) Load 46
|
44: 9(fvec4) Load 43
|
||||||
48: 25(ptr) AccessChain 34(input) 35 41
|
45: 23(ptr) AccessChain 32(input) 33 22
|
||||||
|
Store 45 44
|
||||||
|
47: 8(float) Load 46(input[1].f)
|
||||||
|
48: 37(ptr) AccessChain 32(input) 22 33
|
||||||
Store 48 47
|
Store 48 47
|
||||||
50: 8(float) Load 49(input[1].f)
|
49: 42(ptr) AccessChain 41(input.pos) 22
|
||||||
51: 39(ptr) AccessChain 34(input) 41 35
|
50: 9(fvec4) Load 49
|
||||||
|
51: 23(ptr) AccessChain 32(input) 22 22
|
||||||
Store 51 50
|
Store 51 50
|
||||||
52: 45(ptr) AccessChain 44(input.pos) 41
|
54: 8(float) Load 53(input[2].f)
|
||||||
53: 9(fvec4) Load 52
|
55: 37(ptr) AccessChain 32(input) 52 33
|
||||||
54: 25(ptr) AccessChain 34(input) 41 41
|
Store 55 54
|
||||||
Store 54 53
|
56: 42(ptr) AccessChain 41(input.pos) 52
|
||||||
57: 8(float) Load 56(input[2].f)
|
57: 9(fvec4) Load 56
|
||||||
58: 39(ptr) AccessChain 34(input) 55 35
|
58: 23(ptr) AccessChain 32(input) 52 22
|
||||||
Store 58 57
|
Store 58 57
|
||||||
59: 45(ptr) AccessChain 44(input.pos) 55
|
62: 6(int) Load 28(i)
|
||||||
60: 9(fvec4) Load 59
|
Store 61(param) 62
|
||||||
61: 25(ptr) AccessChain 34(input) 55 41
|
64: 13 Load 32(input)
|
||||||
Store 61 60
|
Store 63(param) 64
|
||||||
65: 6(int) Load 30(i)
|
65: 9(fvec4) FunctionCall 18(@main(i1;struct-S-f1-vf41[3];) 61(param) 63(param)
|
||||||
Store 64(param) 65
|
Store 60(@entryPointOutput) 65
|
||||||
67: 13 Load 34(input)
|
|
||||||
Store 66(param) 67
|
|
||||||
68: 9(fvec4) FunctionCall 18(@main(i1;struct-S-f1-vf41[3];) 64(param) 66(param)
|
|
||||||
Store 63(@entryPointOutput) 68
|
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
18(@main(i1;struct-S-f1-vf41[3];): 9(fvec4) Function None 15
|
18(@main(i1;struct-S-f1-vf41[3];): 9(fvec4) Function None 15
|
||||||
@ -310,10 +313,9 @@ gl_FragCoord origin is upper left
|
|||||||
17(input): 14(ptr) FunctionParameter
|
17(input): 14(ptr) FunctionParameter
|
||||||
19: Label
|
19: Label
|
||||||
20(a): 14(ptr) Variable Function
|
20(a): 14(ptr) Variable Function
|
||||||
26: 25(ptr) Variable Function
|
|
||||||
21: 13 Load 20(a)
|
21: 13 Load 20(a)
|
||||||
Store 17(input) 21
|
Store 17(input) 21
|
||||||
Store 26 24
|
24: 23(ptr) AccessChain 20(a) 22 22
|
||||||
27: 9(fvec4) Load 26
|
25: 9(fvec4) Load 24
|
||||||
ReturnValue 27
|
ReturnValue 25
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -8,5 +8,5 @@ float4 main(int i, S input[3]) : COLOR0
|
|||||||
S a[3];
|
S a[3];
|
||||||
input = a;
|
input = a;
|
||||||
|
|
||||||
return float3(1.0);
|
return a[1].pos;
|
||||||
}
|
}
|
||||||
|
@ -2239,7 +2239,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
|
|||||||
value = intermediate.addConversion(EOpReturn, *currentFunctionType, value);
|
value = intermediate.addConversion(EOpReturn, *currentFunctionType, value);
|
||||||
if (value && *currentFunctionType != value->getType())
|
if (value && *currentFunctionType != value->getType())
|
||||||
value = intermediate.addUniShapeConversion(EOpReturn, *currentFunctionType, value);
|
value = intermediate.addUniShapeConversion(EOpReturn, *currentFunctionType, value);
|
||||||
if (value == nullptr) {
|
if (value == nullptr || *currentFunctionType != value->getType()) {
|
||||||
error(loc, "type does not match, or is not convertible to, the function's return type", "return", "");
|
error(loc, "type does not match, or is not convertible to, the function's return type", "return", "");
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user