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
This commit is contained in:
bsalomon@google.com 2012-06-01 19:25:00 +00:00
Родитель 890e3b58e7
Коммит 60da417642
4 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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