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

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

Issue 2078483002: Start using GrGpuCommandBuffer in GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@memoryWAR
Patch Set: remove errant lines Created 4 years, 6 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLGpuCommandBuffer.h » ('j') | 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 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 } 2143 }
2144 2144
2145 void GrGLGpu::disableScissor() { 2145 void GrGLGpu::disableScissor() {
2146 if (kNo_TriState != fHWScissorSettings.fEnabled) { 2146 if (kNo_TriState != fHWScissorSettings.fEnabled) {
2147 GL_CALL(Disable(GR_GL_SCISSOR_TEST)); 2147 GL_CALL(Disable(GR_GL_SCISSOR_TEST));
2148 fHWScissorSettings.fEnabled = kNo_TriState; 2148 fHWScissorSettings.fEnabled = kNo_TriState;
2149 return; 2149 return;
2150 } 2150 }
2151 } 2151 }
2152 2152
2153 void GrGLGpu::onClear(GrRenderTarget* target, const SkIRect& rect, GrColor color ) { 2153 void GrGLGpu::clear(const SkIRect& rect, GrColor color, GrRenderTarget* target) {
2154 this->handleDirtyContext();
2155
2154 // parent class should never let us get here with no RT 2156 // parent class should never let us get here with no RT
2155 SkASSERT(target); 2157 SkASSERT(target);
2156 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); 2158 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
2157 2159
2158 this->flushRenderTarget(glRT, &rect); 2160 this->flushRenderTarget(glRT, &rect);
2159 GrScissorState scissorState; 2161 GrScissorState scissorState;
2160 scissorState.set(rect); 2162 scissorState.set(rect);
2161 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); 2163 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
2162 2164
2163 GrGLfloat r, g, b, a; 2165 GrGLfloat r, g, b, a;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); 2233 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect());
2232 2234
2233 this->disableScissor(); 2235 this->disableScissor();
2234 2236
2235 GL_CALL(StencilMask(0xffffffff)); 2237 GL_CALL(StencilMask(0xffffffff));
2236 GL_CALL(ClearStencil(0)); 2238 GL_CALL(ClearStencil(0));
2237 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); 2239 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT));
2238 fHWStencilSettings.invalidate(); 2240 fHWStencilSettings.invalidate();
2239 } 2241 }
2240 2242
2241 void GrGLGpu::onClearStencilClip(GrRenderTarget* target, const SkIRect& rect, bo ol insideClip) { 2243 void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTar get* target) {
2242 SkASSERT(target); 2244 SkASSERT(target);
2245 this->handleDirtyContext();
2243 2246
2244 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); 2247 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment();
2245 // this should only be called internally when we know we have a 2248 // this should only be called internally when we know we have a
2246 // stencil buffer. 2249 // stencil buffer.
2247 SkASSERT(sb); 2250 SkASSERT(sb);
2248 GrGLint stencilBitCount = sb->bits(); 2251 GrGLint stencilBitCount = sb->bits();
2249 #if 0 2252 #if 0
2250 SkASSERT(stencilBitCount > 0); 2253 SkASSERT(stencilBitCount > 0);
2251 GrGLint clipStencilMask = (1 << (stencilBitCount - 1)); 2254 GrGLint clipStencilMask = (1 << (stencilBitCount - 1));
2252 #else 2255 #else
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 if (!flipY) { 2620 if (!flipY) {
2618 dst += rowBytes; 2621 dst += rowBytes;
2619 } else { 2622 } else {
2620 dst -= rowBytes; 2623 dst -= rowBytes;
2621 } 2624 }
2622 } 2625 }
2623 } 2626 }
2624 return true; 2627 return true;
2625 } 2628 }
2626 2629
2627 GrGpuCommandBuffer* GrGLGpu::createCommandBuffer(const GrRenderTarget& target, 2630 GrGpuCommandBuffer* GrGLGpu::createCommandBuffer(
2628 GrGpuCommandBuffer::LoadAndStor eOp colorOp, 2631 GrRenderTarget* target,
2629 GrColor colorClear, 2632 const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo,
2630 GrGpuCommandBuffer::LoadAndStor eOp stencilOp, 2633 const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) {
2631 GrColor stencilClear) {
2632 return new GrGLGpuCommandBuffer(this); 2634 return new GrGLGpuCommandBuffer(this);
2633 } 2635 }
2634 2636
2635 void GrGLGpu::finishDrawTarget() { 2637 void GrGLGpu::finishDrawTarget() {
2636 if (fPLSHasBeenUsed) { 2638 if (fPLSHasBeenUsed) {
2637 /* There is an ARM driver bug where if we use PLS, and then draw a frame which does not 2639 /* There is an ARM driver bug where if we use PLS, and then draw a frame which does not
2638 * use PLS, it leaves garbage all over the place. As a workaround, we us e PLS in a 2640 * use PLS, it leaves garbage all over the place. As a workaround, we us e PLS in a
2639 * trivial way every frame. And since we use it every frame, there's nev er a point at which 2641 * trivial way every frame. And since we use it every frame, there's nev er a point at which
2640 * it becomes safe to stop using this workaround once we start. 2642 * it becomes safe to stop using this workaround once we start.
2641 */ 2643 */
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 GetWindowThreadProcessId(hwnd, &wndProcID); 2724 GetWindowThreadProcessId(hwnd, &wndProcID);
2723 if(wndProcID == procID) { 2725 if(wndProcID == procID) {
2724 SwapBuffers(GetDC(hwnd)); 2726 SwapBuffers(GetDC(hwnd));
2725 } 2727 }
2726 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); 2728 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
2727 } 2729 }
2728 } 2730 }
2729 #endif 2731 #endif
2730 #endif 2732 #endif
2731 2733
2732 void GrGLGpu::onDraw(const GrPipeline& pipeline, 2734 void GrGLGpu::draw(const GrPipeline& pipeline,
2733 const GrPrimitiveProcessor& primProc, 2735 const GrPrimitiveProcessor& primProc,
2734 const GrMesh* meshes, 2736 const GrMesh* meshes,
2735 int meshCount) { 2737 int meshCount) {
2738 this->handleDirtyContext();
2739
2736 if (!this->flushGLState(pipeline, primProc)) { 2740 if (!this->flushGLState(pipeline, primProc)) {
2737 return; 2741 return;
2738 } 2742 }
2739 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState(); 2743 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState();
2740 if (!fHWPLSEnabled && plsState != 2744 if (!fHWPLSEnabled && plsState !=
2741 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) { 2745 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) {
2742 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); 2746 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2743 this->setupPixelLocalStorage(pipeline, primProc); 2747 this->setupPixelLocalStorage(pipeline, primProc);
2744 fHWPLSEnabled = true; 2748 fHWPLSEnabled = true;
2745 } 2749 }
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
4647 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4651 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4648 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4652 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4649 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4653 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4650 copyParams->fWidth = texture->width(); 4654 copyParams->fWidth = texture->width();
4651 copyParams->fHeight = texture->height(); 4655 copyParams->fHeight = texture->height();
4652 return true; 4656 return true;
4653 } 4657 }
4654 } 4658 }
4655 return false; 4659 return false;
4656 } 4660 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLGpuCommandBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698