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

Unified Diff: src/gpu/gl/GrGLProgramDataManager.cpp

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert Created 4 years, 8 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
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLSampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramDataManager.cpp
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp
index 6b2e1118cb2ea05f98912142172219322471d62c..9513a3fd57b086c60b95b8f1b4df61bcac9a7e5a 100644
--- a/src/gpu/gl/GrGLProgramDataManager.cpp
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp
@@ -61,19 +61,31 @@ GrGLProgramDataManager::GrGLProgramDataManager(GrGLGpu* gpu, GrGLuint programID,
}
}
-void GrGLProgramDataManager::setSampler(UniformHandle u, int texUnit) const {
- const Uniform& uni = fUniforms[u.toIndex()];
- SkASSERT(GrSLTypeIsSamplerType(uni.fType));
- SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
- // FIXME: We still insert a single sampler uniform for every stage. If the shader does not
- // reference the sampler then the compiler may have optimized it out. Uncomment this assert
- // once stages insert their own samplers.
- // this->printUnused(uni);
- if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
- }
- if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
+void GrGLProgramDataManager::setSamplers(const SkTArray<GrGLSampler>& samplers) const {
+ for (int i = 0; i < samplers.count(); ++i) {
+ GrGLint vsLocation;
+ GrGLint fsLocation;
+ const GrGLSampler& sampler = samplers[i];
+ if (kVertex_GrShaderFlag & sampler.visibility()) {
+ vsLocation = sampler.location();
+ } else {
+ vsLocation = kUnusedUniform;
+ }
+ if (kFragment_GrShaderFlag & sampler.visibility()) {
+ fsLocation = sampler.location();
+ } else {
+ fsLocation = kUnusedUniform;
+ }
+ // FIXME: We still insert a single sampler uniform for every stage. If the shader does not
+ // reference the sampler then the compiler may have optimized it out. Uncomment this assert
+ // once stages insert their own samplers.
+ // this->printUnused(uni);
+ if (kUnusedUniform != fsLocation) {
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i));
+ }
+ if (kUnusedUniform != vsLocation && vsLocation != fsLocation) {
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i));
+ }
}
}
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698