diff options
author | 2015-01-28 06:54:30 -0800 | |
---|---|---|
committer | 2015-01-28 06:54:30 -0800 | |
commit | c2893c5e3870d7e9a37ca146e7da88fba54977d5 (patch) | |
tree | 9efd98166a608e5ae24d35ab0dde1c7cb9b763b3 /src/gpu/GrBatch.h | |
parent | 8b0a05ae44911f9263be5936457b66a967b8a1fc (diff) |
Revert of GrBatchPrototype (patchset #32 id:630001 of https://codereview.chromium.org/845103005/)
Reason for revert:
One last try to fix mac perf regression
Original issue's description:
> GrBatchPrototype
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/d15e4e45374275c045572b304c229237c4a82be4
>
> Committed: https://skia.googlesource.com/skia/+/d5a7db4a867c7e6ccf8451a053d987b470099198
TBR=bsalomon@google.com,kkinnunen@nvidia.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/877393002
Diffstat (limited to 'src/gpu/GrBatch.h')
-rw-r--r-- | src/gpu/GrBatch.h | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/gpu/GrBatch.h b/src/gpu/GrBatch.h deleted file mode 100644 index ceb2c5cc2a..0000000000 --- a/src/gpu/GrBatch.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrBatch_DEFINED -#define GrBatch_DEFINED - -#include <new> -// TODO remove this header when we move entirely to batch -#include "GrGeometryProcessor.h" -#include "SkRefCnt.h" -#include "SkThread.h" -#include "SkTypes.h" - -class GrBatchTarget; -class GrGpu; -class GrIndexBufferAllocPool; -class GrPipeline; -class GrVertexBufferAllocPool; - -struct GrInitInvariantOutput; - -/* - * GrBatch is the base class for all Ganesh deferred geometry generators. To facilitate - * reorderable batching, Ganesh does not generate geometry inline with draw calls. Instead, it - * captures the arguments to the draw and then generates the geometry on demand. This gives GrBatch - * subclasses complete freedom to decide how / what they can batch. - * - * Batches are created when GrContext processes a draw call. Batches of the same subclass may be - * merged using combineIfPossible. When two batches merge, one takes on the union of the data - * and the other is left empty. The merged batch becomes responsible for drawing the data from both - * the original batches. - * - * If there are any possible optimizations which might require knowing more about the full state of - * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverage, then this - * information will be communicated to the GrBatch prior to geometry generation. - */ - -struct GrBatchOpt { - bool fCanTweakAlphaForCoverage; -}; - -class GrBatch : public SkRefCnt { -public: - SK_DECLARE_INST_COUNT(GrBatch) - GrBatch() { SkDEBUGCODE(fUsed = false;) } - virtual ~GrBatch() {} - - virtual const char* name() const = 0; - virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; - virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0; - - /* - * initBatchOpt is used to communicate possible optimizations to the GrBatch. initBatchTracker - * is a hook for the some additional overrides from the GrXferProcessor. This is a bit - * confusing but has to be like this until GrBatch is everywhere. - * - * TODO combine to a single init call when GrBatch is everywhere. - */ - virtual void initBatchOpt(const GrBatchOpt&) = 0; - virtual void initBatchTracker(const GrPipelineInfo& init) = 0; - - bool combineIfPossible(GrBatch* that) { - if (this->classID() != that->classID()) { - return false; - } - - return onCombineIfPossible(that); - } - - virtual bool onCombineIfPossible(GrBatch*) = 0; - - virtual void generateGeometry(GrBatchTarget*, const GrPipeline*) = 0; - - void* operator new(size_t size); - void operator delete(void* target); - - void* operator new(size_t size, void* placement) { - return ::operator new(size, placement); - } - void operator delete(void* target, void* placement) { - ::operator delete(target, placement); - } - - /** - * Helper for down-casting to a GrBatch subclass - */ - template <typename T> const T& cast() const { return *static_cast<const T*>(this); } - template <typename T> T* cast() { return static_cast<T*>(this); } - - uint32_t classID() const { SkASSERT(kIllegalBatchClassID != fClassID); return fClassID; } - - // TODO no GrPrimitiveProcessors yet read fragment position - bool willReadFragmentPosition() const { return false; } - - SkDEBUGCODE(bool isUsed() const { return fUsed; }) - -protected: - template <typename PROC_SUBCLASS> void initClassID() { - static uint32_t kClassID = GenClassID(); - fClassID = kClassID; - } - - uint32_t fClassID; - -private: - static uint32_t GenClassID() { - // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The - // atomic inc returns the old value not the incremented value. So we add - // 1 to the returned value. - uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrBatchClassID)) + 1; - if (!id) { - SkFAIL("This should never wrap as it should only be called once for each GrBatch " - "subclass."); - } - return id; - } - - enum { - kIllegalBatchClassID = 0, - }; - static int32_t gCurrBatchClassID; - - SkDEBUGCODE(bool fUsed;) - - typedef SkRefCnt INHERITED; -}; - -#endif |