aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src
diff options
context:
space:
mode:
authorGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-17 17:01:17 +0000
committerGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-17 17:01:17 +0000
commitd31cbc465088a253b5574b0305e09f9301b2bf81 (patch)
tree02432c74770541d17ee5e13826702b6b57974da5 /gpu/src
parent8af476a7dc6692bf180e1d9e1f65ccdb744cf0c6 (diff)
Removing remnants of GrGLEffect.
Diffstat (limited to 'gpu/src')
-rw-r--r--gpu/src/GrGLEffect.h52
-rw-r--r--gpu/src/GrGLProgram.cpp52
-rw-r--r--gpu/src/GrGLProgram.h49
-rw-r--r--gpu/src/GrGpuGLShaders.cpp14
4 files changed, 9 insertions, 158 deletions
diff --git a/gpu/src/GrGLEffect.h b/gpu/src/GrGLEffect.h
deleted file mode 100644
index ef00df8f4b..0000000000
--- a/gpu/src/GrGLEffect.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright 2011 Google Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#ifndef GrGLEffect_DEFINED
-#define GrGLEffect_DEFINED
-
-#include "GrGLInterface.h"
-#include "GrStringBuilder.h"
-
-class GrEffect;
-
-struct ShaderCodeSegments {
- GrStringBuilder fVSUnis;
- GrStringBuilder fVSAttrs;
- GrStringBuilder fVaryings;
- GrStringBuilder fFSUnis;
- GrStringBuilder fVSCode;
- GrStringBuilder fFSCode;
-};
-
-/**
- * This class is currently a stub. This will be a base class for "effects",
- * which extend the data model of GrPaint and extend the capability of
- * GrGLProgram in a modular fashion.
- */
-class GrGLEffect {
-protected:
- GrGLEffect(GrEffect* effect) {}
-public:
- virtual ~GrGLEffect() {}
- static GrGLEffect* Create(GrEffect* effect) { return NULL; }
- void genShaderCode(ShaderCodeSegments* segments) {}
- bool doGLSetup(GrPrimitiveType type, GrGLint program) { return true; }
- bool doGLPost() { return true; }
- void buildKey(GrBinHashKeyBuilder& key) const {}
- GrGLEffect* nextEffect() { return NULL; }
-};
-
-#endif
diff --git a/gpu/src/GrGLProgram.cpp b/gpu/src/GrGLProgram.cpp
index bd95f3cb8c..01a39b9401 100644
--- a/gpu/src/GrGLProgram.cpp
+++ b/gpu/src/GrGLProgram.cpp
@@ -18,7 +18,6 @@
#include "GrBinHashKey.h"
#include "GrGLConfig.h"
-#include "GrGLEffect.h"
#include "GrMemory.h"
#include "SkXfermode.h"
@@ -140,9 +139,6 @@ static void tex_domain_name(int stage, GrStringBuilder* s) {
}
GrGLProgram::GrGLProgram() {
- for(int stage = 0; stage < GrDrawTarget::kNumStages; ++stage) {
- fStageEffects[stage] = NULL;
- }
}
GrGLProgram::~GrGLProgram() {
@@ -151,50 +147,6 @@ GrGLProgram::~GrGLProgram() {
void GrGLProgram::buildKey(GrBinHashKeyBuilder& key) const {
// Add stage configuration to the key
key.keyData(reinterpret_cast<const uint8_t*>(&fProgramDesc), sizeof(ProgramDesc));
-
- for(int stage = 0; stage < GrDrawTarget::kNumStages; ++stage) {
- // First pass: count effects and write the count to the key.
- // This may seem like we are adding redundant data to the
- // key, but in ensures the one key cannot be a prefix of
- // another key, or identical to the key of a different program.
- GrGLEffect* currentEffect = fStageEffects[stage];
- uint8_t effectCount = 0;
- while (currentEffect) {
- GrAssert(effectCount < 255); // overflow detection
- ++effectCount;
- currentEffect = currentEffect->nextEffect();
- }
- key.keyData(reinterpret_cast<const uint8_t*>(&effectCount), sizeof(uint8_t));
-
- // Second pass: continue building key using the effects
- currentEffect = fStageEffects[stage];
- while (currentEffect) {
- fStageEffects[stage]->buildKey(key);
- }
- }
-}
-
-bool GrGLProgram::doGLSetup(GrPrimitiveType type,
- GrGLProgram::CachedData* programData) const {
- for (int stage = 0; stage < GrDrawTarget::kNumStages; ++stage) {
- GrGLEffect* effect = fStageEffects[stage];
- if (effect) {
- if (!effect->doGLSetup(type, programData->fProgramID)) {
- return false;
- }
- }
- }
-
- return true;
-}
-
-void GrGLProgram::doGLPost() const {
- for (int stage = 0; stage < GrDrawTarget::kNumStages; ++stage) {
- GrGLEffect* effect = fStageEffects[stage];
- if (effect) {
- effect->doGLPost();
- }
- }
}
// assigns modulation of two vars to an output var
@@ -1107,9 +1059,5 @@ void GrGLProgram::genStageCode(int stageNum,
} else {
segments->fFSCode.appendf("\t%s = %s(%s, %s)%s %s;\n", fsOutColor, texFunc.c_str(), samplerName.c_str(), sampleCoords.c_str(), smear, modulate.c_str());
}
-
- if(fStageEffects[stageNum]) {
- fStageEffects[stageNum]->genShaderCode(segments);
- }
}
diff --git a/gpu/src/GrGLProgram.h b/gpu/src/GrGLProgram.h
index 64d7088b72..e02d15b617 100644
--- a/gpu/src/GrGLProgram.h
+++ b/gpu/src/GrGLProgram.h
@@ -24,8 +24,15 @@
#include "SkXfermode.h"
class GrBinHashKeyBuilder;
-class GrGLEffect;
-struct ShaderCodeSegments;
+
+struct ShaderCodeSegments {
+ GrStringBuilder fVSUnis;
+ GrStringBuilder fVSAttrs;
+ GrStringBuilder fVaryings;
+ GrStringBuilder fFSUnis;
+ GrStringBuilder fVSCode;
+ GrStringBuilder fFSCode;
+};
/**
* This class manages a GPU program and records per-program information.
@@ -58,18 +65,6 @@ public:
*/
bool genProgram(CachedData* programData) const;
- /**
- * Routine that is called before rendering. Sets-up all the state and
- * other initializations required for the Gpu Program to run.
- */
- bool doGLSetup(GrPrimitiveType type, CachedData* programData) const;
-
- /**
- * Routine that is called after rendering. Performs state restoration.
- * May perform secondary render passes.
- */
- void doGLPost() const;
-
static int PositionAttributeIdx() { return 0; }
static int TexCoordAttributeIdx(int tcIdx) { return 1 + tcIdx; }
static int ColorAttributeIdx() { return 1 + GrDrawTarget::kMaxTexCoords; }
@@ -177,36 +172,15 @@ public:
class CachedData : public ::GrNoncopyable {
public:
CachedData() {
- GR_DEBUGCODE(fEffectUniCount = 0;)
- fEffectUniLocationsExtended = NULL;
}
~CachedData() {
- GrFree(fEffectUniLocationsExtended);
}
void copyAndTakeOwnership(CachedData& other) {
memcpy(this, &other, sizeof(*this));
- other.fEffectUniLocationsExtended = NULL; // ownership transfer
- GR_DEBUGCODE(other.fEffectUniCount = 0;)
- }
-
- void setEffectUniformCount(size_t effectUniforms) {
- GR_DEBUGCODE(fEffectUniCount = effectUniforms;)
- GrFree(fEffectUniLocationsExtended);
- if (effectUniforms > kUniLocationPreAllocSize) {
- fEffectUniLocationsExtended = (GrGLint*)GrMalloc(sizeof(GrGLint)*(effectUniforms-kUniLocationPreAllocSize));
- } else {
- fEffectUniLocationsExtended = NULL;
- }
}
- GrGLint& effectUniLocation(size_t index) {
- GrAssert(index < fEffectUniCount);
- return (index < kUniLocationPreAllocSize) ?
- fEffectUniLocations[index] :
- fEffectUniLocationsExtended[index - kUniLocationPreAllocSize];
- }
public:
@@ -236,13 +210,8 @@ public:
kUniLocationPreAllocSize = 8
};
- GrGLint fEffectUniLocations[kUniLocationPreAllocSize];
- GrGLint* fEffectUniLocationsExtended;
- GR_DEBUGCODE(size_t fEffectUniCount;)
}; // CachedData
- GrGLEffect* fStageEffects[GrDrawTarget::kNumStages];
-
private:
enum {
kUseUniform = 2000
diff --git a/gpu/src/GrGpuGLShaders.cpp b/gpu/src/GrGpuGLShaders.cpp
index bcf29ae56d..08845a9258 100644
--- a/gpu/src/GrGpuGLShaders.cpp
+++ b/gpu/src/GrGpuGLShaders.cpp
@@ -15,7 +15,6 @@
*/
#include "GrBinHashKey.h"
-#include "GrGLEffect.h"
#include "GrGLProgram.h"
#include "GrGpuGLShaders.h"
#include "GrGpuVertex.h"
@@ -534,10 +533,6 @@ bool GrGpuGLShaders::flushGraphicsState(GrPrimitiveType type) {
fHWProgramID = fProgramData->fProgramID;
}
- if (!fCurrentProgram.doGLSetup(type, fProgramData)) {
- return false;
- }
-
this->flushColor();
GrMatrix* currViewMatrix;
@@ -568,7 +563,6 @@ bool GrGpuGLShaders::flushGraphicsState(GrPrimitiveType type) {
}
void GrGpuGLShaders::postDraw() {
- fCurrentProgram.doGLPost();
}
void GrGpuGLShaders::setupGeometry(int* startVertex,
@@ -774,18 +768,10 @@ void GrGpuGLShaders::buildProgram(GrPrimitiveType type) {
} else {
stage.fModulation = GrGLProgram::ProgramDesc::StageDesc::kColor_Modulation;
}
-
- if (fCurrDrawState.fEffects[s]) {
- fCurrentProgram.fStageEffects[s] = GrGLEffect::Create(fCurrDrawState.fEffects[s]);
- } else {
- delete fCurrentProgram.fStageEffects[s];
- fCurrentProgram.fStageEffects[s] = NULL;
- }
} else {
stage.fOptFlags = 0;
stage.fCoordMapping = (GrGLProgram::ProgramDesc::StageDesc::CoordMapping)0;
stage.fModulation = (GrGLProgram::ProgramDesc::StageDesc::Modulation)0;
- fCurrentProgram.fStageEffects[s] = NULL;
}
}
}