| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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(GrRenderTarget* target, |
| 2628 GrGpuCommandBuffer::LoadAndStor
eOp colorOp, | 2631 GrGpuCommandBuffer::LoadAndStor
eOp colorOp, |
| 2629 GrColor colorClear, | 2632 GrColor colorClear, |
| 2630 GrGpuCommandBuffer::LoadAndStor
eOp stencilOp, | 2633 GrGpuCommandBuffer::LoadAndStor
eOp stencilOp, |
| 2631 GrColor stencilClear) { | 2634 GrColor stencilClear) { |
| 2632 return new GrGLGpuCommandBuffer(this); | 2635 return new GrGLGpuCommandBuffer(this); |
| 2633 } | 2636 } |
| 2634 | 2637 |
| 2635 void GrGLGpu::finishDrawTarget() { | 2638 void GrGLGpu::finishDrawTarget() { |
| 2636 if (fPLSHasBeenUsed) { | 2639 if (fPLSHasBeenUsed) { |
| 2637 /* There is an ARM driver bug where if we use PLS, and then draw a frame
which does not | 2640 /* There is an ARM driver bug where if we use PLS, and then draw a frame
which does not |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2722 GetWindowThreadProcessId(hwnd, &wndProcID); | 2725 GetWindowThreadProcessId(hwnd, &wndProcID); |
| 2723 if(wndProcID == procID) { | 2726 if(wndProcID == procID) { |
| 2724 SwapBuffers(GetDC(hwnd)); | 2727 SwapBuffers(GetDC(hwnd)); |
| 2725 } | 2728 } |
| 2726 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); | 2729 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); |
| 2727 } | 2730 } |
| 2728 } | 2731 } |
| 2729 #endif | 2732 #endif |
| 2730 #endif | 2733 #endif |
| 2731 | 2734 |
| 2732 void GrGLGpu::onDraw(const GrPipeline& pipeline, | 2735 void GrGLGpu::draw(const GrPipeline& pipeline, |
| 2733 const GrPrimitiveProcessor& primProc, | 2736 const GrPrimitiveProcessor& primProc, |
| 2734 const GrMesh* meshes, | 2737 const GrMesh* meshes, |
| 2735 int meshCount) { | 2738 int meshCount) { |
| 2739 this->handleDirtyContext(); |
| 2740 |
| 2736 if (!this->flushGLState(pipeline, primProc)) { | 2741 if (!this->flushGLState(pipeline, primProc)) { |
| 2737 return; | 2742 return; |
| 2738 } | 2743 } |
| 2739 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState(); | 2744 GrPixelLocalStorageState plsState = primProc.getPixelLocalStorageState(); |
| 2740 if (!fHWPLSEnabled && plsState != | 2745 if (!fHWPLSEnabled && plsState != |
| 2741 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) { | 2746 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) { |
| 2742 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); | 2747 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); |
| 2743 this->setupPixelLocalStorage(pipeline, primProc); | 2748 this->setupPixelLocalStorage(pipeline, primProc); |
| 2744 fHWPLSEnabled = true; | 2749 fHWPLSEnabled = true; |
| 2745 } | 2750 } |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4647 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4652 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
| 4648 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4653 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
| 4649 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4654 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
| 4650 copyParams->fWidth = texture->width(); | 4655 copyParams->fWidth = texture->width(); |
| 4651 copyParams->fHeight = texture->height(); | 4656 copyParams->fHeight = texture->height(); |
| 4652 return true; | 4657 return true; |
| 4653 } | 4658 } |
| 4654 } | 4659 } |
| 4655 return false; | 4660 return false; |
| 4656 } | 4661 } |
| OLD | NEW |