Move max vertex attributes value to GL Caps
Review URL: http://codereview.appspot.com/6271043/
git-svn-id: http://skia.googlecode.com/svn/trunk@4123 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index e3dcd57..b23a1f8 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -22,6 +22,7 @@
fMaxSampleCount = 0;
fCoverageAAType = kNone_CoverageAAType;
fMaxFragmentUniformVectors = 0;
+ fMaxVertexAttributes = 0;
fRGBA8RenderbufferSupport = false;
fBGRAFormatSupport = false;
fBGRAIsInternalFormat = false;
@@ -44,6 +45,7 @@
fStencilFormats = caps.fStencilFormats;
fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs;
fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
+ fMaxVertexAttributes = caps.fMaxVertexAttributes;
fMSFBOType = caps.fMSFBOType;
fMaxSampleCount = caps.fMaxSampleCount;
fCoverageAAType = caps.fCoverageAAType;
@@ -83,6 +85,7 @@
GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max);
fMaxFragmentUniformVectors = max / 4;
}
+ GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes);
if (kDesktop_GrGLBinding == binding) {
fRGBA8RenderbufferSupport = true;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index d159d98..70f17bd 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -171,6 +171,9 @@
/// The maximum number of fragment uniform vectors (GLES has min. 16).
int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; }
+ // maximum number of attribute values per vertex
+ int maxVertexAttributes() const { return fMaxVertexAttributes; }
+
/// ES requires an extension to support RGBA8 in RenderBufferStorage
bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; }
@@ -260,6 +263,8 @@
SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs;
int fMaxFragmentUniformVectors;
+ int fMaxVertexAttributes;
+
MSFBOType fMSFBOType;
int fMaxSampleCount;
CoverageAAType fCoverageAAType;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ec535b8..7b44035 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -280,11 +280,6 @@
fCaps.fShaderDerivativeSupport =
this->hasExtension("GL_OES_standard_derivatives");
}
-
- GR_GL_GetIntegerv(this->glInterface(),
- GR_GL_MAX_VERTEX_ATTRIBS,
- &fMaxVertexAttribs);
-
}
void GrGpuGL::fillInConfigRenderableTable() {
@@ -549,7 +544,7 @@
int posAttrIdx = GrGLProgram::PositionAttributeIdx();
GL_CALL(EnableVertexAttribArray(posAttrIdx));
// Disable all other vertex attributes.
- for (int va = 0; va < fMaxVertexAttribs; ++va) {
+ for (int va = 0; va < this->glCaps().maxVertexAttributes(); ++va) {
if (va != posAttrIdx) {
GL_CALL(DisableVertexAttribArray(va));
}
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 211dea8..fd6ba8f 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -330,9 +330,6 @@
GrColor fHWConstAttribColor;
GrColor fHWConstAttribCoverage;
GrGLProgram fCurrentProgram;
- // If we get rid of fixed function subclass this should move
- // to the GLCaps struct in parent class
- GrGLint fMaxVertexAttribs;
int fActiveTextureUnitIdx;