summaryrefslogtreecommitdiffstats
path: root/opengl/system/GLESv2_enc
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/system/GLESv2_enc')
-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
3 files changed, 23 insertions, 9 deletions
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);
}