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 #include "GrGpuGL.h" | 8 #include "GrGpuGL.h" |
9 | 9 |
10 #include "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 } | 195 } |
196 ++fCurrLRUStamp; | 196 ++fCurrLRUStamp; |
197 return entry->fProgram; | 197 return entry->fProgram; |
198 } | 198 } |
199 | 199 |
200 //////////////////////////////////////////////////////////////////////////////// | 200 //////////////////////////////////////////////////////////////////////////////// |
201 | 201 |
202 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 202 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
203 | 203 |
204 bool GrGpuGL::flushGraphicsState(const GrOptDrawState& optState, | 204 bool GrGpuGL::flushGraphicsState(const GrOptDrawState& optState, DrawType type)
{ |
205 DrawType type, | |
206 const GrDeviceCoordTexture* dstCopy) { | |
207 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. | 205 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. |
208 SkASSERT(optState.getRenderTarget()); | 206 SkASSERT(optState.getRenderTarget()); |
209 | 207 |
210 if (kStencilPath_DrawType == type) { | 208 if (kStencilPath_DrawType == type) { |
211 const GrRenderTarget* rt = optState.getRenderTarget(); | 209 const GrRenderTarget* rt = optState.getRenderTarget(); |
212 SkISize size; | 210 SkISize size; |
213 size.set(rt->width(), rt->height()); | 211 size.set(rt->width(), rt->height()); |
214 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); | 212 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); |
215 } else { | 213 } else { |
216 this->flushMiscFixedFunctionState(optState); | 214 this->flushMiscFixedFunctionState(optState); |
(...skipping 16 matching lines...) Expand all Loading... |
233 fCurrentProgram.get()->ref(); | 231 fCurrentProgram.get()->ref(); |
234 | 232 |
235 GrGLuint programID = fCurrentProgram->programID(); | 233 GrGLuint programID = fCurrentProgram->programID(); |
236 if (fHWProgramID != programID) { | 234 if (fHWProgramID != programID) { |
237 GL_CALL(UseProgram(programID)); | 235 GL_CALL(UseProgram(programID)); |
238 fHWProgramID = programID; | 236 fHWProgramID = programID; |
239 } | 237 } |
240 | 238 |
241 this->flushBlend(optState, kDrawLines_DrawType == type, srcCoeff, dstCoe
ff); | 239 this->flushBlend(optState, kDrawLines_DrawType == type, srcCoeff, dstCoe
ff); |
242 | 240 |
243 fCurrentProgram->setData(optState, type, dstCopy); | 241 fCurrentProgram->setData(optState, type); |
244 } | 242 } |
245 | 243 |
246 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa
rget()); | 244 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa
rget()); |
247 this->flushStencil(optState.getStencil(), type); | 245 this->flushStencil(optState.getStencil(), type); |
248 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or
igin()); | 246 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or
igin()); |
249 this->flushAAState(optState, type); | 247 this->flushAAState(optState, type); |
250 | 248 |
251 // This must come after textures are flushed because a texture may need | 249 // This must come after textures are flushed because a texture may need |
252 // to be msaa-resolved (which will modify bound FBO state). | 250 // to be msaa-resolved (which will modify bound FBO state). |
253 this->flushRenderTarget(glRT, NULL); | 251 this->flushRenderTarget(glRT, NULL); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 reinterpret_cast<GrGLvoid*>( | 300 reinterpret_cast<GrGLvoid*>( |
303 vertexOffsetInBytes + vertexAttrib->fOffset)); | 301 vertexOffsetInBytes + vertexAttrib->fOffset)); |
304 } | 302 } |
305 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 303 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
306 } | 304 } |
307 } | 305 } |
308 | 306 |
309 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, | 307 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, |
310 const GrProgramDesc::DescInfo& descInfo, | 308 const GrProgramDesc::DescInfo& descInfo, |
311 GrGpu::DrawType drawType, | 309 GrGpu::DrawType drawType, |
312 const GrDeviceCoordTexture* dstCopy, | |
313 GrProgramDesc* desc) { | 310 GrProgramDesc* desc) { |
314 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo
py, desc)) { | 311 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)
) { |
315 SkDEBUGFAIL("Failed to generate GL program descriptor"); | 312 SkDEBUGFAIL("Failed to generate GL program descriptor"); |
316 } | 313 } |
317 } | 314 } |
OLD | NEW |