Commit d4e5e9e0 by Chris Forbes

Pass baseVertex to vertex shader

Bug: b/118386749 Test: dEQP-VK.draw.* Change-Id: I6064e47825f1dcc2a910fe4be933868a4f3835b5 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29169Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent eb50d257
......@@ -296,7 +296,7 @@ namespace sw
sw::deallocate(mem);
}
void Renderer::draw(VkPrimitiveTopology topology, VkIndexType indexType, unsigned int count, bool update)
void Renderer::draw(VkPrimitiveTopology topology, VkIndexType indexType, unsigned int count, int baseVertex, bool update)
{
#ifndef NDEBUG
if(count < minPrimitives || count > maxPrimitives)
......@@ -425,6 +425,8 @@ namespace sw
data->instanceID = context->instanceID;
}
data->baseVertex = baseVertex;
if(pixelState.stencilActive)
{
data->stencil[0].set(context->frontStencil.reference, context->frontStencil.compareMask, context->frontStencil.writeMask);
......
......@@ -99,6 +99,7 @@ namespace sw
const void *indices;
int instanceID;
int baseVertex;
float lineWidth;
PixelProcessor::Stencil stencil[2]; // clockwise, counterclockwise
......@@ -202,7 +203,7 @@ namespace sw
void *operator new(size_t size);
void operator delete(void * mem);
void draw(VkPrimitiveTopology topology, VkIndexType indexType, unsigned int count, bool update = true);
void draw(VkPrimitiveTopology topology, VkIndexType indexType, unsigned int count, int baseVertex, bool update = true);
void setContext(const sw::Context& context);
......
......@@ -57,7 +57,7 @@ namespace sw
{
assert(it->second.SizeInComponents == 1);
routine.getVariable(it->second.Id)[it->second.FirstComponent] =
As<Float4>(Int4(index) + Int4(0, 1, 2, 3));
As<Float4>(Int4(As<Int>(index) + *Pointer<Int>(data + OFFSET(DrawData, baseVertex))) + Int4(0, 1, 2, 3));
}
auto activeLaneMask = SIMD::Int(0xFFFFFFFF); // TODO: Control this.
......
......@@ -523,7 +523,7 @@ struct DrawBase : public CommandBuffer::Command
for(uint32_t instance = firstInstance; instance != firstInstance + instanceCount; instance++)
{
executionState.renderer->setInstanceID(instance);
executionState.renderer->draw(context.topology, executionState.indexType, primitiveCount);
executionState.renderer->draw(context.topology, executionState.indexType, primitiveCount, vertexOffset);
executionState.renderer->advanceInstanceAttributes();
}
}
......
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