diff options
author | David 'Digit' Turner <digit@google.com> | 2014-11-27 18:05:34 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-11-27 18:05:34 +0100 |
commit | 585a4b03bcd88700b82d83e27fcb2b955cb93398 (patch) | |
tree | c0753a058a7c567a0f48d3daa40c1efee1697dbd /opengl | |
parent | c2f8474518a220b3c1b86b6d4f9fa28ed9bb734a (diff) | |
download | android_device_generic_goldfish-585a4b03bcd88700b82d83e27fcb2b955cb93398.tar.gz android_device_generic_goldfish-585a4b03bcd88700b82d83e27fcb2b955cb93398.tar.bz2 android_device_generic_goldfish-585a4b03bcd88700b82d83e27fcb2b955cb93398.zip |
opengl: Fix pixelDataSize() ambiguity.
The GLESv1 encoder library was calling the pixelDataSize() function
definition from the GLESv2 encoder library, resulting in bugs, like
the inability to see the boot animation when -gpu on is used.
This fixes the issue by using namespaces to differentiate the
two implementations. Note that the auto-generated files have been
updated by re-running update-emugl-sources.sh as specified by
opengl/README after applying the following patches:
https://android-review.googlesource.com/#/c/116642/
https://android-review.googlesource.com/#/c/116643/
https://android-review.googlesource.com/#/c/116644/
Change-Id: Idbd84fb6ca5934cbb9af009b09f9a38cc4a1340a
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/system/GLESv1_enc/GLEncoderUtils.cpp | 4 | ||||
-rw-r--r-- | opengl/system/GLESv1_enc/GLEncoderUtils.h | 3 | ||||
-rw-r--r-- | opengl/system/GLESv1_enc/gl_enc.cpp | 24 | ||||
-rw-r--r-- | opengl/system/GLESv1_enc/gl_entry.cpp | 2 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/GL2EncoderUtils.cpp | 4 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/GL2EncoderUtils.h | 13 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/gl2_client_proc.h | 2 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/gl2_enc.cpp | 26 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/gl2_entry.cpp | 4 |
9 files changed, 47 insertions, 35 deletions
diff --git a/opengl/system/GLESv1_enc/GLEncoderUtils.cpp b/opengl/system/GLESv1_enc/GLEncoderUtils.cpp index 7866d53..4924392 100644 --- a/opengl/system/GLESv1_enc/GLEncoderUtils.cpp +++ b/opengl/system/GLESv1_enc/GLEncoderUtils.cpp @@ -17,8 +17,12 @@ #include <stdlib.h> #include "GLEncoder.h" +namespace glesv1_enc { + size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) { GLEncoder *ctx = (GLEncoder *)self; return ctx->pixelDataSize(width, height, format, type, pack); } + +} // namespace glesv1_enc diff --git a/opengl/system/GLESv1_enc/GLEncoderUtils.h b/opengl/system/GLESv1_enc/GLEncoderUtils.h index 1d0c847..05cc9e1 100644 --- a/opengl/system/GLESv1_enc/GLEncoderUtils.h +++ b/opengl/system/GLESv1_enc/GLEncoderUtils.h @@ -16,7 +16,8 @@ #ifndef GL_ENCODER_UTILS_H #define GL_ENCLODER_UTILS_H -extern "C" { +namespace glesv1_enc { size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); }; + #endif diff --git a/opengl/system/GLESv1_enc/gl_enc.cpp b/opengl/system/GLESv1_enc/gl_enc.cpp index 16d8cac..61c0cee 100644 --- a/opengl/system/GLESv1_enc/gl_enc.cpp +++ b/opengl/system/GLESv1_enc/gl_enc.cpp @@ -1209,7 +1209,7 @@ void glFinish_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1223,7 +1223,7 @@ void glFlush_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1397,7 +1397,7 @@ GLenum glGetError_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1723,7 +1723,7 @@ void glLoadIdentity_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glLoadIdentity;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1974,7 +1974,7 @@ void glPopMatrix_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glPopMatrix;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1988,7 +1988,7 @@ void glPushMatrix_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glPushMatrix;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -2001,7 +2001,7 @@ void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei heig gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 1); + const unsigned int __size_pixels = glesv1_enc::pixelDataSize(self, width, height, format, type, 1); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(packetSize); @@ -2245,7 +2245,7 @@ void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalfor gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize(self, width, height, format, type, 0) : 0); + const unsigned int __size_pixels = ((pixels != NULL) ? glesv1_enc::pixelDataSize(self, width, height, format, type, 0) : 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -2343,7 +2343,7 @@ void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 0); + const unsigned int __size_pixels = glesv1_enc::pixelDataSize(self, width, height, format, type, 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -2732,7 +2732,7 @@ int glFinishRoundTrip_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -3998,7 +3998,7 @@ void glLoadPaletteFromModelViewMatrixOES_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glLoadPaletteFromModelViewMatrixOES;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -4772,7 +4772,7 @@ void glExtGetTexSubImageQCOM_enc(void *self , GLenum target, GLint level, GLint gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_texels = (depth * pixelDataSize(self, width, height, format, type, 0)); + const unsigned int __size_texels = (depth * glesv1_enc::pixelDataSize(self, width, height, format, type, 0)); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_texels + 1*4; ptr = stream->alloc(packetSize); diff --git a/opengl/system/GLESv1_enc/gl_entry.cpp b/opengl/system/GLESv1_enc/gl_entry.cpp index e503dd6..2b7fa9f 100644 --- a/opengl/system/GLESv1_enc/gl_entry.cpp +++ b/opengl/system/GLESv1_enc/gl_entry.cpp @@ -267,7 +267,7 @@ extern "C" { GLboolean glIsVertexArrayOES(GLuint array); void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments); void glMultiDrawArraysEXT(GLenum mode, const GLint* first, const GLsizei* count, GLsizei primcount); - void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid*const* indices, GLsizei primcount); + void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid* const* indices, GLsizei primcount); void glMultiDrawArraysSUN(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount); void glMultiDrawElementsSUN(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount); void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); diff --git a/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp b/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp index 57d65c0..fc2a723 100644 --- a/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp +++ b/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp @@ -18,6 +18,8 @@ #include "GL2Encoder.h" #include <assert.h> +namespace glesv2_enc { + size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) { GL2Encoder *ctx = (GL2Encoder *)self; @@ -37,3 +39,5 @@ GLenum uniformType(void * self, GLuint program, GLint location) assert (ctx->shared() != NULL); return ctx->shared()->getProgramUniformType(program, location); } + +} // namespace glesv2_enc diff --git a/opengl/system/GLESv2_enc/GL2EncoderUtils.h b/opengl/system/GLESv2_enc/GL2EncoderUtils.h index 8e91aeb..4afec10 100644 --- a/opengl/system/GLESv2_enc/GL2EncoderUtils.h +++ b/opengl/system/GLESv2_enc/GL2EncoderUtils.h @@ -16,9 +16,12 @@ #ifndef GL2_ENCODER_UTILS_H #define GL2_ENCLODER_UTILS_H -extern "C" { - size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); - size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack); - GLenum uniformType(void * self, GLuint program, GLint location); -}; +namespace glesv2_enc { + +size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); +size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack); +GLenum uniformType(void * self, GLuint program, GLint location); + +} // namespace glesv2_enc + #endif diff --git a/opengl/system/GLESv2_enc/gl2_client_proc.h b/opengl/system/GLESv2_enc/gl2_client_proc.h index 06270b7..445910d 100644 --- a/opengl/system/GLESv2_enc/gl2_client_proc.h +++ b/opengl/system/GLESv2_enc/gl2_client_proc.h @@ -107,7 +107,7 @@ typedef void (gl2_APIENTRY *glRenderbufferStorage_client_proc_t) (void * ctx, GL typedef void (gl2_APIENTRY *glSampleCoverage_client_proc_t) (void * ctx, GLclampf, GLboolean); typedef void (gl2_APIENTRY *glScissor_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei); typedef void (gl2_APIENTRY *glShaderBinary_client_proc_t) (void * ctx, GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei); -typedef void (gl2_APIENTRY *glShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, const GLchar*const*, const GLint*); +typedef void (gl2_APIENTRY *glShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, const GLchar* const*, const GLint*); typedef void (gl2_APIENTRY *glStencilFunc_client_proc_t) (void * ctx, GLenum, GLint, GLuint); typedef void (gl2_APIENTRY *glStencilFuncSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLint, GLuint); typedef void (gl2_APIENTRY *glStencilMask_client_proc_t) (void * ctx, GLuint); diff --git a/opengl/system/GLESv2_enc/gl2_enc.cpp b/opengl/system/GLESv2_enc/gl2_enc.cpp index 9c5da32..1c4f73c 100644 --- a/opengl/system/GLESv2_enc/gl2_enc.cpp +++ b/opengl/system/GLESv2_enc/gl2_enc.cpp @@ -474,7 +474,7 @@ GLuint glCreateProgram_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -767,7 +767,7 @@ void glFinish_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -781,7 +781,7 @@ void glFlush_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1073,7 +1073,7 @@ GLenum glGetError_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1329,7 +1329,7 @@ void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* pa gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_params = glSizeof(uniformType(self, program, location)); + const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4; ptr = stream->alloc(packetSize); @@ -1348,7 +1348,7 @@ void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* para gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_params = glSizeof(uniformType(self, program, location)); + const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4; ptr = stream->alloc(packetSize); @@ -1638,7 +1638,7 @@ void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei heig gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 1); + const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(packetSize); @@ -1662,7 +1662,7 @@ void glReleaseShaderCompiler_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; @@ -1828,7 +1828,7 @@ void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalfor gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize(self, width, height, format, type, 0) : 0); + const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -1926,7 +1926,7 @@ void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize(self, width, height, format, type, 0) : 0); + const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -2545,7 +2545,7 @@ void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum interna gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); + const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -2572,7 +2572,7 @@ void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffs gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; IOStream *stream = ctx->m_stream; - const unsigned int __size_pixels = pixelDataSize3D(self, width, height, depth, format, type, 0); + const unsigned int __size_pixels = glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); @@ -2906,7 +2906,7 @@ int glFinishRoundTrip_enc(void *self ) IOStream *stream = ctx->m_stream; unsigned char *ptr; - const size_t packetSize = 8 + 0; + const size_t packetSize = 8; ptr = stream->alloc(packetSize); int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; diff --git a/opengl/system/GLESv2_enc/gl2_entry.cpp b/opengl/system/GLESv2_enc/gl2_entry.cpp index 9eb8df3..3812aae 100644 --- a/opengl/system/GLESv2_enc/gl2_entry.cpp +++ b/opengl/system/GLESv2_enc/gl2_entry.cpp @@ -104,7 +104,7 @@ extern "C" { void glSampleCoverage(GLclampf value, GLboolean invert); void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); - void glShaderSource(GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length); + void glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); void glStencilFunc(GLenum func, GLint ref, GLuint mask); void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); void glStencilMask(GLuint mask); @@ -819,7 +819,7 @@ void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const ctx->glShaderBinary(ctx, n, shaders, binaryformat, binary, length); } -void glShaderSource(GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length) +void glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length) { GET_CONTEXT; ctx->glShaderSource(ctx, shader, count, string, length); |