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 #ifndef GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // stencil funcs supported by GPUs. | 437 // stencil funcs supported by GPUs. |
438 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 438 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
439 GrStencilFunc func); | 439 GrStencilFunc func); |
440 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 440 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
441 bool clipInStencil, | 441 bool clipInStencil, |
442 unsigned int clipBit, | 442 unsigned int clipBit, |
443 unsigned int userBits, | 443 unsigned int userBits, |
444 unsigned int* ref, | 444 unsigned int* ref, |
445 unsigned int* mask); | 445 unsigned int* mask); |
446 | 446 |
447 struct GeometrySrcState { | |
448 GeometrySrcState() : fVertexBuffer(NULL), fIndexBuffer(NULL), fVertexSiz
e(0) {} | |
449 const GrVertexBuffer* fVertexBuffer; | |
450 const GrIndexBuffer* fIndexBuffer; | |
451 size_t fVertexSize; | |
452 }; | |
453 | |
454 // accessors for derived classes | |
455 const GeometrySrcState& getGeomSrc() const { return fGeoSrcState; } | |
456 | |
457 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau
se of the assert. | |
458 size_t getVertexSize() const { | |
459 // the vertex layout is only valid if a vertex source has been specified
. | |
460 SkASSERT(this->getGeomSrc().fVertexBuffer); | |
461 return this->getGeomSrc().fVertexSize; | |
462 } | |
463 | |
464 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 447 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
465 | 448 |
466 GrContext::GPUStats fGPUStats; | 449 GrContext::GPUStats fGPUStats; |
467 | 450 |
468 SkAutoTDelete<GrPathRendering> fPathRendering; | 451 SkAutoTDelete<GrPathRendering> fPathRendering; |
469 | 452 |
470 // Subclass must initialize this in its constructor. | 453 // Subclass must initialize this in its constructor. |
471 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 454 SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
472 | 455 |
473 private: | 456 private: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 fResetBits = 0; | 530 fResetBits = 0; |
548 ++fResetTimestamp; | 531 ++fResetTimestamp; |
549 } | 532 } |
550 | 533 |
551 void handleDirtyContext() { | 534 void handleDirtyContext() { |
552 if (fResetBits) { | 535 if (fResetBits) { |
553 this->resetContext(); | 536 this->resetContext(); |
554 } | 537 } |
555 } | 538 } |
556 | 539 |
557 GeometrySrcState fGeoSrcS
tate; | |
558 ResetTimestamp fResetTi
mestamp; | 540 ResetTimestamp fResetTi
mestamp; |
559 uint32_t fResetBi
ts; | 541 uint32_t fResetBi
ts; |
560 // these are mutable so they can be created on-demand | 542 // these are mutable so they can be created on-demand |
561 mutable GrIndexBuffer* fQuadInd
exBuffer; | 543 mutable GrIndexBuffer* fQuadInd
exBuffer; |
562 // To keep track that we always have at least as many debug marker adds as r
emoves | 544 // To keep track that we always have at least as many debug marker adds as r
emoves |
563 int fGpuTrac
eMarkerCount; | 545 int fGpuTrac
eMarkerCount; |
564 GrTraceMarkerSet fActiveT
raceMarkers; | 546 GrTraceMarkerSet fActiveT
raceMarkers; |
565 GrTraceMarkerSet fStoredT
raceMarkers; | 547 GrTraceMarkerSet fStoredT
raceMarkers; |
566 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 548 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
567 GrContext* fContext
; | 549 GrContext* fContext
; |
568 | 550 |
569 typedef SkRefCnt INHERITED; | 551 typedef SkRefCnt INHERITED; |
570 }; | 552 }; |
571 | 553 |
572 #endif | 554 #endif |
OLD | NEW |