| Index: gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
|
| ===================================================================
|
| --- gpu/command_buffer/service/gles2_cmd_decoder_autogen.h (revision 35070)
|
| +++ gpu/command_buffer/service/gles2_cmd_decoder_autogen.h (working copy)
|
| @@ -53,9 +53,8 @@
|
| }
|
| GLuint index = static_cast<GLuint>(c.index);
|
| uint32 name_size = c.data_size;
|
| - const char* name = GetImmediateDataAs<const char*>(c);
|
| - // TODO(gman): Make sure validate checks
|
| - // immediate_data_size covers data_size.
|
| + const char* name = GetImmediateDataAs<const char*>(
|
| + c, name_size, immediate_data_size);
|
| if (name == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -212,11 +211,9 @@
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLintptr offset = static_cast<GLintptr>(c.offset);
|
| GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
|
| - uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
|
| - uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
|
| uint32 data_size = size;
|
| const void* data = GetSharedMemoryAs<const void*>(
|
| - data_shm_id, data_shm_offset, data_size);
|
| + c.data_shm_id, c.data_shm_offset, data_size);
|
| if (!ValidateGLenumBufferTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -233,7 +230,9 @@
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLintptr offset = static_cast<GLintptr>(c.offset);
|
| GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
|
| - const void* data = GetImmediateDataAs<const void*>(c);
|
| + uint32 data_size = size;
|
| + const void* data = GetImmediateDataAs<const void*>(
|
| + c, data_size, immediate_data_size);
|
| if (!ValidateGLenumBufferTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -241,14 +240,6 @@
|
| if (data == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -326,11 +317,9 @@
|
| GLsizei height = static_cast<GLsizei>(c.height);
|
| GLenum format = static_cast<GLenum>(c.format);
|
| GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
|
| - uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
|
| - uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
|
| uint32 data_size = imageSize;
|
| const void* data = GetSharedMemoryAs<const void*>(
|
| - data_shm_id, data_shm_offset, data_size);
|
| + c.data_shm_id, c.data_shm_offset, data_size);
|
| if (!ValidateGLenumTextureTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -355,7 +344,9 @@
|
| GLsizei height = static_cast<GLsizei>(c.height);
|
| GLenum format = static_cast<GLenum>(c.format);
|
| GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
|
| - const void* data = GetImmediateDataAs<const void*>(c);
|
| + uint32 data_size = imageSize;
|
| + const void* data = GetImmediateDataAs<const void*>(
|
| + c, data_size, immediate_data_size);
|
| if (!ValidateGLenumTextureTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -363,14 +354,6 @@
|
| if (data == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - // Immediate version.
|
| - 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;
|
| @@ -427,10 +410,6 @@
|
| return parse_error::kParseNoError;
|
| }
|
| uint32 client_id = c.client_id;
|
| - if (!ValidateGLenumShaderType(type)) {
|
| - SetGLError(GL_INVALID_VALUE);
|
| - return parse_error::kParseNoError;
|
| - }
|
| CreateShaderHelper(type, client_id);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -449,14 +428,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers(
|
| uint32 immediate_data_size, const gles2::DeleteBuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| const GLuint* buffers = GetSharedMemoryAs<const GLuint*>(
|
| - c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
|
| + c.buffers_shm_id, c.buffers_shm_offset, data_size);
|
| if (buffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (buffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -464,13 +441,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate(
|
| uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + const GLuint* buffers = GetImmediateDataAs<const GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (buffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (buffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -478,15 +454,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers(
|
| uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>(
|
| - c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
|
| - gman): size */);
|
| + c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size);
|
| if (framebuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (framebuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -494,13 +467,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate(
|
| uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (framebuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (framebuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -508,15 +480,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers(
|
| uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>(
|
| - c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
|
| - gman): size */);
|
| + c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size);
|
| if (renderbuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (renderbuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -524,13 +493,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate(
|
| uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (renderbuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (renderbuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -538,14 +506,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures(
|
| uint32 immediate_data_size, const gles2::DeleteTextures& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| const GLuint* textures = GetSharedMemoryAs<const GLuint*>(
|
| - c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
|
| + c.textures_shm_id, c.textures_shm_offset, data_size);
|
| if (textures == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (textures == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -553,13 +519,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate(
|
| uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - const GLuint* textures = GetImmediateDataAs<const GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + const GLuint* textures = GetImmediateDataAs<const GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (textures == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (textures == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -620,7 +585,7 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray(
|
| uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) {
|
| GLuint index = static_cast<GLuint>(c.index);
|
| - glDisableVertexAttribArray(index);
|
| + DoDisableVertexAttribArray(index);
|
| return parse_error::kParseNoError;
|
| }
|
|
|
| @@ -633,7 +598,7 @@
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| }
|
| - glDrawArrays(mode, first, count);
|
| + DoDrawArrays(mode, first, count);
|
| return parse_error::kParseNoError;
|
| }
|
|
|
| @@ -651,7 +616,7 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray(
|
| uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) {
|
| GLuint index = static_cast<GLuint>(c.index);
|
| - glEnableVertexAttribArray(index);
|
| + DoEnableVertexAttribArray(index);
|
| return parse_error::kParseNoError;
|
| }
|
|
|
| @@ -735,14 +700,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers(
|
| uint32 immediate_data_size, const gles2::GenBuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| GLuint* buffers = GetSharedMemoryAs<GLuint*>(
|
| - c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
|
| + c.buffers_shm_id, c.buffers_shm_offset, data_size);
|
| if (buffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (buffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenBuffersHelper>(n, buffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -750,13 +713,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate(
|
| uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - GLuint* buffers = GetImmediateDataAs<GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + GLuint* buffers = GetImmediateDataAs<GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (buffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (buffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenBuffersHelper>(n, buffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -775,15 +737,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers(
|
| uint32 immediate_data_size, const gles2::GenFramebuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| GLuint* framebuffers = GetSharedMemoryAs<GLuint*>(
|
| - c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
|
| - gman): size */);
|
| + c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size);
|
| if (framebuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (framebuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -791,13 +750,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate(
|
| uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + GLuint* framebuffers = GetImmediateDataAs<GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (framebuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (framebuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -805,15 +763,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers(
|
| uint32 immediate_data_size, const gles2::GenRenderbuffers& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>(
|
| - c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
|
| - gman): size */);
|
| + c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size);
|
| if (renderbuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (renderbuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -821,13 +776,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate(
|
| uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (renderbuffers == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (renderbuffers == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -835,14 +789,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenTextures(
|
| uint32 immediate_data_size, const gles2::GenTextures& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| GLuint* textures = GetSharedMemoryAs<GLuint*>(
|
| - c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
|
| + c.textures_shm_id, c.textures_shm_offset, data_size);
|
| if (textures == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (textures == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenTexturesHelper>(n, textures);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -850,13 +802,12 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate(
|
| uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) {
|
| GLsizei n = static_cast<GLsizei>(c.n);
|
| - GLuint* textures = GetImmediateDataAs<GLuint*>(c);
|
| + uint32 data_size = n * sizeof(GLuint);
|
| + GLuint* textures = GetImmediateDataAs<GLuint*>(
|
| + c, data_size, immediate_data_size);
|
| if (textures == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (textures == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| GenGLObjects<GLGenTexturesHelper>(n, textures);
|
| return parse_error::kParseNoError;
|
| }
|
| @@ -1001,13 +952,18 @@
|
| return parse_error::kParseNoError;
|
| }
|
| GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
|
| - GLsizei* length = GetSharedMemoryAs<GLsizei*>(
|
| - 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 */);
|
| - if (length == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| + uint32 size_shm_id = c.length_shm_id;
|
| + uint32 size_shm_offset = c.length_shm_offset;
|
| + GLsizei* length = NULL;
|
| + if (size_shm_id != 0 || size_shm_offset != 0) {
|
| + length = GetSharedMemoryAs<GLsizei*>(
|
| + size_shm_id, size_shm_offset, sizeof(*length));
|
| + if (!length) {
|
| + return parse_error::kParseOutOfBounds;
|
| + }
|
| }
|
| + char* infolog = GetSharedMemoryAs<char*>(
|
| + c.infolog_shm_id, c.infolog_shm_offset, bufsize);
|
| if (infolog == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1071,13 +1027,18 @@
|
| return parse_error::kParseNoError;
|
| }
|
| GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
|
| - GLsizei* length = GetSharedMemoryAs<GLsizei*>(
|
| - 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 */);
|
| - if (length == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| + uint32 size_shm_id = c.length_shm_id;
|
| + uint32 size_shm_offset = c.length_shm_offset;
|
| + GLsizei* length = NULL;
|
| + if (size_shm_id != 0 || size_shm_offset != 0) {
|
| + length = GetSharedMemoryAs<GLsizei*>(
|
| + size_shm_id, size_shm_offset, sizeof(*length));
|
| + if (!length) {
|
| + return parse_error::kParseOutOfBounds;
|
| + }
|
| }
|
| + char* infolog = GetSharedMemoryAs<char*>(
|
| + c.infolog_shm_id, c.infolog_shm_offset, bufsize);
|
| if (infolog == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1093,13 +1054,18 @@
|
| return parse_error::kParseNoError;
|
| }
|
| GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
|
| - GLsizei* length = GetSharedMemoryAs<GLsizei*>(
|
| - 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 */);
|
| - if (length == NULL) {
|
| - return parse_error::kParseOutOfBounds;
|
| + uint32 size_shm_id = c.length_shm_id;
|
| + uint32 size_shm_offset = c.length_shm_offset;
|
| + GLsizei* length = NULL;
|
| + if (size_shm_id != 0 || size_shm_offset != 0) {
|
| + length = GetSharedMemoryAs<GLsizei*>(
|
| + size_shm_id, size_shm_offset, sizeof(*length));
|
| + if (!length) {
|
| + return parse_error::kParseOutOfBounds;
|
| + }
|
| }
|
| + char* source = GetSharedMemoryAs<char*>(
|
| + c.source_shm_id, c.source_shm_offset, bufsize);
|
| if (source == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1327,7 +1293,7 @@
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| }
|
| - glLinkProgram(program);
|
| + DoLinkProgram(program);
|
| return parse_error::kParseNoError;
|
| }
|
|
|
| @@ -1493,8 +1459,10 @@
|
| uint32 immediate_data_size, const gles2::TexParameterfv& c) {
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLenum pname = static_cast<GLenum>(c.pname);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| const GLfloat* params = GetSharedMemoryAs<const GLfloat*>(
|
| - c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
|
| + c.params_shm_id, c.params_shm_offset, data_size);
|
| if (!ValidateGLenumTextureBindTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1514,7 +1482,10 @@
|
| uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) {
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLenum pname = static_cast<GLenum>(c.pname);
|
| - const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| + const GLfloat* params = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (!ValidateGLenumTextureBindTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1526,26 +1497,6 @@
|
| if (params == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<TexParameterfvImmediate>(
|
| - immediate_data_size, 1, sizeof(GLfloat), 1)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1571,8 +1522,10 @@
|
| uint32 immediate_data_size, const gles2::TexParameteriv& c) {
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLenum pname = static_cast<GLenum>(c.pname);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1);
|
| const GLint* params = GetSharedMemoryAs<const GLint*>(
|
| - c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
|
| + c.params_shm_id, c.params_shm_offset, data_size);
|
| if (!ValidateGLenumTextureBindTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1592,7 +1545,10 @@
|
| uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) {
|
| GLenum target = static_cast<GLenum>(c.target);
|
| GLenum pname = static_cast<GLenum>(c.pname);
|
| - const GLint* params = GetImmediateDataAs<const GLint*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1);
|
| + const GLint* params = GetImmediateDataAs<const GLint*>(
|
| + c, data_size, immediate_data_size);
|
| if (!ValidateGLenumTextureBindTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1604,26 +1560,6 @@
|
| if (params == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<TexParameterivImmediate>(
|
| - immediate_data_size, 1, sizeof(GLint), 1)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1638,12 +1574,10 @@
|
| GLsizei height = static_cast<GLsizei>(c.height);
|
| GLenum format = static_cast<GLenum>(c.format);
|
| GLenum type = static_cast<GLenum>(c.type);
|
| - uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id);
|
| - uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset);
|
| - uint32 pixels_size = GLES2Util::ComputeImageDataSize(
|
| + uint32 data_size = GLES2Util::ComputeImageDataSize(
|
| width, height, format, type, unpack_alignment_);
|
| const void* pixels = GetSharedMemoryAs<const void*>(
|
| - pixels_shm_id, pixels_shm_offset, pixels_size);
|
| + c.pixels_shm_id, c.pixels_shm_offset, data_size);
|
| if (!ValidateGLenumTextureTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1674,7 +1608,10 @@
|
| GLsizei height = static_cast<GLsizei>(c.height);
|
| GLenum format = static_cast<GLenum>(c.format);
|
| GLenum type = static_cast<GLenum>(c.type);
|
| - const void* pixels = GetImmediateDataAs<const void*>(c);
|
| + uint32 data_size = GLES2Util::ComputeImageDataSize(
|
| + width, height, format, type, unpack_alignment_);
|
| + const void* pixels = GetImmediateDataAs<const void*>(
|
| + c, data_size, immediate_data_size);
|
| if (!ValidateGLenumTextureTarget(target)) {
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| @@ -1690,22 +1627,6 @@
|
| if (pixels == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - // Immediate version.
|
| - 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;
|
| @@ -1723,8 +1644,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform1fv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1736,22 +1659,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| + const GLfloat* v = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform1fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 1)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1768,8 +1682,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform1iv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1);
|
| const GLint* v = GetSharedMemoryAs<const GLint*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1781,22 +1697,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLint* v = GetImmediateDataAs<const GLint*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1);
|
| + const GLint* v = GetImmediateDataAs<const GLint*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform1ivImmediate>(
|
| - immediate_data_size, count, sizeof(GLint), 1)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1814,8 +1721,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform2fv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2);
|
| const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1827,22 +1736,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2);
|
| + const GLfloat* v = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform2fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 2)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1860,8 +1760,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform2iv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 2);
|
| const GLint* v = GetSharedMemoryAs<const GLint*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1873,22 +1775,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLint* v = GetImmediateDataAs<const GLint*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 2);
|
| + const GLint* v = GetImmediateDataAs<const GLint*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform2ivImmediate>(
|
| - immediate_data_size, count, sizeof(GLint), 2)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1907,8 +1800,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform3fv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3);
|
| const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1920,22 +1815,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3);
|
| + const GLfloat* v = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform3fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 3)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -1954,8 +1840,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform3iv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 3);
|
| const GLint* v = GetSharedMemoryAs<const GLint*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -1967,22 +1855,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLint* v = GetImmediateDataAs<const GLint*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 3);
|
| + const GLint* v = GetImmediateDataAs<const GLint*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform3ivImmediate>(
|
| - immediate_data_size, count, sizeof(GLint), 3)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2002,8 +1881,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform4fv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2015,22 +1896,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| + const GLfloat* v = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform4fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 4)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2050,8 +1922,10 @@
|
| uint32 immediate_data_size, const gles2::Uniform4iv& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 4);
|
| const GLint* v = GetSharedMemoryAs<const GLint*>(
|
| - c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
|
| + c.v_shm_id, c.v_shm_offset, data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2063,22 +1937,13 @@
|
| uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) {
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| - const GLint* v = GetImmediateDataAs<const GLint*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 4);
|
| + const GLint* v = GetImmediateDataAs<const GLint*>(
|
| + c, data_size, immediate_data_size);
|
| if (v == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<Uniform4ivImmediate>(
|
| - immediate_data_size, count, sizeof(GLint), 4)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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,8 +1953,10 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
|
| - c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
|
| + c.value_shm_id, c.value_shm_offset, data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2102,22 +1969,13 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| - const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| + const GLfloat* value = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 4)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2127,8 +1985,10 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 9);
|
| const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
|
| - c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
|
| + c.value_shm_id, c.value_shm_offset, data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2141,22 +2001,13 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| - const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 9);
|
| + const GLfloat* value = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 9)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2166,8 +2017,10 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 16);
|
| const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
|
| - c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
|
| + c.value_shm_id, c.value_shm_offset, data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2180,22 +2033,13 @@
|
| GLint location = static_cast<GLint>(c.location);
|
| GLsizei count = static_cast<GLsizei>(c.count);
|
| GLboolean transpose = static_cast<GLboolean>(c.transpose);
|
| - const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 16);
|
| + const GLfloat* value = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (value == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>(
|
| - immediate_data_size, count, sizeof(GLfloat), 16)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2207,7 +2051,7 @@
|
| SetGLError(GL_INVALID_VALUE);
|
| return parse_error::kParseNoError;
|
| }
|
| - glUseProgram(program);
|
| + DoUseProgram(program);
|
| return parse_error::kParseNoError;
|
| }
|
|
|
| @@ -2233,8 +2077,10 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv(
|
| uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
|
| - c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
|
| + c.values_shm_id, c.values_shm_offset, data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2245,22 +2091,13 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate(
|
| uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| - const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1);
|
| + const GLfloat* values = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>(
|
| - immediate_data_size, 1, sizeof(GLfloat), 1)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2277,8 +2114,10 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv(
|
| uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2);
|
| const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
|
| - c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
|
| + c.values_shm_id, c.values_shm_offset, data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2289,22 +2128,13 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate(
|
| uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| - const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2);
|
| + const GLfloat* values = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>(
|
| - immediate_data_size, 1, sizeof(GLfloat), 2)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2322,8 +2152,10 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv(
|
| uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3);
|
| const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
|
| - c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
|
| + c.values_shm_id, c.values_shm_offset, data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2334,22 +2166,13 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate(
|
| uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| - const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3);
|
| + const GLfloat* values = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>(
|
| - immediate_data_size, 1, sizeof(GLfloat), 3)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
| @@ -2368,8 +2191,10 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv(
|
| uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
|
| - c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
|
| + c.values_shm_id, c.values_shm_offset, data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| @@ -2380,22 +2205,13 @@
|
| parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate(
|
| uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) {
|
| GLuint indx = static_cast<GLuint>(c.indx);
|
| - const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
|
| + uint32 data_size =
|
| + ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4);
|
| + const GLfloat* values = GetImmediateDataAs<const GLfloat*>(
|
| + c, data_size, immediate_data_size);
|
| if (values == NULL) {
|
| return parse_error::kParseOutOfBounds;
|
| }
|
| - if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>(
|
| - immediate_data_size, 1, sizeof(GLfloat), 4)) {
|
| - return parse_error::kParseOutOfBounds;
|
| - }
|
| - // Immediate version.
|
| - 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;
|
| }
|
|
|