| Index: command_buffer/service/cross/gapi_decoder.cc
|
| ===================================================================
|
| --- command_buffer/service/cross/gapi_decoder.cc (revision 26638)
|
| +++ command_buffer/service/cross/gapi_decoder.cc (working copy)
|
| @@ -43,30 +43,32 @@
|
|
|
| namespace {
|
|
|
| +// Returns the address of the first byte after a struct.
|
| template <typename T>
|
| const void* AddressAfterStruct(const T& pod) {
|
| return reinterpret_cast<const uint8*>(&pod) + sizeof(pod);
|
| }
|
|
|
| +// Returns the size in bytes of the data of an Immediate command, a command with
|
| +// its data inline in the command buffer.
|
| template <typename T>
|
| -unsigned int ImmediateSize(uint32 arg_count, const T& pod) {
|
| - return (arg_count - sizeof(pod) / sizeof(uint32)) * sizeof(uint32);
|
| +unsigned int ImmediateDataSize(uint32 arg_count, const T& pod) {
|
| + return static_cast<unsigned int>(
|
| + (arg_count + 1 - ComputeNumEntries(sizeof(pod))) *
|
| + sizeof(CommandBufferEntry)); // NOLINT
|
| }
|
|
|
| -// TODO(gman): Remove this.
|
| -CommandBufferEntry* TempHack(const void* foo) {
|
| - return reinterpret_cast<CommandBufferEntry*>(const_cast<void*>(foo));
|
| -}
|
| -
|
| +// A struct to hold info about each command.
|
| struct CommandInfo {
|
| - int arg_flags;
|
| - int arg_count;
|
| + int arg_flags; // How to handle the arguments for this command
|
| + int arg_count; // How many arguments are expected for this command.
|
| };
|
|
|
| +// A table of CommandInfo for all the commands.
|
| const CommandInfo g_command_info[] = {
|
| - #define O3D_COMMAND_BUFFER_CMD_OP(name) { \
|
| - cmd::name::kArgFlags, \
|
| - sizeof(cmd::name) / sizeof(uint32), }, \
|
| + #define O3D_COMMAND_BUFFER_CMD_OP(name) { \
|
| + cmd::name::kArgFlags, \
|
| + sizeof(cmd::name) / sizeof(CommandBufferEntry) - 1, }, /* NOLINT */ \
|
|
|
| O3D_COMMAND_BUFFER_CMDS
|
|
|
| @@ -83,357 +85,30 @@
|
| BufferSyncInterface::ParseError GAPIDecoder::DoCommand(
|
| unsigned int command,
|
| unsigned int arg_count,
|
| - const void* args) {
|
| + const void* cmd_data) {
|
| if (command < arraysize(g_command_info)) {
|
| const CommandInfo& info = g_command_info[command];
|
| - unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
|
| + unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
|
| if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) ||
|
| (info.arg_flags == cmd::kAtLeastN && arg_count > info_arg_count)) {
|
| switch (command) {
|
| #define O3D_COMMAND_BUFFER_CMD_OP(name) \
|
| case cmd::name::kCmdId: \
|
| - return Handle_ ## name( \
|
| + return Handle ## name( \
|
| arg_count, \
|
| - *static_cast<const cmd::name*>(args)); \
|
| + *static_cast<const cmd::name*>(cmd_data)); \
|
|
|
| O3D_COMMAND_BUFFER_CMDS
|
|
|
| #undef O3D_COMMAND_BUFFER_CMD_OP
|
| }
|
| } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| }
|
| }
|
| - return BufferSyncInterface::PARSE_UNKNOWN_COMMAND;
|
| + return BufferSyncInterface::kParseUnknownCommand;
|
| }
|
|
|
| -
|
| -// Decodes the SET_VERTEX_INPUT command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetVertexInput(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - namespace cmd = set_vertex_input_cmd;
|
| - if (arg_count != 5) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - ResourceID vertex_struct_id = args[0].value_uint32;
|
| - unsigned int input_index = args[1].value_uint32;
|
| - ResourceID vertex_buffer_id = args[2].value_uint32;
|
| - unsigned int offset = args[3].value_uint32;
|
| - unsigned int type_stride_semantic = args[4].value_uint32;
|
| - unsigned int semantic_index = cmd::SemanticIndex::Get(type_stride_semantic);
|
| - unsigned int semantic = cmd::Semantic::Get(type_stride_semantic);
|
| - unsigned int type = cmd::Type::Get(type_stride_semantic);
|
| - unsigned int stride = cmd::Stride::Get(type_stride_semantic);
|
| - if (semantic >= vertex_struct::NUM_SEMANTICS ||
|
| - type >= vertex_struct::NUM_TYPES || stride == 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - return gapi_->SetVertexInput(vertex_struct_id, input_index, vertex_buffer_id,
|
| - offset, stride,
|
| - static_cast<vertex_struct::Type>(type),
|
| - static_cast<vertex_struct::Semantic>(semantic),
|
| - semantic_index);
|
| -}
|
| -
|
| -// Decodes the CREATE_TEXTURE_2D command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTexture2D(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count == 3) {
|
| - namespace cmd = create_texture_2d_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int width_height = args[1].value_uint32;
|
| - unsigned int levels_format_flags = args[2].value_uint32;
|
| - unsigned int width = cmd::Width::Get(width_height);
|
| - unsigned int height = cmd::Height::Get(width_height);
|
| - unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| - unsigned int unused = cmd::Unused::Get(levels_format_flags);
|
| - unsigned int format = cmd::Format::Get(levels_format_flags);
|
| - unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| - unsigned int max_levels =
|
| - 1 + base::bits::Log2Ceiling(std::max(width, height));
|
| - if ((width == 0) || (height == 0) || (levels > max_levels) ||
|
| - (unused != 0) || (format >= texture::NUM_FORMATS))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - if (levels == 0) levels = max_levels;
|
| - bool enable_render_surfaces = !!flags;
|
| - return gapi_->CreateTexture2D(id, width, height, levels,
|
| - static_cast<texture::Format>(format), flags,
|
| - enable_render_surfaces);
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the CREATE_TEXTURE_3D command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTexture3D(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count == 4) {
|
| - namespace cmd = create_texture_3d_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int width_height = args[1].value_uint32;
|
| - unsigned int depth_unused = args[2].value_uint32;
|
| - unsigned int levels_format_flags = args[3].value_uint32;
|
| - unsigned int width = cmd::Width::Get(width_height);
|
| - unsigned int height = cmd::Height::Get(width_height);
|
| - unsigned int depth = cmd::Depth::Get(depth_unused);
|
| - unsigned int unused1 = cmd::Unused1::Get(depth_unused);
|
| - unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| - unsigned int unused2 = cmd::Unused2::Get(levels_format_flags);
|
| - unsigned int format = cmd::Format::Get(levels_format_flags);
|
| - unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| - unsigned int max_levels =
|
| - 1 + base::bits::Log2Ceiling(std::max(depth, std::max(width, height)));
|
| - if ((width == 0) || (height == 0) || (depth == 0) ||
|
| - (levels > max_levels) || (unused1 != 0) || (unused2 != 0) ||
|
| - (format >= texture::NUM_FORMATS))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - if (levels == 0) levels = max_levels;
|
| - bool enable_render_surfaces = !!flags;
|
| - return gapi_->CreateTexture3D(id, width, height, depth, levels,
|
| - static_cast<texture::Format>(format), flags,
|
| - enable_render_surfaces);
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the CREATE_TEXTURE_CUBE command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTextureCube(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count == 3) {
|
| - namespace cmd = create_texture_cube_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int side_unused = args[1].value_uint32;
|
| - unsigned int levels_format_flags = args[2].value_uint32;
|
| - unsigned int side = cmd::Side::Get(side_unused);
|
| - unsigned int unused1 = cmd::Unused1::Get(side_unused);
|
| - unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| - unsigned int unused2 = cmd::Unused2::Get(levels_format_flags);
|
| - unsigned int format = cmd::Format::Get(levels_format_flags);
|
| - unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| - unsigned int max_levels = 1 + base::bits::Log2Ceiling(side);
|
| - if ((side == 0) || (levels > max_levels) || (unused1 != 0) ||
|
| - (unused2 != 0) || (format >= texture::NUM_FORMATS))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - if (levels == 0) levels = max_levels;
|
| - bool enable_render_surfaces = !!flags;
|
| - return gapi_->CreateTextureCube(id, side, levels,
|
| - static_cast<texture::Format>(format),
|
| - flags, enable_render_surfaces);
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the SET_TEXTURE_DATA command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetTextureData(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count == 10) {
|
| - namespace cmd = set_texture_data_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int x_y = args[1].value_uint32;
|
| - unsigned int width_height = args[2].value_uint32;
|
| - unsigned int z_depth = args[3].value_uint32;
|
| - unsigned int level_face = args[4].value_uint32;
|
| - unsigned int row_pitch = args[5].value_uint32;
|
| - unsigned int slice_pitch = args[6].value_uint32;
|
| - unsigned int size = args[7].value_uint32;
|
| - unsigned int shm_id = args[8].value_uint32;
|
| - unsigned int offset = args[9].value_uint32;
|
| - unsigned int x = cmd::X::Get(x_y);
|
| - unsigned int y = cmd::Y::Get(x_y);
|
| - unsigned int width = cmd::Width::Get(width_height);
|
| - unsigned int height = cmd::Height::Get(width_height);
|
| - unsigned int z = cmd::Z::Get(z_depth);
|
| - unsigned int depth = cmd::Depth::Get(z_depth);
|
| - unsigned int level = cmd::Level::Get(level_face);
|
| - unsigned int face = cmd::Face::Get(level_face);
|
| - unsigned int unused = cmd::Unused::Get(level_face);
|
| - const void *data = GetAddressAndCheckSize(shm_id, offset, size);
|
| - if (face >= 6 || unused != 0 || !data)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - return gapi_->SetTextureData(id, x, y, z, width, height, depth, level,
|
| - static_cast<texture::Face>(face), row_pitch,
|
| - slice_pitch, size, data);
|
| -
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the SET_TEXTURE_DATA_IMMEDIATE command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetTextureDataImmediate(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count > 8) {
|
| - namespace cmd = set_texture_data_immediate_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int x_y = args[1].value_uint32;
|
| - unsigned int width_height = args[2].value_uint32;
|
| - unsigned int z_depth = args[3].value_uint32;
|
| - unsigned int level_face = args[4].value_uint32;
|
| - unsigned int row_pitch = args[5].value_uint32;
|
| - unsigned int slice_pitch = args[6].value_uint32;
|
| - unsigned int size = args[7].value_uint32;
|
| - unsigned int x = cmd::X::Get(x_y);
|
| - unsigned int y = cmd::Y::Get(x_y);
|
| - unsigned int width = cmd::Width::Get(width_height);
|
| - unsigned int height = cmd::Height::Get(width_height);
|
| - unsigned int z = cmd::Z::Get(z_depth);
|
| - unsigned int depth = cmd::Depth::Get(z_depth);
|
| - unsigned int level = cmd::Level::Get(level_face);
|
| - unsigned int face = cmd::Face::Get(level_face);
|
| - unsigned int unused = cmd::Unused::Get(level_face);
|
| - if (face >= 6 || unused != 0 ||
|
| - size > (arg_count - 5) * sizeof(args[0]))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - return gapi_->SetTextureData(id, x, y, z, width, height, depth, level,
|
| - static_cast<texture::Face>(face), row_pitch,
|
| - slice_pitch, size, args + 8);
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the GET_TEXTURE_DATA command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeGetTextureData(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - if (arg_count == 10) {
|
| - namespace cmd = get_texture_data_cmd;
|
| - unsigned int id = args[0].value_uint32;
|
| - unsigned int x_y = args[1].value_uint32;
|
| - unsigned int width_height = args[2].value_uint32;
|
| - unsigned int z_depth = args[3].value_uint32;
|
| - unsigned int level_face = args[4].value_uint32;
|
| - unsigned int row_pitch = args[5].value_uint32;
|
| - unsigned int slice_pitch = args[6].value_uint32;
|
| - unsigned int size = args[7].value_uint32;
|
| - unsigned int shm_id = args[8].value_uint32;
|
| - unsigned int offset = args[9].value_uint32;
|
| - unsigned int x = cmd::X::Get(x_y);
|
| - unsigned int y = cmd::Y::Get(x_y);
|
| - unsigned int width = cmd::Width::Get(width_height);
|
| - unsigned int height = cmd::Height::Get(width_height);
|
| - unsigned int z = cmd::Z::Get(z_depth);
|
| - unsigned int depth = cmd::Depth::Get(z_depth);
|
| - unsigned int level = cmd::Level::Get(level_face);
|
| - unsigned int face = cmd::Face::Get(level_face);
|
| - unsigned int unused = cmd::Unused::Get(level_face);
|
| - void *data = GetAddressAndCheckSize(shm_id, offset, size);
|
| - if (face >= 6 || unused != 0 || !data)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - return gapi_->GetTextureData(id, x, y, z, width, height, depth, level,
|
| - static_cast<texture::Face>(face), row_pitch,
|
| - slice_pitch, size, data);
|
| -
|
| - } else {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| -}
|
| -
|
| -// Decodes the SET_SAMPLER_STATES command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetSamplerStates(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - namespace cmd = set_sampler_states;
|
| - if (arg_count != 2)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - ResourceID id = args[0].value_uint32;
|
| - Uint32 arg = args[1].value_uint32;
|
| - if (cmd::Unused::Get(arg) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - unsigned int address_u_value = cmd::AddressingU::Get(arg);
|
| - unsigned int address_v_value = cmd::AddressingV::Get(arg);
|
| - unsigned int address_w_value = cmd::AddressingW::Get(arg);
|
| - unsigned int mag_filter_value = cmd::MagFilter::Get(arg);
|
| - unsigned int min_filter_value = cmd::MinFilter::Get(arg);
|
| - unsigned int mip_filter_value = cmd::MipFilter::Get(arg);
|
| - unsigned int max_anisotropy = cmd::MaxAnisotropy::Get(arg);
|
| - if (address_u_value >= sampler::NUM_ADDRESSING_MODE ||
|
| - address_v_value >= sampler::NUM_ADDRESSING_MODE ||
|
| - address_w_value >= sampler::NUM_ADDRESSING_MODE ||
|
| - mag_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| - min_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| - mip_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| - mag_filter_value == sampler::NONE ||
|
| - min_filter_value == sampler::NONE ||
|
| - max_anisotropy == 0) {
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - }
|
| - gapi_->SetSamplerStates(
|
| - id,
|
| - static_cast<sampler::AddressingMode>(address_u_value),
|
| - static_cast<sampler::AddressingMode>(address_v_value),
|
| - static_cast<sampler::AddressingMode>(address_w_value),
|
| - static_cast<sampler::FilteringMode>(mag_filter_value),
|
| - static_cast<sampler::FilteringMode>(min_filter_value),
|
| - static_cast<sampler::FilteringMode>(mip_filter_value),
|
| - max_anisotropy);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| -}
|
| -
|
| -// Decodes the SET_STENCIL_TEST command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetStencilTest(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - namespace cmd = set_stencil_test;
|
| - if (arg_count != 2)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - Uint32 arg0 = args[0].value_uint32;
|
| - Uint32 arg1 = args[1].value_uint32;
|
| - if (cmd::Unused0::Get(arg0) != 0 ||
|
| - cmd::Unused1::Get(arg1) != 0 ||
|
| - cmd::Unused2::Get(arg1) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - unsigned int write_mask = cmd::WriteMask::Get(arg0);
|
| - unsigned int compare_mask = cmd::CompareMask::Get(arg0);
|
| - unsigned int ref = cmd::ReferenceValue::Get(arg0);
|
| - bool enable = cmd::Enable::Get(arg0) != 0;
|
| - bool separate_ccw = cmd::SeparateCCW::Get(arg0) != 0;
|
| - gapi_->SetStencilTest(enable, separate_ccw, write_mask, compare_mask, ref,
|
| - arg1);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| -}
|
| -
|
| -// Decodes the SET_BLENDING command.
|
| -BufferSyncInterface::ParseError GAPIDecoder::DecodeSetBlending(
|
| - unsigned int arg_count,
|
| - CommandBufferEntry *args) {
|
| - namespace cmd = set_blending;
|
| - if (arg_count != 1)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - Uint32 arg = args[0].value_uint32;
|
| - bool enable = cmd::Enable::Get(arg) != 0;
|
| - bool separate_alpha = cmd::SeparateAlpha::Get(arg) != 0;
|
| - unsigned int color_eq = cmd::ColorEq::Get(arg);
|
| - unsigned int color_src = cmd::ColorSrcFunc::Get(arg);
|
| - unsigned int color_dst = cmd::ColorDstFunc::Get(arg);
|
| - unsigned int alpha_eq = cmd::AlphaEq::Get(arg);
|
| - unsigned int alpha_src = cmd::AlphaSrcFunc::Get(arg);
|
| - unsigned int alpha_dst = cmd::AlphaDstFunc::Get(arg);
|
| - if (cmd::Unused0::Get(arg) != 0 ||
|
| - cmd::Unused1::Get(arg) != 0 ||
|
| - color_eq >= GAPIInterface::NUM_BLEND_EQ ||
|
| - color_src >= GAPIInterface::NUM_BLEND_FUNC ||
|
| - color_dst >= GAPIInterface::NUM_BLEND_FUNC ||
|
| - alpha_eq >= GAPIInterface::NUM_BLEND_EQ ||
|
| - alpha_src >= GAPIInterface::NUM_BLEND_FUNC ||
|
| - alpha_dst >= GAPIInterface::NUM_BLEND_FUNC)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| - gapi_->SetBlending(enable,
|
| - separate_alpha,
|
| - static_cast<GAPIInterface::BlendEq>(color_eq),
|
| - static_cast<GAPIInterface::BlendFunc>(color_src),
|
| - static_cast<GAPIInterface::BlendFunc>(color_dst),
|
| - static_cast<GAPIInterface::BlendEq>(alpha_eq),
|
| - static_cast<GAPIInterface::BlendFunc>(alpha_src),
|
| - static_cast<GAPIInterface::BlendFunc>(alpha_dst));
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| -}
|
| -
|
| void *GAPIDecoder::GetAddressAndCheckSize(unsigned int shm_id,
|
| unsigned int offset,
|
| unsigned int size) {
|
| @@ -444,426 +119,589 @@
|
| return static_cast<char *>(shm_addr) + offset;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_NOOP(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleNoop(
|
| uint32 arg_count,
|
| - const cmd::NOOP& args) {
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + const cmd::Noop& args) {
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_TOKEN(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetToken(
|
| uint32 arg_count,
|
| - const cmd::SET_TOKEN& args) {
|
| + const cmd::SetToken& args) {
|
| engine_->set_token(args.token);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_BEGIN_FRAME(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleBeginFrame(
|
| uint32 arg_count,
|
| - const cmd::BEGIN_FRAME& args) {
|
| + const cmd::BeginFrame& args) {
|
| gapi_->BeginFrame();
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_END_FRAME(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleEndFrame(
|
| uint32 arg_count,
|
| - const cmd::END_FRAME& args) {
|
| + const cmd::EndFrame& args) {
|
| gapi_->EndFrame();
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CLEAR(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleClear(
|
| uint32 arg_count,
|
| - const cmd::CLEAR& args) {
|
| + const cmd::Clear& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 buffers = args.buffers;
|
| if (buffers & ~GAPIInterface::ALL_BUFFERS)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| RGBA rgba;
|
| rgba.red = args.red;
|
| rgba.green = args.green;
|
| rgba.blue = args.blue;
|
| rgba.alpha = args.alpha;
|
| gapi_->Clear(buffers, rgba, args.depth, args.stencil);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_VIEWPORT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetViewport(
|
| uint32 arg_count,
|
| - const cmd::SET_VIEWPORT& args) {
|
| + const cmd::SetViewport& args) {
|
| gapi_->SetViewport(args.left,
|
| args.top,
|
| args.width,
|
| args.height,
|
| args.z_min,
|
| args.z_max);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_VERTEX_BUFFER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateVertexBuffer(
|
| uint32 arg_count,
|
| - const cmd::CREATE_VERTEX_BUFFER& args) {
|
| + const cmd::CreateVertexBuffer& args) {
|
| return gapi_->CreateVertexBuffer(args.id, args.size, args.flags);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_VERTEX_BUFFER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyVertexBuffer(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_VERTEX_BUFFER& args) {
|
| + const cmd::DestroyVertexBuffer& args) {
|
| return gapi_->DestroyVertexBuffer(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_VERTEX_BUFFER_DATA_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetVertexBufferDataImmediate(
|
| uint32 arg_count,
|
| - const cmd::SET_VERTEX_BUFFER_DATA_IMMEDIATE& args) {
|
| + const cmd::SetVertexBufferDataImmediate& args) {
|
| return gapi_->SetVertexBufferData(args.id, args.offset,
|
| - ImmediateSize(arg_count, args),
|
| + ImmediateDataSize(arg_count, args),
|
| AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_VERTEX_BUFFER_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetVertexBufferData(
|
| uint32 arg_count,
|
| - const cmd::SET_VERTEX_BUFFER_DATA& args) {
|
| + const cmd::SetVertexBufferData& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->SetVertexBufferData(args.id, args.offset, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_VERTEX_BUFFER_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetVertexBufferData(
|
| uint32 arg_count,
|
| - const cmd::GET_VERTEX_BUFFER_DATA& args) {
|
| + const cmd::GetVertexBufferData& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetVertexBufferData(args.id, args.offset, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_INDEX_BUFFER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateIndexBuffer(
|
| uint32 arg_count,
|
| - const cmd::CREATE_INDEX_BUFFER& args) {
|
| + const cmd::CreateIndexBuffer& args) {
|
| return gapi_->CreateIndexBuffer(args.id, args.size, args.flags);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_INDEX_BUFFER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyIndexBuffer(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_INDEX_BUFFER& args) {
|
| + const cmd::DestroyIndexBuffer& args) {
|
| return gapi_->DestroyIndexBuffer(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_INDEX_BUFFER_DATA_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetIndexBufferDataImmediate(
|
| uint32 arg_count,
|
| - const cmd::SET_INDEX_BUFFER_DATA_IMMEDIATE& args) {
|
| + const cmd::SetIndexBufferDataImmediate& args) {
|
| return gapi_->SetIndexBufferData(args.id, args.offset,
|
| - ImmediateSize(arg_count, args),
|
| + ImmediateDataSize(arg_count, args),
|
| AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_INDEX_BUFFER_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetIndexBufferData(
|
| uint32 arg_count,
|
| - const cmd::SET_INDEX_BUFFER_DATA& args) {
|
| + const cmd::SetIndexBufferData& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->SetIndexBufferData(args.id, args.offset, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_INDEX_BUFFER_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetIndexBufferData(
|
| uint32 arg_count,
|
| - const cmd::GET_INDEX_BUFFER_DATA& args) {
|
| + const cmd::GetIndexBufferData& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetIndexBufferData(args.id, args.offset, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_VERTEX_STRUCT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateVertexStruct(
|
| uint32 arg_count,
|
| - const cmd::CREATE_VERTEX_STRUCT& args) {
|
| + const cmd::CreateVertexStruct& args) {
|
| return gapi_->CreateVertexStruct(args.id, args.input_count);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_VERTEX_STRUCT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyVertexStruct(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_VERTEX_STRUCT& args) {
|
| + const cmd::DestroyVertexStruct& args) {
|
| return gapi_->DestroyVertexStruct(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_VERTEX_INPUT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetVertexInput(
|
| uint32 arg_count,
|
| - const cmd::SET_VERTEX_INPUT& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeSetVertexInput(arg_count, TempHack(&args));
|
| + const cmd::SetVertexInput& args) {
|
| + namespace cmd = set_vertex_input_cmd;
|
| + unsigned int type_stride_semantic = args.fixme4;
|
| + unsigned int semantic_index = cmd::SemanticIndex::Get(type_stride_semantic);
|
| + unsigned int semantic = cmd::Semantic::Get(type_stride_semantic);
|
| + unsigned int type = cmd::Type::Get(type_stride_semantic);
|
| + unsigned int stride = cmd::Stride::Get(type_stride_semantic);
|
| + if (semantic >= vertex_struct::NUM_SEMANTICS ||
|
| + type >= vertex_struct::NUM_TYPES || stride == 0)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + return gapi_->SetVertexInput(
|
| + args.vertex_struct_id, args.input_index, args.vertex_buffer_id,
|
| + args.offset, stride,
|
| + static_cast<vertex_struct::Type>(type),
|
| + static_cast<vertex_struct::Semantic>(semantic),
|
| + semantic_index);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_VERTEX_STRUCT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetVertexStruct(
|
| uint32 arg_count,
|
| - const cmd::SET_VERTEX_STRUCT& args) {
|
| + const cmd::SetVertexStruct& args) {
|
| return gapi_->SetVertexStruct(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DRAW(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDraw(
|
| uint32 arg_count,
|
| - const cmd::DRAW& args) {
|
| + const cmd::Draw& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 primitive_type = args.primitive_type;
|
| if (primitive_type >= GAPIInterface::MAX_PRIMITIVE_TYPE)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->Draw(
|
| static_cast<GAPIInterface::PrimitiveType>(primitive_type),
|
| args.first, args.count);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DRAW_INDEXED(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDrawIndexed(
|
| uint32 arg_count,
|
| - const cmd::DRAW_INDEXED& args) {
|
| + const cmd::DrawIndexed& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 primitive_type = args.primitive_type;
|
| if (primitive_type >= GAPIInterface::MAX_PRIMITIVE_TYPE)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->DrawIndexed(
|
| static_cast<GAPIInterface::PrimitiveType>(primitive_type),
|
| args.index_buffer_id,
|
| args.first, args.count, args.min_index, args.max_index);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_EFFECT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateEffect(
|
| uint32 arg_count,
|
| - const cmd::CREATE_EFFECT& args) {
|
| + const cmd::CreateEffect& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->CreateEffect(args.id, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_EFFECT_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateEffectImmediate(
|
| uint32 arg_count,
|
| - const cmd::CREATE_EFFECT_IMMEDIATE& args) {
|
| + const cmd::CreateEffectImmediate& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| - if (size > ImmediateSize(arg_count, args))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + uint32 data_size = ImmediateDataSize(arg_count, args);
|
| + if (size > data_size)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->CreateEffect(args.id, size, AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_EFFECT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyEffect(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_EFFECT& args) {
|
| + const cmd::DestroyEffect& args) {
|
| return gapi_->DestroyEffect(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_EFFECT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetEffect(
|
| uint32 arg_count,
|
| - const cmd::SET_EFFECT& args) {
|
| + const cmd::SetEffect& args) {
|
| return gapi_->SetEffect(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_PARAM_COUNT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetParamCount(
|
| uint32 arg_count,
|
| - const cmd::GET_PARAM_COUNT& args) {
|
| + const cmd::GetParamCount& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetParamCount(args.id, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_PARAM(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateParam(
|
| uint32 arg_count,
|
| - const cmd::CREATE_PARAM& args) {
|
| + const cmd::CreateParam& args) {
|
| return gapi_->CreateParam(args.param_id, args.effect_id, args.index);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_PARAM_BY_NAME(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateParamByName(
|
| uint32 arg_count,
|
| - const cmd::CREATE_PARAM_BY_NAME& args) {
|
| + const cmd::CreateParamByName& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->CreateParamByName(args.param_id, args.effect_id, size,
|
| data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_PARAM_BY_NAME_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateParamByNameImmediate(
|
| uint32 arg_count,
|
| - const cmd::CREATE_PARAM_BY_NAME_IMMEDIATE& args) {
|
| + const cmd::CreateParamByNameImmediate& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| - if (size > ImmediateSize(arg_count, args))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + uint32 data_size = ImmediateDataSize(arg_count, args);
|
| + if (size > data_size)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->CreateParamByName(args.param_id, args.effect_id, size,
|
| AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_PARAM(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyParam(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_PARAM& args) {
|
| + const cmd::DestroyParam& args) {
|
| return gapi_->DestroyParam(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_PARAM_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetParamData(
|
| uint32 arg_count,
|
| - const cmd::SET_PARAM_DATA& args) {
|
| + const cmd::SetParamData& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->SetParamData(args.id, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_PARAM_DATA_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetParamDataImmediate(
|
| uint32 arg_count,
|
| - const cmd::SET_PARAM_DATA_IMMEDIATE& args) {
|
| + const cmd::SetParamDataImmediate& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| - if (size > ImmediateSize(arg_count, args))
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + uint32 data_size = ImmediateDataSize(arg_count, args);
|
| + if (size > data_size)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->SetParamData(args.id, size, AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_PARAM_DESC(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetParamDesc(
|
| uint32 arg_count,
|
| - const cmd::GET_PARAM_DESC& args) {
|
| + const cmd::GetParamDesc& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetParamDesc(args.id, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_STREAM_COUNT(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetStreamCount(
|
| uint32 arg_count,
|
| - const cmd::GET_STREAM_COUNT& args) {
|
| + const cmd::GetStreamCount& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetStreamCount(args.id, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_STREAM_DESC(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetStreamDesc(
|
| uint32 arg_count,
|
| - const cmd::GET_STREAM_DESC& args) {
|
| + const cmd::GetStreamDesc& args) {
|
| // Pull out some values so they can't be changed by another thread after we've
|
| // validated them.
|
| uint32 size = args.size;
|
| void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| args.shared_memory.offset,
|
| size);
|
| - if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + if (!data) return BufferSyncInterface::kParseInvalidArguments;
|
| return gapi_->GetStreamDesc(args.id, args.index, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_TEXTURE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyTexture(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_TEXTURE& args) {
|
| + const cmd::DestroyTexture& args) {
|
| return gapi_->DestroyTexture(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_TEXTURE_2D(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateTexture2d(
|
| uint32 arg_count,
|
| - const cmd::CREATE_TEXTURE_2D& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeCreateTexture2D(arg_count, TempHack(&args));
|
| + const cmd::CreateTexture2d& args) {
|
| + namespace cmd = create_texture_2d_cmd;
|
| + unsigned int width_height = args.fixme1;
|
| + unsigned int levels_format_flags = args.fixme2;
|
| + unsigned int width = cmd::Width::Get(width_height);
|
| + unsigned int height = cmd::Height::Get(width_height);
|
| + unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| + unsigned int unused = cmd::Unused::Get(levels_format_flags);
|
| + unsigned int format = cmd::Format::Get(levels_format_flags);
|
| + unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| + unsigned int max_levels =
|
| + 1 + base::bits::Log2Ceiling(std::max(width, height));
|
| + if ((width == 0) || (height == 0) || (levels > max_levels) ||
|
| + (unused != 0) || (format >= texture::NUM_FORMATS))
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + if (levels == 0) levels = max_levels;
|
| + bool enable_render_surfaces = !!flags;
|
| + return gapi_->CreateTexture2D(args.texture_id, width, height, levels,
|
| + static_cast<texture::Format>(format), flags,
|
| + enable_render_surfaces);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_TEXTURE_3D(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateTexture3d(
|
| uint32 arg_count,
|
| - const cmd::CREATE_TEXTURE_3D& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeCreateTexture3D(arg_count, TempHack(&args));
|
| + const cmd::CreateTexture3d& args) {
|
| + namespace cmd = create_texture_3d_cmd;
|
| + unsigned int width_height = args.fixme1;
|
| + unsigned int depth_unused = args.fixme2;
|
| + unsigned int levels_format_flags = args.fixme3;
|
| + unsigned int width = cmd::Width::Get(width_height);
|
| + unsigned int height = cmd::Height::Get(width_height);
|
| + unsigned int depth = cmd::Depth::Get(depth_unused);
|
| + unsigned int unused1 = cmd::Unused1::Get(depth_unused);
|
| + unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| + unsigned int unused2 = cmd::Unused2::Get(levels_format_flags);
|
| + unsigned int format = cmd::Format::Get(levels_format_flags);
|
| + unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| + unsigned int max_levels =
|
| + 1 + base::bits::Log2Ceiling(std::max(depth, std::max(width, height)));
|
| + if ((width == 0) || (height == 0) || (depth == 0) ||
|
| + (levels > max_levels) || (unused1 != 0) || (unused2 != 0) ||
|
| + (format >= texture::NUM_FORMATS))
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + if (levels == 0) levels = max_levels;
|
| + bool enable_render_surfaces = !!flags;
|
| + return gapi_->CreateTexture3D(args.texture_id, width, height, depth, levels,
|
| + static_cast<texture::Format>(format), flags,
|
| + enable_render_surfaces);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_TEXTURE_CUBE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateTextureCube(
|
| uint32 arg_count,
|
| - const cmd::CREATE_TEXTURE_CUBE& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeCreateTextureCube(arg_count, TempHack(&args));
|
| + const cmd::CreateTextureCube& args) {
|
| + namespace cmd = create_texture_cube_cmd;
|
| + unsigned int side_unused = args.edge_length;
|
| + unsigned int levels_format_flags = args.fixme2;
|
| + unsigned int side = cmd::Side::Get(side_unused);
|
| + unsigned int unused1 = cmd::Unused1::Get(side_unused);
|
| + unsigned int levels = cmd::Levels::Get(levels_format_flags);
|
| + unsigned int unused2 = cmd::Unused2::Get(levels_format_flags);
|
| + unsigned int format = cmd::Format::Get(levels_format_flags);
|
| + unsigned int flags = cmd::Flags::Get(levels_format_flags);
|
| + unsigned int max_levels = 1 + base::bits::Log2Ceiling(side);
|
| + if ((side == 0) || (levels > max_levels) || (unused1 != 0) ||
|
| + (unused2 != 0) || (format >= texture::NUM_FORMATS))
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + if (levels == 0) levels = max_levels;
|
| + bool enable_render_surfaces = !!flags;
|
| + return gapi_->CreateTextureCube(args.texture_id, side, levels,
|
| + static_cast<texture::Format>(format),
|
| + flags, enable_render_surfaces);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_TEXTURE_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetTextureData(
|
| uint32 arg_count,
|
| - const cmd::SET_TEXTURE_DATA& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeSetTextureData(arg_count, TempHack(&args));
|
| + const cmd::SetTextureData& args) {
|
| + namespace cmd = set_texture_data_cmd;
|
| + unsigned int x_y = args.fixme1;
|
| + unsigned int width_height = args.fixme2;
|
| + unsigned int z_depth = args.fixme3;
|
| + unsigned int level_face = args.fixme4;
|
| + unsigned int size = args.size;
|
| + unsigned int x = cmd::X::Get(x_y);
|
| + unsigned int y = cmd::Y::Get(x_y);
|
| + unsigned int width = cmd::Width::Get(width_height);
|
| + unsigned int height = cmd::Height::Get(width_height);
|
| + unsigned int z = cmd::Z::Get(z_depth);
|
| + unsigned int depth = cmd::Depth::Get(z_depth);
|
| + unsigned int level = cmd::Level::Get(level_face);
|
| + unsigned int face = cmd::Face::Get(level_face);
|
| + unsigned int unused = cmd::Unused::Get(level_face);
|
| + const void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| + args.shared_memory.offset, size);
|
| + if (face >= 6 || unused != 0 || !data)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + return gapi_->SetTextureData(
|
| + args.texture_id, x, y, z, width, height, depth, level,
|
| + static_cast<texture::Face>(face), args.row_pitch,
|
| + args.slice_pitch, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_TEXTURE_DATA_IMMEDIATE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetTextureDataImmediate(
|
| uint32 arg_count,
|
| - const cmd::SET_TEXTURE_DATA_IMMEDIATE& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeSetTextureDataImmediate(arg_count, TempHack(&args));
|
| + const cmd::SetTextureDataImmediate& args) {
|
| + namespace cmd = set_texture_data_immediate_cmd;
|
| + unsigned int x_y = args.fixme1;
|
| + unsigned int width_height = args.fixme2;
|
| + unsigned int z_depth = args.fixme3;
|
| + unsigned int level_face = args.fixme4;
|
| + unsigned int size = args.size;
|
| + unsigned int x = cmd::X::Get(x_y);
|
| + unsigned int y = cmd::Y::Get(x_y);
|
| + unsigned int width = cmd::Width::Get(width_height);
|
| + unsigned int height = cmd::Height::Get(width_height);
|
| + unsigned int z = cmd::Z::Get(z_depth);
|
| + unsigned int depth = cmd::Depth::Get(z_depth);
|
| + unsigned int level = cmd::Level::Get(level_face);
|
| + unsigned int face = cmd::Face::Get(level_face);
|
| + unsigned int unused = cmd::Unused::Get(level_face);
|
| + uint32 data_size = ImmediateDataSize(arg_count, args);
|
| + if (face >= 6 || unused != 0 ||
|
| + size > data_size)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + return gapi_->SetTextureData(
|
| + args.texture_id, x, y, z, width, height, depth, level,
|
| + static_cast<texture::Face>(face), args.row_pitch,
|
| + args.slice_pitch, size, AddressAfterStruct(args));
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_GET_TEXTURE_DATA(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleGetTextureData(
|
| uint32 arg_count,
|
| - const cmd::GET_TEXTURE_DATA& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeGetTextureData(arg_count, TempHack(&args));
|
| + const cmd::GetTextureData& args) {
|
| + namespace cmd = get_texture_data_cmd;
|
| + unsigned int x_y = args.fixme1;
|
| + unsigned int width_height = args.fixme2;
|
| + unsigned int z_depth = args.fixme3;
|
| + unsigned int level_face = args.fixme4;
|
| + unsigned int size = args.size;
|
| + unsigned int x = cmd::X::Get(x_y);
|
| + unsigned int y = cmd::Y::Get(x_y);
|
| + unsigned int width = cmd::Width::Get(width_height);
|
| + unsigned int height = cmd::Height::Get(width_height);
|
| + unsigned int z = cmd::Z::Get(z_depth);
|
| + unsigned int depth = cmd::Depth::Get(z_depth);
|
| + unsigned int level = cmd::Level::Get(level_face);
|
| + unsigned int face = cmd::Face::Get(level_face);
|
| + unsigned int unused = cmd::Unused::Get(level_face);
|
| + void *data = GetAddressAndCheckSize(args.shared_memory.id,
|
| + args.shared_memory.offset, size);
|
| + if (face >= 6 || unused != 0 || !data)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + return gapi_->GetTextureData(
|
| + args.texture_id, x, y, z, width, height, depth, level,
|
| + static_cast<texture::Face>(face), args.row_pitch,
|
| + args.slice_pitch, size, data);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_SAMPLER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateSampler(
|
| uint32 arg_count,
|
| - const cmd::CREATE_SAMPLER& args) {
|
| + const cmd::CreateSampler& args) {
|
| return gapi_->CreateSampler(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_SAMPLER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroySampler(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_SAMPLER& args) {
|
| + const cmd::DestroySampler& args) {
|
| return gapi_->DestroySampler(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_SAMPLER_STATES(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetSamplerStates(
|
| uint32 arg_count,
|
| - const cmd::SET_SAMPLER_STATES& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeSetSamplerStates(arg_count, TempHack(&args));
|
| + const cmd::SetSamplerStates& args) {
|
| + namespace cmd = set_sampler_states;
|
| + Uint32 arg = args.fixme1;
|
| + if (cmd::Unused::Get(arg) != 0)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + unsigned int address_u_value = cmd::AddressingU::Get(arg);
|
| + unsigned int address_v_value = cmd::AddressingV::Get(arg);
|
| + unsigned int address_w_value = cmd::AddressingW::Get(arg);
|
| + unsigned int mag_filter_value = cmd::MagFilter::Get(arg);
|
| + unsigned int min_filter_value = cmd::MinFilter::Get(arg);
|
| + unsigned int mip_filter_value = cmd::MipFilter::Get(arg);
|
| + unsigned int max_anisotropy = cmd::MaxAnisotropy::Get(arg);
|
| + if (address_u_value >= sampler::NUM_ADDRESSING_MODE ||
|
| + address_v_value >= sampler::NUM_ADDRESSING_MODE ||
|
| + address_w_value >= sampler::NUM_ADDRESSING_MODE ||
|
| + mag_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| + min_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| + mip_filter_value >= sampler::NUM_FILTERING_MODE ||
|
| + mag_filter_value == sampler::NONE ||
|
| + min_filter_value == sampler::NONE ||
|
| + max_anisotropy == 0) {
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + }
|
| + gapi_->SetSamplerStates(
|
| + args.id,
|
| + static_cast<sampler::AddressingMode>(address_u_value),
|
| + static_cast<sampler::AddressingMode>(address_v_value),
|
| + static_cast<sampler::AddressingMode>(address_w_value),
|
| + static_cast<sampler::FilteringMode>(mag_filter_value),
|
| + static_cast<sampler::FilteringMode>(min_filter_value),
|
| + static_cast<sampler::FilteringMode>(mip_filter_value),
|
| + max_anisotropy);
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_SAMPLER_BORDER_COLOR(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetSamplerBorderColor(
|
| uint32 arg_count,
|
| - const cmd::SET_SAMPLER_BORDER_COLOR& args) {
|
| + const cmd::SetSamplerBorderColor& args) {
|
| RGBA rgba;
|
| rgba.red = args.red;
|
| rgba.green = args.green;
|
| @@ -872,19 +710,19 @@
|
| return gapi_->SetSamplerBorderColor(args.id, rgba);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_SAMPLER_TEXTURE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetSamplerTexture(
|
| uint32 arg_count,
|
| - const cmd::SET_SAMPLER_TEXTURE& args) {
|
| + const cmd::SetSamplerTexture& args) {
|
| return gapi_->SetSamplerTexture(args.id, args.texture_id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_SCISSOR(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetScissor(
|
| uint32 arg_count,
|
| - const cmd::SET_SCISSOR& args) {
|
| + const cmd::SetScissor& args) {
|
| namespace cmd = set_scissor;
|
| Uint32 x_y_enable = args.fixme0;
|
| if (cmd::Unused::Get(x_y_enable) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| unsigned int x = cmd::X::Get(x_y_enable);
|
| unsigned int y = cmd::Y::Get(x_y_enable);
|
| bool enable = cmd::Enable::Get(x_y_enable) != 0;
|
| @@ -892,32 +730,32 @@
|
| unsigned int width = cmd::Width::Get(width_height);
|
| unsigned int height = cmd::Height::Get(width_height);
|
| gapi_->SetScissor(enable, x, y, width, height);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_POLYGON_OFFSET(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetPolygonOffset(
|
| uint32 arg_count,
|
| - const cmd::SET_POLYGON_OFFSET& args) {
|
| + const cmd::SetPolygonOffset& args) {
|
| gapi_->SetPolygonOffset(args.slope_factor, args.units);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_POINT_LINE_RASTER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetPointLineRaster(
|
| uint32 arg_count,
|
| - const cmd::SET_POINT_LINE_RASTER& args) {
|
| + const cmd::SetPointLineRaster& args) {
|
| namespace cmd = set_point_line_raster;
|
| Uint32 enables = args.fixme0;
|
| if (cmd::Unused::Get(enables) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| bool line_smooth = !!cmd::LineSmoothEnable::Get(enables);
|
| bool point_sprite = !!cmd::PointSpriteEnable::Get(enables);
|
| gapi_->SetPointLineRaster(line_smooth, point_sprite, args.point_size);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_POLYGON_RASTER(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetPolygonRaster(
|
| uint32 arg_count,
|
| - const cmd::SET_POLYGON_RASTER& args) {
|
| + const cmd::SetPolygonRaster& args) {
|
| namespace cmd = set_polygon_raster;
|
| Uint32 fill_cull = args.fixme0;
|
| unsigned int fill_value = cmd::FillMode::Get(fill_cull);
|
| @@ -925,20 +763,20 @@
|
| if (cmd::Unused::Get(fill_cull) != 0 ||
|
| fill_value >= GAPIInterface::NUM_POLYGON_MODE ||
|
| cull_value >= GAPIInterface::NUM_FACE_CULL_MODE)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| gapi_->SetPolygonRaster(
|
| static_cast<GAPIInterface::PolygonMode>(fill_value),
|
| static_cast<GAPIInterface::FaceCullMode>(cull_value));
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_ALPHA_TEST(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetAlphaTest(
|
| uint32 arg_count,
|
| - const cmd::SET_ALPHA_TEST& args) {
|
| + const cmd::SetAlphaTest& args) {
|
| namespace cmd = set_alpha_test;
|
| Uint32 func_enable = args.fixme0;
|
| if (cmd::Unused::Get(func_enable) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| // Check that the bitmask get cannot generate values outside of the
|
| // allowed range.
|
| COMPILE_ASSERT(cmd::Func::kMask < GAPIInterface::NUM_COMPARISON,
|
| @@ -947,16 +785,16 @@
|
| static_cast<GAPIInterface::Comparison>(cmd::Func::Get(func_enable));
|
| bool enable = cmd::Enable::Get(func_enable) != 0;
|
| gapi_->SetAlphaTest(enable, args.value, comp);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_DEPTH_TEST(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetDepthTest(
|
| uint32 arg_count,
|
| - const cmd::SET_DEPTH_TEST& args) {
|
| + const cmd::SetDepthTest& args) {
|
| namespace cmd = set_depth_test;
|
| Uint32 func_enable = args.fixme0;
|
| if (cmd::Unused::Get(func_enable) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| // Check that the bitmask get cannot generate values outside of the
|
| // allowed range.
|
| COMPILE_ASSERT(cmd::Func::kMask < GAPIInterface::NUM_COMPARISON,
|
| @@ -966,53 +804,93 @@
|
| bool write_enable = cmd::WriteEnable::Get(func_enable) != 0;
|
| bool enable = cmd::Enable::Get(func_enable) != 0;
|
| gapi_->SetDepthTest(enable, write_enable, comp);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_STENCIL_TEST(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetStencilTest(
|
| uint32 arg_count,
|
| - const cmd::SET_STENCIL_TEST& args) {
|
| - // TODO(gman): fix.
|
| - return DecodeSetStencilTest(arg_count, TempHack(&args));
|
| + const cmd::SetStencilTest& args) {
|
| + namespace cmd = set_stencil_test;
|
| + Uint32 arg0 = args.fixme0;
|
| + Uint32 arg1 = args.fixme1;
|
| + if (cmd::Unused0::Get(arg0) != 0 ||
|
| + cmd::Unused1::Get(arg1) != 0 ||
|
| + cmd::Unused2::Get(arg1) != 0)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + unsigned int write_mask = cmd::WriteMask::Get(arg0);
|
| + unsigned int compare_mask = cmd::CompareMask::Get(arg0);
|
| + unsigned int ref = cmd::ReferenceValue::Get(arg0);
|
| + bool enable = cmd::Enable::Get(arg0) != 0;
|
| + bool separate_ccw = cmd::SeparateCCW::Get(arg0) != 0;
|
| + gapi_->SetStencilTest(enable, separate_ccw, write_mask, compare_mask, ref,
|
| + arg1);
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_COLOR_WRITE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetColorWrite(
|
| uint32 arg_count,
|
| - const cmd::SET_COLOR_WRITE& args) {
|
| + const cmd::SetColorWrite& args) {
|
| namespace cmd = set_color_write;
|
| Uint32 enables = args.flags;
|
| if (cmd::Unused::Get(enables) != 0)
|
| - return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| bool red = cmd::RedMask::Get(enables) != 0;
|
| bool green = cmd::GreenMask::Get(enables) != 0;
|
| bool blue = cmd::BlueMask::Get(enables) != 0;
|
| bool alpha = cmd::AlphaMask::Get(enables) != 0;
|
| bool dither = cmd::DitherEnable::Get(enables) != 0;
|
| gapi_->SetColorWrite(red, green, blue, alpha, dither);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_BLENDING(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetBlending(
|
| uint32 arg_count,
|
| - const cmd::SET_BLENDING& args) {
|
| - return DecodeSetBlending(arg_count, TempHack(&args));
|
| + const cmd::SetBlending& args) {
|
| + namespace cmd = set_blending;
|
| + Uint32 arg = args.fixme0;
|
| + bool enable = cmd::Enable::Get(arg) != 0;
|
| + bool separate_alpha = cmd::SeparateAlpha::Get(arg) != 0;
|
| + unsigned int color_eq = cmd::ColorEq::Get(arg);
|
| + unsigned int color_src = cmd::ColorSrcFunc::Get(arg);
|
| + unsigned int color_dst = cmd::ColorDstFunc::Get(arg);
|
| + unsigned int alpha_eq = cmd::AlphaEq::Get(arg);
|
| + unsigned int alpha_src = cmd::AlphaSrcFunc::Get(arg);
|
| + unsigned int alpha_dst = cmd::AlphaDstFunc::Get(arg);
|
| + if (cmd::Unused0::Get(arg) != 0 ||
|
| + cmd::Unused1::Get(arg) != 0 ||
|
| + color_eq >= GAPIInterface::NUM_BLEND_EQ ||
|
| + color_src >= GAPIInterface::NUM_BLEND_FUNC ||
|
| + color_dst >= GAPIInterface::NUM_BLEND_FUNC ||
|
| + alpha_eq >= GAPIInterface::NUM_BLEND_EQ ||
|
| + alpha_src >= GAPIInterface::NUM_BLEND_FUNC ||
|
| + alpha_dst >= GAPIInterface::NUM_BLEND_FUNC)
|
| + return BufferSyncInterface::kParseInvalidArguments;
|
| + gapi_->SetBlending(enable,
|
| + separate_alpha,
|
| + static_cast<GAPIInterface::BlendEq>(color_eq),
|
| + static_cast<GAPIInterface::BlendFunc>(color_src),
|
| + static_cast<GAPIInterface::BlendFunc>(color_dst),
|
| + static_cast<GAPIInterface::BlendEq>(alpha_eq),
|
| + static_cast<GAPIInterface::BlendFunc>(alpha_src),
|
| + static_cast<GAPIInterface::BlendFunc>(alpha_dst));
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_BLENDING_COLOR(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetBlendingColor(
|
| uint32 arg_count,
|
| - const cmd::SET_BLENDING_COLOR& args) {
|
| + const cmd::SetBlendingColor& args) {
|
| RGBA rgba;
|
| rgba.red = args.red;
|
| rgba.green = args.green;
|
| rgba.blue = args.blue;
|
| rgba.alpha = args.alpha;
|
| gapi_->SetBlendingColor(rgba);
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_RENDER_SURFACE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateRenderSurface(
|
| uint32 arg_count,
|
| - const cmd::CREATE_RENDER_SURFACE& args) {
|
| + const cmd::CreateRenderSurface& args) {
|
| namespace cmd = create_render_surface_cmd;
|
| unsigned int width_height = args.fixme1;
|
| unsigned int width = cmd::Width::Get(width_height);
|
| @@ -1024,39 +902,39 @@
|
| side, args.texture_id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_RENDER_SURFACE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyRenderSurface(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_RENDER_SURFACE& args) {
|
| + const cmd::DestroyRenderSurface& args) {
|
| return gapi_->DestroyRenderSurface(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_CREATE_DEPTH_SURFACE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleCreateDepthSurface(
|
| uint32 arg_count,
|
| - const cmd::CREATE_DEPTH_SURFACE& args) {
|
| - namespace cmd = create_render_surface_cmd;
|
| + const cmd::CreateDepthSurface& args) {
|
| + namespace cmd = create_depth_surface_cmd;
|
| unsigned int width_height = args.fixme1;
|
| unsigned int width = cmd::Width::Get(width_height);
|
| unsigned int height = cmd::Height::Get(width_height);
|
| return gapi_->CreateDepthSurface(args.id, width, height);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_DESTROY_DEPTH_SURFACE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleDestroyDepthSurface(
|
| uint32 arg_count,
|
| - const cmd::DESTROY_DEPTH_SURFACE& args) {
|
| + const cmd::DestroyDepthSurface& args) {
|
| return gapi_->DestroyDepthSurface(args.id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_RENDER_SURFACE(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetRenderSurface(
|
| uint32 arg_count,
|
| - const cmd::SET_RENDER_SURFACE& args) {
|
| + const cmd::SetRenderSurface& args) {
|
| return gapi_->SetRenderSurface(args.render_surface_id, args.depth_surface_id);
|
| }
|
|
|
| -BufferSyncInterface::ParseError GAPIDecoder::Handle_SET_BACK_SURFACES(
|
| +BufferSyncInterface::ParseError GAPIDecoder::HandleSetBackSurfaces(
|
| uint32 arg_count,
|
| - const cmd::SET_BACK_SURFACES& args) {
|
| + const cmd::SetBackSurfaces& args) {
|
| gapi_->SetBackSurfaces();
|
| - return BufferSyncInterface::PARSE_NO_ERROR;
|
| + return BufferSyncInterface::kParseNoError;
|
| }
|
|
|
| } // namespace command_buffer
|
|
|