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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 2134793002: Remove the command buffer method glGetImageivCHROMIUM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge conflict. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 MailboxInfo& info = m_mailboxes.first(); 214 MailboxInfo& info = m_mailboxes.first();
215 info.m_mailbox.textureTarget = GC3D_TEXTURE_RECTANGLE_ARB; 215 info.m_mailbox.textureTarget = GC3D_TEXTURE_RECTANGLE_ARB;
216 gl->GenMailboxCHROMIUM(info.m_mailbox.name); 216 gl->GenMailboxCHROMIUM(info.m_mailbox.name);
217 gl->ProduceTextureDirectCHROMIUM(imageInfo.m_textureId, info.m_mailbox.textu reTarget, info.m_mailbox.name); 217 gl->ProduceTextureDirectCHROMIUM(imageInfo.m_textureId, info.m_mailbox.textu reTarget, info.m_mailbox.name);
218 info.m_mailbox.allowOverlay = true; 218 info.m_mailbox.allowOverlay = true;
219 219
220 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); 220 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM();
221 gl->Flush(); 221 gl->Flush();
222 gl->GenSyncTokenCHROMIUM(fenceSync, info.m_mailbox.syncToken); 222 gl->GenSyncTokenCHROMIUM(fenceSync, info.m_mailbox.syncToken);
223 info.m_mailbox.validSyncToken = true; 223 info.m_mailbox.validSyncToken = true;
224 info.m_mailbox.gpuMemoryBufferId = imageInfo.m_gpuMemoryBufferId;
225 224
226 info.m_imageInfo = imageInfo; 225 info.m_imageInfo = imageInfo;
227 *outMailbox = info.m_mailbox; 226 *outMailbox = info.m_mailbox;
228 227
229 gl->BindTexture(GC3D_TEXTURE_RECTANGLE_ARB, 0); 228 gl->BindTexture(GC3D_TEXTURE_RECTANGLE_ARB, 0);
230 229
231 // Because we are changing the texture binding without going through skia, 230 // Because we are changing the texture binding without going through skia,
232 // we must dirty the context. 231 // we must dirty the context.
233 grContext->resetContext(kTextureBinding_GrGLBackendState); 232 grContext->resetContext(kTextureBinding_GrGLBackendState);
234 233
(...skipping 19 matching lines...) Expand all
254 GLuint textureId; 253 GLuint textureId;
255 gl->GenTextures(1, &textureId); 254 gl->GenTextures(1, &textureId);
256 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; 255 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB;
257 gl->BindTexture(target, textureId); 256 gl->BindTexture(target, textureId);
258 gl->TexParameteri(target, GL_TEXTURE_MAG_FILTER, getGLFilter()); 257 gl->TexParameteri(target, GL_TEXTURE_MAG_FILTER, getGLFilter());
259 gl->TexParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); 258 gl->TexParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter());
260 gl->TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 259 gl->TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
261 gl->TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 260 gl->TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
262 gl->BindTexImage2DCHROMIUM(target, imageId); 261 gl->BindTexImage2DCHROMIUM(target, imageId);
263 262
264 GLint gpuMemoryBufferId = -1; 263 return Canvas2DLayerBridge::ImageInfo(imageId, textureId);
265 gl->GetImageivCHROMIUM(imageId, GC3D_GPU_MEMORY_BUFFER_ID, &gpuMemoryBufferI d);
266 DCHECK_NE(-1, gpuMemoryBufferId);
267
268 return Canvas2DLayerBridge::ImageInfo(imageId, textureId, gpuMemoryBufferId) ;
269 } 264 }
270 265
271 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) 266 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info)
272 { 267 {
273 gpu::gles2::GLES2Interface* gl = contextGL(); 268 gpu::gles2::GLES2Interface* gl = contextGL();
274 if (!gl) 269 if (!gl)
275 return; 270 return;
276 271
277 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; 272 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB;
278 gl->BindTexture(target, info.m_textureId); 273 gl->BindTexture(target, info.m_textureId);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 getOrCreateSurface()->notifyContentWillChange(SkSurface::kRetain_ContentChan geMode); 990 getOrCreateSurface()->notifyContentWillChange(SkSurface::kRetain_ContentChan geMode);
996 return fromSkSp(m_surface->makeImageSnapshot()); 991 return fromSkSp(m_surface->makeImageSnapshot());
997 } 992 }
998 993
999 void Canvas2DLayerBridge::willOverwriteCanvas() 994 void Canvas2DLayerBridge::willOverwriteCanvas()
1000 { 995 {
1001 skipQueuedDrawCommands(); 996 skipQueuedDrawCommands();
1002 } 997 }
1003 998
1004 #if USE_IOSURFACE_FOR_2D_CANVAS 999 #if USE_IOSURFACE_FOR_2D_CANVAS
1005 Canvas2DLayerBridge::ImageInfo::ImageInfo(GLuint imageId, GLuint textureId, GLin t gpuMemoryBufferId) 1000 Canvas2DLayerBridge::ImageInfo::ImageInfo(GLuint imageId, GLuint textureId) : m_ imageId(imageId), m_textureId(textureId)
1006 : m_imageId(imageId)
1007 , m_textureId(textureId)
1008 , m_gpuMemoryBufferId(gpuMemoryBufferId)
1009 { 1001 {
1010 DCHECK(imageId); 1002 DCHECK(imageId);
1011 DCHECK(textureId); 1003 DCHECK(textureId);
1012 DCHECK_NE(-1, gpuMemoryBufferId);
1013 } 1004 }
1014 1005
1015 bool Canvas2DLayerBridge::ImageInfo::empty() 1006 bool Canvas2DLayerBridge::ImageInfo::empty()
1016 { 1007 {
1017 return m_imageId == 0; 1008 return m_imageId == 0;
1018 } 1009 }
1019 #endif // USE_IOSURFACE_FOR_2D_CANVAS 1010 #endif // USE_IOSURFACE_FOR_2D_CANVAS
1020 1011
1021 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) 1012 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other)
1022 { 1013 {
1023 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 1014 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
1024 m_image = other.m_image; 1015 m_image = other.m_image;
1025 m_parentLayerBridge = other.m_parentLayerBridge; 1016 m_parentLayerBridge = other.m_parentLayerBridge;
1026 #if USE_IOSURFACE_FOR_2D_CANVAS 1017 #if USE_IOSURFACE_FOR_2D_CANVAS
1027 m_imageInfo = other.m_imageInfo; 1018 m_imageInfo = other.m_imageInfo;
1028 #endif // USE_IOSURFACE_FOR_2D_CANVAS 1019 #endif // USE_IOSURFACE_FOR_2D_CANVAS
1029 } 1020 }
1030 1021
1031 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 1022 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
1032 { 1023 {
1033 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 1024 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
1034 hibernationHistogram.count(event); 1025 hibernationHistogram.count(event);
1035 } 1026 }
1036 1027
1037 } // namespace blink 1028 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698