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

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 11 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/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.h » ('j') | 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 "GrInOrderDrawBuffer.h" 8 #include "GrInOrderDrawBuffer.h"
9 9
10 #include "GrDefaultGeoProcFactory.h" 10 #include "GrDefaultGeoProcFactory.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 kTraceCmdBit = 0x80, 107 kTraceCmdBit = 0x80,
108 kCmdMask = 0x7f, 108 kCmdMask = 0x7f,
109 }; 109 };
110 110
111 static inline uint8_t add_trace_bit(uint8_t cmd) { return cmd | kTraceCmdBit; } 111 static inline uint8_t add_trace_bit(uint8_t cmd) { return cmd | kTraceCmdBit; }
112 112
113 static inline uint8_t strip_trace_bit(uint8_t cmd) { return cmd & kCmdMask; } 113 static inline uint8_t strip_trace_bit(uint8_t cmd) { return cmd & kCmdMask; }
114 114
115 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); } 115 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); }
116 116
117 void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds, 117 void GrInOrderDrawBuffer::onDrawRect(GrPipelineBuilder* pipelineBuilder,
118 GrColor color, 118 GrColor color,
119 const SkMatrix& viewMatrix, 119 const SkMatrix& viewMatrix,
120 const SkRect& rect, 120 const SkRect& rect,
121 const SkRect* localRect, 121 const SkRect* localRect,
122 const SkMatrix* localMatrix) { 122 const SkMatrix* localMatrix) {
123 GrDrawState::AutoRestoreEffects are(ds); 123 GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
124 124
125 // Go to device coords to allow batching across matrix changes 125 // Go to device coords to allow batching across matrix changes
126 SkMatrix invert = SkMatrix::I(); 126 SkMatrix invert = SkMatrix::I();
127 127
128 // if we have a local rect, then we apply the localMatrix directly to the lo calRect to generate 128 // if we have a local rect, then we apply the localMatrix directly to the lo calRect to generate
129 // vertex local coords 129 // vertex local coords
130 bool hasExplicitLocalCoords = SkToBool(localRect); 130 bool hasExplicitLocalCoords = SkToBool(localRect);
131 if (!hasExplicitLocalCoords) { 131 if (!hasExplicitLocalCoords) {
132 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) { 132 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) {
133 SkDebugf("Could not invert\n"); 133 SkDebugf("Could not invert\n");
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 static const int kColorOffset = sizeof(SkPoint); 178 static const int kColorOffset = sizeof(SkPoint);
179 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset); 179 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset);
180 for (int i = 0; i < 4; ++i) { 180 for (int i = 0; i < 4; ++i) {
181 *vertColor = color; 181 *vertColor = color;
182 vertColor = (GrColor*) ((intptr_t) vertColor + vstride); 182 vertColor = (GrColor*) ((intptr_t) vertColor + vstride);
183 } 183 }
184 184
185 this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer()); 185 this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
186 this->drawIndexedInstances(ds, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &dev Bounds); 186 this->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType, 1, 4, 6,
187 &devBounds);
187 } 188 }
188 189
189 int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawIn fo& info) { 190 int GrInOrderDrawBuffer::concatInstancedDraw(const GrPipelineBuilder& pipelineBu ilder,
191 const DrawInfo& info) {
190 SkASSERT(!fCmdBuffer.empty()); 192 SkASSERT(!fCmdBuffer.empty());
191 SkASSERT(info.isInstanced()); 193 SkASSERT(info.isInstanced());
192 194
193 const GeometrySrcState& geomSrc = this->getGeomSrc(); 195 const GeometrySrcState& geomSrc = this->getGeomSrc();
194 196
195 // we only attempt to concat the case when reserved verts are used with a cl ient-specified index 197 // we only attempt to concat the case when reserved verts are used with a cl ient-specified index
196 // buffer. To make this work with client-specified VBs we'd need to know if the VB was updated 198 // buffer. To make this work with client-specified VBs we'd need to know if the VB was updated
197 // between draws. 199 // between draws.
198 if (kReserved_GeometrySrcType != geomSrc.fVertexSrc || 200 if (kReserved_GeometrySrcType != geomSrc.fVertexSrc ||
199 kBuffer_GeometrySrcType != geomSrc.fIndexSrc) { 201 kBuffer_GeometrySrcType != geomSrc.fIndexSrc) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 fGpuCmdMarkers.back().addSet(this->getActiveTraceMarkers()); 233 fGpuCmdMarkers.back().addSet(this->getActiveTraceMarkers());
232 } else { 234 } else {
233 fGpuCmdMarkers.push_back(this->getActiveTraceMarkers()); 235 fGpuCmdMarkers.push_back(this->getActiveTraceMarkers());
234 draw->fType = add_trace_bit(draw->fType); 236 draw->fType = add_trace_bit(draw->fType);
235 } 237 }
236 } 238 }
237 239
238 return instancesToConcat; 240 return instancesToConcat;
239 } 241 }
240 242
241 void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds, 243 void GrInOrderDrawBuffer::onDraw(const GrPipelineBuilder& pipelineBuilder,
242 const GrGeometryProcessor* gp, 244 const GrGeometryProcessor* gp,
243 const DrawInfo& info, 245 const DrawInfo& info,
244 const GrScissorState& scissorState, 246 const GrScissorState& scissorState,
245 const GrDeviceCoordTexture* dstCopy) { 247 const GrDeviceCoordTexture* dstCopy) {
246 SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer())); 248 SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
247 249
248 if (!this->recordStateAndShouldDraw(ds, gp, scissorState, dstCopy)) { 250 if (!this->recordStateAndShouldDraw(pipelineBuilder, gp, scissorState, dstCo py)) {
249 return; 251 return;
250 } 252 }
251 253
252 Draw* draw; 254 Draw* draw;
253 if (info.isInstanced()) { 255 if (info.isInstanced()) {
254 int instancesConcated = this->concatInstancedDraw(ds, info); 256 int instancesConcated = this->concatInstancedDraw(pipelineBuilder, info) ;
255 if (info.instanceCount() > instancesConcated) { 257 if (info.instanceCount() > instancesConcated) {
256 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info)); 258 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info));
257 draw->fInfo.adjustInstanceCount(-instancesConcated); 259 draw->fInfo.adjustInstanceCount(-instancesConcated);
258 } else { 260 } else {
259 return; 261 return;
260 } 262 }
261 } else { 263 } else {
262 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info)); 264 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info));
263 } 265 }
264 this->recordTraceMarkersIfNecessary(); 266 this->recordTraceMarkersIfNecessary();
265 } 267 }
266 268
267 void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds, 269 void GrInOrderDrawBuffer::onStencilPath(const GrPipelineBuilder& pipelineBuilder ,
268 const GrPathProcessor* pathProc, 270 const GrPathProcessor* pathProc,
269 const GrPath* path, 271 const GrPath* path,
270 const GrScissorState& scissorState, 272 const GrScissorState& scissorState,
271 const GrStencilSettings& stencilSettings ) { 273 const GrStencilSettings& stencilSettings ) {
272 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath, 274 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath,
273 (path, ds.getRenderTarget())); 275 (path, pipelineBuilder.getRenderT arget()));
274 sp->fScissor = scissorState; 276 sp->fScissor = scissorState;
275 sp->fUseHWAA = ds.isHWAntialias(); 277 sp->fUseHWAA = pipelineBuilder.isHWAntialias();
276 sp->fViewMatrix = pathProc->viewMatrix(); 278 sp->fViewMatrix = pathProc->viewMatrix();
277 sp->fStencil = stencilSettings; 279 sp->fStencil = stencilSettings;
278 this->recordTraceMarkersIfNecessary(); 280 this->recordTraceMarkersIfNecessary();
279 } 281 }
280 282
281 void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds, 283 void GrInOrderDrawBuffer::onDrawPath(const GrPipelineBuilder& pipelineBuilder,
282 const GrPathProcessor* pathProc, 284 const GrPathProcessor* pathProc,
283 const GrPath* path, 285 const GrPath* path,
284 const GrScissorState& scissorState, 286 const GrScissorState& scissorState,
285 const GrStencilSettings& stencilSettings, 287 const GrStencilSettings& stencilSettings,
286 const GrDeviceCoordTexture* dstCopy) { 288 const GrDeviceCoordTexture* dstCopy) {
287 // TODO: Only compare the subset of GrDrawState relevant to path covering? 289 // TODO: Only compare the subset of GrPipelineBuilder relevant to path cover ing?
288 if (!this->recordStateAndShouldDraw(ds, pathProc, scissorState, dstCopy)) { 290 if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, dstCopy)) {
289 return; 291 return;
290 } 292 }
291 DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path)); 293 DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path));
292 dp->fStencilSettings = stencilSettings; 294 dp->fStencilSettings = stencilSettings;
293 this->recordTraceMarkersIfNecessary(); 295 this->recordTraceMarkersIfNecessary();
294 } 296 }
295 297
296 void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds, 298 void GrInOrderDrawBuffer::onDrawPaths(const GrPipelineBuilder& pipelineBuilder,
297 const GrPathProcessor* pathProc, 299 const GrPathProcessor* pathProc,
298 const GrPathRange* pathRange, 300 const GrPathRange* pathRange,
299 const void* indices, 301 const void* indices,
300 PathIndexType indexType, 302 PathIndexType indexType,
301 const float transformValues[], 303 const float transformValues[],
302 PathTransformType transformType, 304 PathTransformType transformType,
303 int count, 305 int count,
304 const GrScissorState& scissorState, 306 const GrScissorState& scissorState,
305 const GrStencilSettings& stencilSettings, 307 const GrStencilSettings& stencilSettings,
306 const GrDeviceCoordTexture* dstCopy) { 308 const GrDeviceCoordTexture* dstCopy) {
307 SkASSERT(pathRange); 309 SkASSERT(pathRange);
308 SkASSERT(indices); 310 SkASSERT(indices);
309 SkASSERT(transformValues); 311 SkASSERT(transformValues);
310 312
311 if (!this->recordStateAndShouldDraw(ds, pathProc, scissorState, dstCopy)) { 313 if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, dstCopy)) {
312 return; 314 return;
313 } 315 }
314 316
315 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType); 317 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
316 if (int misalign = fPathIndexBuffer.count() % indexBytes) { 318 if (int misalign = fPathIndexBuffer.count() % indexBytes) {
317 // Add padding to the index buffer so the indices are aligned properly. 319 // Add padding to the index buffer so the indices are aligned properly.
318 fPathIndexBuffer.append(indexBytes - misalign); 320 fPathIndexBuffer.append(indexBytes - misalign);
319 } 321 }
320 322
321 char* savedIndices = fPathIndexBuffer.append(count * indexBytes, 323 char* savedIndices = fPathIndexBuffer.append(count * indexBytes,
322 reinterpret_cast<const char*>(i ndices)); 324 reinterpret_cast<const char*>(i ndices));
323 float* savedTransforms = fPathTransformBuffer.append( 325 float* savedTransforms = fPathTransformBuffer.append(
324 count * GrPathRendering::PathTransformSize(tran sformType), 326 count * GrPathRendering::PathTransformSize(tran sformType),
325 transformValues); 327 transformValues);
326 328
327 if (kDrawPaths_Cmd == strip_trace_bit(fCmdBuffer.back().fType)) { 329 if (kDrawPaths_Cmd == strip_trace_bit(fCmdBuffer.back().fType)) {
328 // The previous command was also DrawPaths. Try to collapse this call in to the one 330 // The previous command was also DrawPaths. Try to collapse this call in to the one
329 // before. Note that stenciling all the paths at once, then covering, ma y not be 331 // before. Note that stenciling all the paths at once, then covering, ma y not be
330 // equivalent to two separate draw calls if there is overlap. Blending w on't work, 332 // equivalent to two separate draw calls if there is overlap. Blending w on't work,
331 // and the combined calls may also cancel each other's winding numbers i n some 333 // and the combined calls may also cancel each other's winding numbers i n some
332 // places. For now the winding numbers are only an issue if the fill is even/odd, 334 // places. For now the winding numbers are only an issue if the fill is even/odd,
333 // because DrawPaths is currently only used for glyphs, and glyphs in th e same 335 // because DrawPaths is currently only used for glyphs, and glyphs in th e same
334 // font tend to all wind in the same direction. 336 // font tend to all wind in the same direction.
335 DrawPaths* previous = static_cast<DrawPaths*>(&fCmdBuffer.back()); 337 DrawPaths* previous = static_cast<DrawPaths*>(&fCmdBuffer.back());
336 if (pathRange == previous->pathRange() && 338 if (pathRange == previous->pathRange() &&
337 indexType == previous->fIndexType && 339 indexType == previous->fIndexType &&
338 transformType == previous->fTransformType && 340 transformType == previous->fTransformType &&
339 stencilSettings == previous->fStencilSettings && 341 stencilSettings == previous->fStencilSettings &&
340 path_fill_type_is_winding(stencilSettings) && 342 path_fill_type_is_winding(stencilSettings) &&
341 !ds.willBlendWithDst(pathProc)) { 343 !pipelineBuilder.willBlendWithDst(pathProc)) {
342 // Fold this DrawPaths call into the one previous. 344 // Fold this DrawPaths call into the one previous.
343 previous->fCount += count; 345 previous->fCount += count;
344 return; 346 return;
345 } 347 }
346 } 348 }
347 349
348 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPaths, (pathRange)) ; 350 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPaths, (pathRange)) ;
349 dp->fIndicesLocation = SkToU32(savedIndices - fPathIndexBuffer.begin()); 351 dp->fIndicesLocation = SkToU32(savedIndices - fPathIndexBuffer.begin());
350 dp->fIndexType = indexType; 352 dp->fIndexType = indexType;
351 dp->fTransformsLocation = SkToU32(savedTransforms - fPathTransformBuffer.beg in()); 353 dp->fTransformsLocation = SkToU32(savedTransforms - fPathTransformBuffer.beg in());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (cmd_has_trace_marker(iter->fType)) { 425 if (cmd_has_trace_marker(iter->fType)) {
424 traceString = fGpuCmdMarkers[currCmdMarker].toString(); 426 traceString = fGpuCmdMarkers[currCmdMarker].toString();
425 newMarker.fMarker = traceString.c_str(); 427 newMarker.fMarker = traceString.c_str();
426 this->getGpu()->addGpuTraceMarker(&newMarker); 428 this->getGpu()->addGpuTraceMarker(&newMarker);
427 ++currCmdMarker; 429 ++currCmdMarker;
428 } 430 }
429 431
430 if (kSetState_Cmd == strip_trace_bit(iter->fType)) { 432 if (kSetState_Cmd == strip_trace_bit(iter->fType)) {
431 SetState* ss = reinterpret_cast<SetState*>(iter.get()); 433 SetState* ss = reinterpret_cast<SetState*>(iter.get());
432 434
433 this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcesso r, ss->fState, 435 this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcesso r, ss->fPipeline,
434 ss->fState.descInfo(), ss->fBatchTr acker); 436 ss->fPipeline.descInfo(), ss->fBatc hTracker);
435 currentState = ss; 437 currentState = ss;
436 438
437 } else { 439 } else {
438 iter->execute(this, currentState); 440 iter->execute(this, currentState);
439 } 441 }
440 442
441 if (cmd_has_trace_marker(iter->fType)) { 443 if (cmd_has_trace_marker(iter->fType)) {
442 this->getGpu()->removeGpuTraceMarker(&newMarker); 444 this->getGpu()->removeGpuTraceMarker(&newMarker);
443 } 445 }
444 } 446 }
445 447
446 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker); 448 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker);
447 ++fDrawID; 449 ++fDrawID;
448 } 450 }
449 451
450 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState * state) { 452 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState * state) {
451 SkASSERT(state); 453 SkASSERT(state);
452 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes c, 454 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->f Desc,
453 &state->fBatchTracker); 455 &state->fBatchTracker);
454 buf->getGpu()->draw(args, fInfo); 456 buf->getGpu()->draw(args, fInfo);
455 } 457 }
456 458
457 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, const S etState*) { 459 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, const S etState*) {
458 GrGpu::StencilPathState state; 460 GrGpu::StencilPathState state;
459 state.fRenderTarget = fRenderTarget.get(); 461 state.fRenderTarget = fRenderTarget.get();
460 state.fScissor = &fScissor; 462 state.fScissor = &fScissor;
461 state.fStencil = &fStencil; 463 state.fStencil = &fStencil;
462 state.fUseHWAA = fUseHWAA; 464 state.fUseHWAA = fUseHWAA;
463 state.fViewMatrix = &fViewMatrix; 465 state.fViewMatrix = &fViewMatrix;
464 466
465 buf->getGpu()->stencilPath(this->path(), state); 467 buf->getGpu()->stencilPath(this->path(), state);
466 } 468 }
467 469
468 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetS tate* state) { 470 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetS tate* state) {
469 SkASSERT(state); 471 SkASSERT(state);
470 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes c, 472 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->f Desc,
471 &state->fBatchTracker); 473 &state->fBatchTracker);
472 buf->getGpu()->drawPath(args, this->path(), fStencilSettings); 474 buf->getGpu()->drawPath(args, this->path(), fStencilSettings);
473 } 475 }
474 476
475 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const Set State* state) { 477 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const Set State* state) {
476 SkASSERT(state); 478 SkASSERT(state);
477 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes c, 479 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->f Desc,
478 &state->fBatchTracker); 480 &state->fBatchTracker);
479 buf->getGpu()->drawPaths(args, this->pathRange(), 481 buf->getGpu()->drawPaths(args, this->pathRange(),
480 &buf->fPathIndexBuffer[fIndicesLocation], fIndexType , 482 &buf->fPathIndexBuffer[fIndicesLocation], fIndexType ,
481 &buf->fPathTransformBuffer[fTransformsLocation], fTr ansformType, 483 &buf->fPathTransformBuffer[fTransformsLocation], fTr ansformType,
482 fCount, fStencilSettings); 484 fCount, fStencilSettings);
483 } 485 }
484 486
485 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const SetState *) {} 487 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const SetState *) {}
486 488
487 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const SetStat e*) { 489 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const SetStat e*) {
(...skipping 19 matching lines...) Expand all
507 if (getGpu()->canCopySurface(dst, src, srcRect, dstPoint)) { 509 if (getGpu()->canCopySurface(dst, src, srcRect, dstPoint)) {
508 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst , src)); 510 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst , src));
509 cs->fSrcRect = srcRect; 511 cs->fSrcRect = srcRect;
510 cs->fDstPoint = dstPoint; 512 cs->fDstPoint = dstPoint;
511 this->recordTraceMarkersIfNecessary(); 513 this->recordTraceMarkersIfNecessary();
512 return true; 514 return true;
513 } 515 }
514 return false; 516 return false;
515 } 517 }
516 518
517 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, 519 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrPipelineBuilder& pipe lineBuilder,
518 const GrPrimitiveProcessor* p rimProc, 520 const GrPrimitiveProcessor* p rimProc,
519 const GrScissorState& scissor , 521 const GrScissorState& scissor ,
520 const GrDeviceCoordTexture* d stCopy) { 522 const GrDeviceCoordTexture* d stCopy) {
521 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, 523 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState,
522 (ds, primProc, *this->getGpu()->caps (), scissor, 524 (pipelineBuilder, primProc, *this->g etGpu()->caps(),
523 dstCopy)); 525 scissor, dstCopy));
524 if (ss->fState.mustSkip()) { 526 if (ss->fPipeline.mustSkip()) {
525 fCmdBuffer.pop_back(); 527 fCmdBuffer.pop_back();
526 return false; 528 return false;
527 } 529 }
528 530
529 ss->fPrimitiveProcessor->initBatchTracker(&ss->fBatchTracker, 531 ss->fPrimitiveProcessor->initBatchTracker(&ss->fBatchTracker,
530 ss->fState.getInitBatchTracker()); 532 ss->fPipeline.getInitBatchTracker( ));
531 533
532 if (fPrevState && 534 if (fPrevState &&
533 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, 535 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
534 *ss->fPrimitiveProcessor, 536 *ss->fPrimitiveProcessor,
535 ss->fBatchTracker) && 537 ss->fBatchTracker) &&
536 fPrevState->fState.isEqual(ss->fState)) { 538 fPrevState->fPipeline.isEqual(ss->fPipeline)) {
537 fCmdBuffer.pop_back(); 539 fCmdBuffer.pop_back();
538 } else { 540 } else {
539 fPrevState = ss; 541 fPrevState = ss;
540 this->recordTraceMarkersIfNecessary(); 542 this->recordTraceMarkersIfNecessary();
541 } 543 }
542 return true; 544 return true;
543 } 545 }
544 546
545 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 547 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
546 SkASSERT(!fCmdBuffer.empty()); 548 SkASSERT(!fCmdBuffer.empty());
547 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 549 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
548 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 550 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
549 if (activeTraceMarkers.count() > 0) { 551 if (activeTraceMarkers.count() > 0) {
550 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 552 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
551 fGpuCmdMarkers.push_back(activeTraceMarkers); 553 fGpuCmdMarkers.push_back(activeTraceMarkers);
552 } 554 }
553 } 555 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698