summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl')
-rw-r--r--opengl/common.mk1
-rwxr-xr-x[-rw-r--r--]opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp6
-rwxr-xr-x[-rw-r--r--]opengl/shared/OpenglCodecCommon/GLSharedGroup.h1
-rwxr-xr-x[-rw-r--r--]opengl/system/GLESv2_enc/GL2Encoder.cpp14
-rw-r--r--opengl/system/GLESv2_enc/GL2Encoder.h2
-rw-r--r--opengl/system/GLESv2_enc/gl2_enc.cpp16
-rw-r--r--opengl/system/egl/egl.cpp6
-rw-r--r--opengl/system/egl/eglContext.h1
8 files changed, 37 insertions, 10 deletions
diff --git a/opengl/common.mk b/opengl/common.mk
index a4ea7d7..a1e5522 100644
--- a/opengl/common.mk
+++ b/opengl/common.mk
@@ -35,7 +35,6 @@ emugl-begin-module = \
$(eval LOCAL_IS_HOST_MODULE := $(if $3,true,))\
$(eval LOCAL_C_INCLUDES := $(EMUGL_COMMON_INCLUDES)) \
$(eval LOCAL_CFLAGS := $(EMUGL_COMMON_CFLAGS)) \
- $(eval LOCAL_PRELINK_MODULE := false)\
$(eval _EMUGL_INCLUDE_TYPE := $(BUILD_$2)) \
$(call _emugl-init-module,$1,$2,$3)
diff --git a/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp b/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
index c7da37a..b079b6d 100644..100755
--- a/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ b/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
@@ -240,6 +240,12 @@ GLSharedGroup::~GLSharedGroup()
clearObjectMap(m_shaders);
}
+bool GLSharedGroup::isObject(GLuint obj)
+{
+ android::AutoMutex _lock(m_lock);
+ return ((m_shaders.valueFor(obj)!=NULL) || (m_programs.valueFor(obj)!=NULL));
+}
+
BufferData * GLSharedGroup::getBufferData(GLuint bufferId)
{
android::AutoMutex _lock(m_lock);
diff --git a/opengl/shared/OpenglCodecCommon/GLSharedGroup.h b/opengl/shared/OpenglCodecCommon/GLSharedGroup.h
index 61b8f00..6dfcd8f 100644..100755
--- a/opengl/shared/OpenglCodecCommon/GLSharedGroup.h
+++ b/opengl/shared/OpenglCodecCommon/GLSharedGroup.h
@@ -110,6 +110,7 @@ private:
public:
GLSharedGroup();
~GLSharedGroup();
+ bool isObject(GLuint obj);
BufferData * getBufferData(GLuint bufferId);
void addBufferData(GLuint bufferId, GLsizeiptr size, void * data);
void updateBufferData(GLuint bufferId, GLsizeiptr size, void * data);
diff --git a/opengl/system/GLESv2_enc/GL2Encoder.cpp b/opengl/system/GLESv2_enc/GL2Encoder.cpp
index 80a2cda..dca504d 100644..100755
--- a/opengl/system/GLESv2_enc/GL2Encoder.cpp
+++ b/opengl/system/GLESv2_enc/GL2Encoder.cpp
@@ -71,6 +71,7 @@ GL2Encoder::GL2Encoder(IOStream *stream) : gl2_encoder_context_t(stream)
OVERRIDE(glGetVertexAttribfv);
OVERRIDE(glGetVertexAttribPointerv);
+ this->glShaderBinary = &s_glShaderBinary;
this->glShaderSource = &s_glShaderSource;
this->glFinish = &s_glFinish;
@@ -652,11 +653,20 @@ static bool replaceSamplerExternalWith2D(char* const str, ShaderData* const data
return true;
}
+void GL2Encoder::s_glShaderBinary(void *self, GLsizei n, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length)
+{
+ GL2Encoder* ctx = (GL2Encoder*)self;
+ // Although it is not supported, need to set proper error code.
+ SET_ERROR_IF(1, GL_INVALID_ENUM);
+}
+
void GL2Encoder::s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length)
{
GL2Encoder* ctx = (GL2Encoder*)self;
ShaderData* shaderData = ctx->m_shared->getShaderData(shader);
- SET_ERROR_IF(!shaderData, GL_INVALID_VALUE);
+ SET_ERROR_IF(!ctx->m_shared->isObject(shader), GL_INVALID_VALUE);
+ SET_ERROR_IF(!shaderData, GL_INVALID_OPERATION);
+ SET_ERROR_IF((count<0), GL_INVALID_VALUE);
int len = glUtilsCalcShaderSourceLen((char**)string, (GLint*)length, count);
char *str = new char[len + 1];
@@ -755,6 +765,8 @@ GLuint GL2Encoder::s_glCreateProgram(void * self)
GLuint GL2Encoder::s_glCreateShader(void *self, GLenum shaderType)
{
GL2Encoder *ctx = (GL2Encoder*)self;
+ RET_AND_SET_ERROR_IF(((shaderType != GL_VERTEX_SHADER) && (shaderType != GL_FRAGMENT_SHADER)),
+ GL_INVALID_ENUM, 0);
GLuint shader = ctx->m_glCreateShader_enc(self, shaderType);
if (shader != 0) {
if (!ctx->m_shared->addShaderData(shader)) {
diff --git a/opengl/system/GLESv2_enc/GL2Encoder.h b/opengl/system/GLESv2_enc/GL2Encoder.h
index 5f255d1..21e7932 100644
--- a/opengl/system/GLESv2_enc/GL2Encoder.h
+++ b/opengl/system/GLESv2_enc/GL2Encoder.h
@@ -117,6 +117,8 @@ private:
glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv_enc;
static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer);
+ static void s_glShaderBinary(void *self, GLsizei n, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length);
+
static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length);
static void s_glFinish(void *self);
diff --git a/opengl/system/GLESv2_enc/gl2_enc.cpp b/opengl/system/GLESv2_enc/gl2_enc.cpp
index 1c4f73c..089a9ae 100644
--- a/opengl/system/GLESv2_enc/gl2_enc.cpp
+++ b/opengl/system/GLESv2_enc/gl2_enc.cpp
@@ -934,8 +934,8 @@ void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bu
IOStream *stream = ctx->m_stream;
const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_size = (sizeof(GLint));
- const unsigned int __size_type = (sizeof(GLenum));
+ const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
+ const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
unsigned char *ptr;
const size_t packetSize = 8 + 4 + 4 + 4 + __size_length + __size_size + __size_type + __size_name + 4*4;
@@ -951,8 +951,8 @@ void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bu
*(unsigned int *)(ptr) = __size_type; ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
if (length != NULL) stream->readback(length, __size_length);
- stream->readback(size, __size_size);
- stream->readback(type, __size_type);
+ if (size != NULL) stream->readback(size, __size_size);
+ if (type != NULL) stream->readback(type, __size_type);
if (name != NULL) stream->readback(name, __size_name);
}
@@ -963,8 +963,8 @@ void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei b
IOStream *stream = ctx->m_stream;
const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_size = (sizeof(GLint));
- const unsigned int __size_type = (sizeof(GLenum));
+ const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
+ const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
unsigned char *ptr;
const size_t packetSize = 8 + 4 + 4 + 4 + __size_length + __size_size + __size_type + __size_name + 4*4;
@@ -980,8 +980,8 @@ void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei b
*(unsigned int *)(ptr) = __size_type; ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
if (length != NULL) stream->readback(length, __size_length);
- stream->readback(size, __size_size);
- stream->readback(type, __size_type);
+ if (size != NULL) stream->readback(size, __size_size);
+ if (type != NULL) stream->readback(type, __size_type);
if (name != NULL) stream->readback(name, __size_name);
}
diff --git a/opengl/system/egl/egl.cpp b/opengl/system/egl/egl.cpp
index 8499229..86897d4 100644
--- a/opengl/system/egl/egl.cpp
+++ b/opengl/system/egl/egl.cpp
@@ -140,6 +140,7 @@ EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* share
versionString(NULL),
vendorString(NULL),
rendererString(NULL),
+ shaderVersionString(NULL),
extensionString(NULL),
deletePending(0)
{
@@ -158,6 +159,7 @@ EGLContext_t::~EGLContext_t()
delete [] versionString;
delete [] vendorString;
delete [] rendererString;
+ delete [] shaderVersionString;
delete [] extensionString;
}
@@ -416,6 +418,7 @@ static const char *getGLString(int glEnum)
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_EXTENSIONS 0x1F03
switch(glEnum) {
@@ -428,6 +431,9 @@ static const char *getGLString(int glEnum)
case GL_RENDERER:
strPtr = &tInfo->currentContext->rendererString;
break;
+ case GL_SHADING_LANGUAGE_VERSION:
+ strPtr = &tInfo->currentContext->shaderVersionString;
+ break;
case GL_EXTENSIONS:
strPtr = &tInfo->currentContext->extensionString;
break;
diff --git a/opengl/system/egl/eglContext.h b/opengl/system/egl/eglContext.h
index 16a2780..5b6a428 100644
--- a/opengl/system/egl/eglContext.h
+++ b/opengl/system/egl/eglContext.h
@@ -39,6 +39,7 @@ struct EGLContext_t {
const char* versionString;
const char* vendorString;
const char* rendererString;
+ const char* shaderVersionString;
const char* extensionString;
EGLint deletePending;
GLClientState * getClientState(){ return clientState; }