Commit b867bc6f by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Fix dirty element array buffer updates.

The issue occurs that binds the same buffer and calls glDrawElements with the same indices. The offset has been reset in the VertexArrayVk::syncState(), but it doesn't check the actual value in the ContextVk::setupIndexedDraw(). Also corrected case where update via BufferSubData wasn't being sent to the HW. Bug: angleproject:3362 Change-Id: I0f7d2fc162bc8f1c36cb09ba689fd27b482b9035 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666345 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 661ed419
......@@ -25,6 +25,7 @@ Google Inc.
Eric Boren
Henry Bridge
Nat Duca
Courtney Goeltzenleuchter
Peter Kasting
Vangelis Kokkevis
Zhenyao Mo
......
......@@ -481,10 +481,12 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
const void *indices,
vk::CommandBuffer **commandBufferOut)
{
ASSERT(mode != gl::PrimitiveMode::LineLoop);
if (indexType != mCurrentDrawElementsType)
{
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mCurrentDrawElementsType = indexType;
setIndexBufferDirty();
}
const gl::Buffer *elementArrayBuffer = mVertexArray->getState().getElementArrayBuffer();
......@@ -524,7 +526,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context,
{
ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount,
indexTypeOrInvalid, indices, numIndicesOut));
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
setIndexBufferDirty();
mCurrentDrawElementsType = indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum
? indexTypeOrInvalid
: gl::DrawElementsType::UnsignedInt;
......
......@@ -232,7 +232,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff
unsigned int line) override;
const gl::ActiveTextureArray<TextureVk *> &getActiveTextures() const;
void setIndexBufferDirty() { mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); }
void setIndexBufferDirty()
{
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mLastIndexBufferOffset = reinterpret_cast<const void *>(angle::DirtyPointer);
}
angle::Result flushImpl(const gl::Semaphore *semaphore);
angle::Result finishImpl();
......
......@@ -345,7 +345,6 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
mCurrentElementArrayBuffer = nullptr;
}
mCurrentElementArrayBufferOffset = 0;
mLineLoopBufferFirstIndex.reset();
mLineLoopBufferLastIndex.reset();
contextVk->setIndexBufferDirty();
......@@ -356,6 +355,7 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA:
mLineLoopBufferFirstIndex.reset();
mLineLoopBufferLastIndex.reset();
contextVk->setIndexBufferDirty();
mDirtyLineLoopTranslation = true;
break;
......
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