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 13 matching lines...) Expand all Loading... | |
24 #ifdef SK_DEVELOPER | 24 #ifdef SK_DEVELOPER |
25 #define PROGRAM_CACHE_STATS | 25 #define PROGRAM_CACHE_STATS |
26 #endif | 26 #endif |
27 | 27 |
28 class GrGpuGL : public GrGpu { | 28 class GrGpuGL : public GrGpu { |
29 public: | 29 public: |
30 GrGpuGL(const GrGLContext& ctx, GrContext* context); | 30 GrGpuGL(const GrGLContext& ctx, GrContext* context); |
31 virtual ~GrGpuGL(); | 31 virtual ~GrGpuGL(); |
32 | 32 |
33 const GrGLInterface* glInterface() const { return fGLContext.interface(); } | 33 const GrGLInterface* glInterface() const { return fGLContext.interface(); } |
34 const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); } | |
Chris Dalton
2013/09/05 05:29:24
We could avoid having to add this getter by sendin
| |
34 GrGLBinding glBinding() const { return fGLContext.info().binding(); } | 35 GrGLBinding glBinding() const { return fGLContext.info().binding(); } |
35 GrGLVersion glVersion() const { return fGLContext.info().version(); } | 36 GrGLVersion glVersion() const { return fGLContext.info().version(); } |
36 GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGener ation(); } | 37 GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGener ation(); } |
37 | 38 |
38 // Used by GrGLProgram to bind necessary textures for GrGLEffects. | 39 // Used by GrGLProgram to bind necessary textures for GrGLEffects. |
39 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te xture); | 40 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te xture); |
40 | 41 |
41 bool programUnitTest(int maxStages); | 42 bool programUnitTest(int maxStages); |
42 | 43 |
43 // GrGpu overrides | 44 // GrGpu overrides |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); | 165 void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); |
165 | 166 |
166 bool hasExtension(const char* ext) const { return fGLContext.info().hasExten sion(ext); } | 167 bool hasExtension(const char* ext) const { return fGLContext.info().hasExten sion(ext); } |
167 | 168 |
168 const GrGLContext& glContext() const { return fGLContext; } | 169 const GrGLContext& glContext() const { return fGLContext; } |
169 | 170 |
170 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 171 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
171 | 172 |
172 class ProgramCache : public ::GrNoncopyable { | 173 class ProgramCache : public ::GrNoncopyable { |
173 public: | 174 public: |
174 ProgramCache(const GrGLContext& gl); | 175 ProgramCache(GrGpuGL* gpu); |
175 ~ProgramCache(); | 176 ~ProgramCache(); |
176 | 177 |
177 void abandon(); | 178 void abandon(); |
178 GrGLProgram* getProgram(const GrGLProgramDesc& desc, | 179 GrGLProgram* getProgram(const GrGLProgramDesc& desc, |
179 const GrEffectStage* colorStages[], | 180 const GrEffectStage* colorStages[], |
180 const GrEffectStage* coverageStages[]); | 181 const GrEffectStage* coverageStages[]); |
181 | 182 |
182 private: | 183 private: |
183 enum { | 184 enum { |
184 // We may actually have kMaxEntries+1 shaders in the GL context beca use we create a new | 185 // We may actually have kMaxEntries+1 shaders in the GL context beca use we create a new |
(...skipping 11 matching lines...) Expand all Loading... | |
196 int search(const GrGLProgramDesc& desc) const; | 197 int search(const GrGLProgramDesc& desc) const; |
197 | 198 |
198 // sorted array of all the entries | 199 // sorted array of all the entries |
199 Entry* fEntries[kMaxEntries]; | 200 Entry* fEntries[kMaxEntries]; |
200 // hash table based on lowest kHashBits bits of the program key. Used to avoid binary | 201 // hash table based on lowest kHashBits bits of the program key. Used to avoid binary |
201 // searching fEntries. | 202 // searching fEntries. |
202 Entry* fHashTable[1 << kHashBits]; | 203 Entry* fHashTable[1 << kHashBits]; |
203 | 204 |
204 int fCount; | 205 int fCount; |
205 unsigned int fCurrLRUStamp; | 206 unsigned int fCurrLRUStamp; |
206 const GrGLContext& fGL; | 207 GrGpuGL* fGpu; |
207 #ifdef PROGRAM_CACHE_STATS | 208 #ifdef PROGRAM_CACHE_STATS |
208 int fTotalRequests; | 209 int fTotalRequests; |
209 int fCacheMisses; | 210 int fCacheMisses; |
210 int fHashMisses; // cache hit but hash table mis sed | 211 int fHashMisses; // cache hit but hash table mis sed |
211 #endif | 212 #endif |
212 }; | 213 }; |
213 | 214 |
214 // sets the matrix for path stenciling (uses the GL fixed pipe matrices) | 215 // sets the matrix for path stenciling (uses the GL fixed pipe matrices) |
215 void flushPathStencilMatrix(); | 216 void flushPathStencilMatrix(); |
216 | 217 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 ///@} | 431 ///@} |
431 | 432 |
432 // we record what stencil format worked last time to hopefully exit early | 433 // we record what stencil format worked last time to hopefully exit early |
433 // from our loop that tries stencil formats and calls check fb status. | 434 // from our loop that tries stencil formats and calls check fb status. |
434 int fLastSuccessfulStencilFmtIdx; | 435 int fLastSuccessfulStencilFmtIdx; |
435 | 436 |
436 typedef GrGpu INHERITED; | 437 typedef GrGpu INHERITED; |
437 }; | 438 }; |
438 | 439 |
439 #endif | 440 #endif |
OLD | NEW |