Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1192463003: Don't call bindTexture from GrGLProgram (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/gl/GrGLProgram.cpp ('K') | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 1e6251ba66b007b4d5ba9efdb3c5f809373626f9..25d97164036c25d8ddb710581f2f25e607592b3e 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -38,9 +38,8 @@ public:
static_cast<GrGLPathProcessor*>(fGeometryProcessor->fGLProc.get());
pathProc->resolveSeparableVaryings(fGpu, programID);
return SkNEW_ARGS(GrGLNvprProgram, (fGpu, this->desc(), fUniformHandles, programID,
- fUniforms,
- fGeometryProcessor,
- fXferProcessor, fFragmentProcessors.get()));
+ fUniforms, fGeometryProcessor, fXferProcessor,
+ fFragmentProcessors.get(), &fSamplerUniforms));
}
private:
@@ -98,7 +97,8 @@ GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const DrawArgs& args)
, fXferProcessor(NULL)
, fArgs(args)
, fGpu(gpu)
- , fUniforms(kVarsPerBlock) {
+ , fUniforms(kVarsPerBlock)
+ , fSamplerUniforms(4) {
}
void GrGLProgramBuilder::addVarying(const char* name,
@@ -381,16 +381,17 @@ template <class Proc>
void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
GrGLProcessor::TextureSamplerArray* outSamplers,
GrGLInstalledProc<Proc>* ip) {
+ SkDEBUGCODE(ip->fSamplersIdx = fSamplerUniforms.count();)
int numTextures = processor.numTextures();
- ip->fSamplers.push_back_n(numTextures);
+ UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextures);
SkString name;
for (int t = 0; t < numTextures; ++t) {
name.printf("Sampler%d", t);
- ip->fSamplers[t].fUniform = this->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kSampler2D_GrSLType, kDefault_GrSLPrecision,
- name.c_str());
+ localSamplerUniforms[t] = this->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ kSampler2D_GrSLType, kDefault_GrSLPrecision,
+ name.c_str());
SkNEW_APPEND_TO_TARRAY(outSamplers, GrGLProcessor::TextureSampler,
- (ip->fSamplers[t].fUniform, processor.textureAccess(t)));
+ (localSamplerUniforms[t], processor.textureAccess(t)));
}
}
@@ -498,7 +499,8 @@ void GrGLProgramBuilder::cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs) {
GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) {
return SkNEW_ARGS(GrGLProgram, (fGpu, this->desc(), fUniformHandles, programID, fUniforms,
- fGeometryProcessor, fXferProcessor, fFragmentProcessors.get()));
+ fGeometryProcessor, fXferProcessor, fFragmentProcessors.get(),
+ &fSamplerUniforms));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
« src/gpu/gl/GrGLProgram.cpp ('K') | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698