summaryrefslogtreecommitdiffstats
path: root/opengl/system/GLESv2_enc/GL2Encoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/system/GLESv2_enc/GL2Encoder.cpp')
-rwxr-xr-x[-rw-r--r--]opengl/system/GLESv2_enc/GL2Encoder.cpp14
1 files changed, 13 insertions, 1 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)) {