summaryrefslogtreecommitdiff
path: root/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
diff options
context:
space:
mode:
authorLiran <liran@graphtech.co.il>2011-04-07 17:01:47 +0300
committerLiran <liran@graphtech.co.il>2011-04-28 09:24:46 +0300
commitfb06a28c30ddea2481cb258171b95c043775c57f (patch)
treec980b3d1311b43af3ccdd9d1c7826717f9984440 /tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
parent9e9b85c3f610ebd9165644a96ccfbdd704ab3bc6 (diff)
GLESv1 extensions
This fix adds support for OpenGLES 1.1 extensions in the codec layer. This fix also includes bug fixes in GLEncoder (client-state) and gles android wrapper modules. Change-Id: I512649724d43e4af9d3ce5d49ae66d9f4da0b823
Diffstat (limited to 'tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h')
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h203
1 files changed, 202 insertions, 1 deletions
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
index be625d555..b68007888 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
@@ -42,7 +42,9 @@ public:
TEXCOORD5_LOCATION = 9,
TEXCOORD6_LOCATION = 10,
TEXCOORD7_LOCATION = 11,
- LAST_LOCATION = 12
+ MATRIXINDEX_LOCATION = 12,
+ WEIGHT_LOCATION = 13,
+ LAST_LOCATION = 14
} StateLocation;
typedef struct {
@@ -92,6 +94,21 @@ public:
}
return err;
}
+ int getBuffer(GLenum target)
+ {
+ int ret=0;
+ switch (target) {
+ case GL_ARRAY_BUFFER:
+ ret = m_currentArrayVbo;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ ret = m_currentIndexVbo;
+ break;
+ default:
+ ret = -1;
+ }
+ return ret;
+ }
size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
private:
@@ -104,6 +121,190 @@ private:
bool validLocation(int location) { return (location >= 0 && location < m_nLocations); }
+public:
+ void getClientStatePointer(GLenum pname, GLvoid** params);
+ template <class T>
+ bool getClientStateParameter(GLenum param, T* ptr)
+ {
+ bool isClientStateParam = false;
+ switch (param) {
+ case GL_CLIENT_ACTIVE_TEXTURE: {
+ GLint tex = getActiveTexture() + GL_TEXTURE0;
+ *ptr = tex;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_VERTEX_ARRAY_SIZE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+ *ptr = state->size;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_VERTEX_ARRAY_TYPE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_VERTEX_ARRAY_STRIDE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_COLOR_ARRAY_SIZE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+ *ptr = state->size;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_COLOR_ARRAY_TYPE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_COLOR_ARRAY_STRIDE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_NORMAL_ARRAY_TYPE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_NORMAL_ARRAY_STRIDE: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_TEXTURE_COORD_ARRAY_SIZE: {
+ const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+ *ptr = state->size;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_TEXTURE_COORD_ARRAY_TYPE: {
+ const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_TEXTURE_COORD_ARRAY_STRIDE: {
+ const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_POINT_SIZE_ARRAY_TYPE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_MATRIX_INDEX_ARRAY_SIZE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+ *ptr = state->size;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_MATRIX_INDEX_ARRAY_TYPE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_WEIGHT_ARRAY_SIZE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+ *ptr = state->size;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_WEIGHT_ARRAY_TYPE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+ *ptr = state->type;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_WEIGHT_ARRAY_STRIDE_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+ *ptr = state->stride;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_VERTEX_ARRAY_BUFFER_BINDING: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_NORMAL_ARRAY_BUFFER_BINDING: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_COLOR_ARRAY_BUFFER_BINDING: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: {
+ const GLClientState::VertexAttribState *state = getState(getActiveTexture()+GLClientState::TEXCOORD0_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: {
+ const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+ *ptr = state->bufferObject;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_ARRAY_BUFFER_BINDING: {
+ int buffer = getBuffer(GL_ARRAY_BUFFER);
+ *ptr = buffer;
+ isClientStateParam = true;
+ break;
+ }
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING: {
+ int buffer = getBuffer(GL_ELEMENT_ARRAY_BUFFER);
+ *ptr = buffer;
+ isClientStateParam = true;
+ break;
+ }
+ }
+ return isClientStateParam;
+ }
};
#endif