From 304765681b4cc16f8c742c1d3e8ae0c0b7d2fce2 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 31 Jan 2018 08:23:01 -0700 Subject: [PATCH] AST: dump attributes along with control flow. --- Test/baseResults/460.frag.out | 6 ++--- .../baseResults/hlsl.attribute.expression.comp.out | 4 ++-- Test/baseResults/hlsl.attribute.frag.out | 4 ++-- Test/baseResults/hlsl.doLoop.frag.out | 8 +++---- Test/baseResults/hlsl.forLoop.frag.out | 4 ++-- Test/baseResults/hlsl.if.frag.out | 4 ++-- Test/baseResults/hlsl.loopattr.frag.out | 8 +++---- Test/baseResults/hlsl.switch.frag.out | 4 ++-- Test/baseResults/hlsl.whileLoop.frag.out | 4 ++-- glslang/MachineIndependent/intermOut.cpp | 28 +++++++++++++++++++--- 10 files changed, 48 insertions(+), 26 deletions(-) diff --git a/Test/baseResults/460.frag.out b/Test/baseResults/460.frag.out index b80c6f2..90c4837 100755 --- a/Test/baseResults/460.frag.out +++ b/Test/baseResults/460.frag.out @@ -38,7 +38,7 @@ ERROR: node is still EOpNull! 0:22 'i' ( temp int) 0:22 Constant: 0:22 0 (const int) -0:22 Loop with condition tested first +0:22 Loop with condition tested first: Dependency 4 0:22 Loop Condition 0:22 Compare Less Than ( temp bool) 0:22 'i' ( temp int) @@ -48,7 +48,7 @@ ERROR: node is still EOpNull! 0:22 Loop Terminal Expression 0:22 Pre-Increment ( temp int) 0:22 'i' ( temp int) -0:23 Test condition and select ( temp void) +0:23 Test condition and select ( temp void): Flatten 0:23 Condition 0:23 Constant: 0:23 true (const bool) @@ -56,7 +56,7 @@ ERROR: node is still EOpNull! 0:28 Function Definition: attExt( ( global void) 0:28 Function Parameters: 0:30 Sequence -0:30 Loop with condition not tested first +0:30 Loop with condition not tested first: Dependency -3 0:30 Loop Condition 0:30 Constant: 0:30 true (const bool) diff --git a/Test/baseResults/hlsl.attribute.expression.comp.out b/Test/baseResults/hlsl.attribute.expression.comp.out index 53a8dcb..8084f90 100644 --- a/Test/baseResults/hlsl.attribute.expression.comp.out +++ b/Test/baseResults/hlsl.attribute.expression.comp.out @@ -10,7 +10,7 @@ local_size = (4, 6, 8) 0:11 'x' ( temp int) 0:11 Constant: 0:11 0 (const int) -0:11 Loop with condition tested first +0:11 Loop with condition tested first: Unroll 0:11 Loop Condition 0:11 Compare Less Than ( temp bool) 0:11 'x' ( temp int) @@ -53,7 +53,7 @@ local_size = (4, 6, 8) 0:11 'x' ( temp int) 0:11 Constant: 0:11 0 (const int) -0:11 Loop with condition tested first +0:11 Loop with condition tested first: Unroll 0:11 Loop Condition 0:11 Compare Less Than ( temp bool) 0:11 'x' ( temp int) diff --git a/Test/baseResults/hlsl.attribute.frag.out b/Test/baseResults/hlsl.attribute.frag.out index ce5203b..619da20 100755 --- a/Test/baseResults/hlsl.attribute.frag.out +++ b/Test/baseResults/hlsl.attribute.frag.out @@ -6,7 +6,7 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) 0:? Sequence -0:11 Test condition and select ( temp void) +0:11 Test condition and select ( temp void): DontFlatten 0:11 Condition 0:11 Constant: 0:11 false (const bool) @@ -33,7 +33,7 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) 0:? Sequence -0:11 Test condition and select ( temp void) +0:11 Test condition and select ( temp void): DontFlatten 0:11 Condition 0:11 Constant: 0:11 false (const bool) diff --git a/Test/baseResults/hlsl.doLoop.frag.out b/Test/baseResults/hlsl.doLoop.frag.out index eb663ce..ce2ad42 100755 --- a/Test/baseResults/hlsl.doLoop.frag.out +++ b/Test/baseResults/hlsl.doLoop.frag.out @@ -6,12 +6,12 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in float) 0:? Sequence -0:3 Loop with condition not tested first +0:3 Loop with condition not tested first: Unroll 0:3 Loop Condition 0:3 Constant: 0:3 false (const bool) 0:3 No loop body -0:4 Loop with condition not tested first +0:4 Loop with condition not tested first: Unroll 0:4 Loop Condition 0:4 Constant: 0:4 false (const bool) @@ -80,12 +80,12 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in float) 0:? Sequence -0:3 Loop with condition not tested first +0:3 Loop with condition not tested first: Unroll 0:3 Loop Condition 0:3 Constant: 0:3 false (const bool) 0:3 No loop body -0:4 Loop with condition not tested first +0:4 Loop with condition not tested first: Unroll 0:4 Loop Condition 0:4 Constant: 0:4 false (const bool) diff --git a/Test/baseResults/hlsl.forLoop.frag.out b/Test/baseResults/hlsl.forLoop.frag.out index 77e78fe..f945f98 100755 --- a/Test/baseResults/hlsl.forLoop.frag.out +++ b/Test/baseResults/hlsl.forLoop.frag.out @@ -17,7 +17,7 @@ gl_FragCoord origin is upper left 0:4 No loop condition 0:4 No loop body 0:? Sequence -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 any ( temp bool) 0:5 NotEqual ( temp 4-component vector of bool) @@ -220,7 +220,7 @@ gl_FragCoord origin is upper left 0:4 No loop condition 0:4 No loop body 0:? Sequence -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 any ( temp bool) 0:5 NotEqual ( temp 4-component vector of bool) diff --git a/Test/baseResults/hlsl.if.frag.out b/Test/baseResults/hlsl.if.frag.out index 32dcb30..750ae5e 100755 --- a/Test/baseResults/hlsl.if.frag.out +++ b/Test/baseResults/hlsl.if.frag.out @@ -42,7 +42,7 @@ gl_FragCoord origin is upper left 0:14 'input' ( in 4-component vector of float) 0:14 'input' ( in 4-component vector of float) 0:14 true case is null -0:19 Test condition and select ( temp void) +0:19 Test condition and select ( temp void): Flatten 0:19 Condition 0:19 all ( temp bool) 0:19 Equal ( temp 4-component vector of bool) @@ -152,7 +152,7 @@ gl_FragCoord origin is upper left 0:14 'input' ( in 4-component vector of float) 0:14 'input' ( in 4-component vector of float) 0:14 true case is null -0:19 Test condition and select ( temp void) +0:19 Test condition and select ( temp void): Flatten 0:19 Condition 0:19 all ( temp bool) 0:19 Equal ( temp 4-component vector of bool) diff --git a/Test/baseResults/hlsl.loopattr.frag.out b/Test/baseResults/hlsl.loopattr.frag.out index f7f6451..271199c 100644 --- a/Test/baseResults/hlsl.loopattr.frag.out +++ b/Test/baseResults/hlsl.loopattr.frag.out @@ -10,7 +10,7 @@ gl_FragCoord origin is upper left 0:5 'x' ( temp int) 0:5 Constant: 0:5 0 (const int) -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Compare Less Than ( temp bool) 0:5 'x' ( temp int) @@ -25,7 +25,7 @@ gl_FragCoord origin is upper left 0:8 'y' ( temp int) 0:8 Constant: 0:8 0 (const int) -0:8 Loop with condition tested first +0:8 Loop with condition tested first: DontUnroll 0:8 Loop Condition 0:8 Compare Less Than ( temp bool) 0:8 'y' ( temp int) @@ -80,7 +80,7 @@ gl_FragCoord origin is upper left 0:5 'x' ( temp int) 0:5 Constant: 0:5 0 (const int) -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Compare Less Than ( temp bool) 0:5 'x' ( temp int) @@ -95,7 +95,7 @@ gl_FragCoord origin is upper left 0:8 'y' ( temp int) 0:8 Constant: 0:8 0 (const int) -0:8 Loop with condition tested first +0:8 Loop with condition tested first: DontUnroll 0:8 Loop Condition 0:8 Compare Less Than ( temp bool) 0:8 'y' ( temp int) diff --git a/Test/baseResults/hlsl.switch.frag.out b/Test/baseResults/hlsl.switch.frag.out index b440d4e..364c0e0 100755 --- a/Test/baseResults/hlsl.switch.frag.out +++ b/Test/baseResults/hlsl.switch.frag.out @@ -36,7 +36,7 @@ gl_FragCoord origin is upper left 0:17 Pre-Decrement ( temp 4-component vector of float) 0:17 'input' ( in 4-component vector of float) 0:18 Branch: Break -0:21 switch +0:21 switch: DontFlatten 0:21 condition 0:21 'c' ( in int) 0:21 body @@ -186,7 +186,7 @@ gl_FragCoord origin is upper left 0:17 Pre-Decrement ( temp 4-component vector of float) 0:17 'input' ( in 4-component vector of float) 0:18 Branch: Break -0:21 switch +0:21 switch: DontFlatten 0:21 condition 0:21 'c' ( in int) 0:21 body diff --git a/Test/baseResults/hlsl.whileLoop.frag.out b/Test/baseResults/hlsl.whileLoop.frag.out index e4fc0d4..b8fe5e9 100755 --- a/Test/baseResults/hlsl.whileLoop.frag.out +++ b/Test/baseResults/hlsl.whileLoop.frag.out @@ -21,7 +21,7 @@ gl_FragCoord origin is upper left 0:4 Constant: 0:4 false (const bool) 0:4 No loop body -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Constant: 0:5 false (const bool) @@ -71,7 +71,7 @@ gl_FragCoord origin is upper left 0:4 Constant: 0:4 false (const bool) 0:4 No loop body -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Constant: 0:5 false (const bool) diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index dd2cdc8..4c01284 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -817,7 +817,13 @@ bool TOutputTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node OutputTreeText(out, node, depth); out.debug << "Test condition and select"; - out.debug << " (" << node->getCompleteString() << ")\n"; + out.debug << " (" << node->getCompleteString() << ")"; + + if (node->getFlatten()) + out.debug << ": Flatten"; + if (node->getDontFlatten()) + out.debug << ": DontFlatten"; + out.debug << "\n"; ++depth; @@ -979,7 +985,17 @@ bool TOutputTraverser::visitLoop(TVisit /* visit */, TIntermLoop* node) out.debug << "Loop with condition "; if (! node->testFirst()) out.debug << "not "; - out.debug << "tested first\n"; + out.debug << "tested first"; + + if (node->getUnroll()) + out.debug << ": Unroll"; + if (node->getDontUnroll()) + out.debug << ": DontUnroll"; + if (node->getLoopDependency()) { + out.debug << ": Dependency "; + out.debug << node->getLoopDependency(); + } + out.debug << "\n"; ++depth; @@ -1040,7 +1056,13 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node) TInfoSink& out = infoSink; OutputTreeText(out, node, depth); - out.debug << "switch\n"; + out.debug << "switch"; + + if (node->getFlatten()) + out.debug << ": Flatten"; + if (node->getDontFlatten()) + out.debug << ": DontFlatten"; + out.debug << "\n"; OutputTreeText(out, node, depth); out.debug << "condition\n"; -- 2.7.4