Commit ec06305b by Shahbaz Youssefi Committed by Commit Bot

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/1364450Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 132d15c2
......@@ -46,12 +46,13 @@ angle::Result StreamVertexData(ContextVk *contextVk,
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::Result VertexArrayVk::convertVertexBuffer(ContextVk *contextVk,
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::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
ANGLE_TRY(convertVertexBuffer(contextVk, bufferVk, binding, attribIndex));
mCurrentArrayBuffers[attribIndex] = nullptr;
releaseConversion = false;
}
else
......@@ -487,7 +489,9 @@ angle::Result VertexArrayVk::updateClientAttribs(const gl::Context *context,
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();
......
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