mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: cherry-pick d27d9d059b51 from angle * chore: update patches Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
101 lines
5.1 KiB
Diff
101 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Charlie Lao <cclao@google.com>
|
|
Date: Tue, 15 Mar 2022 09:39:36 -0700
|
|
Subject: Vulkan: Update mCurrentElementArrayBuffersync based on dirty bit
|
|
|
|
M96 merge issues:
|
|
ContextVk.cpp:
|
|
ContextVk::setupIndexedDraw: vertexArrayVk/getVertexArray() isn't present in M96
|
|
ContextVk::syncState: M96 uses mVertexArray instead of vertexArrayVk
|
|
VertexArrayVk.cpp:
|
|
VertexArrayVk::updateCurrentElementArrayBuffer doesn't exist in M9
|
|
Created it and kept M96 logic for retrieving buffer/offset
|
|
|
|
The previous fix crrev.com/c/3513553 has run into corner case that
|
|
requires more follow up change crrev.com/c/3522565. But with that, there
|
|
is report that now we are hitting assertion in
|
|
handleDirtyGraphicsIndexBuffer(). This becomes a bit fragile This new
|
|
fix relies on the DIRTY_BIT_INDEX_BUFFER dirty bit and should be more
|
|
reliable as long as the dirty bit is set properly (if not, then we have
|
|
other bug that it won't even send down vulkan command to bind the
|
|
correct element buffer). We could further optimize the code path and
|
|
create a fast path for most common usages in the future.
|
|
|
|
Bug: chromium:1299261
|
|
Change-Id: Ifa8f86d431798c9ca4c128ed71a3e9e0a3537ccb
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3526021
|
|
Commit-Queue: Charlie Lao <cclao@google.com>
|
|
(cherry picked from commit 349636a05a3577a127adb6c79a1e947890bbe462)
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3605834
|
|
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
|
|
Reviewed-by: Charlie Lao <cclao@google.com>
|
|
|
|
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
|
index aa1e5fa793e98a284b3d5dbda58778b8c2f1eeef..d9f6bcd54943bd211f1dc2b1ea149c21a79979a0 100644
|
|
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
|
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
|
@@ -1062,6 +1062,17 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
|
|
mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
|
|
mLastIndexBufferOffset = indices;
|
|
}
|
|
+
|
|
+ // When you draw with LineLoop mode or GL_UNSIGNED_BYTE type, we may allocate its own
|
|
+ // element buffer and modify mCurrentElementArrayBuffer. When we switch out of that draw
|
|
+ // mode, we must reset mCurrentElementArrayBuffer back to the vertexArray's element buffer.
|
|
+ // Since in either case we set DIRTY_BIT_INDEX_BUFFER dirty bit, we use this bit to re-sync
|
|
+ // mCurrentElementArrayBuffer.
|
|
+ if (mGraphicsDirtyBits[DIRTY_BIT_INDEX_BUFFER])
|
|
+ {
|
|
+ mVertexArray->updateCurrentElementArrayBuffer();
|
|
+ }
|
|
+
|
|
if (shouldConvertUint8VkIndexType(indexType) && mGraphicsDirtyBits[DIRTY_BIT_INDEX_BUFFER])
|
|
{
|
|
ANGLE_VK_PERF_WARNING(this, GL_DEBUG_SEVERITY_LOW,
|
|
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
|
index eb401bfd8c1ccfc750d34b46e95d97c54a5a0fac..fd6fcf4c339f7d189217545e10c4c808e103f671 100644
|
|
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
|
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
|
@@ -454,6 +454,17 @@ angle::Result VertexArrayVk::convertVertexBufferCPU(ContextVk *contextVk,
|
|
return angle::Result::Continue;
|
|
}
|
|
|
|
+void VertexArrayVk::updateCurrentElementArrayBuffer()
|
|
+{
|
|
+ ASSERT(mState.getElementArrayBuffer() != nullptr);
|
|
+ ASSERT(mState.getElementArrayBuffer()->getSize() > 0);
|
|
+ gl::Buffer *bufferGL = mState.getElementArrayBuffer();
|
|
+ BufferVk *bufferVk = vk::GetImpl(bufferGL);
|
|
+ mCurrentElementArrayBuffer =
|
|
+ &bufferVk->getBufferAndOffset(&mCurrentElementArrayBufferOffset);
|
|
+
|
|
+}
|
|
+
|
|
angle::Result VertexArrayVk::syncState(const gl::Context *context,
|
|
const gl::VertexArray::DirtyBits &dirtyBits,
|
|
gl::VertexArray::DirtyAttribBitsArray *attribBits,
|
|
@@ -479,9 +490,7 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
|
|
{
|
|
// Note that just updating buffer data may still result in a new
|
|
// vk::BufferHelper allocation.
|
|
- BufferVk *bufferVk = vk::GetImpl(bufferGL);
|
|
- mCurrentElementArrayBuffer =
|
|
- &bufferVk->getBufferAndOffset(&mCurrentElementArrayBufferOffset);
|
|
+ updateCurrentElementArrayBuffer();
|
|
}
|
|
else
|
|
{
|
|
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.h b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
|
index c198265bf8ba2017a13fce558826862f450218b5..0b98a9ed46b7cd4b9588973c74b0bbaf9172ab6c 100644
|
|
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
|
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
|
@@ -34,6 +34,8 @@ class VertexArrayVk : public VertexArrayImpl
|
|
|
|
angle::Result updateActiveAttribInfo(ContextVk *contextVk);
|
|
|
|
+ void updateCurrentElementArrayBuffer();
|
|
+
|
|
angle::Result updateDefaultAttrib(ContextVk *contextVk,
|
|
size_t attribIndex,
|
|
VkBuffer bufferHandle,
|