Dawn: Use shared copy encoder to create backend texture

In onCreateBackendTexture(), a new CommandEncoder was being created to
copy from the staging buffer to the result texture. Following the
staging manager rewrite, this copy encoder was being submitted before
the staging buffer was flushed, causing texture uploads to fail.

Use fCopyEncoder to ensure the staging buffer is unmapped before the
commands are run.

Bug: chromium:1071073
Change-Id: I3e8a77f3356671411f01dbb8017a7997e7c9349b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286394
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Sean Gilhuly 2020-04-30 13:24:29 -04:00 committed by Skia Commit-Bot
parent c120be4bbf
commit a4dd44a3b4

View File

@ -348,7 +348,7 @@ GrBackendTexture GrDawnGpu::onCreateBackendTexture(SkISize dimensions,
memset(defaultStorage.get(), 0, baseLayerSize);
}
wgpu::Device device = this->device();
wgpu::CommandEncoder copyEncoder = fDevice.CreateCommandEncoder();
wgpu::CommandEncoder copyEncoder = this->getCopyEncoder();
int w = dimensions.width(), h = dimensions.height();
for (uint32_t i = 0; i < desc.mipLevelCount; i++) {
size_t origRowBytes = bpp * w;
@ -380,8 +380,6 @@ GrBackendTexture GrDawnGpu::onCreateBackendTexture(SkISize dimensions,
w = std::max(1, w / 2);
h = std::max(1, h / 2);
}
wgpu::CommandBuffer cmdBuf = copyEncoder.Finish();
fQueue.Submit(1, &cmdBuf);
GrDawnTextureInfo info;
info.fTexture = tex;
info.fFormat = desc.format;