diff options
Diffstat (limited to 'gpu/command_buffer/client/gles2_implementation_autogen.h')
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation_autogen.h | 136 |
1 files changed, 115 insertions, 21 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 8b30119..b758002 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -103,6 +103,14 @@ void CompressedTexSubImage2D( void CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + if (width < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + if (height < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->CopyTexImage2D( target, level, internalformat, x, y, width, height, border); } @@ -110,6 +118,14 @@ void CopyTexImage2D( void CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + if (width < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + if (height < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->CopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height); } @@ -185,6 +201,10 @@ void DisableVertexAttribArray(GLuint index) { } void DrawArrays(GLenum mode, GLint first, GLsizei count) { + if (count < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->DrawArrays(mode, first, count); } @@ -274,11 +294,7 @@ void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { memcpy(params, result_buffer_, num_values * sizeof(*params)); } -GLenum GetError() { - helper_->GetError(result_shm_id(), result_shm_offset()); - WaitForCmd(); - return GetResultAs<GLenum>(); -} +GLenum GetError(); void GetFloatv(GLenum pname, GLfloat* params) { helper_->GetFloatv(pname, result_shm_id(), result_shm_offset()); @@ -314,10 +330,21 @@ void GetProgramiv(GLuint program, GLenum pname, GLint* params) { memcpy(params, result_buffer_, num_values * sizeof(*params)); } -// TODO(gman): Implement this void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); - + GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + helper_->SetBucketSize(kResultBucketId, 0); + helper_->GetProgramInfoLog(program, kResultBucketId); + std::string str; + if (GetBucketAsString(kResultBucketId, &str)) { + GLsizei max_size = + std::min(static_cast<size_t>(bufsize) - 1, str.size()); + if (length != NULL) { + *length = max_size; + } + memcpy(infolog, str.c_str(), max_size); + infolog[max_size] = '\0'; + } +} void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { helper_->GetRenderbufferParameteriv( target, pname, result_shm_id(), result_shm_offset()); @@ -335,17 +362,39 @@ void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { memcpy(params, result_buffer_, num_values * sizeof(*params)); } -// TODO(gman): Implement this void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); - + GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + helper_->SetBucketSize(kResultBucketId, 0); + helper_->GetShaderInfoLog(shader, kResultBucketId); + std::string str; + if (GetBucketAsString(kResultBucketId, &str)) { + GLsizei max_size = + std::min(static_cast<size_t>(bufsize) - 1, str.size()); + if (length != NULL) { + *length = max_size; + } + memcpy(infolog, str.c_str(), max_size); + infolog[max_size] = '\0'; + } +} void GetShaderPrecisionFormat( GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -// TODO(gman): Implement this void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source); - + GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + helper_->SetBucketSize(kResultBucketId, 0); + helper_->GetShaderSource(shader, kResultBucketId); + std::string str; + if (GetBucketAsString(kResultBucketId, &str)) { + GLsizei max_size = + std::min(static_cast<size_t>(bufsize) - 1, str.size()); + if (length != NULL) { + *length = max_size; + } + memcpy(source, str.c_str(), max_size); + source[max_size] = '\0'; + } +} const GLubyte* GetString(GLenum name); void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { @@ -397,45 +446,66 @@ void Hint(GLenum target, GLenum mode) { } GLboolean IsBuffer(GLuint buffer) { + typedef IsBuffer::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsBuffer(buffer, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsEnabled(GLenum cap) { + typedef IsEnabled::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsEnabled(cap, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsFramebuffer(GLuint framebuffer) { + typedef IsFramebuffer::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsFramebuffer(framebuffer, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsProgram(GLuint program) { + typedef IsProgram::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsProgram(program, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsRenderbuffer(GLuint renderbuffer) { + typedef IsRenderbuffer::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsRenderbuffer(renderbuffer, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsShader(GLuint shader) { + typedef IsShader::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsShader(shader, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } GLboolean IsTexture(GLuint texture) { + typedef IsTexture::Result Result; + Result* result = GetResultAs<Result*>(); + *result = 0; helper_->IsTexture(texture, result_shm_id(), result_shm_offset()); WaitForCmd(); - return GetResultAs<GLboolean>(); + return *result; } void LineWidth(GLfloat width) { @@ -458,6 +528,14 @@ void ReadPixels( void RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + if (width < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + if (height < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->RenderbufferStorage(target, internalformat, width, height); } @@ -466,6 +544,14 @@ void SampleCoverage(GLclampf value, GLboolean invert) { } void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { + if (width < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + if (height < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->Scissor(x, y, width, height); } @@ -645,6 +731,14 @@ void VertexAttribPointer( const void* ptr); void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { + if (width < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + if (height < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } helper_->Viewport(x, y, width, height); } |