blob: d147a5ce8649500b2d05ac7eaba7d0f5d82cf68e [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto-generated from
// gpu/command_buffer/build_gles2_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
// clang-format -i -style=chromium filename
// DO NOT EDIT!
#include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
namespace gpu {
namespace gles2 {
error::Error GLES2DecoderPassthroughImpl::HandleActiveTexture(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ActiveTexture& c =
*static_cast<const volatile gles2::cmds::ActiveTexture*>(cmd_data);
GLenum texture = static_cast<GLenum>(c.texture);
error::Error error = DoActiveTexture(texture);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleAttachShader(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::AttachShader& c =
*static_cast<const volatile gles2::cmds::AttachShader*>(cmd_data);
GLuint program = c.program;
GLuint shader = c.shader;
error::Error error = DoAttachShader(program, shader);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindBuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BindBuffer& c =
*static_cast<const volatile gles2::cmds::BindBuffer*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint buffer = c.buffer;
error::Error error = DoBindBuffer(target, buffer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindBufferBase(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::BindBufferBase& c =
*static_cast<const volatile gles2::cmds::BindBufferBase*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint index = static_cast<GLuint>(c.index);
GLuint buffer = c.buffer;
error::Error error = DoBindBufferBase(target, index, buffer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindBufferRange(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::BindBufferRange& c =
*static_cast<const volatile gles2::cmds::BindBufferRange*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint index = static_cast<GLuint>(c.index);
GLuint buffer = c.buffer;
GLintptr offset = static_cast<GLintptr>(c.offset);
GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
error::Error error = DoBindBufferRange(target, index, buffer, offset, size);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindFramebuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BindFramebuffer& c =
*static_cast<const volatile gles2::cmds::BindFramebuffer*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint framebuffer = c.framebuffer;
error::Error error = DoBindFramebuffer(target, framebuffer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindRenderbuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BindRenderbuffer& c =
*static_cast<const volatile gles2::cmds::BindRenderbuffer*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint renderbuffer = c.renderbuffer;
error::Error error = DoBindRenderbuffer(target, renderbuffer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindSampler(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::BindSampler& c =
*static_cast<const volatile gles2::cmds::BindSampler*>(cmd_data);
GLuint unit = static_cast<GLuint>(c.unit);
GLuint sampler = c.sampler;
error::Error error = DoBindSampler(unit, sampler);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindTexture(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BindTexture& c =
*static_cast<const volatile gles2::cmds::BindTexture*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint texture = c.texture;
error::Error error = DoBindTexture(target, texture);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBindTransformFeedback(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::BindTransformFeedback& c =
*static_cast<const volatile gles2::cmds::BindTransformFeedback*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLuint transformfeedback = c.transformfeedback;
error::Error error = DoBindTransformFeedback(target, transformfeedback);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBlendColor(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BlendColor& c =
*static_cast<const volatile gles2::cmds::BlendColor*>(cmd_data);
GLclampf red = static_cast<GLclampf>(c.red);
GLclampf green = static_cast<GLclampf>(c.green);
GLclampf blue = static_cast<GLclampf>(c.blue);
GLclampf alpha = static_cast<GLclampf>(c.alpha);
error::Error error = DoBlendColor(red, green, blue, alpha);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBlendEquation(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BlendEquation& c =
*static_cast<const volatile gles2::cmds::BlendEquation*>(cmd_data);
GLenum mode = static_cast<GLenum>(c.mode);
error::Error error = DoBlendEquation(mode);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBlendEquationSeparate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BlendEquationSeparate& c =
*static_cast<const volatile gles2::cmds::BlendEquationSeparate*>(
cmd_data);
GLenum modeRGB = static_cast<GLenum>(c.modeRGB);
GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha);
error::Error error = DoBlendEquationSeparate(modeRGB, modeAlpha);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBlendFunc(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BlendFunc& c =
*static_cast<const volatile gles2::cmds::BlendFunc*>(cmd_data);
GLenum sfactor = static_cast<GLenum>(c.sfactor);
GLenum dfactor = static_cast<GLenum>(c.dfactor);
error::Error error = DoBlendFunc(sfactor, dfactor);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBlendFuncSeparate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BlendFuncSeparate& c =
*static_cast<const volatile gles2::cmds::BlendFuncSeparate*>(cmd_data);
GLenum srcRGB = static_cast<GLenum>(c.srcRGB);
GLenum dstRGB = static_cast<GLenum>(c.dstRGB);
GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha);
GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha);
error::Error error = DoBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleBufferSubData(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::BufferSubData& c =
*static_cast<const volatile gles2::cmds::BufferSubData*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLintptr offset = static_cast<GLintptr>(c.offset);
GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
uint32_t data_size = size;
const void* data = GetSharedMemoryAs<const void*>(
c.data_shm_id, c.data_shm_offset, data_size);
error::Error error = DoBufferSubData(target, offset, size, data);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCheckFramebufferStatus(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::CheckFramebufferStatus& c =
*static_cast<const volatile gles2::cmds::CheckFramebufferStatus*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
typedef cmds::CheckFramebufferStatus::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoCheckFramebufferStatus(target, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClear(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::Clear& c =
*static_cast<const volatile gles2::cmds::Clear*>(cmd_data);
GLbitfield mask = static_cast<GLbitfield>(c.mask);
error::Error error = DoClear(mask);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearBufferfi(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::ClearBufferfi& c =
*static_cast<const volatile gles2::cmds::ClearBufferfi*>(cmd_data);
GLenum buffer = static_cast<GLenum>(c.buffer);
GLint drawbuffers = static_cast<GLint>(c.drawbuffers);
GLfloat depth = static_cast<GLfloat>(c.depth);
GLint stencil = static_cast<GLint>(c.stencil);
error::Error error = DoClearBufferfi(buffer, drawbuffers, depth, stencil);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearBufferfvImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::ClearBufferfvImmediate& c =
*static_cast<const volatile gles2::cmds::ClearBufferfvImmediate*>(
cmd_data);
GLenum buffer = static_cast<GLenum>(c.buffer);
GLint drawbuffers = static_cast<GLint>(c.drawbuffers);
uint32_t value_size;
if (!GLES2Util::ComputeDataSize<GLfloat, 4>(1, &value_size)) {
return error::kOutOfBounds;
}
if (value_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLfloat* value = GetImmediateDataAs<volatile const GLfloat*>(
c, value_size, immediate_data_size);
if (value == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoClearBufferfv(buffer, drawbuffers, value);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearBufferivImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::ClearBufferivImmediate& c =
*static_cast<const volatile gles2::cmds::ClearBufferivImmediate*>(
cmd_data);
GLenum buffer = static_cast<GLenum>(c.buffer);
GLint drawbuffers = static_cast<GLint>(c.drawbuffers);
uint32_t value_size;
if (!GLES2Util::ComputeDataSize<GLint, 4>(1, &value_size)) {
return error::kOutOfBounds;
}
if (value_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLint* value = GetImmediateDataAs<volatile const GLint*>(
c, value_size, immediate_data_size);
if (value == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoClearBufferiv(buffer, drawbuffers, value);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearBufferuivImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::ClearBufferuivImmediate& c =
*static_cast<const volatile gles2::cmds::ClearBufferuivImmediate*>(
cmd_data);
GLenum buffer = static_cast<GLenum>(c.buffer);
GLint drawbuffers = static_cast<GLint>(c.drawbuffers);
uint32_t value_size;
if (!GLES2Util::ComputeDataSize<GLuint, 4>(1, &value_size)) {
return error::kOutOfBounds;
}
if (value_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLuint* value = GetImmediateDataAs<volatile const GLuint*>(
c, value_size, immediate_data_size);
if (value == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoClearBufferuiv(buffer, drawbuffers, value);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearColor(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ClearColor& c =
*static_cast<const volatile gles2::cmds::ClearColor*>(cmd_data);
GLclampf red = static_cast<GLclampf>(c.red);
GLclampf green = static_cast<GLclampf>(c.green);
GLclampf blue = static_cast<GLclampf>(c.blue);
GLclampf alpha = static_cast<GLclampf>(c.alpha);
error::Error error = DoClearColor(red, green, blue, alpha);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearDepthf(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ClearDepthf& c =
*static_cast<const volatile gles2::cmds::ClearDepthf*>(cmd_data);
GLclampf depth = static_cast<GLclampf>(c.depth);
error::Error error = DoClearDepthf(depth);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleClearStencil(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ClearStencil& c =
*static_cast<const volatile gles2::cmds::ClearStencil*>(cmd_data);
GLint s = static_cast<GLint>(c.s);
error::Error error = DoClearStencil(s);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleColorMask(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ColorMask& c =
*static_cast<const volatile gles2::cmds::ColorMask*>(cmd_data);
GLboolean red = static_cast<GLboolean>(c.red);
GLboolean green = static_cast<GLboolean>(c.green);
GLboolean blue = static_cast<GLboolean>(c.blue);
GLboolean alpha = static_cast<GLboolean>(c.alpha);
error::Error error = DoColorMask(red, green, blue, alpha);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCompileShader(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::CompileShader& c =
*static_cast<const volatile gles2::cmds::CompileShader*>(cmd_data);
GLuint shader = c.shader;
error::Error error = DoCompileShader(shader);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCopyBufferSubData(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::CopyBufferSubData& c =
*static_cast<const volatile gles2::cmds::CopyBufferSubData*>(cmd_data);
GLenum readtarget = static_cast<GLenum>(c.readtarget);
GLenum writetarget = static_cast<GLenum>(c.writetarget);
GLintptr readoffset = static_cast<GLintptr>(c.readoffset);
GLintptr writeoffset = static_cast<GLintptr>(c.writeoffset);
GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
error::Error error = DoCopyBufferSubData(readtarget, writetarget, readoffset,
writeoffset, size);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCopyTexImage2D(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::CopyTexImage2D& c =
*static_cast<const volatile gles2::cmds::CopyTexImage2D*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
GLenum internalformat = static_cast<GLenum>(c.internalformat);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
GLint border = static_cast<GLint>(c.border);
error::Error error = DoCopyTexImage2D(target, level, internalformat, x, y,
width, height, border);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCopyTexSubImage2D(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::CopyTexSubImage2D& c =
*static_cast<const volatile gles2::cmds::CopyTexSubImage2D*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
GLint xoffset = static_cast<GLint>(c.xoffset);
GLint yoffset = static_cast<GLint>(c.yoffset);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
error::Error error =
DoCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCopyTexSubImage3D(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::CopyTexSubImage3D& c =
*static_cast<const volatile gles2::cmds::CopyTexSubImage3D*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
GLint xoffset = static_cast<GLint>(c.xoffset);
GLint yoffset = static_cast<GLint>(c.yoffset);
GLint zoffset = static_cast<GLint>(c.zoffset);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
error::Error error = DoCopyTexSubImage3D(target, level, xoffset, yoffset,
zoffset, x, y, width, height);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleCullFace(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::CullFace& c =
*static_cast<const volatile gles2::cmds::CullFace*>(cmd_data);
GLenum mode = static_cast<GLenum>(c.mode);
error::Error error = DoCullFace(mode);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteBuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteBuffersImmediate& c =
*static_cast<const volatile gles2::cmds::DeleteBuffersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t buffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &buffers_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* buffers = GetImmediateDataAs<volatile const GLuint*>(
c, buffers_size, immediate_data_size);
if (buffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteBuffers(n, buffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteFramebuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteFramebuffersImmediate& c =
*static_cast<const volatile gles2::cmds::DeleteFramebuffersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t framebuffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &framebuffers_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* framebuffers =
GetImmediateDataAs<volatile const GLuint*>(c, framebuffers_size,
immediate_data_size);
if (framebuffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteFramebuffers(n, framebuffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteProgram(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteProgram& c =
*static_cast<const volatile gles2::cmds::DeleteProgram*>(cmd_data);
GLuint program = c.program;
error::Error error = DoDeleteProgram(program);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteRenderbuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteRenderbuffersImmediate& c =
*static_cast<const volatile gles2::cmds::DeleteRenderbuffersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t renderbuffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &renderbuffers_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* renderbuffers =
GetImmediateDataAs<volatile const GLuint*>(c, renderbuffers_size,
immediate_data_size);
if (renderbuffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteRenderbuffers(n, renderbuffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteSamplersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::DeleteSamplersImmediate& c =
*static_cast<const volatile gles2::cmds::DeleteSamplersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t samplers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &samplers_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* samplers = GetImmediateDataAs<volatile const GLuint*>(
c, samplers_size, immediate_data_size);
if (samplers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteSamplers(n, samplers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteSync(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::DeleteSync& c =
*static_cast<const volatile gles2::cmds::DeleteSync*>(cmd_data);
GLuint sync = c.sync;
error::Error error = DoDeleteSync(sync);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteShader(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteShader& c =
*static_cast<const volatile gles2::cmds::DeleteShader*>(cmd_data);
GLuint shader = c.shader;
error::Error error = DoDeleteShader(shader);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDeleteTexturesImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DeleteTexturesImmediate& c =
*static_cast<const volatile gles2::cmds::DeleteTexturesImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t textures_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &textures_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* textures = GetImmediateDataAs<volatile const GLuint*>(
c, textures_size, immediate_data_size);
if (textures == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteTextures(n, textures);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error
GLES2DecoderPassthroughImpl::HandleDeleteTransformFeedbacksImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::DeleteTransformFeedbacksImmediate& c =
*static_cast<
const volatile gles2::cmds::DeleteTransformFeedbacksImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t ids_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &ids_size)) {
return error::kOutOfBounds;
}
volatile const GLuint* ids = GetImmediateDataAs<volatile const GLuint*>(
c, ids_size, immediate_data_size);
if (ids == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoDeleteTransformFeedbacks(n, ids);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDepthFunc(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DepthFunc& c =
*static_cast<const volatile gles2::cmds::DepthFunc*>(cmd_data);
GLenum func = static_cast<GLenum>(c.func);
error::Error error = DoDepthFunc(func);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDepthMask(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DepthMask& c =
*static_cast<const volatile gles2::cmds::DepthMask*>(cmd_data);
GLboolean flag = static_cast<GLboolean>(c.flag);
error::Error error = DoDepthMask(flag);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDepthRangef(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DepthRangef& c =
*static_cast<const volatile gles2::cmds::DepthRangef*>(cmd_data);
GLclampf zNear = static_cast<GLclampf>(c.zNear);
GLclampf zFar = static_cast<GLclampf>(c.zFar);
error::Error error = DoDepthRangef(zNear, zFar);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDetachShader(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DetachShader& c =
*static_cast<const volatile gles2::cmds::DetachShader*>(cmd_data);
GLuint program = c.program;
GLuint shader = c.shader;
error::Error error = DoDetachShader(program, shader);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDisable(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::Disable& c =
*static_cast<const volatile gles2::cmds::Disable*>(cmd_data);
GLenum cap = static_cast<GLenum>(c.cap);
error::Error error = DoDisable(cap);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleDisableVertexAttribArray(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::DisableVertexAttribArray& c =
*static_cast<const volatile gles2::cmds::DisableVertexAttribArray*>(
cmd_data);
GLuint index = static_cast<GLuint>(c.index);
error::Error error = DoDisableVertexAttribArray(index);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleEnable(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::Enable& c =
*static_cast<const volatile gles2::cmds::Enable*>(cmd_data);
GLenum cap = static_cast<GLenum>(c.cap);
error::Error error = DoEnable(cap);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleEnableVertexAttribArray(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::EnableVertexAttribArray& c =
*static_cast<const volatile gles2::cmds::EnableVertexAttribArray*>(
cmd_data);
GLuint index = static_cast<GLuint>(c.index);
error::Error error = DoEnableVertexAttribArray(index);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFinish(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
error::Error error = DoFinish();
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFlush(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
error::Error error = DoFlush();
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFramebufferRenderbuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::FramebufferRenderbuffer& c =
*static_cast<const volatile gles2::cmds::FramebufferRenderbuffer*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum attachment = static_cast<GLenum>(c.attachment);
GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget);
GLuint renderbuffer = c.renderbuffer;
error::Error error = DoFramebufferRenderbuffer(
target, attachment, renderbuffertarget, renderbuffer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFramebufferTexture2D(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::FramebufferTexture2D& c =
*static_cast<const volatile gles2::cmds::FramebufferTexture2D*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum attachment = static_cast<GLenum>(c.attachment);
GLenum textarget = static_cast<GLenum>(c.textarget);
GLuint texture = c.texture;
GLint level = static_cast<GLint>(c.level);
error::Error error =
DoFramebufferTexture2D(target, attachment, textarget, texture, level);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFramebufferTextureLayer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::FramebufferTextureLayer& c =
*static_cast<const volatile gles2::cmds::FramebufferTextureLayer*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum attachment = static_cast<GLenum>(c.attachment);
GLuint texture = c.texture;
GLint level = static_cast<GLint>(c.level);
GLint layer = static_cast<GLint>(c.layer);
error::Error error =
DoFramebufferTextureLayer(target, attachment, texture, level, layer);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleFrontFace(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::FrontFace& c =
*static_cast<const volatile gles2::cmds::FrontFace*>(cmd_data);
GLenum mode = static_cast<GLenum>(c.mode);
error::Error error = DoFrontFace(mode);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenBuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GenBuffersImmediate& c =
*static_cast<const volatile gles2::cmds::GenBuffersImmediate*>(cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t buffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &buffers_size)) {
return error::kOutOfBounds;
}
volatile GLuint* buffers = GetImmediateDataAs<volatile GLuint*>(
c, buffers_size, immediate_data_size);
if (buffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenBuffers(n, buffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenerateMipmap(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GenerateMipmap& c =
*static_cast<const volatile gles2::cmds::GenerateMipmap*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
error::Error error = DoGenerateMipmap(target);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenFramebuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GenFramebuffersImmediate& c =
*static_cast<const volatile gles2::cmds::GenFramebuffersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t framebuffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &framebuffers_size)) {
return error::kOutOfBounds;
}
volatile GLuint* framebuffers = GetImmediateDataAs<volatile GLuint*>(
c, framebuffers_size, immediate_data_size);
if (framebuffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenFramebuffers(n, framebuffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenRenderbuffersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GenRenderbuffersImmediate& c =
*static_cast<const volatile gles2::cmds::GenRenderbuffersImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t renderbuffers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &renderbuffers_size)) {
return error::kOutOfBounds;
}
volatile GLuint* renderbuffers = GetImmediateDataAs<volatile GLuint*>(
c, renderbuffers_size, immediate_data_size);
if (renderbuffers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenRenderbuffers(n, renderbuffers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenSamplersImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GenSamplersImmediate& c =
*static_cast<const volatile gles2::cmds::GenSamplersImmediate*>(cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t samplers_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &samplers_size)) {
return error::kOutOfBounds;
}
volatile GLuint* samplers = GetImmediateDataAs<volatile GLuint*>(
c, samplers_size, immediate_data_size);
if (samplers == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenSamplers(n, samplers);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenTexturesImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GenTexturesImmediate& c =
*static_cast<const volatile gles2::cmds::GenTexturesImmediate*>(cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t textures_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &textures_size)) {
return error::kOutOfBounds;
}
volatile GLuint* textures = GetImmediateDataAs<volatile GLuint*>(
c, textures_size, immediate_data_size);
if (textures == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenTextures(n, textures);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGenTransformFeedbacksImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GenTransformFeedbacksImmediate& c =
*static_cast<const volatile gles2::cmds::GenTransformFeedbacksImmediate*>(
cmd_data);
GLsizei n = static_cast<GLsizei>(c.n);
uint32_t ids_size;
if (!SafeMultiplyUint32(n, sizeof(GLuint), &ids_size)) {
return error::kOutOfBounds;
}
volatile GLuint* ids =
GetImmediateDataAs<volatile GLuint*>(c, ids_size, immediate_data_size);
if (ids == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoGenTransformFeedbacks(n, ids);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetBooleanv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetBooleanv& c =
*static_cast<const volatile gles2::cmds::GetBooleanv*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetBooleanv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLboolean* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetBooleanv(pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetBufferParameteri64v(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetBufferParameteri64v& c =
*static_cast<const volatile gles2::cmds::GetBufferParameteri64v*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetBufferParameteri64v::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint64* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetBufferParameteri64v(target, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetBufferParameteriv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetBufferParameteriv& c =
*static_cast<const volatile gles2::cmds::GetBufferParameteriv*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetBufferParameteriv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetBufferParameteriv(target, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetError(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetError& c =
*static_cast<const volatile gles2::cmds::GetError*>(cmd_data);
typedef cmds::GetError::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoGetError(result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetFloatv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetFloatv& c =
*static_cast<const volatile gles2::cmds::GetFloatv*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetFloatv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLfloat* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetFloatv(pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error
GLES2DecoderPassthroughImpl::HandleGetFramebufferAttachmentParameteriv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetFramebufferAttachmentParameteriv& c =
*static_cast<
const volatile gles2::cmds::GetFramebufferAttachmentParameteriv*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum attachment = static_cast<GLenum>(c.attachment);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetFramebufferAttachmentParameteriv(
target, attachment, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetInteger64v(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetInteger64v& c =
*static_cast<const volatile gles2::cmds::GetInteger64v*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetInteger64v::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint64* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetInteger64v(pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetIntegeri_v(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetIntegeri_v& c =
*static_cast<const volatile gles2::cmds::GetIntegeri_v*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
GLuint index = static_cast<GLuint>(c.index);
unsigned int buffer_size = 0;
typedef cmds::GetIntegeri_v::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.data_shm_id, c.data_shm_offset, sizeof(Result), &buffer_size);
GLint* data = result ? result->GetData() : nullptr;
if (data == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetIntegeri_v(pname, index, bufsize, length, data);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetInteger64i_v(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetInteger64i_v& c =
*static_cast<const volatile gles2::cmds::GetInteger64i_v*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
GLuint index = static_cast<GLuint>(c.index);
unsigned int buffer_size = 0;
typedef cmds::GetInteger64i_v::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.data_shm_id, c.data_shm_offset, sizeof(Result), &buffer_size);
GLint64* data = result ? result->GetData() : nullptr;
if (data == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetInteger64i_v(pname, index, bufsize, length, data);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetIntegerv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetIntegerv& c =
*static_cast<const volatile gles2::cmds::GetIntegerv*>(cmd_data);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetIntegerv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetIntegerv(pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetProgramiv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetProgramiv& c =
*static_cast<const volatile gles2::cmds::GetProgramiv*>(cmd_data);
GLuint program = c.program;
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetProgramiv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetProgramiv(program, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetRenderbufferParameteriv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetRenderbufferParameteriv& c =
*static_cast<const volatile gles2::cmds::GetRenderbufferParameteriv*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetRenderbufferParameteriv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetRenderbufferParameteriv(target, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetSamplerParameterfv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetSamplerParameterfv& c =
*static_cast<const volatile gles2::cmds::GetSamplerParameterfv*>(
cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetSamplerParameterfv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLfloat* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetSamplerParameterfv(sampler, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetSamplerParameteriv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetSamplerParameteriv& c =
*static_cast<const volatile gles2::cmds::GetSamplerParameteriv*>(
cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetSamplerParameteriv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetSamplerParameteriv(sampler, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetShaderiv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetShaderiv& c =
*static_cast<const volatile gles2::cmds::GetShaderiv*>(cmd_data);
GLuint shader = c.shader;
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetShaderiv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetShaderiv(shader, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetSynciv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetSynciv& c =
*static_cast<const volatile gles2::cmds::GetSynciv*>(cmd_data);
GLuint sync = static_cast<GLuint>(c.sync);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetSynciv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.values_shm_id, c.values_shm_offset, sizeof(Result), &buffer_size);
GLint* values = result ? result->GetData() : nullptr;
if (values == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error = DoGetSynciv(sync, pname, bufsize, length, values);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetTexParameterfv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetTexParameterfv& c =
*static_cast<const volatile gles2::cmds::GetTexParameterfv*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetTexParameterfv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLfloat* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetTexParameterfv(target, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetTexParameteriv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetTexParameteriv& c =
*static_cast<const volatile gles2::cmds::GetTexParameteriv*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetTexParameteriv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetTexParameteriv(target, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetVertexAttribfv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetVertexAttribfv& c =
*static_cast<const volatile gles2::cmds::GetVertexAttribfv*>(cmd_data);
GLuint index = static_cast<GLuint>(c.index);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetVertexAttribfv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLfloat* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetVertexAttribfv(index, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetVertexAttribiv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetVertexAttribiv& c =
*static_cast<const volatile gles2::cmds::GetVertexAttribiv*>(cmd_data);
GLuint index = static_cast<GLuint>(c.index);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetVertexAttribiv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetVertexAttribiv(index, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetVertexAttribIiv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetVertexAttribIiv& c =
*static_cast<const volatile gles2::cmds::GetVertexAttribIiv*>(cmd_data);
GLuint index = static_cast<GLuint>(c.index);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetVertexAttribIiv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetVertexAttribIiv(index, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleGetVertexAttribIuiv(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::GetVertexAttribIuiv& c =
*static_cast<const volatile gles2::cmds::GetVertexAttribIuiv*>(cmd_data);
GLuint index = static_cast<GLuint>(c.index);
GLenum pname = static_cast<GLenum>(c.pname);
unsigned int buffer_size = 0;
typedef cmds::GetVertexAttribIuiv::Result Result;
Result* result = GetSharedMemoryAndSizeAs<Result*>(
c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size);
GLuint* params = result ? result->GetData() : nullptr;
if (params == nullptr) {
return error::kOutOfBounds;
}
GLsizei bufsize = Result::ComputeMaxResults(buffer_size);
GLsizei written_values = 0;
GLsizei* length = &written_values;
error::Error error =
DoGetVertexAttribIuiv(index, pname, bufsize, length, params);
if (error != error::kNoError) {
return error;
}
if (written_values > bufsize) {
return error::kOutOfBounds;
}
result->SetNumResults(written_values);
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleHint(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::Hint& c =
*static_cast<const volatile gles2::cmds::Hint*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum mode = static_cast<GLenum>(c.mode);
error::Error error = DoHint(target, mode);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleInvalidateFramebufferImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::InvalidateFramebufferImmediate& c =
*static_cast<const volatile gles2::cmds::InvalidateFramebufferImmediate*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLsizei count = static_cast<GLsizei>(c.count);
uint32_t attachments_size = 0;
if (count >= 0 &&
!GLES2Util::ComputeDataSize<GLenum, 1>(count, &attachments_size)) {
return error::kOutOfBounds;
}
if (attachments_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLenum* attachments =
GetImmediateDataAs<volatile const GLenum*>(c, attachments_size,
immediate_data_size);
if (attachments == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoInvalidateFramebuffer(target, count, attachments);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error
GLES2DecoderPassthroughImpl::HandleInvalidateSubFramebufferImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::InvalidateSubFramebufferImmediate& c =
*static_cast<
const volatile gles2::cmds::InvalidateSubFramebufferImmediate*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLsizei count = static_cast<GLsizei>(c.count);
uint32_t attachments_size = 0;
if (count >= 0 &&
!GLES2Util::ComputeDataSize<GLenum, 1>(count, &attachments_size)) {
return error::kOutOfBounds;
}
if (attachments_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLenum* attachments =
GetImmediateDataAs<volatile const GLenum*>(c, attachments_size,
immediate_data_size);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
if (attachments == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoInvalidateSubFramebuffer(target, count, attachments, x,
y, width, height);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsBuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsBuffer& c =
*static_cast<const volatile gles2::cmds::IsBuffer*>(cmd_data);
GLuint buffer = c.buffer;
typedef cmds::IsBuffer::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsBuffer(buffer, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsEnabled(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsEnabled& c =
*static_cast<const volatile gles2::cmds::IsEnabled*>(cmd_data);
GLenum cap = static_cast<GLenum>(c.cap);
typedef cmds::IsEnabled::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsEnabled(cap, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsFramebuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsFramebuffer& c =
*static_cast<const volatile gles2::cmds::IsFramebuffer*>(cmd_data);
GLuint framebuffer = c.framebuffer;
typedef cmds::IsFramebuffer::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsFramebuffer(framebuffer, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsProgram(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsProgram& c =
*static_cast<const volatile gles2::cmds::IsProgram*>(cmd_data);
GLuint program = c.program;
typedef cmds::IsProgram::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsProgram(program, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsRenderbuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsRenderbuffer& c =
*static_cast<const volatile gles2::cmds::IsRenderbuffer*>(cmd_data);
GLuint renderbuffer = c.renderbuffer;
typedef cmds::IsRenderbuffer::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsRenderbuffer(renderbuffer, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsSampler(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::IsSampler& c =
*static_cast<const volatile gles2::cmds::IsSampler*>(cmd_data);
GLuint sampler = c.sampler;
typedef cmds::IsSampler::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsSampler(sampler, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsShader(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsShader& c =
*static_cast<const volatile gles2::cmds::IsShader*>(cmd_data);
GLuint shader = c.shader;
typedef cmds::IsShader::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsShader(shader, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsSync(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::IsSync& c =
*static_cast<const volatile gles2::cmds::IsSync*>(cmd_data);
GLuint sync = c.sync;
typedef cmds::IsSync::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsSync(sync, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsTexture(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::IsTexture& c =
*static_cast<const volatile gles2::cmds::IsTexture*>(cmd_data);
GLuint texture = c.texture;
typedef cmds::IsTexture::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsTexture(texture, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleIsTransformFeedback(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::IsTransformFeedback& c =
*static_cast<const volatile gles2::cmds::IsTransformFeedback*>(cmd_data);
GLuint transformfeedback = c.transformfeedback;
typedef cmds::IsTransformFeedback::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
error::Error error = DoIsTransformFeedback(transformfeedback, result);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleLineWidth(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::LineWidth& c =
*static_cast<const volatile gles2::cmds::LineWidth*>(cmd_data);
GLfloat width = static_cast<GLfloat>(c.width);
error::Error error = DoLineWidth(width);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleLinkProgram(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::LinkProgram& c =
*static_cast<const volatile gles2::cmds::LinkProgram*>(cmd_data);
GLuint program = c.program;
error::Error error = DoLinkProgram(program);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandlePauseTransformFeedback(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
error::Error error = DoPauseTransformFeedback();
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandlePolygonOffset(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::PolygonOffset& c =
*static_cast<const volatile gles2::cmds::PolygonOffset*>(cmd_data);
GLfloat factor = static_cast<GLfloat>(c.factor);
GLfloat units = static_cast<GLfloat>(c.units);
error::Error error = DoPolygonOffset(factor, units);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleReadBuffer(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::ReadBuffer& c =
*static_cast<const volatile gles2::cmds::ReadBuffer*>(cmd_data);
GLenum src = static_cast<GLenum>(c.src);
error::Error error = DoReadBuffer(src);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleReleaseShaderCompiler(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
error::Error error = DoReleaseShaderCompiler();
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleRenderbufferStorage(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::RenderbufferStorage& c =
*static_cast<const volatile gles2::cmds::RenderbufferStorage*>(cmd_data);
GLenum target = static_cast<GLenum>(c.target);
GLenum internalformat = static_cast<GLenum>(c.internalformat);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
error::Error error =
DoRenderbufferStorage(target, internalformat, width, height);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleResumeTransformFeedback(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
error::Error error = DoResumeTransformFeedback();
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleSampleCoverage(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::SampleCoverage& c =
*static_cast<const volatile gles2::cmds::SampleCoverage*>(cmd_data);
GLclampf value = static_cast<GLclampf>(c.value);
GLboolean invert = static_cast<GLboolean>(c.invert);
error::Error error = DoSampleCoverage(value, invert);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleSamplerParameterf(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::SamplerParameterf& c =
*static_cast<const volatile gles2::cmds::SamplerParameterf*>(cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
GLfloat param = static_cast<GLfloat>(c.param);
error::Error error = DoSamplerParameterf(sampler, pname, param);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleSamplerParameterfvImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::SamplerParameterfvImmediate& c =
*static_cast<const volatile gles2::cmds::SamplerParameterfvImmediate*>(
cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
uint32_t params_size;
if (!GLES2Util::ComputeDataSize<GLfloat, 1>(1, &params_size)) {
return error::kOutOfBounds;
}
if (params_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLfloat* params = GetImmediateDataAs<volatile const GLfloat*>(
c, params_size, immediate_data_size);
if (params == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoSamplerParameterfv(sampler, pname, params);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleSamplerParameteri(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::SamplerParameteri& c =
*static_cast<const volatile gles2::cmds::SamplerParameteri*>(cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
GLint param = static_cast<GLint>(c.param);
error::Error error = DoSamplerParameteri(sampler, pname, param);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleSamplerParameterivImmediate(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
if (!feature_info_->IsWebGL2OrES3OrHigherContext())
return error::kUnknownCommand;
const volatile gles2::cmds::SamplerParameterivImmediate& c =
*static_cast<const volatile gles2::cmds::SamplerParameterivImmediate*>(
cmd_data);
GLuint sampler = c.sampler;
GLenum pname = static_cast<GLenum>(c.pname);
uint32_t params_size;
if (!GLES2Util::ComputeDataSize<GLint, 1>(1, &params_size)) {
return error::kOutOfBounds;
}
if (params_size > immediate_data_size) {
return error::kOutOfBounds;
}
volatile const GLint* params = GetImmediateDataAs<volatile const GLint*>(
c, params_size, immediate_data_size);
if (params == nullptr) {
return error::kOutOfBounds;
}
error::Error error = DoSamplerParameteriv(sampler, pname, params);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleScissor(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::Scissor& c =
*static_cast<const volatile gles2::cmds::Scissor*>(cmd_data);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
error::Error error = DoScissor(x, y, width, height);
if (error != error::kNoError) {
return error;
}
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::HandleShaderSourceBucket(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::ShaderSourceBucket& c =
*static_cast<const volatile gles2::cmds::ShaderSourceBucket*>(cmd_data);
GLuint shader = static_cast<GLuint>(c.shader);
Bucket* bucket = GetBucket(c.str_bucket_id);
if (!bucket) {
return error::kInvalidArguments;
}
GLsizei count = 0;
std::vector<char*> strs;
std::vector<GLint> len;