aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawState.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrDrawState.h')
-rw-r--r--src/gpu/GrDrawState.h67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 6f7ebcd6a5..90769cb5c6 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -11,7 +11,7 @@
#include "GrColor.h"
#include "GrMatrix.h"
#include "GrRefCnt.h"
-#include "GrSamplerState.h"
+#include "GrEffectStage.h"
#include "GrStencil.h"
#include "GrTexture.h"
#include "GrRenderTarget.h"
@@ -69,7 +69,7 @@ public:
/**
* Resets to the default state.
- * Sampler states *will* be modified: textures or GrEffect objects will be released.
+ * GrEffects will be removed from all stages.
*/
void reset() {
@@ -188,35 +188,36 @@ public:
/**
* Creates a GrSingleTextureEffect.
*/
- void createTextureEffect(int stage, GrTexture* texture) {
- GrAssert(!this->getSampler(stage).getEffect());
- this->sampler(stage)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
+ void createTextureEffect(int stageIdx, GrTexture* texture) {
+ GrAssert(!this->getStage(stageIdx).getEffect());
+ this->stage(stageIdx)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
}
- void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix) {
- GrAssert(!this->getSampler(stage).getEffect());
+ void createTextureEffect(int stageIdx, GrTexture* texture, const GrMatrix& matrix) {
+ GrAssert(!this->getStage(stageIdx).getEffect());
GrEffect* effect = SkNEW_ARGS(GrSingleTextureEffect, (texture));
- this->sampler(stage)->setEffect(effect, matrix)->unref();
+ this->stage(stageIdx)->setEffect(effect, matrix)->unref();
}
- void createTextureEffect(int stage, GrTexture* texture,
+ void createTextureEffect(int stageIdx,
+ GrTexture* texture,
const GrMatrix& matrix,
const GrTextureParams& params) {
- GrAssert(!this->getSampler(stage).getEffect());
+ GrAssert(!this->getStage(stageIdx).getEffect());
GrEffect* effect = SkNEW_ARGS(GrSingleTextureEffect, (texture, params));
- this->sampler(stage)->setEffect(effect, matrix)->unref();
+ this->stage(stageIdx)->setEffect(effect, matrix)->unref();
}
bool stagesDisabled() {
for (int i = 0; i < kNumStages; ++i) {
- if (NULL != fSamplerStates[i].getEffect()) {
+ if (NULL != fStages[i].getEffect()) {
return false;
}
}
return true;
}
- void disableStage(int index) {
- fSamplerStates[index].setEffect(NULL);
+ void disableStage(int stageIdx) {
+ fStages[stageIdx].setEffect(NULL);
}
/**
@@ -243,33 +244,33 @@ public:
/// @}
///////////////////////////////////////////////////////////////////////////
- /// @name Samplers
+ /// @name Stages
////
/**
- * Returns the current sampler for a stage.
+ * Returns the current stage by index.
*/
- const GrSamplerState& getSampler(int stage) const {
- GrAssert((unsigned)stage < kNumStages);
- return fSamplerStates[stage];
+ const GrEffectStage& getStage(int stageIdx) const {
+ GrAssert((unsigned)stageIdx < kNumStages);
+ return fStages[stageIdx];
}
/**
- * Writable pointer to a stage's sampler.
+ * Writable pointer to a stage.
*/
- GrSamplerState* sampler(int stage) {
- GrAssert((unsigned)stage < kNumStages);
- return fSamplerStates + stage;
+ GrEffectStage* stage(int stageIdx) {
+ GrAssert((unsigned)stageIdx < kNumStages);
+ return fStages + stageIdx;
}
/**
* Called when the source coord system is changing. preConcat gives the transformation from the
* old coord system to the new coord system.
*/
- void preConcatSamplerMatrices(const GrMatrix& preConcat) {
+ void preConcatStageMatrices(const GrMatrix& preConcat) {
for (int i = 0; i < kNumStages; ++i) {
if (this->isStageEnabled(i)) {
- fSamplerStates[i].preConcatCoordChange(preConcat);
+ fStages[i].preConcatCoordChange(preConcat);
}
}
}
@@ -279,7 +280,7 @@ public:
* transformation from the old coord system to the new coord system. Returns false if the matrix
* cannot be inverted.
*/
- bool preConcatSamplerMatricesWithInverse(const GrMatrix& preConcatInverse) {
+ bool preConcatStageMatricesWithInverse(const GrMatrix& preConcatInverse) {
GrMatrix inv;
bool computed = false;
for (int i = 0; i < kNumStages; ++i) {
@@ -289,7 +290,7 @@ public:
} else {
computed = true;
}
- fSamplerStates[i].preConcatCoordChange(preConcatInverse);
+ fStages[i].preConcatCoordChange(preConcatInverse);
}
}
return true;
@@ -502,7 +503,7 @@ public:
private:
GrDrawState* fDrawState;
GrMatrix fViewMatrix;
- GrSamplerState::SavedCoordChange fSavedCoordChanges[GrDrawState::kNumStages];
+ GrEffectStage::SavedCoordChange fSavedCoordChanges[GrDrawState::kNumStages];
uint32_t fRestoreMask;
};
@@ -556,7 +557,7 @@ public:
private:
GrDrawState* fDrawState;
GrMatrix fViewMatrix;
- GrSamplerState::SavedCoordChange fSavedCoordChanges[GrDrawState::kNumStages];
+ GrEffectStage::SavedCoordChange fSavedCoordChanges[GrDrawState::kNumStages];
uint32_t fRestoreMask;
};
@@ -822,7 +823,7 @@ public:
bool isStageEnabled(int s) const {
GrAssert((unsigned)s < kNumStages);
- return (NULL != fSamplerStates[s].getEffect());
+ return (NULL != fStages[s].getEffect());
}
// Most stages are usually not used, so conditionals here
@@ -850,7 +851,7 @@ public:
if (enabled != s.isStageEnabled(i)) {
return false;
}
- if (enabled && this->fSamplerStates[i] != s.fSamplerStates[i]) {
+ if (enabled && this->fStages[i] != s.fStages[i]) {
return false;
}
}
@@ -878,7 +879,7 @@ public:
for (int i = 0; i < kNumStages; i++) {
if (s.isStageEnabled(i)) {
- this->fSamplerStates[i] = s.fSamplerStates[i];
+ this->fStages[i] = s.fStages[i];
}
}
@@ -905,7 +906,7 @@ private:
// This field must be last; it will not be copied or compared
// if the corresponding fTexture[] is NULL.
- GrSamplerState fSamplerStates[kNumStages];
+ GrEffectStage fStages[kNumStages];
typedef GrRefCnt INHERITED;
};