Commit 31ab84a5 by John Kessenich

Merge branch 'dneto0-dead-code'

parents 7f77b2e8 10973789
...@@ -1630,11 +1630,11 @@ void TGlslangToSpvTraverser::finishSpv() ...@@ -1630,11 +1630,11 @@ void TGlslangToSpvTraverser::finishSpv()
for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it) for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it)
entryPoint->addIdOperand(*it); entryPoint->addIdOperand(*it);
#ifndef GLSLANG_WEB
// Add capabilities, extensions, remove unneeded decorations, etc., // Add capabilities, extensions, remove unneeded decorations, etc.,
// based on the resulting SPIR-V. // based on the resulting SPIR-V.
// Note: WebGPU code generation must have the opportunity to aggressively
// prune unreachable merge blocks and continue targets.
builder.postProcess(); builder.postProcess();
#endif
} }
// Write the SPV into 'out'. // Write the SPV into 'out'.
......
...@@ -61,17 +61,22 @@ namespace { ...@@ -61,17 +61,22 @@ namespace {
// Use by calling visit() on the root block. // Use by calling visit() on the root block.
class ReadableOrderTraverser { class ReadableOrderTraverser {
public: public:
explicit ReadableOrderTraverser(std::function<void(Block*)> callback) : callback_(callback) {} ReadableOrderTraverser(std::function<void(Block*, spv::ReachReason, Block*)> callback)
: callback_(callback) {}
// Visits the block if it hasn't been visited already and isn't currently // Visits the block if it hasn't been visited already and isn't currently
// being delayed. Invokes callback(block), then descends into its // being delayed. Invokes callback(block, why, header), then descends into its
// successors. Delays merge-block and continue-block processing until all // successors. Delays merge-block and continue-block processing until all
// the branches have been completed. // the branches have been completed. If |block| is an unreachable merge block or
void visit(Block* block) // an unreachable continue target, then |header| is the corresponding header block.
void visit(Block* block, spv::ReachReason why, Block* header)
{ {
assert(block); assert(block);
if (why == spv::ReachViaControlFlow) {
reachableViaControlFlow_.insert(block);
}
if (visited_.count(block) || delayed_.count(block)) if (visited_.count(block) || delayed_.count(block))
return; return;
callback_(block); callback_(block, why, header);
visited_.insert(block); visited_.insert(block);
Block* mergeBlock = nullptr; Block* mergeBlock = nullptr;
Block* continueBlock = nullptr; Block* continueBlock = nullptr;
...@@ -87,27 +92,40 @@ public: ...@@ -87,27 +92,40 @@ public:
delayed_.insert(continueBlock); delayed_.insert(continueBlock);
} }
} }
const auto successors = block->getSuccessors(); if (why == spv::ReachViaControlFlow) {
const auto& successors = block->getSuccessors();
for (auto it = successors.cbegin(); it != successors.cend(); ++it) for (auto it = successors.cbegin(); it != successors.cend(); ++it)
visit(*it); visit(*it, why, nullptr);
}
if (continueBlock) { if (continueBlock) {
const spv::ReachReason continueWhy =
(reachableViaControlFlow_.count(continueBlock) > 0)
? spv::ReachViaControlFlow
: spv::ReachDeadContinue;
delayed_.erase(continueBlock); delayed_.erase(continueBlock);
visit(continueBlock); visit(continueBlock, continueWhy, block);
} }
if (mergeBlock) { if (mergeBlock) {
const spv::ReachReason mergeWhy =
(reachableViaControlFlow_.count(mergeBlock) > 0)
? spv::ReachViaControlFlow
: spv::ReachDeadMerge;
delayed_.erase(mergeBlock); delayed_.erase(mergeBlock);
visit(mergeBlock); visit(mergeBlock, mergeWhy, block);
} }
} }
private: private:
std::function<void(Block*)> callback_; std::function<void(Block*, spv::ReachReason, Block*)> callback_;
// Whether a block has already been visited or is being delayed. // Whether a block has already been visited or is being delayed.
std::unordered_set<Block *> visited_, delayed_; std::unordered_set<Block *> visited_, delayed_;
// The set of blocks that actually are reached via control flow.
std::unordered_set<Block *> reachableViaControlFlow_;
}; };
} }
void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) void spv::inReadableOrder(Block* root, std::function<void(Block*, spv::ReachReason, Block*)> callback)
{ {
ReadableOrderTraverser(callback).visit(root); ReadableOrderTraverser(callback).visit(root, spv::ReachViaControlFlow, nullptr);
} }
...@@ -689,8 +689,6 @@ public: ...@@ -689,8 +689,6 @@ public:
// Hook to visit each instruction in a block in a function // Hook to visit each instruction in a block in a function
void postProcess(Instruction&); void postProcess(Instruction&);
// Hook to visit each instruction in a reachable block in a function.
void postProcessReachable(const Instruction&);
// Hook to visit each non-32-bit sized float/int operation in a block. // Hook to visit each non-32-bit sized float/int operation in a block.
void postProcessType(const Instruction&, spv::Id typeId); void postProcessType(const Instruction&, spv::Id typeId);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <cassert> #include <cassert>
#include <cstdlib> #include <cstdlib>
#include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <algorithm> #include <algorithm>
...@@ -319,16 +320,14 @@ void Builder::postProcess(Instruction& inst) ...@@ -319,16 +320,14 @@ void Builder::postProcess(Instruction& inst)
} }
} }
// Called for each instruction in a reachable block.
void Builder::postProcessReachable(const Instruction&)
{
// did have code here, but questionable to do so without deleting the instructions
}
// comment in header // comment in header
void Builder::postProcess() void Builder::postProcess()
{ {
// reachableBlocks is the set of blockss reached via control flow, or which are
// unreachable continue targert or unreachable merge.
std::unordered_set<const Block*> reachableBlocks; std::unordered_set<const Block*> reachableBlocks;
std::unordered_map<Block*, Block*> headerForUnreachableContinue;
std::unordered_set<Block*> unreachableMerges;
std::unordered_set<Id> unreachableDefinitions; std::unordered_set<Id> unreachableDefinitions;
// Collect IDs defined in unreachable blocks. For each function, label the // Collect IDs defined in unreachable blocks. For each function, label the
// reachable blocks first. Then for each unreachable block, collect the // reachable blocks first. Then for each unreachable block, collect the
...@@ -336,16 +335,41 @@ void Builder::postProcess() ...@@ -336,16 +335,41 @@ void Builder::postProcess()
for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) {
Function* f = *fi; Function* f = *fi;
Block* entry = f->getEntryBlock(); Block* entry = f->getEntryBlock();
inReadableOrder(entry, [&reachableBlocks](const Block* b) { reachableBlocks.insert(b); }); inReadableOrder(entry,
[&reachableBlocks, &unreachableMerges, &headerForUnreachableContinue]
(Block* b, ReachReason why, Block* header) {
reachableBlocks.insert(b);
if (why == ReachDeadContinue) headerForUnreachableContinue[b] = header;
if (why == ReachDeadMerge) unreachableMerges.insert(b);
});
for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) {
Block* b = *bi; Block* b = *bi;
if (reachableBlocks.count(b) == 0) { if (unreachableMerges.count(b) != 0 || headerForUnreachableContinue.count(b) != 0) {
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) auto ii = b->getInstructions().cbegin();
++ii; // Keep potential decorations on the label.
for (; ii != b->getInstructions().cend(); ++ii)
unreachableDefinitions.insert(ii->get()->getResultId());
} else if (reachableBlocks.count(b) == 0) {
// The normal case for unreachable code. All definitions are considered dead.
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ++ii)
unreachableDefinitions.insert(ii->get()->getResultId()); unreachableDefinitions.insert(ii->get()->getResultId());
} }
} }
} }
// Modify unreachable merge blocks and unreachable continue targets.
// Delete their contents.
for (auto mergeIter = unreachableMerges.begin(); mergeIter != unreachableMerges.end(); ++mergeIter) {
(*mergeIter)->rewriteAsCanonicalUnreachableMerge();
}
for (auto continueIter = headerForUnreachableContinue.begin();
continueIter != headerForUnreachableContinue.end();
++continueIter) {
Block* continue_target = continueIter->first;
Block* header = continueIter->second;
continue_target->rewriteAsCanonicalUnreachableContinue(header);
}
// Remove unneeded decorations, for unreachable instructions // Remove unneeded decorations, for unreachable instructions
decorations.erase(std::remove_if(decorations.begin(), decorations.end(), decorations.erase(std::remove_if(decorations.begin(), decorations.end(),
[&unreachableDefinitions](std::unique_ptr<Instruction>& I) -> bool { [&unreachableDefinitions](std::unique_ptr<Instruction>& I) -> bool {
...@@ -374,13 +398,6 @@ void Builder::postProcess() ...@@ -374,13 +398,6 @@ void Builder::postProcess()
} }
} }
// process all reachable instructions...
for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) {
const Block* block = *bi;
const auto function = [this](const std::unique_ptr<Instruction>& inst) { postProcessReachable(*inst.get()); };
std::for_each(block->getInstructions().begin(), block->getInstructions().end(), function);
}
// process all block-contained instructions // process all block-contained instructions
for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) {
Function* f = *fi; Function* f = *fi;
......
...@@ -226,6 +226,36 @@ public: ...@@ -226,6 +226,36 @@ public:
return nullptr; return nullptr;
} }
// Change this block into a canonical dead merge block. Delete instructions
// as necessary. A canonical dead merge block has only an OpLabel and an
// OpUnreachable.
void rewriteAsCanonicalUnreachableMerge() {
assert(localVariables.empty());
// Delete all instructions except for the label.
assert(instructions.size() > 0);
instructions.resize(1);
successors.clear();
Instruction* unreachable = new Instruction(OpUnreachable);
addInstruction(std::unique_ptr<Instruction>(unreachable));
}
// Change this block into a canonical dead continue target branching to the
// given header ID. Delete instructions as necessary. A canonical dead continue
// target has only an OpLabel and an unconditional branch back to the corresponding
// header.
void rewriteAsCanonicalUnreachableContinue(Block* header) {
assert(localVariables.empty());
// Delete all instructions except for the label.
assert(instructions.size() > 0);
instructions.resize(1);
successors.clear();
// Add OpBranch back to the header.
assert(header != nullptr);
Instruction* branch = new Instruction(OpBranch);
branch->addIdOperand(header->getId());
addInstruction(std::move(std::unique_ptr<Instruction>(branch)));
successors.push_back(header);
}
bool isTerminated() const bool isTerminated() const
{ {
switch (instructions.back()->getOpCode()) { switch (instructions.back()->getOpCode()) {
...@@ -235,6 +265,7 @@ public: ...@@ -235,6 +265,7 @@ public:
case OpKill: case OpKill:
case OpReturn: case OpReturn:
case OpReturnValue: case OpReturnValue:
case OpUnreachable:
return true; return true;
default: default:
return false; return false;
...@@ -268,10 +299,24 @@ protected: ...@@ -268,10 +299,24 @@ protected:
bool unreachable; bool unreachable;
}; };
// The different reasons for reaching a block in the inReadableOrder traversal.
typedef enum ReachReason {
// Reachable from the entry block via transfers of control, i.e. branches.
ReachViaControlFlow = 0,
// A continue target that is not reachable via control flow.
ReachDeadContinue,
// A merge block that is not reachable via control flow.
ReachDeadMerge
};
// Traverses the control-flow graph rooted at root in an order suited for // Traverses the control-flow graph rooted at root in an order suited for
// readable code generation. Invokes callback at every node in the traversal // readable code generation. Invokes callback at every node in the traversal
// order. // order. The callback arguments are:
void inReadableOrder(Block* root, std::function<void(Block*)> callback); // - the block,
// - the reason we reached the block,
// - if the reason was that block is an unreachable continue or unreachable merge block
// then the last parameter is the corresponding header block.
void inReadableOrder(Block* root, std::function<void(Block*, ReachReason, Block* header)> callback);
// //
// SPIR-V IR Function. // SPIR-V IR Function.
...@@ -321,7 +366,7 @@ public: ...@@ -321,7 +366,7 @@ public:
parameterInstructions[p]->dump(out); parameterInstructions[p]->dump(out);
// Blocks // Blocks
inReadableOrder(blocks[0], [&out](const Block* b) { b->dump(out); }); inReadableOrder(blocks[0], [&out](const Block* b, ReachReason, Block*) { b->dump(out); });
Instruction end(0, 0, OpFunctionEnd); Instruction end(0, 0, OpFunctionEnd);
end.dump(out); end.dump(out);
} }
......
...@@ -240,6 +240,5 @@ Validation failed ...@@ -240,6 +240,5 @@ Validation failed
60: 7(fvec4) CompositeConstruct 59 59 59 59 60: 7(fvec4) CompositeConstruct 59 59 59 59
ReturnValue 60 ReturnValue 60
30: Label 30: Label
62: 7(fvec4) Undef Unreachable
ReturnValue 62
FunctionEnd FunctionEnd
...@@ -2,68 +2,95 @@ hlsl.doLoop.frag ...@@ -2,68 +2,95 @@ hlsl.doLoop.frag
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float) 0:1 Function Definition: f0( ( temp void)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in float)
0:? Sequence 0:? Sequence
0:3 Loop with condition not tested first: Unroll 0:2 Loop with condition not tested first: Unroll
0:3 Loop Condition 0:2 Loop Condition
0:3 Constant: 0:2 Constant:
0:3 false (const bool) 0:2 false (const bool)
0:3 No loop body 0:2 No loop body
0:4 Loop with condition not tested first: Unroll 0:5 Function Definition: f1( ( temp void)
0:4 Loop Condition 0:5 Function Parameters:
0:4 Constant:
0:4 false (const bool)
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 Compare Greater Than ( temp bool)
0:5 'input' ( in float)
0:5 Constant:
0:5 2.000000
0:5 Loop Body
0:? Sequence 0:? Sequence
0:5 Branch: Return with expression 0:6 Loop with condition not tested first: Unroll
0:5 Construct vec4 ( temp 4-component vector of float)
0:5 'input' ( in float)
0:6 Loop with condition not tested first
0:6 Loop Condition 0:6 Loop Condition
0:6 Compare Less Than ( temp bool)
0:6 'input' ( in float)
0:6 Constant: 0:6 Constant:
0:6 10.000000 0:6 false (const bool)
0:6 Loop Body 0:6 No loop body
0:6 Pre-Increment ( temp float) 0:9 Function Definition: f2(f1; ( temp float)
0:6 'input' ( in float) 0:9 Function Parameters:
0:7 Loop with condition not tested first 0:9 'input' ( in float)
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 Loop Body
0:7 Loop with condition tested first
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 No loop body
0:8 Branch: Return with expression
0:8 Construct vec4 ( temp 4-component vector of float)
0:8 'input' ( in float)
0:2 Function Definition: PixelShaderFunction( ( temp void)
0:2 Function Parameters:
0:? Sequence 0:? Sequence
0:2 move second child to first child ( temp float) 0:10 Loop with condition not tested first
0:10 Loop Condition
0:10 Compare Greater Than ( temp bool)
0:10 'input' ( in float)
0:10 Constant:
0:10 2.000000
0:10 Loop Body
0:? Sequence
0:10 Branch: Return with expression
0:10 Construct float ( temp float)
0:10 Construct vec4 ( temp 4-component vector of float)
0:10 'input' ( in float)
0:13 Function Definition: f3(f1; ( temp void)
0:13 Function Parameters:
0:13 'input' ( in float)
0:? Sequence
0:14 Loop with condition not tested first
0:14 Loop Condition
0:14 Compare Less Than ( temp bool)
0:14 'input' ( in float)
0:14 Constant:
0:14 10.000000
0:14 Loop Body
0:14 Pre-Increment ( temp float)
0:14 'input' ( in float)
0:17 Function Definition: f4(f1; ( temp void)
0:17 Function Parameters:
0:17 'input' ( in float)
0:? Sequence
0:18 Loop with condition not tested first
0:18 Loop Condition
0:18 Compare Less Than ( temp bool)
0:18 Pre-Increment ( temp float)
0:18 'input' ( in float)
0:18 Constant:
0:18 10.000000
0:18 Loop Body
0:18 Loop with condition tested first
0:18 Loop Condition
0:18 Compare Less Than ( temp bool)
0:18 Pre-Increment ( temp float)
0:18 'input' ( in float)
0:18 Constant:
0:18 10.000000
0:18 No loop body
0:22 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:22 Function Parameters:
0:22 'input' ( in float)
0:? Sequence
0:23 Function Call: f0( ( temp void)
0:24 Function Call: f1( ( temp void)
0:25 Function Call: f2(f1; ( temp float)
0:25 'input' ( in float)
0:26 Function Call: f3(f1; ( temp void)
0:26 'input' ( in float)
0:27 Function Call: f4(f1; ( temp void)
0:27 'input' ( in float)
0:28 Branch: Return with expression
0:28 Construct vec4 ( temp 4-component vector of float)
0:28 'input' ( in float)
0:22 Function Definition: PixelShaderFunction( ( temp void)
0:22 Function Parameters:
0:? Sequence
0:22 move second child to first child ( temp float)
0:? 'input' ( temp float) 0:? 'input' ( temp float)
0:? 'input' (layout( location=0) in float) 0:? 'input' (layout( location=0) in float)
0:2 move second child to first child ( temp 4-component vector of float) 0:22 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float) 0:22 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:? 'input' ( temp float) 0:? 'input' ( temp float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -76,68 +103,95 @@ Linked fragment stage: ...@@ -76,68 +103,95 @@ Linked fragment stage:
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float) 0:1 Function Definition: f0( ( temp void)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in float)
0:? Sequence 0:? Sequence
0:3 Loop with condition not tested first: Unroll 0:2 Loop with condition not tested first: Unroll
0:3 Loop Condition 0:2 Loop Condition
0:3 Constant: 0:2 Constant:
0:3 false (const bool) 0:2 false (const bool)
0:3 No loop body 0:2 No loop body
0:4 Loop with condition not tested first: Unroll 0:5 Function Definition: f1( ( temp void)
0:4 Loop Condition 0:5 Function Parameters:
0:4 Constant:
0:4 false (const bool)
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 Compare Greater Than ( temp bool)
0:5 'input' ( in float)
0:5 Constant:
0:5 2.000000
0:5 Loop Body
0:? Sequence 0:? Sequence
0:5 Branch: Return with expression 0:6 Loop with condition not tested first: Unroll
0:5 Construct vec4 ( temp 4-component vector of float)
0:5 'input' ( in float)
0:6 Loop with condition not tested first
0:6 Loop Condition 0:6 Loop Condition
0:6 Compare Less Than ( temp bool)
0:6 'input' ( in float)
0:6 Constant: 0:6 Constant:
0:6 10.000000 0:6 false (const bool)
0:6 Loop Body 0:6 No loop body
0:6 Pre-Increment ( temp float) 0:9 Function Definition: f2(f1; ( temp float)
0:6 'input' ( in float) 0:9 Function Parameters:
0:7 Loop with condition not tested first 0:9 'input' ( in float)
0:7 Loop Condition 0:? Sequence
0:7 Compare Less Than ( temp bool) 0:10 Loop with condition not tested first
0:7 Pre-Increment ( temp float) 0:10 Loop Condition
0:7 'input' ( in float) 0:10 Compare Greater Than ( temp bool)
0:7 Constant: 0:10 'input' ( in float)
0:7 10.000000 0:10 Constant:
0:7 Loop Body 0:10 2.000000
0:7 Loop with condition tested first 0:10 Loop Body
0:7 Loop Condition 0:? Sequence
0:7 Compare Less Than ( temp bool) 0:10 Branch: Return with expression
0:7 Pre-Increment ( temp float) 0:10 Construct float ( temp float)
0:7 'input' ( in float) 0:10 Construct vec4 ( temp 4-component vector of float)
0:7 Constant: 0:10 'input' ( in float)
0:7 10.000000 0:13 Function Definition: f3(f1; ( temp void)
0:7 No loop body 0:13 Function Parameters:
0:8 Branch: Return with expression 0:13 'input' ( in float)
0:8 Construct vec4 ( temp 4-component vector of float) 0:? Sequence
0:8 'input' ( in float) 0:14 Loop with condition not tested first
0:2 Function Definition: PixelShaderFunction( ( temp void) 0:14 Loop Condition
0:2 Function Parameters: 0:14 Compare Less Than ( temp bool)
0:14 'input' ( in float)
0:14 Constant:
0:14 10.000000
0:14 Loop Body
0:14 Pre-Increment ( temp float)
0:14 'input' ( in float)
0:17 Function Definition: f4(f1; ( temp void)
0:17 Function Parameters:
0:17 'input' ( in float)
0:? Sequence 0:? Sequence
0:2 move second child to first child ( temp float) 0:18 Loop with condition not tested first
0:18 Loop Condition
0:18 Compare Less Than ( temp bool)
0:18 Pre-Increment ( temp float)
0:18 'input' ( in float)
0:18 Constant:
0:18 10.000000
0:18 Loop Body
0:18 Loop with condition tested first
0:18 Loop Condition
0:18 Compare Less Than ( temp bool)
0:18 Pre-Increment ( temp float)
0:18 'input' ( in float)
0:18 Constant:
0:18 10.000000
0:18 No loop body
0:22 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:22 Function Parameters:
0:22 'input' ( in float)
0:? Sequence
0:23 Function Call: f0( ( temp void)
0:24 Function Call: f1( ( temp void)
0:25 Function Call: f2(f1; ( temp float)
0:25 'input' ( in float)
0:26 Function Call: f3(f1; ( temp void)
0:26 'input' ( in float)
0:27 Function Call: f4(f1; ( temp void)
0:27 'input' ( in float)
0:28 Branch: Return with expression
0:28 Construct vec4 ( temp 4-component vector of float)
0:28 'input' ( in float)
0:22 Function Definition: PixelShaderFunction( ( temp void)
0:22 Function Parameters:
0:? Sequence
0:22 move second child to first child ( temp float)
0:? 'input' ( temp float) 0:? 'input' ( temp float)
0:? 'input' (layout( location=0) in float) 0:? 'input' (layout( location=0) in float)
0:2 move second child to first child ( temp 4-component vector of float) 0:22 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float) 0:22 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:? 'input' ( temp float) 0:? 'input' ( temp float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -145,127 +199,176 @@ gl_FragCoord origin is upper left ...@@ -145,127 +199,176 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 71 // Id's are bound by 99
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 64 67 EntryPoint Fragment 4 "PixelShaderFunction" 92 95
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "@PixelShaderFunction(f1;" Name 6 "f0("
Name 10 "input" Name 8 "f1("
Name 62 "input" Name 14 "f2(f1;"
Name 64 "input" Name 13 "input"
Name 67 "@entryPointOutput" Name 18 "f3(f1;"
Name 68 "param" Name 17 "input"
Decorate 64(input) Location 0 Name 21 "f4(f1;"
Decorate 67(@entryPointOutput) Location 0 Name 20 "input"
Name 26 "@PixelShaderFunction(f1;"
Name 25 "input"
Name 77 "param"
Name 80 "param"
Name 83 "param"
Name 90 "input"
Name 92 "input"
Name 95 "@entryPointOutput"
Name 96 "param"
Decorate 92(input) Location 0
Decorate 95(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 10: TypeFloat 32
7: TypePointer Function 6(float) 11: TypePointer Function 10(float)
8: TypeVector 6(float) 4 12: TypeFunction 10(float) 11(ptr)
9: TypeFunction 8(fvec4) 7(ptr) 16: TypeFunction 2 11(ptr)
17: TypeBool 23: TypeVector 10(float) 4
18: 17(bool) ConstantFalse 24: TypeFunction 23(fvec4) 11(ptr)
31: 6(float) Constant 1073741824 32: TypeBool
38: 6(float) Constant 1065353216 33: 32(bool) ConstantFalse
41: 6(float) Constant 1092616192 47: 10(float) Constant 1073741824
63: TypePointer Input 6(float) 55: 10(float) Constant 1065353216
64(input): 63(ptr) Variable Input 58: 10(float) Constant 1092616192
66: TypePointer Output 8(fvec4) 91: TypePointer Input 10(float)
67(@entryPointOutput): 66(ptr) Variable Output 92(input): 91(ptr) Variable Input
94: TypePointer Output 23(fvec4)
95(@entryPointOutput): 94(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
62(input): 7(ptr) Variable Function 90(input): 11(ptr) Variable Function
68(param): 7(ptr) Variable Function 96(param): 11(ptr) Variable Function
65: 6(float) Load 64(input) 93: 10(float) Load 92(input)
Store 62(input) 65 Store 90(input) 93
69: 6(float) Load 62(input) 97: 10(float) Load 90(input)
Store 68(param) 69 Store 96(param) 97
70: 8(fvec4) FunctionCall 11(@PixelShaderFunction(f1;) 68(param) 98: 23(fvec4) FunctionCall 26(@PixelShaderFunction(f1;) 96(param)
Store 67(@entryPointOutput) 70 Store 95(@entryPointOutput) 98
Return Return
FunctionEnd FunctionEnd
11(@PixelShaderFunction(f1;): 8(fvec4) Function None 9 6(f0(): 2 Function None 3
10(input): 7(ptr) FunctionParameter 7: Label
12: Label Branch 28
Branch 13 28: Label
13: Label LoopMerge 30 31 Unroll
LoopMerge 15 16 Unroll Branch 29
Branch 14 29: Label
14: Label Branch 31
Branch 16 31: Label
16: Label BranchConditional 33 28 30
BranchConditional 18 13 15 30: Label
15: Label Return
Branch 19 FunctionEnd
19: Label 8(f1(): 2 Function None 3
LoopMerge 21 22 Unroll 9: Label
Branch 20
20: Label
Branch 22
22: Label
BranchConditional 18 19 21
21: Label
Branch 23
23: Label
LoopMerge 25 26 None
Branch 24
24: Label
27: 6(float) Load 10(input)
28: 8(fvec4) CompositeConstruct 27 27 27 27
ReturnValue 28
26: Label
30: 6(float) Load 10(input)
32: 17(bool) FOrdGreaterThan 30 31
BranchConditional 32 23 25
25: Label
Branch 33
33: Label
LoopMerge 35 36 None
Branch 34 Branch 34
34: Label 34: Label
37: 6(float) Load 10(input) LoopMerge 36 37 Unroll
39: 6(float) FAdd 37 38 Branch 35
Store 10(input) 39
Branch 36
36: Label
40: 6(float) Load 10(input)
42: 17(bool) FOrdLessThan 40 41
BranchConditional 42 33 35
35: Label 35: Label
Branch 43 Branch 37
43: Label 37: Label
LoopMerge 45 46 None BranchConditional 33 34 36
Branch 44 36: Label
44: Label Return
Branch 47 FunctionEnd
47: Label 14(f2(f1;): 10(float) Function None 12
LoopMerge 49 50 None 13(input): 11(ptr) FunctionParameter
Branch 51 15: Label
51: Label Branch 38
52: 6(float) Load 10(input) 38: Label
53: 6(float) FAdd 52 38 LoopMerge 40 41 None
Store 10(input) 53 Branch 39
54: 17(bool) FOrdLessThan 53 41 39: Label
BranchConditional 54 48 49 42: 10(float) Load 13(input)
48: Label 43: 23(fvec4) CompositeConstruct 42 42 42 42
44: 10(float) CompositeExtract 43 0
ReturnValue 44
41: Label
Branch 38
40: Label
Unreachable
FunctionEnd
18(f3(f1;): 2 Function None 16
17(input): 11(ptr) FunctionParameter
19: Label
Branch 50 Branch 50
50: Label 50: Label
Branch 47 LoopMerge 52 53 None
49: Label Branch 51
Branch 46 51: Label
46: Label 54: 10(float) Load 17(input)
55: 6(float) Load 10(input) 56: 10(float) FAdd 54 55
56: 6(float) FAdd 55 38 Store 17(input) 56
Store 10(input) 56 Branch 53
57: 17(bool) FOrdLessThan 56 41 53: Label
BranchConditional 57 43 45 57: 10(float) Load 17(input)
45: Label 59: 32(bool) FOrdLessThan 57 58
58: 6(float) Load 10(input) BranchConditional 59 50 52
59: 8(fvec4) CompositeConstruct 58 58 58 58 52: Label
ReturnValue 59 Return
FunctionEnd
21(f4(f1;): 2 Function None 16
20(input): 11(ptr) FunctionParameter
22: Label
Branch 60
60: Label
LoopMerge 62 63 None
Branch 61
61: Label
Branch 64
64: Label
LoopMerge 66 67 None
Branch 68
68: Label
69: 10(float) Load 20(input)
70: 10(float) FAdd 69 55
Store 20(input) 70
71: 32(bool) FOrdLessThan 70 58
BranchConditional 71 65 66
65: Label
Branch 67
67: Label
Branch 64
66: Label
Branch 63
63: Label
72: 10(float) Load 20(input)
73: 10(float) FAdd 72 55
Store 20(input) 73
74: 32(bool) FOrdLessThan 73 58
BranchConditional 74 60 62
62: Label
Return
FunctionEnd
26(@PixelShaderFunction(f1;): 23(fvec4) Function None 24
25(input): 11(ptr) FunctionParameter
27: Label
77(param): 11(ptr) Variable Function
80(param): 11(ptr) Variable Function
83(param): 11(ptr) Variable Function
75: 2 FunctionCall 6(f0()
76: 2 FunctionCall 8(f1()
78: 10(float) Load 25(input)
Store 77(param) 78
79: 10(float) FunctionCall 14(f2(f1;) 77(param)
81: 10(float) Load 25(input)
Store 80(param) 81
82: 2 FunctionCall 18(f3(f1;) 80(param)
84: 10(float) Load 25(input)
Store 83(param) 84
85: 2 FunctionCall 21(f4(f1;) 83(param)
86: 10(float) Load 25(input)
87: 23(fvec4) CompositeConstruct 86 86 86 86
ReturnValue 87
FunctionEnd FunctionEnd
...@@ -2,197 +2,251 @@ hlsl.forLoop.frag ...@@ -2,197 +2,251 @@ hlsl.forLoop.frag
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:1 Function Definition: f0( ( temp void)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:3 Loop with condition tested first
0:3 No loop condition
0:3 No loop body
0:4 Sequence
0:4 Pre-Increment ( temp 4-component vector of float)
0:4 'input' ( in 4-component vector of float)
0:4 Loop with condition tested first
0:4 No loop condition
0:4 No loop body
0:? Sequence
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)
0:5 'input' ( in 4-component vector of float)
0:5 'input' ( in 4-component vector of float)
0:5 No loop body
0:? Sequence 0:? Sequence
0:6 Loop with condition tested first
0:6 Loop Condition
0:6 any ( temp bool)
0:6 NotEqual ( temp 4-component vector of bool)
0:6 'input' ( in 4-component vector of float)
0:6 'input' ( in 4-component vector of float)
0:6 Loop Body
0:? Sequence 0:? Sequence
0:6 Branch: Return with expression 0:2 Loop with condition tested first
0:6 Negate value ( temp 4-component vector of float) 0:2 No loop condition
0:2 No loop body
0:5 Function Definition: f1(vf4; ( temp void)
0:5 Function Parameters:
0:5 'input' ( in 4-component vector of float)
0:? Sequence
0:6 Sequence
0:6 Pre-Increment ( temp 4-component vector of float)
0:6 'input' ( in 4-component vector of float) 0:6 'input' ( in 4-component vector of float)
0:7 Sequence 0:6 Loop with condition tested first
0:7 Pre-Decrement ( temp 4-component vector of float) 0:6 No loop condition
0:7 'input' ( in 4-component vector of float) 0:6 No loop body
0:7 Loop with condition tested first 0:9 Function Definition: f2(vf4; ( temp void)
0:7 Loop Condition 0:9 Function Parameters:
0:7 any ( temp bool)
0:7 NotEqual ( temp 4-component vector of bool)
0:7 'input' ( in 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Loop Body
0:? Sequence
0:7 Branch: Return with expression
0:7 Negate value ( temp 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Loop Terminal Expression
0:7 add second child into first child ( temp 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Constant:
0:7 2.000000
0:? Sequence
0:8 Loop with condition tested first
0:8 No loop condition
0:8 Loop Body
0:8 Test condition and select ( temp void)
0:8 Condition
0:8 Compare Greater Than ( temp bool)
0:8 direct index ( temp float)
0:8 'input' ( in 4-component vector of float)
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 2.000000
0:8 true case
0:8 Branch: Break
0:? Sequence
0:9 Loop with condition tested first
0:9 No loop condition
0:9 Loop Body
0:9 Test condition and select ( temp void)
0:9 Condition
0:9 Compare Greater Than ( temp bool)
0:9 direct index ( temp float)
0:9 'input' ( in 4-component vector of float) 0:9 'input' ( in 4-component vector of float)
0:9 Constant: 0:? Sequence
0:9 0 (const int) 0:? Sequence
0:9 Constant: 0:10 Loop with condition tested first: Unroll
0:9 2.000000 0:10 Loop Condition
0:9 true case 0:10 any ( temp bool)
0:9 Branch: Continue 0:10 NotEqual ( temp 4-component vector of bool)
0:11 Sequence 0:10 'input' ( in 4-component vector of float)
0:11 move second child to first child ( temp int) 0:10 'input' ( in 4-component vector of float)
0:11 'ii' ( temp int) 0:10 No loop body
0:11 Constant: 0:13 Function Definition: f3(vf4; ( temp float)
0:11 -1 (const int) 0:13 Function Parameters:
0:11 Loop with condition tested first 0:13 'input' ( in 4-component vector of float)
0:11 Loop Condition 0:? Sequence
0:11 Compare Less Than ( temp bool) 0:? Sequence
0:11 'ii' ( temp int)
0:11 Constant:
0:11 3 (const int)
0:11 Loop Body
0:11 Test condition and select ( temp void)
0:11 Condition
0:11 Compare Equal ( temp bool)
0:11 'ii' ( temp int)
0:11 Constant:
0:11 2 (const int)
0:11 true case
0:11 Branch: Continue
0:11 Loop Terminal Expression
0:11 Pre-Increment ( temp int)
0:11 'ii' ( temp int)
0:12 Pre-Decrement ( temp float)
0:12 'ii' ( temp float)
0:13 Sequence
0:13 move second child to first child ( temp int)
0:13 'first' ( temp int)
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child ( temp int)
0:13 'second' ( temp int)
0:13 Constant:
0:13 1 (const int)
0:13 Loop with condition tested first
0:13 No loop condition
0:13 Loop Body
0:13 add ( temp int)
0:13 'first' ( temp int)
0:13 'second' ( temp int)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'i' ( temp int)
0:14 Constant:
0:14 0 (const int)
0:14 move second child to first child ( temp int)
0:14 'count' ( temp int)
0:14 Convert float to int ( temp int)
0:14 'ii' ( temp float)
0:14 Loop with condition tested first 0:14 Loop with condition tested first
0:14 Loop Condition 0:14 Loop Condition
0:14 Compare Less Than ( temp bool) 0:14 any ( temp bool)
0:14 'i' ( temp int) 0:14 NotEqual ( temp 4-component vector of bool)
0:14 'count' ( temp int) 0:14 'input' ( in 4-component vector of float)
0:14 No loop body 0:14 'input' ( in 4-component vector of float)
0:14 Loop Terminal Expression 0:14 Loop Body
0:14 Post-Increment ( temp int) 0:? Sequence
0:14 'i' ( temp int) 0:14 Branch: Return with expression
0:15 Sequence 0:14 Construct float ( temp float)
0:15 move second child to first child ( temp float) 0:14 Negate value ( temp 4-component vector of float)
0:15 'first' ( temp float) 0:14 'input' ( in 4-component vector of float)
0:15 Constant: 0:17 Function Definition: f4(vf4; ( temp float)
0:15 0.000000 0:17 Function Parameters:
0:15 Loop with condition tested first 0:17 'input' ( in 4-component vector of float)
0:15 Loop Condition 0:? Sequence
0:15 Compare Less Than ( temp bool) 0:18 Sequence
0:15 'first' ( temp float) 0:18 Pre-Decrement ( temp 4-component vector of float)
0:15 direct index ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'second' ( temp 2-element array of float) 0:18 Loop with condition tested first
0:15 Constant: 0:18 Loop Condition
0:15 0 (const int) 0:18 any ( temp bool)
0:15 Loop Body 0:18 NotEqual ( temp 4-component vector of bool)
0:15 add ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 add ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'first' ( temp float) 0:18 Loop Body
0:15 direct index ( temp float) 0:? Sequence
0:15 'second' ( temp 2-element array of float) 0:18 Branch: Return with expression
0:15 Constant: 0:18 Construct float ( temp float)
0:15 1 (const int) 0:18 Negate value ( temp 4-component vector of float)
0:15 'third' ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 Loop Terminal Expression 0:18 Loop Terminal Expression
0:15 Pre-Increment ( temp float) 0:18 add second child into first child ( temp 4-component vector of float)
0:15 direct index ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'second' ( temp 2-element array of float) 0:18 Constant:
0:15 Constant: 0:18 2.000000
0:15 1 (const int) 0:21 Function Definition: f5(vf4; ( temp void)
0:? Sequence 0:21 Function Parameters:
0:16 Comma ( temp float) 0:21 'input' ( in 4-component vector of float)
0:16 Comma ( temp float) 0:? Sequence
0:16 Pre-Decrement ( temp float) 0:? Sequence
0:16 'ii' ( temp float) 0:22 Loop with condition tested first
0:16 Pre-Decrement ( temp float) 0:22 No loop condition
0:16 'ii' ( temp float) 0:22 Loop Body
0:16 Pre-Decrement ( temp float) 0:22 Test condition and select ( temp void)
0:16 'ii' ( temp float) 0:22 Condition
0:16 Loop with condition tested first 0:22 Compare Greater Than ( temp bool)
0:16 No loop condition 0:22 direct index ( temp float)
0:16 Loop Body 0:22 'input' ( in 4-component vector of float)
0:16 'ii' ( temp float) 0:22 Constant:
0:2 Function Definition: PixelShaderFunction( ( temp void) 0:22 0 (const int)
0:2 Function Parameters: 0:22 Constant:
0:? Sequence 0:22 2.000000
0:2 move second child to first child ( temp 4-component vector of float) 0:22 true case
0:22 Branch: Break
0:25 Function Definition: f6(vf4; ( temp void)
0:25 Function Parameters:
0:25 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:26 Loop with condition tested first
0:26 No loop condition
0:26 Loop Body
0:26 Test condition and select ( temp void)
0:26 Condition
0:26 Compare Greater Than ( temp bool)
0:26 direct index ( temp float)
0:26 'input' ( in 4-component vector of float)
0:26 Constant:
0:26 0 (const int)
0:26 Constant:
0:26 2.000000
0:26 true case
0:26 Branch: Continue
0:29 Function Definition: f99( ( temp void)
0:29 Function Parameters:
0:? Sequence
0:30 Sequence
0:30 move second child to first child ( temp int)
0:30 'first' ( temp int)
0:30 Constant:
0:30 0 (const int)
0:30 move second child to first child ( temp int)
0:30 'second' ( temp int)
0:30 Constant:
0:30 1 (const int)
0:30 Loop with condition tested first
0:30 No loop condition
0:30 Loop Body
0:30 add ( temp int)
0:30 'first' ( temp int)
0:30 'second' ( temp int)
0:33 Function Definition: f100(f1; ( temp void)
0:33 Function Parameters:
0:33 'ii' ( in float)
0:? Sequence
0:? Sequence
0:34 Comma ( temp float)
0:34 Comma ( temp float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Loop with condition tested first
0:34 No loop condition
0:34 Loop Body
0:34 'ii' ( in float)
0:38 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:38 Function Parameters:
0:38 'input' ( in 4-component vector of float)
0:? Sequence
0:39 Function Call: f0( ( temp void)
0:40 Function Call: f1(vf4; ( temp void)
0:40 'input' ( in 4-component vector of float)
0:41 Function Call: f2(vf4; ( temp void)
0:41 'input' ( in 4-component vector of float)
0:42 Function Call: f3(vf4; ( temp float)
0:42 'input' ( in 4-component vector of float)
0:43 Function Call: f4(vf4; ( temp float)
0:43 'input' ( in 4-component vector of float)
0:44 Function Call: f5(vf4; ( temp void)
0:44 'input' ( in 4-component vector of float)
0:45 Function Call: f6(vf4; ( temp void)
0:45 'input' ( in 4-component vector of float)
0:48 Sequence
0:48 move second child to first child ( temp int)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 -1 (const int)
0:48 Loop with condition tested first
0:48 Loop Condition
0:48 Compare Less Than ( temp bool)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 3 (const int)
0:48 Loop Body
0:48 Test condition and select ( temp void)
0:48 Condition
0:48 Compare Equal ( temp bool)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 2 (const int)
0:48 true case
0:48 Branch: Continue
0:48 Loop Terminal Expression
0:48 Pre-Increment ( temp int)
0:48 'ii' ( temp int)
0:49 Pre-Decrement ( temp float)
0:49 'ii' ( temp float)
0:51 Function Call: f99( ( temp void)
0:53 Sequence
0:53 move second child to first child ( temp int)
0:53 'i' ( temp int)
0:53 Constant:
0:53 0 (const int)
0:53 move second child to first child ( temp int)
0:53 'count' ( temp int)
0:53 Convert float to int ( temp int)
0:53 'ii' ( temp float)
0:53 Loop with condition tested first
0:53 Loop Condition
0:53 Compare Less Than ( temp bool)
0:53 'i' ( temp int)
0:53 'count' ( temp int)
0:53 No loop body
0:53 Loop Terminal Expression
0:53 Post-Increment ( temp int)
0:53 'i' ( temp int)
0:54 Sequence
0:54 move second child to first child ( temp float)
0:54 'first' ( temp float)
0:54 Constant:
0:54 0.000000
0:54 Loop with condition tested first
0:54 Loop Condition
0:54 Compare Less Than ( temp bool)
0:54 'first' ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 0 (const int)
0:54 Loop Body
0:54 add ( temp float)
0:54 add ( temp float)
0:54 'first' ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 1 (const int)
0:54 'third' ( temp float)
0:54 Loop Terminal Expression
0:54 Pre-Increment ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 1 (const int)
0:56 Function Call: f100(f1; ( temp void)
0:56 'ii' ( temp float)
0:58 Branch: Return with expression
0:58 'input' ( in 4-component vector of float)
0:38 Function Definition: PixelShaderFunction( ( temp void)
0:38 Function Parameters:
0:? Sequence
0:38 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp 4-component vector of float) 0:38 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:38 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -205,197 +259,251 @@ Linked fragment stage: ...@@ -205,197 +259,251 @@ Linked fragment stage:
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:1 Function Definition: f0( ( temp void)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:3 Loop with condition tested first
0:3 No loop condition
0:3 No loop body
0:4 Sequence
0:4 Pre-Increment ( temp 4-component vector of float)
0:4 'input' ( in 4-component vector of float)
0:4 Loop with condition tested first
0:4 No loop condition
0:4 No loop body
0:? Sequence
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)
0:5 'input' ( in 4-component vector of float)
0:5 'input' ( in 4-component vector of float)
0:5 No loop body
0:? Sequence 0:? Sequence
0:6 Loop with condition tested first
0:6 Loop Condition
0:6 any ( temp bool)
0:6 NotEqual ( temp 4-component vector of bool)
0:6 'input' ( in 4-component vector of float)
0:6 'input' ( in 4-component vector of float)
0:6 Loop Body
0:? Sequence 0:? Sequence
0:6 Branch: Return with expression 0:2 Loop with condition tested first
0:6 Negate value ( temp 4-component vector of float) 0:2 No loop condition
0:2 No loop body
0:5 Function Definition: f1(vf4; ( temp void)
0:5 Function Parameters:
0:5 'input' ( in 4-component vector of float)
0:? Sequence
0:6 Sequence
0:6 Pre-Increment ( temp 4-component vector of float)
0:6 'input' ( in 4-component vector of float) 0:6 'input' ( in 4-component vector of float)
0:7 Sequence 0:6 Loop with condition tested first
0:7 Pre-Decrement ( temp 4-component vector of float) 0:6 No loop condition
0:7 'input' ( in 4-component vector of float) 0:6 No loop body
0:7 Loop with condition tested first 0:9 Function Definition: f2(vf4; ( temp void)
0:7 Loop Condition 0:9 Function Parameters:
0:7 any ( temp bool)
0:7 NotEqual ( temp 4-component vector of bool)
0:7 'input' ( in 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Loop Body
0:? Sequence
0:7 Branch: Return with expression
0:7 Negate value ( temp 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Loop Terminal Expression
0:7 add second child into first child ( temp 4-component vector of float)
0:7 'input' ( in 4-component vector of float)
0:7 Constant:
0:7 2.000000
0:? Sequence
0:8 Loop with condition tested first
0:8 No loop condition
0:8 Loop Body
0:8 Test condition and select ( temp void)
0:8 Condition
0:8 Compare Greater Than ( temp bool)
0:8 direct index ( temp float)
0:8 'input' ( in 4-component vector of float)
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 2.000000
0:8 true case
0:8 Branch: Break
0:? Sequence
0:9 Loop with condition tested first
0:9 No loop condition
0:9 Loop Body
0:9 Test condition and select ( temp void)
0:9 Condition
0:9 Compare Greater Than ( temp bool)
0:9 direct index ( temp float)
0:9 'input' ( in 4-component vector of float) 0:9 'input' ( in 4-component vector of float)
0:9 Constant: 0:? Sequence
0:9 0 (const int) 0:? Sequence
0:9 Constant: 0:10 Loop with condition tested first: Unroll
0:9 2.000000 0:10 Loop Condition
0:9 true case 0:10 any ( temp bool)
0:9 Branch: Continue 0:10 NotEqual ( temp 4-component vector of bool)
0:11 Sequence 0:10 'input' ( in 4-component vector of float)
0:11 move second child to first child ( temp int) 0:10 'input' ( in 4-component vector of float)
0:11 'ii' ( temp int) 0:10 No loop body
0:11 Constant: 0:13 Function Definition: f3(vf4; ( temp float)
0:11 -1 (const int) 0:13 Function Parameters:
0:11 Loop with condition tested first 0:13 'input' ( in 4-component vector of float)
0:11 Loop Condition 0:? Sequence
0:11 Compare Less Than ( temp bool) 0:? Sequence
0:11 'ii' ( temp int)
0:11 Constant:
0:11 3 (const int)
0:11 Loop Body
0:11 Test condition and select ( temp void)
0:11 Condition
0:11 Compare Equal ( temp bool)
0:11 'ii' ( temp int)
0:11 Constant:
0:11 2 (const int)
0:11 true case
0:11 Branch: Continue
0:11 Loop Terminal Expression
0:11 Pre-Increment ( temp int)
0:11 'ii' ( temp int)
0:12 Pre-Decrement ( temp float)
0:12 'ii' ( temp float)
0:13 Sequence
0:13 move second child to first child ( temp int)
0:13 'first' ( temp int)
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child ( temp int)
0:13 'second' ( temp int)
0:13 Constant:
0:13 1 (const int)
0:13 Loop with condition tested first
0:13 No loop condition
0:13 Loop Body
0:13 add ( temp int)
0:13 'first' ( temp int)
0:13 'second' ( temp int)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'i' ( temp int)
0:14 Constant:
0:14 0 (const int)
0:14 move second child to first child ( temp int)
0:14 'count' ( temp int)
0:14 Convert float to int ( temp int)
0:14 'ii' ( temp float)
0:14 Loop with condition tested first 0:14 Loop with condition tested first
0:14 Loop Condition 0:14 Loop Condition
0:14 Compare Less Than ( temp bool) 0:14 any ( temp bool)
0:14 'i' ( temp int) 0:14 NotEqual ( temp 4-component vector of bool)
0:14 'count' ( temp int) 0:14 'input' ( in 4-component vector of float)
0:14 No loop body 0:14 'input' ( in 4-component vector of float)
0:14 Loop Terminal Expression 0:14 Loop Body
0:14 Post-Increment ( temp int) 0:? Sequence
0:14 'i' ( temp int) 0:14 Branch: Return with expression
0:15 Sequence 0:14 Construct float ( temp float)
0:15 move second child to first child ( temp float) 0:14 Negate value ( temp 4-component vector of float)
0:15 'first' ( temp float) 0:14 'input' ( in 4-component vector of float)
0:15 Constant: 0:17 Function Definition: f4(vf4; ( temp float)
0:15 0.000000 0:17 Function Parameters:
0:15 Loop with condition tested first 0:17 'input' ( in 4-component vector of float)
0:15 Loop Condition 0:? Sequence
0:15 Compare Less Than ( temp bool) 0:18 Sequence
0:15 'first' ( temp float) 0:18 Pre-Decrement ( temp 4-component vector of float)
0:15 direct index ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'second' ( temp 2-element array of float) 0:18 Loop with condition tested first
0:15 Constant: 0:18 Loop Condition
0:15 0 (const int) 0:18 any ( temp bool)
0:15 Loop Body 0:18 NotEqual ( temp 4-component vector of bool)
0:15 add ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 add ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'first' ( temp float) 0:18 Loop Body
0:15 direct index ( temp float) 0:? Sequence
0:15 'second' ( temp 2-element array of float) 0:18 Branch: Return with expression
0:15 Constant: 0:18 Construct float ( temp float)
0:15 1 (const int) 0:18 Negate value ( temp 4-component vector of float)
0:15 'third' ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 Loop Terminal Expression 0:18 Loop Terminal Expression
0:15 Pre-Increment ( temp float) 0:18 add second child into first child ( temp 4-component vector of float)
0:15 direct index ( temp float) 0:18 'input' ( in 4-component vector of float)
0:15 'second' ( temp 2-element array of float) 0:18 Constant:
0:15 Constant: 0:18 2.000000
0:15 1 (const int) 0:21 Function Definition: f5(vf4; ( temp void)
0:? Sequence 0:21 Function Parameters:
0:16 Comma ( temp float) 0:21 'input' ( in 4-component vector of float)
0:16 Comma ( temp float) 0:? Sequence
0:16 Pre-Decrement ( temp float) 0:? Sequence
0:16 'ii' ( temp float) 0:22 Loop with condition tested first
0:16 Pre-Decrement ( temp float) 0:22 No loop condition
0:16 'ii' ( temp float) 0:22 Loop Body
0:16 Pre-Decrement ( temp float) 0:22 Test condition and select ( temp void)
0:16 'ii' ( temp float) 0:22 Condition
0:16 Loop with condition tested first 0:22 Compare Greater Than ( temp bool)
0:16 No loop condition 0:22 direct index ( temp float)
0:16 Loop Body 0:22 'input' ( in 4-component vector of float)
0:16 'ii' ( temp float) 0:22 Constant:
0:2 Function Definition: PixelShaderFunction( ( temp void) 0:22 0 (const int)
0:2 Function Parameters: 0:22 Constant:
0:? Sequence 0:22 2.000000
0:2 move second child to first child ( temp 4-component vector of float) 0:22 true case
0:22 Branch: Break
0:25 Function Definition: f6(vf4; ( temp void)
0:25 Function Parameters:
0:25 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:26 Loop with condition tested first
0:26 No loop condition
0:26 Loop Body
0:26 Test condition and select ( temp void)
0:26 Condition
0:26 Compare Greater Than ( temp bool)
0:26 direct index ( temp float)
0:26 'input' ( in 4-component vector of float)
0:26 Constant:
0:26 0 (const int)
0:26 Constant:
0:26 2.000000
0:26 true case
0:26 Branch: Continue
0:29 Function Definition: f99( ( temp void)
0:29 Function Parameters:
0:? Sequence
0:30 Sequence
0:30 move second child to first child ( temp int)
0:30 'first' ( temp int)
0:30 Constant:
0:30 0 (const int)
0:30 move second child to first child ( temp int)
0:30 'second' ( temp int)
0:30 Constant:
0:30 1 (const int)
0:30 Loop with condition tested first
0:30 No loop condition
0:30 Loop Body
0:30 add ( temp int)
0:30 'first' ( temp int)
0:30 'second' ( temp int)
0:33 Function Definition: f100(f1; ( temp void)
0:33 Function Parameters:
0:33 'ii' ( in float)
0:? Sequence
0:? Sequence
0:34 Comma ( temp float)
0:34 Comma ( temp float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Pre-Decrement ( temp float)
0:34 'ii' ( in float)
0:34 Loop with condition tested first
0:34 No loop condition
0:34 Loop Body
0:34 'ii' ( in float)
0:38 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:38 Function Parameters:
0:38 'input' ( in 4-component vector of float)
0:? Sequence
0:39 Function Call: f0( ( temp void)
0:40 Function Call: f1(vf4; ( temp void)
0:40 'input' ( in 4-component vector of float)
0:41 Function Call: f2(vf4; ( temp void)
0:41 'input' ( in 4-component vector of float)
0:42 Function Call: f3(vf4; ( temp float)
0:42 'input' ( in 4-component vector of float)
0:43 Function Call: f4(vf4; ( temp float)
0:43 'input' ( in 4-component vector of float)
0:44 Function Call: f5(vf4; ( temp void)
0:44 'input' ( in 4-component vector of float)
0:45 Function Call: f6(vf4; ( temp void)
0:45 'input' ( in 4-component vector of float)
0:48 Sequence
0:48 move second child to first child ( temp int)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 -1 (const int)
0:48 Loop with condition tested first
0:48 Loop Condition
0:48 Compare Less Than ( temp bool)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 3 (const int)
0:48 Loop Body
0:48 Test condition and select ( temp void)
0:48 Condition
0:48 Compare Equal ( temp bool)
0:48 'ii' ( temp int)
0:48 Constant:
0:48 2 (const int)
0:48 true case
0:48 Branch: Continue
0:48 Loop Terminal Expression
0:48 Pre-Increment ( temp int)
0:48 'ii' ( temp int)
0:49 Pre-Decrement ( temp float)
0:49 'ii' ( temp float)
0:51 Function Call: f99( ( temp void)
0:53 Sequence
0:53 move second child to first child ( temp int)
0:53 'i' ( temp int)
0:53 Constant:
0:53 0 (const int)
0:53 move second child to first child ( temp int)
0:53 'count' ( temp int)
0:53 Convert float to int ( temp int)
0:53 'ii' ( temp float)
0:53 Loop with condition tested first
0:53 Loop Condition
0:53 Compare Less Than ( temp bool)
0:53 'i' ( temp int)
0:53 'count' ( temp int)
0:53 No loop body
0:53 Loop Terminal Expression
0:53 Post-Increment ( temp int)
0:53 'i' ( temp int)
0:54 Sequence
0:54 move second child to first child ( temp float)
0:54 'first' ( temp float)
0:54 Constant:
0:54 0.000000
0:54 Loop with condition tested first
0:54 Loop Condition
0:54 Compare Less Than ( temp bool)
0:54 'first' ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 0 (const int)
0:54 Loop Body
0:54 add ( temp float)
0:54 add ( temp float)
0:54 'first' ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 1 (const int)
0:54 'third' ( temp float)
0:54 Loop Terminal Expression
0:54 Pre-Increment ( temp float)
0:54 direct index ( temp float)
0:54 'second' ( temp 2-element array of float)
0:54 Constant:
0:54 1 (const int)
0:56 Function Call: f100(f1; ( temp void)
0:56 'ii' ( temp float)
0:58 Branch: Return with expression
0:58 'input' ( in 4-component vector of float)
0:38 Function Definition: PixelShaderFunction( ( temp void)
0:38 Function Parameters:
0:? Sequence
0:38 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp 4-component vector of float) 0:38 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:38 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -403,303 +511,402 @@ gl_FragCoord origin is upper left ...@@ -403,303 +511,402 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 183 // Id's are bound by 240
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 176 179 EntryPoint Fragment 4 "PixelShaderFunction" 233 236
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "@PixelShaderFunction(vf4;" Name 6 "f0("
Name 10 "input" Name 13 "f1(vf4;"
Name 92 "ii" Name 12 "input"
Name 111 "ii" Name 16 "f2(vf4;"
Name 114 "first" Name 15 "input"
Name 116 "second" Name 20 "f3(vf4;"
Name 124 "i" Name 19 "input"
Name 125 "count" Name 23 "f4(vf4;"
Name 138 "first" Name 22 "input"
Name 149 "second" Name 26 "f5(vf4;"
Name 157 "third" Name 25 "input"
Name 174 "input" Name 29 "f6(vf4;"
Name 176 "input" Name 28 "input"
Name 179 "@entryPointOutput" Name 31 "f99("
Name 180 "param" Name 36 "f100(f1;"
Decorate 176(input) Location 0 Name 35 "ii"
Decorate 179(@entryPointOutput) Location 0 Name 40 "@PixelShaderFunction(vf4;"
Name 39 "input"
Name 124 "first"
Name 126 "second"
Name 146 "param"
Name 149 "param"
Name 152 "param"
Name 155 "param"
Name 158 "param"
Name 161 "param"
Name 164 "ii"
Name 182 "ii"
Name 186 "i"
Name 187 "count"
Name 200 "first"
Name 211 "second"
Name 219 "third"
Name 225 "param"
Name 231 "input"
Name 233 "input"
Name 236 "@entryPointOutput"
Name 237 "param"
Decorate 233(input) Location 0
Decorate 236(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 8: TypeFloat 32
7: TypeVector 6(float) 4 9: TypeVector 8(float) 4
8: TypePointer Function 7(fvec4) 10: TypePointer Function 9(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 11: TypeFunction 2 10(ptr)
18: 6(float) Constant 1065353216 18: TypeFunction 8(float) 10(ptr)
32: TypeBool 33: TypePointer Function 8(float)
33: TypeVector 32(bool) 4 34: TypeFunction 2 33(ptr)
63: 6(float) Constant 1073741824 38: TypeFunction 9(fvec4) 10(ptr)
71: TypeInt 32 0 47: 8(float) Constant 1065353216
72: 71(int) Constant 0 61: TypeBool
73: TypePointer Function 6(float) 62: TypeVector 61(bool) 4
90: TypeInt 32 1 95: 8(float) Constant 1073741824
91: TypePointer Function 90(int) 104: TypeInt 32 0
93: 90(int) Constant 4294967295 105: 104(int) Constant 0
100: 90(int) Constant 3 122: TypeInt 32 1
103: 90(int) Constant 2 123: TypePointer Function 122(int)
109: 90(int) Constant 1 125: 122(int) Constant 0
115: 90(int) Constant 0 127: 122(int) Constant 1
139: 6(float) Constant 0 165: 122(int) Constant 4294967295
146: 71(int) Constant 2 172: 122(int) Constant 3
147: TypeArray 6(float) 146 175: 122(int) Constant 2
148: TypePointer Function 147 201: 8(float) Constant 0
175: TypePointer Input 7(fvec4) 208: 104(int) Constant 2
176(input): 175(ptr) Variable Input 209: TypeArray 8(float) 208
178: TypePointer Output 7(fvec4) 210: TypePointer Function 209
179(@entryPointOutput): 178(ptr) Variable Output 232: TypePointer Input 9(fvec4)
233(input): 232(ptr) Variable Input
235: TypePointer Output 9(fvec4)
236(@entryPointOutput): 235(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
174(input): 8(ptr) Variable Function 231(input): 10(ptr) Variable Function
180(param): 8(ptr) Variable Function 237(param): 10(ptr) Variable Function
177: 7(fvec4) Load 176(input) 234: 9(fvec4) Load 233(input)
Store 174(input) 177 Store 231(input) 234
181: 7(fvec4) Load 174(input) 238: 9(fvec4) Load 231(input)
Store 180(param) 181 Store 237(param) 238
182: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 180(param) 239: 9(fvec4) FunctionCall 40(@PixelShaderFunction(vf4;) 237(param)
Store 179(@entryPointOutput) 182 Store 236(@entryPointOutput) 239
Return Return
FunctionEnd FunctionEnd
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9 6(f0(): 2 Function None 3
10(input): 8(ptr) FunctionParameter 7: Label
12: Label Branch 42
92(ii): 91(ptr) Variable Function 42: Label
111(ii): 73(ptr) Variable Function LoopMerge 44 45 None
114(first): 91(ptr) Variable Function Branch 43
116(second): 91(ptr) Variable Function 43: Label
124(i): 91(ptr) Variable Function Branch 45
125(count): 91(ptr) Variable Function 45: Label
138(first): 73(ptr) Variable Function Branch 42
149(second): 148(ptr) Variable Function 44: Label
157(third): 73(ptr) Variable Function Unreachable
Branch 13 FunctionEnd
13: Label 13(f1(vf4;): 2 Function None 11
LoopMerge 15 16 None 12(input): 10(ptr) FunctionParameter
Branch 14
14: Label 14: Label
Branch 16 46: 9(fvec4) Load 12(input)
16: Label 48: 9(fvec4) CompositeConstruct 47 47 47 47
Branch 13 49: 9(fvec4) FAdd 46 48
15: Label Store 12(input) 49
17: 7(fvec4) Load 10(input) Branch 50
19: 7(fvec4) CompositeConstruct 18 18 18 18 50: Label
20: 7(fvec4) FAdd 17 19 LoopMerge 52 53 None
Store 10(input) 20
Branch 21
21: Label
LoopMerge 23 24 None
Branch 22
22: Label
Branch 24
24: Label
Branch 21
23: Label
Branch 25
25: Label
LoopMerge 27 28 Unroll
Branch 29
29: Label
30: 7(fvec4) Load 10(input)
31: 7(fvec4) Load 10(input)
34: 33(bvec4) FOrdNotEqual 30 31
35: 32(bool) Any 34
BranchConditional 35 26 27
26: Label
Branch 28
28: Label
Branch 25
27: Label
Branch 36
36: Label
LoopMerge 38 39 None
Branch 40
40: Label
41: 7(fvec4) Load 10(input)
42: 7(fvec4) Load 10(input)
43: 33(bvec4) FOrdNotEqual 41 42
44: 32(bool) Any 43
BranchConditional 44 37 38
37: Label
45: 7(fvec4) Load 10(input)
46: 7(fvec4) FNegate 45
ReturnValue 46
39: Label
Branch 36
38: Label
48: 7(fvec4) Load 10(input)
49: 7(fvec4) CompositeConstruct 18 18 18 18
50: 7(fvec4) FSub 48 49
Store 10(input) 50
Branch 51 Branch 51
51: Label 51: Label
LoopMerge 53 54 None Branch 53
Branch 55 53: Label
55: Label Branch 50
56: 7(fvec4) Load 10(input)
57: 7(fvec4) Load 10(input)
58: 33(bvec4) FOrdNotEqual 56 57
59: 32(bool) Any 58
BranchConditional 59 52 53
52: Label 52: Label
60: 7(fvec4) Load 10(input) Unreachable
61: 7(fvec4) FNegate 60 FunctionEnd
ReturnValue 61 16(f2(vf4;): 2 Function None 11
15(input): 10(ptr) FunctionParameter
17: Label
Branch 54
54: Label 54: Label
64: 7(fvec4) Load 10(input) LoopMerge 56 57 Unroll
65: 7(fvec4) CompositeConstruct 63 63 63 63 Branch 58
66: 7(fvec4) FAdd 64 65 58: Label
Store 10(input) 66 59: 9(fvec4) Load 15(input)
Branch 51 60: 9(fvec4) Load 15(input)
53: Label 63: 62(bvec4) FOrdNotEqual 59 60
Branch 67 64: 61(bool) Any 63
67: Label BranchConditional 64 55 56
LoopMerge 69 70 None 55: Label
Branch 68 Branch 57
68: Label 57: Label
74: 73(ptr) AccessChain 10(input) 72 Branch 54
75: 6(float) Load 74 56: Label
76: 32(bool) FOrdGreaterThan 75 63 Return
SelectionMerge 78 None FunctionEnd
BranchConditional 76 77 78 20(f3(vf4;): 8(float) Function None 18
77: Label 19(input): 10(ptr) FunctionParameter
21: Label
Branch 65
65: Label
LoopMerge 67 68 None
Branch 69 Branch 69
78: Label
Branch 70
70: Label
Branch 67
69: Label 69: Label
Branch 80 70: 9(fvec4) Load 19(input)
80: Label 71: 9(fvec4) Load 19(input)
LoopMerge 82 83 None 72: 62(bvec4) FOrdNotEqual 70 71
Branch 81 73: 61(bool) Any 72
81: Label BranchConditional 73 66 67
84: 73(ptr) AccessChain 10(input) 72 66: Label
85: 6(float) Load 84 74: 9(fvec4) Load 19(input)
86: 32(bool) FOrdGreaterThan 85 63 75: 9(fvec4) FNegate 74
SelectionMerge 88 None 76: 8(float) CompositeExtract 75 0
BranchConditional 86 87 88 ReturnValue 76
87: Label 68: Label
Branch 83 Branch 65
88: Label 67: Label
Branch 83 78: 8(float) Undef
83: Label ReturnValue 78
Branch 80 FunctionEnd
23(f4(vf4;): 8(float) Function None 18
22(input): 10(ptr) FunctionParameter
24: Label
79: 9(fvec4) Load 22(input)
80: 9(fvec4) CompositeConstruct 47 47 47 47
81: 9(fvec4) FSub 79 80
Store 22(input) 81
Branch 82
82: Label 82: Label
Store 92(ii) 93 LoopMerge 84 85 None
Branch 94 Branch 86
94: Label 86: Label
LoopMerge 96 97 None 87: 9(fvec4) Load 22(input)
Branch 98 88: 9(fvec4) Load 22(input)
98: Label 89: 62(bvec4) FOrdNotEqual 87 88
99: 90(int) Load 92(ii) 90: 61(bool) Any 89
101: 32(bool) SLessThan 99 100 BranchConditional 90 83 84
BranchConditional 101 95 96 83: Label
95: Label 91: 9(fvec4) Load 22(input)
102: 90(int) Load 92(ii) 92: 9(fvec4) FNegate 91
104: 32(bool) IEqual 102 103 93: 8(float) CompositeExtract 92 0
SelectionMerge 106 None ReturnValue 93
BranchConditional 104 105 106 85: Label
105: Label Branch 82
Branch 97 84: Label
106: Label 99: 8(float) Undef
Branch 97 ReturnValue 99
97: Label FunctionEnd
108: 90(int) Load 92(ii) 26(f5(vf4;): 2 Function None 11
110: 90(int) IAdd 108 109 25(input): 10(ptr) FunctionParameter
Store 92(ii) 110 27: Label
Branch 94 Branch 100
96: Label 100: Label
112: 6(float) Load 111(ii) LoopMerge 102 103 None
113: 6(float) FSub 112 18 Branch 101
Store 111(ii) 113 101: Label
Store 114(first) 115 106: 33(ptr) AccessChain 25(input) 105
Store 116(second) 109 107: 8(float) Load 106
Branch 117 108: 61(bool) FOrdGreaterThan 107 95
117: Label SelectionMerge 110 None
LoopMerge 119 120 None BranchConditional 108 109 110
Branch 118 109: Label
118: Label Branch 102
121: 90(int) Load 114(first) 110: Label
122: 90(int) Load 116(second) Branch 103
123: 90(int) IAdd 121 122 103: Label
Branch 120 Branch 100
120: Label 102: Label
Branch 117 Return
FunctionEnd
29(f6(vf4;): 2 Function None 11
28(input): 10(ptr) FunctionParameter
30: Label
Branch 112
112: Label
LoopMerge 114 115 None
Branch 113
113: Label
116: 33(ptr) AccessChain 28(input) 105
117: 8(float) Load 116
118: 61(bool) FOrdGreaterThan 117 95
SelectionMerge 120 None
BranchConditional 118 119 120
119: Label 119: Label
Store 124(i) 115 Branch 115
126: 6(float) Load 111(ii) 120: Label
127: 90(int) ConvertFToS 126 Branch 115
Store 125(count) 127 115: Label
Branch 112
114: Label
Unreachable
FunctionEnd
31(f99(): 2 Function None 3
32: Label
124(first): 123(ptr) Variable Function
126(second): 123(ptr) Variable Function
Store 124(first) 125
Store 126(second) 127
Branch 128 Branch 128
128: Label 128: Label
LoopMerge 130 131 None LoopMerge 130 131 None
Branch 132 Branch 129
132: Label
133: 90(int) Load 124(i)
134: 90(int) Load 125(count)
135: 32(bool) SLessThan 133 134
BranchConditional 135 129 130
129: Label 129: Label
132: 122(int) Load 124(first)
133: 122(int) Load 126(second)
134: 122(int) IAdd 132 133
Branch 131 Branch 131
131: Label 131: Label
136: 90(int) Load 124(i)
137: 90(int) IAdd 136 109
Store 124(i) 137
Branch 128 Branch 128
130: Label 130: Label
Store 138(first) 139 Unreachable
Branch 140 FunctionEnd
140: Label 36(f100(f1;): 2 Function None 34
LoopMerge 142 143 None 35(ii): 33(ptr) FunctionParameter
37: Label
135: 8(float) Load 35(ii)
136: 8(float) FSub 135 47
Store 35(ii) 136
137: 8(float) Load 35(ii)
138: 8(float) FSub 137 47
Store 35(ii) 138
139: 8(float) Load 35(ii)
140: 8(float) FSub 139 47
Store 35(ii) 140
Branch 141
141: Label
LoopMerge 143 144 None
Branch 142
142: Label
Branch 144 Branch 144
144: Label 144: Label
145: 6(float) Load 138(first) Branch 141
150: 73(ptr) AccessChain 149(second) 115
151: 6(float) Load 150
152: 32(bool) FOrdLessThan 145 151
BranchConditional 152 141 142
141: Label
153: 6(float) Load 138(first)
154: 73(ptr) AccessChain 149(second) 109
155: 6(float) Load 154
156: 6(float) FAdd 153 155
158: 6(float) Load 157(third)
159: 6(float) FAdd 156 158
Branch 143
143: Label 143: Label
160: 73(ptr) AccessChain 149(second) 109 Unreachable
161: 6(float) Load 160 FunctionEnd
162: 6(float) FAdd 161 18 40(@PixelShaderFunction(vf4;): 9(fvec4) Function None 38
Store 160 162 39(input): 10(ptr) FunctionParameter
Branch 140 41: Label
142: Label 146(param): 10(ptr) Variable Function
163: 6(float) Load 111(ii) 149(param): 10(ptr) Variable Function
164: 6(float) FSub 163 18 152(param): 10(ptr) Variable Function
Store 111(ii) 164 155(param): 10(ptr) Variable Function
165: 6(float) Load 111(ii) 158(param): 10(ptr) Variable Function
166: 6(float) FSub 165 18 161(param): 10(ptr) Variable Function
Store 111(ii) 166 164(ii): 123(ptr) Variable Function
167: 6(float) Load 111(ii) 182(ii): 33(ptr) Variable Function
168: 6(float) FSub 167 18 186(i): 123(ptr) Variable Function
Store 111(ii) 168 187(count): 123(ptr) Variable Function
Branch 169 200(first): 33(ptr) Variable Function
169: Label 211(second): 210(ptr) Variable Function
LoopMerge 171 172 None 219(third): 33(ptr) Variable Function
225(param): 33(ptr) Variable Function
145: 2 FunctionCall 6(f0()
147: 9(fvec4) Load 39(input)
Store 146(param) 147
148: 2 FunctionCall 13(f1(vf4;) 146(param)
150: 9(fvec4) Load 39(input)
Store 149(param) 150
151: 2 FunctionCall 16(f2(vf4;) 149(param)
153: 9(fvec4) Load 39(input)
Store 152(param) 153
154: 8(float) FunctionCall 20(f3(vf4;) 152(param)
156: 9(fvec4) Load 39(input)
Store 155(param) 156
157: 8(float) FunctionCall 23(f4(vf4;) 155(param)
159: 9(fvec4) Load 39(input)
Store 158(param) 159
160: 2 FunctionCall 26(f5(vf4;) 158(param)
162: 9(fvec4) Load 39(input)
Store 161(param) 162
163: 2 FunctionCall 29(f6(vf4;) 161(param)
Store 164(ii) 165
Branch 166
166: Label
LoopMerge 168 169 None
Branch 170 Branch 170
170: Label 170: Label
Branch 172 171: 122(int) Load 164(ii)
172: Label 173: 61(bool) SLessThan 171 172
BranchConditional 173 167 168
167: Label
174: 122(int) Load 164(ii)
176: 61(bool) IEqual 174 175
SelectionMerge 178 None
BranchConditional 176 177 178
177: Label
Branch 169 Branch 169
171: Label 178: Label
173: 7(fvec4) Undef Branch 169
ReturnValue 173 169: Label
180: 122(int) Load 164(ii)
181: 122(int) IAdd 180 127
Store 164(ii) 181
Branch 166
168: Label
183: 8(float) Load 182(ii)
184: 8(float) FSub 183 47
Store 182(ii) 184
185: 2 FunctionCall 31(f99()
Store 186(i) 125
188: 8(float) Load 182(ii)
189: 122(int) ConvertFToS 188
Store 187(count) 189
Branch 190
190: Label
LoopMerge 192 193 None
Branch 194
194: Label
195: 122(int) Load 186(i)
196: 122(int) Load 187(count)
197: 61(bool) SLessThan 195 196
BranchConditional 197 191 192
191: Label
Branch 193
193: Label
198: 122(int) Load 186(i)
199: 122(int) IAdd 198 127
Store 186(i) 199
Branch 190
192: Label
Store 200(first) 201
Branch 202
202: Label
LoopMerge 204 205 None
Branch 206
206: Label
207: 8(float) Load 200(first)
212: 33(ptr) AccessChain 211(second) 125
213: 8(float) Load 212
214: 61(bool) FOrdLessThan 207 213
BranchConditional 214 203 204
203: Label
215: 8(float) Load 200(first)
216: 33(ptr) AccessChain 211(second) 127
217: 8(float) Load 216
218: 8(float) FAdd 215 217
220: 8(float) Load 219(third)
221: 8(float) FAdd 218 220
Branch 205
205: Label
222: 33(ptr) AccessChain 211(second) 127
223: 8(float) Load 222
224: 8(float) FAdd 223 47
Store 222 224
Branch 202
204: Label
226: 8(float) Load 182(ii)
Store 225(param) 226
227: 2 FunctionCall 36(f100(f1;) 225(param)
228: 9(fvec4) Load 39(input)
ReturnValue 228
FunctionEnd FunctionEnd
...@@ -2,104 +2,116 @@ hlsl.if.frag ...@@ -2,104 +2,116 @@ hlsl.if.frag
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:1 Function Definition: f0(vf4; ( temp 4-component vector of float)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in 4-component vector of float) 0:1 'input' ( in 4-component vector of float)
0:? Sequence 0:? Sequence
0:3 Test condition and select ( temp void) 0:2 Test condition and select ( temp void)
0:3 Condition 0:2 Condition
0:3 all ( temp bool) 0:2 all ( temp bool)
0:3 Equal ( temp 4-component vector of bool) 0:2 Equal ( temp 4-component vector of bool)
0:3 'input' ( in 4-component vector of float) 0:2 'input' ( in 4-component vector of float)
0:2 'input' ( in 4-component vector of float)
0:2 true case
0:3 Branch: Return with expression
0:3 'input' ( in 4-component vector of float) 0:3 'input' ( in 4-component vector of float)
0:3 true case 0:2 false case
0:4 Branch: Return with expression 0:5 Branch: Return with expression
0:4 'input' ( in 4-component vector of float) 0:5 Negate value ( temp 4-component vector of float)
0:6 Test condition and select ( temp void) 0:5 'input' ( in 4-component vector of float)
0:6 Condition 0:8 Function Definition: f1(vf4; ( temp 4-component vector of float)
0:6 all ( temp bool) 0:8 Function Parameters:
0:6 Equal ( temp 4-component vector of bool) 0:8 'input' ( in 4-component vector of float)
0:6 'input' ( in 4-component vector of float) 0:? Sequence
0:6 'input' ( in 4-component vector of float) 0:9 Test condition and select ( temp void)
0:6 true case 0:9 Condition
0:7 Branch: Return with expression 0:9 all ( temp bool)
0:7 'input' ( in 4-component vector of float) 0:9 Equal ( temp 4-component vector of bool)
0:6 false case
0:9 Branch: Return with expression
0:9 Negate value ( temp 4-component vector of float)
0:9 'input' ( in 4-component vector of float) 0:9 'input' ( in 4-component vector of float)
0:11 Test condition and select ( temp void) 0:9 'input' ( in 4-component vector of float)
0:11 Condition 0:9 true case
0:11 all ( temp bool) 0:? Sequence
0:11 Equal ( temp 4-component vector of bool) 0:10 Branch: Return with expression
0:11 'input' ( in 4-component vector of float) 0:10 'input' ( in 4-component vector of float)
0:11 'input' ( in 4-component vector of float) 0:9 false case
0:11 true case is null
0:14 Test condition and select ( temp void)
0:14 Condition
0:14 all ( temp bool)
0:14 Equal ( temp 4-component vector of bool)
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): Flatten
0:19 Condition
0:19 all ( temp bool)
0:19 Equal ( temp 4-component vector of bool)
0:19 'input' ( in 4-component vector of float)
0:19 'input' ( in 4-component vector of float)
0:19 true case
0:? Sequence 0:? Sequence
0:20 Branch: Return with expression 0:12 Branch: Return with expression
0:20 'input' ( in 4-component vector of float) 0:12 Negate value ( temp 4-component vector of float)
0:12 'input' ( in 4-component vector of float)
0:17 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'input' ( in 4-component vector of float)
0:? Sequence
0:18 Test condition and select ( temp void)
0:18 Condition
0:18 all ( temp bool)
0:18 Equal ( temp 4-component vector of bool)
0:18 'input' ( in 4-component vector of float)
0:18 'input' ( in 4-component vector of float)
0:18 true case
0:19 Branch: Return with expression
0:19 'input' ( in 4-component vector of float)
0:21 Function Call: f0(vf4; ( temp 4-component vector of float)
0:21 'input' ( in 4-component vector of float)
0:23 Test condition and select ( temp void) 0:23 Test condition and select ( temp void)
0:23 Condition 0:23 Condition
0:23 all ( temp bool) 0:23 all ( temp bool)
0:23 Equal ( temp 4-component vector of bool) 0:23 Equal ( temp 4-component vector of bool)
0:23 'input' ( in 4-component vector of float) 0:23 'input' ( in 4-component vector of float)
0:23 'input' ( in 4-component vector of float) 0:23 'input' ( in 4-component vector of float)
0:23 true case 0:23 true case is null
0:? Sequence 0:26 Test condition and select ( temp void)
0:24 Branch: Return with expression 0:26 Condition
0:24 'input' ( in 4-component vector of float) 0:26 all ( temp bool)
0:23 false case 0:26 Equal ( temp 4-component vector of bool)
0:? Sequence
0:26 Branch: Return with expression
0:26 Negate value ( temp 4-component vector of float)
0:26 'input' ( in 4-component vector of float) 0:26 'input' ( in 4-component vector of float)
0:30 Test condition and select ( temp void) 0:26 'input' ( in 4-component vector of float)
0:30 Condition 0:26 true case is null
0:30 Convert float to bool ( temp bool) 0:31 Test condition and select ( temp void): Flatten
0:30 move second child to first child ( temp float) 0:31 Condition
0:30 'ii' ( temp float) 0:31 all ( temp bool)
0:30 direct index ( temp float) 0:31 Equal ( temp 4-component vector of bool)
0:30 'input' ( in 4-component vector of float) 0:31 'input' ( in 4-component vector of float)
0:30 Constant: 0:31 'input' ( in 4-component vector of float)
0:30 2 (const int) 0:31 true case
0:30 true case 0:? Sequence
0:31 Pre-Increment ( temp float) 0:32 Branch: Return with expression
0:31 'ii' ( temp float) 0:32 'input' ( in 4-component vector of float)
0:32 Pre-Increment ( temp int) 0:35 Function Call: f1(vf4; ( temp 4-component vector of float)
0:32 'ii' ( temp int) 0:35 'input' ( in 4-component vector of float)
0:33 Test condition and select ( temp void) 0:38 Test condition and select ( temp void)
0:33 Condition 0:38 Condition
0:33 Compare Equal ( temp bool) 0:38 Convert float to bool ( temp bool)
0:33 Convert int to float ( temp float) 0:38 move second child to first child ( temp float)
0:33 'ii' ( temp int) 0:38 'ii' ( temp float)
0:33 Constant: 0:38 direct index ( temp float)
0:33 1.000000 0:38 'input' ( in 4-component vector of float)
0:33 true case 0:38 Constant:
0:34 Pre-Increment ( temp int) 0:38 2 (const int)
0:34 'ii' ( temp int) 0:38 true case
0:2 Function Definition: PixelShaderFunction( ( temp void) 0:39 Pre-Increment ( temp float)
0:2 Function Parameters: 0:39 'ii' ( temp float)
0:40 Pre-Increment ( temp int)
0:40 'ii' ( temp int)
0:41 Test condition and select ( temp void)
0:41 Condition
0:41 Compare Equal ( temp bool)
0:41 Convert int to float ( temp float)
0:41 'ii' ( temp int)
0:41 Constant:
0:41 1.000000
0:41 true case
0:42 Pre-Increment ( temp int)
0:42 'ii' ( temp int)
0:17 Function Definition: PixelShaderFunction( ( temp void)
0:17 Function Parameters:
0:? Sequence 0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float) 0:17 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp 4-component vector of float) 0:17 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:17 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -112,104 +124,116 @@ Linked fragment stage: ...@@ -112,104 +124,116 @@ Linked fragment stage:
Shader version: 500 Shader version: 500
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:1 Function Definition: f0(vf4; ( temp 4-component vector of float)
0:2 Function Parameters: 0:1 Function Parameters:
0:2 'input' ( in 4-component vector of float) 0:1 'input' ( in 4-component vector of float)
0:? Sequence 0:? Sequence
0:3 Test condition and select ( temp void) 0:2 Test condition and select ( temp void)
0:3 Condition 0:2 Condition
0:3 all ( temp bool) 0:2 all ( temp bool)
0:3 Equal ( temp 4-component vector of bool) 0:2 Equal ( temp 4-component vector of bool)
0:3 'input' ( in 4-component vector of float) 0:2 'input' ( in 4-component vector of float)
0:2 'input' ( in 4-component vector of float)
0:2 true case
0:3 Branch: Return with expression
0:3 'input' ( in 4-component vector of float) 0:3 'input' ( in 4-component vector of float)
0:3 true case 0:2 false case
0:4 Branch: Return with expression 0:5 Branch: Return with expression
0:4 'input' ( in 4-component vector of float) 0:5 Negate value ( temp 4-component vector of float)
0:6 Test condition and select ( temp void) 0:5 'input' ( in 4-component vector of float)
0:6 Condition 0:8 Function Definition: f1(vf4; ( temp 4-component vector of float)
0:6 all ( temp bool) 0:8 Function Parameters:
0:6 Equal ( temp 4-component vector of bool) 0:8 'input' ( in 4-component vector of float)
0:6 'input' ( in 4-component vector of float) 0:? Sequence
0:6 'input' ( in 4-component vector of float) 0:9 Test condition and select ( temp void)
0:6 true case 0:9 Condition
0:7 Branch: Return with expression 0:9 all ( temp bool)
0:7 'input' ( in 4-component vector of float) 0:9 Equal ( temp 4-component vector of bool)
0:6 false case
0:9 Branch: Return with expression
0:9 Negate value ( temp 4-component vector of float)
0:9 'input' ( in 4-component vector of float) 0:9 'input' ( in 4-component vector of float)
0:11 Test condition and select ( temp void) 0:9 'input' ( in 4-component vector of float)
0:11 Condition 0:9 true case
0:11 all ( temp bool) 0:? Sequence
0:11 Equal ( temp 4-component vector of bool) 0:10 Branch: Return with expression
0:11 'input' ( in 4-component vector of float) 0:10 'input' ( in 4-component vector of float)
0:11 'input' ( in 4-component vector of float) 0:9 false case
0:11 true case is null
0:14 Test condition and select ( temp void)
0:14 Condition
0:14 all ( temp bool)
0:14 Equal ( temp 4-component vector of bool)
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): Flatten
0:19 Condition
0:19 all ( temp bool)
0:19 Equal ( temp 4-component vector of bool)
0:19 'input' ( in 4-component vector of float)
0:19 'input' ( in 4-component vector of float)
0:19 true case
0:? Sequence 0:? Sequence
0:20 Branch: Return with expression 0:12 Branch: Return with expression
0:20 'input' ( in 4-component vector of float) 0:12 Negate value ( temp 4-component vector of float)
0:12 'input' ( in 4-component vector of float)
0:17 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'input' ( in 4-component vector of float)
0:? Sequence
0:18 Test condition and select ( temp void)
0:18 Condition
0:18 all ( temp bool)
0:18 Equal ( temp 4-component vector of bool)
0:18 'input' ( in 4-component vector of float)
0:18 'input' ( in 4-component vector of float)
0:18 true case
0:19 Branch: Return with expression
0:19 'input' ( in 4-component vector of float)
0:21 Function Call: f0(vf4; ( temp 4-component vector of float)
0:21 'input' ( in 4-component vector of float)
0:23 Test condition and select ( temp void) 0:23 Test condition and select ( temp void)
0:23 Condition 0:23 Condition
0:23 all ( temp bool) 0:23 all ( temp bool)
0:23 Equal ( temp 4-component vector of bool) 0:23 Equal ( temp 4-component vector of bool)
0:23 'input' ( in 4-component vector of float) 0:23 'input' ( in 4-component vector of float)
0:23 'input' ( in 4-component vector of float) 0:23 'input' ( in 4-component vector of float)
0:23 true case 0:23 true case is null
0:? Sequence 0:26 Test condition and select ( temp void)
0:24 Branch: Return with expression 0:26 Condition
0:24 'input' ( in 4-component vector of float) 0:26 all ( temp bool)
0:23 false case 0:26 Equal ( temp 4-component vector of bool)
0:? Sequence
0:26 Branch: Return with expression
0:26 Negate value ( temp 4-component vector of float)
0:26 'input' ( in 4-component vector of float) 0:26 'input' ( in 4-component vector of float)
0:30 Test condition and select ( temp void) 0:26 'input' ( in 4-component vector of float)
0:30 Condition 0:26 true case is null
0:30 Convert float to bool ( temp bool) 0:31 Test condition and select ( temp void): Flatten
0:30 move second child to first child ( temp float) 0:31 Condition
0:30 'ii' ( temp float) 0:31 all ( temp bool)
0:30 direct index ( temp float) 0:31 Equal ( temp 4-component vector of bool)
0:30 'input' ( in 4-component vector of float) 0:31 'input' ( in 4-component vector of float)
0:30 Constant: 0:31 'input' ( in 4-component vector of float)
0:30 2 (const int) 0:31 true case
0:30 true case 0:? Sequence
0:31 Pre-Increment ( temp float) 0:32 Branch: Return with expression
0:31 'ii' ( temp float) 0:32 'input' ( in 4-component vector of float)
0:32 Pre-Increment ( temp int) 0:35 Function Call: f1(vf4; ( temp 4-component vector of float)
0:32 'ii' ( temp int) 0:35 'input' ( in 4-component vector of float)
0:33 Test condition and select ( temp void) 0:38 Test condition and select ( temp void)
0:33 Condition 0:38 Condition
0:33 Compare Equal ( temp bool) 0:38 Convert float to bool ( temp bool)
0:33 Convert int to float ( temp float) 0:38 move second child to first child ( temp float)
0:33 'ii' ( temp int) 0:38 'ii' ( temp float)
0:33 Constant: 0:38 direct index ( temp float)
0:33 1.000000 0:38 'input' ( in 4-component vector of float)
0:33 true case 0:38 Constant:
0:34 Pre-Increment ( temp int) 0:38 2 (const int)
0:34 'ii' ( temp int) 0:38 true case
0:2 Function Definition: PixelShaderFunction( ( temp void) 0:39 Pre-Increment ( temp float)
0:2 Function Parameters: 0:39 'ii' ( temp float)
0:40 Pre-Increment ( temp int)
0:40 'ii' ( temp int)
0:41 Test condition and select ( temp void)
0:41 Condition
0:41 Compare Equal ( temp bool)
0:41 Convert int to float ( temp float)
0:41 'ii' ( temp int)
0:41 Constant:
0:41 1.000000
0:41 true case
0:42 Pre-Increment ( temp int)
0:42 'ii' ( temp int)
0:17 Function Definition: PixelShaderFunction( ( temp void)
0:17 Function Parameters:
0:? Sequence 0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float) 0:17 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp 4-component vector of float) 0:17 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:17 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
...@@ -217,154 +241,178 @@ gl_FragCoord origin is upper left ...@@ -217,154 +241,178 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 103 // Id's are bound by 117
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 96 99 EntryPoint Fragment 4 "PixelShaderFunction" 110 113
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "@PixelShaderFunction(vf4;" Name 11 "f0(vf4;"
Name 10 "input" Name 10 "input"
Name 68 "ii" Name 14 "f1(vf4;"
Name 13 "input"
Name 17 "@PixelShaderFunction(vf4;"
Name 16 "input"
Name 55 "param"
Name 78 "param"
Name 82 "ii" Name 82 "ii"
Name 94 "input" Name 96 "ii"
Name 96 "input" Name 108 "input"
Name 99 "@entryPointOutput" Name 110 "input"
Name 100 "param" Name 113 "@entryPointOutput"
Decorate 96(input) Location 0 Name 114 "param"
Decorate 99(@entryPointOutput) Location 0 Decorate 110(input) Location 0
Decorate 113(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4) 8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 9: TypeFunction 7(fvec4) 8(ptr)
15: TypeBool 21: TypeBool
16: TypeVector 15(bool) 4 22: TypeVector 21(bool) 4
67: TypePointer Function 6(float) 81: TypePointer Function 6(float)
69: TypeInt 32 0 83: TypeInt 32 0
70: 69(int) Constant 2 84: 83(int) Constant 2
73: 6(float) Constant 0 87: 6(float) Constant 0
78: 6(float) Constant 1065353216 92: 6(float) Constant 1065353216
80: TypeInt 32 1 94: TypeInt 32 1
81: TypePointer Function 80(int) 95: TypePointer Function 94(int)
84: 80(int) Constant 1 98: 94(int) Constant 1
95: TypePointer Input 7(fvec4) 109: TypePointer Input 7(fvec4)
96(input): 95(ptr) Variable Input 110(input): 109(ptr) Variable Input
98: TypePointer Output 7(fvec4) 112: TypePointer Output 7(fvec4)
99(@entryPointOutput): 98(ptr) Variable Output 113(@entryPointOutput): 112(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
94(input): 8(ptr) Variable Function 108(input): 8(ptr) Variable Function
100(param): 8(ptr) Variable Function 114(param): 8(ptr) Variable Function
97: 7(fvec4) Load 96(input) 111: 7(fvec4) Load 110(input)
Store 94(input) 97 Store 108(input) 111
101: 7(fvec4) Load 94(input) 115: 7(fvec4) Load 108(input)
Store 100(param) 101 Store 114(param) 115
102: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 100(param) 116: 7(fvec4) FunctionCall 17(@PixelShaderFunction(vf4;) 114(param)
Store 99(@entryPointOutput) 102 Store 113(@entryPointOutput) 116
Return Return
FunctionEnd FunctionEnd
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9 11(f0(vf4;): 7(fvec4) Function None 9
10(input): 8(ptr) FunctionParameter 10(input): 8(ptr) FunctionParameter
12: Label 12: Label
68(ii): 67(ptr) Variable Function 19: 7(fvec4) Load 10(input)
82(ii): 81(ptr) Variable Function 20: 7(fvec4) Load 10(input)
13: 7(fvec4) Load 10(input) 23: 22(bvec4) FOrdEqual 19 20
14: 7(fvec4) Load 10(input) 24: 21(bool) All 23
17: 16(bvec4) FOrdEqual 13 14 SelectionMerge 26 None
18: 15(bool) All 17 BranchConditional 24 25 29
SelectionMerge 20 None 25: Label
BranchConditional 18 19 20 27: 7(fvec4) Load 10(input)
19: Label ReturnValue 27
21: 7(fvec4) Load 10(input) 29: Label
ReturnValue 21 30: 7(fvec4) Load 10(input)
20: Label 31: 7(fvec4) FNegate 30
23: 7(fvec4) Load 10(input) ReturnValue 31
24: 7(fvec4) Load 10(input) 26: Label
25: 16(bvec4) FOrdEqual 23 24 Unreachable
26: 15(bool) All 25 FunctionEnd
SelectionMerge 28 None 14(f1(vf4;): 7(fvec4) Function None 9
BranchConditional 26 27 31 13(input): 8(ptr) FunctionParameter
27: Label 15: Label
29: 7(fvec4) Load 10(input) 34: 7(fvec4) Load 13(input)
ReturnValue 29 35: 7(fvec4) Load 13(input)
31: Label 36: 22(bvec4) FOrdEqual 34 35
32: 7(fvec4) Load 10(input) 37: 21(bool) All 36
33: 7(fvec4) FNegate 32 SelectionMerge 39 None
ReturnValue 33 BranchConditional 37 38 42
28: Label 38: Label
35: 7(fvec4) Load 10(input) 40: 7(fvec4) Load 13(input)
36: 7(fvec4) Load 10(input) ReturnValue 40
37: 16(bvec4) FOrdEqual 35 36 42: Label
38: 15(bool) All 37 43: 7(fvec4) Load 13(input)
SelectionMerge 40 None 44: 7(fvec4) FNegate 43
BranchConditional 38 39 40 ReturnValue 44
39: Label 39: Label
Branch 40 Unreachable
40: Label FunctionEnd
41: 7(fvec4) Load 10(input) 17(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
42: 7(fvec4) Load 10(input) 16(input): 8(ptr) FunctionParameter
43: 16(bvec4) FOrdEqual 41 42 18: Label
44: 15(bool) All 43 55(param): 8(ptr) Variable Function
SelectionMerge 46 None 78(param): 8(ptr) Variable Function
BranchConditional 44 45 46 82(ii): 81(ptr) Variable Function
45: Label 96(ii): 95(ptr) Variable Function
Branch 46 47: 7(fvec4) Load 16(input)
46: Label 48: 7(fvec4) Load 16(input)
47: 7(fvec4) Load 10(input) 49: 22(bvec4) FOrdEqual 47 48
48: 7(fvec4) Load 10(input) 50: 21(bool) All 49
49: 16(bvec4) FOrdEqual 47 48 SelectionMerge 52 None
50: 15(bool) All 49
SelectionMerge 52 Flatten
BranchConditional 50 51 52 BranchConditional 50 51 52
51: Label 51: Label
53: 7(fvec4) Load 10(input) 53: 7(fvec4) Load 16(input)
ReturnValue 53 ReturnValue 53
52: Label 52: Label
55: 7(fvec4) Load 10(input) 56: 7(fvec4) Load 16(input)
56: 7(fvec4) Load 10(input) Store 55(param) 56
57: 16(bvec4) FOrdEqual 55 56 57: 7(fvec4) FunctionCall 11(f0(vf4;) 55(param)
58: 15(bool) All 57 58: 7(fvec4) Load 16(input)
SelectionMerge 60 None 59: 7(fvec4) Load 16(input)
BranchConditional 58 59 63 60: 22(bvec4) FOrdEqual 58 59
59: Label 61: 21(bool) All 60
61: 7(fvec4) Load 10(input) SelectionMerge 63 None
ReturnValue 61 BranchConditional 61 62 63
62: Label
Branch 63
63: Label 63: Label
64: 7(fvec4) Load 10(input) 64: 7(fvec4) Load 16(input)
65: 7(fvec4) FNegate 64 65: 7(fvec4) Load 16(input)
ReturnValue 65 66: 22(bvec4) FOrdEqual 64 65
60: Label 67: 21(bool) All 66
71: 67(ptr) AccessChain 10(input) 70 SelectionMerge 69 None
72: 6(float) Load 71 BranchConditional 67 68 69
Store 68(ii) 72 68: Label
74: 15(bool) FOrdNotEqual 72 73 Branch 69
SelectionMerge 76 None 69: Label
BranchConditional 74 75 76 70: 7(fvec4) Load 16(input)
71: 7(fvec4) Load 16(input)
72: 22(bvec4) FOrdEqual 70 71
73: 21(bool) All 72
SelectionMerge 75 Flatten
BranchConditional 73 74 75
74: Label
76: 7(fvec4) Load 16(input)
ReturnValue 76
75: Label 75: Label
77: 6(float) Load 68(ii) 79: 7(fvec4) Load 16(input)
79: 6(float) FAdd 77 78 Store 78(param) 79
Store 68(ii) 79 80: 7(fvec4) FunctionCall 14(f1(vf4;) 78(param)
Branch 76 85: 81(ptr) AccessChain 16(input) 84
76: Label 86: 6(float) Load 85
83: 80(int) Load 82(ii) Store 82(ii) 86
85: 80(int) IAdd 83 84 88: 21(bool) FOrdNotEqual 86 87
Store 82(ii) 85
86: 80(int) Load 82(ii)
87: 6(float) ConvertSToF 86
88: 15(bool) FOrdEqual 87 78
SelectionMerge 90 None SelectionMerge 90 None
BranchConditional 88 89 90 BranchConditional 88 89 90
89: Label 89: Label
91: 80(int) Load 82(ii) 91: 6(float) Load 82(ii)
92: 80(int) IAdd 91 84 93: 6(float) FAdd 91 92
Store 82(ii) 92 Store 82(ii) 93
Branch 90 Branch 90
90: Label 90: Label
93: 7(fvec4) Undef 97: 94(int) Load 96(ii)
ReturnValue 93 99: 94(int) IAdd 97 98
Store 96(ii) 99
100: 94(int) Load 96(ii)
101: 6(float) ConvertSToF 100
102: 21(bool) FOrdEqual 101 92
SelectionMerge 104 None
BranchConditional 102 103 104
103: Label
105: 94(int) Load 96(ii)
106: 94(int) IAdd 105 98
Store 96(ii) 106
Branch 104
104: Label
107: 7(fvec4) Undef
ReturnValue 107
FunctionEnd FunctionEnd
...@@ -305,6 +305,5 @@ gl_FragCoord origin is upper left ...@@ -305,6 +305,5 @@ gl_FragCoord origin is upper left
66: 9(fvec4) CompositeConstruct 65 65 65 65 66: 9(fvec4) CompositeConstruct 65 65 65 65
ReturnValue 66 ReturnValue 66
45: Label 45: Label
68: 9(fvec4) Undef Unreachable
ReturnValue 68
FunctionEnd FunctionEnd
...@@ -344,6 +344,5 @@ gl_FragCoord origin is upper left ...@@ -344,6 +344,5 @@ gl_FragCoord origin is upper left
84: 9(fvec4) CompositeConstruct 83 83 83 83 84: 9(fvec4) CompositeConstruct 83 83 83 83
ReturnValue 84 ReturnValue 84
53: Label 53: Label
86: 9(fvec4) Undef Unreachable
ReturnValue 86
FunctionEnd FunctionEnd
...@@ -303,6 +303,5 @@ gl_FragCoord origin is upper left ...@@ -303,6 +303,5 @@ gl_FragCoord origin is upper left
66: 9(fvec4) CompositeConstruct 65 65 65 65 66: 9(fvec4) CompositeConstruct 65 65 65 65
ReturnValue 66 ReturnValue 66
45: Label 45: Label
68: 9(fvec4) Undef Unreachable
ReturnValue 68
FunctionEnd FunctionEnd
...@@ -118,6 +118,5 @@ gl_FragCoord origin is upper left ...@@ -118,6 +118,5 @@ gl_FragCoord origin is upper left
23: Label 23: Label
ReturnValue 24 ReturnValue 24
16: Label 16: Label
26: 7(fvec4) Undef Unreachable
ReturnValue 26
FunctionEnd FunctionEnd
...@@ -88,7 +88,7 @@ remap.similar_1a.everything.frag ...@@ -88,7 +88,7 @@ remap.similar_1a.everything.frag
22102: 649(ptr) Variable Function 22102: 649(ptr) Variable Function
24151: 12(int) Load 4408 24151: 12(int) Load 4408
13868: 9(bool) SGreaterThan 24151 2577 13868: 9(bool) SGreaterThan 24151 2577
SelectionMerge 22309 None SelectionMerge 14966 None
BranchConditional 13868 9492 17416 BranchConditional 13868 9492 17416
9492: Label 9492: Label
15624: 12(int) Load 4408 15624: 12(int) Load 4408
...@@ -109,7 +109,6 @@ remap.similar_1a.everything.frag ...@@ -109,7 +109,6 @@ remap.similar_1a.everything.frag
10505: 12(int) IAdd 11462 21176 10505: 12(int) IAdd 11462 21176
14626: 13(float) ConvertSToF 10505 14626: 13(float) ConvertSToF 10505
ReturnValue 14626 ReturnValue 14626
22309: Label 14966: Label
6429: 13(float) Undef Unreachable
ReturnValue 6429
FunctionEnd FunctionEnd
...@@ -124,6 +124,5 @@ remap.similar_1a.none.frag ...@@ -124,6 +124,5 @@ remap.similar_1a.none.frag
68: 8(float) ConvertSToF 67 68: 8(float) ConvertSToF 67
ReturnValue 68 ReturnValue 68
43: Label 43: Label
70: 8(float) Undef Unreachable
ReturnValue 70
FunctionEnd FunctionEnd
...@@ -93,7 +93,7 @@ remap.similar_1b.everything.frag ...@@ -93,7 +93,7 @@ remap.similar_1b.everything.frag
22102: 649(ptr) Variable Function 22102: 649(ptr) Variable Function
24151: 12(int) Load 4408 24151: 12(int) Load 4408
13868: 9(bool) SGreaterThan 24151 2577 13868: 9(bool) SGreaterThan 24151 2577
SelectionMerge 22309 None SelectionMerge 14966 None
BranchConditional 13868 10822 17416 BranchConditional 13868 10822 17416
10822: Label 10822: Label
22680: 12(int) Load 4408 22680: 12(int) Load 4408
...@@ -115,7 +115,6 @@ remap.similar_1b.everything.frag ...@@ -115,7 +115,6 @@ remap.similar_1b.everything.frag
10505: 12(int) IAdd 11462 21176 10505: 12(int) IAdd 11462 21176
14626: 13(float) ConvertSToF 10505 14626: 13(float) ConvertSToF 10505
ReturnValue 14626 ReturnValue 14626
22309: Label 14966: Label
6429: 13(float) Undef Unreachable
ReturnValue 6429
FunctionEnd FunctionEnd
...@@ -130,6 +130,5 @@ remap.similar_1b.none.frag ...@@ -130,6 +130,5 @@ remap.similar_1b.none.frag
73: 8(float) ConvertSToF 72 73: 8(float) ConvertSToF 72
ReturnValue 73 ReturnValue 73
46: Label 46: Label
75: 8(float) Undef Unreachable
ReturnValue 75
FunctionEnd FunctionEnd
spv.controlFlowAttributes.frag spv.controlFlowAttributes.frag
WARNING: 0:20: 'unroll' : expected no arguments WARNING: 0:27: 'unroll' : expected no arguments
WARNING: 0:21: 'dont_unroll' : expected no arguments WARNING: 0:28: 'dont_unroll' : expected no arguments
WARNING: 0:22: 'dependency_infinite' : expected no arguments WARNING: 0:29: 'dependency_infinite' : expected no arguments
WARNING: 0:23: 'dependency_length' : expected a single integer argument WARNING: 0:30: 'dependency_length' : expected a single integer argument
WARNING: 0:24: '' : attribute with arguments not recognized, skipping WARNING: 0:31: '' : attribute with arguments not recognized, skipping
WARNING: 0:25: '' : attribute with arguments not recognized, skipping WARNING: 0:32: '' : attribute with arguments not recognized, skipping
WARNING: 0:26: '' : attribute with arguments not recognized, skipping WARNING: 0:33: '' : attribute with arguments not recognized, skipping
Validation failed Validation failed
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 118 // Id's are bound by 123
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -20,220 +20,231 @@ Validation failed ...@@ -20,220 +20,231 @@ Validation failed
Source GLSL 450 Source GLSL 450
SourceExtension "GL_EXT_control_flow_attributes" SourceExtension "GL_EXT_control_flow_attributes"
Name 4 "main" Name 4 "main"
Name 8 "i" Name 6 "f0("
Name 36 "i" Name 8 "f1("
Name 47 "cond" Name 23 "i"
Name 60 "i" Name 41 "i"
Name 79 "i" Name 52 "cond"
Name 65 "i"
Name 84 "i"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 19: TypeBool
7: TypePointer Function 6(int) 20: 19(bool) ConstantTrue
9: 6(int) Constant 0 21: TypeInt 32 1
16: 6(int) Constant 8 22: TypePointer Function 21(int)
17: TypeBool 24: 21(int) Constant 0
20: 6(int) Constant 1 31: 21(int) Constant 8
31: 17(bool) ConstantTrue 34: 21(int) Constant 1
46: TypePointer Private 17(bool) 51: TypePointer Private 19(bool)
47(cond): 46(ptr) Variable Private 52(cond): 51(ptr) Variable Private
54: 17(bool) ConstantFalse 59: 19(bool) ConstantFalse
55: 6(int) Constant 3 60: 21(int) Constant 3
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
8(i): 7(ptr) Variable Function 23(i): 22(ptr) Variable Function
36(i): 7(ptr) Variable Function 41(i): 22(ptr) Variable Function
60(i): 7(ptr) Variable Function 65(i): 22(ptr) Variable Function
79(i): 7(ptr) Variable Function 84(i): 22(ptr) Variable Function
Store 8(i) 9 Store 23(i) 24
Branch 10
10: Label
LoopMerge 12 13 Unroll
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Branch 13
13: Label
19: 6(int) Load 8(i)
21: 6(int) IAdd 19 20
Store 8(i) 21
Branch 10
12: Label
Branch 22
22: Label
LoopMerge 24 25 DontUnroll
Branch 23
23: Label
Branch 25 Branch 25
25: Label 25: Label
Branch 22 LoopMerge 27 28 Unroll
24: Label
Branch 26
26: Label
LoopMerge 28 29 DontUnroll
Branch 30
30: Label
BranchConditional 31 27 28
27: Label
Branch 29 Branch 29
29: Label 29: Label
Branch 26 30: 21(int) Load 23(i)
32: 19(bool) SLessThan 30 31
BranchConditional 32 26 27
26: Label
Branch 28
28: Label 28: Label
Branch 32 33: 21(int) Load 23(i)
32: Label 35: 21(int) IAdd 33 34
LoopMerge 34 35 DependencyInfinite Store 23(i) 35
Branch 33 Branch 25
33: Label 27: Label
Branch 35 36: 2 FunctionCall 6(f0()
35: Label
BranchConditional 31 32 34
34: Label
Store 36(i) 9
Branch 37 Branch 37
37: Label 37: Label
LoopMerge 39 40 DependencyLength 4 LoopMerge 39 40 DependencyInfinite
Branch 41 Branch 38
41: Label
42: 6(int) Load 36(i)
43: 17(bool) SLessThan 42 16
BranchConditional 43 38 39
38: Label 38: Label
Branch 40 Branch 40
40: Label 40: Label
44: 6(int) Load 36(i) BranchConditional 20 37 39
45: 6(int) IAdd 44 20
Store 36(i) 45
Branch 37
39: Label 39: Label
48: 17(bool) Load 47(cond) Store 41(i) 24
SelectionMerge 50 Flatten Branch 42
BranchConditional 48 49 50 42: Label
49: Label LoopMerge 44 45 DependencyLength 4
Branch 50 Branch 46
50: Label 46: Label
51: 17(bool) Load 47(cond) 47: 21(int) Load 41(i)
SelectionMerge 53 DontFlatten 48: 19(bool) SLessThan 47 31
BranchConditional 51 52 53 BranchConditional 48 43 44
52: Label 43: Label
Store 47(cond) 54 Branch 45
Branch 53 45: Label
53: Label 49: 21(int) Load 41(i)
SelectionMerge 57 DontFlatten 50: 21(int) IAdd 49 34
Switch 55 57 Store 41(i) 50
case 3: 56 Branch 42
56: Label 44: Label
Branch 57 53: 19(bool) Load 52(cond)
SelectionMerge 55 Flatten
BranchConditional 53 54 55
54: Label
Branch 55
55: Label
56: 19(bool) Load 52(cond)
SelectionMerge 58 DontFlatten
BranchConditional 56 57 58
57: Label 57: Label
Store 60(i) 9 Store 52(cond) 59
Branch 61 Branch 58
58: Label
SelectionMerge 62 DontFlatten
Switch 60 62
case 3: 61
61: Label 61: Label
LoopMerge 63 64 None Branch 62
Branch 65
65: Label
66: 6(int) Load 60(i)
67: 17(bool) SLessThan 66 16
BranchConditional 67 62 63
62: Label 62: Label
Branch 64 Store 65(i) 24
64: Label Branch 66
68: 6(int) Load 60(i) 66: Label
69: 6(int) IAdd 68 20 LoopMerge 68 69 None
Store 60(i) 69
Branch 61
63: Label
Branch 70 Branch 70
70: Label 70: Label
LoopMerge 72 73 None 71: 21(int) Load 65(i)
Branch 74 72: 19(bool) SLessThan 71 31
74: Label BranchConditional 72 67 68
BranchConditional 31 71 72 67: Label
71: Label Branch 69
Branch 73 69: Label
73: Label 73: 21(int) Load 65(i)
Branch 70 74: 21(int) IAdd 73 34
72: Label Store 65(i) 74
Branch 66
68: Label
Branch 75 Branch 75
75: Label 75: Label
LoopMerge 77 78 None LoopMerge 77 78 None
Branch 76 Branch 79
79: Label
BranchConditional 20 76 77
76: Label 76: Label
Branch 78 Branch 78
78: Label 78: Label
BranchConditional 31 75 77 Branch 75
77: Label 77: Label
Store 79(i) 9
Branch 80 Branch 80
80: Label 80: Label
LoopMerge 82 83 None LoopMerge 82 83 None
Branch 84 Branch 81
84: Label
85: 6(int) Load 79(i)
86: 17(bool) SLessThan 85 16
BranchConditional 86 81 82
81: Label 81: Label
Branch 83 Branch 83
83: Label 83: Label
87: 6(int) Load 79(i) BranchConditional 20 80 82
88: 6(int) IAdd 87 20
Store 79(i) 88
Branch 80
82: Label 82: Label
89: 17(bool) Load 47(cond) Store 84(i) 24
SelectionMerge 91 None Branch 85
BranchConditional 89 90 91 85: Label
90: Label LoopMerge 87 88 None
Branch 91 Branch 89
91: Label 89: Label
92: 17(bool) Load 47(cond) 90: 21(int) Load 84(i)
SelectionMerge 94 None 91: 19(bool) SLessThan 90 31
BranchConditional 92 93 94 BranchConditional 91 86 87
93: Label 86: Label
Store 47(cond) 54 Branch 88
Branch 94 88: Label
94: Label 92: 21(int) Load 84(i)
93: 21(int) IAdd 92 34
Store 84(i) 93
Branch 85
87: Label
94: 19(bool) Load 52(cond)
SelectionMerge 96 None SelectionMerge 96 None
Switch 55 96 BranchConditional 94 95 96
case 3: 95
95: Label 95: Label
Branch 96 Branch 96
96: Label 96: Label
97: 19(bool) Load 52(cond)
SelectionMerge 99 None
BranchConditional 97 98 99
98: Label
Store 52(cond) 59
Branch 99 Branch 99
99: Label 99: Label
LoopMerge 101 102 Unroll DontUnroll DependencyLength 2 SelectionMerge 101 None
Branch 103 Switch 60 101
103: Label case 3: 100
104: 17(bool) Load 47(cond)
BranchConditional 104 100 101
100: Label 100: Label
Branch 102 Branch 101
102: Label
Branch 99
101: Label 101: Label
SelectionMerge 106 DontFlatten Branch 104
Switch 55 106 104: Label
case 3: 105 LoopMerge 106 107 Unroll DontUnroll DependencyLength 2
Branch 108
108: Label
109: 19(bool) Load 52(cond)
BranchConditional 109 105 106
105: Label 105: Label
Branch 106 Branch 107
107: Label
Branch 104
106: Label 106: Label
109: 17(bool) Load 47(cond) SelectionMerge 111 DontFlatten
SelectionMerge 111 Flatten Switch 60 111
BranchConditional 109 110 111 case 3: 110
110: Label 110: Label
Branch 111 Branch 111
111: Label 111: Label
Branch 112 114: 19(bool) Load 52(cond)
112: Label SelectionMerge 116 Flatten
LoopMerge 114 115 DependencyInfinite BranchConditional 114 115 116
115: Label
Branch 116 Branch 116
116: Label 116: Label
117: 17(bool) Load 47(cond) Branch 117
BranchConditional 117 113 114 117: Label
113: Label LoopMerge 119 120 DependencyInfinite
Branch 115 Branch 121
115: Label 121: Label
Branch 112 122: 19(bool) Load 52(cond)
114: Label BranchConditional 122 118 119
118: Label
Branch 120
120: Label
Branch 117
119: Label
Return
FunctionEnd
6(f0(): 2 Function None 3
7: Label
Branch 10
10: Label
LoopMerge 12 13 DontUnroll
Branch 11
11: Label
Branch 13
13: Label
Branch 10
12: Label
Unreachable
FunctionEnd
8(f1(): 2 Function None 3
9: Label
Branch 14
14: Label
LoopMerge 16 17 DontUnroll
Branch 18
18: Label
BranchConditional 20 15 16
15: Label
Branch 17
17: Label
Branch 14
16: Label
Return Return
FunctionEnd FunctionEnd
spv.dead-after-continue.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 29
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 20 28
Source GLSL 450
Name 4 "main"
Name 8 "i"
Name 20 "o"
Name 28 "c"
Decorate 20(o) Location 0
Decorate 28(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
16: 6(int) Constant 5
17: TypeBool
19: TypePointer Output 6(int)
20(o): 19(ptr) Variable Output
21: 6(int) Constant 1
23: 6(int) Constant 2
26: 6(int) Constant 3
27: TypePointer Input 6(int)
28(c): 27(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
LoopMerge 12 13 None
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Store 20(o) 21
Branch 13
13: Label
24: 6(int) Load 8(i)
25: 6(int) IAdd 24 21
Store 8(i) 25
Branch 10
12: Label
Store 20(o) 26
Return
FunctionEnd
spv.dead-after-discard.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 15
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 14
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 8 "o"
Name 14 "c"
Decorate 8(o) Location 0
Decorate 14(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(o): 7(ptr) Variable Output
9: 6(int) Constant 1
11: 6(int) Constant 3
12: TypeFloat 32
13: TypePointer Input 12(float)
14(c): 13(ptr) Variable Input
4(main): 2 Function None 3
5: Label
Store 8(o) 9
Kill
FunctionEnd
spv.dead-after-loop-break.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 36
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 8 25
Source GLSL 450
Name 4 "main"
Name 8 "o"
Name 11 "i"
Name 25 "c"
Decorate 8(o) Location 0
Decorate 25(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(o): 7(ptr) Variable Output
9: 6(int) Constant 1
10: TypePointer Function 6(int)
12: 6(int) Constant 0
19: 6(int) Constant 5
20: TypeBool
22: 6(int) Constant 2
24: TypePointer Input 6(int)
25(c): 24(ptr) Variable Input
30: 6(int) Constant 3
32: 6(int) Constant 4
35: 6(int) Constant 6
4(main): 2 Function None 3
5: Label
11(i): 10(ptr) Variable Function
Store 8(o) 9
Store 11(i) 12
Branch 13
13: Label
LoopMerge 15 16 None
Branch 17
17: Label
18: 6(int) Load 11(i)
21: 20(bool) SLessThan 18 19
BranchConditional 21 14 15
14: Label
Store 8(o) 22
23: 6(int) Load 11(i)
26: 6(int) Load 25(c)
27: 20(bool) IEqual 23 26
SelectionMerge 29 None
BranchConditional 27 28 29
28: Label
Store 8(o) 30
Branch 15
29: Label
Store 8(o) 19
Branch 16
16: Label
33: 6(int) Load 11(i)
34: 6(int) IAdd 33 9
Store 11(i) 34
Branch 13
15: Label
Store 8(o) 35
Return
FunctionEnd
spv.dead-after-return.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 14
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 8 13
Source GLSL 450
Name 4 "main"
Name 8 "o"
Name 13 "c"
Decorate 8(o) Location 0
Decorate 13(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(o): 7(ptr) Variable Output
9: 6(int) Constant 1
11: 6(int) Constant 3
12: TypePointer Input 6(int)
13(c): 12(ptr) Variable Input
4(main): 2 Function None 3
5: Label
Store 8(o) 9
Return
FunctionEnd
spv.dead-after-switch-break.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 21
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 8 14
Source GLSL 450
Name 4 "main"
Name 8 "c"
Name 14 "o"
Decorate 8(c) Location 0
Decorate 14(o) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Input 6(int)
8(c): 7(ptr) Variable Input
13: TypePointer Output 6(int)
14(o): 13(ptr) Variable Output
15: 6(int) Constant 1
17: 6(int) Constant 2
20: 6(int) Constant 3
4(main): 2 Function None 3
5: Label
9: 6(int) Load 8(c)
SelectionMerge 12 None
Switch 9 11
case 0: 10
11: Label
Branch 12
10: Label
Store 14(o) 15
Branch 12
12: Label
Store 14(o) 20
Return
FunctionEnd
spv.dead-complex-continue-after-return.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 11 30
Source GLSL 450
Name 4 "main"
Name 8 "i"
Name 11 "o"
Name 30 "c"
Decorate 11(o) Location 0
Decorate 30(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
10: TypePointer Output 6(int)
11(o): 10(ptr) Variable Output
12: 6(int) Constant 1
19: 6(int) Constant 5
20: TypeBool
22: 6(int) Constant 2
24: 6(int) Constant 3
27: 6(int) Constant 99
28: 6(int) Constant 4
29: TypePointer Input 6(int)
30(c): 29(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Store 11(o) 12
Store 8(i) 9
Branch 13
13: Label
LoopMerge 15 16 None
Branch 17
17: Label
18: 6(int) Load 8(i)
21: 20(bool) SLessThan 18 19
BranchConditional 21 14 15
14: Label
Store 11(o) 22
Return
16: Label
Branch 13
15: Label
Store 11(o) 28
Return
FunctionEnd
spv.dead-complex-merge-after-return.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 36
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 11 27
Source GLSL 450
Name 4 "main"
Name 8 "i"
Name 11 "o"
Name 27 "c"
Decorate 11(o) Location 0
Decorate 27(c) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
10: TypePointer Output 6(int)
11(o): 10(ptr) Variable Output
12: 6(int) Constant 1
17: 6(int) Constant 2
19: 6(int) Constant 3
22: 6(int) Constant 5
23: TypeBool
25: 6(int) Constant 4
26: TypePointer Input 6(int)
27(c): 26(ptr) Variable Input
32: 6(int) Constant 100
34: 6(int) Constant 200
35: 6(int) Constant 300
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Store 11(o) 12
Branch 13
13: Label
LoopMerge 15 16 None
Branch 14
14: Label
Store 11(o) 17
Return
16: Label
Branch 13
15: Label
Unreachable
FunctionEnd
...@@ -160,7 +160,7 @@ spv.earlyReturnDiscard.frag ...@@ -160,7 +160,7 @@ spv.earlyReturnDiscard.frag
102: Label 102: Label
Return Return
100: Label 100: Label
Branch 67 Unreachable
67: Label 67: Label
106: 7(fvec4) Load 9(color) 106: 7(fvec4) Load 9(color)
107: 7(fvec4) Load 13(color2) 107: 7(fvec4) Load 13(color2)
......
...@@ -38,5 +38,5 @@ spv.for-notest.vert ...@@ -38,5 +38,5 @@ spv.for-notest.vert
Store 8(i) 19 Store 8(i) 19
Branch 10 Branch 10
12: Label 12: Label
Return Unreachable
FunctionEnd FunctionEnd
...@@ -99,8 +99,7 @@ spv.forwardFun.frag ...@@ -99,8 +99,7 @@ spv.forwardFun.frag
45: Label 45: Label
ReturnValue 46 ReturnValue 46
42: Label 42: Label
48: 8(float) Undef Unreachable
ReturnValue 48
FunctionEnd FunctionEnd
16(foo(vf4;): 8(float) Function None 14 16(foo(vf4;): 8(float) Function None 14
15(bar): 13(ptr) FunctionParameter 15(bar): 13(ptr) FunctionParameter
......
...@@ -105,8 +105,7 @@ WARNING: 0:5: varying deprecated in version 130; may be removed in future releas ...@@ -105,8 +105,7 @@ WARNING: 0:5: varying deprecated in version 130; may be removed in future releas
44: Label 44: Label
ReturnValue 45 ReturnValue 45
41: Label 41: Label
47: 6(float) Undef Unreachable
ReturnValue 47
FunctionEnd FunctionEnd
18(missingReturn(): 6(float) Function None 15 18(missingReturn(): 6(float) Function None 15
19: Label 19: Label
......
...@@ -37,5 +37,5 @@ spv.merge-unreachable.frag ...@@ -37,5 +37,5 @@ spv.merge-unreachable.frag
23: Label 23: Label
Return Return
21: Label 21: Label
Return Unreachable
FunctionEnd FunctionEnd
float4 PixelShaderFunction(float input) : COLOR0 void f0() {
{
[unroll] do {} while (false); [unroll] do {} while (false);
}
void f1() {
[unroll] do {;} while (false); [unroll] do {;} while (false);
}
float f2(float input) {
do { return (float4)input; } while (input > 2.0); do { return (float4)input; } while (input > 2.0);
}
void f3(float input) {
do ++input; while (input < 10.0); do ++input; while (input < 10.0);
}
void f4(float input) {
do while (++input < 10.0); while (++input < 10.0); // nest while inside do-while do while (++input < 10.0); while (++input < 10.0); // nest while inside do-while
}
float4 PixelShaderFunction(float input) : COLOR0
{
f0();
f1();
f2(input);
f3(input);
f4(input);
return (float4)input; return (float4)input;
} }
float4 PixelShaderFunction(float4 input) : COLOR0 void f0() {
{
for (;;) ; for (;;) ;
}
void f1(float4 input) {
for (++input; ; ) ; for (++input; ; ) ;
}
void f2(float4 input) {
[unroll] for (; any(input != input); ) {} [unroll] for (; any(input != input); ) {}
}
float f3(float4 input) {
for (; any(input != input); ) { return -input; } for (; any(input != input); ) { return -input; }
}
float f4(float4 input) {
for (--input; any(input != input); input += 2) { return -input; } for (--input; any(input != input); input += 2) { return -input; }
}
void f5(float4 input) {
for (;;) if (input.x > 2.0) break; for (;;) if (input.x > 2.0) break;
}
void f6(float4 input) {
for (;;) if (input.x > 2.0) continue; for (;;) if (input.x > 2.0) continue;
}
void f99() {
for (int first = 0, second = 1; ;) first + second;
}
void f100(float ii) {
for (--ii, --ii, --ii;;) ii;
}
float4 PixelShaderFunction(float4 input) : COLOR0
{
f0();
f1(input);
f2(input);
f3(input);
f4(input);
f5(input);
f6(input);
float ii; float ii;
for (int ii = -1; ii < 3; ++ii) if (ii == 2) continue; for (int ii = -1; ii < 3; ++ii) if (ii == 2) continue;
--ii; --ii;
for (int first = 0, second = 1; ;) first + second;
f99();
for ( int i = 0, count = int(ii); i < count; i++ ); for ( int i = 0, count = int(ii); i < count; i++ );
for (float first = 0, second[2], third; first < second[0]; ++second[1]) first + second[1] + third; for (float first = 0, second[2], third; first < second[0]; ++second[1]) first + second[1] + third;
for (--ii, --ii, --ii;;) ii;
f100(ii);
return input;
} }
float4 PixelShaderFunction(float4 input) : COLOR0 float4 f0(float4 input) {
{
if (all(input == input)) if (all(input == input))
return input; return input;
else
return -input;
}
if (all(input == input)) float4 f1(float4 input) {
if (all(input == input)) {
return input; return input;
else } else {
return -input; return -input;
}
}
float4 PixelShaderFunction(float4 input) : COLOR0
{
if (all(input == input))
return input;
f0(input);
if (all(input == input)) if (all(input == input))
; ;
...@@ -20,11 +32,7 @@ float4 PixelShaderFunction(float4 input) : COLOR0 ...@@ -20,11 +32,7 @@ float4 PixelShaderFunction(float4 input) : COLOR0
return input; return input;
} }
if (all(input == input)) { f1(input);
return input;
} else {
return -input;
}
int ii; int ii;
if (float ii = input.z) if (float ii = input.z)
......
...@@ -4,11 +4,18 @@ ...@@ -4,11 +4,18 @@
bool cond; bool cond;
void f0() {
[[loop]] for (;;) { }
}
void f1() {
[[dont_unroll]] while(true) { }
}
void main() void main()
{ {
[[unroll]] for (int i = 0; i < 8; ++i) { } [[unroll]] for (int i = 0; i < 8; ++i) { }
[[loop]] for (;;) { } f0();
[[dont_unroll]] while(true) { }
[[dependency_infinite]] do { } while(true); [[dependency_infinite]] do { } while(true);
[[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { } [[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { }
[[flatten]] if (cond) { } else { } [[flatten]] if (cond) { } else { }
......
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
int i;
for (i=0; i < 5; i++) {
o = 1;
continue;
o = 2;
}
o = 3;
}
#version 450
layout(location =0 ) in float c;
layout(location =0 ) out int o;
void main() {
o = 1;
discard;
o = 3;
}
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
int i;
o = 1;
for (i=0; i < 5; i++) {
o = 2;
if (i==c) {
o = 3;
break;
o = 4;
}
o = 5;
}
o = 6;
}
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
o = 1;
return;
o = 3;
}
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
int i;
switch(c) {
case 0: o=1;
break;
o=2;
default: break;
}
o = 3;
}
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
int i = 0;
o = 1;
// This has non-trivial continue target.
for (i=0; i < 5; ++i, o=99) {
o = 2;
return;
o = 3;
}
// This is considered reachable since Glslang codegen will
// create a conditional branch in the header, and one arm
// of that branch reaches this merge block.
o = 4;
}
#version 450
layout(location =0 ) in int c;
layout(location =0 ) out int o;
void main() {
int i = 0;
o = 1;
do {
o = 2;
return;
o = 3;
} while(i++ < 5);
// All this is a dead merge block.
o = 4;
if (c==4) {
o = 100;
} else {
o = 200;
}
o = 300;
}
...@@ -63,6 +63,7 @@ std::string FileNameAsCustomTestSuffixIoMap( ...@@ -63,6 +63,7 @@ std::string FileNameAsCustomTestSuffixIoMap(
} }
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>; using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>; using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
...@@ -85,6 +86,13 @@ TEST_P(CompileVulkanToSpirvTest, FromFile) ...@@ -85,6 +86,13 @@ TEST_P(CompileVulkanToSpirvTest, FromFile)
Target::Spv); Target::Spv);
} }
TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv);
}
// Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected // Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
// to successfully generate SPIR-V. // to successfully generate SPIR-V.
TEST_P(CompileVulkanToDebugSpirvTest, FromFile) TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
...@@ -417,6 +425,23 @@ INSTANTIATE_TEST_CASE_P( ...@@ -417,6 +425,23 @@ INSTANTIATE_TEST_CASE_P(
FileNameAsCustomTestSuffix FileNameAsCustomTestSuffix
); );
// Cases with deliberately unreachable code.
// By default the compiler will aggressively eliminate
// unreachable merges and continues.
INSTANTIATE_TEST_CASE_P(
GlslWithDeadCode, CompileVulkanToSpirvDeadCodeElimTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.dead-after-continue.vert",
"spv.dead-after-discard.frag",
"spv.dead-after-return.vert",
"spv.dead-after-loop-break.vert",
"spv.dead-after-switch-break.vert",
"spv.dead-complex-continue-after-return.vert",
"spv.dead-complex-merge-after-return.vert",
})),
FileNameAsCustomTestSuffix
);
// clang-format off // clang-format off
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToDebugSpirvTest, Glsl, CompileVulkanToDebugSpirvTest,
......
...@@ -113,7 +113,7 @@ public: ...@@ -113,7 +113,7 @@ public:
forceVersionProfile(false), forceVersionProfile(false),
isForwardCompatible(false) { isForwardCompatible(false) {
// Perform validation by default. // Perform validation by default.
validatorOptions.validate = true; spirvOptions.validate = true;
} }
// Tries to load the contents from the file at the given |path|. On success, // Tries to load the contents from the file at the given |path|. On success,
...@@ -693,14 +693,14 @@ public: ...@@ -693,14 +693,14 @@ public:
expectedOutputFname, result.spirvWarningsErrors); expectedOutputFname, result.spirvWarningsErrors);
} }
glslang::SpvOptions& options() { return validatorOptions; } glslang::SpvOptions& options() { return spirvOptions; }
private: private:
const int defaultVersion; const int defaultVersion;
const EProfile defaultProfile; const EProfile defaultProfile;
const bool forceVersionProfile; const bool forceVersionProfile;
const bool isForwardCompatible; const bool isForwardCompatible;
glslang::SpvOptions validatorOptions; glslang::SpvOptions spirvOptions;
}; };
} // namespace glslangtest } // namespace glslangtest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment