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. ...@@ -25,6 +25,7 @@ Google Inc.
Eric Boren Eric Boren
Henry Bridge Henry Bridge
Nat Duca Nat Duca
Courtney Goeltzenleuchter
Peter Kasting Peter Kasting
Vangelis Kokkevis Vangelis Kokkevis
Zhenyao Mo Zhenyao Mo
......
...@@ -481,10 +481,12 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context, ...@@ -481,10 +481,12 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
const void *indices, const void *indices,
vk::CommandBuffer **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
ASSERT(mode != gl::PrimitiveMode::LineLoop);
if (indexType != mCurrentDrawElementsType) if (indexType != mCurrentDrawElementsType)
{ {
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
mCurrentDrawElementsType = indexType; mCurrentDrawElementsType = indexType;
setIndexBufferDirty();
} }
const gl::Buffer *elementArrayBuffer = mVertexArray->getState().getElementArrayBuffer(); const gl::Buffer *elementArrayBuffer = mVertexArray->getState().getElementArrayBuffer();
...@@ -524,7 +526,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context, ...@@ -524,7 +526,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context,
{ {
ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount, ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount,
indexTypeOrInvalid, indices, numIndicesOut)); indexTypeOrInvalid, indices, numIndicesOut));
mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER); setIndexBufferDirty();
mCurrentDrawElementsType = indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum mCurrentDrawElementsType = indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum
? indexTypeOrInvalid ? indexTypeOrInvalid
: gl::DrawElementsType::UnsignedInt; : gl::DrawElementsType::UnsignedInt;
......
...@@ -232,7 +232,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff ...@@ -232,7 +232,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff
unsigned int line) override; unsigned int line) override;
const gl::ActiveTextureArray<TextureVk *> &getActiveTextures() const; 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 flushImpl(const gl::Semaphore *semaphore);
angle::Result finishImpl(); angle::Result finishImpl();
......
...@@ -345,7 +345,6 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context, ...@@ -345,7 +345,6 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
mCurrentElementArrayBuffer = nullptr; mCurrentElementArrayBuffer = nullptr;
} }
mCurrentElementArrayBufferOffset = 0;
mLineLoopBufferFirstIndex.reset(); mLineLoopBufferFirstIndex.reset();
mLineLoopBufferLastIndex.reset(); mLineLoopBufferLastIndex.reset();
contextVk->setIndexBufferDirty(); contextVk->setIndexBufferDirty();
...@@ -356,6 +355,7 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context, ...@@ -356,6 +355,7 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA: case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA:
mLineLoopBufferFirstIndex.reset(); mLineLoopBufferFirstIndex.reset();
mLineLoopBufferLastIndex.reset(); mLineLoopBufferLastIndex.reset();
contextVk->setIndexBufferDirty();
mDirtyLineLoopTranslation = true; mDirtyLineLoopTranslation = true;
break; 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