Commit 1ea7af54 by Alexis Hetu Committed by Alexis Hétu

Prevent extra vertices from being processed

Extra vertices are added at the end of the vertex list when processing a batch in order to avoid SIMD width overrun. A single comparison can prevent us from processing these vertices by disabling them in the stores and atomics mask. This would fix the following tests: dEQP-VK.synchronization.op.single_queue.* when enabling the vertexPipelineStoresAndAtomics feature. Note that these tests are affected because they wrongly assume vertices won't be processed more than once. These tests should still get fixed. Bug b/140294254 Change-Id: I04185b899a9770537c3d10bcfd87e00e314582de Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/36368 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 9f2b6c45
...@@ -63,7 +63,7 @@ namespace sw ...@@ -63,7 +63,7 @@ namespace sw
{ {
} }
void VertexProgram::program(Pointer<UInt> &batch) void VertexProgram::program(Pointer<UInt> &batch, UInt& vertexCount)
{ {
auto it = spirvShader->inputBuiltins.find(spv::BuiltInVertexIndex); auto it = spirvShader->inputBuiltins.find(spv::BuiltInVertexIndex);
if (it != spirvShader->inputBuiltins.end()) if (it != spirvShader->inputBuiltins.end())
...@@ -80,7 +80,8 @@ namespace sw ...@@ -80,7 +80,8 @@ namespace sw
} }
auto activeLaneMask = SIMD::Int(0xFFFFFFFF); auto activeLaneMask = SIMD::Int(0xFFFFFFFF);
spirvShader->emit(&routine, activeLaneMask, activeLaneMask, descriptorSets); Int4 storesAndAtomicsMask = CmpGE(UInt4(vertexCount), UInt4(1, 2, 3, 4));
spirvShader->emit(&routine, activeLaneMask, storesAndAtomicsMask, descriptorSets);
spirvShader->emitEpilog(&routine); spirvShader->emitEpilog(&routine);
} }
......
...@@ -34,7 +34,7 @@ namespace sw ...@@ -34,7 +34,7 @@ namespace sw
virtual ~VertexProgram(); virtual ~VertexProgram();
private: private:
void program(Pointer<UInt> &batch) override; void program(Pointer<UInt> &batch, UInt& vertexCount) override;
const vk::DescriptorSet::Bindings &descriptorSets; const vk::DescriptorSet::Bindings &descriptorSets;
}; };
......
...@@ -60,7 +60,7 @@ namespace sw ...@@ -60,7 +60,7 @@ namespace sw
If(tagCache[cacheIndex] != index) If(tagCache[cacheIndex] != index)
{ {
readInput(batch); readInput(batch);
program(batch); program(batch, vertexCount);
computeClipFlags(); computeClipFlags();
writeCache(vertexCache, tagCache, batch); writeCache(vertexCache, tagCache, batch);
......
...@@ -62,7 +62,7 @@ namespace sw ...@@ -62,7 +62,7 @@ namespace sw
SpirvShader const * const spirvShader; SpirvShader const * const spirvShader;
private: private:
virtual void program(Pointer<UInt> &batch) = 0; virtual void program(Pointer<UInt> &batch, UInt& vertexCount) = 0;
typedef VertexProcessor::State::Input Stream; typedef VertexProcessor::State::Input Stream;
......
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