Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: src/gpu/gl/GrGpuGL_program.cpp

Issue 599963002: Use OptDrawState instead of DrawState when flushing state in GrGpuGL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true. 210 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
211 SkASSERT(optState->getRenderTarget()); 211 SkASSERT(optState->getRenderTarget());
212 212
213 if (kStencilPath_DrawType == type) { 213 if (kStencilPath_DrawType == type) {
214 const GrRenderTarget* rt = optState->getRenderTarget(); 214 const GrRenderTarget* rt = optState->getRenderTarget();
215 SkISize size; 215 SkISize size;
216 size.set(rt->width(), rt->height()); 216 size.set(rt->width(), rt->height());
217 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(), size, rt->origin()); 217 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(), size, rt->origin());
218 } else { 218 } else {
219 this->flushMiscFixedFunctionState(); 219 this->flushMiscFixedFunctionState(*optState.get());
220 220
221 GrBlendCoeff srcCoeff = optState->getSrcBlendCoeff(); 221 GrBlendCoeff srcCoeff = optState->getSrcBlendCoeff();
222 GrBlendCoeff dstCoeff = optState->getDstBlendCoeff(); 222 GrBlendCoeff dstCoeff = optState->getDstBlendCoeff();
223 223
224 // In these blend coeff's we end up drawing nothing so we can skip draw all together 224 // In these blend coeff's we end up drawing nothing so we can skip draw all together
225 if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff && 225 if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff &&
226 !optState->getStencil().doesWrite()) { 226 !optState->getStencil().doesWrite()) {
227 return false; 227 return false;
228 } 228 }
229 229
(...skipping 25 matching lines...) Expand all
255 } 255 }
256 256
257 fCurrentProgram.get()->ref(); 257 fCurrentProgram.get()->ref();
258 258
259 GrGLuint programID = fCurrentProgram->programID(); 259 GrGLuint programID = fCurrentProgram->programID();
260 if (fHWProgramID != programID) { 260 if (fHWProgramID != programID) {
261 GL_CALL(UseProgram(programID)); 261 GL_CALL(UseProgram(programID));
262 fHWProgramID = programID; 262 fHWProgramID = programID;
263 } 263 }
264 264
265 this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff); 265 this->flushBlend(*optState.get(), kDrawLines_DrawType == type, srcCoeff, dstCoeff);
266 266
267 fCurrentProgram->setData(*optState.get(), 267 fCurrentProgram->setData(*optState.get(),
268 type, 268 type,
269 geometryProcessor, 269 geometryProcessor,
270 colorStages.begin(), 270 colorStages.begin(),
271 coverageStages.begin(), 271 coverageStages.begin(),
272 dstCopy, 272 dstCopy,
273 &fSharedGLProgramState); 273 &fSharedGLProgramState);
274 } 274 }
275 275
276 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderT arget()); 276 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderT arget());
277 this->flushStencil(type); 277 this->flushStencil(type);
278 this->flushScissor(glRT->getViewport(), glRT->origin()); 278 this->flushScissor(glRT->getViewport(), glRT->origin());
279 this->flushAAState(type); 279 this->flushAAState(*optState.get(), type);
280 280
281 SkIRect* devRect = NULL; 281 SkIRect* devRect = NULL;
282 SkIRect devClipBounds; 282 SkIRect devClipBounds;
283 if (optState->isClipState()) { 283 if (optState->isClipState()) {
284 this->getClip()->getConservativeBounds(optState->getRenderTarget(), &dev ClipBounds); 284 this->getClip()->getConservativeBounds(optState->getRenderTarget(), &dev ClipBounds);
285 devRect = &devClipBounds; 285 devRect = &devClipBounds;
286 } 286 }
287 // This must come after textures are flushed because a texture may need 287 // This must come after textures are flushed because a texture may need
288 // to be msaa-resolved (which will modify bound FBO state). 288 // to be msaa-resolved (which will modify bound FBO state).
289 this->flushRenderTarget(glRT, devRect); 289 this->flushRenderTarget(glRT, devRect);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GrGLAttribTypeToLayout(attribType).fCount, 362 GrGLAttribTypeToLayout(attribType).fCount,
363 GrGLAttribTypeToLayout(attribType).fType, 363 GrGLAttribTypeToLayout(attribType).fType,
364 GrGLAttribTypeToLayout(attribType).fNormalized, 364 GrGLAttribTypeToLayout(attribType).fNormalized,
365 stride, 365 stride,
366 reinterpret_cast<GrGLvoid*>( 366 reinterpret_cast<GrGLvoid*>(
367 vertexOffsetInBytes + vertexAttrib->fOffset)); 367 vertexOffsetInBytes + vertexAttrib->fOffset));
368 } 368 }
369 attribState->disableUnusedArrays(this, usedAttribArraysMask); 369 attribState->disableUnusedArrays(this, usedAttribArraysMask);
370 } 370 }
371 } 371 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698