Index: gpu/command_buffer/service/gles2_cmd_decoder_autogen.h |
=================================================================== |
--- gpu/command_buffer/service/gles2_cmd_decoder_autogen.h (revision 34647) |
+++ gpu/command_buffer/service/gles2_cmd_decoder_autogen.h (working copy) |
@@ -5,11 +5,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( |
uint32 immediate_data_size, const gles2::ActiveTexture& c) { |
GLenum texture = static_cast<GLenum>(c.texture); |
- parse_error::ParseError result = |
- ValidateActiveTexture(this, immediate_data_size, texture); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glActiveTexture(texture); |
return parse_error::kParseNoError; |
} |
@@ -26,11 +21,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateAttachShader(this, immediate_data_size, program, shader); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glAttachShader(program, shader); |
return parse_error::kParseNoError; |
} |
@@ -46,11 +36,8 @@ |
uint32 name_size = c.data_size; |
const char* name = GetSharedMemoryAs<const char*>( |
c.name_shm_id, c.name_shm_offset, name_size); |
- parse_error::ParseError result = |
- ValidateBindAttribLocation( |
- this, immediate_data_size, program, index, name); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (name == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
String name_str(name, name_size); |
glBindAttribLocation(program, index, name_str.c_str()); |
@@ -69,11 +56,8 @@ |
const char* name = GetImmediateDataAs<const char*>(c); |
// TODO(gman): Make sure validate checks |
// immediate_data_size covers data_size. |
- parse_error::ParseError result = |
- ValidateBindAttribLocationImmediate( |
- this, immediate_data_size, program, index, name); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (name == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
String name_str(name, name_size); |
glBindAttribLocation(program, index, name_str.c_str()); |
@@ -88,10 +72,9 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateBindBuffer(this, immediate_data_size, target, buffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
DoBindBuffer(target, buffer); |
return parse_error::kParseNoError; |
@@ -105,10 +88,9 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateBindFramebuffer(this, immediate_data_size, target, framebuffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFrameBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glBindFramebufferEXT(target, framebuffer); |
return parse_error::kParseNoError; |
@@ -122,11 +104,9 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateBindRenderbuffer( |
- this, immediate_data_size, target, renderbuffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumRenderBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glBindRenderbufferEXT(target, renderbuffer); |
return parse_error::kParseNoError; |
@@ -140,10 +120,9 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateBindTexture(this, immediate_data_size, target, texture); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glBindTexture(target, texture); |
return parse_error::kParseNoError; |
@@ -155,11 +134,6 @@ |
GLclampf green = static_cast<GLclampf>(c.green); |
GLclampf blue = static_cast<GLclampf>(c.blue); |
GLclampf alpha = static_cast<GLclampf>(c.alpha); |
- parse_error::ParseError result = |
- ValidateBlendColor(this, immediate_data_size, red, green, blue, alpha); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glBlendColor(red, green, blue, alpha); |
return parse_error::kParseNoError; |
} |
@@ -167,10 +141,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation( |
uint32 immediate_data_size, const gles2::BlendEquation& c) { |
GLenum mode = static_cast<GLenum>(c.mode); |
- parse_error::ParseError result = |
- ValidateBlendEquation(this, immediate_data_size, mode); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumEquation(mode)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glBlendEquation(mode); |
return parse_error::kParseNoError; |
@@ -180,12 +153,14 @@ |
uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) { |
GLenum modeRGB = static_cast<GLenum>(c.modeRGB); |
GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); |
- parse_error::ParseError result = |
- ValidateBlendEquationSeparate( |
- this, immediate_data_size, modeRGB, modeAlpha); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumEquation(modeRGB)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumEquation(modeAlpha)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glBlendEquationSeparate(modeRGB, modeAlpha); |
return parse_error::kParseNoError; |
} |
@@ -194,11 +169,14 @@ |
uint32 immediate_data_size, const gles2::BlendFunc& c) { |
GLenum sfactor = static_cast<GLenum>(c.sfactor); |
GLenum dfactor = static_cast<GLenum>(c.dfactor); |
- parse_error::ParseError result = |
- ValidateBlendFunc(this, immediate_data_size, sfactor, dfactor); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumSrcBlendFactor(sfactor)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumDstBlendFactor(dfactor)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glBlendFunc(sfactor, dfactor); |
return parse_error::kParseNoError; |
} |
@@ -209,12 +187,22 @@ |
GLenum dstRGB = static_cast<GLenum>(c.dstRGB); |
GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); |
GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); |
- parse_error::ParseError result = |
- ValidateBlendFuncSeparate( |
- this, immediate_data_size, srcRGB, dstRGB, srcAlpha, dstAlpha); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumSrcBlendFactor(srcRGB)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumDstBlendFactor(dstRGB)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumSrcBlendFactor(srcAlpha)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumDstBlendFactor(dstAlpha)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
return parse_error::kParseNoError; |
} |
@@ -229,12 +217,13 @@ |
uint32 data_size = size; |
const void* data = GetSharedMemoryAs<const void*>( |
data_shm_id, data_shm_offset, data_size); |
- parse_error::ParseError result = |
- ValidateBufferSubData( |
- this, immediate_data_size, target, offset, size, data); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glBufferSubData(target, offset, size, data); |
return parse_error::kParseNoError; |
} |
@@ -245,13 +234,21 @@ |
GLintptr offset = static_cast<GLintptr>(c.offset); |
GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
const void* data = GetImmediateDataAs<const void*>(c); |
+ if (!ValidateGLenumBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateBufferSubDataImmediate( |
- this, immediate_data_size, target, offset, size, data); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glBufferSubData(target, offset, size, data); |
return parse_error::kParseNoError; |
} |
@@ -259,10 +256,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( |
uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) { |
GLenum target = static_cast<GLenum>(c.target); |
- parse_error::ParseError result = |
- ValidateCheckFramebufferStatus(this, immediate_data_size, target); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFrameBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glCheckFramebufferStatusEXT(target); |
return parse_error::kParseNoError; |
@@ -271,11 +267,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleClear( |
uint32 immediate_data_size, const gles2::Clear& c) { |
GLbitfield mask = static_cast<GLbitfield>(c.mask); |
- parse_error::ParseError result = |
- ValidateClear(this, immediate_data_size, mask); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glClear(mask); |
return parse_error::kParseNoError; |
} |
@@ -286,11 +277,6 @@ |
GLclampf green = static_cast<GLclampf>(c.green); |
GLclampf blue = static_cast<GLclampf>(c.blue); |
GLclampf alpha = static_cast<GLclampf>(c.alpha); |
- parse_error::ParseError result = |
- ValidateClearColor(this, immediate_data_size, red, green, blue, alpha); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glClearColor(red, green, blue, alpha); |
return parse_error::kParseNoError; |
} |
@@ -298,11 +284,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf( |
uint32 immediate_data_size, const gles2::ClearDepthf& c) { |
GLclampf depth = static_cast<GLclampf>(c.depth); |
- parse_error::ParseError result = |
- ValidateClearDepthf(this, immediate_data_size, depth); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glClearDepth(depth); |
return parse_error::kParseNoError; |
} |
@@ -310,11 +291,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleClearStencil( |
uint32 immediate_data_size, const gles2::ClearStencil& c) { |
GLint s = static_cast<GLint>(c.s); |
- parse_error::ParseError result = |
- ValidateClearStencil(this, immediate_data_size, s); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glClearStencil(s); |
return parse_error::kParseNoError; |
} |
@@ -325,11 +301,6 @@ |
GLboolean green = static_cast<GLboolean>(c.green); |
GLboolean blue = static_cast<GLboolean>(c.blue); |
GLboolean alpha = static_cast<GLboolean>(c.alpha); |
- parse_error::ParseError result = |
- ValidateColorMask(this, immediate_data_size, red, green, blue, alpha); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glColorMask(red, green, blue, alpha); |
return parse_error::kParseNoError; |
} |
@@ -341,11 +312,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateCompileShader(this, immediate_data_size, shader); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glCompileShader(shader); |
return parse_error::kParseNoError; |
} |
@@ -365,13 +331,13 @@ |
uint32 data_size = imageSize; |
const void* data = GetSharedMemoryAs<const void*>( |
data_shm_id, data_shm_offset, data_size); |
- parse_error::ParseError result = |
- ValidateCompressedTexSubImage2D( |
- this, immediate_data_size, target, level, xoffset, yoffset, width, |
- height, format, imageSize, data); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glCompressedTexSubImage2D( |
target, level, xoffset, yoffset, width, height, format, imageSize, data); |
return parse_error::kParseNoError; |
@@ -390,14 +356,21 @@ |
GLenum format = static_cast<GLenum>(c.format); |
GLsizei imageSize = static_cast<GLsizei>(c.imageSize); |
const void* data = GetImmediateDataAs<const void*>(c); |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateCompressedTexSubImage2DImmediate( |
- this, immediate_data_size, target, level, xoffset, yoffset, width, |
- height, format, imageSize, data); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (data == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glCompressedTexSubImage2D( |
target, level, xoffset, yoffset, width, height, format, imageSize, data); |
return parse_error::kParseNoError; |
@@ -413,12 +386,9 @@ |
GLsizei width = static_cast<GLsizei>(c.width); |
GLsizei height = static_cast<GLsizei>(c.height); |
GLint border = static_cast<GLint>(c.border); |
- parse_error::ParseError result = |
- ValidateCopyTexImage2D( |
- this, immediate_data_size, target, level, internalformat, x, y, width, |
- height, border); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); |
return parse_error::kParseNoError; |
@@ -434,12 +404,9 @@ |
GLint y = static_cast<GLint>(c.y); |
GLsizei width = static_cast<GLsizei>(c.width); |
GLsizei height = static_cast<GLsizei>(c.height); |
- parse_error::ParseError result = |
- ValidateCopyTexSubImage2D( |
- this, immediate_data_size, target, level, xoffset, yoffset, x, y, |
- width, height); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
return parse_error::kParseNoError; |
@@ -448,11 +415,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram( |
uint32 immediate_data_size, const gles2::CreateProgram& c) { |
uint32 client_id = c.client_id; |
- parse_error::ParseError result = |
- ValidateCreateProgram(this, immediate_data_size); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
CreateProgramHelper(client_id); |
return parse_error::kParseNoError; |
} |
@@ -460,11 +422,14 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( |
uint32 immediate_data_size, const gles2::CreateShader& c) { |
GLenum type = static_cast<GLenum>(c.type); |
+ if (!ValidateGLenumShaderType(type)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
uint32 client_id = c.client_id; |
- parse_error::ParseError result = |
- ValidateCreateShader(this, immediate_data_size, type); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumShaderType(type)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
CreateShaderHelper(type, client_id); |
return parse_error::kParseNoError; |
@@ -473,10 +438,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleCullFace( |
uint32 immediate_data_size, const gles2::CullFace& c) { |
GLenum mode = static_cast<GLenum>(c.mode); |
- parse_error::ParseError result = |
- ValidateCullFace(this, immediate_data_size, mode); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFaceType(mode)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glCullFace(mode); |
return parse_error::kParseNoError; |
@@ -487,11 +451,12 @@ |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( |
c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateDeleteBuffers(this, immediate_data_size, n, buffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); |
return parse_error::kParseNoError; |
} |
@@ -500,11 +465,12 @@ |
uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateDeleteBuffersImmediate(this, immediate_data_size, n, buffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); |
return parse_error::kParseNoError; |
} |
@@ -515,11 +481,12 @@ |
const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( |
c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( |
gman): size */); |
- parse_error::ParseError result = |
- ValidateDeleteFramebuffers(this, immediate_data_size, n, framebuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); |
return parse_error::kParseNoError; |
} |
@@ -528,43 +495,28 @@ |
uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateDeleteFramebuffersImmediate( |
- this, immediate_data_size, n, framebuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); |
return parse_error::kParseNoError; |
} |
-parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram( |
- uint32 immediate_data_size, const gles2::DeleteProgram& c) { |
- GLuint program; |
- if (!id_map_.GetServiceId(c.program, &program)) { |
- SetGLError(GL_INVALID_VALUE); |
- return parse_error::kParseNoError; |
- } |
- parse_error::ParseError result = |
- ValidateDeleteProgram(this, immediate_data_size, program); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
- DoDeleteProgram(program); |
- return parse_error::kParseNoError; |
-} |
- |
parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( |
uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( |
c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( |
gman): size */); |
- parse_error::ParseError result = |
- ValidateDeleteRenderbuffers(this, immediate_data_size, n, renderbuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); |
return parse_error::kParseNoError; |
} |
@@ -573,42 +525,27 @@ |
uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateDeleteRenderbuffersImmediate( |
- this, immediate_data_size, n, renderbuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); |
return parse_error::kParseNoError; |
} |
-parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( |
- uint32 immediate_data_size, const gles2::DeleteShader& c) { |
- GLuint shader; |
- if (!id_map_.GetServiceId(c.shader, &shader)) { |
- SetGLError(GL_INVALID_VALUE); |
- return parse_error::kParseNoError; |
- } |
- parse_error::ParseError result = |
- ValidateDeleteShader(this, immediate_data_size, shader); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
- DoDeleteShader(shader); |
- return parse_error::kParseNoError; |
-} |
- |
parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( |
uint32 immediate_data_size, const gles2::DeleteTextures& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* textures = GetSharedMemoryAs<const GLuint*>( |
c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateDeleteTextures(this, immediate_data_size, n, textures); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); |
return parse_error::kParseNoError; |
} |
@@ -617,11 +554,12 @@ |
uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
const GLuint* textures = GetImmediateDataAs<const GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateDeleteTexturesImmediate(this, immediate_data_size, n, textures); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); |
return parse_error::kParseNoError; |
} |
@@ -629,10 +567,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( |
uint32 immediate_data_size, const gles2::DepthFunc& c) { |
GLenum func = static_cast<GLenum>(c.func); |
- parse_error::ParseError result = |
- ValidateDepthFunc(this, immediate_data_size, func); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumCmpFunction(func)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glDepthFunc(func); |
return parse_error::kParseNoError; |
@@ -641,11 +578,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleDepthMask( |
uint32 immediate_data_size, const gles2::DepthMask& c) { |
GLboolean flag = static_cast<GLboolean>(c.flag); |
- parse_error::ParseError result = |
- ValidateDepthMask(this, immediate_data_size, flag); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glDepthMask(flag); |
return parse_error::kParseNoError; |
} |
@@ -654,11 +586,6 @@ |
uint32 immediate_data_size, const gles2::DepthRangef& c) { |
GLclampf zNear = static_cast<GLclampf>(c.zNear); |
GLclampf zFar = static_cast<GLclampf>(c.zFar); |
- parse_error::ParseError result = |
- ValidateDepthRangef(this, immediate_data_size, zNear, zFar); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glDepthRange(zNear, zFar); |
return parse_error::kParseNoError; |
} |
@@ -675,11 +602,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateDetachShader(this, immediate_data_size, program, shader); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glDetachShader(program, shader); |
return parse_error::kParseNoError; |
} |
@@ -687,10 +609,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleDisable( |
uint32 immediate_data_size, const gles2::Disable& c) { |
GLenum cap = static_cast<GLenum>(c.cap); |
- parse_error::ParseError result = |
- ValidateDisable(this, immediate_data_size, cap); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumCapability(cap)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glDisable(cap); |
return parse_error::kParseNoError; |
@@ -699,11 +620,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( |
uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) { |
GLuint index = static_cast<GLuint>(c.index); |
- parse_error::ParseError result = |
- ValidateDisableVertexAttribArray(this, immediate_data_size, index); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glDisableVertexAttribArray(index); |
return parse_error::kParseNoError; |
} |
@@ -713,10 +629,9 @@ |
GLenum mode = static_cast<GLenum>(c.mode); |
GLint first = static_cast<GLint>(c.first); |
GLsizei count = static_cast<GLsizei>(c.count); |
- parse_error::ParseError result = |
- ValidateDrawArrays(this, immediate_data_size, mode, first, count); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumDrawMode(mode)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glDrawArrays(mode, first, count); |
return parse_error::kParseNoError; |
@@ -725,10 +640,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleEnable( |
uint32 immediate_data_size, const gles2::Enable& c) { |
GLenum cap = static_cast<GLenum>(c.cap); |
- parse_error::ParseError result = |
- ValidateEnable(this, immediate_data_size, cap); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumCapability(cap)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glEnable(cap); |
return parse_error::kParseNoError; |
@@ -737,33 +651,18 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( |
uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) { |
GLuint index = static_cast<GLuint>(c.index); |
- parse_error::ParseError result = |
- ValidateEnableVertexAttribArray(this, immediate_data_size, index); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glEnableVertexAttribArray(index); |
return parse_error::kParseNoError; |
} |
parse_error::ParseError GLES2DecoderImpl::HandleFinish( |
uint32 immediate_data_size, const gles2::Finish& c) { |
- parse_error::ParseError result = |
- ValidateFinish(this, immediate_data_size); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glFinish(); |
return parse_error::kParseNoError; |
} |
parse_error::ParseError GLES2DecoderImpl::HandleFlush( |
uint32 immediate_data_size, const gles2::Flush& c) { |
- parse_error::ParseError result = |
- ValidateFlush(this, immediate_data_size); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glFlush(); |
return parse_error::kParseNoError; |
} |
@@ -778,13 +677,18 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateFramebufferRenderbuffer( |
- this, immediate_data_size, target, attachment, renderbuffertarget, |
- renderbuffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFrameBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumAttachment(attachment)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumRenderBufferTarget(renderbuffertarget)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glFramebufferRenderbufferEXT( |
target, attachment, renderbuffertarget, renderbuffer); |
return parse_error::kParseNoError; |
@@ -801,13 +705,18 @@ |
return parse_error::kParseNoError; |
} |
GLint level = static_cast<GLint>(c.level); |
- parse_error::ParseError result = |
- ValidateFramebufferTexture2D( |
- this, immediate_data_size, target, attachment, textarget, texture, |
- level); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFrameBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumAttachment(attachment)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumTextureTarget(textarget)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); |
return parse_error::kParseNoError; |
} |
@@ -815,10 +724,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleFrontFace( |
uint32 immediate_data_size, const gles2::FrontFace& c) { |
GLenum mode = static_cast<GLenum>(c.mode); |
- parse_error::ParseError result = |
- ValidateFrontFace(this, immediate_data_size, mode); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFaceMode(mode)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glFrontFace(mode); |
return parse_error::kParseNoError; |
@@ -829,11 +737,12 @@ |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* buffers = GetSharedMemoryAs<GLuint*>( |
c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateGenBuffers(this, immediate_data_size, n, buffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenBuffersHelper>(n, buffers); |
return parse_error::kParseNoError; |
} |
@@ -842,11 +751,12 @@ |
uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* buffers = GetImmediateDataAs<GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateGenBuffersImmediate(this, immediate_data_size, n, buffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (buffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenBuffersHelper>(n, buffers); |
return parse_error::kParseNoError; |
} |
@@ -854,10 +764,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( |
uint32 immediate_data_size, const gles2::GenerateMipmap& c) { |
GLenum target = static_cast<GLenum>(c.target); |
- parse_error::ParseError result = |
- ValidateGenerateMipmap(this, immediate_data_size, target); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glGenerateMipmapEXT(target); |
return parse_error::kParseNoError; |
@@ -869,11 +778,12 @@ |
GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( |
c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( |
gman): size */); |
- parse_error::ParseError result = |
- ValidateGenFramebuffers(this, immediate_data_size, n, framebuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); |
return parse_error::kParseNoError; |
} |
@@ -882,12 +792,12 @@ |
uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateGenFramebuffersImmediate( |
- this, immediate_data_size, n, framebuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (framebuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); |
return parse_error::kParseNoError; |
} |
@@ -898,11 +808,12 @@ |
GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( |
c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( |
gman): size */); |
- parse_error::ParseError result = |
- ValidateGenRenderbuffers(this, immediate_data_size, n, renderbuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); |
return parse_error::kParseNoError; |
} |
@@ -911,12 +822,12 @@ |
uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateGenRenderbuffersImmediate( |
- this, immediate_data_size, n, renderbuffers); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (renderbuffers == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); |
return parse_error::kParseNoError; |
} |
@@ -926,11 +837,12 @@ |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* textures = GetSharedMemoryAs<GLuint*>( |
c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateGenTextures(this, immediate_data_size, n, textures); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenTexturesHelper>(n, textures); |
return parse_error::kParseNoError; |
} |
@@ -939,11 +851,12 @@ |
uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { |
GLsizei n = static_cast<GLsizei>(c.n); |
GLuint* textures = GetImmediateDataAs<GLuint*>(c); |
- parse_error::ParseError result = |
- ValidateGenTexturesImmediate(this, immediate_data_size, n, textures); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (textures == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
GenGLObjects<GLGenTexturesHelper>(n, textures); |
return parse_error::kParseNoError; |
} |
@@ -956,10 +869,8 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLboolean*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetBooleanv(this, immediate_data_size, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glGetBooleanv(pname, params); |
return parse_error::kParseNoError; |
@@ -974,12 +885,17 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetBufferParameteriv( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumBufferParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetBufferParameteriv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -988,11 +904,6 @@ |
uint32 immediate_data_size, const gles2::GetError& c) { |
GLenum* result_dst = GetSharedMemoryAs<GLenum*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateGetError(this, immediate_data_size); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = GetGLError(); |
return parse_error::kParseNoError; |
} |
@@ -1005,10 +916,8 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLfloat*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetFloatv(this, immediate_data_size, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glGetFloatv(pname, params); |
return parse_error::kParseNoError; |
@@ -1026,12 +935,21 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetFramebufferAttachmentParameteriv( |
- this, immediate_data_size, target, attachment, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFrameBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumAttachment(attachment)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumFrameBufferParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1044,10 +962,8 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetIntegerv(this, immediate_data_size, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glGetIntegerv(pname, params); |
return parse_error::kParseNoError; |
@@ -1066,11 +982,13 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetProgramiv(this, immediate_data_size, program, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumProgramParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetProgramiv(program, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1087,12 +1005,12 @@ |
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); |
char* infolog = GetSharedMemoryAs<char*>( |
c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateGetProgramInfoLog( |
- this, immediate_data_size, program, bufsize, length, infolog); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (length == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (infolog == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetProgramInfoLog(program, bufsize, length, infolog); |
return parse_error::kParseNoError; |
} |
@@ -1106,12 +1024,17 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetRenderbufferParameteriv( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumRenderBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumRenderBufferParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetRenderbufferParameterivEXT(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1129,11 +1052,13 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetShaderiv(this, immediate_data_size, shader, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumShaderParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetShaderiv(shader, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1150,12 +1075,12 @@ |
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); |
char* infolog = GetSharedMemoryAs<char*>( |
c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateGetShaderInfoLog( |
- this, immediate_data_size, shader, bufsize, length, infolog); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (length == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (infolog == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetShaderInfoLog(shader, bufsize, length, infolog); |
return parse_error::kParseNoError; |
} |
@@ -1172,12 +1097,12 @@ |
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); |
char* source = GetSharedMemoryAs<char*>( |
c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateGetShaderSource( |
- this, immediate_data_size, shader, bufsize, length, source); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (length == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (source == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetShaderSource(shader, bufsize, length, source); |
return parse_error::kParseNoError; |
} |
@@ -1185,10 +1110,9 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleGetString( |
uint32 immediate_data_size, const gles2::GetString& c) { |
GLenum name = static_cast<GLenum>(c.name); |
- parse_error::ParseError result = |
- ValidateGetString(this, immediate_data_size, name); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumStringType(name)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glGetString(name); |
return parse_error::kParseNoError; |
@@ -1203,12 +1127,17 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLfloat*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetTexParameterfv( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetTexParameterfv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1222,12 +1151,17 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetTexParameteriv( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetTexParameteriv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1241,12 +1175,13 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLfloat*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetVertexAttribfv( |
- this, immediate_data_size, index, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumVertexAttribute(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetVertexAttribfv(index, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1260,12 +1195,13 @@ |
uint32 params_size = num_values * sizeof(*params); |
params = GetSharedMemoryAs<GLint*>( |
c.params_shm_id, c.params_shm_offset, params_size); |
- parse_error::ParseError result = |
- ValidateGetVertexAttribiv( |
- this, immediate_data_size, index, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumVertexAttribute(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glGetVertexAttribiv(index, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1274,11 +1210,14 @@ |
uint32 immediate_data_size, const gles2::Hint& c) { |
GLenum target = static_cast<GLenum>(c.target); |
GLenum mode = static_cast<GLenum>(c.mode); |
- parse_error::ParseError result = |
- ValidateHint(this, immediate_data_size, target, mode); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumHintTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumHintMode(mode)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glHint(target, mode); |
return parse_error::kParseNoError; |
} |
@@ -1292,11 +1231,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsBuffer(this, immediate_data_size, buffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsBuffer(buffer); |
return parse_error::kParseNoError; |
} |
@@ -1306,10 +1240,9 @@ |
GLenum cap = static_cast<GLenum>(c.cap); |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsEnabled(this, immediate_data_size, cap); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumCapability(cap)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
*result_dst = glIsEnabled(cap); |
return parse_error::kParseNoError; |
@@ -1324,11 +1257,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsFramebuffer(this, immediate_data_size, framebuffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsFramebufferEXT(framebuffer); |
return parse_error::kParseNoError; |
} |
@@ -1342,11 +1270,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsProgram(this, immediate_data_size, program); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsProgram(program); |
return parse_error::kParseNoError; |
} |
@@ -1360,11 +1283,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsRenderbuffer(this, immediate_data_size, renderbuffer); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsRenderbufferEXT(renderbuffer); |
return parse_error::kParseNoError; |
} |
@@ -1378,11 +1296,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsShader(this, immediate_data_size, shader); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsShader(shader); |
return parse_error::kParseNoError; |
} |
@@ -1396,11 +1309,6 @@ |
} |
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( |
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
- parse_error::ParseError result = |
- ValidateIsTexture(this, immediate_data_size, texture); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
*result_dst = glIsTexture(texture); |
return parse_error::kParseNoError; |
} |
@@ -1408,11 +1316,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleLineWidth( |
uint32 immediate_data_size, const gles2::LineWidth& c) { |
GLfloat width = static_cast<GLfloat>(c.width); |
- parse_error::ParseError result = |
- ValidateLineWidth(this, immediate_data_size, width); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glLineWidth(width); |
return parse_error::kParseNoError; |
} |
@@ -1424,11 +1327,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateLinkProgram(this, immediate_data_size, program); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glLinkProgram(program); |
return parse_error::kParseNoError; |
} |
@@ -1437,11 +1335,6 @@ |
uint32 immediate_data_size, const gles2::PolygonOffset& c) { |
GLfloat factor = static_cast<GLfloat>(c.factor); |
GLfloat units = static_cast<GLfloat>(c.units); |
- parse_error::ParseError result = |
- ValidatePolygonOffset(this, immediate_data_size, factor, units); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glPolygonOffset(factor, units); |
return parse_error::kParseNoError; |
} |
@@ -1452,12 +1345,14 @@ |
GLenum internalformat = static_cast<GLenum>(c.internalformat); |
GLsizei width = static_cast<GLsizei>(c.width); |
GLsizei height = static_cast<GLsizei>(c.height); |
- parse_error::ParseError result = |
- ValidateRenderbufferStorage( |
- this, immediate_data_size, target, internalformat, width, height); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumRenderBufferTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumRenderBufferFormat(internalformat)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glRenderbufferStorageEXT(target, internalformat, width, height); |
return parse_error::kParseNoError; |
} |
@@ -1466,11 +1361,6 @@ |
uint32 immediate_data_size, const gles2::SampleCoverage& c) { |
GLclampf value = static_cast<GLclampf>(c.value); |
GLboolean invert = static_cast<GLboolean>(c.invert); |
- parse_error::ParseError result = |
- ValidateSampleCoverage(this, immediate_data_size, value, invert); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glSampleCoverage(value, invert); |
return parse_error::kParseNoError; |
} |
@@ -1481,11 +1371,6 @@ |
GLint y = static_cast<GLint>(c.y); |
GLsizei width = static_cast<GLsizei>(c.width); |
GLsizei height = static_cast<GLsizei>(c.height); |
- parse_error::ParseError result = |
- ValidateScissor(this, immediate_data_size, x, y, width, height); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glScissor(x, y, width, height); |
return parse_error::kParseNoError; |
} |
@@ -1495,10 +1380,9 @@ |
GLenum func = static_cast<GLenum>(c.func); |
GLint ref = static_cast<GLint>(c.ref); |
GLuint mask = static_cast<GLuint>(c.mask); |
- parse_error::ParseError result = |
- ValidateStencilFunc(this, immediate_data_size, func, ref, mask); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumCmpFunction(func)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glStencilFunc(func, ref, mask); |
return parse_error::kParseNoError; |
@@ -1510,12 +1394,14 @@ |
GLenum func = static_cast<GLenum>(c.func); |
GLint ref = static_cast<GLint>(c.ref); |
GLuint mask = static_cast<GLuint>(c.mask); |
- parse_error::ParseError result = |
- ValidateStencilFuncSeparate( |
- this, immediate_data_size, face, func, ref, mask); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFaceType(face)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumCmpFunction(func)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glStencilFuncSeparate(face, func, ref, mask); |
return parse_error::kParseNoError; |
} |
@@ -1523,11 +1409,6 @@ |
parse_error::ParseError GLES2DecoderImpl::HandleStencilMask( |
uint32 immediate_data_size, const gles2::StencilMask& c) { |
GLuint mask = static_cast<GLuint>(c.mask); |
- parse_error::ParseError result = |
- ValidateStencilMask(this, immediate_data_size, mask); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glStencilMask(mask); |
return parse_error::kParseNoError; |
} |
@@ -1536,10 +1417,9 @@ |
uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) { |
GLenum face = static_cast<GLenum>(c.face); |
GLuint mask = static_cast<GLuint>(c.mask); |
- parse_error::ParseError result = |
- ValidateStencilMaskSeparate(this, immediate_data_size, face, mask); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFaceType(face)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
glStencilMaskSeparate(face, mask); |
return parse_error::kParseNoError; |
@@ -1550,11 +1430,18 @@ |
GLenum fail = static_cast<GLenum>(c.fail); |
GLenum zfail = static_cast<GLenum>(c.zfail); |
GLenum zpass = static_cast<GLenum>(c.zpass); |
- parse_error::ParseError result = |
- ValidateStencilOp(this, immediate_data_size, fail, zfail, zpass); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumStencilOp(fail)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumStencilOp(zfail)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumStencilOp(zpass)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glStencilOp(fail, zfail, zpass); |
return parse_error::kParseNoError; |
} |
@@ -1565,12 +1452,22 @@ |
GLenum fail = static_cast<GLenum>(c.fail); |
GLenum zfail = static_cast<GLenum>(c.zfail); |
GLenum zpass = static_cast<GLenum>(c.zpass); |
- parse_error::ParseError result = |
- ValidateStencilOpSeparate( |
- this, immediate_data_size, face, fail, zfail, zpass); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumFaceType(face)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumStencilOp(fail)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumStencilOp(zfail)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumStencilOp(zpass)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glStencilOpSeparate(face, fail, zfail, zpass); |
return parse_error::kParseNoError; |
} |
@@ -1580,11 +1477,14 @@ |
GLenum target = static_cast<GLenum>(c.target); |
GLenum pname = static_cast<GLenum>(c.pname); |
GLfloat param = static_cast<GLfloat>(c.param); |
- parse_error::ParseError result = |
- ValidateTexParameterf(this, immediate_data_size, target, pname, param); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glTexParameterf(target, pname, param); |
return parse_error::kParseNoError; |
} |
@@ -1595,11 +1495,17 @@ |
GLenum pname = static_cast<GLenum>(c.pname); |
const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( |
c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateTexParameterfv(this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexParameterfv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1609,13 +1515,37 @@ |
GLenum target = static_cast<GLenum>(c.target); |
GLenum pname = static_cast<GLenum>(c.pname); |
const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c); |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<TexParameterfvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateTexParameterfvImmediate( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<TexParameterfvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexParameterfv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1625,11 +1555,14 @@ |
GLenum target = static_cast<GLenum>(c.target); |
GLenum pname = static_cast<GLenum>(c.pname); |
GLint param = static_cast<GLint>(c.param); |
- parse_error::ParseError result = |
- ValidateTexParameteri(this, immediate_data_size, target, pname, param); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
glTexParameteri(target, pname, param); |
return parse_error::kParseNoError; |
} |
@@ -1640,11 +1573,17 @@ |
GLenum pname = static_cast<GLenum>(c.pname); |
const GLint* params = GetSharedMemoryAs<const GLint*>( |
c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateTexParameteriv(this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexParameteriv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1654,13 +1593,37 @@ |
GLenum target = static_cast<GLenum>(c.target); |
GLenum pname = static_cast<GLenum>(c.pname); |
const GLint* params = GetImmediateDataAs<const GLint*>(c); |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<TexParameterivImmediate>( |
+ immediate_data_size, 1, sizeof(GLint), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateTexParameterivImmediate( |
- this, immediate_data_size, target, pname, params); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureBindTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureParameter(pname)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (params == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<TexParameterivImmediate>( |
+ immediate_data_size, 1, sizeof(GLint), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexParameteriv(target, pname, params); |
return parse_error::kParseNoError; |
} |
@@ -1681,13 +1644,21 @@ |
width, height, format, type, unpack_alignment_); |
const void* pixels = GetSharedMemoryAs<const void*>( |
pixels_shm_id, pixels_shm_offset, pixels_size); |
- parse_error::ParseError result = |
- ValidateTexSubImage2D( |
- this, immediate_data_size, target, level, xoffset, yoffset, width, |
- height, format, type, pixels); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureFormat(format)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumPixelType(type)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (pixels == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexSubImage2D( |
target, level, xoffset, yoffset, width, height, format, type, pixels); |
return parse_error::kParseNoError; |
@@ -1704,14 +1675,37 @@ |
GLenum format = static_cast<GLenum>(c.format); |
GLenum type = static_cast<GLenum>(c.type); |
const void* pixels = GetImmediateDataAs<const void*>(c); |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumTextureFormat(format)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumPixelType(type)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (pixels == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateTexSubImage2DImmediate( |
- this, immediate_data_size, target, level, xoffset, yoffset, width, |
- height, format, type, pixels); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (!ValidateGLenumTextureTarget(target)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
} |
+ if (!ValidateGLenumTextureFormat(format)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (!ValidateGLenumPixelType(type)) { |
+ SetGLError(GL_INVALID_VALUE); |
+ return parse_error::kParseNoError; |
+ } |
+ if (pixels == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glTexSubImage2D( |
target, level, xoffset, yoffset, width, height, format, type, pixels); |
return parse_error::kParseNoError; |
@@ -1721,11 +1715,6 @@ |
uint32 immediate_data_size, const gles2::Uniform1f& c) { |
GLint location = static_cast<GLint>(c.location); |
GLfloat x = static_cast<GLfloat>(c.x); |
- parse_error::ParseError result = |
- ValidateUniform1f(this, immediate_data_size, location, x); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform1f(location, x); |
return parse_error::kParseNoError; |
} |
@@ -1736,10 +1725,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform1fv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform1fv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1750,13 +1737,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform1fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform1fvImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform1fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform1fv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1765,11 +1760,6 @@ |
uint32 immediate_data_size, const gles2::Uniform1i& c) { |
GLint location = static_cast<GLint>(c.location); |
GLint x = static_cast<GLint>(c.x); |
- parse_error::ParseError result = |
- ValidateUniform1i(this, immediate_data_size, location, x); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform1i(location, x); |
return parse_error::kParseNoError; |
} |
@@ -1780,10 +1770,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetSharedMemoryAs<const GLint*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform1iv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform1iv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1794,13 +1782,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetImmediateDataAs<const GLint*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform1ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform1ivImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform1ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform1iv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1810,11 +1806,6 @@ |
GLint location = static_cast<GLint>(c.location); |
GLfloat x = static_cast<GLfloat>(c.x); |
GLfloat y = static_cast<GLfloat>(c.y); |
- parse_error::ParseError result = |
- ValidateUniform2f(this, immediate_data_size, location, x, y); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform2f(location, x, y); |
return parse_error::kParseNoError; |
} |
@@ -1825,10 +1816,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform2fv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform2fv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1839,13 +1828,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform2fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform2fvImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform2fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform2fv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1855,11 +1852,6 @@ |
GLint location = static_cast<GLint>(c.location); |
GLint x = static_cast<GLint>(c.x); |
GLint y = static_cast<GLint>(c.y); |
- parse_error::ParseError result = |
- ValidateUniform2i(this, immediate_data_size, location, x, y); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform2i(location, x, y); |
return parse_error::kParseNoError; |
} |
@@ -1870,10 +1862,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetSharedMemoryAs<const GLint*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform2iv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform2iv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1884,13 +1874,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetImmediateDataAs<const GLint*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform2ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform2ivImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform2ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform2iv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1901,11 +1899,6 @@ |
GLfloat x = static_cast<GLfloat>(c.x); |
GLfloat y = static_cast<GLfloat>(c.y); |
GLfloat z = static_cast<GLfloat>(c.z); |
- parse_error::ParseError result = |
- ValidateUniform3f(this, immediate_data_size, location, x, y, z); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform3f(location, x, y, z); |
return parse_error::kParseNoError; |
} |
@@ -1916,10 +1909,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform3fv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform3fv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1930,13 +1921,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform3fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform3fvImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform3fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform3fv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1947,11 +1946,6 @@ |
GLint x = static_cast<GLint>(c.x); |
GLint y = static_cast<GLint>(c.y); |
GLint z = static_cast<GLint>(c.z); |
- parse_error::ParseError result = |
- ValidateUniform3i(this, immediate_data_size, location, x, y, z); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform3i(location, x, y, z); |
return parse_error::kParseNoError; |
} |
@@ -1962,10 +1956,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetSharedMemoryAs<const GLint*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform3iv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform3iv(location, count, v); |
return parse_error::kParseNoError; |
@@ -1976,13 +1968,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetImmediateDataAs<const GLint*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform3ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform3ivImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform3ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform3iv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -1994,11 +1994,6 @@ |
GLfloat y = static_cast<GLfloat>(c.y); |
GLfloat z = static_cast<GLfloat>(c.z); |
GLfloat w = static_cast<GLfloat>(c.w); |
- parse_error::ParseError result = |
- ValidateUniform4f(this, immediate_data_size, location, x, y, z, w); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform4f(location, x, y, z, w); |
return parse_error::kParseNoError; |
} |
@@ -2009,10 +2004,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform4fv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform4fv(location, count, v); |
return parse_error::kParseNoError; |
@@ -2023,13 +2016,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform4fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform4fvImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform4fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform4fv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -2041,11 +2042,6 @@ |
GLint y = static_cast<GLint>(c.y); |
GLint z = static_cast<GLint>(c.z); |
GLint w = static_cast<GLint>(c.w); |
- parse_error::ParseError result = |
- ValidateUniform4i(this, immediate_data_size, location, x, y, z, w); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUniform4i(location, x, y, z, w); |
return parse_error::kParseNoError; |
} |
@@ -2056,10 +2052,8 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetSharedMemoryAs<const GLint*>( |
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniform4iv(this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniform4iv(location, count, v); |
return parse_error::kParseNoError; |
@@ -2070,13 +2064,21 @@ |
GLint location = static_cast<GLint>(c.location); |
GLsizei count = static_cast<GLsizei>(c.count); |
const GLint* v = GetImmediateDataAs<const GLint*>(c); |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<Uniform4ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniform4ivImmediate( |
- this, immediate_data_size, location, count, v); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (v == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<Uniform4ivImmediate>( |
+ immediate_data_size, count, sizeof(GLint), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniform4iv(location, count, v); |
return parse_error::kParseNoError; |
} |
@@ -2088,11 +2090,8 @@ |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniformMatrix2fv( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniformMatrix2fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
@@ -2104,13 +2103,21 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniformMatrix2fvImmediate( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniformMatrix2fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
} |
@@ -2122,11 +2129,8 @@ |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniformMatrix3fv( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniformMatrix3fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
@@ -2138,13 +2142,21 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 9)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniformMatrix3fvImmediate( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 9)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniformMatrix3fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
} |
@@ -2156,11 +2168,8 @@ |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateUniformMatrix4fv( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glUniformMatrix4fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
@@ -2172,13 +2181,21 @@ |
GLsizei count = static_cast<GLsizei>(c.count); |
GLboolean transpose = static_cast<GLboolean>(c.transpose); |
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 16)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateUniformMatrix4fvImmediate( |
- this, immediate_data_size, location, count, transpose, value); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (value == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>( |
+ immediate_data_size, count, sizeof(GLfloat), 16)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glUniformMatrix4fv(location, count, transpose, value); |
return parse_error::kParseNoError; |
} |
@@ -2190,11 +2207,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateUseProgram(this, immediate_data_size, program); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glUseProgram(program); |
return parse_error::kParseNoError; |
} |
@@ -2206,11 +2218,6 @@ |
SetGLError(GL_INVALID_VALUE); |
return parse_error::kParseNoError; |
} |
- parse_error::ParseError result = |
- ValidateValidateProgram(this, immediate_data_size, program); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glValidateProgram(program); |
return parse_error::kParseNoError; |
} |
@@ -2219,11 +2226,6 @@ |
uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { |
GLuint indx = static_cast<GLuint>(c.indx); |
GLfloat x = static_cast<GLfloat>(c.x); |
- parse_error::ParseError result = |
- ValidateVertexAttrib1f(this, immediate_data_size, indx, x); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glVertexAttrib1f(indx, x); |
return parse_error::kParseNoError; |
} |
@@ -2233,10 +2235,8 @@ |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateVertexAttrib1fv(this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glVertexAttrib1fv(indx, values); |
return parse_error::kParseNoError; |
@@ -2246,13 +2246,21 @@ |
uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) { |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateVertexAttrib1fvImmediate( |
- this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 1)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glVertexAttrib1fv(indx, values); |
return parse_error::kParseNoError; |
} |
@@ -2262,11 +2270,6 @@ |
GLuint indx = static_cast<GLuint>(c.indx); |
GLfloat x = static_cast<GLfloat>(c.x); |
GLfloat y = static_cast<GLfloat>(c.y); |
- parse_error::ParseError result = |
- ValidateVertexAttrib2f(this, immediate_data_size, indx, x, y); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glVertexAttrib2f(indx, x, y); |
return parse_error::kParseNoError; |
} |
@@ -2276,10 +2279,8 @@ |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateVertexAttrib2fv(this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glVertexAttrib2fv(indx, values); |
return parse_error::kParseNoError; |
@@ -2289,13 +2290,21 @@ |
uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) { |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateVertexAttrib2fvImmediate( |
- this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 2)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glVertexAttrib2fv(indx, values); |
return parse_error::kParseNoError; |
} |
@@ -2306,11 +2315,6 @@ |
GLfloat x = static_cast<GLfloat>(c.x); |
GLfloat y = static_cast<GLfloat>(c.y); |
GLfloat z = static_cast<GLfloat>(c.z); |
- parse_error::ParseError result = |
- ValidateVertexAttrib3f(this, immediate_data_size, indx, x, y, z); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glVertexAttrib3f(indx, x, y, z); |
return parse_error::kParseNoError; |
} |
@@ -2320,10 +2324,8 @@ |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateVertexAttrib3fv(this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glVertexAttrib3fv(indx, values); |
return parse_error::kParseNoError; |
@@ -2333,13 +2335,21 @@ |
uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) { |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateVertexAttrib3fvImmediate( |
- this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 3)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glVertexAttrib3fv(indx, values); |
return parse_error::kParseNoError; |
} |
@@ -2351,11 +2361,6 @@ |
GLfloat y = static_cast<GLfloat>(c.y); |
GLfloat z = static_cast<GLfloat>(c.z); |
GLfloat w = static_cast<GLfloat>(c.w); |
- parse_error::ParseError result = |
- ValidateVertexAttrib4f(this, immediate_data_size, indx, x, y, z, w); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glVertexAttrib4f(indx, x, y, z, w); |
return parse_error::kParseNoError; |
} |
@@ -2365,10 +2370,8 @@ |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); |
- parse_error::ParseError result = |
- ValidateVertexAttrib4fv(this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
glVertexAttrib4fv(indx, values); |
return parse_error::kParseNoError; |
@@ -2378,13 +2381,21 @@ |
uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) { |
GLuint indx = static_cast<GLuint>(c.indx); |
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
+ if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
// Immediate version. |
- parse_error::ParseError result = |
- ValidateVertexAttrib4fvImmediate( |
- this, immediate_data_size, indx, values); |
- if (result != parse_error::kParseNoError) { |
- return result; |
+ if (values == NULL) { |
+ return parse_error::kParseOutOfBounds; |
} |
+ if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>( |
+ immediate_data_size, 1, sizeof(GLfloat), 4)) { |
+ return parse_error::kParseOutOfBounds; |
+ } |
glVertexAttrib4fv(indx, values); |
return parse_error::kParseNoError; |
} |
@@ -2395,22 +2406,12 @@ |
GLint y = static_cast<GLint>(c.y); |
GLsizei width = static_cast<GLsizei>(c.width); |
GLsizei height = static_cast<GLsizei>(c.height); |
- parse_error::ParseError result = |
- ValidateViewport(this, immediate_data_size, x, y, width, height); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
glViewport(x, y, width, height); |
return parse_error::kParseNoError; |
} |
parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers( |
uint32 immediate_data_size, const gles2::SwapBuffers& c) { |
- parse_error::ParseError result = |
- ValidateSwapBuffers(this, immediate_data_size); |
- if (result != parse_error::kParseNoError) { |
- return result; |
- } |
DoSwapBuffers(); |
return parse_error::kParseNoError; |
} |