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 "GrGLContext.h" | 11 #include "GrGLContext.h" |
12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
13 #include "GrGLIndexBuffer.h" | 13 #include "GrGLIndexBuffer.h" |
14 #include "GrGLPathRendering.h" | 14 #include "GrGLPathRendering.h" |
15 #include "GrGLProgram.h" | 15 #include "GrGLProgram.h" |
16 #include "GrGLRenderTarget.h" | 16 #include "GrGLRenderTarget.h" |
17 #include "GrGLStencilAttachment.h" | 17 #include "GrGLStencilAttachment.h" |
18 #include "GrGLTexture.h" | 18 #include "GrGLTexture.h" |
19 #include "GrGLVertexArray.h" | 19 #include "GrGLVertexArray.h" |
20 #include "GrGLVertexBuffer.h" | 20 #include "GrGLVertexBuffer.h" |
21 #include "GrGpu.h" | 21 #include "GrGpu.h" |
22 #include "GrPipelineBuilder.h" | 22 #include "GrPipelineBuilder.h" |
23 #include "GrXferProcessor.h" | 23 #include "GrXferProcessor.h" |
24 #include "SkTypes.h" | 24 #include "SkTypes.h" |
25 | 25 |
26 class GrPipeline; | 26 class GrPipeline; |
| 27 class GrVertices; |
27 | 28 |
28 #ifdef SK_DEVELOPER | 29 #ifdef SK_DEVELOPER |
29 #define PROGRAM_CACHE_STATS | 30 #define PROGRAM_CACHE_STATS |
30 #endif | 31 #endif |
31 | 32 |
32 class GrGLGpu : public GrGpu { | 33 class GrGLGpu : public GrGpu { |
33 public: | 34 public: |
34 GrGLGpu(const GrGLContext& ctx, GrContext* context); | 35 GrGLGpu(const GrGLContext& ctx, GrContext* context); |
35 ~GrGLGpu() override; | 36 ~GrGLGpu() override; |
36 | 37 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void* buffer, | 142 void* buffer, |
142 size_t rowBytes) override; | 143 size_t rowBytes) override; |
143 | 144 |
144 bool onWriteTexturePixels(GrTexture* texture, | 145 bool onWriteTexturePixels(GrTexture* texture, |
145 int left, int top, int width, int height, | 146 int left, int top, int width, int height, |
146 GrPixelConfig config, const void* buffer, | 147 GrPixelConfig config, const void* buffer, |
147 size_t rowBytes) override; | 148 size_t rowBytes) override; |
148 | 149 |
149 void onResolveRenderTarget(GrRenderTarget* target) override; | 150 void onResolveRenderTarget(GrRenderTarget* target) override; |
150 | 151 |
151 void onDraw(const DrawArgs&, const GrDrawTarget::DrawInfo&) override; | 152 void onDraw(const DrawArgs&, const GrVertices&) override; |
152 void onStencilPath(const GrPath*, const StencilPathState&) override; | 153 void onStencilPath(const GrPath*, const StencilPathState&) override; |
153 void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) ov
erride; | 154 void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) ov
erride; |
154 void onDrawPaths(const DrawArgs&, | 155 void onDrawPaths(const DrawArgs&, |
155 const GrPathRange*, | 156 const GrPathRange*, |
156 const void* indices, | 157 const void* indices, |
157 GrDrawTarget::PathIndexType, | 158 GrDrawTarget::PathIndexType, |
158 const float transformValues[], | 159 const float transformValues[], |
159 GrDrawTarget::PathTransformType, | 160 GrDrawTarget::PathTransformType, |
160 int count, | 161 int count, |
161 const GrStencilSettings&) override; | 162 const GrStencilSettings&) override; |
162 | 163 |
163 void clearStencil(GrRenderTarget*) override; | 164 void clearStencil(GrRenderTarget*) override; |
164 | 165 |
165 // GrDrawTarget overrides | 166 // GrDrawTarget overrides |
166 void didAddGpuTraceMarker() override; | 167 void didAddGpuTraceMarker() override; |
167 void didRemoveGpuTraceMarker() override; | 168 void didRemoveGpuTraceMarker() override; |
168 | 169 |
169 // binds texture unit in GL | 170 // binds texture unit in GL |
170 void setTextureUnit(int unitIdx); | 171 void setTextureUnit(int unitIdx); |
171 | 172 |
172 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. | 173 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. |
173 bool flushGLState(const DrawArgs&); | 174 bool flushGLState(const DrawArgs&); |
174 | 175 |
175 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 176 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
176 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 177 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
177 // index is relative to the returned offset. | 178 // index is relative to the returned offset. |
178 void setupGeometry(const GrPrimitiveProcessor&, | 179 void setupGeometry(const GrPrimitiveProcessor&, |
179 const GrDrawTarget::DrawInfo& info, | 180 const GrVertices& vertices, |
180 size_t* indexOffsetInBytes); | 181 size_t* indexOffsetInBytes); |
181 | 182 |
182 // Subclasses should call this to flush the blend state. | 183 // Subclasses should call this to flush the blend state. |
183 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); | 184 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); |
184 | 185 |
185 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 186 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
186 | 187 |
187 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 188 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
188 | 189 |
189 class ProgramCache : public ::SkNoncopyable { | 190 class ProgramCache : public ::SkNoncopyable { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 468 |
468 // we record what stencil format worked last time to hopefully exit early | 469 // we record what stencil format worked last time to hopefully exit early |
469 // from our loop that tries stencil formats and calls check fb status. | 470 // from our loop that tries stencil formats and calls check fb status. |
470 int fLastSuccessfulStencilFmtIdx; | 471 int fLastSuccessfulStencilFmtIdx; |
471 | 472 |
472 typedef GrGpu INHERITED; | 473 typedef GrGpu INHERITED; |
473 friend class GrGLPathRendering; // For accessing setTextureUnit. | 474 friend class GrGLPathRendering; // For accessing setTextureUnit. |
474 }; | 475 }; |
475 | 476 |
476 #endif | 477 #endif |
OLD | NEW |