Make sure we invalidate mapped memory from vk transfer buffers before reading.
When doing asyncRead we were not calling invalidatemappedMemory after calling map on the transfer buffer. This is an issue if we happen to be using non-coherent memory to back the buffer. Our normal read pixels call was manually calling invalidate so that was working fine. Bug: skia:9867 Change-Id: I765d12f75c914db0dba008433836463898a9712c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268681 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
14d64afaa8
commit
3b23de5878
@ -2561,8 +2561,6 @@ bool GrVkGpu::onReadPixels(GrSurface* surface, int left, int top, int width, int
|
||||
return false;
|
||||
}
|
||||
void* mappedMemory = transferBuffer->map();
|
||||
const GrVkAlloc& transAlloc = transferBuffer->alloc();
|
||||
GrVkMemory::InvalidateMappedAlloc(this, transAlloc, 0, transAlloc.fSize);
|
||||
|
||||
if (copyFromOrigin) {
|
||||
uint32_t skipRows = region.imageExtent.height - height;
|
||||
|
@ -28,7 +28,14 @@ private:
|
||||
void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
|
||||
const SkString& dumpName) const override;
|
||||
|
||||
void onMap() override { this->GrGpuBuffer::fMapPtr = this->vkMap(this->getVkGpu()); }
|
||||
void onMap() override {
|
||||
this->GrGpuBuffer::fMapPtr = this->vkMap(this->getVkGpu());
|
||||
if (this->GrGpuBuffer::fMapPtr &&
|
||||
this->intendedType() == GrGpuBufferType::kXferGpuToCpu) {
|
||||
const GrVkAlloc& alloc = this->alloc();
|
||||
GrVkMemory::InvalidateMappedAlloc(this->getVkGpu(), alloc, 0, alloc.fSize);
|
||||
}
|
||||
}
|
||||
|
||||
void onUnmap() override { this->vkUnmap(this->getVkGpu()); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user