Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1888473002: Use transfer buffer for BatchAtlas texture copies Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to ToT Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index fcd3270ba245c0229a1415b5df7da90c283f5df2..33c0140f92cb4139cbf148da380ae526aa889e05 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -908,13 +908,13 @@ bool GrGLGpu::onWritePixels(GrSurface* surface,
return success;
}
-bool GrGLGpu::onTransferPixels(GrSurface* surface,
+bool GrGLGpu::onTransferPixels(GrTexture* texture,
int left, int top, int width, int height,
GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) {
- GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture());
+ GrGLTexture* glTex = static_cast<GrGLTexture*>(texture);
- if (!check_write_and_transfer_input(glTex, surface, config)) {
+ if (!check_write_and_transfer_input(glTex, texture, config)) {
return false;
}
@@ -933,7 +933,7 @@ bool GrGLGpu::onTransferPixels(GrSurface* surface,
bool success = false;
GrMipLevel mipLevel;
- mipLevel.fPixels = transferBuffer;
+ mipLevel.fPixels = (void*)offset;
mipLevel.fRowBytes = rowBytes;
SkSTArray<1, GrMipLevel> texels;
texels.push_back(mipLevel);
@@ -1205,6 +1205,14 @@ bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc,
SkASSERT(this->caps()->isConfigTexturable(desc.fConfig));
+ // unbind any previous transfer buffer if not transferring
+ auto& xferBufferState = fHWBufferState[kXferCpuToGpu_GrBufferType];
+ if (kTransfer_UploadType != uploadType &&
+ SK_InvalidUniqueID != xferBufferState.fBoundBufferUniqueID) {
+ GL_CALL(BindBuffer(xferBufferState.fGLTarget, 0));
+ xferBufferState.invalidate();
+ }
+
// texels is const.
// But we may need to flip the texture vertically to prepare it.
// Rather than flip in place and alter the incoming data,
@@ -4694,3 +4702,20 @@ bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrTexturePara
}
return false;
}
+
+GrFence SK_WARN_UNUSED_RESULT GrGLGpu::insertFence() const {
+ GrGLsync fence;
+ GL_CALL_RET(fence, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
+ return (GrFence)fence;
+}
+
+bool GrGLGpu::waitFence(GrFence fence) const {
+ const GrGLuint64 kTimeout = 1000;
+ GrGLenum result;
+ GL_CALL_RET(result, ClientWaitSync((GrGLsync)fence, GR_GL_SYNC_FLUSH_COMMANDS_BIT, kTimeout));
+ return (GR_GL_CONDITION_SATISFIED == result);
+}
+
+void GrGLGpu::deleteFence(GrFence fence) const {
+ GL_CALL(DeleteSync((GrGLsync)fence));
+}
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698