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 |
11 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
12 #include "GrGLContext.h" | 12 #include "GrGLContext.h" |
13 #include "GrGLIRect.h" | 13 #include "GrGLIRect.h" |
14 #include "GrGLIndexBuffer.h" | 14 #include "GrGLIndexBuffer.h" |
15 #include "GrGLPathRendering.h" | 15 #include "GrGLPathRendering.h" |
16 #include "GrGLProgram.h" | 16 #include "GrGLProgram.h" |
17 #include "GrGLRenderTarget.h" | 17 #include "GrGLRenderTarget.h" |
18 #include "GrGLStencilBuffer.h" | 18 #include "GrGLStencilBuffer.h" |
19 #include "GrGLTexture.h" | 19 #include "GrGLTexture.h" |
20 #include "GrGLVertexArray.h" | 20 #include "GrGLVertexArray.h" |
21 #include "GrGLVertexBuffer.h" | 21 #include "GrGLVertexBuffer.h" |
22 #include "GrGpu.h" | 22 #include "GrGpu.h" |
23 #include "GrOptDrawState.h" | 23 #include "GrOptDrawState.h" |
| 24 #include "GrXferProcessor.h" |
24 #include "SkTypes.h" | 25 #include "SkTypes.h" |
25 | 26 |
26 #ifdef SK_DEVELOPER | 27 #ifdef SK_DEVELOPER |
27 #define PROGRAM_CACHE_STATS | 28 #define PROGRAM_CACHE_STATS |
28 #endif | 29 #endif |
29 | 30 |
30 class GrGLGpu : public GrGpu { | 31 class GrGLGpu : public GrGpu { |
31 public: | 32 public: |
32 GrGLGpu(const GrGLContext& ctx, GrContext* context); | 33 GrGLGpu(const GrGLContext& ctx, GrContext* context); |
33 ~GrGLGpu() SK_OVERRIDE; | 34 ~GrGLGpu() SK_OVERRIDE; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool flushGLState(const GrOptDrawState&); | 171 bool flushGLState(const GrOptDrawState&); |
171 | 172 |
172 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 173 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
173 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 174 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start |
174 // index is relative to the returned offset. | 175 // index is relative to the returned offset. |
175 void setupGeometry(const GrOptDrawState&, | 176 void setupGeometry(const GrOptDrawState&, |
176 const GrDrawTarget::DrawInfo& info, | 177 const GrDrawTarget::DrawInfo& info, |
177 size_t* indexOffsetInBytes); | 178 size_t* indexOffsetInBytes); |
178 | 179 |
179 // Subclasses should call this to flush the blend state. | 180 // Subclasses should call this to flush the blend state. |
180 void flushBlend(const GrOptDrawState& optState); | 181 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); |
181 | 182 |
182 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 183 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
183 | 184 |
184 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 185 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
185 | 186 |
186 class ProgramCache : public ::SkNoncopyable { | 187 class ProgramCache : public ::SkNoncopyable { |
187 public: | 188 public: |
188 ProgramCache(GrGLGpu* gpu); | 189 ProgramCache(GrGLGpu* gpu); |
189 ~ProgramCache(); | 190 ~ProgramCache(); |
190 | 191 |
(...skipping 26 matching lines...) Expand all Loading... |
217 unsigned int fCurrLRUStamp; | 218 unsigned int fCurrLRUStamp; |
218 GrGLGpu* fGpu; | 219 GrGLGpu* fGpu; |
219 #ifdef PROGRAM_CACHE_STATS | 220 #ifdef PROGRAM_CACHE_STATS |
220 int fTotalRequests; | 221 int fTotalRequests; |
221 int fCacheMisses; | 222 int fCacheMisses; |
222 int fHashMisses; // cache hit but hash table mis
sed | 223 int fHashMisses; // cache hit but hash table mis
sed |
223 #endif | 224 #endif |
224 }; | 225 }; |
225 | 226 |
226 void flushDither(bool dither); | 227 void flushDither(bool dither); |
227 void flushColorWriteDisable(bool disableColorWrites); | 228 void flushColorWrite(bool writeColor); |
228 void flushDrawFace(GrDrawState::DrawFace face); | 229 void flushDrawFace(GrDrawState::DrawFace face); |
229 | 230 |
230 // flushes the scissor. see the note on flushBoundTextureAndParams about | 231 // flushes the scissor. see the note on flushBoundTextureAndParams about |
231 // flushing the scissor after that function is called. | 232 // flushing the scissor after that function is called. |
232 void flushScissor(const GrScissorState&, | 233 void flushScissor(const GrScissorState&, |
233 const GrGLIRect& rtViewport, | 234 const GrGLIRect& rtViewport, |
234 GrSurfaceOrigin rtOrigin); | 235 GrSurfaceOrigin rtOrigin); |
235 | 236 |
236 // disables the scissor | 237 // disables the scissor |
237 void disableScissor(); | 238 void disableScissor(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 451 |
451 // we record what stencil format worked last time to hopefully exit early | 452 // we record what stencil format worked last time to hopefully exit early |
452 // from our loop that tries stencil formats and calls check fb status. | 453 // from our loop that tries stencil formats and calls check fb status. |
453 int fLastSuccessfulStencilFmtIdx; | 454 int fLastSuccessfulStencilFmtIdx; |
454 | 455 |
455 typedef GrGpu INHERITED; | 456 typedef GrGpu INHERITED; |
456 friend class GrGLPathRendering; // For accessing setTextureUnit. | 457 friend class GrGLPathRendering; // For accessing setTextureUnit. |
457 }; | 458 }; |
458 | 459 |
459 #endif | 460 #endif |
OLD | NEW |