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 GrGpuGL_DEFINED | 8 #ifndef GrGpuGL_DEFINED |
9 #define GrGpuGL_DEFINED | 9 #define GrGpuGL_DEFINED |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 GrGpuGL(const GrGLContext& ctx, GrContext* context); | 31 GrGpuGL(const GrGLContext& ctx, GrContext* context); |
32 virtual ~GrGpuGL(); | 32 virtual ~GrGpuGL(); |
33 | 33 |
34 const GrGLInterface* glInterface() const { return fGLContext.interface(); } | 34 const GrGLInterface* glInterface() const { return fGLContext.interface(); } |
35 const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); } | 35 const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); } |
36 GrGLBinding glBinding() const { return fGLContext.info().binding(); } | 36 GrGLBinding glBinding() const { return fGLContext.info().binding(); } |
37 GrGLVersion glVersion() const { return fGLContext.info().version(); } | 37 GrGLVersion glVersion() const { return fGLContext.info().version(); } |
38 GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGener
ation(); } | 38 GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGener
ation(); } |
39 | 39 |
40 // Used by GrGLProgram to bind necessary textures for GrGLEffects. | 40 // Used by GrGLProgram and GrGLTexGenProgramEffects to configure OpenGL stat
e. |
41 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); | 41 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); |
| 42 void setProjectionMatrix(const SkMatrix& matrix, |
| 43 const SkISize& renderTargetSize, |
| 44 GrSurfaceOrigin renderTargetOrigin); |
| 45 enum TexGenComponents { |
| 46 kS_TexGenComponents = 1, |
| 47 kST_TexGenComponents = 2, |
| 48 kSTR_TexGenComponents = 3 |
| 49 }; |
| 50 void enableTexGen(int unitIdx, TexGenComponents, const GrGLfloat* coefficien
ts); |
| 51 void enableTexGen(int unitIdx, TexGenComponents, const SkMatrix& matrix); |
| 52 void disableUnusedTexGen(int numUsedTexCoordSets); |
42 | 53 |
43 bool programUnitTest(int maxStages); | 54 bool programUnitTest(int maxStages); |
44 | 55 |
45 // GrGpu overrides | 56 // GrGpu overrides |
46 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, | 57 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
47 GrPixelConfig surfaceConfig)
const SK_OVERRIDE; | 58 GrPixelConfig surfaceConfig)
const SK_OVERRIDE; |
48 virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig, | 59 virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig, |
49 GrPixelConfig surfaceConfig
) const SK_OVERRIDE; | 60 GrPixelConfig surfaceConfig
) const SK_OVERRIDE; |
50 virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig
) const SK_OVERRIDE; | 61 virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig
) const SK_OVERRIDE; |
51 virtual bool readPixelsWillPayForYFlip( | 62 virtual bool readPixelsWillPayForYFlip( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 int fCount; | 217 int fCount; |
207 unsigned int fCurrLRUStamp; | 218 unsigned int fCurrLRUStamp; |
208 GrGpuGL* fGpu; | 219 GrGpuGL* fGpu; |
209 #ifdef PROGRAM_CACHE_STATS | 220 #ifdef PROGRAM_CACHE_STATS |
210 int fTotalRequests; | 221 int fTotalRequests; |
211 int fCacheMisses; | 222 int fCacheMisses; |
212 int fHashMisses; // cache hit but hash table mis
sed | 223 int fHashMisses; // cache hit but hash table mis
sed |
213 #endif | 224 #endif |
214 }; | 225 }; |
215 | 226 |
216 // sets the matrix for path stenciling (uses the GL fixed pipe matrices) | |
217 void flushPathStencilMatrix(); | |
218 | |
219 // flushes dithering, color-mask, and face culling stat | 227 // flushes dithering, color-mask, and face culling stat |
220 void flushMiscFixedFunctionState(); | 228 void flushMiscFixedFunctionState(); |
221 | 229 |
222 // flushes the scissor. see the note on flushBoundTextureAndParams about | 230 // flushes the scissor. see the note on flushBoundTextureAndParams about |
223 // flushing the scissor after that function is called. | 231 // flushing the scissor after that function is called. |
224 void flushScissor(); | 232 void flushScissor(); |
225 | 233 |
226 void initFSAASupport(); | 234 void initFSAASupport(); |
227 | 235 |
228 // determines valid stencil formats | 236 // determines valid stencil formats |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 GrGLProgram::MatrixState fHWProjectionMatrixState; | 433 GrGLProgram::MatrixState fHWProjectionMatrixState; |
426 | 434 |
427 GrStencilSettings fHWStencilSettings; | 435 GrStencilSettings fHWStencilSettings; |
428 TriState fHWStencilTestEnabled; | 436 TriState fHWStencilTestEnabled; |
429 | 437 |
430 GrDrawState::DrawFace fHWDrawFace; | 438 GrDrawState::DrawFace fHWDrawFace; |
431 TriState fHWWriteToColor; | 439 TriState fHWWriteToColor; |
432 TriState fHWDitherEnabled; | 440 TriState fHWDitherEnabled; |
433 GrRenderTarget* fHWBoundRenderTarget; | 441 GrRenderTarget* fHWBoundRenderTarget; |
434 SkTArray<GrTexture*, true> fHWBoundTextures; | 442 SkTArray<GrTexture*, true> fHWBoundTextures; |
| 443 |
| 444 struct TexGenData { |
| 445 GrGLenum fMode; |
| 446 GrGLint fNumComponents; |
| 447 GrGLfloat fCoefficients[3 * 3]; |
| 448 }; |
| 449 int fHWActiveTexGenSets; |
| 450 SkTArray<TexGenData, true> fHWTexGenSettings; |
435 ///@} | 451 ///@} |
436 | 452 |
437 // we record what stencil format worked last time to hopefully exit early | 453 // we record what stencil format worked last time to hopefully exit early |
438 // from our loop that tries stencil formats and calls check fb status. | 454 // from our loop that tries stencil formats and calls check fb status. |
439 int fLastSuccessfulStencilFmtIdx; | 455 int fLastSuccessfulStencilFmtIdx; |
440 | 456 |
441 typedef GrGpu INHERITED; | 457 typedef GrGpu INHERITED; |
442 }; | 458 }; |
443 | 459 |
444 #endif | 460 #endif |
OLD | NEW |