aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkColorFilters.cpp2
-rw-r--r--src/effects/SkColorMatrixFilter.cpp4
-rw-r--r--src/effects/SkLightingImageFilter.cpp2
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp6
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointRadialGradient.cpp2
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp2
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp4
-rw-r--r--src/gpu/effects/GrTextureDomainEffect.cpp2
-rw-r--r--src/gpu/gl/GrGLProgram.cpp4
-rw-r--r--src/gpu/gl/GrGLShaderBuilder.cpp7
-rw-r--r--src/gpu/gl/GrGLUniformManager.cpp59
-rw-r--r--src/gpu/gl/GrGLUniformManager.h24
14 files changed, 70 insertions, 52 deletions
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index 613163e5a6..8ef9edf2b2 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -260,7 +260,7 @@ public:
const ModeColorFilterEffect& colorModeFilter = drawEffect.castEffect<ModeColorFilterEffect>();
GrGLfloat c[4];
GrColorToRGBAFloat(colorModeFilter.color(), c);
- uman.set4fv(fFilterColorUni, 0, 1, c);
+ uman.set4fv(fFilterColorUni, 1, c);
}
}
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index d8eb1f17c5..5b36a8f7e5 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -441,8 +441,8 @@ public:
GrGLfloat vec[] = {
m[4] * kScale, m[9] * kScale, m[14] * kScale, m[19] * kScale,
};
- uniManager.setMatrix4fv(fMatrixHandle, 0, 1, mt);
- uniManager.set4fv(fVectorHandle, 0, 1, vec);
+ uniManager.setMatrix4fv(fMatrixHandle, 1, mt);
+ uniManager.set4fv(fVectorHandle, 1, vec);
}
private:
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index dd23532e71..db3a1a0924 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -36,7 +36,7 @@ const SkScalar gOneQuarter = SkFloatToScalar(0.25f);
#if SK_SUPPORT_GPU
void setUniformPoint3(const GrGLUniformManager& uman, UniformHandle uni, const SkPoint3& point) {
GR_STATIC_ASSERT(sizeof(SkPoint3) == 3 * sizeof(GrGLfloat));
- uman.set3fv(uni, 0, 1, &point.fX);
+ uman.set3fv(uni, 1, &point.fX);
}
void setUniformNormal3(const GrGLUniformManager& uman, UniformHandle uni, const SkPoint3& point) {
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 4864aec65a..6f213d7118 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -537,9 +537,9 @@ void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman,
float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = ySign / texture.height();
- uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
- uman.set2fv(fTargetUni, 0, 1, conv.target());
- uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.kernel());
+ uman.set2fv(fImageIncrementUni, 1, imageIncrement);
+ uman.set2fv(fTargetUni, 1, conv.target());
+ uman.set1fv(fKernelUni, fKernelSize.width() * fKernelSize.height(), conv.kernel());
uman.set1f(fGainUni, conv.gain());
uman.set1f(fBiasUni, conv.bias());
const SkIRect& bounds = conv.bounds();
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 9665dcb162..c9855c9086 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -434,7 +434,7 @@ void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman,
default:
GrCrash("Unknown filter direction.");
}
- uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
+ uman.set2fv(fImageIncrementUni, 1, imageIncrement);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 94eb72f5a0..2a822e4829 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -655,7 +655,7 @@ void GrGLConical2Gradient::setData(const GrGLUniformManager& uman,
SkScalarToFloat(diffRadius)
};
- uman.set1fv(fParamUni, 0, 6, values);
+ uman.set1fv(fParamUni, 6, values);
fCachedCenter = centerX1;
fCachedRadius = radius0;
fCachedDiffRadius = diffRadius;
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 923ed1e6ba..207f3db653 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -638,7 +638,7 @@ void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman,
data.isPosRoot() ? 1.f : -1.f
};
- uman.set1fv(fParamUni, 0, 6, values);
+ uman.set1fv(fParamUni, 6, values);
fCachedCenter = centerX1;
fCachedRadius = radius0;
fCachedPosRoot = data.isPosRoot();
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 568311b3ca..f6cc37dc11 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -95,7 +95,7 @@ void GrGLBicubicEffect::setData(const GrGLUniformManager& uman,
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = 1.0f / texture.height();
- uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
+ uman.set2fv(fImageIncrementUni, 1, imageIncrement);
uman.setMatrix4f(fCoefficientsUni, effect.coefficients());
}
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 4d16361fe5..57cdece9d8 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -120,7 +120,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman,
default:
GrCrash("Unknown filter direction.");
}
- uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
+ uman.set2fv(fImageIncrementUni, 1, imageIncrement);
if (conv.useBounds()) {
const float* bounds = conv.bounds();
if (Gr1DKernelEffect::kY_Direction == conv.direction() &&
@@ -130,7 +130,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman,
uman.set2f(fBoundsUni, bounds[0], bounds[1]);
}
}
- uman.set1fv(fKernelUni, 0, this->width(), conv.kernel());
+ uman.set1fv(fKernelUni, this->width(), conv.kernel());
}
GrGLEffect::EffectKey GrGLConvolutionEffect::GenKey(const GrDrawEffect& drawEffect,
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index eca99d73a8..699aa729fd 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -113,7 +113,7 @@ void GrGLTextureDomainEffect::setData(const GrGLUniformManager& uman,
SkTSwap(values[1], values[3]);
}
if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) {
- uman.set4fv(fNameUni, 0, 1, values);
+ uman.set4fv(fNameUni, 1, values);
memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat));
}
}
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index f80bc2e550..accaf884d1 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -272,7 +272,7 @@ void GrGLProgram::setColor(const GrDrawState& drawState,
// OpenGL ES doesn't support unsigned byte varieties of glUniform
GrGLfloat c[4];
GrColorToRGBAFloat(color, c);
- fUniformManager.set4fv(fUniformHandles.fColorUni, 0, 1, c);
+ fUniformManager.set4fv(fUniformHandles.fColorUni, 1, c);
fColor = color;
}
sharedState->fConstAttribColorIndex = -1;
@@ -311,7 +311,7 @@ void GrGLProgram::setCoverage(const GrDrawState& drawState,
// OpenGL ES doesn't support unsigned byte varieties of glUniform
GrGLfloat c[4];
GrColorToRGBAFloat(coverage, c);
- fUniformManager.set4fv(fUniformHandles.fCoverageUni, 0, 1, c);
+ fUniformManager.set4fv(fUniformHandles.fCoverageUni, 1, c);
fCoverage = coverage;
}
sharedState->fConstAttribCoverageIndex = -1;
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 348ee2622f..961cad798f 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -588,6 +588,9 @@ bool GrGLShaderBuilder::finish(GrGLuint* outProgramId) {
}
this->bindProgramLocations(programId);
+ if (fUniformManager.isUsingBindUniform()) {
+ fUniformManager.getUniformLocations(programId, fUniforms);
+ }
GL_CALL(LinkProgram(programId));
@@ -619,7 +622,9 @@ bool GrGLShaderBuilder::finish(GrGLuint* outProgramId) {
}
}
- fUniformManager.getUniformLocations(programId, fUniforms);
+ if (!fUniformManager.isUsingBindUniform()) {
+ fUniformManager.getUniformLocations(programId, fUniforms);
+ }
*outProgramId = programId;
return true;
}
diff --git a/src/gpu/gl/GrGLUniformManager.cpp b/src/gpu/gl/GrGLUniformManager.cpp
index 74bb651fa4..2d0b48a2be 100644
--- a/src/gpu/gl/GrGLUniformManager.cpp
+++ b/src/gpu/gl/GrGLUniformManager.cpp
@@ -11,9 +11,13 @@
#include "gl/GrGpuGL.h"
#include "SkMatrix.h"
-#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, OFFSET, COUNT) \
- SkASSERT(offset + arrayCount <= uni.fArrayCount || \
- (0 == offset && 1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount))
+#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \
+ SkASSERT(arrayCount <= uni.fArrayCount || \
+ (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount))
+
+GrGLUniformManager::GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) {
+ fUsingBindUniform = fGpu->glInterface()->fBindUniformLocation != NULL;
+}
GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType type, int arrayCount) {
int idx = fUniforms.count();
@@ -56,22 +60,21 @@ void GrGLUniformManager::set1f(UniformHandle u, GrGLfloat v0) const {
}
void GrGLUniformManager::set1fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kFloat_GrSLType);
SkASSERT(arrayCount > 0);
- ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
// This assert fires in some instances of the two-pt gradient for its VSParams.
// Once the uniform manager is responsible for inserting the duplicate uniform
// arrays in VS and FS driver bug workaround, this can be enabled.
//SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
}
}
@@ -89,19 +92,18 @@ void GrGLUniformManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) cons
}
void GrGLUniformManager::set2fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kVec2f_GrSLType);
SkASSERT(arrayCount > 0);
- ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
}
}
@@ -119,19 +121,18 @@ void GrGLUniformManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGL
}
void GrGLUniformManager::set3fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kVec3f_GrSLType);
SkASSERT(arrayCount > 0);
- ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
}
}
@@ -153,18 +154,18 @@ void GrGLUniformManager::set4f(UniformHandle u,
}
void GrGLUniformManager::set4fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kVec4f_GrSLType);
SkASSERT(arrayCount > 0);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
- GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation + offset, arrayCount, v));
+ GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
}
}
@@ -196,40 +197,38 @@ void GrGLUniformManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix[])
}
void GrGLUniformManager::setMatrix3fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat matrices[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kMat33f_GrSLType);
SkASSERT(arrayCount > 0);
- ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
- UniformMatrix3fv(uni.fFSLocation + offset, arrayCount, false, matrices));
+ UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
- UniformMatrix3fv(uni.fVSLocation + offset, arrayCount, false, matrices));
+ UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices));
}
}
void GrGLUniformManager::setMatrix4fv(UniformHandle u,
- int offset,
int arrayCount,
const GrGLfloat matrices[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
SkASSERT(uni.fType == kMat44f_GrSLType);
SkASSERT(arrayCount > 0);
- ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
+ ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
- UniformMatrix4fv(uni.fFSLocation + offset, arrayCount, false, matrices));
+ UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices));
}
if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
- UniformMatrix4fv(uni.fVSLocation + offset, arrayCount, false, matrices));
+ UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices));
}
}
@@ -258,8 +257,14 @@ void GrGLUniformManager::getUniformLocations(GrGLuint programID, const BuilderUn
SkASSERT(uniforms[i].fVariable.getArrayCount() == fUniforms[i].fArrayCount);
GrGLint location;
// TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
- GR_GL_CALL_RET(fGpu->glInterface(), location,
+ if (fUsingBindUniform) {
+ location = i;
+ GR_GL_CALL(fGpu->glInterface(),
+ BindUniformLocation(programID, location, uniforms[i].fVariable.c_str()));
+ } else {
+ GR_GL_CALL_RET(fGpu->glInterface(), location,
GetUniformLocation(programID, uniforms[i].fVariable.c_str()));
+ }
if (GrGLShaderBuilder::kVertex_Visibility & uniforms[i].fVisibility) {
fUniforms[i].fVSLocation = location;
}
diff --git a/src/gpu/gl/GrGLUniformManager.h b/src/gpu/gl/GrGLUniformManager.h
index eefab04986..d7438f9ed7 100644
--- a/src/gpu/gl/GrGLUniformManager.h
+++ b/src/gpu/gl/GrGLUniformManager.h
@@ -46,28 +46,28 @@ public:
friend class GrGLUniformManager; // For accessing toUniformIndex().
};
- GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) {}
+ GrGLUniformManager(GrGpuGL* gpu);
UniformHandle appendUniform(GrSLType type, int arrayCount = GrGLShaderVar::kNonArray);
/** Functions for uploading uniform values. The varities ending in v can be used to upload to an
- * array of uniforms. offset + arrayCount must be <= the array count of the uniform.
+ * array of uniforms. arrayCount must be <= the array count of the uniform.
*/
void setSampler(UniformHandle, GrGLint texUnit) const;
void set1f(UniformHandle, GrGLfloat v0) const;
- void set1fv(UniformHandle, int offset, int arrayCount, const GrGLfloat v[]) const;
+ void set1fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
void set2f(UniformHandle, GrGLfloat, GrGLfloat) const;
- void set2fv(UniformHandle, int offset, int arrayCount, const GrGLfloat v[]) const;
+ void set2fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
void set3f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat) const;
- void set3fv(UniformHandle, int offset, int arrayCount, const GrGLfloat v[]) const;
+ void set3fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
void set4f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat, GrGLfloat) const;
- void set4fv(UniformHandle, int offset, int arrayCount, const GrGLfloat v[]) const;
+ void set4fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
// matrices are column-major, the first three upload a single matrix, the latter three upload
// arrayCount matrices into a uniform array.
void setMatrix3f(UniformHandle, const GrGLfloat matrix[]) const;
void setMatrix4f(UniformHandle, const GrGLfloat matrix[]) const;
- void setMatrix3fv(UniformHandle, int offset, int arrayCount, const GrGLfloat matrices[]) const;
- void setMatrix4fv(UniformHandle, int offset, int arrayCount, const GrGLfloat matrices[]) const;
+ void setMatrix3fv(UniformHandle, int arrayCount, const GrGLfloat matrices[]) const;
+ void setMatrix4fv(UniformHandle, int arrayCount, const GrGLfloat matrices[]) const;
// convenience method for uploading a SkMatrix to a 3x3 matrix uniform
void setSkMatrix(UniformHandle, const SkMatrix&) const;
@@ -82,6 +82,13 @@ public:
typedef GrTAllocator<BuilderUniform> BuilderUniformArray;
/**
+ * Called by the GrGLShaderBuilder to know if the manager is using
+ * BindUniformLocation. In that case getUniformLocations must be called
+ * before the program is linked.
+ */
+ bool isUsingBindUniform() const { return fUsingBindUniform; }
+
+ /**
* Called by the GrGLShaderBuilder to get GL locations for all uniforms.
*/
void getUniformLocations(GrGLuint programID, const BuilderUniformArray& uniforms);
@@ -103,6 +110,7 @@ private:
int fArrayCount;
};
+ bool fUsingBindUniform;
SkTArray<Uniform, true> fUniforms;
GrGpuGL* fGpu;
};