mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
HLSL: Fix #884: Use promoted children, not pre-promoted, in completing binary nodes.
This commit is contained in:
parent
c48c8e76e1
commit
c49b4efa91
@ -71,6 +71,50 @@ gl_FragCoord origin is upper left
|
||||
0:14 0.000000
|
||||
0:14 0.000000
|
||||
0:14 0.000000
|
||||
0:15 Test condition and select ( temp void)
|
||||
0:15 Condition
|
||||
0:15 Constant:
|
||||
0:15 true (const bool)
|
||||
0:15 true case
|
||||
0:16 Branch: Return with expression
|
||||
0:16 Constant:
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:17 Test condition and select ( temp void)
|
||||
0:17 Condition
|
||||
0:17 Constant:
|
||||
0:17 false (const bool)
|
||||
0:17 true case
|
||||
0:18 Branch: Return with expression
|
||||
0:18 Constant:
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:19 Test condition and select ( temp void)
|
||||
0:19 Condition
|
||||
0:19 Constant:
|
||||
0:19 true (const bool)
|
||||
0:19 true case
|
||||
0:20 Branch: Return with expression
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:21 Test condition and select ( temp void)
|
||||
0:21 Condition
|
||||
0:21 Constant:
|
||||
0:21 true (const bool)
|
||||
0:21 true case
|
||||
0:22 Branch: Return with expression
|
||||
0:22 Constant:
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:2 Function Definition: main( ( temp void)
|
||||
0:2 Function Parameters:
|
||||
0:? Sequence
|
||||
@ -156,6 +200,50 @@ gl_FragCoord origin is upper left
|
||||
0:14 0.000000
|
||||
0:14 0.000000
|
||||
0:14 0.000000
|
||||
0:15 Test condition and select ( temp void)
|
||||
0:15 Condition
|
||||
0:15 Constant:
|
||||
0:15 true (const bool)
|
||||
0:15 true case
|
||||
0:16 Branch: Return with expression
|
||||
0:16 Constant:
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:16 0.000000
|
||||
0:17 Test condition and select ( temp void)
|
||||
0:17 Condition
|
||||
0:17 Constant:
|
||||
0:17 false (const bool)
|
||||
0:17 true case
|
||||
0:18 Branch: Return with expression
|
||||
0:18 Constant:
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:18 0.000000
|
||||
0:19 Test condition and select ( temp void)
|
||||
0:19 Condition
|
||||
0:19 Constant:
|
||||
0:19 true (const bool)
|
||||
0:19 true case
|
||||
0:20 Branch: Return with expression
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:20 0.000000
|
||||
0:21 Test condition and select ( temp void)
|
||||
0:21 Condition
|
||||
0:21 Constant:
|
||||
0:21 true (const bool)
|
||||
0:21 true case
|
||||
0:22 Branch: Return with expression
|
||||
0:22 Constant:
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:22 0.000000
|
||||
0:2 Function Definition: main( ( temp void)
|
||||
0:2 Function Parameters:
|
||||
0:? Sequence
|
||||
@ -167,18 +255,18 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 38
|
||||
// Id's are bound by 50
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 36
|
||||
EntryPoint Fragment 4 "main" 48
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 9 "@main("
|
||||
Name 36 "@entryPointOutput"
|
||||
Decorate 36(@entryPointOutput) Location 0
|
||||
Name 48 "@entryPointOutput"
|
||||
Decorate 48(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -189,12 +277,12 @@ gl_FragCoord origin is upper left
|
||||
15: 6(float) Constant 0
|
||||
16: 7(fvec4) ConstantComposite 15 15 15 15
|
||||
21: 11(bool) ConstantTrue
|
||||
35: TypePointer Output 7(fvec4)
|
||||
36(@entryPointOutput): 35(ptr) Variable Output
|
||||
47: TypePointer Output 7(fvec4)
|
||||
48(@entryPointOutput): 47(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
37: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 36(@entryPointOutput) 37
|
||||
49: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 48(@entryPointOutput) 49
|
||||
Return
|
||||
FunctionEnd
|
||||
9(@main(): 7(fvec4) Function None 8
|
||||
@ -229,6 +317,26 @@ gl_FragCoord origin is upper left
|
||||
31: Label
|
||||
ReturnValue 16
|
||||
32: Label
|
||||
34: 7(fvec4) Undef
|
||||
ReturnValue 34
|
||||
SelectionMerge 35 None
|
||||
BranchConditional 21 34 35
|
||||
34: Label
|
||||
ReturnValue 16
|
||||
35: Label
|
||||
SelectionMerge 38 None
|
||||
BranchConditional 12 37 38
|
||||
37: Label
|
||||
ReturnValue 16
|
||||
38: Label
|
||||
SelectionMerge 41 None
|
||||
BranchConditional 21 40 41
|
||||
40: Label
|
||||
ReturnValue 16
|
||||
41: Label
|
||||
SelectionMerge 44 None
|
||||
BranchConditional 21 43 44
|
||||
43: Label
|
||||
ReturnValue 16
|
||||
44: Label
|
||||
46: 7(fvec4) Undef
|
||||
ReturnValue 46
|
||||
FunctionEnd
|
||||
|
@ -12,4 +12,12 @@ float4 main() : SV_TARGET
|
||||
return 0.0.xxxx;
|
||||
if (!1)
|
||||
return 0.0.xxxx;
|
||||
if (0 || 1)
|
||||
return 0.0.xxxx;
|
||||
if (1 && 0)
|
||||
return 0.0.xxxx;
|
||||
if (1 || false)
|
||||
return 0.0.xxxx;
|
||||
if (true && 1)
|
||||
return 0.0.xxxx;
|
||||
}
|
@ -148,8 +148,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||
// If they are both (non-specialization) constants, they must be folded.
|
||||
// (Unless it's the sequence (comma) operator, but that's handled in addComma().)
|
||||
//
|
||||
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
|
||||
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
|
||||
TIntermConstantUnion *leftTempConstant = node->getLeft()->getAsConstantUnion();
|
||||
TIntermConstantUnion *rightTempConstant = node->getRight()->getAsConstantUnion();
|
||||
if (leftTempConstant && rightTempConstant) {
|
||||
TIntermTyped* folded = leftTempConstant->fold(node->getOp(), rightTempConstant);
|
||||
if (folded)
|
||||
@ -158,7 +158,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||
|
||||
// If can propagate spec-constantness and if the operation is an allowed
|
||||
// specialization-constant operation, make a spec-constant.
|
||||
if (specConstantPropagates(*left, *right) && isSpecializationOperation(*node))
|
||||
if (specConstantPropagates(*node->getLeft(), *node->getRight()) && isSpecializationOperation(*node))
|
||||
node->getWritableType().getQualifier().makeSpecConstant();
|
||||
|
||||
return node;
|
||||
|
Loading…
Reference in New Issue
Block a user