diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-01 19:25:00 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-01 19:25:00 +0000 |
commit | 60da4176425c74cf112d7e116f54a530a82d0d68 (patch) | |
tree | 5b5bd322375a36fc603871db39e54f9ab2392c5c /src | |
parent | 890e3b58e78c0825820f75f1f0c5a5d71e855aa6 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 3 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.h | 3 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index e3dcd57f30..b23a1f8153 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -22,6 +22,7 @@ void GrGLCaps::reset() { fMaxSampleCount = 0; fCoverageAAType = kNone_CoverageAAType; fMaxFragmentUniformVectors = 0; + fMaxVertexAttributes = 0; fRGBA8RenderbufferSupport = false; fBGRAFormatSupport = false; fBGRAIsInternalFormat = false; @@ -44,6 +45,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { 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 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) { 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 d159d98963..70f17bd9ec 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -171,6 +171,9 @@ public: /// 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 @@ private: 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 ec535b8a14..7b44035f24 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -280,11 +280,6 @@ void GrGpuGL::initCaps() { 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 @@ void GrGpuGL::onResetContext() { 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 211dea80dc..fd6ba8ffbd 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -330,9 +330,6 @@ private: 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; |