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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 fHWBufferTextures[b].fKnownBound = false; | 556 fHWBufferTextures[b].fKnownBound = false; |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 if (resetBits & kBlend_GrGLBackendState) { | 560 if (resetBits & kBlend_GrGLBackendState) { |
561 fHWBlendState.invalidate(); | 561 fHWBlendState.invalidate(); |
562 } | 562 } |
563 | 563 |
564 if (resetBits & kView_GrGLBackendState) { | 564 if (resetBits & kView_GrGLBackendState) { |
565 fHWScissorSettings.invalidate(); | 565 fHWScissorSettings.invalidate(); |
| 566 fHWWindows.invalidate(); |
566 fHWViewport.invalidate(); | 567 fHWViewport.invalidate(); |
567 } | 568 } |
568 | 569 |
569 if (resetBits & kStencil_GrGLBackendState) { | 570 if (resetBits & kStencil_GrGLBackendState) { |
570 fHWStencilSettings.invalidate(); | 571 fHWStencilSettings.invalidate(); |
571 fHWStencilTestEnabled = kUnknown_TriState; | 572 fHWStencilTestEnabled = kUnknown_TriState; |
572 } | 573 } |
573 | 574 |
574 // Vertex | 575 // Vertex |
575 if (resetBits & kVertex_GrGLBackendState) { | 576 if (resetBits & kVertex_GrGLBackendState) { |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 fHWScissorSettings.fEnabled = kYes_TriState; | 1989 fHWScissorSettings.fEnabled = kYes_TriState; |
1989 } | 1990 } |
1990 return; | 1991 return; |
1991 } | 1992 } |
1992 } | 1993 } |
1993 | 1994 |
1994 // See fall through note above | 1995 // See fall through note above |
1995 this->disableScissor(); | 1996 this->disableScissor(); |
1996 } | 1997 } |
1997 | 1998 |
| 1999 void GrGLGpu::flushWindowRectangles(const GrWindowRectangles& windows, const GrG
LRenderTarget* rt) { |
| 2000 SkASSERT(windows.count() <= this->caps()->maxWindowRectangles()); |
| 2001 if (!this->caps()->maxWindowRectangles() || |
| 2002 fHWWindows.areEqual(rt->origin(), rt->getViewport(), windows)) { |
| 2003 return; |
| 2004 } |
| 2005 |
| 2006 const SkIRect* skwindows = windows.data(); |
| 2007 SkAutoSTMalloc<8, GrGLIRect> glwindows(windows.count()); |
| 2008 for (int i = 0; i < windows.count(); ++i) { |
| 2009 glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin()
); |
| 2010 } |
| 2011 |
| 2012 typedef GrWindowRectangles::Mode Mode; |
| 2013 GrGLenum glmode = Mode::kExclusive == windows.mode() ? GR_GL_EXCLUSIVE : GR_
GL_INCLUSIVE; |
| 2014 GL_CALL(WindowRectangles(glmode, windows.count(), glwindows[0].asInts())); |
| 2015 |
| 2016 fHWWindows.set(rt->origin(), rt->getViewport(), windows); |
| 2017 SkASSERT(fHWWindows.areDisabled() || rt->renderFBOID()); // Can't use window
rects on-screen. |
| 2018 } |
| 2019 |
| 2020 void GrGLGpu::disableWindowRectangles() { |
| 2021 if (!this->caps()->maxWindowRectangles() || fHWWindows.areDisabled()) { |
| 2022 return; |
| 2023 } |
| 2024 GL_CALL(WindowRectangles(GR_GL_EXCLUSIVE, 0, nullptr)); |
| 2025 fHWWindows.setDisabled(); |
| 2026 } |
| 2027 |
1998 void GrGLGpu::flushMinSampleShading(float minSampleShading) { | 2028 void GrGLGpu::flushMinSampleShading(float minSampleShading) { |
1999 if (fHWMinSampleShading != minSampleShading) { | 2029 if (fHWMinSampleShading != minSampleShading) { |
2000 if (minSampleShading > 0.0) { | 2030 if (minSampleShading > 0.0) { |
2001 GL_CALL(Enable(GR_GL_SAMPLE_SHADING)); | 2031 GL_CALL(Enable(GR_GL_SAMPLE_SHADING)); |
2002 GL_CALL(MinSampleShading(minSampleShading)); | 2032 GL_CALL(MinSampleShading(minSampleShading)); |
2003 } | 2033 } |
2004 else { | 2034 else { |
2005 GL_CALL(Disable(GR_GL_SAMPLE_SHADING)); | 2035 GL_CALL(Disable(GR_GL_SAMPLE_SHADING)); |
2006 } | 2036 } |
2007 fHWMinSampleShading = minSampleShading; | 2037 fHWMinSampleShading = minSampleShading; |
(...skipping 27 matching lines...) Expand all Loading... |
2035 const GrSwizzle& swizzle = this->glCaps().glslCaps()->configOutputSwizzl
e( | 2065 const GrSwizzle& swizzle = this->glCaps().glslCaps()->configOutputSwizzl
e( |
2036 pipeline.getRenderTarget()->config()); | 2066 pipeline.getRenderTarget()->config()); |
2037 this->flushBlend(blendInfo, swizzle); | 2067 this->flushBlend(blendInfo, swizzle); |
2038 } | 2068 } |
2039 | 2069 |
2040 program->setData(primProc, pipeline); | 2070 program->setData(primProc, pipeline); |
2041 | 2071 |
2042 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTa
rget()); | 2072 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTa
rget()); |
2043 this->flushStencil(pipeline.getStencil()); | 2073 this->flushStencil(pipeline.getStencil()); |
2044 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or
igin()); | 2074 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or
igin()); |
| 2075 this->flushWindowRectangles(pipeline.getWindowRectangles(), glRT); |
2045 this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStenc
il().isDisabled()); | 2076 this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStenc
il().isDisabled()); |
2046 | 2077 |
2047 // This must come after textures are flushed because a texture may need | 2078 // This must come after textures are flushed because a texture may need |
2048 // to be msaa-resolved (which will modify bound FBO state). | 2079 // to be msaa-resolved (which will modify bound FBO state). |
2049 this->flushRenderTarget(glRT, nullptr, pipeline.getDisableOutputConversionTo
SRGB()); | 2080 this->flushRenderTarget(glRT, nullptr, pipeline.getDisableOutputConversionTo
SRGB()); |
2050 | 2081 |
2051 return true; | 2082 return true; |
2052 } | 2083 } |
2053 | 2084 |
2054 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc, | 2085 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 this->handleDirtyContext(); | 2195 this->handleDirtyContext(); |
2165 | 2196 |
2166 // parent class should never let us get here with no RT | 2197 // parent class should never let us get here with no RT |
2167 SkASSERT(target); | 2198 SkASSERT(target); |
2168 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); | 2199 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
2169 | 2200 |
2170 this->flushRenderTarget(glRT, &rect); | 2201 this->flushRenderTarget(glRT, &rect); |
2171 GrScissorState scissorState; | 2202 GrScissorState scissorState; |
2172 scissorState.set(rect); | 2203 scissorState.set(rect); |
2173 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); | 2204 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); |
| 2205 this->disableWindowRectangles(); |
2174 | 2206 |
2175 GrGLfloat r, g, b, a; | 2207 GrGLfloat r, g, b, a; |
2176 static const GrGLfloat scale255 = 1.f / 255.f; | 2208 static const GrGLfloat scale255 = 1.f / 255.f; |
2177 a = GrColorUnpackA(color) * scale255; | 2209 a = GrColorUnpackA(color) * scale255; |
2178 GrGLfloat scaleRGB = scale255; | 2210 GrGLfloat scaleRGB = scale255; |
2179 r = GrColorUnpackR(color) * scaleRGB; | 2211 r = GrColorUnpackR(color) * scaleRGB; |
2180 g = GrColorUnpackG(color) * scaleRGB; | 2212 g = GrColorUnpackG(color) * scaleRGB; |
2181 b = GrColorUnpackB(color) * scaleRGB; | 2213 b = GrColorUnpackB(color) * scaleRGB; |
2182 | 2214 |
2183 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); | 2215 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); |
2184 fHWWriteToColor = kYes_TriState; | 2216 fHWWriteToColor = kYes_TriState; |
2185 GL_CALL(ClearColor(r, g, b, a)); | 2217 GL_CALL(ClearColor(r, g, b, a)); |
2186 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); | 2218 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); |
2187 } | 2219 } |
2188 | 2220 |
2189 void GrGLGpu::clearStencil(GrRenderTarget* target) { | 2221 void GrGLGpu::clearStencil(GrRenderTarget* target) { |
2190 if (nullptr == target) { | 2222 if (nullptr == target) { |
2191 return; | 2223 return; |
2192 } | 2224 } |
2193 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); | 2225 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
2194 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); | 2226 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); |
2195 | 2227 |
2196 this->disableScissor(); | 2228 this->disableScissor(); |
| 2229 this->disableWindowRectangles(); |
2197 | 2230 |
2198 GL_CALL(StencilMask(0xffffffff)); | 2231 GL_CALL(StencilMask(0xffffffff)); |
2199 GL_CALL(ClearStencil(0)); | 2232 GL_CALL(ClearStencil(0)); |
2200 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 2233 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
2201 fHWStencilSettings.invalidate(); | 2234 fHWStencilSettings.invalidate(); |
2202 } | 2235 } |
2203 | 2236 |
2204 void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTar
get* target) { | 2237 void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTar
get* target) { |
2205 SkASSERT(target); | 2238 SkASSERT(target); |
2206 this->handleDirtyContext(); | 2239 this->handleDirtyContext(); |
(...skipping 19 matching lines...) Expand all Loading... |
2226 value = (1 << (stencilBitCount - 1)); | 2259 value = (1 << (stencilBitCount - 1)); |
2227 } else { | 2260 } else { |
2228 value = 0; | 2261 value = 0; |
2229 } | 2262 } |
2230 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); | 2263 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
2231 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); | 2264 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); |
2232 | 2265 |
2233 GrScissorState scissorState; | 2266 GrScissorState scissorState; |
2234 scissorState.set(rect); | 2267 scissorState.set(rect); |
2235 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); | 2268 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); |
| 2269 this->disableWindowRectangles(); |
2236 | 2270 |
2237 GL_CALL(StencilMask((uint32_t) clipStencilMask)); | 2271 GL_CALL(StencilMask((uint32_t) clipStencilMask)); |
2238 GL_CALL(ClearStencil(value)); | 2272 GL_CALL(ClearStencil(value)); |
2239 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 2273 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
2240 fHWStencilSettings.invalidate(); | 2274 fHWStencilSettings.invalidate(); |
2241 } | 2275 } |
2242 | 2276 |
2243 static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL
Caps& caps, | 2277 static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL
Caps& caps, |
2244 int width, int height, GrPixelConfig co
nfig, | 2278 int width, int height, GrPixelConfig co
nfig, |
2245 size_t rowBytes) { | 2279 size_t rowBytes) { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 } | 2630 } |
2597 | 2631 |
2598 void GrGLGpu::finishDrawTarget() { | 2632 void GrGLGpu::finishDrawTarget() { |
2599 if (fPLSHasBeenUsed) { | 2633 if (fPLSHasBeenUsed) { |
2600 /* There is an ARM driver bug where if we use PLS, and then draw a frame
which does not | 2634 /* There is an ARM driver bug where if we use PLS, and then draw a frame
which does not |
2601 * use PLS, it leaves garbage all over the place. As a workaround, we us
e PLS in a | 2635 * use PLS, it leaves garbage all over the place. As a workaround, we us
e PLS in a |
2602 * trivial way every frame. And since we use it every frame, there's nev
er a point at which | 2636 * trivial way every frame. And since we use it every frame, there's nev
er a point at which |
2603 * it becomes safe to stop using this workaround once we start. | 2637 * it becomes safe to stop using this workaround once we start. |
2604 */ | 2638 */ |
2605 this->disableScissor(); | 2639 this->disableScissor(); |
| 2640 this->disableWindowRectangles(); |
2606 // using PLS in the presence of MSAA results in GL_INVALID_OPERATION | 2641 // using PLS in the presence of MSAA results in GL_INVALID_OPERATION |
2607 this->flushHWAAState(nullptr, false, false); | 2642 this->flushHWAAState(nullptr, false, false); |
2608 SkASSERT(!fHWPLSEnabled); | 2643 SkASSERT(!fHWPLSEnabled); |
2609 SkASSERT(fMSAAEnabled != kYes_TriState); | 2644 SkASSERT(fMSAAEnabled != kYes_TriState); |
2610 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); | 2645 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); |
2611 this->stampPLSSetupRect(SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f, 0.01f)
); | 2646 this->stampPLSSetupRect(SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f, 0.01f)
); |
2612 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); | 2647 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); |
2613 } | 2648 } |
2614 } | 2649 } |
2615 | 2650 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 } while ((nonIdxMesh = iter.next())); | 2780 } while ((nonIdxMesh = iter.next())); |
2746 } | 2781 } |
2747 | 2782 |
2748 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLo
calStorageState) { | 2783 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLo
calStorageState) { |
2749 // PLS draws always involve multiple draws, finishing up with a non-PLS | 2784 // PLS draws always involve multiple draws, finishing up with a non-PLS |
2750 // draw that writes to the color buffer. That draw ends up here; we wait | 2785 // draw that writes to the color buffer. That draw ends up here; we wait |
2751 // until after it is complete to actually disable PLS. | 2786 // until after it is complete to actually disable PLS. |
2752 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); | 2787 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); |
2753 fHWPLSEnabled = false; | 2788 fHWPLSEnabled = false; |
2754 this->disableScissor(); | 2789 this->disableScissor(); |
| 2790 this->disableWindowRectangles(); |
2755 } | 2791 } |
2756 | 2792 |
2757 #if SWAP_PER_DRAW | 2793 #if SWAP_PER_DRAW |
2758 glFlush(); | 2794 glFlush(); |
2759 #if defined(SK_BUILD_FOR_MAC) | 2795 #if defined(SK_BUILD_FOR_MAC) |
2760 aglSwapBuffers(aglGetCurrentContext()); | 2796 aglSwapBuffers(aglGetCurrentContext()); |
2761 int set_a_break_pt_here = 9; | 2797 int set_a_break_pt_here = 9; |
2762 aglSwapBuffers(aglGetCurrentContext()); | 2798 aglSwapBuffers(aglGetCurrentContext()); |
2763 #elif defined(SK_BUILD_FOR_WIN32) | 2799 #elif defined(SK_BUILD_FOR_WIN32) |
2764 SwapBuf(); | 2800 SwapBuf(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 // the bound DRAW FBO ID. | 2877 // the bound DRAW FBO ID. |
2842 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 2878 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
2843 const GrGLIRect& vp = rt->getViewport(); | 2879 const GrGLIRect& vp = rt->getViewport(); |
2844 const SkIRect dirtyRect = rt->getResolveRect(); | 2880 const SkIRect dirtyRect = rt->getResolveRect(); |
2845 | 2881 |
2846 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) { | 2882 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) { |
2847 // Apple's extension uses the scissor as the blit bounds. | 2883 // Apple's extension uses the scissor as the blit bounds. |
2848 GrScissorState scissorState; | 2884 GrScissorState scissorState; |
2849 scissorState.set(dirtyRect); | 2885 scissorState.set(dirtyRect); |
2850 this->flushScissor(scissorState, vp, rt->origin()); | 2886 this->flushScissor(scissorState, vp, rt->origin()); |
| 2887 this->disableWindowRectangles(); |
2851 GL_CALL(ResolveMultisampleFramebuffer()); | 2888 GL_CALL(ResolveMultisampleFramebuffer()); |
2852 } else { | 2889 } else { |
2853 GrGLIRect r; | 2890 GrGLIRect r; |
2854 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, | 2891 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, |
2855 dirtyRect.width(), dirtyRect.height(), target->o
rigin()); | 2892 dirtyRect.width(), dirtyRect.height(), target->o
rigin()); |
2856 | 2893 |
2857 int right = r.fLeft + r.fWidth; | 2894 int right = r.fLeft + r.fWidth; |
2858 int top = r.fBottom + r.fHeight; | 2895 int top = r.fBottom + r.fHeight; |
2859 | 2896 |
2860 // BlitFrameBuffer respects the scissor, so disable it. | 2897 // BlitFrameBuffer respects the scissor, so disable it. |
2861 this->disableScissor(); | 2898 this->disableScissor(); |
| 2899 this->disableWindowRectangles(); |
2862 GL_CALL(BlitFramebuffer(r.fLeft, r.fBottom, right, top, | 2900 GL_CALL(BlitFramebuffer(r.fLeft, r.fBottom, right, top, |
2863 r.fLeft, r.fBottom, right, top, | 2901 r.fLeft, r.fBottom, right, top, |
2864 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); | 2902 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); |
2865 } | 2903 } |
2866 } | 2904 } |
2867 rt->flagAsResolved(); | 2905 rt->flagAsResolved(); |
2868 } | 2906 } |
2869 } | 2907 } |
2870 | 2908 |
2871 namespace { | 2909 namespace { |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4084 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); | 4122 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); |
4085 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); | 4123 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); |
4086 | 4124 |
4087 GrXferProcessor::BlendInfo blendInfo; | 4125 GrXferProcessor::BlendInfo blendInfo; |
4088 blendInfo.reset(); | 4126 blendInfo.reset(); |
4089 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4127 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4090 this->flushColorWrite(true); | 4128 this->flushColorWrite(true); |
4091 this->flushDrawFace(GrDrawFace::kBoth); | 4129 this->flushDrawFace(GrDrawFace::kBoth); |
4092 this->flushHWAAState(glRT, false, false); | 4130 this->flushHWAAState(glRT, false, false); |
4093 this->disableScissor(); | 4131 this->disableScissor(); |
| 4132 this->disableWindowRectangles(); |
4094 GrStencilSettings stencil; | 4133 GrStencilSettings stencil; |
4095 stencil.setDisabled(); | 4134 stencil.setDisabled(); |
4096 this->flushStencil(stencil); | 4135 this->flushStencil(stencil); |
4097 | 4136 |
4098 GL_CALL(DrawArrays(GR_GL_LINE_LOOP, 0, 4)); | 4137 GL_CALL(DrawArrays(GR_GL_LINE_LOOP, 0, 4)); |
4099 } | 4138 } |
4100 | 4139 |
4101 | 4140 |
4102 bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, | 4141 bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, |
4103 GrSurface* src, | 4142 GrSurface* src, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4172 sx1 - sx0, sy1 - sy0, sx0, sy0)); | 4211 sx1 - sx0, sy1 - sy0, sx0, sy0)); |
4173 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); | 4212 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); |
4174 | 4213 |
4175 GrXferProcessor::BlendInfo blendInfo; | 4214 GrXferProcessor::BlendInfo blendInfo; |
4176 blendInfo.reset(); | 4215 blendInfo.reset(); |
4177 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4216 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4178 this->flushColorWrite(true); | 4217 this->flushColorWrite(true); |
4179 this->flushDrawFace(GrDrawFace::kBoth); | 4218 this->flushDrawFace(GrDrawFace::kBoth); |
4180 this->flushHWAAState(nullptr, false, false); | 4219 this->flushHWAAState(nullptr, false, false); |
4181 this->disableScissor(); | 4220 this->disableScissor(); |
| 4221 this->disableWindowRectangles(); |
4182 GrStencilSettings stencil; | 4222 GrStencilSettings stencil; |
4183 stencil.setDisabled(); | 4223 stencil.setDisabled(); |
4184 this->flushStencil(stencil); | 4224 this->flushStencil(stencil); |
4185 | 4225 |
4186 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); | 4226 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); |
4187 this->unbindTextureFBOForCopy(GR_GL_FRAMEBUFFER, dst); | 4227 this->unbindTextureFBOForCopy(GR_GL_FRAMEBUFFER, dst); |
4188 this->didWriteToSurface(dst, &dstRect); | 4228 this->didWriteToSurface(dst, &dstRect); |
4189 | 4229 |
4190 return true; | 4230 return true; |
4191 } | 4231 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4256 src->origin()); | 4296 src->origin()); |
4257 dstGLRect.setRelativeTo(dstVP, | 4297 dstGLRect.setRelativeTo(dstVP, |
4258 dstRect.fLeft, | 4298 dstRect.fLeft, |
4259 dstRect.fTop, | 4299 dstRect.fTop, |
4260 dstRect.width(), | 4300 dstRect.width(), |
4261 dstRect.height(), | 4301 dstRect.height(), |
4262 dst->origin()); | 4302 dst->origin()); |
4263 | 4303 |
4264 // BlitFrameBuffer respects the scissor, so disable it. | 4304 // BlitFrameBuffer respects the scissor, so disable it. |
4265 this->disableScissor(); | 4305 this->disableScissor(); |
| 4306 this->disableWindowRectangles(); |
4266 | 4307 |
4267 GrGLint srcY0; | 4308 GrGLint srcY0; |
4268 GrGLint srcY1; | 4309 GrGLint srcY1; |
4269 // Does the blit need to y-mirror or not? | 4310 // Does the blit need to y-mirror or not? |
4270 if (src->origin() == dst->origin()) { | 4311 if (src->origin() == dst->origin()) { |
4271 srcY0 = srcGLRect.fBottom; | 4312 srcY0 = srcGLRect.fBottom; |
4272 srcY1 = srcGLRect.fBottom + srcGLRect.fHeight; | 4313 srcY1 = srcGLRect.fBottom + srcGLRect.fHeight; |
4273 } else { | 4314 } else { |
4274 srcY0 = srcGLRect.fBottom + srcGLRect.fHeight; | 4315 srcY0 = srcGLRect.fBottom + srcGLRect.fHeight; |
4275 srcY1 = srcGLRect.fBottom; | 4316 srcY1 = srcGLRect.fBottom; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4380 attribs->disableUnusedArrays(this, 0x1); | 4421 attribs->disableUnusedArrays(this, 0x1); |
4381 | 4422 |
4382 // Set "simple" state once: | 4423 // Set "simple" state once: |
4383 GrXferProcessor::BlendInfo blendInfo; | 4424 GrXferProcessor::BlendInfo blendInfo; |
4384 blendInfo.reset(); | 4425 blendInfo.reset(); |
4385 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4426 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4386 this->flushColorWrite(true); | 4427 this->flushColorWrite(true); |
4387 this->flushDrawFace(GrDrawFace::kBoth); | 4428 this->flushDrawFace(GrDrawFace::kBoth); |
4388 this->flushHWAAState(nullptr, false, false); | 4429 this->flushHWAAState(nullptr, false, false); |
4389 this->disableScissor(); | 4430 this->disableScissor(); |
| 4431 this->disableWindowRectangles(); |
4390 GrStencilSettings stencil; | 4432 GrStencilSettings stencil; |
4391 stencil.setDisabled(); | 4433 stencil.setDisabled(); |
4392 this->flushStencil(stencil); | 4434 this->flushStencil(stencil); |
4393 | 4435 |
4394 // Do all the blits: | 4436 // Do all the blits: |
4395 width = texture->width(); | 4437 width = texture->width(); |
4396 height = texture->height(); | 4438 height = texture->height(); |
4397 GrGLIRect viewport; | 4439 GrGLIRect viewport; |
4398 viewport.fLeft = 0; | 4440 viewport.fLeft = 0; |
4399 viewport.fBottom = 0; | 4441 viewport.fBottom = 0; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4655 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4614 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4656 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4615 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4657 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4616 copyParams->fWidth = texture->width(); | 4658 copyParams->fWidth = texture->width(); |
4617 copyParams->fHeight = texture->height(); | 4659 copyParams->fHeight = texture->height(); |
4618 return true; | 4660 return true; |
4619 } | 4661 } |
4620 } | 4662 } |
4621 return false; | 4663 return false; |
4622 } | 4664 } |
OLD | NEW |