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 GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
10 | 10 |
11 #include "GrDrawState.h" | |
12 #include "GrGLContext.h" | 11 #include "GrGLContext.h" |
13 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
14 #include "GrGLIndexBuffer.h" | 13 #include "GrGLIndexBuffer.h" |
15 #include "GrGLPathRendering.h" | 14 #include "GrGLPathRendering.h" |
16 #include "GrGLProgram.h" | 15 #include "GrGLProgram.h" |
17 #include "GrGLRenderTarget.h" | 16 #include "GrGLRenderTarget.h" |
18 #include "GrGLStencilBuffer.h" | 17 #include "GrGLStencilBuffer.h" |
19 #include "GrGLTexture.h" | 18 #include "GrGLTexture.h" |
20 #include "GrGLVertexArray.h" | 19 #include "GrGLVertexArray.h" |
21 #include "GrGLVertexBuffer.h" | 20 #include "GrGLVertexBuffer.h" |
22 #include "GrGpu.h" | 21 #include "GrGpu.h" |
23 #include "GrOptDrawState.h" | 22 #include "GrPipelineBuilder.h" |
24 #include "GrXferProcessor.h" | 23 #include "GrXferProcessor.h" |
25 #include "SkTypes.h" | 24 #include "SkTypes.h" |
26 | 25 |
| 26 class GrPipeline; |
| 27 |
27 #ifdef SK_DEVELOPER | 28 #ifdef SK_DEVELOPER |
28 #define PROGRAM_CACHE_STATS | 29 #define PROGRAM_CACHE_STATS |
29 #endif | 30 #endif |
30 | 31 |
31 class GrGLGpu : public GrGpu { | 32 class GrGLGpu : public GrGpu { |
32 public: | 33 public: |
33 GrGLGpu(const GrGLContext& ctx, GrContext* context); | 34 GrGLGpu(const GrGLContext& ctx, GrContext* context); |
34 ~GrGLGpu() SK_OVERRIDE; | 35 ~GrGLGpu() SK_OVERRIDE; |
35 | 36 |
36 void contextAbandoned() SK_OVERRIDE; | 37 void contextAbandoned() SK_OVERRIDE; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const SkIRect& srcRect, | 100 const SkIRect& srcRect, |
100 const SkIPoint& dstPoint) SK_OVERRIDE; | 101 const SkIPoint& dstPoint) SK_OVERRIDE; |
101 | 102 |
102 bool canCopySurface(const GrSurface* dst, | 103 bool canCopySurface(const GrSurface* dst, |
103 const GrSurface* src, | 104 const GrSurface* src, |
104 const SkIRect& srcRect, | 105 const SkIRect& srcRect, |
105 const SkIPoint& dstPoint) SK_OVERRIDE; | 106 const SkIPoint& dstPoint) SK_OVERRIDE; |
106 | 107 |
107 void buildProgramDesc(GrProgramDesc*, | 108 void buildProgramDesc(GrProgramDesc*, |
108 const GrPrimitiveProcessor&, | 109 const GrPrimitiveProcessor&, |
109 const GrOptDrawState&, | 110 const GrPipeline&, |
110 const GrProgramDesc::DescInfo&, | 111 const GrProgramDesc::DescInfo&, |
111 const GrBatchTracker&) const SK_OVERRIDE; | 112 const GrBatchTracker&) const SK_OVERRIDE; |
112 | 113 |
113 private: | 114 private: |
114 // GrGpu overrides | 115 // GrGpu overrides |
115 void onResetContext(uint32_t resetBits) SK_OVERRIDE; | 116 void onResetContext(uint32_t resetBits) SK_OVERRIDE; |
116 | 117 |
117 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, bool budgeted, const v
oid* srcData, | 118 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, bool budgeted, const v
oid* srcData, |
118 size_t rowBytes) SK_OVERRIDE; | 119 size_t rowBytes) SK_OVERRIDE; |
119 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, bool budgete
d, | 120 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, bool budgete
d, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 160 |
160 void clearStencil(GrRenderTarget*) SK_OVERRIDE; | 161 void clearStencil(GrRenderTarget*) SK_OVERRIDE; |
161 | 162 |
162 // GrDrawTarget overrides | 163 // GrDrawTarget overrides |
163 void didAddGpuTraceMarker() SK_OVERRIDE; | 164 void didAddGpuTraceMarker() SK_OVERRIDE; |
164 void didRemoveGpuTraceMarker() SK_OVERRIDE; | 165 void didRemoveGpuTraceMarker() SK_OVERRIDE; |
165 | 166 |
166 // binds texture unit in GL | 167 // binds texture unit in GL |
167 void setTextureUnit(int unitIdx); | 168 void setTextureUnit(int unitIdx); |
168 | 169 |
169 // Flushes state from GrOptDrawState to GL. Returns false if the state could
n't be set. | 170 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. |
170 // TODO we only have need to know if this is a line draw for flushing AA sta
te on some buggy | 171 // TODO we only have need to know if this is a line draw for flushing AA sta
te on some buggy |
171 // hardware. Evaluate if this is really necessary anymore | 172 // hardware. Evaluate if this is really necessary anymore |
172 bool flushGLState(const DrawArgs&, bool isLineDraw); | 173 bool flushGLState(const DrawArgs&, bool isLineDraw); |
173 | 174 |
174 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 175 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
175 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 176 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start |
176 // index is relative to the returned offset. | 177 // index is relative to the returned offset. |
177 void setupGeometry(const GrPrimitiveProcessor&, | 178 void setupGeometry(const GrPrimitiveProcessor&, |
178 const GrDrawTarget::DrawInfo& info, | 179 const GrDrawTarget::DrawInfo& info, |
179 size_t* indexOffsetInBytes); | 180 size_t* indexOffsetInBytes); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 GrGLGpu* fGpu; | 221 GrGLGpu* fGpu; |
221 #ifdef PROGRAM_CACHE_STATS | 222 #ifdef PROGRAM_CACHE_STATS |
222 int fTotalRequests; | 223 int fTotalRequests; |
223 int fCacheMisses; | 224 int fCacheMisses; |
224 int fHashMisses; // cache hit but hash table mis
sed | 225 int fHashMisses; // cache hit but hash table mis
sed |
225 #endif | 226 #endif |
226 }; | 227 }; |
227 | 228 |
228 void flushDither(bool dither); | 229 void flushDither(bool dither); |
229 void flushColorWrite(bool writeColor); | 230 void flushColorWrite(bool writeColor); |
230 void flushDrawFace(GrDrawState::DrawFace face); | 231 void flushDrawFace(GrPipelineBuilder::DrawFace face); |
231 | 232 |
232 // flushes the scissor. see the note on flushBoundTextureAndParams about | 233 // flushes the scissor. see the note on flushBoundTextureAndParams about |
233 // flushing the scissor after that function is called. | 234 // flushing the scissor after that function is called. |
234 void flushScissor(const GrScissorState&, | 235 void flushScissor(const GrScissorState&, |
235 const GrGLIRect& rtViewport, | 236 const GrGLIRect& rtViewport, |
236 GrSurfaceOrigin rtOrigin); | 237 GrSurfaceOrigin rtOrigin); |
237 | 238 |
238 // disables the scissor | 239 // disables the scissor |
239 void disableScissor(); | 240 void disableScissor(); |
240 | 241 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 fEnabled = kUnknown_TriState; | 437 fEnabled = kUnknown_TriState; |
437 } | 438 } |
438 } fHWBlendState; | 439 } fHWBlendState; |
439 | 440 |
440 TriState fMSAAEnabled; | 441 TriState fMSAAEnabled; |
441 | 442 |
442 GrStencilSettings fHWStencilSettings; | 443 GrStencilSettings fHWStencilSettings; |
443 TriState fHWStencilTestEnabled; | 444 TriState fHWStencilTestEnabled; |
444 | 445 |
445 | 446 |
446 GrDrawState::DrawFace fHWDrawFace; | 447 GrPipelineBuilder::DrawFace fHWDrawFace; |
447 TriState fHWWriteToColor; | 448 TriState fHWWriteToColor; |
448 TriState fHWDitherEnabled; | 449 TriState fHWDitherEnabled; |
449 uint32_t fHWBoundRenderTargetUniqueID; | 450 uint32_t fHWBoundRenderTargetUniqueID; |
450 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; | 451 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; |
451 | 452 |
452 ///@} | 453 ///@} |
453 | 454 |
454 // we record what stencil format worked last time to hopefully exit early | 455 // we record what stencil format worked last time to hopefully exit early |
455 // from our loop that tries stencil formats and calls check fb status. | 456 // from our loop that tries stencil formats and calls check fb status. |
456 int fLastSuccessfulStencilFmtIdx; | 457 int fLastSuccessfulStencilFmtIdx; |
457 | 458 |
458 typedef GrGpu INHERITED; | 459 typedef GrGpu INHERITED; |
459 friend class GrGLPathRendering; // For accessing setTextureUnit. | 460 friend class GrGLPathRendering; // For accessing setTextureUnit. |
460 }; | 461 }; |
461 | 462 |
462 #endif | 463 #endif |
OLD | NEW |