Vulkan: Add dynamic vertex buffers to graph
With DynamicBuffer outputting BufferHelper objects, these objects can
participate in the command graph, i.e. record commands. This means they
need appropriate dependencies in the graph as well as pipeline barriers.
There are a few users of DynamicBuffer for which this change should be
applied to. This change covers vertex attribute buffers.
Bug: angleproject:2958
Change-Id: Ic3f8e187639919aba23102bba238de9ce70e6394
Reviewed-on: https://chromium-review.googlesource.com/c/1364450
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
index e032b1b..8476bfa 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
@@ -46,12 +46,13 @@
size_t vertexCount,
size_t stride,
VertexCopyFunction vertexLoadFunction,
- VkBuffer *bufferHandleOut,
+ vk::BufferHelper **bufferOut,
VkDeviceSize *bufferOffsetOut)
{
uint8_t *dst = nullptr;
- ANGLE_TRY(dynamicBuffer->allocate(contextVk, bytesToAllocate, &dst, bufferHandleOut,
- bufferOffsetOut, nullptr));
+ ANGLE_TRY(dynamicBuffer->allocate(contextVk, bytesToAllocate, &dst, nullptr, bufferOffsetOut,
+ nullptr));
+ *bufferOut = dynamicBuffer->getCurrentBuffer();
dst += destOffset;
vertexLoadFunction(sourceData, stride, vertexCount, dst);
@@ -208,10 +209,12 @@
ANGLE_TRY(StreamVertexData(contextVk, &mCurrentArrayBufferConversion[attribIndex], srcBytes,
numVertices * dstFormatSize, 0, numVertices, binding.getStride(),
mCurrentArrayBufferFormats[attribIndex]->vertexLoadFunction,
- &mCurrentArrayBufferHandles[attribIndex],
+ &mCurrentArrayBuffers[attribIndex],
&mCurrentArrayBufferOffsets[attribIndex]));
ANGLE_TRY(srcBuffer->unmapImpl(contextVk));
+ mCurrentArrayBufferHandles[attribIndex] =
+ mCurrentArrayBuffers[attribIndex]->getBuffer().getHandle();
mCurrentArrayBufferConversionCanRelease[attribIndex] = true;
return angle::Result::Continue();
@@ -341,7 +344,6 @@
ANGLE_TRY(convertVertexBuffer(contextVk, bufferVk, binding, attribIndex));
- mCurrentArrayBuffers[attribIndex] = nullptr;
releaseConversion = false;
}
else
@@ -487,7 +489,9 @@
ANGLE_TRY(StreamVertexData(
contextVk, &mDynamicVertexData, src, bytesToAllocate, destOffset, vertexCount,
binding.getStride(), mCurrentArrayBufferFormats[attribIndex]->vertexLoadFunction,
- &mCurrentArrayBufferHandles[attribIndex], &mCurrentArrayBufferOffsets[attribIndex]));
+ &mCurrentArrayBuffers[attribIndex], &mCurrentArrayBufferOffsets[attribIndex]));
+ mCurrentArrayBufferHandles[attribIndex] =
+ mCurrentArrayBuffers[attribIndex]->getBuffer().getHandle();
}
return angle::Result::Continue();