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

Unified Diff: src/gpu/gl/GrGLProgram.h

Issue 12942014: Move GrGLProgram::Desc out of GrGLProgram. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Move #include below dbl include check Created 7 years, 9 months 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
Index: src/gpu/gl/GrGLProgram.h
===================================================================
--- src/gpu/gl/GrGLProgram.h (revision 8407)
+++ src/gpu/gl/GrGLProgram.h (working copy)
@@ -10,8 +10,8 @@
#define GrGLProgram_DEFINED
#include "GrDrawState.h"
-#include "GrGLEffect.h"
#include "GrGLContext.h"
+#include "GrGLProgramDesc.h"
#include "GrGLSL.h"
#include "GrGLTexture.h"
#include "GrGLUniformManager.h"
@@ -24,10 +24,6 @@
class GrGLShaderBuilder;
class SkMWCRandom;
-// optionally compile the experimental GS code. Set to GR_DEBUG
-// so that debug build bots will execute the code.
-#define GR_GL_EXPERIMENTAL_GS GR_DEBUG
-
/**
* This class manages a GPU program and records per-program information.
* We can specify the attribute locations so that they are constant
@@ -41,22 +37,8 @@
public:
SK_DECLARE_INST_COUNT(GrGLProgram)
- class Desc;
-
- /**
- * Builds a program descriptor from a GrDrawState. Whether the primitive type is points, the
- * output of GrDrawState::getBlendOpts, and the caps of the GrGpuGL are also inputs.
- */
- static void BuildDesc(const GrDrawState&,
- bool isPoints,
- GrDrawState::BlendOptFlags,
- GrBlendCoeff srcCoeff,
- GrBlendCoeff dstCoeff,
- const GrGpuGL* gpu,
- Desc* outDesc);
-
static GrGLProgram* Create(const GrGLContext& gl,
- const Desc& desc,
+ const GrGLProgramDesc& desc,
const GrEffectStage* stages[]);
virtual ~GrGLProgram();
@@ -71,7 +53,7 @@
*/
void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const;
- const Desc& getDesc() { return fDesc; }
+ const GrGLProgramDesc& getDesc() { return fDesc; }
/**
* Gets the GL program ID for this program.
@@ -123,88 +105,9 @@
*/
void setData(GrGpuGL*, GrColor color, GrColor coverage, SharedGLState*);
- // Parameters that affect code generation
- // This structs should be kept compact; it is input to an expensive hash key generator.
- class Desc {
- public:
- Desc() {
- // since we use this as part of a key we can't have any uninitialized
- // padding
- memset(this, 0, sizeof(Desc));
- }
-
- // returns this as a uint32_t array to be used as a key in the program cache
- const uint32_t* asKey() const {
- return reinterpret_cast<const uint32_t*>(this);
- }
-
- // For unit testing.
- void setRandom(SkMWCRandom*,
- const GrGpuGL* gpu,
- const GrEffectStage stages[GrDrawState::kNumStages]);
-
- private:
- // Specifies where the initial color comes from before the stages are applied.
- enum ColorInput {
- kSolidWhite_ColorInput,
- kTransBlack_ColorInput,
- kAttribute_ColorInput,
- kUniform_ColorInput,
-
- kColorInputCnt
- };
- // Dual-src blending makes use of a secondary output color that can be
- // used as a per-pixel blend coefficient. This controls whether a
- // secondary source is output and what value it holds.
- enum DualSrcOutput {
- kNone_DualSrcOutput,
- kCoverage_DualSrcOutput,
- kCoverageISA_DualSrcOutput,
- kCoverageISC_DualSrcOutput,
-
- kDualSrcOutputCnt
- };
-
- // should the FS discard if the coverage is zero (to avoid stencil manipulation)
- bool fDiscardIfZeroCoverage;
-
- // stripped of bits that don't affect program generation
- GrAttribBindings fAttribBindings;
-
- /** Non-zero if this stage has an effect */
- GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages];
-
- // To enable experimental geometry shader code (not for use in
- // production)
-#if GR_GL_EXPERIMENTAL_GS
- bool fExperimentalGS;
-#endif
- uint8_t fColorInput; // casts to enum ColorInput
- uint8_t fCoverageInput; // casts to enum ColorInput
- uint8_t fDualSrcOutput; // casts to enum DualSrcOutput
- int8_t fFirstCoverageStage;
- SkBool8 fEmitsPointSize;
- uint8_t fColorFilterXfermode; // casts to enum SkXfermode::Mode
-
- int8_t fPositionAttributeIndex;
- int8_t fColorAttributeIndex;
- int8_t fCoverageAttributeIndex;
- int8_t fLocalCoordsAttributeIndex;
-
- friend class GrGLProgram;
- };
-
- // Layout information for OpenGL vertex attributes
- struct AttribLayout {
- GrGLint fCount;
- GrGLenum fType;
- GrGLboolean fNormalized;
- };
- static const AttribLayout kAttribLayouts[kGrVertexAttribTypeCount];
-
private:
GrGLProgram(const GrGLContext& gl,
- const Desc& desc,
+ const GrGLProgramDesc& desc,
const GrEffectStage* stages[]);
bool succeeded() const { return 0 != fProgramID; }
@@ -281,7 +184,7 @@
GrGLEffect* fEffects[GrDrawState::kNumStages];
- Desc fDesc;
+ GrGLProgramDesc fDesc;
const GrGLContext& fContext;
GrGLUniformManager fUniformManager;
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | src/gpu/gl/GrGLProgramDesc.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698