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 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool copySurface(GrSurface* dst, | 97 bool copySurface(GrSurface* dst, |
98 GrSurface* src, | 98 GrSurface* src, |
99 const SkIRect& srcRect, | 99 const SkIRect& srcRect, |
100 const SkIPoint& dstPoint) SK_OVERRIDE; | 100 const SkIPoint& dstPoint) SK_OVERRIDE; |
101 | 101 |
102 bool canCopySurface(const GrSurface* dst, | 102 bool canCopySurface(const GrSurface* dst, |
103 const GrSurface* src, | 103 const GrSurface* src, |
104 const SkIRect& srcRect, | 104 const SkIRect& srcRect, |
105 const SkIPoint& dstPoint) SK_OVERRIDE; | 105 const SkIPoint& dstPoint) SK_OVERRIDE; |
106 | 106 |
107 protected: | 107 void buildProgramDesc(GrProgramDesc*, |
108 void buildProgramDesc(const GrOptDrawState&, | 108 const GrPrimitiveProcessor&, |
| 109 const GrOptDrawState&, |
109 const GrProgramDesc::DescInfo&, | 110 const GrProgramDesc::DescInfo&, |
110 GrGpu::DrawType, | 111 GrGpu::DrawType, |
111 GrProgramDesc*) 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, |
120 const void* srcData) SK_OVERRIDE; | 121 const void* srcData) SK_OVERRIDE; |
121 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_OVERRIDE; | 122 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... |
138 void* buffer, | 139 void* buffer, |
139 size_t rowBytes) SK_OVERRIDE; | 140 size_t rowBytes) SK_OVERRIDE; |
140 | 141 |
141 bool onWriteTexturePixels(GrTexture* texture, | 142 bool onWriteTexturePixels(GrTexture* texture, |
142 int left, int top, int width, int height, | 143 int left, int top, int width, int height, |
143 GrPixelConfig config, const void* buffer, | 144 GrPixelConfig config, const void* buffer, |
144 size_t rowBytes) SK_OVERRIDE; | 145 size_t rowBytes) SK_OVERRIDE; |
145 | 146 |
146 void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; | 147 void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; |
147 | 148 |
148 void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK_OVERRID
E; | 149 void onDraw(const DrawArgs&, const GrDrawTarget::DrawInfo&) SK_OVERRIDE; |
149 void onStencilPath(const GrPath*, const StencilPathState&) SK_OVERRIDE; | 150 void onStencilPath(const GrPath*, const StencilPathState&) SK_OVERRIDE; |
150 void onDrawPath(const GrOptDrawState&, const GrPath*, const GrStencilSetting
s&) SK_OVERRIDE; | 151 void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) SK
_OVERRIDE; |
151 void onDrawPaths(const GrOptDrawState&, | 152 void onDrawPaths(const DrawArgs&, |
152 const GrPathRange*, | 153 const GrPathRange*, |
153 const void* indices, | 154 const void* indices, |
154 GrDrawTarget::PathIndexType, | 155 GrDrawTarget::PathIndexType, |
155 const float transformValues[], | 156 const float transformValues[], |
156 GrDrawTarget::PathTransformType, | 157 GrDrawTarget::PathTransformType, |
157 int count, | 158 int count, |
158 const GrStencilSettings&) SK_OVERRIDE; | 159 const GrStencilSettings&) SK_OVERRIDE; |
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 GrOptDrawState to GL. Returns false if the state could
n't be set. |
170 bool flushGLState(const GrOptDrawState&); | 171 bool flushGLState(const DrawArgs&); |
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 GrPrimitiveProcessor&, |
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 GrXferProcessor::BlendInfo& blendInfo); | 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 |
191 void abandon(); | 192 void abandon(); |
192 GrGLProgram* getProgram(const GrOptDrawState&); | 193 GrGLProgram* getProgram(const DrawArgs&); |
193 | 194 |
194 private: | 195 private: |
195 enum { | 196 enum { |
196 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new | 197 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new |
197 // shader before evicting from the cache. | 198 // shader before evicting from the cache. |
198 kMaxEntries = 128, | 199 kMaxEntries = 128, |
199 kHashBits = 6, | 200 kHashBits = 6, |
200 }; | 201 }; |
201 | 202 |
202 struct Entry; | 203 struct Entry; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 452 |
452 // we record what stencil format worked last time to hopefully exit early | 453 // we record what stencil format worked last time to hopefully exit early |
453 // from our loop that tries stencil formats and calls check fb status. | 454 // from our loop that tries stencil formats and calls check fb status. |
454 int fLastSuccessfulStencilFmtIdx; | 455 int fLastSuccessfulStencilFmtIdx; |
455 | 456 |
456 typedef GrGpu INHERITED; | 457 typedef GrGpu INHERITED; |
457 friend class GrGLPathRendering; // For accessing setTextureUnit. | 458 friend class GrGLPathRendering; // For accessing setTextureUnit. |
458 }; | 459 }; |
459 | 460 |
460 #endif | 461 #endif |
OLD | NEW |