Add a GrGpuGL reference for GrGLProgram/GrGLUniformManager
Updates GrGLProgram and GrGLUniformManager to keep a GrGpuGL reference
instead of one for GrGLContextInfo. No change in functionality, this
is in preparation to support fixed function GL calls for vertexless
shaders.
R=bsalomon@google.com
Author: cdalton@nvidia.com
Review URL: https://chromiumcodereview.appspot.com/23636011
git-svn-id: http://skia.googlecode.com/svn/trunk/src@11111 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/gl/GrGLProgram.cpp b/gpu/gl/GrGLProgram.cpp
index 540ebca..d457a32 100644
--- a/gpu/gl/GrGLProgram.cpp
+++ b/gpu/gl/GrGLProgram.cpp
@@ -21,8 +21,8 @@
SK_DEFINE_INST_COUNT(GrGLProgram)
-#define GL_CALL(X) GR_GL_CALL(fContext.interface(), X)
-#define GL_CALL_RET(R, X) GR_GL_CALL_RET(fContext.interface(), R, X)
+#define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
+#define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X)
SK_CONF_DECLARE(bool, c_PrintShaders, "gpu.printShaders", false,
"Print the source code for all shaders generated.");
@@ -36,11 +36,11 @@
inline const char* dual_source_output_name() { return "dualSourceOut"; }
}
-GrGLProgram* GrGLProgram::Create(const GrGLContext& gl,
+GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu,
const GrGLProgramDesc& desc,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[]) {
- GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, colorStages, coverageStages));
+ GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gpu, desc, colorStages, coverageStages));
if (!program->succeeded()) {
delete program;
program = NULL;
@@ -48,12 +48,12 @@
return program;
}
-GrGLProgram::GrGLProgram(const GrGLContext& gl,
+GrGLProgram::GrGLProgram(GrGpuGL* gpu,
const GrGLProgramDesc& desc,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[])
-: fContext(gl)
-, fUniformManager(gl) {
+: fGpu(gpu)
+, fUniformManager(gpu) {
fDesc = desc;
fVShaderID = 0;
fGShaderID = 0;
@@ -286,7 +286,7 @@
#if GR_GL_EXPERIMENTAL_GS
// TODO: The builder should add all this glue code.
if (fDesc.getHeader().fExperimentalGS) {
- SkASSERT(fContext.info().glslGeneration() >= k150_GrGLSLGeneration);
+ SkASSERT(fGpu->glslGeneration() >= k150_GrGLSLGeneration);
vertexBuilder->fGSHeader.append("layout(triangles) in;\n"
"layout(triangle_strip, max_vertices = 6) out;\n");
vertexBuilder->gsCodeAppend("\tfor (int i = 0; i < 3; ++i) {\n"
@@ -335,7 +335,7 @@
}
// Compiles a GL shader, returns shader ID or 0 if failed params have same meaning as glShaderSource
-GrGLuint compile_shader(const GrGLContext& gl,
+GrGLuint compile_shader(const GrGLInterface* gli,
GrGLenum type,
int stringCnt,
const char** strings,
@@ -344,12 +344,11 @@
"stringCount", SkStringPrintf("%i", stringCnt).c_str());
GrGLuint shader;
- GR_GL_CALL_RET(gl.interface(), shader, CreateShader(type));
+ GR_GL_CALL_RET(gli, shader, CreateShader(type));
if (0 == shader) {
return 0;
}
- const GrGLInterface* gli = gl.interface();
GrGLint compiled = GR_GL_INIT_ZERO;
GR_GL_CALL(gli, ShaderSource(shader, stringCnt, strings, stringLengths));
GR_GL_CALL(gli, CompileShader(shader));
@@ -376,10 +375,10 @@
}
// helper version of above for when shader is already flattened into a single SkString
-GrGLuint compile_shader(const GrGLContext& gl, GrGLenum type, const SkString& shader) {
+GrGLuint compile_shader(const GrGLInterface* gli, GrGLenum type, const SkString& shader) {
const GrGLchar* str = shader.c_str();
int length = shader.size();
- return compile_shader(gl, type, 1, &str, &length);
+ return compile_shader(gli, type, 1, &str, &length);
}
void expand_known_value4f(SkString* string, GrSLConstantVec vec) {
@@ -412,7 +411,7 @@
GrPrintf(shader.c_str());
GrPrintf("\n");
}
- if (!(fVShaderID = compile_shader(fContext, GR_GL_VERTEX_SHADER, shader))) {
+ if (!(fVShaderID = compile_shader(fGpu->glInterface(), GR_GL_VERTEX_SHADER, shader))) {
return false;
}
@@ -423,7 +422,7 @@
GrPrintf(shader.c_str());
GrPrintf("\n");
}
- if (!(fGShaderID = compile_shader(fContext, GR_GL_GEOMETRY_SHADER, shader))) {
+ if (!(fGShaderID = compile_shader(fGpu->glInterface(), GR_GL_GEOMETRY_SHADER, shader))) {
return false;
}
}
@@ -435,7 +434,7 @@
GrPrintf(shader.c_str());
GrPrintf("\n");
}
- if (!(fFShaderID = compile_shader(fContext, GR_GL_FRAGMENT_SHADER, shader))) {
+ if (!(fFShaderID = compile_shader(fGpu->glInterface(), GR_GL_FRAGMENT_SHADER, shader))) {
return false;
}
@@ -450,7 +449,7 @@
bool needsVertexShader = true;
- GrGLShaderBuilder builder(fContext.info(), fUniformManager, fDesc, needsVertexShader);
+ GrGLShaderBuilder builder(fGpu->ctxInfo(), fUniformManager, fDesc, needsVertexShader);
if (GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder.getVertexBuilder()) {
const char* viewMName;
@@ -476,7 +475,7 @@
bool dualSourceOutputWritten = false;
GrGLShaderVar colorOutput;
- bool isColorDeclared = GrGLSLSetupFSColorOuput(fContext.info().glslGeneration(),
+ bool isColorDeclared = GrGLSLSetupFSColorOuput(fGpu->glslGeneration(),
declared_color_output_name(),
&colorOutput);
if (isColorDeclared) {
@@ -797,8 +796,7 @@
///////////////////////////////////////////////////////////////////////////////
-void GrGLProgram::setEffectData(GrGpuGL* gpu,
- const GrEffectStage& stage,
+void GrGLProgram::setEffectData(const GrEffectStage& stage,
const EffectAndSamplers& effect) {
// Let the GrGLEffect set its data.
@@ -815,18 +813,17 @@
const GrTextureAccess& access = (*stage.getEffect())->textureAccess(s);
GrGLTexture* texture = static_cast<GrGLTexture*>(access.getTexture());
int unit = effect.fTextureUnits[s];
- gpu->bindTexture(unit, access.getParams(), texture);
+ fGpu->bindTexture(unit, access.getParams(), texture);
}
}
}
-void GrGLProgram::setData(GrGpuGL* gpu,
- GrDrawState::BlendOptFlags blendOpts,
+void GrGLProgram::setData(GrDrawState::BlendOptFlags blendOpts,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[],
const GrDeviceCoordTexture* dstCopy,
SharedGLState* sharedState) {
- const GrDrawState& drawState = gpu->getDrawState();
+ const GrDrawState& drawState = fGpu->getDrawState();
GrColor color;
GrColor coverage;
@@ -864,7 +861,7 @@
1.f / dstCopy->texture()->height());
GrGLTexture* texture = static_cast<GrGLTexture*>(dstCopy->texture());
static GrTextureParams kParams; // the default is clamp, nearest filtering.
- gpu->bindTexture(fDstCopyTexUnit, kParams, texture);
+ fGpu->bindTexture(fDstCopyTexUnit, kParams, texture);
} else {
SkASSERT(!fUniformHandles.fDstCopyScaleUni.isValid());
SkASSERT(!fUniformHandles.fDstCopySamplerUni.isValid());
@@ -879,13 +876,13 @@
// We may have omitted the GrGLEffect because of the color filter logic in genProgram.
// This can be removed when the color filter is an effect.
if (NULL != fColorEffects[e].fGLEffect) {
- this->setEffectData(gpu, *colorStages[e], fColorEffects[e]);
+ this->setEffectData(*colorStages[e], fColorEffects[e]);
}
}
for (int e = 0; e < fCoverageEffects.count(); ++e) {
if (NULL != fCoverageEffects[e].fGLEffect) {
- this->setEffectData(gpu, *coverageStages[e], fCoverageEffects[e]);
+ this->setEffectData(*coverageStages[e], fCoverageEffects[e]);
}
}
}
diff --git a/gpu/gl/GrGLProgram.h b/gpu/gl/GrGLProgram.h
index e39e9bf..283ac03 100644
--- a/gpu/gl/GrGLProgram.h
+++ b/gpu/gl/GrGLProgram.h
@@ -37,7 +37,7 @@
public:
SK_DECLARE_INST_COUNT(GrGLProgram)
- static GrGLProgram* Create(const GrGLContext& gl,
+ static GrGLProgram* Create(GrGpuGL* gpu,
const GrGLProgramDesc& desc,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[]);
@@ -108,8 +108,7 @@
* GrGpuGL object to bind the textures required by the GrGLEffects. The color and coverage
* stages come from GrGLProgramDesc::Build().
*/
- void setData(GrGpuGL*,
- GrDrawState::BlendOptFlags,
+ void setData(GrDrawState::BlendOptFlags,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[],
const GrDeviceCoordTexture* dstCopy, // can be NULL
@@ -146,7 +145,7 @@
TextureUnitSArray fTextureUnits; // texture unit used for each entry of fSamplerUnis
};
- GrGLProgram(const GrGLContext& gl,
+ GrGLProgram(GrGpuGL* gpu,
const GrGLProgramDesc& desc,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[]);
@@ -179,7 +178,7 @@
const char* adjustInColor(const SkString& inColor) const;
// Helper for setData().
- void setEffectData(GrGpuGL* gpu, const GrEffectStage& stage, const EffectAndSamplers& effect);
+ void setEffectData(const GrEffectStage& stage, const EffectAndSamplers& effect);
// Helper for setData(). Makes GL calls to specify the initial color when there is not
// per-vertex colors.
@@ -209,7 +208,7 @@
SkTArray<EffectAndSamplers> fCoverageEffects;
GrGLProgramDesc fDesc;
- const GrGLContext& fContext;
+ GrGpuGL* fGpu;
GrGLUniformManager fUniformManager;
UniformHandles fUniformHandles;
diff --git a/gpu/gl/GrGLUniformManager.cpp b/gpu/gl/GrGLUniformManager.cpp
index 79895f1..74bb651 100644
--- a/gpu/gl/GrGLUniformManager.cpp
+++ b/gpu/gl/GrGLUniformManager.cpp
@@ -8,6 +8,7 @@
#include "gl/GrGLShaderBuilder.h"
#include "gl/GrGLProgram.h"
#include "gl/GrGLUniformHandle.h"
+#include "gl/GrGpuGL.h"
#include "SkMatrix.h"
#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, OFFSET, COUNT) \
@@ -34,10 +35,10 @@
// once stages insert their own samplers.
// SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1i(uni.fFSLocation, texUnit));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1i(uni.fVSLocation, texUnit));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
}
}
@@ -47,10 +48,10 @@
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1f(uni.fFSLocation, v0));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1f(uni.fVSLocation, v0));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
}
}
@@ -67,10 +68,10 @@
// arrays in VS and FS driver bug workaround, this can be enabled.
//SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation + offset, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform1fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation + offset, arrayCount, v));
}
}
@@ -80,10 +81,10 @@
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform2f(uni.fFSLocation, v0, v1));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform2f(uni.fVSLocation, v0, v1));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
}
}
@@ -97,10 +98,10 @@
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform2fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation + offset, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform2fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation + offset, arrayCount, v));
}
}
@@ -110,10 +111,10 @@
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
}
}
@@ -127,10 +128,10 @@
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform3fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation + offset, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform3fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation + offset, arrayCount, v));
}
}
@@ -144,10 +145,10 @@
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v3));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v3));
}
}
@@ -160,10 +161,10 @@
SkASSERT(arrayCount > 0);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform4fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation + offset, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), Uniform4fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation + offset, arrayCount, v));
}
}
@@ -174,10 +175,10 @@
// TODO: Re-enable this assert once texture matrices aren't forced on all effects
// SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
+ GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), UniformMatrix3fv(uni.fVSLocation, 1, false, matrix));
+ GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, false, matrix));
}
}
@@ -187,10 +188,10 @@
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
+ GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(), UniformMatrix4fv(uni.fVSLocation, 1, false, matrix));
+ GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, false, matrix));
}
}
@@ -204,11 +205,11 @@
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(),
+ GR_GL_CALL(fGpu->glInterface(),
UniformMatrix3fv(uni.fFSLocation + offset, arrayCount, false, matrices));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(),
+ GR_GL_CALL(fGpu->glInterface(),
UniformMatrix3fv(uni.fVSLocation + offset, arrayCount, false, matrices));
}
}
@@ -223,11 +224,11 @@
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(),
+ GR_GL_CALL(fGpu->glInterface(),
UniformMatrix4fv(uni.fFSLocation + offset, arrayCount, false, matrices));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fContext.interface(),
+ GR_GL_CALL(fGpu->glInterface(),
UniformMatrix4fv(uni.fVSLocation + offset, arrayCount, false, matrices));
}
}
@@ -257,7 +258,7 @@
SkASSERT(uniforms[i].fVariable.getArrayCount() == fUniforms[i].fArrayCount);
GrGLint location;
// TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
- GR_GL_CALL_RET(fContext.interface(), location,
+ GR_GL_CALL_RET(fGpu->glInterface(), location,
GetUniformLocation(programID, uniforms[i].fVariable.c_str()));
if (GrGLShaderBuilder::kVertex_Visibility & uniforms[i].fVisibility) {
fUniforms[i].fVSLocation = location;
diff --git a/gpu/gl/GrGLUniformManager.h b/gpu/gl/GrGLUniformManager.h
index 1ef262d..eefab04 100644
--- a/gpu/gl/GrGLUniformManager.h
+++ b/gpu/gl/GrGLUniformManager.h
@@ -14,7 +14,7 @@
#include "SkTArray.h"
-class GrGLContext;
+class GrGpuGL;
class SkMatrix;
/** Manages a program's uniforms.
@@ -46,7 +46,7 @@
friend class GrGLUniformManager; // For accessing toUniformIndex().
};
- GrGLUniformManager(const GrGLContext& context) : fContext(context) {}
+ GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) {}
UniformHandle appendUniform(GrSLType type, int arrayCount = GrGLShaderVar::kNonArray);
@@ -104,7 +104,7 @@
};
SkTArray<Uniform, true> fUniforms;
- const GrGLContext& fContext;
+ GrGpuGL* fGpu;
};
#endif
diff --git a/gpu/gl/GrGpuGL.cpp b/gpu/gl/GrGpuGL.cpp
index 28e41af..a9fd41e 100644
--- a/gpu/gl/GrGpuGL.cpp
+++ b/gpu/gl/GrGpuGL.cpp
@@ -148,7 +148,7 @@
ctx.info().caps()->print();
}
- fProgramCache = SkNEW_ARGS(ProgramCache, (this->glContext()));
+ fProgramCache = SkNEW_ARGS(ProgramCache, (this));
SkASSERT(this->glCaps().maxVertexAttributes() >= GrDrawState::kMaxVertexAttribCnt);
diff --git a/gpu/gl/GrGpuGL.h b/gpu/gl/GrGpuGL.h
index 1d1cdc5..669f21c 100644
--- a/gpu/gl/GrGpuGL.h
+++ b/gpu/gl/GrGpuGL.h
@@ -31,6 +31,7 @@
virtual ~GrGpuGL();
const GrGLInterface* glInterface() const { return fGLContext.interface(); }
+ const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); }
GrGLBinding glBinding() const { return fGLContext.info().binding(); }
GrGLVersion glVersion() const { return fGLContext.info().version(); }
GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGeneration(); }
@@ -171,7 +172,7 @@
class ProgramCache : public ::GrNoncopyable {
public:
- ProgramCache(const GrGLContext& gl);
+ ProgramCache(GrGpuGL* gpu);
~ProgramCache();
void abandon();
@@ -203,7 +204,7 @@
int fCount;
unsigned int fCurrLRUStamp;
- const GrGLContext& fGL;
+ GrGpuGL* fGpu;
#ifdef PROGRAM_CACHE_STATS
int fTotalRequests;
int fCacheMisses;
diff --git a/gpu/gl/GrGpuGL_program.cpp b/gpu/gl/GrGpuGL_program.cpp
index 2b1795d..0795dfa 100644
--- a/gpu/gl/GrGpuGL_program.cpp
+++ b/gpu/gl/GrGpuGL_program.cpp
@@ -35,10 +35,10 @@
}
};
-GrGpuGL::ProgramCache::ProgramCache(const GrGLContext& gl)
+GrGpuGL::ProgramCache::ProgramCache(GrGpuGL* gpu)
: fCount(0)
, fCurrLRUStamp(0)
- , fGL(gl)
+ , fGpu(gpu)
#ifdef PROGRAM_CACHE_STATS
, fTotalRequests(0)
, fCacheMisses(0)
@@ -119,7 +119,7 @@
#ifdef PROGRAM_CACHE_STATS
++fCacheMisses;
#endif
- GrGLProgram* program = GrGLProgram::Create(fGL, desc, colorStages, coverageStages);
+ GrGLProgram* program = GrGLProgram::Create(fGpu, desc, colorStages, coverageStages);
if (NULL == program) {
return NULL;
}
@@ -305,8 +305,7 @@
fCurrentProgram->overrideBlend(&srcCoeff, &dstCoeff);
this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff);
- fCurrentProgram->setData(this,
- blendOpts,
+ fCurrentProgram->setData(blendOpts,
colorStages.begin(),
coverageStages.begin(),
dstCopy,