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 #ifndef GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 127 |
128 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, | 128 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, |
129 GrPixelConfig config) const override; | 129 GrPixelConfig config) const override; |
130 bool isTestingOnlyBackendTexture(GrBackendObject) const override; | 130 bool isTestingOnlyBackendTexture(GrBackendObject) const override; |
131 void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) c onst override; | 131 void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) c onst override; |
132 | 132 |
133 void resetShaderCacheForTesting() const override; | 133 void resetShaderCacheForTesting() const override; |
134 | 134 |
135 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override; | 135 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override; |
136 | 136 |
137 void performFlushWorkaround() override; | |
138 | |
137 private: | 139 private: |
138 GrGLGpu(GrGLContext* ctx, GrContext* context); | 140 GrGLGpu(GrGLContext* ctx, GrContext* context); |
139 | 141 |
140 // GrGpu overrides | 142 // GrGpu overrides |
141 void onResetContext(uint32_t resetBits) override; | 143 void onResetContext(uint32_t resetBits) override; |
142 | 144 |
143 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; | 145 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; |
144 | 146 |
145 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, | 147 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, |
146 const void* srcData, size_t rowBytes) override; | 148 const void* srcData, size_t rowBytes) override; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 const SkIPoint& dstPoint); | 215 const SkIPoint& dstPoint); |
214 void copySurfaceAsCopyTexSubImage(GrSurface* dst, | 216 void copySurfaceAsCopyTexSubImage(GrSurface* dst, |
215 GrSurface* src, | 217 GrSurface* src, |
216 const SkIRect& srcRect, | 218 const SkIRect& srcRect, |
217 const SkIPoint& dstPoint); | 219 const SkIPoint& dstPoint); |
218 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, | 220 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, |
219 GrSurface* src, | 221 GrSurface* src, |
220 const SkIRect& srcRect, | 222 const SkIRect& srcRect, |
221 const SkIPoint& dstPoint); | 223 const SkIPoint& dstPoint); |
222 | 224 |
225 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p osXformUniform, | |
226 GrGLuint arrayBuffer); | |
227 | |
228 void setupPixelLocalStorage(const DrawArgs& args); | |
229 | |
223 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 230 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
224 | 231 |
225 class ProgramCache : public ::SkNoncopyable { | 232 class ProgramCache : public ::SkNoncopyable { |
226 public: | 233 public: |
227 ProgramCache(GrGLGpu* gpu); | 234 ProgramCache(GrGLGpu* gpu); |
228 ~ProgramCache(); | 235 ~ProgramCache(); |
229 | 236 |
230 void reset(); | 237 void reset(); |
231 void abandon(); | 238 void abandon(); |
232 GrGLProgram* refProgram(const DrawArgs&); | 239 GrGLProgram* refProgram(const DrawArgs&); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 | 341 |
335 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co pying. | 342 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co pying. |
336 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); | 343 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); |
337 | 344 |
338 SkAutoTUnref<GrGLContext> fGLContext; | 345 SkAutoTUnref<GrGLContext> fGLContext; |
339 | 346 |
340 void createCopyPrograms(); | 347 void createCopyPrograms(); |
341 void createWireRectProgram(); | 348 void createWireRectProgram(); |
342 void createUnitRectBuffer(); | 349 void createUnitRectBuffer(); |
343 | 350 |
351 void createPLSSetupProgram(); | |
352 | |
344 // GL program-related state | 353 // GL program-related state |
345 ProgramCache* fProgramCache; | 354 ProgramCache* fProgramCache; |
346 | 355 |
347 /////////////////////////////////////////////////////////////////////////// | 356 /////////////////////////////////////////////////////////////////////////// |
348 ///@name Caching of GL State | 357 ///@name Caching of GL State |
349 ///@{ | 358 ///@{ |
350 int fHWActiveTextureUnitIdx; | 359 int fHWActiveTextureUnitIdx; |
351 GrGLuint fHWProgramID; | 360 GrGLuint fHWProgramID; |
352 | 361 |
353 enum TriState { | 362 enum TriState { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 case GR_GL_TEXTURE_EXTERNAL: | 553 case GR_GL_TEXTURE_EXTERNAL: |
545 return 1; | 554 return 1; |
546 case GR_GL_TEXTURE_RECTANGLE: | 555 case GR_GL_TEXTURE_RECTANGLE: |
547 return 2; | 556 return 2; |
548 default: | 557 default: |
549 SkFAIL("Unexpected texture target type."); | 558 SkFAIL("Unexpected texture target type."); |
550 return 0; | 559 return 0; |
551 } | 560 } |
552 } | 561 } |
553 | 562 |
563 struct { | |
564 GrGLuint fProgram; | |
565 GrGLint fPosXformUniform; | |
566 GrGLuint fArrayBuffer; | |
567 } fPLSSetupProgram; | |
568 | |
569 bool fHWPLSEnabled; | |
570 bool fPLSHasBeenUsed = false; | |
bsalomon
2016/01/21 21:54:08
Hm.. we don't use this type of init anywhere else.
| |
571 | |
554 typedef GrGpu INHERITED; | 572 typedef GrGpu INHERITED; |
555 friend class GrGLPathRendering; // For accessing setTextureUnit. | 573 friend class GrGLPathRendering; // For accessing setTextureUnit. |
556 }; | 574 }; |
557 | 575 |
558 #endif | 576 #endif |
OLD | NEW |