diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 22:39:35 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 22:39:35 +0000 |
commit | 30213cb02594880dd1af0fe21224ec246944e3bd (patch) | |
tree | 2645a0ec1f1767cdc8b887e0c79d7ea1dc458c7e /o3d | |
parent | 51343d5ae5d463fc4f84f4af79b44962a580cd4f (diff) | |
download | chromium_src-30213cb02594880dd1af0fe21224ec246944e3bd.zip chromium_src-30213cb02594880dd1af0fe21224ec246944e3bd.tar.gz chromium_src-30213cb02594880dd1af0fe21224ec246944e3bd.tar.bz2 |
move all O3D specific command buffer stuff to command_buffer::o3d
namespace. That's so I can add command_buffer::xxx namespace for
different command buffer.
Review URL: http://codereview.chromium.org/332036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
49 files changed, 690 insertions, 643 deletions
diff --git a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc index 959660ed..15a6cb2 100644 --- a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc +++ b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc @@ -282,7 +282,7 @@ TEST_F(CommandBufferHelperTest, TestToken) { CommandBufferOffset command1_put = get_helper_put(); int32 token = helper_->InsertToken(); - EXPECT_CALL(*api_mock_.get(), DoCommand(kSetToken, 1, _)) + EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) .WillOnce(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), Return(parse_error::kParseNoError))); // Add another command. diff --git a/o3d/command_buffer/client/cross/effect_helper.cc b/o3d/command_buffer/client/cross/effect_helper.cc index 2523892..454a319 100644 --- a/o3d/command_buffer/client/cross/effect_helper.cc +++ b/o3d/command_buffer/client/cross/effect_helper.cc @@ -32,7 +32,7 @@ // This file implements the EffectHelper class. -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/client/cross/cmd_buffer_helper.h" #include "command_buffer/client/cross/effect_helper.h" #include "command_buffer/client/cross/fenced_allocator.h" diff --git a/o3d/command_buffer/client/cross/fenced_allocator_test.cc b/o3d/command_buffer/client/cross/fenced_allocator_test.cc index 1ba510d..24d0f6d 100644 --- a/o3d/command_buffer/client/cross/fenced_allocator_test.cc +++ b/o3d/command_buffer/client/cross/fenced_allocator_test.cc @@ -66,10 +66,10 @@ class BaseFencedAllocatorTest : public testing::Test { api_mock_.reset(new AsyncAPIMock); // ignore noops in the mock - we don't want to inspect the internals of the // helper. - EXPECT_CALL(*api_mock_, DoCommand(kNoop, 0, _)) + EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) .WillRepeatedly(Return(parse_error::kParseNoError)); // Forward the SetToken calls to the engine - EXPECT_CALL(*api_mock_.get(), DoCommand(kSetToken, 1, _)) + EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), Return(parse_error::kParseNoError))); diff --git a/o3d/command_buffer/client/cross/o3d_cmd_helper.h b/o3d/command_buffer/client/cross/o3d_cmd_helper.h index 9aa7644..c325766 100644 --- a/o3d/command_buffer/client/cross/o3d_cmd_helper.h +++ b/o3d/command_buffer/client/cross/o3d_cmd_helper.h @@ -38,7 +38,7 @@ #include "command_buffer/common/cross/logging.h" #include "command_buffer/common/cross/constants.h" #include "command_buffer/client/cross/cmd_buffer_helper.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "o3d/gpu_plugin/np_utils/np_object_pointer.h" namespace o3d { @@ -58,24 +58,24 @@ class O3DCmdHelper : public CommandBufferHelper { // ------------------ Individual commands ---------------------- void Noop(uint32 skip_count) { - cmd::Noop& cmd = GetImmediateCmdSpace<cmd::Noop>( + o3d::Noop& cmd = GetImmediateCmdSpace<o3d::Noop>( skip_count * sizeof(CommandBufferEntry)); cmd.Init(skip_count); } void SetToken(uint32 token) { - cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>(); + o3d::SetToken& cmd = GetCmdSpace<o3d::SetToken>(); cmd.Init(token); } void BeginFrame() { - cmd::BeginFrame& cmd = GetCmdSpace<cmd::BeginFrame>(); + o3d::BeginFrame& cmd = GetCmdSpace<o3d::BeginFrame>(); cmd.Init(); } void EndFrame() { - cmd::EndFrame& cmd = GetCmdSpace<cmd::EndFrame>(); + o3d::EndFrame& cmd = GetCmdSpace<o3d::EndFrame>(); cmd.Init(); } @@ -83,7 +83,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 buffers, float red, float green, float blue, float alpha, float depth, uint32 stencil) { - cmd::Clear& cmd = GetCmdSpace<cmd::Clear>(); + o3d::Clear& cmd = GetCmdSpace<o3d::Clear>(); cmd.Init(buffers, red, green, blue, alpha, depth, stencil); } @@ -94,34 +94,34 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 height, float z_min, float z_max) { - cmd::SetViewport& cmd = GetCmdSpace<cmd::SetViewport>(); + o3d::SetViewport& cmd = GetCmdSpace<o3d::SetViewport>(); cmd.Init(left, top, width, height, z_min, z_max); } void CreateVertexBuffer( ResourceId vertex_buffer_id, uint32 size, vertex_buffer::Flags flags) { - cmd::CreateVertexBuffer& cmd = GetCmdSpace<cmd::CreateVertexBuffer>(); + o3d::CreateVertexBuffer& cmd = GetCmdSpace<o3d::CreateVertexBuffer>(); cmd.Init(vertex_buffer_id, size, flags); } void DestroyVertexBuffer(ResourceId vertex_buffer_id) { - cmd::DestroyVertexBuffer& cmd = GetCmdSpace<cmd::DestroyVertexBuffer>(); + o3d::DestroyVertexBuffer& cmd = GetCmdSpace<o3d::DestroyVertexBuffer>(); cmd.Init(vertex_buffer_id); } void SetVertexBufferDataImmediate( ResourceId vertex_buffer_id, uint32 offset, const void* data, uint32 size) { - cmd::SetVertexBufferDataImmediate& cmd = - GetImmediateCmdSpace<cmd::SetVertexBufferDataImmediate>(size); + o3d::SetVertexBufferDataImmediate& cmd = + GetImmediateCmdSpace<o3d::SetVertexBufferDataImmediate>(size); cmd.Init(vertex_buffer_id, offset, data, size); } void SetVertexBufferData( ResourceId vertex_buffer_id, uint32 offset, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::SetVertexBufferData& cmd = - GetCmdSpace<cmd::SetVertexBufferData>(); + o3d::SetVertexBufferData& cmd = + GetCmdSpace<o3d::SetVertexBufferData>(); cmd.Init(vertex_buffer_id, offset, size, shared_memory_id, shared_memory_offset); } @@ -129,36 +129,36 @@ class O3DCmdHelper : public CommandBufferHelper { void GetVertexBufferData( ResourceId vertex_buffer_id, uint32 offset, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetVertexBufferData& cmd = - GetCmdSpace<cmd::GetVertexBufferData>(); + o3d::GetVertexBufferData& cmd = + GetCmdSpace<o3d::GetVertexBufferData>(); cmd.Init(vertex_buffer_id, offset, size, shared_memory_id, shared_memory_offset); } void CreateIndexBuffer( ResourceId index_buffer_id, uint32 size, index_buffer::Flags flags) { - cmd::CreateIndexBuffer& cmd = - GetCmdSpace<cmd::CreateIndexBuffer>(); + o3d::CreateIndexBuffer& cmd = + GetCmdSpace<o3d::CreateIndexBuffer>(); cmd.Init(index_buffer_id, size, flags); } void DestroyIndexBuffer(ResourceId index_buffer_id) { - cmd::DestroyIndexBuffer& cmd = GetCmdSpace<cmd::DestroyIndexBuffer>(); + o3d::DestroyIndexBuffer& cmd = GetCmdSpace<o3d::DestroyIndexBuffer>(); cmd.Init(index_buffer_id); } void SetIndexBufferDataImmediate( ResourceId index_buffer_id, uint32 offset, const void* data, uint32 size) { - cmd::SetIndexBufferDataImmediate& cmd = - GetImmediateCmdSpace<cmd::SetIndexBufferDataImmediate>(size); + o3d::SetIndexBufferDataImmediate& cmd = + GetImmediateCmdSpace<o3d::SetIndexBufferDataImmediate>(size); cmd.Init(index_buffer_id, offset, data, size); } void SetIndexBufferData( ResourceId index_buffer_id, uint32 offset, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::SetIndexBufferData& cmd = GetCmdSpace<cmd::SetIndexBufferData>(); + o3d::SetIndexBufferData& cmd = GetCmdSpace<o3d::SetIndexBufferData>(); cmd.Init(index_buffer_id, offset, size, shared_memory_id, shared_memory_offset); } @@ -166,18 +166,18 @@ class O3DCmdHelper : public CommandBufferHelper { void GetIndexBufferData( ResourceId index_buffer_id, uint32 offset, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetIndexBufferData& cmd = GetCmdSpace<cmd::GetIndexBufferData>(); + o3d::GetIndexBufferData& cmd = GetCmdSpace<o3d::GetIndexBufferData>(); cmd.Init(index_buffer_id, offset, size, shared_memory_id, shared_memory_offset); } void CreateVertexStruct(ResourceId vertex_struct_id, uint32 input_count) { - cmd::CreateVertexStruct& cmd = GetCmdSpace<cmd::CreateVertexStruct>(); + o3d::CreateVertexStruct& cmd = GetCmdSpace<o3d::CreateVertexStruct>(); cmd.Init(vertex_struct_id, input_count); } void DestroyVertexStruct(ResourceId vertex_struct_id) { - cmd::DestroyVertexStruct& cmd = GetCmdSpace<cmd::DestroyVertexStruct>(); + o3d::DestroyVertexStruct& cmd = GetCmdSpace<o3d::DestroyVertexStruct>(); cmd.Init(vertex_struct_id); } @@ -190,7 +190,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 semantic_index, vertex_struct::Type type, uint32 stride) { - cmd::SetVertexInput& cmd = GetCmdSpace<cmd::SetVertexInput>(); + o3d::SetVertexInput& cmd = GetCmdSpace<o3d::SetVertexInput>(); cmd.Init( vertex_struct_id, input_index, @@ -203,23 +203,23 @@ class O3DCmdHelper : public CommandBufferHelper { } void SetVertexStruct(ResourceId vertex_struct_id) { - cmd::SetVertexStruct& cmd = GetCmdSpace<cmd::SetVertexStruct>(); + o3d::SetVertexStruct& cmd = GetCmdSpace<o3d::SetVertexStruct>(); cmd.Init(vertex_struct_id); } - void Draw(PrimitiveType primitive_type, uint32 first, uint32 count) { - cmd::Draw& cmd = GetCmdSpace<cmd::Draw>(); + void Draw(o3d::PrimitiveType primitive_type, uint32 first, uint32 count) { + o3d::Draw& cmd = GetCmdSpace<o3d::Draw>(); cmd.Init(primitive_type, first, count); } void DrawIndexed( - PrimitiveType primitive_type, + o3d::PrimitiveType primitive_type, ResourceId index_buffer_id, uint32 first, uint32 count, uint32 min_index, uint32 max_index) { - cmd::DrawIndexed& cmd = GetCmdSpace<cmd::DrawIndexed>(); + o3d::DrawIndexed& cmd = GetCmdSpace<o3d::DrawIndexed>(); cmd.Init( primitive_type, index_buffer_id, @@ -232,96 +232,96 @@ class O3DCmdHelper : public CommandBufferHelper { void CreateEffect( ResourceId effect_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::CreateEffect& cmd = GetCmdSpace<cmd::CreateEffect>(); + o3d::CreateEffect& cmd = GetCmdSpace<o3d::CreateEffect>(); cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); } void CreateEffectImmediate( ResourceId effect_id, uint32 size, const void* data) { - cmd::CreateEffectImmediate& cmd = - GetImmediateCmdSpace<cmd::CreateEffectImmediate>(size); + o3d::CreateEffectImmediate& cmd = + GetImmediateCmdSpace<o3d::CreateEffectImmediate>(size); cmd.Init(effect_id, size, data); } void DestroyEffect(ResourceId effect_id) { - cmd::DestroyEffect& cmd = GetCmdSpace<cmd::DestroyEffect>(); + o3d::DestroyEffect& cmd = GetCmdSpace<o3d::DestroyEffect>(); cmd.Init(effect_id); } void SetEffect(ResourceId effect_id) { - cmd::SetEffect& cmd = GetCmdSpace<cmd::SetEffect>(); + o3d::SetEffect& cmd = GetCmdSpace<o3d::SetEffect>(); cmd.Init(effect_id); } void GetParamCount( ResourceId effect_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetParamCount& cmd = GetCmdSpace<cmd::GetParamCount>(); + o3d::GetParamCount& cmd = GetCmdSpace<o3d::GetParamCount>(); cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); } void CreateParam(ResourceId param_id, ResourceId effect_id, uint32 index) { - cmd::CreateParam& cmd = GetCmdSpace<cmd::CreateParam>(); + o3d::CreateParam& cmd = GetCmdSpace<o3d::CreateParam>(); cmd.Init(param_id, effect_id, index); } void CreateParamByName( ResourceId param_id, ResourceId effect_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::CreateParamByName& cmd = GetCmdSpace<cmd::CreateParamByName>(); + o3d::CreateParamByName& cmd = GetCmdSpace<o3d::CreateParamByName>(); cmd.Init(param_id, effect_id, size, shared_memory_id, shared_memory_offset); } void CreateParamByNameImmediate( ResourceId param_id, ResourceId effect_id, uint32 size, const void* data) { - cmd::CreateParamByNameImmediate& cmd = - GetImmediateCmdSpace<cmd::CreateParamByNameImmediate>(size); + o3d::CreateParamByNameImmediate& cmd = + GetImmediateCmdSpace<o3d::CreateParamByNameImmediate>(size); cmd.Init(param_id, effect_id, size, data); } void DestroyParam(ResourceId param_id) { - cmd::DestroyParam& cmd = GetCmdSpace<cmd::DestroyParam>(); + o3d::DestroyParam& cmd = GetCmdSpace<o3d::DestroyParam>(); cmd.Init(param_id); } void SetParamData( ResourceId param_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::SetParamData& cmd = GetCmdSpace<cmd::SetParamData>(); + o3d::SetParamData& cmd = GetCmdSpace<o3d::SetParamData>(); cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); } void SetParamDataImmediate( ResourceId param_id, uint32 size, const void* data) { - cmd::SetParamDataImmediate& cmd = - GetImmediateCmdSpace<cmd::SetParamDataImmediate>(size); + o3d::SetParamDataImmediate& cmd = + GetImmediateCmdSpace<o3d::SetParamDataImmediate>(size); cmd.Init(param_id, size, data); } void GetParamDesc( ResourceId param_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetParamDesc& cmd = GetCmdSpace<cmd::GetParamDesc>(); + o3d::GetParamDesc& cmd = GetCmdSpace<o3d::GetParamDesc>(); cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); } void GetStreamCount( ResourceId effect_id, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetStreamCount& cmd = GetCmdSpace<cmd::GetStreamCount>(); + o3d::GetStreamCount& cmd = GetCmdSpace<o3d::GetStreamCount>(); cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); } void GetStreamDesc( ResourceId effect_id, uint32 index, uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetStreamDesc& cmd = GetCmdSpace<cmd::GetStreamDesc>(); + o3d::GetStreamDesc& cmd = GetCmdSpace<o3d::GetStreamDesc>(); cmd.Init(effect_id, index, size, shared_memory_id, shared_memory_offset); } void DestroyTexture(ResourceId texture_id) { - cmd::DestroyTexture& cmd = GetCmdSpace<cmd::DestroyTexture>(); + o3d::DestroyTexture& cmd = GetCmdSpace<o3d::DestroyTexture>(); cmd.Init(texture_id); } @@ -330,7 +330,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 width, uint32 height, uint32 levels, texture::Format format, bool enable_render_surfaces) { - cmd::CreateTexture2d& cmd = GetCmdSpace<cmd::CreateTexture2d>(); + o3d::CreateTexture2d& cmd = GetCmdSpace<o3d::CreateTexture2d>(); cmd.Init(texture_id, width, height, levels, format, enable_render_surfaces); @@ -341,7 +341,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 width, uint32 height, uint32 depth, uint32 levels, texture::Format format, bool enable_render_surfaces) { - cmd::CreateTexture3d& cmd = GetCmdSpace<cmd::CreateTexture3d>(); + o3d::CreateTexture3d& cmd = GetCmdSpace<o3d::CreateTexture3d>(); cmd.Init(texture_id, width, height, depth, levels, format, @@ -352,7 +352,7 @@ class O3DCmdHelper : public CommandBufferHelper { ResourceId texture_id, uint32 edge_length, uint32 levels, texture::Format format, bool enable_render_surfaces) { - cmd::CreateTextureCube& cmd = GetCmdSpace<cmd::CreateTextureCube>(); + o3d::CreateTextureCube& cmd = GetCmdSpace<o3d::CreateTextureCube>(); cmd.Init(texture_id, edge_length, levels, format, enable_render_surfaces); @@ -373,7 +373,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::SetTextureData& cmd = GetCmdSpace<cmd::SetTextureData>(); + o3d::SetTextureData& cmd = GetCmdSpace<o3d::SetTextureData>(); cmd.Init( texture_id, x, @@ -405,8 +405,8 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 slice_pitch, uint32 size, const void* data) { - cmd::SetTextureDataImmediate& cmd = - GetImmediateCmdSpace<cmd::SetTextureDataImmediate>(size); + o3d::SetTextureDataImmediate& cmd = + GetImmediateCmdSpace<o3d::SetTextureDataImmediate>(size); cmd.Init( texture_id, x, @@ -438,7 +438,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 size, uint32 shared_memory_id, uint32 shared_memory_offset) { - cmd::GetTextureData& cmd = GetCmdSpace<cmd::GetTextureData>(); + o3d::GetTextureData& cmd = GetCmdSpace<o3d::GetTextureData>(); cmd.Init( texture_id, x, @@ -457,12 +457,12 @@ class O3DCmdHelper : public CommandBufferHelper { } void CreateSampler(ResourceId sampler_id) { - cmd::CreateSampler& cmd = GetCmdSpace<cmd::CreateSampler>(); + o3d::CreateSampler& cmd = GetCmdSpace<o3d::CreateSampler>(); cmd.Init(sampler_id); } void DestroySampler(ResourceId sampler_id) { - cmd::DestroySampler& cmd = GetCmdSpace<cmd::DestroySampler>(); + o3d::DestroySampler& cmd = GetCmdSpace<o3d::DestroySampler>(); cmd.Init(sampler_id); } @@ -475,7 +475,7 @@ class O3DCmdHelper : public CommandBufferHelper { sampler::FilteringMode min_filter_value, sampler::FilteringMode mip_filter_value, uint8 max_anisotropy) { - cmd::SetSamplerStates& cmd = GetCmdSpace<cmd::SetSamplerStates>(); + o3d::SetSamplerStates& cmd = GetCmdSpace<o3d::SetSamplerStates>(); cmd.Init( sampler_id, address_u_value, @@ -490,13 +490,13 @@ class O3DCmdHelper : public CommandBufferHelper { void SetSamplerBorderColor( ResourceId sampler_id, float red, float green, float blue, float alpha) { - cmd::SetSamplerBorderColor& cmd = - GetCmdSpace<cmd::SetSamplerBorderColor>(); + o3d::SetSamplerBorderColor& cmd = + GetCmdSpace<o3d::SetSamplerBorderColor>(); cmd.Init(sampler_id, red, green, blue, alpha); } void SetSamplerTexture(ResourceId sampler_id, ResourceId texture_id) { - cmd::SetSamplerTexture& cmd = GetCmdSpace<cmd::SetSamplerTexture>(); + o3d::SetSamplerTexture& cmd = GetCmdSpace<o3d::SetSamplerTexture>(); cmd.Init(sampler_id, texture_id); } @@ -506,7 +506,7 @@ class O3DCmdHelper : public CommandBufferHelper { uint32 width, uint32 height, bool enable) { - cmd::SetScissor& cmd = GetCmdSpace<cmd::SetScissor>(); + o3d::SetScissor& cmd = GetCmdSpace<o3d::SetScissor>(); cmd.Init( x, y, @@ -516,28 +516,29 @@ class O3DCmdHelper : public CommandBufferHelper { } void SetPolygonOffset(float slope_factor, float units) { - cmd::SetPolygonOffset& cmd = GetCmdSpace<cmd::SetPolygonOffset>(); + o3d::SetPolygonOffset& cmd = GetCmdSpace<o3d::SetPolygonOffset>(); cmd.Init(slope_factor, units); } void SetPointLineRaster( bool line_smooth_enable, bool point_sprite_enable, float point_size) { - cmd::SetPointLineRaster& cmd = GetCmdSpace<cmd::SetPointLineRaster>(); + o3d::SetPointLineRaster& cmd = GetCmdSpace<o3d::SetPointLineRaster>(); cmd.Init(line_smooth_enable, point_sprite_enable, point_size); } - void SetPolygonRaster(PolygonMode fill_mode, FaceCullMode cull_mode) { - cmd::SetPolygonRaster& cmd = GetCmdSpace<cmd::SetPolygonRaster>(); + void SetPolygonRaster(o3d::PolygonMode fill_mode, + o3d::FaceCullMode cull_mode) { + o3d::SetPolygonRaster& cmd = GetCmdSpace<o3d::SetPolygonRaster>(); cmd.Init(fill_mode, cull_mode); } - void SetAlphaTest(Comparison func, bool enable, float value) { - cmd::SetAlphaTest& cmd = GetCmdSpace<cmd::SetAlphaTest>(); + void SetAlphaTest(o3d::Comparison func, bool enable, float value) { + o3d::SetAlphaTest& cmd = GetCmdSpace<o3d::SetAlphaTest>(); cmd.Init(func, enable, value); } - void SetDepthTest(Comparison func, bool write_enable, bool enable) { - cmd::SetDepthTest& cmd = GetCmdSpace<cmd::SetDepthTest>(); + void SetDepthTest(o3d::Comparison func, bool write_enable, bool enable) { + o3d::SetDepthTest& cmd = GetCmdSpace<o3d::SetDepthTest>(); cmd.Init(func, write_enable, enable); } @@ -547,15 +548,15 @@ class O3DCmdHelper : public CommandBufferHelper { uint8 reference_value, bool separate_ccw, bool enable, - Comparison cw_func, - StencilOp cw_pass_op, - StencilOp cw_fail_op, - StencilOp cw_z_fail_op, - Comparison ccw_func, - StencilOp ccw_pass_op, - StencilOp ccw_fail_op, - StencilOp ccw_z_fail_op) { - cmd::SetStencilTest& cmd = GetCmdSpace<cmd::SetStencilTest>(); + o3d::Comparison cw_func, + o3d::StencilOp cw_pass_op, + o3d::StencilOp cw_fail_op, + o3d::StencilOp cw_z_fail_op, + o3d::Comparison ccw_func, + o3d::StencilOp ccw_pass_op, + o3d::StencilOp ccw_fail_op, + o3d::StencilOp ccw_z_fail_op) { + o3d::SetStencilTest& cmd = GetCmdSpace<o3d::SetStencilTest>(); cmd.Init( write_mask, compare_mask, @@ -573,20 +574,20 @@ class O3DCmdHelper : public CommandBufferHelper { } void SetColorWrite(uint8 mask, bool dither_enable) { - cmd::SetColorWrite& cmd = GetCmdSpace<cmd::SetColorWrite>(); + o3d::SetColorWrite& cmd = GetCmdSpace<o3d::SetColorWrite>(); cmd.Init(mask, dither_enable); } void SetBlending( - BlendFunc color_src_func, - BlendFunc color_dst_func, - BlendEq color_eq, - BlendFunc alpha_src_func, - BlendFunc alpha_dst_func, - BlendEq alpha_eq, + o3d::BlendFunc color_src_func, + o3d::BlendFunc color_dst_func, + o3d::BlendEq color_eq, + o3d::BlendFunc alpha_src_func, + o3d::BlendFunc alpha_dst_func, + o3d::BlendEq alpha_eq, bool separate_alpha, bool enable) { - cmd::SetBlending& cmd = GetCmdSpace<cmd::SetBlending>(); + o3d::SetBlending& cmd = GetCmdSpace<o3d::SetBlending>(); cmd.Init( color_src_func, color_dst_func, @@ -599,7 +600,7 @@ class O3DCmdHelper : public CommandBufferHelper { } void SetBlendingColor(float red, float green, float blue, float alpha) { - cmd::SetBlendingColor& cmd = GetCmdSpace<cmd::SetBlendingColor>(); + o3d::SetBlendingColor& cmd = GetCmdSpace<o3d::SetBlendingColor>(); cmd.Init(red, green, blue, alpha); } @@ -607,35 +608,35 @@ class O3DCmdHelper : public CommandBufferHelper { ResourceId render_surface_id, ResourceId texture_id, uint32 width, uint32 height, uint32 level, uint32 side) { - cmd::CreateRenderSurface& cmd = GetCmdSpace<cmd::CreateRenderSurface>(); + o3d::CreateRenderSurface& cmd = GetCmdSpace<o3d::CreateRenderSurface>(); cmd.Init(render_surface_id, texture_id, width, height, level, side); } void DestroyRenderSurface(ResourceId render_surface_id) { - cmd::DestroyRenderSurface& cmd = - GetCmdSpace<cmd::DestroyRenderSurface>(); + o3d::DestroyRenderSurface& cmd = + GetCmdSpace<o3d::DestroyRenderSurface>(); cmd.Init(render_surface_id); } void CreateDepthSurface( ResourceId depth_surface_id, uint32 width, uint32 height) { - cmd::CreateDepthSurface& cmd = GetCmdSpace<cmd::CreateDepthSurface>(); + o3d::CreateDepthSurface& cmd = GetCmdSpace<o3d::CreateDepthSurface>(); cmd.Init(depth_surface_id, width, height); } void DestroyDepthSurface(ResourceId depth_surface_id) { - cmd::DestroyDepthSurface& cmd = GetCmdSpace<cmd::DestroyDepthSurface>(); + o3d::DestroyDepthSurface& cmd = GetCmdSpace<o3d::DestroyDepthSurface>(); cmd.Init(depth_surface_id); } void SetRenderSurface( ResourceId render_surface_id, ResourceId depth_surface_id) { - cmd::SetRenderSurface& cmd = GetCmdSpace<cmd::SetRenderSurface>(); + o3d::SetRenderSurface& cmd = GetCmdSpace<o3d::SetRenderSurface>(); cmd.Init(render_surface_id, depth_surface_id); } void SetBackSurfaces() { - cmd::SetBackSurfaces& cmd = GetCmdSpace<cmd::SetBackSurfaces>(); + o3d::SetBackSurfaces& cmd = GetCmdSpace<o3d::SetBackSurfaces>(); cmd.Init(); } }; diff --git a/o3d/command_buffer/command_buffer.gyp b/o3d/command_buffer/command_buffer.gyp index c54e8253..82fe350 100644 --- a/o3d/command_buffer/command_buffer.gyp +++ b/o3d/command_buffer/command_buffer.gyp @@ -40,8 +40,8 @@ 'sources': [ 'common/cross/bitfield_helpers.h', 'common/cross/cmd_buffer_common.h', - 'common/cross/cmd_buffer_format.h', - 'common/cross/cmd_buffer_format.cc', + 'common/cross/o3d_cmd_format.h', + 'common/cross/o3d_cmd_format.cc', 'common/cross/gapi_interface.h', 'common/cross/logging.h', 'common/cross/mocks.h', diff --git a/o3d/command_buffer/common/cross/gapi_interface.h b/o3d/command_buffer/common/cross/gapi_interface.h index a6f47a3..668632b 100644 --- a/o3d/command_buffer/common/cross/gapi_interface.h +++ b/o3d/command_buffer/common/cross/gapi_interface.h @@ -38,10 +38,11 @@ #include "command_buffer/common/cross/constants.h" #include "command_buffer/common/cross/resource.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" namespace o3d { namespace command_buffer { +namespace o3d { // RBGA color definition. struct RGBA { @@ -827,6 +828,7 @@ class GAPIInterface { virtual void SetBackSurfaces() = 0; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/common/cross/cmd_buffer_format.cc b/o3d/command_buffer/common/cross/o3d_cmd_format.cc index b7b9590..be6bef1 100644 --- a/o3d/command_buffer/common/cross/cmd_buffer_format.cc +++ b/o3d/command_buffer/common/cross/o3d_cmd_format.cc @@ -33,11 +33,11 @@ // This file contains the binary format definition of the command buffer and // command buffer commands. -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" namespace o3d { namespace command_buffer { -namespace cmd { +namespace o3d { const char* GetCommandName(CommandId id) { static const char* const names[] = { diff --git a/o3d/command_buffer/common/cross/cmd_buffer_format.h b/o3d/command_buffer/common/cross/o3d_cmd_format.h index 465a692..fb80230 100644 --- a/o3d/command_buffer/common/cross/cmd_buffer_format.h +++ b/o3d/command_buffer/common/cross/o3d_cmd_format.h @@ -64,6 +64,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { // This macro is used to safely and convienently expand the list of commnad // buffer commands in to various lists and never have them get out of sync. To @@ -240,8 +241,6 @@ enum BlendFunc { kNumBlendFunc }; -namespace cmd { - const char* GetCommandName(CommandId id); // Make sure the compiler does not add extra padding to any of the command @@ -250,8 +249,8 @@ O3D_PUSH_STRUCTURE_PACKING_1; struct Noop { typedef Noop ValueType; - static const CommandId kCmdId = command_buffer::kNoop; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kNoop; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 skip_count) { header.Init(kCmdId, skip_count + 1); @@ -275,8 +274,8 @@ COMPILE_ASSERT(offsetof(Noop, header) == 0, Offsetof_Noop_header_not_0); struct SetToken { typedef SetToken ValueType; - static const CommandId kCmdId = command_buffer::kSetToken; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetToken; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -303,8 +302,8 @@ COMPILE_ASSERT(offsetof(SetToken, token) == 4, struct BeginFrame { typedef BeginFrame ValueType; - static const CommandId kCmdId = command_buffer::kBeginFrame; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kBeginFrame; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -327,8 +326,8 @@ COMPILE_ASSERT(offsetof(BeginFrame, header) == 0, struct EndFrame { typedef EndFrame ValueType; - static const CommandId kCmdId = command_buffer::kEndFrame; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kEndFrame; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -351,8 +350,8 @@ COMPILE_ASSERT(offsetof(EndFrame, header) == 0, struct Clear { typedef Clear ValueType; - static const CommandId kCmdId = command_buffer::kClear; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kClear; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -409,8 +408,8 @@ COMPILE_ASSERT(offsetof(Clear, stencil) == 28, struct SetViewport { typedef SetViewport ValueType; - static const CommandId kCmdId = command_buffer::kSetViewport; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetViewport; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -476,8 +475,8 @@ COMPILE_ASSERT(offsetof(SetViewport, z_max) == 24, struct CreateVertexBuffer { typedef CreateVertexBuffer ValueType; - static const CommandId kCmdId = command_buffer::kCreateVertexBuffer; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateVertexBuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -516,8 +515,8 @@ COMPILE_ASSERT(offsetof(CreateVertexBuffer, flags) == 12, struct DestroyVertexBuffer { typedef DestroyVertexBuffer ValueType; - static const CommandId kCmdId = command_buffer::kDestroyVertexBuffer; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyVertexBuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -546,8 +545,8 @@ COMPILE_ASSERT(offsetof(DestroyVertexBuffer, vertex_buffer_id) == 4, struct SetVertexBufferDataImmediate { typedef SetVertexBufferDataImmediate ValueType; - static const CommandId kCmdId = command_buffer::kSetVertexBufferDataImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kSetVertexBufferDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 size) { header.SetCmdBySize<ValueType>(size); @@ -583,8 +582,8 @@ COMPILE_ASSERT(offsetof(SetVertexBufferDataImmediate, offset) == 8, struct SetVertexBufferData { typedef SetVertexBufferData ValueType; - static const CommandId kCmdId = command_buffer::kSetVertexBufferData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetVertexBufferData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -629,8 +628,8 @@ COMPILE_ASSERT(offsetof(SetVertexBufferData, shared_memory) == 16, struct GetVertexBufferData { typedef GetVertexBufferData ValueType; - static const CommandId kCmdId = command_buffer::kGetVertexBufferData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetVertexBufferData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -675,8 +674,8 @@ COMPILE_ASSERT(offsetof(GetVertexBufferData, shared_memory) == 16, struct CreateIndexBuffer { typedef CreateIndexBuffer ValueType; - static const CommandId kCmdId = command_buffer::kCreateIndexBuffer; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateIndexBuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -715,8 +714,8 @@ COMPILE_ASSERT(offsetof(CreateIndexBuffer, flags) == 12, struct DestroyIndexBuffer { typedef DestroyIndexBuffer ValueType; - static const CommandId kCmdId = command_buffer::kDestroyIndexBuffer; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyIndexBuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -745,8 +744,8 @@ COMPILE_ASSERT(offsetof(DestroyIndexBuffer, index_buffer_id) == 4, struct SetIndexBufferDataImmediate { typedef SetIndexBufferDataImmediate ValueType; - static const CommandId kCmdId = command_buffer::kSetIndexBufferDataImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kSetIndexBufferDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 size) { header.SetCmdBySize<ValueType>(size); @@ -782,8 +781,8 @@ COMPILE_ASSERT(offsetof(SetIndexBufferDataImmediate, offset) == 8, struct SetIndexBufferData { typedef SetIndexBufferData ValueType; - static const CommandId kCmdId = command_buffer::kSetIndexBufferData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetIndexBufferData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -828,8 +827,8 @@ COMPILE_ASSERT(offsetof(SetIndexBufferData, shared_memory) == 16, struct GetIndexBufferData { typedef GetIndexBufferData ValueType; - static const CommandId kCmdId = command_buffer::kGetIndexBufferData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetIndexBufferData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -874,8 +873,8 @@ COMPILE_ASSERT(offsetof(GetIndexBufferData, shared_memory) == 16, struct CreateVertexStruct { typedef CreateVertexStruct ValueType; - static const CommandId kCmdId = command_buffer::kCreateVertexStruct; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateVertexStruct; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -908,8 +907,8 @@ COMPILE_ASSERT(offsetof(CreateVertexStruct, input_count) == 8, struct DestroyVertexStruct { typedef DestroyVertexStruct ValueType; - static const CommandId kCmdId = command_buffer::kDestroyVertexStruct; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyVertexStruct; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -938,8 +937,8 @@ COMPILE_ASSERT(offsetof(DestroyVertexStruct, vertex_struct_id) == 4, struct SetVertexInput { typedef SetVertexInput ValueType; - static const CommandId kCmdId = command_buffer::kSetVertexInput; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetVertexInput; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // type_stride_semantic field. typedef BitField<0, 4> SemanticIndex; @@ -1018,8 +1017,8 @@ COMPILE_ASSERT(offsetof(SetVertexInput, type_stride_semantic) == 20, struct SetVertexStruct { typedef SetVertexStruct ValueType; - static const CommandId kCmdId = command_buffer::kSetVertexStruct; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetVertexStruct; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1048,8 +1047,8 @@ COMPILE_ASSERT(offsetof(SetVertexStruct, vertex_struct_id) == 4, struct Draw { typedef Draw ValueType; - static const CommandId kCmdId = command_buffer::kDraw; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDraw; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1086,8 +1085,8 @@ COMPILE_ASSERT(offsetof(Draw, count) == 12, struct DrawIndexed { typedef DrawIndexed ValueType; - static const CommandId kCmdId = command_buffer::kDrawIndexed; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDrawIndexed; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1153,8 +1152,8 @@ COMPILE_ASSERT(offsetof(DrawIndexed, max_index) == 24, struct CreateEffect { typedef CreateEffect ValueType; - static const CommandId kCmdId = command_buffer::kCreateEffect; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateEffect; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1193,8 +1192,8 @@ COMPILE_ASSERT(offsetof(CreateEffect, shared_memory) == 12, struct CreateEffectImmediate { typedef CreateEffectImmediate ValueType; - static const CommandId kCmdId = command_buffer::kCreateEffectImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kCreateEffectImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 size) { header.SetCmdBySize<ValueType>(size); @@ -1228,8 +1227,8 @@ COMPILE_ASSERT(offsetof(CreateEffectImmediate, size) == 8, struct DestroyEffect { typedef DestroyEffect ValueType; - static const CommandId kCmdId = command_buffer::kDestroyEffect; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyEffect; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1257,8 +1256,8 @@ COMPILE_ASSERT(offsetof(DestroyEffect, effect_id) == 4, struct SetEffect { typedef SetEffect ValueType; - static const CommandId kCmdId = command_buffer::kSetEffect; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetEffect; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1286,8 +1285,8 @@ COMPILE_ASSERT(offsetof(SetEffect, effect_id) == 4, struct GetParamCount { typedef GetParamCount ValueType; - static const CommandId kCmdId = command_buffer::kGetParamCount; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetParamCount; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1326,8 +1325,8 @@ COMPILE_ASSERT(offsetof(GetParamCount, shared_memory) == 12, struct CreateParam { typedef CreateParam ValueType; - static const CommandId kCmdId = command_buffer::kCreateParam; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateParam; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1364,8 +1363,8 @@ COMPILE_ASSERT(offsetof(CreateParam, index) == 12, struct CreateParamByName { typedef CreateParamByName ValueType; - static const CommandId kCmdId = command_buffer::kCreateParamByName; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateParamByName; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1410,8 +1409,8 @@ COMPILE_ASSERT(offsetof(CreateParamByName, shared_memory) == 16, struct CreateParamByNameImmediate { typedef CreateParamByNameImmediate ValueType; - static const CommandId kCmdId = command_buffer::kCreateParamByNameImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kCreateParamByNameImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 size) { header.SetCmdBySize<ValueType>(size); @@ -1451,8 +1450,8 @@ COMPILE_ASSERT(offsetof(CreateParamByNameImmediate, size) == 12, struct DestroyParam { typedef DestroyParam ValueType; - static const CommandId kCmdId = command_buffer::kDestroyParam; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyParam; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1480,8 +1479,8 @@ COMPILE_ASSERT(offsetof(DestroyParam, param_id) == 4, struct SetParamData { typedef SetParamData ValueType; - static const CommandId kCmdId = command_buffer::kSetParamData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetParamData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1520,8 +1519,8 @@ COMPILE_ASSERT(offsetof(SetParamData, shared_memory) == 12, struct SetParamDataImmediate { typedef SetParamDataImmediate ValueType; - static const CommandId kCmdId = command_buffer::kSetParamDataImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kSetParamDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; void SetHeader(uint32 size) { header.SetCmdBySize<ValueType>(size); @@ -1556,8 +1555,8 @@ COMPILE_ASSERT(offsetof(SetParamDataImmediate, size) == 8, struct GetParamDesc { typedef GetParamDesc ValueType; - static const CommandId kCmdId = command_buffer::kGetParamDesc; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetParamDesc; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1596,8 +1595,8 @@ COMPILE_ASSERT(offsetof(GetParamDesc, shared_memory) == 12, struct GetStreamCount { typedef GetStreamCount ValueType; - static const CommandId kCmdId = command_buffer::kGetStreamCount; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetStreamCount; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1637,8 +1636,8 @@ COMPILE_ASSERT(offsetof(GetStreamCount, shared_memory) == 12, struct GetStreamDesc { typedef GetStreamDesc ValueType; - static const CommandId kCmdId = command_buffer::kGetStreamDesc; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetStreamDesc; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1681,8 +1680,8 @@ COMPILE_ASSERT(offsetof(GetStreamDesc, shared_memory) == 16, struct DestroyTexture { typedef DestroyTexture ValueType; - static const CommandId kCmdId = command_buffer::kDestroyTexture; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyTexture; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -1710,8 +1709,8 @@ COMPILE_ASSERT(offsetof(DestroyTexture, texture_id) == 4, struct CreateTexture2d { typedef CreateTexture2d ValueType; - static const CommandId kCmdId = command_buffer::kCreateTexture2d; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateTexture2d; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> Width; @@ -1769,8 +1768,8 @@ COMPILE_ASSERT(offsetof(CreateTexture2d, levels_format_flags) == 12, struct CreateTexture3d { typedef CreateTexture3d ValueType; - static const CommandId kCmdId = command_buffer::kCreateTexture3d; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateTexture3d; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> Width; @@ -1836,8 +1835,8 @@ COMPILE_ASSERT(offsetof(CreateTexture3d, levels_format_flags) == 16, struct CreateTextureCube { typedef CreateTextureCube ValueType; - static const CommandId kCmdId = command_buffer::kCreateTextureCube; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateTextureCube; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> Side; @@ -1893,8 +1892,8 @@ COMPILE_ASSERT(offsetof(CreateTextureCube, levels_format_flags) == 12, struct SetTextureData { typedef SetTextureData ValueType; - static const CommandId kCmdId = command_buffer::kSetTextureData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetTextureData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> X; @@ -2013,8 +2012,8 @@ COMPILE_ASSERT(offsetof(SetTextureData, shared_memory) == 36, struct SetTextureDataImmediate { typedef SetTextureDataImmediate ValueType; - static const CommandId kCmdId = command_buffer::kSetTextureDataImmediate; - static const ArgFlags kArgFlags = kAtLeastN; + static const CommandId kCmdId = kSetTextureDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; // argument 1 typedef BitField<0, 16> X; @@ -2127,8 +2126,8 @@ COMPILE_ASSERT(offsetof(SetTextureDataImmediate, size) == 32, struct GetTextureData { typedef GetTextureData ValueType; - static const CommandId kCmdId = command_buffer::kGetTextureData; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kGetTextureData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> X; @@ -2247,8 +2246,8 @@ COMPILE_ASSERT(offsetof(GetTextureData, shared_memory) == 36, struct CreateSampler { typedef CreateSampler ValueType; - static const CommandId kCmdId = command_buffer::kCreateSampler; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateSampler; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2276,8 +2275,8 @@ COMPILE_ASSERT(offsetof(CreateSampler, sampler_id) == 4, struct DestroySampler { typedef DestroySampler ValueType; - static const CommandId kCmdId = command_buffer::kDestroySampler; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroySampler; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2305,8 +2304,8 @@ COMPILE_ASSERT(offsetof(DestroySampler, sampler_id) == 4, struct SetSamplerStates { typedef SetSamplerStates ValueType; - static const CommandId kCmdId = command_buffer::kSetSamplerStates; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetSamplerStates; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 2 typedef BitField<0, 3> AddressingU; @@ -2381,8 +2380,8 @@ COMPILE_ASSERT(offsetof(SetSamplerStates, sampler_states) == 8, struct SetSamplerBorderColor { typedef SetSamplerBorderColor ValueType; - static const CommandId kCmdId = command_buffer::kSetSamplerBorderColor; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetSamplerBorderColor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2429,8 +2428,8 @@ COMPILE_ASSERT(offsetof(SetSamplerBorderColor, alpha) == 20, struct SetSamplerTexture { typedef SetSamplerTexture ValueType; - static const CommandId kCmdId = command_buffer::kSetSamplerTexture; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetSamplerTexture; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2463,8 +2462,8 @@ COMPILE_ASSERT(offsetof(SetSamplerTexture, texture_id) == 8, struct SetScissor { typedef SetScissor ValueType; - static const CommandId kCmdId = command_buffer::kSetScissor; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetScissor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 15> X; @@ -2524,8 +2523,8 @@ COMPILE_ASSERT(offsetof(SetScissor, width_height) == 8, struct SetPolygonOffset { typedef SetPolygonOffset ValueType; - static const CommandId kCmdId = command_buffer::kSetPolygonOffset; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetPolygonOffset; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2558,8 +2557,8 @@ COMPILE_ASSERT(offsetof(SetPolygonOffset, units) == 8, struct SetPointLineRaster { typedef SetPointLineRaster ValueType; - static const CommandId kCmdId = command_buffer::kSetPointLineRaster; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetPointLineRaster; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 1> LineSmoothEnable; @@ -2603,8 +2602,8 @@ COMPILE_ASSERT(offsetof(SetPointLineRaster, point_size) == 8, struct SetPolygonRaster { typedef SetPolygonRaster ValueType; - static const CommandId kCmdId = command_buffer::kSetPolygonRaster; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetPolygonRaster; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 2> FillMode; @@ -2640,8 +2639,8 @@ COMPILE_ASSERT(offsetof(SetPolygonRaster, fill_cull) == 4, struct SetAlphaTest { typedef SetAlphaTest ValueType; - static const CommandId kCmdId = command_buffer::kSetAlphaTest; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetAlphaTest; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 3> Func; @@ -2679,8 +2678,8 @@ COMPILE_ASSERT(offsetof(SetAlphaTest, value) == 8, struct SetDepthTest { typedef SetDepthTest ValueType; - static const CommandId kCmdId = command_buffer::kSetDepthTest; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetDepthTest; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 3> Func; @@ -2719,8 +2718,8 @@ COMPILE_ASSERT(offsetof(SetDepthTest, func_enable) == 4, struct SetStencilTest { typedef SetStencilTest ValueType; - static const CommandId kCmdId = command_buffer::kSetStencilTest; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetStencilTest; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 8> WriteMask; @@ -2825,8 +2824,8 @@ COMPILE_ASSERT(offsetof(SetStencilTest, stencil_args1) == 8, struct SetColorWrite { typedef SetColorWrite ValueType; - static const CommandId kCmdId = command_buffer::kSetColorWrite; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetColorWrite; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 1> RedMask; @@ -2868,8 +2867,8 @@ COMPILE_ASSERT(offsetof(SetColorWrite, flags) == 4, struct SetBlending { typedef SetBlending ValueType; - static const CommandId kCmdId = command_buffer::kSetBlending; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetBlending; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 0 typedef BitField<0, 4> ColorSrcFunc; @@ -2943,8 +2942,8 @@ COMPILE_ASSERT(offsetof(SetBlending, blend_settings) == 4, struct SetBlendingColor { typedef SetBlendingColor ValueType; - static const CommandId kCmdId = command_buffer::kSetBlendingColor; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetBlendingColor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -2986,8 +2985,8 @@ COMPILE_ASSERT(offsetof(SetBlendingColor, alpha) == 16, struct CreateRenderSurface { typedef CreateRenderSurface ValueType; - static const CommandId kCmdId = command_buffer::kCreateRenderSurface; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateRenderSurface; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> Width; @@ -3045,8 +3044,8 @@ COMPILE_ASSERT(offsetof(CreateRenderSurface, texture_id) == 16, struct DestroyRenderSurface { typedef DestroyRenderSurface ValueType; - static const CommandId kCmdId = command_buffer::kDestroyRenderSurface; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyRenderSurface; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -3075,8 +3074,8 @@ COMPILE_ASSERT(offsetof(DestroyRenderSurface, render_surface_id) == 4, struct CreateDepthSurface { typedef CreateDepthSurface ValueType; - static const CommandId kCmdId = command_buffer::kCreateDepthSurface; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kCreateDepthSurface; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; // argument 1 typedef BitField<0, 16> Width; @@ -3115,8 +3114,8 @@ COMPILE_ASSERT(offsetof(CreateDepthSurface, width_height) == 8, struct DestroyDepthSurface { typedef DestroyDepthSurface ValueType; - static const CommandId kCmdId = command_buffer::kDestroyDepthSurface; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kDestroyDepthSurface; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -3145,8 +3144,8 @@ COMPILE_ASSERT(offsetof(DestroyDepthSurface, depth_surface_id) == 4, struct SetRenderSurface { typedef SetRenderSurface ValueType; - static const CommandId kCmdId = command_buffer::kSetRenderSurface; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetRenderSurface; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); @@ -3180,8 +3179,8 @@ COMPILE_ASSERT(offsetof(SetRenderSurface, depth_surface_id) == 8, struct SetBackSurfaces { typedef SetBackSurfaces ValueType; - static const CommandId kCmdId = command_buffer::kSetBackSurfaces; - static const ArgFlags kArgFlags = kFixed; + static const CommandId kCmdId = kSetBackSurfaces; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; void SetHeader() { header.SetCmd<ValueType>(); diff --git a/o3d/command_buffer/service/cross/cmd_parser.cc b/o3d/command_buffer/service/cross/cmd_parser.cc index 6f72aed..26eacbf 100644 --- a/o3d/command_buffer/service/cross/cmd_parser.cc +++ b/o3d/command_buffer/service/cross/cmd_parser.cc @@ -34,7 +34,7 @@ #include "command_buffer/service/cross/cmd_parser.h" // TODO(gman): remove this so we can use this code for different formats. -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" namespace o3d { namespace command_buffer { @@ -87,8 +87,9 @@ parse_error::ParseError CommandParser::ProcessCommand() { // It seems like we need an official way to turn on a debug mode and // get these errors. if (result != parse_error::kParseNoError) { - DLOG(INFO) << "Error: " << result << " for Command " - << cmd::GetCommandName(static_cast<CommandId>(header.command)); + DLOG(INFO) + << "Error: " << result << " for Command " + << o3d::GetCommandName(static_cast<o3d::CommandId>(header.command)); } get_ = (get + header.size) % entry_count_; return result; 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 diff --git a/o3d/command_buffer/service/cross/gapi_decoder.h b/o3d/command_buffer/service/cross/gapi_decoder.h index 9c6cd32..a17f3ee 100644 --- a/o3d/command_buffer/service/cross/gapi_decoder.h +++ b/o3d/command_buffer/service/cross/gapi_decoder.h @@ -37,14 +37,17 @@ #include "core/cross/types.h" #include "command_buffer/service/cross/cmd_parser.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" namespace o3d { namespace command_buffer { -class GAPIInterface; class CommandBufferEngine; +namespace o3d { + +class GAPIInterface; + // This class implements the AsyncAPIInterface interface, decoding GAPI // commands and sending them to a GAPI interface. class GAPIDecoder : public AsyncAPIInterface { @@ -82,7 +85,7 @@ class GAPIDecoder : public AsyncAPIInterface { #define O3D_COMMAND_BUFFER_CMD_OP(name) \ ParseError Handle ## name( \ unsigned int arg_count, \ - const cmd::name& args); \ + const o3d::name& args); \ O3D_COMMAND_BUFFER_CMDS(O3D_COMMAND_BUFFER_CMD_OP) @@ -92,6 +95,7 @@ class GAPIDecoder : public AsyncAPIInterface { CommandBufferEngine *engine_; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/effect_gl.cc b/o3d/command_buffer/service/cross/gl/effect_gl.cc index 2d24f7b..a45994d 100644 --- a/o3d/command_buffer/service/cross/gl/effect_gl.cc +++ b/o3d/command_buffer/service/cross/gl/effect_gl.cc @@ -42,6 +42,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { EffectParamGL::EffectParamGL(effect_param::DataType data_type, EffectGL *effect, @@ -846,5 +847,6 @@ bool GAPIGL::ValidateEffect() { return current_effect_->Begin(this); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/effect_gl.h b/o3d/command_buffer/service/cross/gl/effect_gl.h index 8ffd6cf..cae6e6c 100644 --- a/o3d/command_buffer/service/cross/gl/effect_gl.h +++ b/o3d/command_buffer/service/cross/gl/effect_gl.h @@ -43,6 +43,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPIGL; class EffectGL; @@ -156,7 +157,7 @@ class EffectGL : public Effect { DISALLOW_COPY_AND_ASSIGN(EffectGL); }; - +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/gapi_gl.cc b/o3d/command_buffer/service/cross/gl/gapi_gl.cc index 345e2384..f6761e0 100644 --- a/o3d/command_buffer/service/cross/gl/gapi_gl.cc +++ b/o3d/command_buffer/service/cross/gl/gapi_gl.cc @@ -41,6 +41,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { GAPIGL::GAPIGL() #ifdef OS_LINUX @@ -409,5 +410,6 @@ void GAPIGL::Clear(unsigned int buffers, CHECK_GL_ERROR(); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/gapi_gl.h b/o3d/command_buffer/service/cross/gl/gapi_gl.h index 3c07ba0..af8a406 100644 --- a/o3d/command_buffer/service/cross/gl/gapi_gl.h +++ b/o3d/command_buffer/service/cross/gl/gapi_gl.h @@ -50,6 +50,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { #if defined(OS_LINUX) class XWindowWrapper; #endif // defined(OS_LINUX) @@ -459,6 +460,7 @@ class GAPIGL : public GAPIInterface { ResourceMap<RenderDepthStencilSurfaceGL> depth_surfaces_; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/geometry_gl.cc b/o3d/command_buffer/service/cross/gl/geometry_gl.cc index 47604f1..aa783a1 100644 --- a/o3d/command_buffer/service/cross/gl/geometry_gl.cc +++ b/o3d/command_buffer/service/cross/gl/geometry_gl.cc @@ -38,6 +38,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { VertexBufferGL::~VertexBufferGL() { glDeleteBuffers(1, &gl_buffer_); @@ -458,30 +459,30 @@ bool GAPIGL::ValidateStreams() { namespace { -void PrimitiveTypeToGL(command_buffer::PrimitiveType primitive_type, +void PrimitiveTypeToGL(o3d::PrimitiveType primitive_type, GLenum *gl_mode, unsigned int *count) { switch (primitive_type) { - case command_buffer::kPoints: + case o3d::kPoints: *gl_mode = GL_POINTS; break; - case command_buffer::kLines: + case o3d::kLines: *gl_mode = GL_LINES; *count *= 2; break; - case command_buffer::kLineStrips: + case o3d::kLineStrips: *gl_mode = GL_LINE_STRIP; ++*count; break; - case command_buffer::kTriangles: + case o3d::kTriangles: *gl_mode = GL_TRIANGLES; *count *= 3; break; - case command_buffer::kTriangleStrips: + case o3d::kTriangleStrips: *gl_mode = GL_TRIANGLE_STRIP; *count += 2; break; - case command_buffer::kTriangleFans: + case o3d::kTriangleFans: *gl_mode = GL_TRIANGLE_FAN; *count += 2; break; @@ -493,9 +494,9 @@ void PrimitiveTypeToGL(command_buffer::PrimitiveType primitive_type, } // anonymous namespace -parse_error::ParseError GAPIGL::Draw(PrimitiveType primitive_type, - unsigned int first, - unsigned int count) { +parse_error::ParseError GAPIGL::Draw(o3d::PrimitiveType primitive_type, + unsigned int first, + unsigned int count) { if (validate_effect_ && !ValidateEffect()) { return parse_error::kParseInvalidArguments; } @@ -514,7 +515,7 @@ parse_error::ParseError GAPIGL::Draw(PrimitiveType primitive_type, } parse_error::ParseError GAPIGL::DrawIndexed( - PrimitiveType primitive_type, + o3d::PrimitiveType primitive_type, ResourceId index_buffer_id, unsigned int first, unsigned int count, @@ -549,5 +550,6 @@ parse_error::ParseError GAPIGL::DrawIndexed( return parse_error::kParseNoError; } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/geometry_gl.h b/o3d/command_buffer/service/cross/gl/geometry_gl.h index 563653a..ad1e2e7 100644 --- a/o3d/command_buffer/service/cross/gl/geometry_gl.h +++ b/o3d/command_buffer/service/cross/gl/geometry_gl.h @@ -42,6 +42,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPIGL; @@ -138,6 +139,7 @@ class VertexStructGL : public VertexStruct { }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/render_surface_gl.cc b/o3d/command_buffer/service/cross/gl/render_surface_gl.cc index 35634ff..00fbdba 100644 --- a/o3d/command_buffer/service/cross/gl/render_surface_gl.cc +++ b/o3d/command_buffer/service/cross/gl/render_surface_gl.cc @@ -39,6 +39,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { RenderSurfaceGL::RenderSurfaceGL(int width, int height, @@ -256,6 +257,7 @@ void GAPIGL::SetBackSurfaces() { glFrontFace(GL_CCW); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/render_surface_gl.h b/o3d/command_buffer/service/cross/gl/render_surface_gl.h index 9bdb535..92f514d 100644 --- a/o3d/command_buffer/service/cross/gl/render_surface_gl.h +++ b/o3d/command_buffer/service/cross/gl/render_surface_gl.h @@ -41,6 +41,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class RenderSurfaceGL : public RenderSurface { public: @@ -110,6 +111,7 @@ class RenderDepthStencilSurfaceGL : public RenderDepthStencilSurface { DISALLOW_COPY_AND_ASSIGN(RenderDepthStencilSurfaceGL); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/sampler_gl.cc b/o3d/command_buffer/service/cross/gl/sampler_gl.cc index 7f09a4e..218b132 100644 --- a/o3d/command_buffer/service/cross/gl/sampler_gl.cc +++ b/o3d/command_buffer/service/cross/gl/sampler_gl.cc @@ -37,6 +37,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { namespace { @@ -233,6 +234,6 @@ parse_error::ParseError GAPIGL::SetSamplerTexture( return parse_error::kParseNoError; } - +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/sampler_gl.h b/o3d/command_buffer/service/cross/gl/sampler_gl.h index 07fd079..69104c0 100644 --- a/o3d/command_buffer/service/cross/gl/sampler_gl.h +++ b/o3d/command_buffer/service/cross/gl/sampler_gl.h @@ -41,6 +41,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPIGL; @@ -62,7 +63,7 @@ class SamplerGL : public Sampler { unsigned int max_anisotropy); // Sets the border color states. - void SetBorderColor(const RGBA &color); + void SetBorderColor(const o3d::RGBA &color); // Sets the texture. void SetTexture(ResourceId texture) { texture_id_ = texture; } @@ -81,6 +82,7 @@ class SamplerGL : public Sampler { ResourceId texture_id_; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/states_gl.cc b/o3d/command_buffer/service/cross/gl/states_gl.cc index 625b3e3..b4dfb41 100644 --- a/o3d/command_buffer/service/cross/gl/states_gl.cc +++ b/o3d/command_buffer/service/cross/gl/states_gl.cc @@ -32,11 +32,12 @@ // This file implements the render state-related GAPI functions on GL. -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/service/cross/gl/gapi_gl.h" namespace o3d { namespace command_buffer { +namespace o3d { namespace { @@ -45,7 +46,7 @@ GLenum kGLPolygonModes[] = { GL_LINE, GL_FILL, }; -COMPILE_ASSERT(command_buffer::kNumPolygonMode == arraysize(kGLPolygonModes), +COMPILE_ASSERT(o3d::kNumPolygonMode == arraysize(kGLPolygonModes), kGLPolygonModes_does_not_match_command_buffer_PolygonMode); GLenum kGLComparison[] = { @@ -58,7 +59,7 @@ GLenum kGLComparison[] = { GL_GEQUAL, GL_ALWAYS, }; -COMPILE_ASSERT(command_buffer::kNumComparison == arraysize(kGLComparison), +COMPILE_ASSERT(o3d::kNumComparison == arraysize(kGLComparison), kGLComparison_does_not_match_command_buffer_Comparison); GLenum kGLBlendFunc[] = { @@ -76,7 +77,7 @@ GLenum kGLBlendFunc[] = { GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, }; -COMPILE_ASSERT(command_buffer::kNumBlendFunc == arraysize(kGLBlendFunc), +COMPILE_ASSERT(o3d::kNumBlendFunc == arraysize(kGLBlendFunc), kGLBlendFunc_does_not_match_command_buffer_BlendFunc); GLenum kGLBlendEq[] = { @@ -86,7 +87,7 @@ GLenum kGLBlendEq[] = { GL_MIN, GL_MAX, }; -COMPILE_ASSERT(command_buffer::kNumBlendEq == arraysize(kGLBlendEq), +COMPILE_ASSERT(o3d::kNumBlendEq == arraysize(kGLBlendEq), kGLBlendEq_does_not_match_command_buffer_BlendEq); GLenum kGLStencilOp[] = { @@ -99,18 +100,18 @@ GLenum kGLStencilOp[] = { GL_INCR_WRAP, GL_DECR_WRAP, }; -COMPILE_ASSERT(command_buffer::kNumStencilOp == arraysize(kGLStencilOp), +COMPILE_ASSERT(o3d::kNumStencilOp == arraysize(kGLStencilOp), kGLStencilOp_does_not_match_command_buffer_StencilOp); // Check that the definition of the counter-clockwise func/ops match the // clockwise ones, just shifted by 16 bits, so that we can use // DecodeStencilFuncOps on both of them. #define CHECK_CCW_MATCHES_CW(FIELD) \ - COMPILE_ASSERT(cmd::SetStencilTest::CW ## FIELD::kLength == \ - cmd::SetStencilTest::CCW ## FIELD::kLength, \ + COMPILE_ASSERT(o3d::SetStencilTest::CW ## FIELD::kLength == \ + o3d::SetStencilTest::CCW ## FIELD::kLength, \ CCW ## FIELD ## _length_does_not_match_ ## CW ## FIELD); \ - COMPILE_ASSERT(cmd::SetStencilTest::CW ## FIELD::kShift + 16 == \ - cmd::SetStencilTest::CCW ## FIELD::kShift, \ + COMPILE_ASSERT(o3d::SetStencilTest::CW ## FIELD::kShift + 16 == \ + o3d::SetStencilTest::CCW ## FIELD::kShift, \ CCW ## FIELD ## _shift_does_not_match_ ## CW ## FIELD) CHECK_CCW_MATCHES_CW(Func); @@ -128,28 +129,28 @@ void DecodeStencilFuncOps(Uint32 params, GLenum *zfail) { // Sanity check. The value has already been tested in // GAPIDecoder::DecodeSetStencilTest in gapi_decoder.cc. - DCHECK_EQ(cmd::SetStencilTest::Unused1::Get(params), 0); + DCHECK_EQ(o3d::SetStencilTest::Unused1::Get(params), 0); // Check that the bitmask get cannot generate values outside of the allowed // range. - COMPILE_ASSERT(cmd::SetStencilTest::CWFunc::kMask < - command_buffer::kNumComparison, + COMPILE_ASSERT(o3d::SetStencilTest::CWFunc::kMask < + o3d::kNumComparison, set_stencil_test_CWFunc_may_produce_invalid_values); - *func = kGLComparison[cmd::SetStencilTest::CWFunc::Get(params)]; + *func = kGLComparison[o3d::SetStencilTest::CWFunc::Get(params)]; - COMPILE_ASSERT(cmd::SetStencilTest::CWPassOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(o3d::SetStencilTest::CWPassOp::kMask < + o3d::kNumStencilOp, set_stencil_test_CWPassOp_may_produce_invalid_values); - *pass = kGLStencilOp[cmd::SetStencilTest::CWPassOp::Get(params)]; + *pass = kGLStencilOp[o3d::SetStencilTest::CWPassOp::Get(params)]; - COMPILE_ASSERT(cmd::SetStencilTest::CWFailOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(o3d::SetStencilTest::CWFailOp::kMask < + o3d::kNumStencilOp, set_stencil_test_CWFailOp_may_produce_invalid_values); - *fail = kGLStencilOp[cmd::SetStencilTest::CWFailOp::Get(params)]; + *fail = kGLStencilOp[o3d::SetStencilTest::CWFailOp::Get(params)]; - COMPILE_ASSERT(cmd::SetStencilTest::CWZFailOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(o3d::SetStencilTest::CWZFailOp::kMask < + o3d::kNumStencilOp, set_stencil_test_CWZFailOp_may_produce_invalid_values); - *zfail = kGLStencilOp[cmd::SetStencilTest::CWZFailOp::Get(params)]; + *zfail = kGLStencilOp[o3d::SetStencilTest::CWZFailOp::Get(params)]; } } // anonymous namespace @@ -207,8 +208,8 @@ void GAPIGL::SetPolygonOffset(float slope_factor, float units) { glPolygonOffset(slope_factor, units); } -void GAPIGL::SetPolygonRaster(PolygonMode fill_mode, - FaceCullMode cull_mode) { +void GAPIGL::SetPolygonRaster(o3d::PolygonMode fill_mode, + o3d::FaceCullMode cull_mode) { DCHECK_LT(fill_mode, kNumPolygonMode); glPolygonMode(GL_FRONT_AND_BACK, kGLPolygonModes[fill_mode]); DCHECK_LT(cull_mode, kNumFaceCullMode); @@ -229,7 +230,7 @@ void GAPIGL::SetPolygonRaster(PolygonMode fill_mode, void GAPIGL::SetAlphaTest(bool enable, float reference, - Comparison comp) { + o3d::Comparison comp) { DCHECK_LT(comp, kNumComparison); if (enable) { glEnable(GL_ALPHA_TEST); @@ -241,7 +242,7 @@ void GAPIGL::SetAlphaTest(bool enable, void GAPIGL::SetDepthTest(bool enable, bool write_enable, - Comparison comp) { + o3d::Comparison comp) { DCHECK_LT(comp, kNumComparison); if (enable) { glEnable(GL_DEPTH_TEST); @@ -341,5 +342,6 @@ void GAPIGL::SetBlendingColor(const RGBA &color) { glBlendColor(color.red, color.green, color.blue, color.alpha); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/texture_gl.cc b/o3d/command_buffer/service/cross/gl/texture_gl.cc index 6a92048..8cc0d57 100644 --- a/o3d/command_buffer/service/cross/gl/texture_gl.cc +++ b/o3d/command_buffer/service/cross/gl/texture_gl.cc @@ -37,6 +37,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { namespace { @@ -643,8 +644,6 @@ bool TextureCubeGL::InstallFrameBufferObjects( } -// GAPIGL functions. - // Destroys a texture resource. parse_error::ParseError GAPIGL::DestroyTexture(ResourceId id) { // Dirty effect, because this texture id may be used. @@ -764,5 +763,6 @@ parse_error::ParseError GAPIGL::GetTextureData( parse_error::kParseInvalidArguments; } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/cross/gl/texture_gl.h b/o3d/command_buffer/service/cross/gl/texture_gl.h index 938b216..58e6e37 100644 --- a/o3d/command_buffer/service/cross/gl/texture_gl.h +++ b/o3d/command_buffer/service/cross/gl/texture_gl.h @@ -43,6 +43,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class RenderDepthStencilSurfaceGL; class RenderSurfaceGL; @@ -278,6 +279,7 @@ class TextureCubeGL : public TextureGL { DISALLOW_COPY_AND_ASSIGN(TextureCubeGL); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/d3d9_utils.h b/o3d/command_buffer/service/win/d3d9/d3d9_utils.h index 1057715..7b9c7f5 100644 --- a/o3d/command_buffer/service/win/d3d9/d3d9_utils.h +++ b/o3d/command_buffer/service/win/d3d9/d3d9_utils.h @@ -89,7 +89,7 @@ inline unsigned int FloatToClampedByte(float value) { } // Converts a RGBA color into a D3DCOLOR -inline D3DCOLOR RGBAToD3DCOLOR(const RGBA &color) { +inline D3DCOLOR RGBAToD3DCOLOR(const o3d::RGBA &color) { return D3DCOLOR_RGBA(FloatToClampedByte(color.red), FloatToClampedByte(color.green), FloatToClampedByte(color.blue), diff --git a/o3d/command_buffer/service/win/d3d9/effect_d3d9.cc b/o3d/command_buffer/service/win/d3d9/effect_d3d9.cc index bb80079..0231802 100644 --- a/o3d/command_buffer/service/win/d3d9/effect_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/effect_d3d9.cc @@ -46,6 +46,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { // Logs the D3D effect error, from either the buffer, or GetLastError(). static void LogFXError(LPD3DXBUFFER error_buffer) { @@ -673,5 +674,6 @@ bool GAPID3D9::ValidateEffect() { return current_effect_->Begin(); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/effect_d3d9.h b/o3d/command_buffer/service/win/d3d9/effect_d3d9.h index a37f895..31fc713 100644 --- a/o3d/command_buffer/service/win/d3d9/effect_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/effect_d3d9.h @@ -43,6 +43,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPID3D9; class EffectD3D9; @@ -133,6 +134,7 @@ class EffectD3D9 : public Effect { DISALLOW_COPY_AND_ASSIGN(EffectD3D9); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.cc b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.cc index 79ada6f..23f966d 100644 --- a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.cc @@ -36,6 +36,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { GAPID3D9::GAPID3D9() : d3d_module_(NULL), @@ -309,19 +310,19 @@ bool GAPID3D9::ValidateStreams() { // Converts a GAPID3D9::PrimitiveType to a D3DPRIMITIVETYPE. static D3DPRIMITIVETYPE D3DPrimitive( - command_buffer::PrimitiveType primitive_type) { + PrimitiveType primitive_type) { switch (primitive_type) { - case command_buffer::kPoints: + case kPoints: return D3DPT_POINTLIST; - case command_buffer::kLines: + case kLines: return D3DPT_LINELIST; - case command_buffer::kLineStrips: + case kLineStrips: return D3DPT_LINESTRIP; - case command_buffer::kTriangles: + case kTriangles: return D3DPT_TRIANGLELIST; - case command_buffer::kTriangleStrips: + case kTriangleStrips: return D3DPT_TRIANGLESTRIP; - case command_buffer::kTriangleFans: + case kTriangleFans: return D3DPT_TRIANGLEFAN; default: LOG(FATAL) << "Invalid primitive type"; @@ -388,5 +389,6 @@ parse_error::ParseError GAPID3D9::DrawIndexed( return parse_error::kParseNoError; } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h index 1965407..7c56172 100644 --- a/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/gapi_d3d9.h @@ -46,6 +46,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { // This class implements the GAPI interface for D3D9. class GAPID3D9 : public GAPIInterface { @@ -501,6 +502,7 @@ class GAPID3D9 : public GAPIInterface { D3DXGetShaderInputSemanticsProc get_shader_input_semantics_; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc index 7674585..77b3b41 100644 --- a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc @@ -41,6 +41,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { // Destroys the D3D9 vertex buffer. VertexBufferD3D9::~VertexBufferD3D9() { @@ -432,5 +433,6 @@ parse_error::ParseError GAPID3D9::SetVertexInput( return parse_error::kParseNoError; } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.h b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.h index 14ba2c2..0aa2222 100644 --- a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.h @@ -44,6 +44,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPID3D9; @@ -120,6 +121,7 @@ class VertexStructD3D9 : public VertexStruct { DISALLOW_COPY_AND_ASSIGN(VertexStructD3D9); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.cc b/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.cc index 8141edd..3b4cd46 100644 --- a/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.cc @@ -40,6 +40,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { RenderSurfaceD3D9::RenderSurfaceD3D9(int width, int height, @@ -225,6 +226,7 @@ void GAPID3D9::SetBackSurfaces() { HR(d3d_device()->SetDepthStencilSurface(back_buffer_depth_surface_)); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.h b/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.h index 428c718..45069c4 100644 --- a/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/render_surface_d3d9.h @@ -45,6 +45,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPID3D9; @@ -154,6 +155,7 @@ class RenderDepthStencilSurfaceD3D9 : public RenderDepthStencilSurface { DISALLOW_COPY_AND_ASSIGN(RenderDepthStencilSurfaceD3D9); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc index 3823aae..04768ae 100644 --- a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc @@ -38,6 +38,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { namespace { @@ -194,6 +195,6 @@ parse_error::ParseError GAPID3D9::SetSamplerTexture( return parse_error::kParseNoError; } - +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.h b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.h index cbc348a..ab27286 100644 --- a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.h @@ -42,6 +42,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPID3D9; @@ -79,6 +80,7 @@ class SamplerD3D9 : public Sampler { ResourceId texture_id_; }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/states_d3d9.cc b/o3d/command_buffer/service/win/d3d9/states_d3d9.cc index f6292e3..be6e3ae 100644 --- a/o3d/command_buffer/service/win/d3d9/states_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/states_d3d9.cc @@ -34,23 +34,24 @@ // functions. #include <algorithm> -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/service/win/d3d9/gapi_d3d9.h" namespace o3d { namespace command_buffer { +namespace o3d { namespace { // Checks that a command_buffer enum matches a D3D enum so that it can be // converted quickly. #define CHECK_CB_ENUM_MATCHES_D3D(CB_ENUM, D3D_ENUM) \ - COMPILE_ASSERT(command_buffer::CB_ENUM + 1 == D3D_ENUM, \ + COMPILE_ASSERT(CB_ENUM + 1 == D3D_ENUM, \ CB_ENUM ## _plus_1_not_ ## D3D_ENUM) // Converts values from the PolygonMode enum to corresponding D3D values -inline D3DFILLMODE PolygonModeToD3D(command_buffer::PolygonMode fill_mode) { - DCHECK_LT(fill_mode, command_buffer::kNumPolygonMode); +inline D3DFILLMODE PolygonModeToD3D(PolygonMode fill_mode) { + DCHECK_LT(fill_mode, kNumPolygonMode); // Check that all acceptable values translate to D3D values by adding 1. @@ -61,8 +62,8 @@ inline D3DFILLMODE PolygonModeToD3D(command_buffer::PolygonMode fill_mode) { } // Converts values from the FaceCullMode enum to corresponding D3D values -inline D3DCULL FaceCullModeToD3D(command_buffer::FaceCullMode cull_mode) { - DCHECK_LT(cull_mode, command_buffer::kNumFaceCullMode); +inline D3DCULL FaceCullModeToD3D(FaceCullMode cull_mode) { + DCHECK_LT(cull_mode, kNumFaceCullMode); // Check that all acceptable values translate to D3D values by adding 1. CHECK_CB_ENUM_MATCHES_D3D(kCullNone, D3DCULL_NONE); @@ -72,8 +73,8 @@ inline D3DCULL FaceCullModeToD3D(command_buffer::FaceCullMode cull_mode) { } // Converts values from the Comparison enum to corresponding D3D values -inline D3DCMPFUNC ComparisonToD3D(command_buffer::Comparison comp) { - DCHECK_LT(comp, command_buffer::kNumComparison); +inline D3DCMPFUNC ComparisonToD3D(Comparison comp) { + DCHECK_LT(comp, kNumComparison); // Check that all acceptable values translate to D3D values by adding 1. CHECK_CB_ENUM_MATCHES_D3D(kNever, D3DCMP_NEVER); @@ -88,8 +89,8 @@ inline D3DCMPFUNC ComparisonToD3D(command_buffer::Comparison comp) { } // Converts values from the StencilOp enum to corresponding D3D values -inline D3DSTENCILOP StencilOpToD3D(command_buffer::StencilOp stencil_op) { - DCHECK_LT(stencil_op, command_buffer::kNumStencilOp); +inline D3DSTENCILOP StencilOpToD3D(StencilOp stencil_op) { + DCHECK_LT(stencil_op, kNumStencilOp); // Check that all acceptable values translate to D3D values by adding 1. CHECK_CB_ENUM_MATCHES_D3D(kKeep, D3DSTENCILOP_KEEP); @@ -104,8 +105,8 @@ inline D3DSTENCILOP StencilOpToD3D(command_buffer::StencilOp stencil_op) { } // Converts values from the BlendEq enum to corresponding D3D values -inline D3DBLENDOP BlendEqToD3D(command_buffer::BlendEq blend_eq) { - DCHECK_LT(blend_eq, command_buffer::kNumBlendEq); +inline D3DBLENDOP BlendEqToD3D(BlendEq blend_eq) { + DCHECK_LT(blend_eq, kNumBlendEq); // Check that all acceptable values translate to D3D values by adding 1. CHECK_CB_ENUM_MATCHES_D3D(kBlendEqAdd, D3DBLENDOP_ADD); CHECK_CB_ENUM_MATCHES_D3D(kBlendEqSub, D3DBLENDOP_SUBTRACT); @@ -116,35 +117,35 @@ inline D3DBLENDOP BlendEqToD3D(command_buffer::BlendEq blend_eq) { } // Converts values from the BlendFunc enum to corresponding D3D values -D3DBLEND BlendFuncToD3D(command_buffer::BlendFunc blend_func) { +D3DBLEND BlendFuncToD3D(BlendFunc blend_func) { // The D3DBLEND enum values don't map 1-to-1 to BlendFunc, so we use a switch // here. switch (blend_func) { - case command_buffer::kBlendFuncZero: + case kBlendFuncZero: return D3DBLEND_ZERO; - case command_buffer::kBlendFuncOne: + case kBlendFuncOne: return D3DBLEND_ONE; - case command_buffer::kBlendFuncSrcColor: + case kBlendFuncSrcColor: return D3DBLEND_SRCCOLOR; - case command_buffer::kBlendFuncInvSrcColor: + case kBlendFuncInvSrcColor: return D3DBLEND_INVSRCCOLOR; - case command_buffer::kBlendFuncSrcAlpha: + case kBlendFuncSrcAlpha: return D3DBLEND_SRCALPHA; - case command_buffer::kBlendFuncInvSrcAlpha: + case kBlendFuncInvSrcAlpha: return D3DBLEND_INVSRCALPHA; - case command_buffer::kBlendFuncDstAlpha: + case kBlendFuncDstAlpha: return D3DBLEND_DESTALPHA; - case command_buffer::kBlendFuncInvDstAlpha: + case kBlendFuncInvDstAlpha: return D3DBLEND_INVDESTALPHA; - case command_buffer::kBlendFuncDstColor: + case kBlendFuncDstColor: return D3DBLEND_DESTCOLOR; - case command_buffer::kBlendFuncInvDstColor: + case kBlendFuncInvDstColor: return D3DBLEND_INVDESTCOLOR; - case command_buffer::kBlendFuncSrcAlphaSaturate: + case kBlendFuncSrcAlphaSaturate: return D3DBLEND_SRCALPHASAT; - case command_buffer::kBlendFuncBlendColor: + case kBlendFuncBlendColor: return D3DBLEND_BLENDFACTOR; - case command_buffer::kBlendFuncInvBlendColor: + case kBlendFuncInvBlendColor: return D3DBLEND_INVBLENDFACTOR; default: DLOG(FATAL) << "Invalid BlendFunc"; @@ -154,38 +155,34 @@ D3DBLEND BlendFuncToD3D(command_buffer::BlendFunc blend_func) { // Decodes stencil test function and operations from the bitfield. void DecodeStencilFuncOps(Uint32 params, - command_buffer::Comparison *func, - command_buffer::StencilOp *pass, - command_buffer::StencilOp *fail, - command_buffer::StencilOp *zfail) { + Comparison *func, + StencilOp *pass, + StencilOp *fail, + StencilOp *zfail) { // Sanity check. The value has already been tested in // GAPIDecoder::DecodeSetStencilTest in gapi_decoder.cc. - DCHECK_EQ(cmd::SetStencilTest::Unused1::Get(params), 0); + DCHECK_EQ(SetStencilTest::Unused1::Get(params), 0); // Check that the bitmask get cannot generate values outside of the allowed // range. - COMPILE_ASSERT(cmd::SetStencilTest::CWFunc::kMask < - command_buffer::kNumComparison, + COMPILE_ASSERT(SetStencilTest::CWFunc::kMask < + kNumComparison, set_stencil_test_CWFunc_may_produce_invalid_values); - *func = static_cast<command_buffer::Comparison>( - cmd::SetStencilTest::CWFunc::Get(params)); + *func = static_cast<Comparison>(SetStencilTest::CWFunc::Get(params)); - COMPILE_ASSERT(cmd::SetStencilTest::CWPassOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(SetStencilTest::CWPassOp::kMask < + kNumStencilOp, set_stencil_test_CWPassOp_may_produce_invalid_values); - *pass = static_cast<command_buffer::StencilOp>( - cmd::SetStencilTest::CWPassOp::Get(params)); + *pass = static_cast<StencilOp>(SetStencilTest::CWPassOp::Get(params)); - COMPILE_ASSERT(cmd::SetStencilTest::CWFailOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(SetStencilTest::CWFailOp::kMask < + kNumStencilOp, set_stencil_test_CWFailOp_may_produce_invalid_values); - *fail = static_cast<command_buffer::StencilOp>( - cmd::SetStencilTest::CWFailOp::Get(params)); + *fail = static_cast<StencilOp>(SetStencilTest::CWFailOp::Get(params)); - COMPILE_ASSERT(cmd::SetStencilTest::CWZFailOp::kMask < - command_buffer::kNumStencilOp, + COMPILE_ASSERT(SetStencilTest::CWZFailOp::kMask < + kNumStencilOp, set_stencil_test_CWZFailOp_may_produce_invalid_values); - *zfail = static_cast<command_buffer::StencilOp>( - cmd::SetStencilTest::CWZFailOp::Get(params)); + *zfail = static_cast<StencilOp>(SetStencilTest::CWZFailOp::Get(params)); } } // anonymous namespace @@ -280,11 +277,11 @@ void GAPID3D9::SetStencilTest(bool enable, // clockwise ones, just shifted by 16 bits, so that we can use // DecodeStencilFuncOps on both of them. #define CHECK_CCW_MATCHES_CW(FIELD) \ - COMPILE_ASSERT(cmd::SetStencilTest::CW ## FIELD::kLength == \ - cmd::SetStencilTest::CCW ## FIELD::kLength, \ + COMPILE_ASSERT(SetStencilTest::CW ## FIELD::kLength == \ + SetStencilTest::CCW ## FIELD::kLength, \ CCW ## FIELD ## _length_does_not_match_ ## CW ## FIELD); \ - COMPILE_ASSERT(cmd::SetStencilTest::CW ## FIELD::kShift + 16 == \ - cmd::SetStencilTest::CCW ## FIELD::kShift, \ + COMPILE_ASSERT(SetStencilTest::CW ## FIELD::kShift + 16 == \ + SetStencilTest::CCW ## FIELD::kShift, \ CCW ## FIELD ## _shift_does_not_match_ ## CW ## FIELD) CHECK_CCW_MATCHES_CW(Func); CHECK_CCW_MATCHES_CW(PassOp); @@ -352,5 +349,6 @@ void GAPID3D9::SetBlendingColor(const RGBA &color) { HR(d3d_device_->SetRenderState(D3DRS_BLENDFACTOR, RGBAToD3DCOLOR(color))); } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc b/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc index f9c235a..a4410ac 100644 --- a/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc @@ -38,6 +38,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { // Converts a texture format to a D3D texture format. D3DFORMAT TextureD3D9::D3DFormat(texture::Format format) { @@ -726,5 +727,6 @@ parse_error::ParseError GAPID3D9::GetTextureData( parse_error::kParseInvalidArguments; } +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/command_buffer/service/win/d3d9/texture_d3d9.h b/o3d/command_buffer/service/win/d3d9/texture_d3d9.h index 5cbbef5..803dc23 100644 --- a/o3d/command_buffer/service/win/d3d9/texture_d3d9.h +++ b/o3d/command_buffer/service/win/d3d9/texture_d3d9.h @@ -44,6 +44,7 @@ namespace o3d { namespace command_buffer { +namespace o3d { class GAPID3D9; @@ -276,6 +277,7 @@ class TextureCubeD3D9 : public TextureD3D9 { DISALLOW_COPY_AND_ASSIGN(TextureCubeD3D9); }; +} // namespace o3d } // namespace command_buffer } // namespace o3d diff --git a/o3d/core/cross/command_buffer/effect_cb.cc b/o3d/core/cross/command_buffer/effect_cb.cc index a3b0260..a8ceb54 100644 --- a/o3d/core/cross/command_buffer/effect_cb.cc +++ b/o3d/core/cross/command_buffer/effect_cb.cc @@ -38,7 +38,7 @@ #include "core/cross/service_locator.h" #include "core/cross/command_buffer/effect_cb.h" #include "command_buffer/common/cross/constants.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/client/cross/fenced_allocator.h" #include "command_buffer/client/cross/o3d_cmd_helper.h" diff --git a/o3d/core/cross/command_buffer/param_cache_cb.cc b/o3d/core/cross/command_buffer/param_cache_cb.cc index db3d0d7..05d7924 100644 --- a/o3d/core/cross/command_buffer/param_cache_cb.cc +++ b/o3d/core/cross/command_buffer/param_cache_cb.cc @@ -39,7 +39,7 @@ #include "core/cross/command_buffer/effect_cb.h" #include "core/cross/command_buffer/param_cache_cb.h" #include "core/cross/command_buffer/sampler_cb.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { diff --git a/o3d/core/cross/command_buffer/primitive_cb.cc b/o3d/core/cross/command_buffer/primitive_cb.cc index a5418d4..86051bd 100644 --- a/o3d/core/cross/command_buffer/primitive_cb.cc +++ b/o3d/core/cross/command_buffer/primitive_cb.cc @@ -50,7 +50,7 @@ namespace o3d { using command_buffer::ResourceId; using command_buffer::O3DCmdHelper; using command_buffer::CommandBufferEntry; -using command_buffer::GAPIInterface; +using command_buffer::o3d::GAPIInterface; using command_buffer::kInvalidResource; namespace vertex_struct = command_buffer::vertex_struct; @@ -63,22 +63,22 @@ PrimitiveCB::~PrimitiveCB() { } // Converts an O3D primitive type to a command-buffer one. -static command_buffer::PrimitiveType GetCBPrimitiveType( +static command_buffer::o3d::PrimitiveType GetCBPrimitiveType( Primitive::PrimitiveType primitive_type) { switch (primitive_type) { case Primitive::LINELIST: - return command_buffer::kLines; + return command_buffer::o3d::kLines; case Primitive::LINESTRIP: - return command_buffer::kLineStrips; + return command_buffer::o3d::kLineStrips; case Primitive::TRIANGLELIST: - return command_buffer::kTriangles; + return command_buffer::o3d::kTriangles; case Primitive::TRIANGLESTRIP: - return command_buffer::kTriangleStrips; + return command_buffer::o3d::kTriangleStrips; case Primitive::TRIANGLEFAN: - return command_buffer::kTriangleFans; + return command_buffer::o3d::kTriangleFans; default: // Note that POINTLIST falls into this case, for compatibility with D3D. - return command_buffer::kMaxPrimitiveType; + return command_buffer::o3d::kMaxPrimitiveType; } } @@ -116,9 +116,9 @@ void PrimitiveCB::PlatformSpecificRender(Renderer* renderer, DLOG(INFO) << "Trying to draw with an empty index buffer."; return; } - command_buffer::PrimitiveType cb_primitive_type = + command_buffer::o3d::PrimitiveType cb_primitive_type = GetCBPrimitiveType(primitive_type_); - if (cb_primitive_type == command_buffer::kMaxPrimitiveType) { + if (cb_primitive_type == command_buffer::o3d::kMaxPrimitiveType) { DLOG(INFO) << "Invalid primitive type (" << primitive_type_ << ")."; return; } diff --git a/o3d/core/cross/command_buffer/renderer_cb.cc b/o3d/core/cross/command_buffer/renderer_cb.cc index 985bc74..5d0dcd58 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.cc +++ b/o3d/core/cross/command_buffer/renderer_cb.cc @@ -56,7 +56,7 @@ #include "gpu_plugin/system_services/shared_memory.h" namespace o3d { -using command_buffer::GAPIInterface; +using command_buffer::o3d::GAPIInterface; using command_buffer::O3DCmdHelper; using gpu_plugin::CommandBuffer; using gpu_plugin::GPUProcessor; @@ -131,9 +131,9 @@ void RendererCB::PlatformSpecificClear(const Float4 &color, bool depth_flag, int stencil, bool stencil_flag) { - uint32 buffers = (color_flag ? command_buffer::kColor : 0) | - (depth_flag ? command_buffer::kDepth : 0) | - (stencil_flag ? command_buffer::kStencil : 0); + uint32 buffers = (color_flag ? command_buffer::o3d::kColor : 0) | + (depth_flag ? command_buffer::o3d::kDepth : 0) | + (stencil_flag ? command_buffer::o3d::kStencil : 0); helper_->Clear(buffers, color[0], color[1], color[2], color[3], depth, stencil); } diff --git a/o3d/core/cross/command_buffer/sampler_cb.cc b/o3d/core/cross/command_buffer/sampler_cb.cc index 25c945b..8ceaa7d 100644 --- a/o3d/core/cross/command_buffer/sampler_cb.cc +++ b/o3d/core/cross/command_buffer/sampler_cb.cc @@ -36,7 +36,7 @@ #include "core/cross/error.h" #include "core/cross/command_buffer/sampler_cb.h" #include "core/cross/command_buffer/renderer_cb.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { @@ -104,7 +104,7 @@ void SamplerCB::SetTextureAndStates() { if (mag_filter_cb == sampler::kNone) mag_filter_cb = sampler::kPoint; if (min_filter_cb == sampler::kNone) min_filter_cb = sampler::kPoint; int max_max_anisotropy = - command_buffer::cmd::SetSamplerStates::MaxAnisotropy::kMask; + command_buffer::o3d::SetSamplerStates::MaxAnisotropy::kMask; unsigned int max_anisotropy_cb = std::max(1, std::min(max_max_anisotropy, max_anisotropy())); if (min_filter() != Sampler::ANISOTROPIC) { diff --git a/o3d/core/cross/command_buffer/states_cb.cc b/o3d/core/cross/command_buffer/states_cb.cc index ab04583..c437290 100644 --- a/o3d/core/cross/command_buffer/states_cb.cc +++ b/o3d/core/cross/command_buffer/states_cb.cc @@ -48,130 +48,130 @@ namespace { // Converts values meant to represent a Cull Mode to the corresponding // command-buffer value. // Default: CULL_NONE. -command_buffer::FaceCullMode CullModeToCB(int cull) { +command_buffer::o3d::FaceCullMode CullModeToCB(int cull) { switch (cull) { default: case State::CULL_NONE: - return command_buffer::kCullNone; + return command_buffer::o3d::kCullNone; case State::CULL_CW: - return command_buffer::kCullCW; + return command_buffer::o3d::kCullCW; case State::CULL_CCW: - return command_buffer::kCullCCW; + return command_buffer::o3d::kCullCCW; } } // Converts values meant to represent a Polygon Fill Mode to the corresponding // command-buffer value. // Default: kPolygonModeFill. -command_buffer::PolygonMode FillModeToCB(int fill) { +command_buffer::o3d::PolygonMode FillModeToCB(int fill) { switch (fill) { case State::POINT: - return command_buffer::kPolygonModePoints; + return command_buffer::o3d::kPolygonModePoints; case State::WIREFRAME: - return command_buffer::kPolygonModeLines; + return command_buffer::o3d::kPolygonModeLines; default: case State::SOLID: - return command_buffer::kPolygonModeFill; + return command_buffer::o3d::kPolygonModeFill; } } // Converts values meant to represent a Comparison Function to the corresponding // command-buffer value. // Default: kAlways. -command_buffer::Comparison ComparisonToCB(int comparison) { +command_buffer::o3d::Comparison ComparisonToCB(int comparison) { switch (comparison) { case State::CMP_NEVER: - return command_buffer::kNever; + return command_buffer::o3d::kNever; case State::CMP_LESS: - return command_buffer::kLess; + return command_buffer::o3d::kLess; case State::CMP_EQUAL: - return command_buffer::kEqual; + return command_buffer::o3d::kEqual; case State::CMP_LEQUAL: - return command_buffer::kLEqual; + return command_buffer::o3d::kLEqual; case State::CMP_GREATER: - return command_buffer::kGreater; + return command_buffer::o3d::kGreater; case State::CMP_NOTEQUAL: - return command_buffer::kNotEqual; + return command_buffer::o3d::kNotEqual; case State::CMP_GEQUAL: - return command_buffer::kGEqual; + return command_buffer::o3d::kGEqual; case State::CMP_ALWAYS: default: - return command_buffer::kAlways; + return command_buffer::o3d::kAlways; } } // Converts values meant to represent a Stencil Operation to the corresponding // command-buffer value. // Default: kKeep. -command_buffer::StencilOp StencilOpToCB(int op) { +command_buffer::o3d::StencilOp StencilOpToCB(int op) { switch (op) { default: case State::STENCIL_KEEP: - return command_buffer::kKeep; + return command_buffer::o3d::kKeep; case State::STENCIL_ZERO: - return command_buffer::kZero; + return command_buffer::o3d::kZero; case State::STENCIL_REPLACE: - return command_buffer::kReplace; + return command_buffer::o3d::kReplace; case State::STENCIL_INCREMENT_SATURATE: - return command_buffer::kIncNoWrap; + return command_buffer::o3d::kIncNoWrap; case State::STENCIL_DECREMENT_SATURATE: - return command_buffer::kDecNoWrap; + return command_buffer::o3d::kDecNoWrap; case State::STENCIL_INVERT: - return command_buffer::kInvert; + return command_buffer::o3d::kInvert; case State::STENCIL_INCREMENT: - return command_buffer::kIncWrap; + return command_buffer::o3d::kIncWrap; case State::STENCIL_DECREMENT: - return command_buffer::kDecWrap; + return command_buffer::o3d::kDecWrap; } } // Converts values meant to represent a Blending Function to the corresponding // command-buffer value. // Default: kBlendFuncOne. -command_buffer::BlendFunc BlendFuncToCB(int func) { +command_buffer::o3d::BlendFunc BlendFuncToCB(int func) { switch (func) { case State::BLENDFUNC_ZERO: - return command_buffer::kBlendFuncZero; + return command_buffer::o3d::kBlendFuncZero; default: case State::BLENDFUNC_ONE: - return command_buffer::kBlendFuncOne; + return command_buffer::o3d::kBlendFuncOne; case State::BLENDFUNC_SOURCE_COLOR: - return command_buffer::kBlendFuncSrcColor; + return command_buffer::o3d::kBlendFuncSrcColor; case State::BLENDFUNC_INVERSE_SOURCE_COLOR: - return command_buffer::kBlendFuncInvSrcColor; + return command_buffer::o3d::kBlendFuncInvSrcColor; case State::BLENDFUNC_SOURCE_ALPHA: - return command_buffer::kBlendFuncSrcAlpha; + return command_buffer::o3d::kBlendFuncSrcAlpha; case State::BLENDFUNC_INVERSE_SOURCE_ALPHA: - return command_buffer::kBlendFuncInvSrcAlpha; + return command_buffer::o3d::kBlendFuncInvSrcAlpha; case State::BLENDFUNC_DESTINATION_ALPHA: - return command_buffer::kBlendFuncDstAlpha; + return command_buffer::o3d::kBlendFuncDstAlpha; case State::BLENDFUNC_INVERSE_DESTINATION_ALPHA: - return command_buffer::kBlendFuncInvDstAlpha; + return command_buffer::o3d::kBlendFuncInvDstAlpha; case State::BLENDFUNC_DESTINATION_COLOR: - return command_buffer::kBlendFuncDstColor; + return command_buffer::o3d::kBlendFuncDstColor; case State::BLENDFUNC_INVERSE_DESTINATION_COLOR: - return command_buffer::kBlendFuncInvDstColor; + return command_buffer::o3d::kBlendFuncInvDstColor; case State::BLENDFUNC_SOURCE_ALPHA_SATUTRATE: - return command_buffer::kBlendFuncSrcAlphaSaturate; + return command_buffer::o3d::kBlendFuncSrcAlphaSaturate; } } // Converts values meant to represent a Blending Equation to the corresponding // command-buffer value. // Default: kBlendEqAdd. -command_buffer::BlendEq BlendEqToCB(int eq) { +command_buffer::o3d::BlendEq BlendEqToCB(int eq) { switch (eq) { default: case State::BLEND_ADD: - return command_buffer::kBlendEqAdd; + return command_buffer::o3d::kBlendEqAdd; case State::BLEND_SUBTRACT: - return command_buffer::kBlendEqSub; + return command_buffer::o3d::kBlendEqSub; case State::BLEND_REVERSE_SUBTRACT: - return command_buffer::kBlendEqRevSub; + return command_buffer::o3d::kBlendEqRevSub; case State::BLEND_MIN: - return command_buffer::kBlendEqMin; + return command_buffer::o3d::kBlendEqMin; case State::BLEND_MAX: - return command_buffer::kBlendEqMax; + return command_buffer::o3d::kBlendEqMax; } } @@ -264,7 +264,7 @@ class ColorWriteStateHandler : public TypedStateHandler<ParamInteger> { virtual void SetStateFromTypedParam(RendererCB* renderer, ParamInteger* param) const { - using command_buffer::cmd::SetColorWrite; + using command_buffer::o3d::SetColorWrite; int mask = param->value(); SetColorWrite::AllColorsMask::Set(value_, mask); renderer->SetWriteMask(mask); @@ -314,7 +314,7 @@ class CullModeStateHandler : public TypedStateHandler<ParamInteger> { virtual void SetStateFromTypedParam(RendererCB* renderer, ParamInteger* param) const { - using command_buffer::cmd::SetPolygonRaster; + using command_buffer::o3d::SetPolygonRaster; SetPolygonRaster::CullMode::Set(value_, CullModeToCB(param->value())); *dirty_ = true; } @@ -336,7 +336,7 @@ class FillModeStateHandler : public TypedStateHandler<ParamInteger> { virtual void SetStateFromTypedParam(RendererCB* renderer, ParamInteger* param) const { - using command_buffer::cmd::SetPolygonRaster; + using command_buffer::o3d::SetPolygonRaster; SetPolygonRaster::FillMode::Set(value_, FillModeToCB(param->value())); *dirty_ = true; } @@ -448,7 +448,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Point/Line raster { bool *dirty = point_line_helper_.dirty_ptr(); - using command_buffer::cmd::SetPointLineRaster; + using command_buffer::o3d::SetPointLineRaster; SetPointLineRaster& cmd = point_line_helper_.command(); renderer->AddStateHandler( State::kLineSmoothEnableParamName, @@ -466,7 +466,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Polygon Raster { bool *dirty = poly_raster_helper_.dirty_ptr(); - using command_buffer::cmd::SetPolygonRaster; + using command_buffer::o3d::SetPolygonRaster; SetPolygonRaster& cmd = poly_raster_helper_.command(); renderer->AddStateHandler(State::kCullModeParamName, new CullModeStateHandler(&cmd.fill_cull, dirty)); @@ -477,7 +477,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Polygon Offset { bool *dirty = poly_offset_helper_.dirty_ptr(); - command_buffer::cmd::SetPolygonOffset& cmd = + command_buffer::o3d::SetPolygonOffset& cmd = poly_offset_helper_.command(); renderer->AddStateHandler( State::kPolygonOffset1ParamName, @@ -489,7 +489,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Alpha test { - using command_buffer::cmd::SetAlphaTest; + using command_buffer::o3d::SetAlphaTest; SetAlphaTest& cmd = alpha_test_helper_.command(); bool *dirty = alpha_test_helper_.dirty_ptr(); renderer->AddStateHandler( @@ -506,7 +506,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Depth Test { bool *dirty = depth_test_helper_.dirty_ptr(); - using command_buffer::cmd::SetDepthTest; + using command_buffer::o3d::SetDepthTest; SetDepthTest& cmd = depth_test_helper_.command(); renderer->AddStateHandler( State::kZWriteEnableParamName, @@ -522,7 +522,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Stencil Test { bool *dirty = stencil_test_helper_.dirty_ptr(); - using command_buffer::cmd::SetStencilTest; + using command_buffer::o3d::SetStencilTest; SetStencilTest& cmd = stencil_test_helper_.command(); renderer->AddStateHandler( State::kStencilEnableParamName, @@ -583,7 +583,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Blending { bool *dirty = blending_helper_.dirty_ptr(); - using command_buffer::cmd::SetBlending; + using command_buffer::o3d::SetBlending; SetBlending& cmd = blending_helper_.command(); renderer->AddStateHandler( State::kAlphaBlendEnableParamName, @@ -621,7 +621,7 @@ void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { // Color Write { bool *dirty = color_write_helper_.dirty_ptr(); - using command_buffer::cmd::SetColorWrite; + using command_buffer::o3d::SetColorWrite; SetColorWrite& cmd = color_write_helper_.command(); renderer->AddStateHandler( State::kDitherEnableParamName, diff --git a/o3d/core/cross/command_buffer/states_cb.h b/o3d/core/cross/command_buffer/states_cb.h index 471f92a..e2a1905 100644 --- a/o3d/core/cross/command_buffer/states_cb.h +++ b/o3d/core/cross/command_buffer/states_cb.h @@ -37,7 +37,7 @@ #define O3D_CORE_CROSS_COMMAND_BUFFER_STATES_CB_H_ #include "core/cross/command_buffer/renderer_cb.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/client/cross/cmd_buffer_helper.h" namespace o3d { @@ -87,15 +87,15 @@ class RendererCB::StateManager { DISALLOW_COPY_AND_ASSIGN(StateHelper); }; - StateHelper<command_buffer::cmd::SetPointLineRaster> point_line_helper_; - StateHelper<command_buffer::cmd::SetPolygonOffset> poly_offset_helper_; - StateHelper<command_buffer::cmd::SetPolygonRaster> poly_raster_helper_; - StateHelper<command_buffer::cmd::SetAlphaTest> alpha_test_helper_; - StateHelper<command_buffer::cmd::SetDepthTest> depth_test_helper_; - StateHelper<command_buffer::cmd::SetStencilTest> stencil_test_helper_; - StateHelper<command_buffer::cmd::SetColorWrite> color_write_helper_; - StateHelper<command_buffer::cmd::SetBlending> blending_helper_; - StateHelper<command_buffer::cmd::SetBlendingColor> blending_color_helper_; + StateHelper<command_buffer::o3d::SetPointLineRaster> point_line_helper_; + StateHelper<command_buffer::o3d::SetPolygonOffset> poly_offset_helper_; + StateHelper<command_buffer::o3d::SetPolygonRaster> poly_raster_helper_; + StateHelper<command_buffer::o3d::SetAlphaTest> alpha_test_helper_; + StateHelper<command_buffer::o3d::SetDepthTest> depth_test_helper_; + StateHelper<command_buffer::o3d::SetStencilTest> stencil_test_helper_; + StateHelper<command_buffer::o3d::SetColorWrite> color_write_helper_; + StateHelper<command_buffer::o3d::SetBlending> blending_helper_; + StateHelper<command_buffer::o3d::SetBlendingColor> blending_color_helper_; DISALLOW_COPY_AND_ASSIGN(StateManager); }; diff --git a/o3d/core/cross/command_buffer/stream_bank_cb.cc b/o3d/core/cross/command_buffer/stream_bank_cb.cc index 86997da..11bb06f 100644 --- a/o3d/core/cross/command_buffer/stream_bank_cb.cc +++ b/o3d/core/cross/command_buffer/stream_bank_cb.cc @@ -49,7 +49,7 @@ namespace o3d { using command_buffer::ResourceId; using command_buffer::O3DCmdHelper; using command_buffer::CommandBufferEntry; -using command_buffer::GAPIInterface; +using command_buffer::o3d::GAPIInterface; using command_buffer::kInvalidResource; namespace vertex_struct = command_buffer::vertex_struct; diff --git a/o3d/core/cross/command_buffer/texture_cb.cc b/o3d/core/cross/command_buffer/texture_cb.cc index 0ef1ee4..f0e45fa 100644 --- a/o3d/core/cross/command_buffer/texture_cb.cc +++ b/o3d/core/cross/command_buffer/texture_cb.cc @@ -38,7 +38,7 @@ #include "core/cross/command_buffer/renderer_cb.h" #include "core/cross/command_buffer/texture_cb.h" -#include "command_buffer/common/cross/cmd_buffer_format.h" +#include "command_buffer/common/cross/o3d_cmd_format.h" #include "command_buffer/common/cross/resource.h" #include "command_buffer/client/cross/o3d_cmd_helper.h" #include "command_buffer/client/cross/fenced_allocator.h" diff --git a/o3d/gpu_plugin/gpu_processor.h b/o3d/gpu_plugin/gpu_processor.h index 31dc055..f4b32fd 100644 --- a/o3d/gpu_plugin/gpu_processor.h +++ b/o3d/gpu_plugin/gpu_processor.h @@ -31,9 +31,9 @@ class GPUProcessor : public ::base::RefCounted<GPUProcessor>, public command_buffer::CommandBufferEngine { public: #if defined(CB_SERVICE_D3D9) - typedef command_buffer::GAPID3D9 GPUGAPIInterface; + typedef command_buffer::o3d::GAPID3D9 GPUGAPIInterface; #elif defined(CB_SERVICE_GL) - typedef command_buffer::GAPIGL GPUGAPIInterface; + typedef command_buffer::o3d::GAPIGL GPUGAPIInterface; #else #error command buffer service not defined #endif @@ -45,7 +45,7 @@ class GPUProcessor : public ::base::RefCounted<GPUProcessor>, GPUProcessor(NPP npp, CommandBuffer* command_buffer, GPUGAPIInterface* gapi, - command_buffer::GAPIDecoder* decoder, + command_buffer::o3d::GAPIDecoder* decoder, command_buffer::CommandParser* parser, int commands_per_update); @@ -88,7 +88,7 @@ class GPUProcessor : public ::base::RefCounted<GPUProcessor>, int commands_per_update_; scoped_ptr<GPUGAPIInterface> gapi_; - scoped_ptr<command_buffer::GAPIDecoder> decoder_; + scoped_ptr<command_buffer::o3d::GAPIDecoder> decoder_; scoped_ptr<command_buffer::CommandParser> parser_; }; diff --git a/o3d/gpu_plugin/gpu_processor_win.cc b/o3d/gpu_plugin/gpu_processor_win.cc index a765ff94..8ab8b30 100644 --- a/o3d/gpu_plugin/gpu_processor_win.cc +++ b/o3d/gpu_plugin/gpu_processor_win.cc @@ -16,14 +16,14 @@ GPUProcessor::GPUProcessor(NPP npp, commands_per_update_(100) { DCHECK(command_buffer); gapi_.reset(new GPUGAPIInterface); - decoder_.reset(new command_buffer::GAPIDecoder(gapi_.get())); + decoder_.reset(new command_buffer::o3d::GAPIDecoder(gapi_.get())); decoder_->set_engine(this); } GPUProcessor::GPUProcessor(NPP npp, CommandBuffer* command_buffer, GPUGAPIInterface* gapi, - command_buffer::GAPIDecoder* decoder, + command_buffer::o3d::GAPIDecoder* decoder, command_buffer::CommandParser* parser, int commands_per_update) : npp_(npp), |