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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int left, int top, int width, int height, | 148 int left, int top, int width, int height, |
149 GrPixelConfig config, const void* buffer, | 149 GrPixelConfig config, const void* buffer, |
150 size_t rowBytes) SK_OVERRIDE; | 150 size_t rowBytes) SK_OVERRIDE; |
151 | 151 |
152 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; | 152 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; |
153 | 153 |
154 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK
_OVERRIDE; | 154 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK
_OVERRIDE; |
155 | 155 |
156 | 156 |
157 virtual void clearStencil(GrRenderTarget*) SK_OVERRIDE; | 157 virtual void clearStencil(GrRenderTarget*) SK_OVERRIDE; |
158 virtual bool flushGraphicsState(const GrOptDrawState&) SK_OVERRIDE; | 158 virtual bool flushGraphicsState(const GrOptDrawState&, DrawType) SK_OVERRIDE
; |
159 | 159 |
160 // GrDrawTarget overrides | 160 // GrDrawTarget overrides |
161 virtual void didAddGpuTraceMarker() SK_OVERRIDE; | 161 virtual void didAddGpuTraceMarker() SK_OVERRIDE; |
162 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE; | 162 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE; |
163 | 163 |
164 // binds texture unit in GL | 164 // binds texture unit in GL |
165 void setTextureUnit(int unitIdx); | 165 void setTextureUnit(int unitIdx); |
166 | 166 |
167 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 167 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
168 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 168 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start |
(...skipping 12 matching lines...) Expand all Loading... |
181 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 181 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
182 | 182 |
183 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 183 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
184 | 184 |
185 class ProgramCache : public ::SkNoncopyable { | 185 class ProgramCache : public ::SkNoncopyable { |
186 public: | 186 public: |
187 ProgramCache(GrGpuGL* gpu); | 187 ProgramCache(GrGpuGL* gpu); |
188 ~ProgramCache(); | 188 ~ProgramCache(); |
189 | 189 |
190 void abandon(); | 190 void abandon(); |
191 GrGLProgram* getProgram(const GrOptDrawState&); | 191 GrGLProgram* getProgram(const GrOptDrawState&, DrawType); |
192 | 192 |
193 private: | 193 private: |
194 enum { | 194 enum { |
195 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new | 195 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new |
196 // shader before evicting from the cache. | 196 // shader before evicting from the cache. |
197 kMaxEntries = 128, | 197 kMaxEntries = 128, |
198 kHashBits = 6, | 198 kHashBits = 6, |
199 }; | 199 }; |
200 | 200 |
201 struct Entry; | 201 struct Entry; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // sets a texture unit to use for texture operations other than binding a te
xture to a program. | 242 // sets a texture unit to use for texture operations other than binding a te
xture to a program. |
243 // ensures that such operations don't negatively interact with tracking boun
d textures. | 243 // ensures that such operations don't negatively interact with tracking boun
d textures. |
244 void setScratchTextureUnit(); | 244 void setScratchTextureUnit(); |
245 | 245 |
246 // bounds is region that may be modified and therefore has to be resolved. | 246 // bounds is region that may be modified and therefore has to be resolved. |
247 // NULL means whole target. Can be an empty rect. | 247 // NULL means whole target. Can be an empty rect. |
248 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); | 248 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
249 | 249 |
250 void flushStencil(const GrStencilSettings&, DrawType); | 250 void flushStencil(const GrStencilSettings&, DrawType); |
251 void flushAAState(const GrOptDrawState&); | 251 void flushAAState(const GrOptDrawState&, DrawType); |
252 | 252 |
253 bool configToGLFormats(GrPixelConfig config, | 253 bool configToGLFormats(GrPixelConfig config, |
254 bool getSizedInternal, | 254 bool getSizedInternal, |
255 GrGLenum* internalFormat, | 255 GrGLenum* internalFormat, |
256 GrGLenum* externalFormat, | 256 GrGLenum* externalFormat, |
257 GrGLenum* externalType); | 257 GrGLenum* externalType); |
258 // helper for onCreateTexture and writeTexturePixels | 258 // helper for onCreateTexture and writeTexturePixels |
259 bool uploadTexData(const GrSurfaceDesc& desc, | 259 bool uploadTexData(const GrSurfaceDesc& desc, |
260 bool isNewTexture, | 260 bool isNewTexture, |
261 int left, int top, int width, int height, | 261 int left, int top, int width, int height, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 // we record what stencil format worked last time to hopefully exit early | 449 // we record what stencil format worked last time to hopefully exit early |
450 // from our loop that tries stencil formats and calls check fb status. | 450 // from our loop that tries stencil formats and calls check fb status. |
451 int fLastSuccessfulStencilFmtIdx; | 451 int fLastSuccessfulStencilFmtIdx; |
452 | 452 |
453 typedef GrGpu INHERITED; | 453 typedef GrGpu INHERITED; |
454 friend class GrGLPathRendering; // For accessing setTextureUnit. | 454 friend class GrGLPathRendering; // For accessing setTextureUnit. |
455 }; | 455 }; |
456 | 456 |
457 #endif | 457 #endif |
OLD | NEW |