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

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/GrInOrderDrawBuffer.cpp ('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 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 desc->fConfig = src->config(); 2398 desc->fConfig = src->config();
2399 desc->fOrigin = src->origin(); 2399 desc->fOrigin = src->origin();
2400 desc->fFlags = kNone_GrSurfaceFlags; 2400 desc->fFlags = kNone_GrSurfaceFlags;
2401 } 2401 }
2402 } 2402 }
2403 2403
2404 bool GrGpuGL::onCopySurface(GrSurface* dst, 2404 bool GrGpuGL::onCopySurface(GrSurface* dst,
2405 GrSurface* src, 2405 GrSurface* src,
2406 const SkIRect& srcRect, 2406 const SkIRect& srcRect,
2407 const SkIPoint& dstPoint) { 2407 const SkIPoint& dstPoint) {
2408 bool inheritedCouldCopy = INHERITED::onCanCopySurface(dst, src, srcRect, dst Point);
2409 bool copied = false; 2408 bool copied = false;
2410 bool wouldNeedTempFBO = false; 2409 if (can_copy_texsubimage(dst, src, this)) {
2411 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) &&
2412 (!wouldNeedTempFBO || !inheritedCouldCopy)) {
2413 GrGLuint srcFBO; 2410 GrGLuint srcFBO;
2414 GrGLIRect srcVP; 2411 GrGLIRect srcVP;
2415 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP); 2412 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_FRAMEBUFFER, &srcVP);
2416 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture()); 2413 GrGLTexture* dstTex = static_cast<GrGLTexture*>(dst->asTexture());
2417 SkASSERT(dstTex); 2414 SkASSERT(dstTex);
2418 // We modified the bound FBO 2415 // We modified the bound FBO
2419 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; 2416 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
2420 GrGLIRect srcGLRect; 2417 GrGLIRect srcGLRect;
2421 srcGLRect.setRelativeTo(srcVP, 2418 srcGLRect.setRelativeTo(srcVP,
2422 srcRect.fLeft, 2419 srcRect.fLeft,
(...skipping 11 matching lines...) Expand all
2434 dstY = dstPoint.fY; 2431 dstY = dstPoint.fY;
2435 } 2432 }
2436 GL_CALL(CopyTexSubImage2D(GR_GL_TEXTURE_2D, 0, 2433 GL_CALL(CopyTexSubImage2D(GR_GL_TEXTURE_2D, 0,
2437 dstPoint.fX, dstY, 2434 dstPoint.fX, dstY,
2438 srcGLRect.fLeft, srcGLRect.fBottom, 2435 srcGLRect.fLeft, srcGLRect.fBottom,
2439 srcGLRect.fWidth, srcGLRect.fHeight)); 2436 srcGLRect.fWidth, srcGLRect.fHeight));
2440 copied = true; 2437 copied = true;
2441 if (srcFBO) { 2438 if (srcFBO) {
2442 GL_CALL(DeleteFramebuffers(1, &srcFBO)); 2439 GL_CALL(DeleteFramebuffers(1, &srcFBO));
2443 } 2440 }
2444 } else if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && 2441 } else if (can_blit_framebuffer(dst, src, this)) {
2445 (!wouldNeedTempFBO || !inheritedCouldCopy)) {
2446 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, 2442 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY,
2447 srcRect.width(), srcRect.height()); 2443 srcRect.width(), srcRect.height());
2448 bool selfOverlap = false; 2444 bool selfOverlap = false;
2449 if (dst->surfacePriv().isSameAs(src)) { 2445 if (dst->surfacePriv().isSameAs(src)) {
2450 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); 2446 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect);
2451 } 2447 }
2452 2448
2453 if (!selfOverlap) { 2449 if (!selfOverlap) {
2454 GrGLuint dstFBO; 2450 GrGLuint dstFBO;
2455 GrGLuint srcFBO; 2451 GrGLuint srcFBO;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); 2494 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
2499 if (dstFBO) { 2495 if (dstFBO) {
2500 GL_CALL(DeleteFramebuffers(1, &dstFBO)); 2496 GL_CALL(DeleteFramebuffers(1, &dstFBO));
2501 } 2497 }
2502 if (srcFBO) { 2498 if (srcFBO) {
2503 GL_CALL(DeleteFramebuffers(1, &srcFBO)); 2499 GL_CALL(DeleteFramebuffers(1, &srcFBO));
2504 } 2500 }
2505 copied = true; 2501 copied = true;
2506 } 2502 }
2507 } 2503 }
2508 if (!copied && inheritedCouldCopy) {
2509 copied = INHERITED::onCopySurface(dst, src, srcRect, dstPoint);
2510 SkASSERT(copied);
2511 }
2512 return copied; 2504 return copied;
2513 } 2505 }
2514 2506
2515 bool GrGpuGL::onCanCopySurface(GrSurface* dst, 2507 bool GrGpuGL::onCanCopySurface(GrSurface* dst,
2516 GrSurface* src, 2508 GrSurface* src,
2517 const SkIRect& srcRect, 2509 const SkIRect& srcRect,
2518 const SkIPoint& dstPoint) { 2510 const SkIPoint& dstPoint) {
2519 // This mirrors the logic in onCopySurface. 2511 // This mirrors the logic in onCopySurface. We prefer our base makes the co py if we need to
bsalomon 2014/10/31 19:43:01 Is this preference known to be valid?
2520 if (can_copy_texsubimage(dst, src, this)) { 2512 // create a temp fbo
2513 bool wouldNeedTempFBO = false;
2514 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem pFBO) {
2521 return true; 2515 return true;
2522 } 2516 }
2523 if (can_blit_framebuffer(dst, src, this)) { 2517 if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem pFBO) {
2524 if (dst->surfacePriv().isSameAs(src)) { 2518 if (dst->surfacePriv().isSameAs(src)) {
2525 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, 2519 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY,
2526 srcRect.width(), srcRect.height( )); 2520 srcRect.width(), srcRect.height( ));
2527 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) { 2521 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) {
2528 return true; 2522 return true;
2529 } 2523 }
2530 } else { 2524 } else {
2531 return true; 2525 return true;
2532 } 2526 }
2533 } 2527 }
2534 return INHERITED::onCanCopySurface(dst, src, srcRect, dstPoint); 2528 return false;
2535 } 2529 }
2536 2530
2537 void GrGpuGL::didAddGpuTraceMarker() { 2531 void GrGpuGL::didAddGpuTraceMarker() {
2538 if (this->caps()->gpuTracingSupport()) { 2532 if (this->caps()->gpuTracingSupport()) {
2539 const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers(); 2533 const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers();
2540 SkString markerString = markerArray.toStringLast(); 2534 SkString markerString = markerArray.toStringLast();
2541 GL_CALL(PushGroupMarker(0, markerString.c_str())); 2535 GL_CALL(PushGroupMarker(0, markerString.c_str()));
2542 } 2536 }
2543 } 2537 }
2544 2538
(...skipping 29 matching lines...) Expand all
2574 this->setVertexArrayID(gpu, 0); 2568 this->setVertexArrayID(gpu, 0);
2575 } 2569 }
2576 int attrCount = gpu->glCaps().maxVertexAttributes(); 2570 int attrCount = gpu->glCaps().maxVertexAttributes();
2577 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2571 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2578 fDefaultVertexArrayAttribState.resize(attrCount); 2572 fDefaultVertexArrayAttribState.resize(attrCount);
2579 } 2573 }
2580 attribState = &fDefaultVertexArrayAttribState; 2574 attribState = &fDefaultVertexArrayAttribState;
2581 } 2575 }
2582 return attribState; 2576 return attribState;
2583 } 2577 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698