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

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

Issue 699733002: removing setVertexArraySource from drawtarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: a bit more cleanup 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/GrGpu.h ('k') | src/gpu/GrInOrderDrawBuffer.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return false; 284 return false;
285 } 285 }
286 286
287 return true; 287 return true;
288 } 288 }
289 289
290 //////////////////////////////////////////////////////////////////////////////// 290 ////////////////////////////////////////////////////////////////////////////////
291 291
292 void GrGpu::geometrySourceWillPush() { 292 void GrGpu::geometrySourceWillPush() {
293 const GeometrySrcState& geoSrc = this->getGeomSrc(); 293 const GeometrySrcState& geoSrc = this->getGeomSrc();
294 if (kArray_GeometrySrcType == geoSrc.fVertexSrc || 294 if (kReserved_GeometrySrcType == geoSrc.fVertexSrc) {
295 kReserved_GeometrySrcType == geoSrc.fVertexSrc) {
296 this->finalizeReservedVertices(); 295 this->finalizeReservedVertices();
297 } 296 }
298 if (kArray_GeometrySrcType == geoSrc.fIndexSrc || 297 if (kReserved_GeometrySrcType == geoSrc.fIndexSrc) {
299 kReserved_GeometrySrcType == geoSrc.fIndexSrc) {
300 this->finalizeReservedIndices(); 298 this->finalizeReservedIndices();
301 } 299 }
302 GeometryPoolState& newState = fGeomPoolStateStack.push_back(); 300 GeometryPoolState& newState = fGeomPoolStateStack.push_back();
303 #ifdef SK_DEBUG 301 #ifdef SK_DEBUG
304 newState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; 302 newState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
305 newState.fPoolStartVertex = DEBUG_INVAL_START_IDX; 303 newState.fPoolStartVertex = DEBUG_INVAL_START_IDX;
306 newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; 304 newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
307 newState.fPoolStartIndex = DEBUG_INVAL_START_IDX; 305 newState.fPoolStartIndex = DEBUG_INVAL_START_IDX;
308 #else 306 #else
309 (void) newState; // silence compiler warning 307 (void) newState; // silence compiler warning
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 --fVertexPoolUseCnt; 505 --fVertexPoolUseCnt;
508 } 506 }
509 507
510 void GrGpu::releaseReservedIndexSpace() { 508 void GrGpu::releaseReservedIndexSpace() {
511 const GeometrySrcState& geoSrc = this->getGeomSrc(); 509 const GeometrySrcState& geoSrc = this->getGeomSrc();
512 SkASSERT(kReserved_GeometrySrcType == geoSrc.fIndexSrc); 510 SkASSERT(kReserved_GeometrySrcType == geoSrc.fIndexSrc);
513 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 511 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
514 fIndexPool->putBack(bytes); 512 fIndexPool->putBack(bytes);
515 --fIndexPoolUseCnt; 513 --fIndexPoolUseCnt;
516 } 514 }
517
518 void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) {
519 this->prepareVertexPool();
520 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
521 #ifdef SK_DEBUG
522 bool success =
523 #endif
524 fVertexPool->appendVertices(this->getVertexSize(),
525 vertexCount,
526 vertexArray,
527 &geomPoolState.fPoolVertexBuffer,
528 &geomPoolState.fPoolStartVertex);
529 ++fVertexPoolUseCnt;
530 GR_DEBUGASSERT(success);
531 }
532
533 void GrGpu::onSetIndexSourceToArray(const void* indexArray, int indexCount) {
534 this->prepareIndexPool();
535 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
536 #ifdef SK_DEBUG
537 bool success =
538 #endif
539 fIndexPool->appendIndices(indexCount,
540 indexArray,
541 &geomPoolState.fPoolIndexBuffer,
542 &geomPoolState.fPoolStartIndex);
543 ++fIndexPoolUseCnt;
544 GR_DEBUGASSERT(success);
545 }
546
547 void GrGpu::releaseVertexArray() {
548 // if vertex source was array, we stowed data in the pool
549 const GeometrySrcState& geoSrc = this->getGeomSrc();
550 SkASSERT(kArray_GeometrySrcType == geoSrc.fVertexSrc);
551 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize;
552 fVertexPool->putBack(bytes);
553 --fVertexPoolUseCnt;
554 }
555
556 void GrGpu::releaseIndexArray() {
557 // if index source was array, we stowed data in the pool
558 const GeometrySrcState& geoSrc = this->getGeomSrc();
559 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
560 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
561 fIndexPool->putBack(bytes);
562 --fIndexPoolUseCnt;
563 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698