aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-10-06 12:13:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-06 12:13:54 -0700
commit307796bc2e3731099d96773db7385fe70cb94f7d (patch)
treed76c7887045df86f570a09470ac9095dbbbbf723 /src/gpu/gl/builders
parent1564dde11af9f8ab1e4394af1599c5772accf710 (diff)
Plumb OptDrawState down to VertexShaderBuilder
Diffstat (limited to 'src/gpu/gl/builders')
-rw-r--r--src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp3
-rw-r--r--src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLFullProgramBuilder.cpp4
-rw-r--r--src/gpu/gl/builders/GrGLFullProgramBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp3
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h4
-rw-r--r--src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp11
7 files changed, 14 insertions, 15 deletions
diff --git a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp
index 2c70a75ca9..d5bccd7025 100644
--- a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp
@@ -9,8 +9,9 @@
#include "../GrGpuGL.h"
GrGLFragmentOnlyProgramBuilder::GrGLFragmentOnlyProgramBuilder(GrGpuGL* gpu,
+ const GrOptDrawState& optState,
const GrGLProgramDesc& desc)
- : INHERITED(gpu, desc) {
+ : INHERITED(gpu, optState, desc) {
SkASSERT(desc.getHeader().fUseFragShaderOnly);
SkASSERT(gpu->glCaps().pathRenderingSupport());
SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorInput);
diff --git a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h
index b1fb88d954..06c15fdfe1 100644
--- a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h
@@ -12,7 +12,7 @@
class GrGLFragmentOnlyProgramBuilder : public GrGLProgramBuilder {
public:
- GrGLFragmentOnlyProgramBuilder(GrGpuGL*, const GrGLProgramDesc&);
+ GrGLFragmentOnlyProgramBuilder(GrGpuGL*, const GrOptDrawState&, const GrGLProgramDesc&);
int addTexCoordSets(int count);
diff --git a/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp b/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
index 46db712a96..d309b27583 100644
--- a/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
@@ -9,9 +9,9 @@
#include "../GrGLGeometryProcessor.h"
#include "../GrGpuGL.h"
-GrGLFullProgramBuilder::GrGLFullProgramBuilder(GrGpuGL* gpu,
+GrGLFullProgramBuilder::GrGLFullProgramBuilder(GrGpuGL* gpu, const GrOptDrawState& optState,
const GrGLProgramDesc& desc)
- : INHERITED(gpu, desc)
+ : INHERITED(gpu, optState, desc)
, fGLGeometryProcessorEmitter(this)
, fGS(this)
, fVS(this) {
diff --git a/src/gpu/gl/builders/GrGLFullProgramBuilder.h b/src/gpu/gl/builders/GrGLFullProgramBuilder.h
index 41da17ff9e..0f3834187b 100644
--- a/src/gpu/gl/builders/GrGLFullProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLFullProgramBuilder.h
@@ -15,7 +15,7 @@ class GrGLVertexProgramEffects;
class GrGLFullProgramBuilder : public GrGLProgramBuilder {
public:
- GrGLFullProgramBuilder(GrGpuGL*, const GrGLProgramDesc&);
+ GrGLFullProgramBuilder(GrGpuGL*, const GrOptDrawState&, const GrGLProgramDesc&);
/** Add a varying variable to the current program to pass values between vertex and fragment
shaders. If the last two parameters are non-NULL, they are filled in with the name
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 909ac76d62..de08ec4ad0 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -82,7 +82,7 @@ bool GrGLProgramBuilder::genProgram(const GrGeometryStage* geometryProcessor,
//////////////////////////////////////////////////////////////////////////////
-GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu,
+GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu, const GrOptDrawState& optState,
const GrGLProgramDesc& desc)
: fEffectEmitter(NULL)
, fFragOnly(SkToBool(desc.getHeader().fUseFragShaderOnly))
@@ -91,6 +91,7 @@ GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu,
, fFS(this, desc)
, fSeparableVaryingInfos(kVarsPerBlock)
, fGrProcessorEmitter(this)
+ , fOptState(optState)
, fDesc(desc)
, fGpu(gpu)
, fUniforms(kVarsPerBlock) {
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index f6397d8871..7fa8ba266c 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -145,8 +145,9 @@ public:
protected:
typedef GrTAllocator<GrGLShaderVar> VarArray;
- GrGLProgramBuilder(GrGpuGL*, const GrGLProgramDesc&);
+ GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&, const GrGLProgramDesc&);
+ const GrOptDrawState& optState() const { return fOptState; }
const GrGLProgramDesc& desc() const { return fDesc; }
// Helper for emitEffects().
@@ -326,6 +327,7 @@ private:
GrGLFragmentProcessorEmitter fGrProcessorEmitter;
+ const GrOptDrawState& fOptState;
const GrGLProgramDesc& fDesc;
GrGpuGL* fGpu;
UniformInfoArray fUniforms;
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index 4877071d77..55ce7d1458 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -82,14 +82,9 @@ void GrGLVertexShaderBuilder::bindProgramLocations(GrGLuint programId) {
coverage_attribute_name()));
}
- // We pull the current state of attributes off of drawstate's optimized state and bind them in
- // order. This assumes that the drawState has not changed since we called flushGraphicsState()
- // higher up in the stack.
- const GrDrawTargetCaps* caps = fProgramBuilder->gpu()->caps();
- const GrDrawState& drawState = *fProgramBuilder->gpu()->drawState();
- SkAutoTUnref<GrOptDrawState> optState(drawState.createOptState(*caps));
- const GrVertexAttrib* vaPtr = optState->getVertexAttribs();
- const int vaCount = optState->getVertexAttribCount();
+ const GrOptDrawState& optState = fProgramBuilder->optState();
+ const GrVertexAttrib* vaPtr = optState.getVertexAttribs();
+ const int vaCount = optState.getVertexAttribCount();
int i = fEffectAttribOffset;
for (int index = 0; index < vaCount; index++) {