aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar fmenozzi <fmenozzi@google.com>2016-06-18 09:31:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-18 09:31:58 -0700
commitcc3a22b369e1a60fa2acf2987f2934baf7c4b198 (patch)
tree8e1c44abd38f3fdcc8fffeebc07f637e6484fdc7 /src
parent802acec1876bb647aaab1bbcfd97748bba54da8f (diff)
Integers can now be passed as uniforms; needed for passing color count to fragment shader
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLProgramDataManager.cpp13
-rw-r--r--src/gpu/gl/GrGLProgramDataManager.h1
-rw-r--r--src/gpu/glsl/GrGLSLProgramDataManager.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp
index 9513a3fd57..fa232b73fd 100644
--- a/src/gpu/gl/GrGLProgramDataManager.cpp
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp
@@ -89,6 +89,19 @@ void GrGLProgramDataManager::setSamplers(const SkTArray<GrGLSampler>& samplers)
}
}
+void GrGLProgramDataManager::set1i(UniformHandle u, int i) const {
+ const Uniform& uni = fUniforms[u.toIndex()];
+ SkASSERT(uni.fType == kInt_GrSLType);
+ SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
+ SkDEBUGCODE(this->printUnused(uni));
+ if (kUnusedUniform != uni.fFSLocation) {
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i));
+ }
+ if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
+ GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i));
+ }
+}
+
void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kFloat_GrSLType);
diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h
index 513b6a4ce6..62da06dbec 100644
--- a/src/gpu/gl/GrGLProgramDataManager.h
+++ b/src/gpu/gl/GrGLProgramDataManager.h
@@ -53,6 +53,7 @@ public:
/** Functions for uploading uniform values. The varities ending in v can be used to upload to an
* array of uniforms. arrayCount must be <= the array count of the uniform.
*/
+ void set1i(UniformHandle, int) const override;
void set1f(UniformHandle, float v0) const override;
void set1fv(UniformHandle, int arrayCount, const float v[]) const override;
void set2f(UniformHandle, float, float) const override;
diff --git a/src/gpu/glsl/GrGLSLProgramDataManager.h b/src/gpu/glsl/GrGLSLProgramDataManager.h
index 5d502cfd75..7b310628c5 100644
--- a/src/gpu/glsl/GrGLSLProgramDataManager.h
+++ b/src/gpu/glsl/GrGLSLProgramDataManager.h
@@ -26,6 +26,7 @@ public:
/** Functions for uploading uniform values. The varities ending in v can be used to upload to an
* array of uniforms. arrayCount must be <= the array count of the uniform.
*/
+ virtual void set1i(UniformHandle, int) const = 0;
virtual void set1f(UniformHandle, float v0) const = 0;
virtual void set1fv(UniformHandle, int arrayCount, const float v[]) const = 0;
virtual void set2f(UniformHandle, float, float) const = 0;