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

Unified Diff: include/gpu/GrBackendProcessorFactory.h

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrFragmentProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrBackendProcessorFactory.h
diff --git a/include/gpu/GrBackendProcessorFactory.h b/include/gpu/GrBackendProcessorFactory.h
deleted file mode 100644
index dc0bbbe53f66e224bd61cc729f615d69c7fa1270..0000000000000000000000000000000000000000
--- a/include/gpu/GrBackendProcessorFactory.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrBackendProcessorFactory_DEFINED
-#define GrBackendProcessorFactory_DEFINED
-
-#include "GrTypes.h"
-#include "SkTemplates.h"
-#include "SkThread.h"
-#include "SkTypes.h"
-#include "SkTArray.h"
-
-class GrGLProcessor;
-class GrGLCaps;
-class GrProcessor;
-
-/**
- * Used by processors to build their keys. It incorporates each per-processor key into a larger shader
- * key.
- */
-class GrProcessorKeyBuilder {
-public:
- GrProcessorKeyBuilder(SkTArray<unsigned char, true>* data) : fData(data), fCount(0) {
- SkASSERT(0 == fData->count() % sizeof(uint32_t));
- }
-
- void add32(uint32_t v) {
- ++fCount;
- fData->push_back_n(4, reinterpret_cast<uint8_t*>(&v));
- }
-
- /** Inserts count uint32_ts into the key. The returned pointer is only valid until the next
- add*() call. */
- uint32_t* SK_WARN_UNUSED_RESULT add32n(int count) {
- SkASSERT(count > 0);
- fCount += count;
- return reinterpret_cast<uint32_t*>(fData->push_back_n(4 * count));
- }
-
- size_t size() const { return sizeof(uint32_t) * fCount; }
-
-private:
- SkTArray<uint8_t, true>* fData; // unowned ptr to the larger key.
- int fCount; // number of uint32_ts added to fData by the processor.
-};
-
-/**
- * Given a GrProcessor of a particular type, creates the corresponding graphics-backend-specific
- * processor object. It also tracks equivalence of shaders generated via a key. The factory for an
- * processor is accessed via GrProcessor::getFactory(). Each factory instance is assigned an ID at
- * construction. The ID of GrProcessor::getFactory() is used as a type identifier. Thus, a
- * GrProcessor subclass must always return the same object from getFactory() and that factory object
- * must be unique to the GrProcessor subclass (and unique from any further derived subclasses).
- *
- * Rather than subclassing this class themselves, it is recommended that GrProcessor authors use
- * the templated subclass GrTBackendProcessorFactory by writing their getFactory() method as:
- *
- * const GrBackendProcessorFactory& MyProcessor::getFactory() const {
- * return GrTBackendProcessorFactory<MyProcessor>::getInstance();
- * }
- *
- * Using GrTBackendProcessorFactory places a few constraints on the processor. See that class's
- * comments.
- */
-class GrBackendProcessorFactory : SkNoncopyable {
-public:
- /**
- * Produces a human-reable name for the v.
- */
- virtual const char* name() const = 0;
-
- /**
- * A unique value for every instance of this factory. It is automatically incorporated into the
- * processor's key. This allows keys generated by getGLProcessorKey() to only be unique within a
- * GrProcessor subclass and not necessarily across subclasses.
- */
- uint32_t classID() const { return fProcessorClassID; }
-
-protected:
- GrBackendProcessorFactory() : fProcessorClassID(GenClassID()) {}
- virtual ~GrBackendProcessorFactory() {}
-
-private:
- enum {
- kIllegalProcessorClassID = 0,
- };
-
- 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(&fCurrProcessorClassID)) + 1;
- if (!id) {
- SkFAIL("This should never wrap as it should only be called once for each GrProcessor "
- "subclass.");
- }
- return id;
- }
-
- const uint32_t fProcessorClassID;
- static int32_t fCurrProcessorClassID;
-};
-
-class GrFragmentProcessor;
-class GrGeometryProcessor;
-class GrXferProcessor;
-class GrGLFragmentProcessor;
-class GrGLGeometryProcessor;
-class GrGLXferProcessor;
-
-/**
- * Backend processor factory cannot actually create anything, it is up to subclasses to implement
- * a create binding which matches Gr to GL in a type safe way
- */
-
-class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory {
-public:
- /**
- * Generates an processor's key. The key is based on the aspects of the GrProcessor object's
- * configuration that affect GLSL code generation. Two GrProcessor instances that would cause
- * this->createGLInstance()->emitCode() to produce different code must produce different keys.
- */
- virtual void getGLProcessorKey(const GrFragmentProcessor&,
- const GrGLCaps&,
- GrProcessorKeyBuilder*) const = 0;
-
- /**
- * Creates a GrGLProcessor instance that is used both to generate code for the GrProcessor in a
- * GLSL program and to manage updating uniforms for the program when it is used.
- */
- virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&) const = 0;
-};
-
-class GrBackendXferProcessorFactory : public GrBackendProcessorFactory {
-public:
- /**
- * Creates a GrGLProcessor instance that is used both to generate code for the GrProcessor in a
- * GLSL program and to manage updating uniforms for the program when it is used.
- */
- virtual GrGLXferProcessor* createGLInstance(const GrXferProcessor&) const = 0;
-};
-
-class GrBatchTracker;
-
-class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory {
-public:
- /**
- * Generates an processor's key. The key is based on the aspects of the GrProcessor object's
- * configuration that affect GLSL code generation. Two GrProcessor instances that would cause
- * this->createGLInstance()->emitCode() to produce different code must produce different keys.
- */
- virtual void getGLProcessorKey(const GrGeometryProcessor&,
- const GrBatchTracker&,
- const GrGLCaps&,
- GrProcessorKeyBuilder*) const = 0;
-
- /**
- * Creates a GrGLProcessor instance that is used both to generate code for the GrProcessor in a
- * GLSL program and to manage updating uniforms for the program when it is used.
- */
- virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&,
- const GrBatchTracker&) const = 0;
-};
-
-#endif
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698