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

Side by Side Diff: src/gpu/gl/GrGLProgramDataManager.cpp

Issue 2076143003: Integers can now be passed as uniforms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary assert Created 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/glsl/GrGLSLProgramDataManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMatrix.h" 8 #include "SkMatrix.h"
9 #include "gl/GrGLProgramDataManager.h" 9 #include "gl/GrGLProgramDataManager.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // this->printUnused(uni); 82 // this->printUnused(uni);
83 if (kUnusedUniform != fsLocation) { 83 if (kUnusedUniform != fsLocation) {
84 GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i)); 84 GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i));
85 } 85 }
86 if (kUnusedUniform != vsLocation && vsLocation != fsLocation) { 86 if (kUnusedUniform != vsLocation && vsLocation != fsLocation) {
87 GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i)); 87 GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i));
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void GrGLProgramDataManager::set1i(UniformHandle u, int32_t i) const {
93 const Uniform& uni = fUniforms[u.toIndex()];
94 SkASSERT(uni.fType == kInt_GrSLType);
95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
96 SkDEBUGCODE(this->printUnused(uni));
97 if (kUnusedUniform != uni.fFSLocation) {
98 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i));
99 }
100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
101 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i));
102 }
103 }
104
92 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { 105 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const {
93 const Uniform& uni = fUniforms[u.toIndex()]; 106 const Uniform& uni = fUniforms[u.toIndex()];
94 SkASSERT(uni.fType == kFloat_GrSLType); 107 SkASSERT(uni.fType == kFloat_GrSLType);
95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); 108 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
96 SkDEBUGCODE(this->printUnused(uni);) 109 SkDEBUGCODE(this->printUnused(uni);)
97 if (kUnusedUniform != uni.fFSLocation) { 110 if (kUnusedUniform != uni.fFSLocation) {
98 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); 111 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
99 } 112 }
100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) { 113 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
101 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); 114 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 matrix); 301 matrix);
289 } 302 }
290 303
291 #ifdef SK_DEBUG 304 #ifdef SK_DEBUG
292 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { 305 void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
293 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) { 306 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
294 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); 307 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n");
295 } 308 }
296 } 309 }
297 #endif 310 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/glsl/GrGLSLProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698