aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLProcessor.h8
-rw-r--r--src/gpu/gl/GrGLProgram.cpp20
-rw-r--r--src/gpu/gl/GrGLProgram.h10
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp12
-rw-r--r--src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp6
-rw-r--r--src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h4
-rw-r--r--src/gpu/gl/builders/GrGLNvprProgramBuilder.cpp4
-rw-r--r--src/gpu/gl/builders/GrGLNvprProgramBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp21
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h5
10 files changed, 46 insertions, 46 deletions
diff --git a/src/gpu/gl/GrGLProcessor.h b/src/gpu/gl/GrGLProcessor.h
index 331607a693..f5ebf51b08 100644
--- a/src/gpu/gl/GrGLProcessor.h
+++ b/src/gpu/gl/GrGLProcessor.h
@@ -72,11 +72,9 @@ public:
/** A GrGLProcessor instance can be reused with any GrProcessor that produces the same stage
key; this function reads data from a GrProcessor and uploads any uniform variables required
- by the shaders created in emitCode(). The GrProcessor installed in the GrDrawEffect is
- guaranteed to be of the same type that created this GrGLProcessor and to have an identical
- effect key as the one that created this GrGLProcessor. Effects that use local coords have
- to consider whether the GrProcessorStage's coord change matrix should be used. When explicit
- local coordinates are used it can be ignored. */
+ by the shaders created in emitCode(). The GrProcessor parameter is guaranteed to be of the
+ same type that created this GrGLProcessor and to have an identical effect key as the one
+ that created this GrGLProcessor. */
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {}
const char* name() const { return fFactory.name(); }
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 3456a424d0..0e67e81e86 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -25,17 +25,16 @@
/**
* Retrieves the final matrix that a transform needs to apply to its source coords.
*/
-static SkMatrix get_transform_matrix(const GrFragmentStage& processorStage,
+static SkMatrix get_transform_matrix(const GrPendingFragmentStage& stage,
bool useExplicitLocalCoords,
int transformIdx) {
- const GrCoordTransform& coordTransform =
- processorStage.getProcessor()->coordTransform(transformIdx);
+ const GrCoordTransform& coordTransform = stage.getProcessor()->coordTransform(transformIdx);
SkMatrix combined;
if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
// If we have explicit local coords then we shouldn't need a coord change.
const SkMatrix& ccm =
- useExplicitLocalCoords ? SkMatrix::I() : processorStage.getCoordChangeMatrix();
+ useExplicitLocalCoords ? SkMatrix::I() : stage.getCoordChangeMatrix();
combined.setConcat(coordTransform.getMatrix(), ccm);
} else {
combined = coordTransform.getMatrix();
@@ -175,14 +174,15 @@ void GrGLProgram::setData(const GrOptDrawState& optState,
void GrGLProgram::setFragmentData(const GrOptDrawState& optState) {
int numProcessors = fFragmentProcessors->fProcs.count();
for (int e = 0; e < numProcessors; ++e) {
- const GrFragmentStage& stage = optState.getFragmentStage(e);
+ const GrPendingFragmentStage& stage = optState.getFragmentStage(e);
const GrProcessor& processor = *stage.getProcessor();
fFragmentProcessors->fProcs[e]->fGLProc->setData(fProgramDataManager, processor);
this->setTransformData(stage, fFragmentProcessors->fProcs[e]);
this->bindTextures(fFragmentProcessors->fProcs[e], processor);
}
}
-void GrGLProgram::setTransformData(const GrFragmentStage& processor, GrGLInstalledFragProc* ip) {
+void GrGLProgram::setTransformData(const GrPendingFragmentStage& processor,
+ GrGLInstalledFragProc* ip) {
SkTArray<GrGLInstalledFragProc::Transform, true>& transforms = ip->fTransforms;
int numTransforms = transforms.count();
SkASSERT(numTransforms == processor.getProcessor()->numTransforms());
@@ -329,7 +329,8 @@ void GrGLNvprProgram::didSetData(GrGpu::DrawType drawType) {
SkASSERT(GrGpu::IsPathRenderingDrawType(drawType));
}
-void GrGLNvprProgram::setTransformData(const GrFragmentStage& proc, GrGLInstalledFragProc* ip) {
+void GrGLNvprProgram::setTransformData(const GrPendingFragmentStage& proc,
+ GrGLInstalledFragProc* ip) {
SkTArray<GrGLInstalledFragProc::Transform, true>& transforms = ip->fTransforms;
int numTransforms = transforms.count();
SkASSERT(numTransforms == proc.getProcessor()->numTransforms());
@@ -370,7 +371,8 @@ void GrGLLegacyNvprProgram::didSetData(GrGpu::DrawType drawType) {
}
void
-GrGLLegacyNvprProgram::setTransformData(const GrFragmentStage& proc, GrGLInstalledFragProc* ip) {
+GrGLLegacyNvprProgram::setTransformData(const GrPendingFragmentStage& proc,
+ GrGLInstalledFragProc* ip) {
// We've hidden the texcoord index in the first entry of the transforms array for each effect
int texCoordIndex = ip->fTransforms[0].fHandle.handle();
int numTransforms = proc.getProcessor()->numTransforms();
@@ -378,7 +380,7 @@ GrGLLegacyNvprProgram::setTransformData(const GrFragmentStage& proc, GrGLInstall
const SkMatrix& transform = get_transform_matrix(proc, false, t);
GrGLPathRendering::PathTexGenComponents components =
GrGLPathRendering::kST_PathTexGenComponents;
- if (proc.isPerspectiveCoordTransform(t, false)) {
+ if (proc.isPerspectiveCoordTransform(t)) {
components = GrGLPathRendering::kSTR_PathTexGenComponents;
}
fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, transform);
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index e37d54d124..c623977a91 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -159,7 +159,7 @@ protected:
// A templated helper to loop over effects, set the transforms(via subclass) and bind textures
void setFragmentData(const GrOptDrawState&);
- virtual void setTransformData(const GrFragmentStage& effectStage, GrGLInstalledFragProc* pe);
+ virtual void setTransformData(const GrPendingFragmentStage&, GrGLInstalledFragProc*);
void bindTextures(const GrGLInstalledProc*, const GrProcessor&);
/*
@@ -215,7 +215,7 @@ protected:
class GrGLNvprProgram : public GrGLNvprProgramBase {
public:
- virtual bool hasVertexShader() const SK_OVERRIDE { return true; }
+ virtual bool hasVertexShader() const SK_OVERRIDE { return true; }
private:
typedef GrGLNvprProgramBuilder::SeparableVaryingInfo SeparableVaryingInfo;
@@ -228,7 +228,8 @@ private:
GrGLInstalledFragProcs* fragmentProcessors,
const SeparableVaryingInfoArray& separableVaryings);
virtual void didSetData(GrGpu::DrawType) SK_OVERRIDE;
- virtual void setTransformData(const GrFragmentStage&, GrGLInstalledFragProc*) SK_OVERRIDE;
+ virtual void setTransformData(const GrPendingFragmentStage&,
+ GrGLInstalledFragProc*) SK_OVERRIDE;
struct Varying {
GrGLint fLocation;
@@ -256,7 +257,8 @@ private:
GrGLInstalledFragProcs* fragmentProcessors,
int texCoordSetCnt);
virtual void didSetData(GrGpu::DrawType) SK_OVERRIDE;
- virtual void setTransformData(const GrFragmentStage&, GrGLInstalledFragProc*) SK_OVERRIDE;
+ virtual void setTransformData(const GrPendingFragmentStage&,
+ GrGLInstalledFragProc*) SK_OVERRIDE;
int fTexCoordSetCnt;
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 836400e350..f8510ff30b 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -73,19 +73,19 @@ static uint32_t gen_attrib_key(const GrGeometryProcessor& proc) {
return key;
}
-static uint32_t gen_transform_key(const GrFragmentStage& effectStage,
+static uint32_t gen_transform_key(const GrPendingFragmentStage& stage,
bool useExplicitLocalCoords) {
uint32_t totalKey = 0;
- int numTransforms = effectStage.getProcessor()->numTransforms();
+ int numTransforms = stage.getProcessor()->numTransforms();
for (int t = 0; t < numTransforms; ++t) {
uint32_t key = 0;
- if (effectStage.isPerspectiveCoordTransform(t, useExplicitLocalCoords)) {
+ if (stage.isPerspectiveCoordTransform(t)) {
key |= kGeneral_MatrixType;
} else {
key |= kNoPersp_MatrixType;
}
- const GrCoordTransform& coordTransform = effectStage.getProcessor()->coordTransform(t);
+ const GrCoordTransform& coordTransform = stage.getProcessor()->coordTransform(t);
if (kLocal_GrCoordSet != coordTransform.sourceCoords() && useExplicitLocalCoords) {
key |= kPositionCoords_Flag;
}
@@ -161,8 +161,8 @@ struct GeometryProcessorKeyBuilder {
};
struct FragmentProcessorKeyBuilder {
- typedef GrFragmentStage StagedProcessor;
- static bool GetProcessorKey(const GrFragmentStage& fps,
+ typedef GrPendingFragmentStage StagedProcessor;
+ static bool GetProcessorKey(const GrPendingFragmentStage& fps,
const GrGLCaps& caps,
bool useLocalCoords,
GrProcessorKeyBuilder* b,
diff --git a/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp b/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp
index c0c4fbb46e..b251593bfe 100644
--- a/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp
@@ -21,7 +21,7 @@ int GrGLLegacyNvprProgramBuilder::addTexCoordSets(int count) {
return firstFreeCoordSet;
}
-void GrGLLegacyNvprProgramBuilder::emitTransforms(const GrFragmentStage& processorStage,
+void GrGLLegacyNvprProgramBuilder::emitTransforms(const GrPendingFragmentStage& processorStage,
GrGLProcessor::TransformedCoordsArray* outCoords,
GrGLInstalledFragProc* ifp) {
int numTransforms = processorStage.getProcessor()->numTransforms();
@@ -35,8 +35,8 @@ void GrGLLegacyNvprProgramBuilder::emitTransforms(const GrFragmentStage& process
SkString name;
for (int t = 0; t < numTransforms; ++t) {
- GrSLType type = processorStage.isPerspectiveCoordTransform(t, false) ? kVec3f_GrSLType :
- kVec2f_GrSLType;
+ GrSLType type = processorStage.isPerspectiveCoordTransform(t) ? kVec3f_GrSLType :
+ kVec2f_GrSLType;
name.printf("%s(gl_TexCoord[%i])", GrGLSLTypeString(type), texCoordIndex++);
SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, (name, type));
diff --git a/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h b/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h
index cd2cfb7453..b25759e795 100644
--- a/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h
@@ -18,9 +18,9 @@ public:
private:
int addTexCoordSets(int count);
- void emitTransforms(const GrFragmentStage&,
+ void emitTransforms(const GrPendingFragmentStage&,
GrGLProcessor::TransformedCoordsArray* outCoords,
- GrGLInstalledFragProc*);
+ GrGLInstalledFragProc*) SK_OVERRIDE;
int fTexCoordSetCnt;
diff --git a/src/gpu/gl/builders/GrGLNvprProgramBuilder.cpp b/src/gpu/gl/builders/GrGLNvprProgramBuilder.cpp
index 5488252b28..f5a55866ee 100644
--- a/src/gpu/gl/builders/GrGLNvprProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLNvprProgramBuilder.cpp
@@ -17,7 +17,7 @@ GrGLNvprProgramBuilder::GrGLNvprProgramBuilder(GrGpuGL* gpu,
, fSeparableVaryingInfos(kVarsPerBlock) {
}
-void GrGLNvprProgramBuilder::emitTransforms(const GrFragmentStage& processorStage,
+void GrGLNvprProgramBuilder::emitTransforms(const GrPendingFragmentStage& processorStage,
GrGLProcessor::TransformedCoordsArray* outCoords,
GrGLInstalledFragProc* ifp) {
const GrFragmentProcessor* effect = processorStage.getProcessor();
@@ -27,7 +27,7 @@ void GrGLNvprProgramBuilder::emitTransforms(const GrFragmentStage& processorStag
for (int t = 0; t < numTransforms; t++) {
GrSLType varyingType =
- processorStage.isPerspectiveCoordTransform(t, false) ?
+ processorStage.isPerspectiveCoordTransform(t) ?
kVec3f_GrSLType :
kVec2f_GrSLType;
diff --git a/src/gpu/gl/builders/GrGLNvprProgramBuilder.h b/src/gpu/gl/builders/GrGLNvprProgramBuilder.h
index e9f6b3b872..48fa96c8d7 100644
--- a/src/gpu/gl/builders/GrGLNvprProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLNvprProgramBuilder.h
@@ -28,7 +28,7 @@ public:
virtual GrGLProgram* createProgram(GrGLuint programID);
private:
- virtual void emitTransforms(const GrFragmentStage&,
+ virtual void emitTransforms(const GrPendingFragmentStage&,
GrGLProcessor::TransformedCoordsArray* outCoords,
GrGLInstalledFragProc*) SK_OVERRIDE;
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index f628db9289..e56a83d2f1 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -266,8 +266,8 @@ void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, int numProcs, G
GrGLProgramDescBuilder::kProcessorKeyOffsetsAndLengthOffset);
for (int e = procOffset; e < numProcs; ++e) {
GrGLSLExpr4 output;
- const GrFragmentStage& stage = fOptState.getFragmentStage(e);
- this->emitAndInstallProc<GrFragmentStage>(stage, e, keyProvider, *inOut, &output);
+ const GrPendingFragmentStage& stage = fOptState.getFragmentStage(e);
+ this->emitAndInstallProc<GrPendingFragmentStage>(stage, e, keyProvider, *inOut, &output);
*inOut = output;
}
}
@@ -305,7 +305,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const Proc& proc,
fFS.codeAppend("}");
}
-void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentStage& fs,
+void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
const GrProcessorKey& key,
const char* outColor,
const char* inColor) {
@@ -358,20 +358,17 @@ void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) {
SkASSERT(fFS.hasReadDstColor() == fp.willReadDstColor());
}
-void GrGLProgramBuilder::emitTransforms(const GrFragmentStage& effectStage,
+void GrGLProgramBuilder::emitTransforms(const GrPendingFragmentStage& stage,
GrGLProcessor::TransformedCoordsArray* outCoords,
GrGLInstalledFragProc* ifp) {
- const GrFragmentProcessor* effect = effectStage.getProcessor();
- int numTransforms = effect->numTransforms();
+ const GrFragmentProcessor* processor = stage.getProcessor();
+ int numTransforms = processor->numTransforms();
ifp->fTransforms.push_back_n(numTransforms);
for (int t = 0; t < numTransforms; t++) {
const char* uniName = "StageMatrix";
- GrSLType varyingType =
- effectStage.isPerspectiveCoordTransform(t, fVS.hasLocalCoords()) ?
- kVec3f_GrSLType :
- kVec2f_GrSLType;
-
+ GrSLType varyingType = stage.isPerspectiveCoordTransform(t) ? kVec3f_GrSLType :
+ kVec2f_GrSLType;
SkString suffixedUniName;
if (0 != t) {
suffixedUniName.append(uniName);
@@ -390,7 +387,7 @@ void GrGLProgramBuilder::emitTransforms(const GrFragmentStage& effectStage,
suffixedVaryingName.appendf("_%i", t);
varyingName = suffixedVaryingName.c_str();
}
- const char* coords = kPosition_GrCoordSet == effect->coordTransform(t).sourceCoords() ?
+ const char* coords = kPosition_GrCoordSet == processor->coordTransform(t).sourceCoords() ?
fVS.positionAttribute().c_str() :
fVS.localCoordsAttribute().c_str();
GrGLVertToFrag v(varyingType);
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index a44fa91090..1b6c904036 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -14,6 +14,7 @@
#include "../GrGLProgramDataManager.h"
#include "../GrGLUniformHandle.h"
#include "../GrGLGeometryProcessor.h"
+#include "../../GrPendingFragmentStage.h"
/*
* This is the base class for a series of interfaces. This base class *MUST* remain abstract with
@@ -252,7 +253,7 @@ protected:
GrGLSLExpr4* output);
// these emit functions help to keep the createAndEmitProcessors template general
- void emitAndInstallProc(const GrFragmentStage&,
+ void emitAndInstallProc(const GrPendingFragmentStage&,
const GrProcessorKey&,
const char* outColor,
const char* inColor);
@@ -267,7 +268,7 @@ protected:
GrGLInstalledProc*);
// each specific program builder has a distinct transform and must override this function
- virtual void emitTransforms(const GrFragmentStage&,
+ virtual void emitTransforms(const GrPendingFragmentStage&,
GrGLProcessor::TransformedCoordsArray* outCoords,
GrGLInstalledFragProc*);
GrGLProgram* finalize();