Fix one APICreateBuffer use in CommandBufferVk.

Bug: dawn:723
Change-Id: I48c1c2594ee8b86dfe11b5dcaedcdd8170868def
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84765
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
Corentin Wallez 2022-03-28 18:47:02 +00:00 committed by Dawn LUCI CQ
parent 45b4893326
commit ac0f60c307
2 changed files with 13 additions and 11 deletions

View File

@ -444,7 +444,7 @@ namespace dawn::native::vulkan {
: CommandBufferBase(encoder, descriptor) {
}
void CommandBuffer::RecordCopyImageWithTemporaryBuffer(
MaybeError CommandBuffer::RecordCopyImageWithTemporaryBuffer(
CommandRecordingContext* recordingContext,
const TextureCopy& srcCopy,
const TextureCopy& dstCopy,
@ -467,12 +467,12 @@ namespace dawn::native::vulkan {
tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
Device* device = ToBackend(GetDevice());
// TODO(dawn:723): change to not use AcquireRef for reentrant object creation.
Ref<Buffer> tempBuffer =
AcquireRef(ToBackend(device->APICreateBuffer(&tempBufferDescriptor)));
Ref<BufferBase> tempBufferBase;
DAWN_TRY_ASSIGN(tempBufferBase, device->CreateBuffer(&tempBufferDescriptor));
Buffer* tempBuffer = ToBackend(tempBufferBase.Get());
BufferCopy tempBufferCopy;
tempBufferCopy.buffer = tempBuffer.Get();
tempBufferCopy.buffer = tempBuffer;
tempBufferCopy.rowsPerImage = heightInBlocks;
tempBufferCopy.offset = 0;
tempBufferCopy.bytesPerRow = copySize.width / blockInfo.width * blockInfo.byteSize;
@ -500,6 +500,8 @@ namespace dawn::native::vulkan {
&tempBufferToDstRegion);
recordingContext->tempBuffers.emplace_back(tempBuffer);
return {};
}
MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* recordingContext) {
@ -706,8 +708,8 @@ namespace dawn::native::vulkan {
1, &region);
}
} else {
RecordCopyImageWithTemporaryBuffer(recordingContext, src, dst,
copy->copySize);
DAWN_TRY(RecordCopyImageWithTemporaryBuffer(recordingContext, src, dst,
copy->copySize));
}
break;

View File

@ -44,10 +44,10 @@ namespace dawn::native::vulkan {
const ComputePassResourceUsage& resourceUsages);
MaybeError RecordRenderPass(CommandRecordingContext* recordingContext,
BeginRenderPassCmd* renderPass);
void RecordCopyImageWithTemporaryBuffer(CommandRecordingContext* recordingContext,
const TextureCopy& srcCopy,
const TextureCopy& dstCopy,
const Extent3D& copySize);
MaybeError RecordCopyImageWithTemporaryBuffer(CommandRecordingContext* recordingContext,
const TextureCopy& srcCopy,
const TextureCopy& dstCopy,
const Extent3D& copySize);
};
} // namespace dawn::native::vulkan