summaryrefslogtreecommitdiffstats
path: root/o3d/command_buffer/service/cross/gapi_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/command_buffer/service/cross/gapi_decoder.cc')
-rw-r--r--o3d/command_buffer/service/cross/gapi_decoder.cc415
1 files changed, 206 insertions, 209 deletions
diff --git a/o3d/command_buffer/service/cross/gapi_decoder.cc b/o3d/command_buffer/service/cross/gapi_decoder.cc
index 650d8d9..15a797f 100644
--- a/o3d/command_buffer/service/cross/gapi_decoder.cc
+++ b/o3d/command_buffer/service/cross/gapi_decoder.cc
@@ -40,6 +40,7 @@
namespace o3d {
namespace command_buffer {
+namespace o3d {
namespace {
@@ -66,9 +67,9 @@ struct CommandInfo {
// 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(CommandBufferEntry) - 1, }, /* NOLINT */ \
+ #define O3D_COMMAND_BUFFER_CMD_OP(name) { \
+ name::kArgFlags, \
+ sizeof(name) / sizeof(CommandBufferEntry) - 1, }, /* NOLINT */ \
O3D_COMMAND_BUFFER_CMDS(O3D_COMMAND_BUFFER_CMD_OP)
@@ -93,10 +94,10 @@ parse_error::ParseError GAPIDecoder::DoCommand(
(info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) {
switch (command) {
#define O3D_COMMAND_BUFFER_CMD_OP(name) \
- case cmd::name::kCmdId: \
+ case name::kCmdId: \
return Handle ## name( \
arg_count, \
- *static_cast<const cmd::name*>(cmd_data)); \
+ *static_cast<const name*>(cmd_data)); \
O3D_COMMAND_BUFFER_CMDS(O3D_COMMAND_BUFFER_CMD_OP)
@@ -121,38 +122,38 @@ void *GAPIDecoder::GetAddressAndCheckSize(unsigned int shm_id,
parse_error::ParseError GAPIDecoder::HandleNoop(
uint32 arg_count,
- const cmd::Noop& args) {
+ const Noop& args) {
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetToken(
uint32 arg_count,
- const cmd::SetToken& args) {
+ const SetToken& args) {
engine_->set_token(args.token);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleBeginFrame(
uint32 arg_count,
- const cmd::BeginFrame& args) {
+ const BeginFrame& args) {
gapi_->BeginFrame();
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleEndFrame(
uint32 arg_count,
- const cmd::EndFrame& args) {
+ const EndFrame& args) {
gapi_->EndFrame();
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleClear(
uint32 arg_count,
- const cmd::Clear& args) {
+ const 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 & ~command_buffer::kAllBuffers)
+ if (buffers & ~kAllBuffers)
return parse_error::kParseInvalidArguments;
RGBA rgba;
rgba.red = args.red;
@@ -165,7 +166,7 @@ parse_error::ParseError GAPIDecoder::HandleClear(
parse_error::ParseError GAPIDecoder::HandleSetViewport(
uint32 arg_count,
- const cmd::SetViewport& args) {
+ const SetViewport& args) {
gapi_->SetViewport(args.left,
args.top,
args.width,
@@ -177,20 +178,20 @@ parse_error::ParseError GAPIDecoder::HandleSetViewport(
parse_error::ParseError GAPIDecoder::HandleCreateVertexBuffer(
uint32 arg_count,
- const cmd::CreateVertexBuffer& args) {
+ const CreateVertexBuffer& args) {
return gapi_->CreateVertexBuffer(
args.vertex_buffer_id, args.size, args.flags);
}
parse_error::ParseError GAPIDecoder::HandleDestroyVertexBuffer(
uint32 arg_count,
- const cmd::DestroyVertexBuffer& args) {
+ const DestroyVertexBuffer& args) {
return gapi_->DestroyVertexBuffer(args.vertex_buffer_id);
}
parse_error::ParseError GAPIDecoder::HandleSetVertexBufferDataImmediate(
uint32 arg_count,
- const cmd::SetVertexBufferDataImmediate& args) {
+ const SetVertexBufferDataImmediate& args) {
uint32 size = ImmediateDataSize(arg_count, args);
if (size == 0) {
return parse_error::kParseNoError;
@@ -202,7 +203,7 @@ parse_error::ParseError GAPIDecoder::HandleSetVertexBufferDataImmediate(
parse_error::ParseError GAPIDecoder::HandleSetVertexBufferData(
uint32 arg_count,
- const cmd::SetVertexBufferData& args) {
+ const SetVertexBufferData& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -216,7 +217,7 @@ parse_error::ParseError GAPIDecoder::HandleSetVertexBufferData(
parse_error::ParseError GAPIDecoder::HandleGetVertexBufferData(
uint32 arg_count,
- const cmd::GetVertexBufferData& args) {
+ const GetVertexBufferData& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -230,19 +231,19 @@ parse_error::ParseError GAPIDecoder::HandleGetVertexBufferData(
parse_error::ParseError GAPIDecoder::HandleCreateIndexBuffer(
uint32 arg_count,
- const cmd::CreateIndexBuffer& args) {
+ const CreateIndexBuffer& args) {
return gapi_->CreateIndexBuffer(args.index_buffer_id, args.size, args.flags);
}
parse_error::ParseError GAPIDecoder::HandleDestroyIndexBuffer(
uint32 arg_count,
- const cmd::DestroyIndexBuffer& args) {
+ const DestroyIndexBuffer& args) {
return gapi_->DestroyIndexBuffer(args.index_buffer_id);
}
parse_error::ParseError GAPIDecoder::HandleSetIndexBufferDataImmediate(
uint32 arg_count,
- const cmd::SetIndexBufferDataImmediate& args) {
+ const SetIndexBufferDataImmediate& args) {
uint32 size = ImmediateDataSize(arg_count, args);
if (size == 0) {
return parse_error::kParseNoError;
@@ -253,7 +254,7 @@ parse_error::ParseError GAPIDecoder::HandleSetIndexBufferDataImmediate(
parse_error::ParseError GAPIDecoder::HandleSetIndexBufferData(
uint32 arg_count,
- const cmd::SetIndexBufferData& args) {
+ const SetIndexBufferData& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -267,7 +268,7 @@ parse_error::ParseError GAPIDecoder::HandleSetIndexBufferData(
parse_error::ParseError GAPIDecoder::HandleGetIndexBufferData(
uint32 arg_count,
- const cmd::GetIndexBufferData& args) {
+ const GetIndexBufferData& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -281,28 +282,28 @@ parse_error::ParseError GAPIDecoder::HandleGetIndexBufferData(
parse_error::ParseError GAPIDecoder::HandleCreateVertexStruct(
uint32 arg_count,
- const cmd::CreateVertexStruct& args) {
+ const CreateVertexStruct& args) {
return gapi_->CreateVertexStruct(args.vertex_struct_id, args.input_count);
}
parse_error::ParseError GAPIDecoder::HandleDestroyVertexStruct(
uint32 arg_count,
- const cmd::DestroyVertexStruct& args) {
+ const DestroyVertexStruct& args) {
return gapi_->DestroyVertexStruct(args.vertex_struct_id);
}
parse_error::ParseError GAPIDecoder::HandleSetVertexInput(
uint32 arg_count,
- const cmd::SetVertexInput& args) {
+ const SetVertexInput& args) {
unsigned int type_stride_semantic = args.type_stride_semantic;
unsigned int semantic_index =
- cmd::SetVertexInput::SemanticIndex::Get(type_stride_semantic);
+ SetVertexInput::SemanticIndex::Get(type_stride_semantic);
unsigned int semantic =
- cmd::SetVertexInput::Semantic::Get(type_stride_semantic);
+ SetVertexInput::Semantic::Get(type_stride_semantic);
unsigned int type =
- cmd::SetVertexInput::Type::Get(type_stride_semantic);
+ SetVertexInput::Type::Get(type_stride_semantic);
unsigned int stride =
- cmd::SetVertexInput::Stride::Get(type_stride_semantic);
+ SetVertexInput::Stride::Get(type_stride_semantic);
if (semantic >= vertex_struct::kNumSemantics ||
type >= vertex_struct::kNumTypes || stride == 0)
return parse_error::kParseInvalidArguments;
@@ -316,40 +317,40 @@ parse_error::ParseError GAPIDecoder::HandleSetVertexInput(
parse_error::ParseError GAPIDecoder::HandleSetVertexStruct(
uint32 arg_count,
- const cmd::SetVertexStruct& args) {
+ const SetVertexStruct& args) {
return gapi_->SetVertexStruct(args.vertex_struct_id);
}
parse_error::ParseError GAPIDecoder::HandleDraw(
uint32 arg_count,
- const cmd::Draw& args) {
+ const 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 >= command_buffer::kMaxPrimitiveType)
+ if (primitive_type >= kMaxPrimitiveType)
return parse_error::kParseInvalidArguments;
return gapi_->Draw(
- static_cast<command_buffer::PrimitiveType>(primitive_type),
+ static_cast<PrimitiveType>(primitive_type),
args.first, args.count);
}
parse_error::ParseError GAPIDecoder::HandleDrawIndexed(
uint32 arg_count,
- const cmd::DrawIndexed& args) {
+ const 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 >= command_buffer::kMaxPrimitiveType)
+ if (primitive_type >= kMaxPrimitiveType)
return parse_error::kParseInvalidArguments;
return gapi_->DrawIndexed(
- static_cast<command_buffer::PrimitiveType>(primitive_type),
+ static_cast<PrimitiveType>(primitive_type),
args.index_buffer_id,
args.first, args.count, args.min_index, args.max_index);
}
parse_error::ParseError GAPIDecoder::HandleCreateEffect(
uint32 arg_count,
- const cmd::CreateEffect& args) {
+ const CreateEffect& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -362,7 +363,7 @@ parse_error::ParseError GAPIDecoder::HandleCreateEffect(
parse_error::ParseError GAPIDecoder::HandleCreateEffectImmediate(
uint32 arg_count,
- const cmd::CreateEffectImmediate& args) {
+ const CreateEffectImmediate& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -378,19 +379,19 @@ parse_error::ParseError GAPIDecoder::HandleCreateEffectImmediate(
parse_error::ParseError GAPIDecoder::HandleDestroyEffect(
uint32 arg_count,
- const cmd::DestroyEffect& args) {
+ const DestroyEffect& args) {
return gapi_->DestroyEffect(args.effect_id);
}
parse_error::ParseError GAPIDecoder::HandleSetEffect(
uint32 arg_count,
- const cmd::SetEffect& args) {
+ const SetEffect& args) {
return gapi_->SetEffect(args.effect_id);
}
parse_error::ParseError GAPIDecoder::HandleGetParamCount(
uint32 arg_count,
- const cmd::GetParamCount& args) {
+ const GetParamCount& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -403,13 +404,13 @@ parse_error::ParseError GAPIDecoder::HandleGetParamCount(
parse_error::ParseError GAPIDecoder::HandleCreateParam(
uint32 arg_count,
- const cmd::CreateParam& args) {
+ const CreateParam& args) {
return gapi_->CreateParam(args.param_id, args.effect_id, args.index);
}
parse_error::ParseError GAPIDecoder::HandleCreateParamByName(
uint32 arg_count,
- const cmd::CreateParamByName& args) {
+ const CreateParamByName& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -423,7 +424,7 @@ parse_error::ParseError GAPIDecoder::HandleCreateParamByName(
parse_error::ParseError GAPIDecoder::HandleCreateParamByNameImmediate(
uint32 arg_count,
- const cmd::CreateParamByNameImmediate& args) {
+ const CreateParamByNameImmediate& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -439,13 +440,13 @@ parse_error::ParseError GAPIDecoder::HandleCreateParamByNameImmediate(
parse_error::ParseError GAPIDecoder::HandleDestroyParam(
uint32 arg_count,
- const cmd::DestroyParam& args) {
+ const DestroyParam& args) {
return gapi_->DestroyParam(args.param_id);
}
parse_error::ParseError GAPIDecoder::HandleSetParamData(
uint32 arg_count,
- const cmd::SetParamData& args) {
+ const SetParamData& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -458,7 +459,7 @@ parse_error::ParseError GAPIDecoder::HandleSetParamData(
parse_error::ParseError GAPIDecoder::HandleSetParamDataImmediate(
uint32 arg_count,
- const cmd::SetParamDataImmediate& args) {
+ const SetParamDataImmediate& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -474,7 +475,7 @@ parse_error::ParseError GAPIDecoder::HandleSetParamDataImmediate(
parse_error::ParseError GAPIDecoder::HandleGetParamDesc(
uint32 arg_count,
- const cmd::GetParamDesc& args) {
+ const GetParamDesc& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -487,7 +488,7 @@ parse_error::ParseError GAPIDecoder::HandleGetParamDesc(
parse_error::ParseError GAPIDecoder::HandleGetStreamCount(
uint32 arg_count,
- const cmd::GetStreamCount& args) {
+ const GetStreamCount& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -500,7 +501,7 @@ parse_error::ParseError GAPIDecoder::HandleGetStreamCount(
parse_error::ParseError GAPIDecoder::HandleGetStreamDesc(
uint32 arg_count,
- const cmd::GetStreamDesc& args) {
+ const GetStreamDesc& args) {
// Pull out some values so they can't be changed by another thread after we've
// validated them.
uint32 size = args.size;
@@ -513,21 +514,21 @@ parse_error::ParseError GAPIDecoder::HandleGetStreamDesc(
parse_error::ParseError GAPIDecoder::HandleDestroyTexture(
uint32 arg_count,
- const cmd::DestroyTexture& args) {
+ const DestroyTexture& args) {
return gapi_->DestroyTexture(args.texture_id);
}
parse_error::ParseError GAPIDecoder::HandleCreateTexture2d(
uint32 arg_count,
- const cmd::CreateTexture2d& args) {
+ const CreateTexture2d& args) {
unsigned int width_height = args.width_height;
unsigned int levels_format_flags = args.levels_format_flags;
- unsigned int width = cmd::CreateTexture2d::Width::Get(width_height);
- unsigned int height = cmd::CreateTexture2d::Height::Get(width_height);
- unsigned int levels = cmd::CreateTexture2d::Levels::Get(levels_format_flags);
- unsigned int unused = cmd::CreateTexture2d::Unused::Get(levels_format_flags);
- unsigned int format = cmd::CreateTexture2d::Format::Get(levels_format_flags);
- unsigned int flags = cmd::CreateTexture2d::Flags::Get(levels_format_flags);
+ unsigned int width = CreateTexture2d::Width::Get(width_height);
+ unsigned int height = CreateTexture2d::Height::Get(width_height);
+ unsigned int levels = CreateTexture2d::Levels::Get(levels_format_flags);
+ unsigned int unused = CreateTexture2d::Unused::Get(levels_format_flags);
+ unsigned int format = CreateTexture2d::Format::Get(levels_format_flags);
+ unsigned int flags = CreateTexture2d::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) ||
@@ -541,19 +542,18 @@ parse_error::ParseError GAPIDecoder::HandleCreateTexture2d(
parse_error::ParseError GAPIDecoder::HandleCreateTexture3d(
uint32 arg_count,
- const cmd::CreateTexture3d& args) {
+ const CreateTexture3d& args) {
unsigned int width_height = args.width_height;
unsigned int depth_unused = args.depth_unused;
unsigned int levels_format_flags = args.levels_format_flags;
- unsigned int width = cmd::CreateTexture3d::Width::Get(width_height);
- unsigned int height = cmd::CreateTexture3d::Height::Get(width_height);
- unsigned int depth = cmd::CreateTexture3d::Depth::Get(depth_unused);
- unsigned int unused1 = cmd::CreateTexture3d::Unused1::Get(depth_unused);
- unsigned int levels = cmd::CreateTexture3d::Levels::Get(levels_format_flags);
- unsigned int unused2 =
- cmd::CreateTexture3d::Unused2::Get(levels_format_flags);
- unsigned int format = cmd::CreateTexture3d::Format::Get(levels_format_flags);
- unsigned int flags = cmd::CreateTexture3d::Flags::Get(levels_format_flags);
+ unsigned int width = CreateTexture3d::Width::Get(width_height);
+ unsigned int height = CreateTexture3d::Height::Get(width_height);
+ unsigned int depth = CreateTexture3d::Depth::Get(depth_unused);
+ unsigned int unused1 = CreateTexture3d::Unused1::Get(depth_unused);
+ unsigned int levels = CreateTexture3d::Levels::Get(levels_format_flags);
+ unsigned int unused2 = CreateTexture3d::Unused2::Get(levels_format_flags);
+ unsigned int format = CreateTexture3d::Format::Get(levels_format_flags);
+ unsigned int flags = CreateTexture3d::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) ||
@@ -568,18 +568,15 @@ parse_error::ParseError GAPIDecoder::HandleCreateTexture3d(
parse_error::ParseError GAPIDecoder::HandleCreateTextureCube(
uint32 arg_count,
- const cmd::CreateTextureCube& args) {
+ const CreateTextureCube& args) {
unsigned int side_unused = args.edge_length;
unsigned int levels_format_flags = args.levels_format_flags;
- unsigned int side = cmd::CreateTextureCube::Side::Get(side_unused);
- unsigned int unused1 = cmd::CreateTextureCube::Unused1::Get(side_unused);
- unsigned int levels =
- cmd::CreateTextureCube::Levels::Get(levels_format_flags);
- unsigned int unused2 =
- cmd::CreateTextureCube::Unused2::Get(levels_format_flags);
- unsigned int format =
- cmd::CreateTextureCube::Format::Get(levels_format_flags);
- unsigned int flags = cmd::CreateTextureCube::Flags::Get(levels_format_flags);
+ unsigned int side = CreateTextureCube::Side::Get(side_unused);
+ unsigned int unused1 = CreateTextureCube::Unused1::Get(side_unused);
+ unsigned int levels = CreateTextureCube::Levels::Get(levels_format_flags);
+ unsigned int unused2 = CreateTextureCube::Unused2::Get(levels_format_flags);
+ unsigned int format = CreateTextureCube::Format::Get(levels_format_flags);
+ unsigned int flags = CreateTextureCube::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::kUnknown) || (levels == 0))
@@ -592,21 +589,21 @@ parse_error::ParseError GAPIDecoder::HandleCreateTextureCube(
parse_error::ParseError GAPIDecoder::HandleSetTextureData(
uint32 arg_count,
- const cmd::SetTextureData& args) {
+ const SetTextureData& args) {
unsigned int x_y = args.x_y;
unsigned int width_height = args.width_height;
unsigned int z_depth = args.z_depth;
unsigned int level_face = args.level_face;
unsigned int size = args.size;
- unsigned int x = cmd::SetTextureData::X::Get(x_y);
- unsigned int y = cmd::SetTextureData::Y::Get(x_y);
- unsigned int width = cmd::SetTextureData::Width::Get(width_height);
- unsigned int height = cmd::SetTextureData::Height::Get(width_height);
- unsigned int z = cmd::SetTextureData::Z::Get(z_depth);
- unsigned int depth = cmd::SetTextureData::Depth::Get(z_depth);
- unsigned int level = cmd::SetTextureData::Level::Get(level_face);
- unsigned int face = cmd::SetTextureData::Face::Get(level_face);
- unsigned int unused = cmd::SetTextureData::Unused::Get(level_face);
+ unsigned int x = SetTextureData::X::Get(x_y);
+ unsigned int y = SetTextureData::Y::Get(x_y);
+ unsigned int width = SetTextureData::Width::Get(width_height);
+ unsigned int height = SetTextureData::Height::Get(width_height);
+ unsigned int z = SetTextureData::Z::Get(z_depth);
+ unsigned int depth = SetTextureData::Depth::Get(z_depth);
+ unsigned int level = SetTextureData::Level::Get(level_face);
+ unsigned int face = SetTextureData::Face::Get(level_face);
+ unsigned int unused = SetTextureData::Unused::Get(level_face);
const void *data = GetAddressAndCheckSize(args.shared_memory.id,
args.shared_memory.offset, size);
if (face >= 6 || unused != 0 || !data)
@@ -619,21 +616,21 @@ parse_error::ParseError GAPIDecoder::HandleSetTextureData(
parse_error::ParseError GAPIDecoder::HandleSetTextureDataImmediate(
uint32 arg_count,
- const cmd::SetTextureDataImmediate& args) {
+ const SetTextureDataImmediate& args) {
unsigned int x_y = args.x_y;
unsigned int width_height = args.width_height;
unsigned int z_depth = args.z_depth;
unsigned int level_face = args.level_face;
unsigned int size = args.size;
- unsigned int x = cmd::SetTextureDataImmediate::X::Get(x_y);
- unsigned int y = cmd::SetTextureDataImmediate::Y::Get(x_y);
- unsigned int width = cmd::SetTextureDataImmediate::Width::Get(width_height);
- unsigned int height = cmd::SetTextureDataImmediate::Height::Get(width_height);
- unsigned int z = cmd::SetTextureDataImmediate::Z::Get(z_depth);
- unsigned int depth = cmd::SetTextureDataImmediate::Depth::Get(z_depth);
- unsigned int level = cmd::SetTextureDataImmediate::Level::Get(level_face);
- unsigned int face = cmd::SetTextureDataImmediate::Face::Get(level_face);
- unsigned int unused = cmd::SetTextureDataImmediate::Unused::Get(level_face);
+ unsigned int x = SetTextureDataImmediate::X::Get(x_y);
+ unsigned int y = SetTextureDataImmediate::Y::Get(x_y);
+ unsigned int width = SetTextureDataImmediate::Width::Get(width_height);
+ unsigned int height = SetTextureDataImmediate::Height::Get(width_height);
+ unsigned int z = SetTextureDataImmediate::Z::Get(z_depth);
+ unsigned int depth = SetTextureDataImmediate::Depth::Get(z_depth);
+ unsigned int level = SetTextureDataImmediate::Level::Get(level_face);
+ unsigned int face = SetTextureDataImmediate::Face::Get(level_face);
+ unsigned int unused = SetTextureDataImmediate::Unused::Get(level_face);
uint32 data_size = ImmediateDataSize(arg_count, args);
if (face >= 6 || unused != 0 ||
size > data_size)
@@ -649,21 +646,21 @@ parse_error::ParseError GAPIDecoder::HandleSetTextureDataImmediate(
parse_error::ParseError GAPIDecoder::HandleGetTextureData(
uint32 arg_count,
- const cmd::GetTextureData& args) {
+ const GetTextureData& args) {
unsigned int x_y = args.x_y;
unsigned int width_height = args.width_height;
unsigned int z_depth = args.z_depth;
unsigned int level_face = args.level_face;
unsigned int size = args.size;
- unsigned int x = cmd::GetTextureData::X::Get(x_y);
- unsigned int y = cmd::GetTextureData::Y::Get(x_y);
- unsigned int width = cmd::GetTextureData::Width::Get(width_height);
- unsigned int height = cmd::GetTextureData::Height::Get(width_height);
- unsigned int z = cmd::GetTextureData::Z::Get(z_depth);
- unsigned int depth = cmd::GetTextureData::Depth::Get(z_depth);
- unsigned int level = cmd::GetTextureData::Level::Get(level_face);
- unsigned int face = cmd::GetTextureData::Face::Get(level_face);
- unsigned int unused = cmd::GetTextureData::Unused::Get(level_face);
+ unsigned int x = GetTextureData::X::Get(x_y);
+ unsigned int y = GetTextureData::Y::Get(x_y);
+ unsigned int width = GetTextureData::Width::Get(width_height);
+ unsigned int height = GetTextureData::Height::Get(width_height);
+ unsigned int z = GetTextureData::Z::Get(z_depth);
+ unsigned int depth = GetTextureData::Depth::Get(z_depth);
+ unsigned int level = GetTextureData::Level::Get(level_face);
+ unsigned int face = GetTextureData::Face::Get(level_face);
+ unsigned int unused = GetTextureData::Unused::Get(level_face);
void *data = GetAddressAndCheckSize(args.shared_memory.id,
args.shared_memory.offset, size);
if (face >= 6 || unused != 0 || !data)
@@ -676,29 +673,29 @@ parse_error::ParseError GAPIDecoder::HandleGetTextureData(
parse_error::ParseError GAPIDecoder::HandleCreateSampler(
uint32 arg_count,
- const cmd::CreateSampler& args) {
+ const CreateSampler& args) {
return gapi_->CreateSampler(args.sampler_id);
}
parse_error::ParseError GAPIDecoder::HandleDestroySampler(
uint32 arg_count,
- const cmd::DestroySampler& args) {
+ const DestroySampler& args) {
return gapi_->DestroySampler(args.sampler_id);
}
parse_error::ParseError GAPIDecoder::HandleSetSamplerStates(
uint32 arg_count,
- const cmd::SetSamplerStates& args) {
+ const SetSamplerStates& args) {
Uint32 arg = args.sampler_states;
- if (cmd::SetSamplerStates::Unused::Get(arg) != 0)
+ if (SetSamplerStates::Unused::Get(arg) != 0)
return parse_error::kParseInvalidArguments;
- unsigned int address_u_value = cmd::SetSamplerStates::AddressingU::Get(arg);
- unsigned int address_v_value = cmd::SetSamplerStates::AddressingV::Get(arg);
- unsigned int address_w_value = cmd::SetSamplerStates::AddressingW::Get(arg);
- unsigned int mag_filter_value = cmd::SetSamplerStates::MagFilter::Get(arg);
- unsigned int min_filter_value = cmd::SetSamplerStates::MinFilter::Get(arg);
- unsigned int mip_filter_value = cmd::SetSamplerStates::MipFilter::Get(arg);
- unsigned int max_anisotropy = cmd::SetSamplerStates::MaxAnisotropy::Get(arg);
+ unsigned int address_u_value = SetSamplerStates::AddressingU::Get(arg);
+ unsigned int address_v_value = SetSamplerStates::AddressingV::Get(arg);
+ unsigned int address_w_value = SetSamplerStates::AddressingW::Get(arg);
+ unsigned int mag_filter_value = SetSamplerStates::MagFilter::Get(arg);
+ unsigned int min_filter_value = SetSamplerStates::MinFilter::Get(arg);
+ unsigned int mip_filter_value = SetSamplerStates::MipFilter::Get(arg);
+ unsigned int max_anisotropy = SetSamplerStates::MaxAnisotropy::Get(arg);
if (address_u_value >= sampler::kNumAddressingMode ||
address_v_value >= sampler::kNumAddressingMode ||
address_w_value >= sampler::kNumAddressingMode ||
@@ -724,7 +721,7 @@ parse_error::ParseError GAPIDecoder::HandleSetSamplerStates(
parse_error::ParseError GAPIDecoder::HandleSetSamplerBorderColor(
uint32 arg_count,
- const cmd::SetSamplerBorderColor& args) {
+ const SetSamplerBorderColor& args) {
RGBA rgba;
rgba.red = args.red;
rgba.green = args.green;
@@ -735,113 +732,112 @@ parse_error::ParseError GAPIDecoder::HandleSetSamplerBorderColor(
parse_error::ParseError GAPIDecoder::HandleSetSamplerTexture(
uint32 arg_count,
- const cmd::SetSamplerTexture& args) {
+ const SetSamplerTexture& args) {
return gapi_->SetSamplerTexture(args.sampler_id, args.texture_id);
}
parse_error::ParseError GAPIDecoder::HandleSetScissor(
uint32 arg_count,
- const cmd::SetScissor& args) {
+ const SetScissor& args) {
Uint32 x_y_enable = args.x_y_enable;
- if (cmd::SetScissor::Unused::Get(x_y_enable) != 0)
+ if (SetScissor::Unused::Get(x_y_enable) != 0)
return parse_error::kParseInvalidArguments;
- unsigned int x = cmd::SetScissor::X::Get(x_y_enable);
- unsigned int y = cmd::SetScissor::Y::Get(x_y_enable);
- bool enable = cmd::SetScissor::Enable::Get(x_y_enable) != 0;
+ unsigned int x = SetScissor::X::Get(x_y_enable);
+ unsigned int y = SetScissor::Y::Get(x_y_enable);
+ bool enable = SetScissor::Enable::Get(x_y_enable) != 0;
Uint32 width_height = args.width_height;
- unsigned int width = cmd::SetScissor::Width::Get(width_height);
- unsigned int height = cmd::SetScissor::Height::Get(width_height);
+ unsigned int width = SetScissor::Width::Get(width_height);
+ unsigned int height = SetScissor::Height::Get(width_height);
gapi_->SetScissor(enable, x, y, width, height);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetPolygonOffset(
uint32 arg_count,
- const cmd::SetPolygonOffset& args) {
+ const SetPolygonOffset& args) {
gapi_->SetPolygonOffset(args.slope_factor, args.units);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetPointLineRaster(
uint32 arg_count,
- const cmd::SetPointLineRaster& args) {
+ const SetPointLineRaster& args) {
Uint32 enables = args.enables;
- if (cmd::SetPointLineRaster::Unused::Get(enables) != 0)
+ if (SetPointLineRaster::Unused::Get(enables) != 0)
return parse_error::kParseInvalidArguments;
- bool line_smooth = !!cmd::SetPointLineRaster::LineSmoothEnable::Get(enables);
- bool point_sprite =
- !!cmd::SetPointLineRaster::PointSpriteEnable::Get(enables);
+ bool line_smooth = !!SetPointLineRaster::LineSmoothEnable::Get(enables);
+ bool point_sprite = !!SetPointLineRaster::PointSpriteEnable::Get(enables);
gapi_->SetPointLineRaster(line_smooth, point_sprite, args.point_size);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetPolygonRaster(
uint32 arg_count,
- const cmd::SetPolygonRaster& args) {
+ const SetPolygonRaster& args) {
Uint32 fill_cull = args.fill_cull;
- unsigned int fill_value = cmd::SetPolygonRaster::FillMode::Get(fill_cull);
- unsigned int cull_value = cmd::SetPolygonRaster::CullMode::Get(fill_cull);
- if (cmd::SetPolygonRaster::Unused::Get(fill_cull) != 0 ||
- fill_value >= command_buffer::kNumPolygonMode ||
- cull_value >= command_buffer::kNumFaceCullMode)
+ unsigned int fill_value = SetPolygonRaster::FillMode::Get(fill_cull);
+ unsigned int cull_value = SetPolygonRaster::CullMode::Get(fill_cull);
+ if (SetPolygonRaster::Unused::Get(fill_cull) != 0 ||
+ fill_value >= kNumPolygonMode ||
+ cull_value >= kNumFaceCullMode)
return parse_error::kParseInvalidArguments;
gapi_->SetPolygonRaster(
- static_cast<command_buffer::PolygonMode>(fill_value),
- static_cast<command_buffer::FaceCullMode>(cull_value));
+ static_cast<PolygonMode>(fill_value),
+ static_cast<FaceCullMode>(cull_value));
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetAlphaTest(
uint32 arg_count,
- const cmd::SetAlphaTest& args) {
+ const SetAlphaTest& args) {
Uint32 func_enable = args.func_enable;
- if (cmd::SetAlphaTest::Unused::Get(func_enable) != 0)
+ if (SetAlphaTest::Unused::Get(func_enable) != 0)
return parse_error::kParseInvalidArguments;
// Check that the bitmask get cannot generate values outside of the
// allowed range.
- COMPILE_ASSERT(cmd::SetAlphaTest::Func::kMask <
- command_buffer::kNumComparison,
+ COMPILE_ASSERT(SetAlphaTest::Func::kMask <
+ kNumComparison,
set_alpha_test_Func_may_produce_invalid_values);
- command_buffer::Comparison comp = static_cast<command_buffer::Comparison>(
- cmd::SetAlphaTest::Func::Get(func_enable));
- bool enable = cmd::SetAlphaTest::Enable::Get(func_enable) != 0;
+ Comparison comp = static_cast<Comparison>(
+ SetAlphaTest::Func::Get(func_enable));
+ bool enable = SetAlphaTest::Enable::Get(func_enable) != 0;
gapi_->SetAlphaTest(enable, args.value, comp);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetDepthTest(
uint32 arg_count,
- const cmd::SetDepthTest& args) {
+ const SetDepthTest& args) {
Uint32 func_enable = args.func_enable;
- if (cmd::SetDepthTest::Unused::Get(func_enable) != 0)
+ if (SetDepthTest::Unused::Get(func_enable) != 0)
return parse_error::kParseInvalidArguments;
// Check that the bitmask get cannot generate values outside of the
// allowed range.
- COMPILE_ASSERT(cmd::SetDepthTest::Func::kMask <
- command_buffer::kNumComparison,
+ COMPILE_ASSERT(SetDepthTest::Func::kMask <
+ kNumComparison,
set_alpha_test_Func_may_produce_invalid_values);
- command_buffer::Comparison comp = static_cast<command_buffer::Comparison>(
- cmd::SetDepthTest::Func::Get(func_enable));
- bool write_enable = cmd::SetDepthTest::WriteEnable::Get(func_enable) != 0;
- bool enable = cmd::SetDepthTest::Enable::Get(func_enable) != 0;
+ Comparison comp = static_cast<Comparison>(
+ SetDepthTest::Func::Get(func_enable));
+ bool write_enable = SetDepthTest::WriteEnable::Get(func_enable) != 0;
+ bool enable = SetDepthTest::Enable::Get(func_enable) != 0;
gapi_->SetDepthTest(enable, write_enable, comp);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetStencilTest(
uint32 arg_count,
- const cmd::SetStencilTest& args) {
+ const SetStencilTest& args) {
Uint32 arg0 = args.stencil_args0;
Uint32 arg1 = args.stencil_args1;
- if (cmd::SetStencilTest::Unused0::Get(arg0) != 0 ||
- cmd::SetStencilTest::Unused1::Get(arg1) != 0 ||
- cmd::SetStencilTest::Unused2::Get(arg1) != 0)
+ if (SetStencilTest::Unused0::Get(arg0) != 0 ||
+ SetStencilTest::Unused1::Get(arg1) != 0 ||
+ SetStencilTest::Unused2::Get(arg1) != 0)
return parse_error::kParseInvalidArguments;
- unsigned int write_mask = cmd::SetStencilTest::WriteMask::Get(arg0);
- unsigned int compare_mask = cmd::SetStencilTest::CompareMask::Get(arg0);
- unsigned int ref = cmd::SetStencilTest::ReferenceValue::Get(arg0);
- bool enable = cmd::SetStencilTest::Enable::Get(arg0) != 0;
- bool separate_ccw = cmd::SetStencilTest::SeparateCCW::Get(arg0) != 0;
+ unsigned int write_mask = SetStencilTest::WriteMask::Get(arg0);
+ unsigned int compare_mask = SetStencilTest::CompareMask::Get(arg0);
+ unsigned int ref = SetStencilTest::ReferenceValue::Get(arg0);
+ bool enable = SetStencilTest::Enable::Get(arg0) != 0;
+ bool separate_ccw = SetStencilTest::SeparateCCW::Get(arg0) != 0;
gapi_->SetStencilTest(enable, separate_ccw, write_mask, compare_mask, ref,
arg1);
return parse_error::kParseNoError;
@@ -849,54 +845,54 @@ parse_error::ParseError GAPIDecoder::HandleSetStencilTest(
parse_error::ParseError GAPIDecoder::HandleSetColorWrite(
uint32 arg_count,
- const cmd::SetColorWrite& args) {
+ const SetColorWrite& args) {
Uint32 enables = args.flags;
- if (cmd::SetColorWrite::Unused::Get(enables) != 0)
+ if (SetColorWrite::Unused::Get(enables) != 0)
return parse_error::kParseInvalidArguments;
- bool red = cmd::SetColorWrite::RedMask::Get(enables) != 0;
- bool green = cmd::SetColorWrite::GreenMask::Get(enables) != 0;
- bool blue = cmd::SetColorWrite::BlueMask::Get(enables) != 0;
- bool alpha = cmd::SetColorWrite::AlphaMask::Get(enables) != 0;
- bool dither = cmd::SetColorWrite::DitherEnable::Get(enables) != 0;
+ bool red = SetColorWrite::RedMask::Get(enables) != 0;
+ bool green = SetColorWrite::GreenMask::Get(enables) != 0;
+ bool blue = SetColorWrite::BlueMask::Get(enables) != 0;
+ bool alpha = SetColorWrite::AlphaMask::Get(enables) != 0;
+ bool dither = SetColorWrite::DitherEnable::Get(enables) != 0;
gapi_->SetColorWrite(red, green, blue, alpha, dither);
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetBlending(
uint32 arg_count,
- const cmd::SetBlending& args) {
+ const SetBlending& args) {
Uint32 arg = args.blend_settings;
- bool enable = cmd::SetBlending::Enable::Get(arg) != 0;
- bool separate_alpha = cmd::SetBlending::SeparateAlpha::Get(arg) != 0;
- unsigned int color_eq = cmd::SetBlending::ColorEq::Get(arg);
- unsigned int color_src = cmd::SetBlending::ColorSrcFunc::Get(arg);
- unsigned int color_dst = cmd::SetBlending::ColorDstFunc::Get(arg);
- unsigned int alpha_eq = cmd::SetBlending::AlphaEq::Get(arg);
- unsigned int alpha_src = cmd::SetBlending::AlphaSrcFunc::Get(arg);
- unsigned int alpha_dst = cmd::SetBlending::AlphaDstFunc::Get(arg);
- if (cmd::SetBlending::Unused0::Get(arg) != 0 ||
- cmd::SetBlending::Unused1::Get(arg) != 0 ||
- color_eq >= command_buffer::kNumBlendEq ||
- color_src >= command_buffer::kNumBlendFunc ||
- color_dst >= command_buffer::kNumBlendFunc ||
- alpha_eq >= command_buffer::kNumBlendEq ||
- alpha_src >= command_buffer::kNumBlendFunc ||
- alpha_dst >= command_buffer::kNumBlendFunc)
+ bool enable = SetBlending::Enable::Get(arg) != 0;
+ bool separate_alpha = SetBlending::SeparateAlpha::Get(arg) != 0;
+ unsigned int color_eq = SetBlending::ColorEq::Get(arg);
+ unsigned int color_src = SetBlending::ColorSrcFunc::Get(arg);
+ unsigned int color_dst = SetBlending::ColorDstFunc::Get(arg);
+ unsigned int alpha_eq = SetBlending::AlphaEq::Get(arg);
+ unsigned int alpha_src = SetBlending::AlphaSrcFunc::Get(arg);
+ unsigned int alpha_dst = SetBlending::AlphaDstFunc::Get(arg);
+ if (SetBlending::Unused0::Get(arg) != 0 ||
+ SetBlending::Unused1::Get(arg) != 0 ||
+ color_eq >= kNumBlendEq ||
+ color_src >= kNumBlendFunc ||
+ color_dst >= kNumBlendFunc ||
+ alpha_eq >= kNumBlendEq ||
+ alpha_src >= kNumBlendFunc ||
+ alpha_dst >= kNumBlendFunc)
return parse_error::kParseInvalidArguments;
gapi_->SetBlending(enable,
separate_alpha,
- static_cast<command_buffer::BlendEq>(color_eq),
- static_cast<command_buffer::BlendFunc>(color_src),
- static_cast<command_buffer::BlendFunc>(color_dst),
- static_cast<command_buffer::BlendEq>(alpha_eq),
- static_cast<command_buffer::BlendFunc>(alpha_src),
- static_cast<command_buffer::BlendFunc>(alpha_dst));
+ static_cast<BlendEq>(color_eq),
+ static_cast<BlendFunc>(color_src),
+ static_cast<BlendFunc>(color_dst),
+ static_cast<BlendEq>(alpha_eq),
+ static_cast<BlendFunc>(alpha_src),
+ static_cast<BlendFunc>(alpha_dst));
return parse_error::kParseNoError;
}
parse_error::ParseError GAPIDecoder::HandleSetBlendingColor(
uint32 arg_count,
- const cmd::SetBlendingColor& args) {
+ const SetBlendingColor& args) {
RGBA rgba;
rgba.red = args.red;
rgba.green = args.green;
@@ -908,13 +904,13 @@ parse_error::ParseError GAPIDecoder::HandleSetBlendingColor(
parse_error::ParseError GAPIDecoder::HandleCreateRenderSurface(
uint32 arg_count,
- const cmd::CreateRenderSurface& args) {
+ const CreateRenderSurface& args) {
unsigned int width_height = args.width_height;
- unsigned int width = cmd::CreateRenderSurface::Width::Get(width_height);
- unsigned int height = cmd::CreateRenderSurface::Height::Get(width_height);
+ unsigned int width = CreateRenderSurface::Width::Get(width_height);
+ unsigned int height = CreateRenderSurface::Height::Get(width_height);
unsigned int levels_side = args.levels_side;
- unsigned int mip_level = cmd::CreateRenderSurface::Levels::Get(levels_side);
- unsigned int side = cmd::CreateRenderSurface::Side::Get(levels_side);
+ unsigned int mip_level = CreateRenderSurface::Levels::Get(levels_side);
+ unsigned int side = CreateRenderSurface::Side::Get(levels_side);
return gapi_->CreateRenderSurface(args.render_surface_id,
width, height, mip_level,
side, args.texture_id);
@@ -922,37 +918,38 @@ parse_error::ParseError GAPIDecoder::HandleCreateRenderSurface(
parse_error::ParseError GAPIDecoder::HandleDestroyRenderSurface(
uint32 arg_count,
- const cmd::DestroyRenderSurface& args) {
+ const DestroyRenderSurface& args) {
return gapi_->DestroyRenderSurface(args.render_surface_id);
}
parse_error::ParseError GAPIDecoder::HandleCreateDepthSurface(
uint32 arg_count,
- const cmd::CreateDepthSurface& args) {
+ const CreateDepthSurface& args) {
unsigned int width_height = args.width_height;
- unsigned int width = cmd::CreateDepthSurface::Width::Get(width_height);
- unsigned int height = cmd::CreateDepthSurface::Height::Get(width_height);
+ unsigned int width = CreateDepthSurface::Width::Get(width_height);
+ unsigned int height = CreateDepthSurface::Height::Get(width_height);
return gapi_->CreateDepthSurface(args.depth_surface_id, width, height);
}
parse_error::ParseError GAPIDecoder::HandleDestroyDepthSurface(
uint32 arg_count,
- const cmd::DestroyDepthSurface& args) {
+ const DestroyDepthSurface& args) {
return gapi_->DestroyDepthSurface(args.depth_surface_id);
}
parse_error::ParseError GAPIDecoder::HandleSetRenderSurface(
uint32 arg_count,
- const cmd::SetRenderSurface& args) {
+ const SetRenderSurface& args) {
return gapi_->SetRenderSurface(args.render_surface_id, args.depth_surface_id);
}
parse_error::ParseError GAPIDecoder::HandleSetBackSurfaces(
uint32 arg_count,
- const cmd::SetBackSurfaces& args) {
+ const SetBackSurfaces& args) {
gapi_->SetBackSurfaces();
return parse_error::kParseNoError;
}
+} // namespace o3d
} // namespace command_buffer
} // namespace o3d