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 | |
139 private: | 137 private: |
140 GrGLGpu(GrGLContext* ctx, GrContext* context); | 138 GrGLGpu(GrGLContext* ctx, GrContext* context); |
141 | 139 |
142 // GrGpu overrides | 140 // GrGpu overrides |
143 void onResetContext(uint32_t resetBits) override; | 141 void onResetContext(uint32_t resetBits) override; |
144 | 142 |
145 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; | 143 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; |
146 | 144 |
147 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 145 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, |
148 const void* srcData, size_t rowBytes) override; | 146 const void* srcData, size_t rowBytes) override; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 const SkIPoint& dstPoint); | 227 const SkIPoint& dstPoint); |
230 void copySurfaceAsCopyTexSubImage(GrSurface* dst, | 228 void copySurfaceAsCopyTexSubImage(GrSurface* dst, |
231 GrSurface* src, | 229 GrSurface* src, |
232 const SkIRect& srcRect, | 230 const SkIRect& srcRect, |
233 const SkIPoint& dstPoint); | 231 const SkIPoint& dstPoint); |
234 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, | 232 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, |
235 GrSurface* src, | 233 GrSurface* src, |
236 const SkIRect& srcRect, | 234 const SkIRect& srcRect, |
237 const SkIPoint& dstPoint); | 235 const SkIPoint& dstPoint); |
238 | 236 |
239 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p
osXformUniform, | |
240 GrGLuint arrayBuffer); | |
241 | |
242 void setupPixelLocalStorage(const DrawArgs& args); | |
243 | |
244 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 237 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
245 | 238 |
246 class ProgramCache : public ::SkNoncopyable { | 239 class ProgramCache : public ::SkNoncopyable { |
247 public: | 240 public: |
248 ProgramCache(GrGLGpu* gpu); | 241 ProgramCache(GrGLGpu* gpu); |
249 ~ProgramCache(); | 242 ~ProgramCache(); |
250 | 243 |
251 void reset(); | 244 void reset(); |
252 void abandon(); | 245 void abandon(); |
253 GrGLProgram* refProgram(const DrawArgs&); | 246 GrGLProgram* refProgram(const DrawArgs&); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 348 |
356 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co
pying. | 349 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co
pying. |
357 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); | 350 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); |
358 | 351 |
359 SkAutoTUnref<GrGLContext> fGLContext; | 352 SkAutoTUnref<GrGLContext> fGLContext; |
360 | 353 |
361 void createCopyPrograms(); | 354 void createCopyPrograms(); |
362 void createWireRectProgram(); | 355 void createWireRectProgram(); |
363 void createUnitRectBuffer(); | 356 void createUnitRectBuffer(); |
364 | 357 |
365 void createPLSSetupProgram(); | |
366 | |
367 // GL program-related state | 358 // GL program-related state |
368 ProgramCache* fProgramCache; | 359 ProgramCache* fProgramCache; |
369 | 360 |
370 /////////////////////////////////////////////////////////////////////////// | 361 /////////////////////////////////////////////////////////////////////////// |
371 ///@name Caching of GL State | 362 ///@name Caching of GL State |
372 ///@{ | 363 ///@{ |
373 int fHWActiveTextureUnitIdx; | 364 int fHWActiveTextureUnitIdx; |
374 GrGLuint fHWProgramID; | 365 GrGLuint fHWProgramID; |
375 | 366 |
376 enum TriState { | 367 enum TriState { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 case GR_GL_TEXTURE_EXTERNAL: | 558 case GR_GL_TEXTURE_EXTERNAL: |
568 return 1; | 559 return 1; |
569 case GR_GL_TEXTURE_RECTANGLE: | 560 case GR_GL_TEXTURE_RECTANGLE: |
570 return 2; | 561 return 2; |
571 default: | 562 default: |
572 SkFAIL("Unexpected texture target type."); | 563 SkFAIL("Unexpected texture target type."); |
573 return 0; | 564 return 0; |
574 } | 565 } |
575 } | 566 } |
576 | 567 |
577 struct { | |
578 GrGLuint fProgram; | |
579 GrGLint fPosXformUniform; | |
580 GrGLuint fArrayBuffer; | |
581 } fPLSSetupProgram; | |
582 | |
583 bool fHWPLSEnabled; | |
584 bool fPLSHasBeenUsed; | |
585 | |
586 typedef GrGpu INHERITED; | 568 typedef GrGpu INHERITED; |
587 friend class GrGLPathRendering; // For accessing setTextureUnit. | 569 friend class GrGLPathRendering; // For accessing setTextureUnit. |
588 }; | 570 }; |
589 | 571 |
590 #endif | 572 #endif |
OLD | NEW |