| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 * Takes the current active set of markers and stores them for later use. An
y current marker | 398 * Takes the current active set of markers and stores them for later use. An
y current marker |
| 399 * in the active set is removed from the active set and the targets remove f
unction is called. | 399 * in the active set is removed from the active set and the targets remove f
unction is called. |
| 400 * These functions do not work as a stack so you cannot call save a second t
ime before calling | 400 * These functions do not work as a stack so you cannot call save a second t
ime before calling |
| 401 * restore. Also, it is assumed that when restore is called the current acti
ve set of markers | 401 * restore. Also, it is assumed that when restore is called the current acti
ve set of markers |
| 402 * is empty. When the stored markers are added back into the active set, the
targets add marker | 402 * is empty. When the stored markers are added back into the active set, the
targets add marker |
| 403 * is called. | 403 * is called. |
| 404 */ | 404 */ |
| 405 void saveActiveTraceMarkers(); | 405 void saveActiveTraceMarkers(); |
| 406 void restoreActiveTraceMarkers(); | 406 void restoreActiveTraceMarkers(); |
| 407 | 407 |
| 408 // Given a rt, find or create a stencil buffer and attach it |
| 409 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 410 |
| 408 protected: | 411 protected: |
| 409 // Functions used to map clip-respecting stencil tests into normal | 412 // Functions used to map clip-respecting stencil tests into normal |
| 410 // stencil funcs supported by GPUs. | 413 // stencil funcs supported by GPUs. |
| 411 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 414 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 412 GrStencilFunc func); | 415 GrStencilFunc func); |
| 413 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 416 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 414 bool clipInStencil, | 417 bool clipInStencil, |
| 415 unsigned int clipBit, | 418 unsigned int clipBit, |
| 416 unsigned int userBits, | 419 unsigned int userBits, |
| 417 unsigned int* ref, | 420 unsigned int* ref, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // Should attach the SB to the RT. Returns false if compatible sb could | 485 // Should attach the SB to the RT. Returns false if compatible sb could |
| 483 // not be created. | 486 // not be created. |
| 484 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; | 487 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; |
| 485 | 488 |
| 486 // attaches an existing SB to an existing RT. | 489 // attaches an existing SB to an existing RT. |
| 487 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; | 490 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; |
| 488 | 491 |
| 489 // clears target's entire stencil buffer to 0 | 492 // clears target's entire stencil buffer to 0 |
| 490 virtual void clearStencil(GrRenderTarget* target) = 0; | 493 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 491 | 494 |
| 492 // Given a rt, find or create a stencil buffer and attach it | |
| 493 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | |
| 494 | |
| 495 virtual void didAddGpuTraceMarker() = 0; | 495 virtual void didAddGpuTraceMarker() = 0; |
| 496 virtual void didRemoveGpuTraceMarker() = 0; | 496 virtual void didRemoveGpuTraceMarker() = 0; |
| 497 | 497 |
| 498 void resetContext() { | 498 void resetContext() { |
| 499 this->onResetContext(fResetBits); | 499 this->onResetContext(fResetBits); |
| 500 fResetBits = 0; | 500 fResetBits = 0; |
| 501 ++fResetTimestamp; | 501 ++fResetTimestamp; |
| 502 } | 502 } |
| 503 | 503 |
| 504 void handleDirtyContext() { | 504 void handleDirtyContext() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 515 int fGpuTrac
eMarkerCount; | 515 int fGpuTrac
eMarkerCount; |
| 516 GrTraceMarkerSet fActiveT
raceMarkers; | 516 GrTraceMarkerSet fActiveT
raceMarkers; |
| 517 GrTraceMarkerSet fStoredT
raceMarkers; | 517 GrTraceMarkerSet fStoredT
raceMarkers; |
| 518 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 518 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 519 GrContext* fContext
; | 519 GrContext* fContext
; |
| 520 | 520 |
| 521 typedef SkRefCnt INHERITED; | 521 typedef SkRefCnt INHERITED; |
| 522 }; | 522 }; |
| 523 | 523 |
| 524 #endif | 524 #endif |
| OLD | NEW |