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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 SkASSERT(optState.getRenderTarget()); | 206 SkASSERT(optState.getRenderTarget()); |
207 | 207 |
208 if (kStencilPath_DrawType == optState.drawType()) { | 208 if (kStencilPath_DrawType == optState.drawType()) { |
209 const GrRenderTarget* rt = optState.getRenderTarget(); | 209 const GrRenderTarget* rt = optState.getRenderTarget(); |
210 SkISize size; | 210 SkISize size; |
211 size.set(rt->width(), rt->height()); | 211 size.set(rt->width(), rt->height()); |
212 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); | 212 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); |
213 } else { | 213 } else { |
214 this->flushMiscFixedFunctionState(optState); | 214 this->flushMiscFixedFunctionState(optState); |
215 | 215 |
216 GrBlendCoeff srcCoeff = optState.getSrcBlendCoeff(); | |
217 GrBlendCoeff dstCoeff = optState.getDstBlendCoeff(); | |
218 | |
219 fCurrentProgram.reset(fProgramCache->getProgram(optState)); | 216 fCurrentProgram.reset(fProgramCache->getProgram(optState)); |
220 if (NULL == fCurrentProgram.get()) { | 217 if (NULL == fCurrentProgram.get()) { |
221 SkDEBUGFAIL("Failed to create program!"); | 218 SkDEBUGFAIL("Failed to create program!"); |
222 return false; | 219 return false; |
223 } | 220 } |
224 | 221 |
225 fCurrentProgram.get()->ref(); | 222 fCurrentProgram.get()->ref(); |
226 | 223 |
227 GrGLuint programID = fCurrentProgram->programID(); | 224 GrGLuint programID = fCurrentProgram->programID(); |
228 if (fHWProgramID != programID) { | 225 if (fHWProgramID != programID) { |
229 GL_CALL(UseProgram(programID)); | 226 GL_CALL(UseProgram(programID)); |
230 fHWProgramID = programID; | 227 fHWProgramID = programID; |
231 } | 228 } |
232 | 229 |
233 this->flushBlend(optState, kDrawLines_DrawType == optState.drawType(), s
rcCoeff, dstCoeff); | 230 this->flushBlend(optState); |
234 | 231 |
235 fCurrentProgram->setData(optState); | 232 fCurrentProgram->setData(optState); |
236 } | 233 } |
237 | 234 |
238 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa
rget()); | 235 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa
rget()); |
239 this->flushStencil(optState.getStencil(), optState.drawType()); | 236 this->flushStencil(optState.getStencil(), optState.drawType()); |
240 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or
igin()); | 237 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or
igin()); |
241 this->flushAAState(optState); | 238 this->flushAAState(optState); |
242 | 239 |
243 // This must come after textures are flushed because a texture may need | 240 // This must come after textures are flushed because a texture may need |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 299 } |
303 | 300 |
304 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, | 301 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, |
305 const GrProgramDesc::DescInfo& descInfo, | 302 const GrProgramDesc::DescInfo& descInfo, |
306 GrGpu::DrawType drawType, | 303 GrGpu::DrawType drawType, |
307 GrProgramDesc* desc) { | 304 GrProgramDesc* desc) { |
308 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)
) { | 305 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)
) { |
309 SkDEBUGFAIL("Failed to generate GL program descriptor"); | 306 SkDEBUGFAIL("Failed to generate GL program descriptor"); |
310 } | 307 } |
311 } | 308 } |
OLD | NEW |