| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 160 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
| 161 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 161 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start |
| 162 // index is relative to the returned offset. | 162 // index is relative to the returned offset. |
| 163 void setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes); | 163 void setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes); |
| 164 | 164 |
| 165 // Subclasses should call this to flush the blend state. | 165 // Subclasses should call this to flush the blend state. |
| 166 // The params should be the final coefficients to apply | 166 // The params should be the final coefficients to apply |
| 167 // (after any blending optimizations or dual source blending considerations | 167 // (after any blending optimizations or dual source blending considerations |
| 168 // have been accounted for). | 168 // have been accounted for). |
| 169 void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); | 169 void flushBlend(const GrOptDrawState& optState, bool isLines, |
| 170 GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); |
| 170 | 171 |
| 171 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 172 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
| 172 | 173 |
| 173 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 174 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
| 174 | 175 |
| 175 class ProgramCache : public ::SkNoncopyable { | 176 class ProgramCache : public ::SkNoncopyable { |
| 176 public: | 177 public: |
| 177 ProgramCache(GrGpuGL* gpu); | 178 ProgramCache(GrGpuGL* gpu); |
| 178 ~ProgramCache(); | 179 ~ProgramCache(); |
| 179 | 180 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 209 unsigned int fCurrLRUStamp; | 210 unsigned int fCurrLRUStamp; |
| 210 GrGpuGL* fGpu; | 211 GrGpuGL* fGpu; |
| 211 #ifdef PROGRAM_CACHE_STATS | 212 #ifdef PROGRAM_CACHE_STATS |
| 212 int fTotalRequests; | 213 int fTotalRequests; |
| 213 int fCacheMisses; | 214 int fCacheMisses; |
| 214 int fHashMisses; // cache hit but hash table mis
sed | 215 int fHashMisses; // cache hit but hash table mis
sed |
| 215 #endif | 216 #endif |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 // flushes dithering, color-mask, and face culling stat | 219 // flushes dithering, color-mask, and face culling stat |
| 219 void flushMiscFixedFunctionState(); | 220 void flushMiscFixedFunctionState(const GrOptDrawState&); |
| 220 | 221 |
| 221 // flushes the scissor. see the note on flushBoundTextureAndParams about | 222 // flushes the scissor. see the note on flushBoundTextureAndParams about |
| 222 // flushing the scissor after that function is called. | 223 // flushing the scissor after that function is called. |
| 223 void flushScissor(const GrGLIRect& rtViewport, GrSurfaceOrigin rtOrigin); | 224 void flushScissor(const GrGLIRect& rtViewport, GrSurfaceOrigin rtOrigin); |
| 224 | 225 |
| 225 void initFSAASupport(); | 226 void initFSAASupport(); |
| 226 | 227 |
| 227 // determines valid stencil formats | 228 // determines valid stencil formats |
| 228 void initStencilFormats(); | 229 void initStencilFormats(); |
| 229 | 230 |
| 230 // sets a texture unit to use for texture operations other than binding a te
xture to a program. | 231 // sets a texture unit to use for texture operations other than binding a te
xture to a program. |
| 231 // ensures that such operations don't negatively interact with tracking boun
d textures. | 232 // ensures that such operations don't negatively interact with tracking boun
d textures. |
| 232 void setScratchTextureUnit(); | 233 void setScratchTextureUnit(); |
| 233 | 234 |
| 234 // bounds is region that may be modified and therefore has to be resolved. | 235 // bounds is region that may be modified and therefore has to be resolved. |
| 235 // NULL means whole target. Can be an empty rect. | 236 // NULL means whole target. Can be an empty rect. |
| 236 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); | 237 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
| 237 | 238 |
| 238 void flushStencil(DrawType); | 239 void flushStencil(DrawType); |
| 239 void flushAAState(DrawType); | 240 void flushAAState(const GrOptDrawState&, DrawType); |
| 240 | 241 |
| 241 bool configToGLFormats(GrPixelConfig config, | 242 bool configToGLFormats(GrPixelConfig config, |
| 242 bool getSizedInternal, | 243 bool getSizedInternal, |
| 243 GrGLenum* internalFormat, | 244 GrGLenum* internalFormat, |
| 244 GrGLenum* externalFormat, | 245 GrGLenum* externalFormat, |
| 245 GrGLenum* externalType); | 246 GrGLenum* externalType); |
| 246 // helper for onCreateTexture and writeTexturePixels | 247 // helper for onCreateTexture and writeTexturePixels |
| 247 bool uploadTexData(const GrGLTexture::Desc& desc, | 248 bool uploadTexData(const GrGLTexture::Desc& desc, |
| 248 bool isNewTexture, | 249 bool isNewTexture, |
| 249 int left, int top, int width, int height, | 250 int left, int top, int width, int height, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 441 |
| 441 // we record what stencil format worked last time to hopefully exit early | 442 // we record what stencil format worked last time to hopefully exit early |
| 442 // from our loop that tries stencil formats and calls check fb status. | 443 // from our loop that tries stencil formats and calls check fb status. |
| 443 int fLastSuccessfulStencilFmtIdx; | 444 int fLastSuccessfulStencilFmtIdx; |
| 444 | 445 |
| 445 typedef GrGpu INHERITED; | 446 typedef GrGpu INHERITED; |
| 446 friend class GrGLPathRendering; // For accessing setTextureUnit. | 447 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 447 }; | 448 }; |
| 448 | 449 |
| 449 #endif | 450 #endif |
| OLD | NEW |