diff options
author | Lingfeng Yang <lfy@google.com> | 2016-03-01 21:27:49 -0800 |
---|---|---|
committer | Bo Hu <bohu@google.com> | 2016-03-02 06:25:46 +0000 |
commit | a31a0310154660e3105ab6a1955d3667efda3630 (patch) | |
tree | fce6e335da993aac4a60e9b8b37845c129147b36 | |
parent | 24db87f76308c1eb933dbb32f312fe53f945cbc9 (diff) | |
download | android_device_generic_goldfish-a31a0310154660e3105ab6a1955d3667efda3630.tar.gz android_device_generic_goldfish-a31a0310154660e3105ab6a1955d3667efda3630.tar.bz2 android_device_generic_goldfish-a31a0310154660e3105ab6a1955d3667efda3630.zip |
Cache glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, int*).
BUG:27418143
If we don't, the chatter over the pipe will
kill framerate.
I believe this is OK for the emulator,
as the parameter is dependent on only the
GPU hardware.
Change-Id: I9bd74de6317316902bddf54b915ef509625cee52
-rw-r--r-- | opengl/shared/OpenglCodecCommon/GLClientState.cpp | 2 | ||||
-rw-r--r-- | opengl/shared/OpenglCodecCommon/GLClientState.h | 15 | ||||
-rwxr-xr-x | opengl/system/GLESv2_enc/GL2Encoder.cpp | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/opengl/shared/OpenglCodecCommon/GLClientState.cpp index 57637ae..638eb4c 100644 --- a/opengl/shared/OpenglCodecCommon/GLClientState.cpp +++ b/opengl/shared/OpenglCodecCommon/GLClientState.cpp @@ -65,6 +65,8 @@ GLClientState::GLClientState(int nLocations) m_tex.textures = NULL; m_tex.numTextures = 0; m_tex.allocTextures = 0; + + m_maxVertexAttribsDirty = true; } GLClientState::~GLClientState() diff --git a/opengl/shared/OpenglCodecCommon/GLClientState.h b/opengl/shared/OpenglCodecCommon/GLClientState.h index 09ee571..8e95c37 100644 --- a/opengl/shared/OpenglCodecCommon/GLClientState.h +++ b/opengl/shared/OpenglCodecCommon/GLClientState.h @@ -90,6 +90,10 @@ public: int getLocation(GLenum loc); void setActiveTexture(int texUnit) {m_activeTexture = texUnit; }; int getActiveTexture() const { return m_activeTexture; } + void setMaxVertexAttribs(int val) { + m_maxVertexAttribs = val; + m_maxVertexAttribsDirty = false; + } void unBindBuffer(GLuint id) { @@ -184,6 +188,8 @@ public: private: PixelStoreState m_pixelStore; VertexAttribState *m_states; + int m_maxVertexAttribs; + bool m_maxVertexAttribsDirty; int m_nLocations; GLuint m_currentArrayVbo; GLuint m_currentIndexVbo; @@ -439,6 +445,15 @@ public: isClientStateParam = true; break; } + case GL_MAX_VERTEX_ATTRIBS: { + if (m_maxVertexAttribsDirty) { + isClientStateParam = false; + } else { + *ptr = m_maxVertexAttribs; + isClientStateParam = true; + } + break; + } } return isClientStateParam; } diff --git a/opengl/system/GLESv2_enc/GL2Encoder.cpp b/opengl/system/GLESv2_enc/GL2Encoder.cpp index c367385..9280839 100755 --- a/opengl/system/GLESv2_enc/GL2Encoder.cpp +++ b/opengl/system/GLESv2_enc/GL2Encoder.cpp @@ -309,6 +309,12 @@ void GL2Encoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr) ctx->m_max_textureSize = *ptr; } break; + case GL_MAX_VERTEX_ATTRIBS: + if (!ctx->m_state->getClientStateParameter<GLint>(param, ptr)) { + ctx->m_glGetIntegerv_enc(self, param, ptr); + ctx->m_state->setMaxVertexAttribs(*ptr); + } + break; default: if (!ctx->m_state->getClientStateParameter<GLint>(param, ptr)) { ctx->m_glGetIntegerv_enc(self, param, ptr); |