Integers can now be passed as uniforms; needed for passing color count to fragment shader

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2076143003

Review-Url: https://codereview.chromium.org/2076143003
This commit is contained in:
fmenozzi 2016-06-18 09:31:58 -07:00 committed by Commit bot
parent 802acec187
commit cc3a22b369
3 changed files with 15 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;