Commit df31624e by Charlie Lao Committed by Commit Bot

Vulkan: Reduce the onBufferRead/onBufferWrite API verbosity a bit

This adds helper functions to handle common use case for onBufferRead and onBufferWrite to reduce the API verbosity a little bit. Also fix the transform feedback bug that we are passing in wrong access/stage flags when it is emulated by vertex shader. Bug: b/155122200 Change-Id: Id2549ca00cad184a90c6230dc3665aaff44dda08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174265 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 67da0051
...@@ -305,10 +305,8 @@ angle::Result BufferVk::copySubData(const gl::Context *context, ...@@ -305,10 +305,8 @@ angle::Result BufferVk::copySubData(const gl::Context *context,
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferRead(&sourceBuffer->getBuffer()));
&sourceBuffer->getBuffer())); ANGLE_TRY(contextVk->onBufferTransferWrite(mBuffer));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
mBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
// Enqueue a copy command on the GPU. // Enqueue a copy command on the GPU.
...@@ -553,10 +551,8 @@ angle::Result BufferVk::copyToBufferImpl(ContextVk *contextVk, ...@@ -553,10 +551,8 @@ angle::Result BufferVk::copyToBufferImpl(ContextVk *contextVk,
const VkBufferCopy *copies) const VkBufferCopy *copies)
{ {
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferWrite(destBuffer));
destBuffer)); ANGLE_TRY(contextVk->onBufferTransferRead(mBuffer));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
mBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
commandBuffer->copyBuffer(mBuffer->getBuffer(), destBuffer->getBuffer(), copyCount, copies); commandBuffer->copyBuffer(mBuffer->getBuffer(), destBuffer->getBuffer(), copyCount, copies);
......
...@@ -1433,9 +1433,8 @@ angle::Result ContextVk::handleDirtyGraphicsTransformFeedbackBuffersEmulation( ...@@ -1433,9 +1433,8 @@ angle::Result ContextVk::handleDirtyGraphicsTransformFeedbackBuffersEmulation(
BufferVk *bufferVk = vk::GetImpl(buffer); BufferVk *bufferVk = vk::GetImpl(buffer);
vk::BufferHelper &bufferHelper = bufferVk->getBuffer(); vk::BufferHelper &bufferHelper = bufferVk->getBuffer();
mRenderPassCommands.bufferWrite( mRenderPassCommands.bufferWrite(&mResourceUseList, VK_ACCESS_SHADER_WRITE_BIT,
&mResourceUseList, VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, &bufferHelper);
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT, &bufferHelper);
} }
// TODO(http://anglebug.com/3570): Need to update to handle Program Pipelines // TODO(http://anglebug.com/3570): Need to update to handle Program Pipelines
......
...@@ -617,12 +617,24 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -617,12 +617,24 @@ class ContextVk : public ContextImpl, public vk::Context
vk::ResourceUseList &getResourceUseList() { return mResourceUseList; } vk::ResourceUseList &getResourceUseList() { return mResourceUseList; }
angle::Result onBufferRead(VkAccessFlags readAccessType, angle::Result onBufferTransferRead(vk::BufferHelper *buffer)
VkPipelineStageFlags readStage, {
vk::BufferHelper *buffer); return onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, buffer);
angle::Result onBufferWrite(VkAccessFlags writeAccessType, }
VkPipelineStageFlags writeStage, angle::Result onBufferTransferWrite(vk::BufferHelper *buffer)
vk::BufferHelper *buffer); {
return onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, buffer);
}
angle::Result onBufferComputeShaderRead(vk::BufferHelper *buffer)
{
return onBufferRead(VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
buffer);
}
angle::Result onBufferComputeShaderWrite(vk::BufferHelper *buffer)
{
return onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
buffer);
}
angle::Result onImageRead(VkImageAspectFlags aspectFlags, angle::Result onImageRead(VkImageAspectFlags aspectFlags,
vk::ImageLayout imageLayout, vk::ImageLayout imageLayout,
...@@ -941,6 +953,13 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -941,6 +953,13 @@ class ContextVk : public ContextImpl, public vk::Context
ANGLE_INLINE void onRenderPassFinished() { mRenderPassCommandBuffer = nullptr; } ANGLE_INLINE void onRenderPassFinished() { mRenderPassCommandBuffer = nullptr; }
angle::Result onBufferRead(VkAccessFlags readAccessType,
VkPipelineStageFlags readStage,
vk::BufferHelper *buffer);
angle::Result onBufferWrite(VkAccessFlags writeAccessType,
VkPipelineStageFlags writeStage,
vk::BufferHelper *buffer);
void initIndexTypeMap(); void initIndexTypeMap();
std::array<DirtyBitHandler, DIRTY_BIT_MAX> mGraphicsDirtyBitHandlers; std::array<DirtyBitHandler, DIRTY_BIT_MAX> mGraphicsDirtyBitHandlers;
......
...@@ -122,8 +122,7 @@ angle::Result OverlayVk::createFont(ContextVk *contextVk) ...@@ -122,8 +122,7 @@ angle::Result OverlayVk::createFont(ContextVk *contextVk)
// Copy font data from staging buffer. // Copy font data from staging buffer.
vk::CommandBuffer *fontDataUpload; vk::CommandBuffer *fontDataUpload;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferRead(&fontDataBuffer.get()));
&fontDataBuffer.get()));
ANGLE_TRY(contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferDst, ANGLE_TRY(contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferDst,
&mFontImage)); &mFontImage));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&fontDataUpload)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&fontDataUpload));
......
...@@ -42,7 +42,7 @@ the primary command buffer. ...@@ -42,7 +42,7 @@ the primary command buffer.
The back-end usually records Image and Buffer barriers through additional `ContextVk` APIs: The back-end usually records Image and Buffer barriers through additional `ContextVk` APIs:
* `onBufferRead` and `onBufferWrite` accumulate `VkBuffer` barriers. * `onBufferTransferRead/onBufferComputeShaderRead` and `onBufferTransferWrite/onBufferComputeShaderWrite` accumulate `VkBuffer` barriers.
* `onImageRead` and `onImageWrite` accumulate `VkImage` barriers. * `onImageRead` and `onImageWrite` accumulate `VkImage` barriers.
* `onRenderPassImageWrite` is a special API for write barriers inside a RenderPass instance. * `onRenderPassImageWrite` is a special API for write barriers inside a RenderPass instance.
...@@ -57,8 +57,8 @@ In this example we'll be recording a buffer copy command: ...@@ -57,8 +57,8 @@ In this example we'll be recording a buffer copy command:
``` ```
# Ensure that ANGLE sets proper read and write barriers for the Buffers. # Ensure that ANGLE sets proper read and write barriers for the Buffers.
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, destBuffer)); ANGLE_TRY(contextVk->onBufferTransferWrite(destBuffer));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, srcBuffer)); ANGLE_TRY(contextVk->onBufferTransferRead(srcBuffer));
# Get a pointer to a secondary command buffer for command recording. May "flush" the RP. # Get a pointer to a secondary command buffer for command recording. May "flush" the RP.
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
......
...@@ -1035,8 +1035,7 @@ angle::Result TextureVk::copyBufferDataToImage(ContextVk *contextVk, ...@@ -1035,8 +1035,7 @@ angle::Result TextureVk::copyBufferDataToImage(ContextVk *contextVk,
ANGLE_TRY(ensureImageInitialized(contextVk, ImageMipLevels::EnabledLevels)); ANGLE_TRY(ensureImageInitialized(contextVk, ImageMipLevels::EnabledLevels));
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferRead(srcBuffer));
srcBuffer));
ANGLE_TRY( ANGLE_TRY(
contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferDst, mImage)); contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferDst, mImage));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
......
...@@ -795,8 +795,7 @@ angle::Result UtilsVk::clearBuffer(ContextVk *contextVk, ...@@ -795,8 +795,7 @@ angle::Result UtilsVk::clearBuffer(ContextVk *contextVk,
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
// Tell the context dest that we are writing to dest. // Tell the context dest that we are writing to dest.
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dest));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dest));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
const vk::Format &destFormat = dest->getViewFormat(); const vk::Format &destFormat = dest->getViewFormat();
...@@ -846,10 +845,8 @@ angle::Result UtilsVk::convertIndexBuffer(ContextVk *contextVk, ...@@ -846,10 +845,8 @@ angle::Result UtilsVk::convertIndexBuffer(ContextVk *contextVk,
ANGLE_TRY(ensureConvertIndexResourcesInitialized(contextVk)); ANGLE_TRY(ensureConvertIndexResourcesInitialized(contextVk));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(src));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, src)); ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dest));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dest));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
VkDescriptorSet descriptorSet; VkDescriptorSet descriptorSet;
...@@ -910,14 +907,10 @@ angle::Result UtilsVk::convertIndexIndirectBuffer(ContextVk *contextVk, ...@@ -910,14 +907,10 @@ angle::Result UtilsVk::convertIndexIndirectBuffer(ContextVk *contextVk,
ANGLE_TRY(ensureConvertIndexIndirectResourcesInitialized(contextVk)); ANGLE_TRY(ensureConvertIndexIndirectResourcesInitialized(contextVk));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(srcIndirectBuf));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, srcIndirectBuf)); ANGLE_TRY(contextVk->onBufferComputeShaderRead(srcIndexBuf));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dstIndirectBuf));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, srcIndexBuf)); ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dstIndexBuf));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dstIndirectBuf));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dstIndexBuf));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
VkDescriptorSet descriptorSet; VkDescriptorSet descriptorSet;
...@@ -982,14 +975,10 @@ angle::Result UtilsVk::convertLineLoopIndexIndirectBuffer( ...@@ -982,14 +975,10 @@ angle::Result UtilsVk::convertLineLoopIndexIndirectBuffer(
ANGLE_TRY(ensureConvertIndexIndirectLineLoopResourcesInitialized(contextVk)); ANGLE_TRY(ensureConvertIndexIndirectLineLoopResourcesInitialized(contextVk));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(srcIndirectBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, srcIndirectBuffer)); ANGLE_TRY(contextVk->onBufferComputeShaderRead(srcIndexBuffer));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dstIndirectBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, srcIndexBuffer)); ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dstIndexBuffer));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dstIndirectBuffer));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dstIndexBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
VkDescriptorSet descriptorSet; VkDescriptorSet descriptorSet;
...@@ -1046,12 +1035,9 @@ angle::Result UtilsVk::convertLineLoopArrayIndirectBuffer( ...@@ -1046,12 +1035,9 @@ angle::Result UtilsVk::convertLineLoopArrayIndirectBuffer(
ANGLE_TRY(ensureConvertIndirectLineLoopResourcesInitialized(contextVk)); ANGLE_TRY(ensureConvertIndirectLineLoopResourcesInitialized(contextVk));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(srcIndirectBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, srcIndirectBuffer)); ANGLE_TRY(contextVk->onBufferComputeShaderWrite(destIndirectBuffer));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderWrite(destIndexBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, destIndirectBuffer));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, destIndexBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
VkDescriptorSet descriptorSet; VkDescriptorSet descriptorSet;
...@@ -1105,10 +1091,8 @@ angle::Result UtilsVk::convertVertexBuffer(ContextVk *contextVk, ...@@ -1105,10 +1091,8 @@ angle::Result UtilsVk::convertVertexBuffer(ContextVk *contextVk,
ANGLE_TRY(ensureConvertVertexResourcesInitialized(contextVk)); ANGLE_TRY(ensureConvertVertexResourcesInitialized(contextVk));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(src));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, src)); ANGLE_TRY(contextVk->onBufferComputeShaderWrite(dest));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, dest));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
ConvertVertexShaderParams shaderParams; ConvertVertexShaderParams shaderParams;
...@@ -1819,8 +1803,7 @@ angle::Result UtilsVk::cullOverlayWidgets(ContextVk *contextVk, ...@@ -1819,8 +1803,7 @@ angle::Result UtilsVk::cullOverlayWidgets(ContextVk *contextVk,
&descriptorSet)); &descriptorSet));
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(enabledWidgetsBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, enabledWidgetsBuffer));
ANGLE_TRY(contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT, ANGLE_TRY(contextVk->onImageWrite(VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::ComputeShaderWrite, dest)); vk::ImageLayout::ComputeShaderWrite, dest));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
...@@ -1897,10 +1880,8 @@ angle::Result UtilsVk::drawOverlay(ContextVk *contextVk, ...@@ -1897,10 +1880,8 @@ angle::Result UtilsVk::drawOverlay(ContextVk *contextVk,
vk::ImageLayout::ComputeShaderReadOnly, culledWidgets)); vk::ImageLayout::ComputeShaderReadOnly, culledWidgets));
ANGLE_TRY(contextVk->onImageRead(VK_IMAGE_ASPECT_COLOR_BIT, ANGLE_TRY(contextVk->onImageRead(VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::ComputeShaderReadOnly, font)); vk::ImageLayout::ComputeShaderReadOnly, font));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT, ANGLE_TRY(contextVk->onBufferComputeShaderRead(textWidgetsBuffer));
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, textWidgetsBuffer)); ANGLE_TRY(contextVk->onBufferComputeShaderRead(graphWidgetsBuffer));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_SHADER_READ_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, graphWidgetsBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
......
...@@ -1813,10 +1813,8 @@ angle::Result BufferHelper::copyFromBuffer(ContextVk *contextVk, ...@@ -1813,10 +1813,8 @@ angle::Result BufferHelper::copyFromBuffer(ContextVk *contextVk,
const VkBufferCopy &copyRegion) const VkBufferCopy &copyRegion)
{ {
CommandBuffer *commandBuffer = nullptr; CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferRead(srcBuffer));
this)); ANGLE_TRY(contextVk->onBufferTransferWrite(this));
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
srcBuffer));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
commandBuffer->copyBuffer(srcBuffer->getBuffer(), mBuffer, 1, &copyRegion); commandBuffer->copyBuffer(srcBuffer->getBuffer(), mBuffer, 1, &copyRegion);
...@@ -1952,6 +1950,8 @@ void BufferHelper::updateWriteBarrier(VkAccessFlags writeAccessType, ...@@ -1952,6 +1950,8 @@ void BufferHelper::updateWriteBarrier(VkAccessFlags writeAccessType,
{ {
// We don't need to check mCurrentReadStages here since if it is not zero, mCurrentReadAccess // We don't need to check mCurrentReadStages here since if it is not zero, mCurrentReadAccess
// must not be zero as well. stage is finer grain than accessType. // must not be zero as well. stage is finer grain than accessType.
ASSERT((!mCurrentReadStages && !mCurrentReadAccess) ||
(mCurrentReadStages && mCurrentReadAccess));
if (mCurrentReadAccess != 0 || mCurrentWriteAccess != 0) if (mCurrentReadAccess != 0 || mCurrentWriteAccess != 0)
{ {
*barrierSrcOut |= mCurrentWriteAccess; *barrierSrcOut |= mCurrentWriteAccess;
...@@ -3358,8 +3358,7 @@ angle::Result ImageHelper::flushStagedUpdates(ContextVk *contextVk, ...@@ -3358,8 +3358,7 @@ angle::Result ImageHelper::flushStagedUpdates(ContextVk *contextVk,
BufferHelper *currentBuffer = bufferUpdate.bufferHelper; BufferHelper *currentBuffer = bufferUpdate.bufferHelper;
ASSERT(currentBuffer && currentBuffer->valid()); ASSERT(currentBuffer && currentBuffer->valid());
ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, ANGLE_TRY(contextVk->onBufferTransferRead(currentBuffer));
VK_PIPELINE_STAGE_TRANSFER_BIT, currentBuffer));
commandBuffer->copyBufferToImage(currentBuffer->getBuffer().getHandle(), mImage, commandBuffer->copyBufferToImage(currentBuffer->getBuffer().getHandle(), mImage,
getCurrentLayout(), 1, &update.buffer.copyRegion); getCurrentLayout(), 1, &update.buffer.copyRegion);
...@@ -3477,8 +3476,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk, ...@@ -3477,8 +3476,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk,
CommandBuffer *commandBuffer = nullptr; CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(contextVk->onImageRead(aspectFlags, ImageLayout::TransferSrc, this)); ANGLE_TRY(contextVk->onImageRead(aspectFlags, ImageLayout::TransferSrc, this));
ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, ANGLE_TRY(contextVk->onBufferTransferWrite(*bufferOut));
*bufferOut));
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer)); ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
VkBufferImageCopy regions[2] = {}; VkBufferImageCopy regions[2] = {};
......
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