Commit 0f0f9795 by Ben Clayton

src/Pipeline: Misc fixes

Change `windowSpacePosition` from c-array to `std::array`. Other invocation state fields use `std::array`, and this simplifies some template logic in the new debugger implementation. Add / fix comments in `SpirvShaderControlFlow.cpp`. Also add a missing call to `dbgEndEmitInstruction()`. This is typically invoked by `SpirvShader::EmitInstruction()`, but the special handling of `OpPhi` in `EmitLoop()` previously skipped this. Bug: b/145351270 Change-Id: Id6463d5e157b28ef61ce8fc48644bcbc97a2aa55 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48696Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent c271e49f
...@@ -1370,7 +1370,7 @@ public: ...@@ -1370,7 +1370,7 @@ public:
// are only used when debugging. See b/146486064 for more information. // are only used when debugging. See b/146486064 for more information.
// Give careful consideration to the runtime performance loss before adding // Give careful consideration to the runtime performance loss before adding
// more state here. // more state here.
SIMD::Int windowSpacePosition[2]; std::array<SIMD::Int, 2> windowSpacePosition;
Int viewID; // slice offset into input attachments for multiview, even if the shader doesn't use ViewIndex Int viewID; // slice offset into input attachments for multiview, even if the shader doesn't use ViewIndex
Int instanceID; Int instanceID;
SIMD::Int vertexIndex; SIMD::Int vertexIndex;
......
...@@ -339,7 +339,7 @@ void SpirvShader::EmitLoop(EmitState *state) const ...@@ -339,7 +339,7 @@ void SpirvShader::EmitLoop(EmitState *state) const
// Gather all the blocks that make up the loop. // Gather all the blocks that make up the loop.
std::unordered_set<Block::ID> loopBlocks; std::unordered_set<Block::ID> loopBlocks;
loopBlocks.emplace(block.mergeBlock); loopBlocks.emplace(block.mergeBlock); // Stop traversal at mergeBlock.
function.TraverseReachableBlocks(blockId, loopBlocks); function.TraverseReachableBlocks(blockId, loopBlocks);
// incomingBlocks are block ins that are not back-edges. // incomingBlocks are block ins that are not back-edges.
...@@ -397,6 +397,7 @@ void SpirvShader::EmitLoop(EmitState *state) const ...@@ -397,6 +397,7 @@ void SpirvShader::EmitLoop(EmitState *state) const
if(insn.opcode() == spv::OpPhi) if(insn.opcode() == spv::OpPhi)
{ {
LoadPhi(insn, state); LoadPhi(insn, state);
dbgEndEmitInstruction(insn, state);
} }
else else
{ {
...@@ -467,7 +468,7 @@ void SpirvShader::EmitLoop(EmitState *state) const ...@@ -467,7 +468,7 @@ void SpirvShader::EmitLoop(EmitState *state) const
// int phi = phi_source; // OpPhi // int phi = phi_source; // OpPhi
// //
// In this example, with each iteration of the loop, phi_source will // In this example, with each iteration of the loop, phi_source will
// only have a single lane assigned. However by 'phi' value in the merge // only have a single lane assigned. However the 'phi' value in the merge
// block needs to be assigned the union of all the per-lane assignments // block needs to be assigned the union of all the per-lane assignments
// of phi_source when that lane exited the loop. // of phi_source when that lane exited the loop.
for(auto insn = mergeBlock.begin(); insn != mergeBlock.end(); insn++) for(auto insn = mergeBlock.begin(); insn != mergeBlock.end(); insn++)
......
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