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

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 694933002: Temporary fix to remove drawrect call from GpuGL (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanupcontext
Patch Set: cleanup Created 6 years, 1 month 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
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { 2392 if (srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) {
2393 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. 2393 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer.
2394 INHERITED::initCopySurfaceDstDesc(src, desc); 2394 INHERITED::initCopySurfaceDstDesc(src, desc);
2395 } else { 2395 } else {
2396 desc->fConfig = src->config(); 2396 desc->fConfig = src->config();
2397 desc->fOrigin = src->origin(); 2397 desc->fOrigin = src->origin();
2398 desc->fFlags = kNone_GrSurfaceFlags; 2398 desc->fFlags = kNone_GrSurfaceFlags;
2399 } 2399 }
2400 } 2400 }
2401 2401
2402 bool GrGpuGL::onCopySurface(GrSurface* dst, 2402 bool GrGpuGL::copySurface(GrSurface* dst,
2403 GrSurface* src, 2403 GrSurface* src,
2404 const SkIRect& srcRect, 2404 const SkIRect& srcRect,
2405 const SkIPoint& dstPoint) { 2405 const SkIPoint& dstPoint) {
2406 bool inheritedCouldCopy = INHERITED::onCanCopySurface(dst, src, srcRect, dst Point);
2407 bool copied = false; 2406 bool copied = false;
2408 bool wouldNeedTempFBO = false; 2407 if (can_copy_texsubimage(dst, src, this)) {
2409 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) &&
2410 (!wouldNeedTempFBO || !inheritedCouldCopy)) {
2411 GrGLuint srcFBO; 2408 GrGLuint srcFBO;
2412 GrGLIRect srcVP; 2409 GrGLIRect srcVP;
2413 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP); 2410 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP);
2414 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture()); 2411 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture());
2415 SkASSERT(dstTex); 2412 SkASSERT(dstTex);
2416 // We modified the bound FBO 2413 // We modified the bound FBO
2417 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; 2414 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
2418 GrGLIRect srcGLRect; 2415 GrGLIRect srcGLRect;
2419 srcGLRect.setRelativeTo(srcVP, 2416 srcGLRect.setRelativeTo(srcVP,
2420 srcRect.fLeft, 2417 srcRect.fLeft,
(...skipping 11 matching lines...) Expand all
2432 dstY = dstPoint.fY; 2429 dstY = dstPoint.fY;
2433 } 2430 }
2434 GL_CALL(CopyTexSubImage2D(GR_GL_TEXTURE_2D, 0, 2431 GL_CALL(CopyTexSubImage2D(GR_GL_TEXTURE_2D, 0,
2435 dstPoint.fX, dstY, 2432 dstPoint.fX, dstY,
2436 srcGLRect.fLeft, srcGLRect.fBottom, 2433 srcGLRect.fLeft, srcGLRect.fBottom,
2437 srcGLRect.fWidth, srcGLRect.fHeight)); 2434 srcGLRect.fWidth, srcGLRect.fHeight));
2438 copied = true; 2435 copied = true;
2439 if (srcFBO) { 2436 if (srcFBO) {
2440 GL_CALL(DeleteFramebuffers(1, &srcFBO)); 2437 GL_CALL(DeleteFramebuffers(1, &srcFBO));
2441 } 2438 }
2442 } else if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && 2439 } else if (can_blit_framebuffer(dst, src, this)) {
2443 (!wouldNeedTempFBO || !inheritedCouldCopy)) {
2444 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, 2440 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY,
2445 srcRect.width(), srcRect.height()); 2441 srcRect.width(), srcRect.height());
2446 bool selfOverlap = false; 2442 bool selfOverlap = false;
2447 if (dst->surfacePriv().isSameAs(src)) { 2443 if (dst->surfacePriv().isSameAs(src)) {
2448 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); 2444 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect);
2449 } 2445 }
2450 2446
2451 if (!selfOverlap) { 2447 if (!selfOverlap) {
2452 GrGLuint dstFBO; 2448 GrGLuint dstFBO;
2453 GrGLuint srcFBO; 2449 GrGLuint srcFBO;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); 2492 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
2497 if (dstFBO) { 2493 if (dstFBO) {
2498 GL_CALL(DeleteFramebuffers(1, &dstFBO)); 2494 GL_CALL(DeleteFramebuffers(1, &dstFBO));
2499 } 2495 }
2500 if (srcFBO) { 2496 if (srcFBO) {
2501 GL_CALL(DeleteFramebuffers(1, &srcFBO)); 2497 GL_CALL(DeleteFramebuffers(1, &srcFBO));
2502 } 2498 }
2503 copied = true; 2499 copied = true;
2504 } 2500 }
2505 } 2501 }
2506 if (!copied && inheritedCouldCopy) {
2507 copied = INHERITED::onCopySurface(dst, src, srcRect, dstPoint);
2508 SkASSERT(copied);
2509 }
2510 return copied; 2502 return copied;
2511 } 2503 }
2512 2504
2513 bool GrGpuGL::onCanCopySurface(GrSurface* dst, 2505 bool GrGpuGL::canCopySurface(GrSurface* dst,
2514 GrSurface* src, 2506 GrSurface* src,
2515 const SkIRect& srcRect, 2507 const SkIRect& srcRect,
2516 const SkIPoint& dstPoint) { 2508 const SkIPoint& dstPoint) {
2517 // This mirrors the logic in onCopySurface. 2509 // This mirrors the logic in onCopySurface. We prefer our base makes the co py if we need to
2518 if (can_copy_texsubimage(dst, src, this)) { 2510 // create a temp fbo
2511 // TODO verify this assumption, it may not be true at all
2512 bool wouldNeedTempFBO = false;
2513 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem pFBO) {
2519 return true; 2514 return true;
2520 } 2515 }
2521 if (can_blit_framebuffer(dst, src, this)) { 2516 if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem pFBO) {
2522 if (dst->surfacePriv().isSameAs(src)) { 2517 if (dst->surfacePriv().isSameAs(src)) {
2523 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, 2518 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY,
2524 srcRect.width(), srcRect.height( )); 2519 srcRect.width(), srcRect.height( ));
2525 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) { 2520 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) {
2526 return true; 2521 return true;
2527 } 2522 }
2528 } else { 2523 } else {
2529 return true; 2524 return true;
2530 } 2525 }
2531 } 2526 }
2532 return INHERITED::onCanCopySurface(dst, src, srcRect, dstPoint); 2527 return false;
2533 } 2528 }
2534 2529
2535 void GrGpuGL::didAddGpuTraceMarker() { 2530 void GrGpuGL::didAddGpuTraceMarker() {
2536 if (this->caps()->gpuTracingSupport()) { 2531 if (this->caps()->gpuTracingSupport()) {
2537 const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers(); 2532 const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers();
2538 SkString markerString = markerArray.toStringLast(); 2533 SkString markerString = markerArray.toStringLast();
2539 GL_CALL(PushGroupMarker(0, markerString.c_str())); 2534 GL_CALL(PushGroupMarker(0, markerString.c_str()));
2540 } 2535 }
2541 } 2536 }
2542 2537
(...skipping 29 matching lines...) Expand all
2572 this->setVertexArrayID(gpu, 0); 2567 this->setVertexArrayID(gpu, 0);
2573 } 2568 }
2574 int attrCount = gpu->glCaps().maxVertexAttributes(); 2569 int attrCount = gpu->glCaps().maxVertexAttributes();
2575 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2570 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2576 fDefaultVertexArrayAttribState.resize(attrCount); 2571 fDefaultVertexArrayAttribState.resize(attrCount);
2577 } 2572 }
2578 attribState = &fDefaultVertexArrayAttribState; 2573 attribState = &fDefaultVertexArrayAttribState;
2579 } 2574 }
2580 return attribState; 2575 return attribState;
2581 } 2576 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698