opengl emulator: Added gl error tracking on the guest (encoder)
Sometimes we need to check parameter values before encoding to prevent crashes, for example: glDeleteBufferes(-1, ptr); - would crash For that we need to check some gl errors on the guest. The change adds error state to the encoder and also adds new feature to emugen which allows to insert parameter check code into the attribute file. Added such parameter check code in the appropiate gl functions in gl.attrib and gl2.attrib Change-Id: I7f317df52ac8fbd96979100a1031cf023a0b49d3
This commit is contained in:
committed by
Guy Zadickario
parent
dd3849c9ed
commit
d6f18cdf80
@@ -11,6 +11,7 @@ GL2Encoder::GL2Encoder(IOStream *stream) : gl2_encoder_context_t(stream)
|
||||
{
|
||||
m_initialized = false;
|
||||
m_state = NULL;
|
||||
m_error = GL_NO_ERROR;
|
||||
m_num_compressedTextureFormats = 0;
|
||||
m_compressedTextureFormats = NULL;
|
||||
//overrides
|
||||
@@ -31,6 +32,7 @@ GL2Encoder::GL2Encoder(IOStream *stream) : gl2_encoder_context_t(stream)
|
||||
m_glGetVertexAttribPointerv = set_glGetVertexAttribPointerv(s_glGetVertexAttribPointerv);
|
||||
set_glShaderSource(s_glShaderSource);
|
||||
set_glFinish(s_glFinish);
|
||||
m_glGetError_enc = set_glGetError(s_glGetError);
|
||||
}
|
||||
|
||||
GL2Encoder::~GL2Encoder()
|
||||
@@ -38,6 +40,19 @@ GL2Encoder::~GL2Encoder()
|
||||
delete m_compressedTextureFormats;
|
||||
}
|
||||
|
||||
GLenum GL2Encoder::s_glGetError(void * self)
|
||||
{
|
||||
GL2Encoder *ctx = (GL2Encoder *)self;
|
||||
GLenum err = ctx->getError();
|
||||
if(err != GL_NO_ERROR) {
|
||||
ctx->setError(GL_NO_ERROR);
|
||||
return err;
|
||||
}
|
||||
|
||||
return ctx->m_glGetError_enc(self);
|
||||
|
||||
}
|
||||
|
||||
void GL2Encoder::s_glFlush(void *self)
|
||||
{
|
||||
GL2Encoder *ctx = (GL2Encoder *) self;
|
||||
|
||||
Reference in New Issue
Block a user