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

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

Issue 742763002: scissor state on optstate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 1 month 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 "GrBufferAllocPool.h" 10 #include "GrBufferAllocPool.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset); 183 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset);
184 for (int i = 0; i < 4; ++i) { 184 for (int i = 0; i < 4; ++i) {
185 *vertColor = color; 185 *vertColor = color;
186 vertColor = (GrColor*) ((intptr_t) vertColor + vstride); 186 vertColor = (GrColor*) ((intptr_t) vertColor + vstride);
187 } 187 }
188 188
189 this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer()); 189 this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
190 this->drawIndexedInstances(ds, kTriangles_GrPrimitiveType, 1, 4, 6, &devBoun ds); 190 this->drawIndexedInstances(ds, kTriangles_GrPrimitiveType, 1, 4, 6, &devBoun ds);
191 } 191 }
192 192
193 int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, 193 int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawIn fo& info) {
194 const DrawInfo& info,
195 const GrClipMaskManager::ScissorSta te& scissorState) {
196 SkASSERT(!fCmdBuffer.empty()); 194 SkASSERT(!fCmdBuffer.empty());
197 SkASSERT(info.isInstanced()); 195 SkASSERT(info.isInstanced());
198 196
199 const GeometrySrcState& geomSrc = this->getGeomSrc(); 197 const GeometrySrcState& geomSrc = this->getGeomSrc();
200 198
201 // we only attempt to concat the case when reserved verts are used with a cl ient-specified index 199 // we only attempt to concat the case when reserved verts are used with a cl ient-specified index
202 // buffer. To make this work with client-specified VBs we'd need to know if the VB was updated 200 // buffer. To make this work with client-specified VBs we'd need to know if the VB was updated
203 // between draws. 201 // between draws.
204 if (kReserved_GeometrySrcType != geomSrc.fVertexSrc || 202 if (kReserved_GeometrySrcType != geomSrc.fVertexSrc ||
205 kBuffer_GeometrySrcType != geomSrc.fIndexSrc) { 203 kBuffer_GeometrySrcType != geomSrc.fIndexSrc) {
206 return 0; 204 return 0;
207 } 205 }
208 // Check if there is a draw info that is compatible that uses the same VB fr om the pool and 206 // Check if there is a draw info that is compatible that uses the same VB fr om the pool and
209 // the same IB 207 // the same IB
210 if (kDraw_Cmd != strip_trace_bit(fCmdBuffer.back().fType)) { 208 if (kDraw_Cmd != strip_trace_bit(fCmdBuffer.back().fType)) {
211 return 0; 209 return 0;
212 } 210 }
213 211
214 Draw* draw = static_cast<Draw*>(&fCmdBuffer.back()); 212 Draw* draw = static_cast<Draw*>(&fCmdBuffer.back());
215 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 213 GeometryPoolState& poolState = fGeoPoolStateStack.back();
216 const GrVertexBuffer* vertexBuffer = poolState.fPoolVertexBuffer; 214 const GrVertexBuffer* vertexBuffer = poolState.fPoolVertexBuffer;
217 215
218 if (!draw->fInfo.isInstanced() || 216 if (!draw->fInfo.isInstanced() ||
219 draw->fInfo.verticesPerInstance() != info.verticesPerInstance() || 217 draw->fInfo.verticesPerInstance() != info.verticesPerInstance() ||
220 draw->fInfo.indicesPerInstance() != info.indicesPerInstance() || 218 draw->fInfo.indicesPerInstance() != info.indicesPerInstance() ||
221 draw->fInfo.vertexBuffer() != vertexBuffer || 219 draw->fInfo.vertexBuffer() != vertexBuffer ||
222 draw->fInfo.indexBuffer() != geomSrc.fIndexBuffer || 220 draw->fInfo.indexBuffer() != geomSrc.fIndexBuffer) {
223 draw->fScissorState != scissorState) {
224 return 0; 221 return 0;
225 } 222 }
226 // info does not yet account for the offset from the start of the pool's VB while the previous 223 // info does not yet account for the offset from the start of the pool's VB while the previous
227 // draw record does. 224 // draw record does.
228 int adjustedStartVertex = poolState.fPoolStartVertex + info.startVertex(); 225 int adjustedStartVertex = poolState.fPoolStartVertex + info.startVertex();
229 if (draw->fInfo.startVertex() + draw->fInfo.vertexCount() != adjustedStartVe rtex) { 226 if (draw->fInfo.startVertex() + draw->fInfo.vertexCount() != adjustedStartVe rtex) {
230 return 0; 227 return 0;
231 } 228 }
232 229
233 SkASSERT(poolState.fPoolStartVertex == draw->fInfo.startVertex() + draw->fIn fo.vertexCount()); 230 SkASSERT(poolState.fPoolStartVertex == draw->fInfo.startVertex() + draw->fIn fo.vertexCount());
(...skipping 17 matching lines...) Expand all
251 fGpuCmdMarkers.push_back(this->getActiveTraceMarkers()); 248 fGpuCmdMarkers.push_back(this->getActiveTraceMarkers());
252 draw->fType = add_trace_bit(draw->fType); 249 draw->fType = add_trace_bit(draw->fType);
253 } 250 }
254 } 251 }
255 252
256 return instancesToConcat; 253 return instancesToConcat;
257 } 254 }
258 255
259 void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds, 256 void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
260 const DrawInfo& info, 257 const DrawInfo& info,
261 const GrClipMaskManager::ScissorState& scissorS tate) { 258 const ScissorState& scissorState) {
262 SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer())); 259 SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
263 260
264 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 261 GeometryPoolState& poolState = fGeoPoolStateStack.back();
265 262
266 if (!this->recordStateAndShouldDraw(ds, GrGpu::PrimTypeToDrawType(info.primi tiveType()), 263 if (!this->recordStateAndShouldDraw(ds, GrGpu::PrimTypeToDrawType(info.primi tiveType()),
267 info.getDstCopy())) { 264 scissorState, info.getDstCopy())) {
268 return; 265 return;
269 } 266 }
270 267
271 Draw* draw; 268 Draw* draw;
272 if (info.isInstanced()) { 269 if (info.isInstanced()) {
273 int instancesConcated = this->concatInstancedDraw(ds, info, scissorState ); 270 int instancesConcated = this->concatInstancedDraw(ds, info);
274 if (info.instanceCount() > instancesConcated) { 271 if (info.instanceCount() > instancesConcated) {
275 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorStat e)); 272 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info));
276 draw->fInfo.adjustInstanceCount(-instancesConcated); 273 draw->fInfo.adjustInstanceCount(-instancesConcated);
277 } else { 274 } else {
278 return; 275 return;
279 } 276 }
280 } else { 277 } else {
281 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorState)); 278 draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info));
282 } 279 }
283 this->recordTraceMarkersIfNecessary(); 280 this->recordTraceMarkersIfNecessary();
284 281
285 // Adjust the starting vertex and index when we are using reserved or array sources to 282 // Adjust the starting vertex and index when we are using reserved or array sources to
286 // compensate for the fact that the data was inserted into a larger vb/ib ow ned by the pool. 283 // compensate for the fact that the data was inserted into a larger vb/ib ow ned by the pool.
287 if (kBuffer_GeometrySrcType != this->getGeomSrc().fVertexSrc) { 284 if (kBuffer_GeometrySrcType != this->getGeomSrc().fVertexSrc) {
288 size_t bytes = (info.vertexCount() + info.startVertex()) * ds.getVertexS tride(); 285 size_t bytes = (info.vertexCount() + info.startVertex()) * ds.getVertexS tride();
289 poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, bytes); 286 poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, bytes);
290 draw->fInfo.adjustStartVertex(poolState.fPoolStartVertex); 287 draw->fInfo.adjustStartVertex(poolState.fPoolStartVertex);
291 } 288 }
292 289
293 if (info.isIndexed() && kBuffer_GeometrySrcType != this->getGeomSrc().fIndex Src) { 290 if (info.isIndexed() && kBuffer_GeometrySrcType != this->getGeomSrc().fIndex Src) {
294 size_t bytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t ); 291 size_t bytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t );
295 poolState.fUsedPoolIndexBytes = SkTMax(poolState.fUsedPoolIndexBytes, by tes); 292 poolState.fUsedPoolIndexBytes = SkTMax(poolState.fUsedPoolIndexBytes, by tes);
296 draw->fInfo.adjustStartIndex(poolState.fPoolStartIndex); 293 draw->fInfo.adjustStartIndex(poolState.fPoolStartIndex);
297 } 294 }
298 } 295 }
299 296
300 void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds, 297 void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
301 const GrPath* path, 298 const GrPath* path,
302 const GrClipMaskManager::ScissorState& s cissorState, 299 const GrClipMaskManager::ScissorState& s cissorState,
303 const GrStencilSettings& stencilSettings ) { 300 const GrStencilSettings& stencilSettings ) {
304 // Only compare the subset of GrDrawState relevant to path stenciling? 301 // Only compare the subset of GrDrawState relevant to path stenciling?
305 if (!this->recordStateAndShouldDraw(ds, GrGpu::kStencilPath_DrawType, NULL)) { 302 if (!this->recordStateAndShouldDraw(ds, GrGpu::kStencilPath_DrawType, scisso rState, NULL)) {
306 return; 303 return;
307 } 304 }
308 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath, (path)); 305 StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath, (path));
309 sp->fScissorState = scissorState;
310 sp->fStencilSettings = stencilSettings; 306 sp->fStencilSettings = stencilSettings;
311 this->recordTraceMarkersIfNecessary(); 307 this->recordTraceMarkersIfNecessary();
312 } 308 }
313 309
314 void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds, 310 void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
315 const GrPath* path, 311 const GrPath* path,
316 const GrClipMaskManager::ScissorState& scis sorState, 312 const GrClipMaskManager::ScissorState& scis sorState,
317 const GrStencilSettings& stencilSettings, 313 const GrStencilSettings& stencilSettings,
318 const GrDeviceCoordTexture* dstCopy) { 314 const GrDeviceCoordTexture* dstCopy) {
319 // TODO: Only compare the subset of GrDrawState relevant to path covering? 315 // TODO: Only compare the subset of GrDrawState relevant to path covering?
320 if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, dstCopy)) { 316 if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, scissorSt ate, dstCopy)) {
321 return; 317 return;
322 } 318 }
323 DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path)); 319 DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path));
324 if (dstCopy) { 320 if (dstCopy) {
325 dp->fDstCopy = *dstCopy; 321 dp->fDstCopy = *dstCopy;
326 } 322 }
327 dp->fScissorState = scissorState;
328 dp->fStencilSettings = stencilSettings; 323 dp->fStencilSettings = stencilSettings;
329 this->recordTraceMarkersIfNecessary(); 324 this->recordTraceMarkersIfNecessary();
330 } 325 }
331 326
332 void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds, 327 void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
333 const GrPathRange* pathRange, 328 const GrPathRange* pathRange,
334 const uint32_t indices[], 329 const uint32_t indices[],
335 int count, 330 int count,
336 const float transforms[], 331 const float transforms[],
337 PathTransformType transformsType, 332 PathTransformType transformsType,
338 const GrClipMaskManager::ScissorState& sci ssorState, 333 const GrClipMaskManager::ScissorState& sci ssorState,
339 const GrStencilSettings& stencilSettings, 334 const GrStencilSettings& stencilSettings,
340 const GrDeviceCoordTexture* dstCopy) { 335 const GrDeviceCoordTexture* dstCopy) {
341 SkASSERT(pathRange); 336 SkASSERT(pathRange);
342 SkASSERT(indices); 337 SkASSERT(indices);
343 SkASSERT(transforms); 338 SkASSERT(transforms);
344 339
345 if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, dstCopy)) { 340 if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, scissorSt ate, dstCopy)) {
346 return; 341 return;
347 } 342 }
348 343
349 uint32_t* savedIndices = fPathIndexBuffer.append(count, indices); 344 uint32_t* savedIndices = fPathIndexBuffer.append(count, indices);
350 float* savedTransforms = fPathTransformBuffer.append(count * 345 float* savedTransforms = fPathTransformBuffer.append(count *
351 GrPathRendering::PathTransformSize(transformsTy pe), transforms); 346 GrPathRendering::PathTransformSize(transformsTy pe), transforms);
352 347
353 if (kDrawPaths_Cmd == strip_trace_bit(fCmdBuffer.back().fType)) { 348 if (kDrawPaths_Cmd == strip_trace_bit(fCmdBuffer.back().fType)) {
354 // The previous command was also DrawPaths. Try to collapse this call in to the one 349 // The previous command was also DrawPaths. Try to collapse this call in to the one
355 // before. Note that stencilling all the paths at once, then covering, m ay not be 350 // before. Note that stencilling all the paths at once, then covering, m ay not be
356 // equivalent to two separate draw calls if there is overlap. Blending w on't work, 351 // equivalent to two separate draw calls if there is overlap. Blending w on't work,
357 // and the combined calls may also cancel each other's winding numbers i n some 352 // and the combined calls may also cancel each other's winding numbers i n some
358 // places. For now the winding numbers are only an issue if the fill is even/odd, 353 // places. For now the winding numbers are only an issue if the fill is even/odd,
359 // because DrawPaths is currently only used for glyphs, and glyphs in th e same 354 // because DrawPaths is currently only used for glyphs, and glyphs in th e same
360 // font tend to all wind in the same direction. 355 // font tend to all wind in the same direction.
361 DrawPaths* previous = static_cast<DrawPaths*>(&fCmdBuffer.back()); 356 DrawPaths* previous = static_cast<DrawPaths*>(&fCmdBuffer.back());
362 if (pathRange == previous->pathRange() && 357 if (pathRange == previous->pathRange() &&
363 transformsType == previous->fTransformsType && 358 transformsType == previous->fTransformsType &&
364 scissorState == previous->fScissorState &&
365 stencilSettings == previous->fStencilSettings && 359 stencilSettings == previous->fStencilSettings &&
366 path_fill_type_is_winding(stencilSettings) && 360 path_fill_type_is_winding(stencilSettings) &&
367 !ds.willBlendWithDst()) { 361 !ds.willBlendWithDst()) {
368 // Fold this DrawPaths call into the one previous. 362 // Fold this DrawPaths call into the one previous.
369 previous->fCount += count; 363 previous->fCount += count;
370 return; 364 return;
371 } 365 }
372 } 366 }
373 367
374 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPaths, (pathRange)) ; 368 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPaths, (pathRange)) ;
375 dp->fIndicesLocation = savedIndices - fPathIndexBuffer.begin(); 369 dp->fIndicesLocation = savedIndices - fPathIndexBuffer.begin();
376 dp->fCount = count; 370 dp->fCount = count;
377 dp->fTransformsLocation = savedTransforms - fPathTransformBuffer.begin(); 371 dp->fTransformsLocation = savedTransforms - fPathTransformBuffer.begin();
378 dp->fTransformsType = transformsType; 372 dp->fTransformsType = transformsType;
379 dp->fScissorState = scissorState;
380 dp->fStencilSettings = stencilSettings; 373 dp->fStencilSettings = stencilSettings;
381 if (dstCopy) { 374 if (dstCopy) {
382 dp->fDstCopy = *dstCopy; 375 dp->fDstCopy = *dstCopy;
383 } 376 }
384 377
385 this->recordTraceMarkersIfNecessary(); 378 this->recordTraceMarkersIfNecessary();
386 } 379 }
387 380
388 void GrInOrderDrawBuffer::onClear(const SkIRect* rect, GrColor color, 381 void GrInOrderDrawBuffer::onClear(const SkIRect* rect, GrColor color,
389 bool canIgnoreRect, GrRenderTarget* renderTarg et) { 382 bool canIgnoreRect, GrRenderTarget* renderTarg et) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 500 }
508 501
509 fDstGpu->restoreActiveTraceMarkers(); 502 fDstGpu->restoreActiveTraceMarkers();
510 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker); 503 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker);
511 504
512 this->reset(); 505 this->reset();
513 ++fDrawID; 506 ++fDrawID;
514 } 507 }
515 508
516 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const GrOptDra wState* optState) { 509 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const GrOptDra wState* optState) {
517 buf->fDstGpu->draw(*optState, fInfo, fScissorState); 510 buf->fDstGpu->draw(*optState, fInfo);
518 } 511 }
519 512
520 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, 513 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf,
521 const GrOptDrawState* optState) { 514 const GrOptDrawState* optState) {
522 buf->fDstGpu->stencilPath(*optState, this->path(), fScissorState, fStencilSe ttings); 515 buf->fDstGpu->stencilPath(*optState, this->path(), fStencilSettings);
523 } 516 }
524 517
525 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, 518 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf,
526 const GrOptDrawState* optState) { 519 const GrOptDrawState* optState) {
527 buf->fDstGpu->drawPath(*optState, this->path(), fScissorState, fStencilSetti ngs, 520 buf->fDstGpu->drawPath(*optState, this->path(), fStencilSettings,
528 fDstCopy.texture() ? &fDstCopy : NULL); 521 fDstCopy.texture() ? &fDstCopy : NULL);
529 } 522 }
530 523
531 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, 524 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf,
532 const GrOptDrawState* optState) { 525 const GrOptDrawState* optState) {
533 buf->fDstGpu->drawPaths(*optState, this->pathRange(), 526 buf->fDstGpu->drawPaths(*optState, this->pathRange(),
534 &buf->fPathIndexBuffer[fIndicesLocation], fCount, 527 &buf->fPathIndexBuffer[fIndicesLocation], fCount,
535 &buf->fPathTransformBuffer[fTransformsLocation], fTr ansformsType, 528 &buf->fPathTransformBuffer[fTransformsLocation], fTr ansformsType,
536 fScissorState, fStencilSettings, fDstCopy.texture() ? &fDstCopy : NULL); 529 fStencilSettings, fDstCopy.texture() ? &fDstCopy : N ULL);
537 } 530 }
538 531
539 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const GrOptDra wState*) { 532 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const GrOptDra wState*) {
540 } 533 }
541 534
542 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const GrOptDr awState*) { 535 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const GrOptDr awState*) {
543 if (GrColor_ILLEGAL == fColor) { 536 if (GrColor_ILLEGAL == fColor) {
544 buf->fDstGpu->discard(this->renderTarget()); 537 buf->fDstGpu->discard(this->renderTarget());
545 } else { 538 } else {
546 buf->fDstGpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget() ); 539 buf->fDstGpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget() );
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 if (kReserved_GeometrySrcType == restoredState.fVertexSrc) { 724 if (kReserved_GeometrySrcType == restoredState.fVertexSrc) {
732 poolState.fUsedPoolVertexBytes = restoredState.fVertexSize * restoredSta te.fVertexCount; 725 poolState.fUsedPoolVertexBytes = restoredState.fVertexSize * restoredSta te.fVertexCount;
733 } 726 }
734 if (kReserved_GeometrySrcType == restoredState.fIndexSrc) { 727 if (kReserved_GeometrySrcType == restoredState.fIndexSrc) {
735 poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * restoredState.fIndexC ount; 728 poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * restoredState.fIndexC ount;
736 } 729 }
737 } 730 }
738 731
739 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, 732 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
740 GrGpu::DrawType drawType, 733 GrGpu::DrawType drawType,
734 const GrClipMaskManager::Scis sorState& scissor,
741 const GrDeviceCoordTexture* d stCopy) { 735 const GrDeviceCoordTexture* d stCopy) {
742 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(ds, fDstGpu, ds tCopy, drawType)); 736 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(ds, fDstGpu, sc issor, dstCopy,
737 drawType));
743 if (!optState) { 738 if (!optState) {
744 return false; 739 return false;
745 } 740 }
746 if (!fLastState || *optState != *fLastState) { 741 if (!fLastState || *optState != *fLastState) {
747 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, (optState) ); 742 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, (optState) );
748 fLastState.reset(SkRef(optState.get())); 743 fLastState.reset(SkRef(optState.get()));
749 if (dstCopy) { 744 if (dstCopy) {
750 ss->fDstCopy = *dstCopy; 745 ss->fDstCopy = *dstCopy;
751 } 746 }
752 ss->fDrawType = drawType; 747 ss->fDrawType = drawType;
753 this->recordTraceMarkersIfNecessary(); 748 this->recordTraceMarkersIfNecessary();
754 } 749 }
755 return true; 750 return true;
756 } 751 }
757 752
758 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 753 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
759 SkASSERT(!fCmdBuffer.empty()); 754 SkASSERT(!fCmdBuffer.empty());
760 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 755 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
761 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 756 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
762 if (activeTraceMarkers.count() > 0) { 757 if (activeTraceMarkers.count() > 0) {
763 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 758 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
764 fGpuCmdMarkers.push_back(activeTraceMarkers); 759 fGpuCmdMarkers.push_back(activeTraceMarkers);
765 } 760 }
766 } 761 }
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