From 3de2b5e6928858f43abf4e968def05b9b1da0d04 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Sun, 7 Oct 2018 17:30:12 +0300 Subject: [PATCH] [D3D12] Code style fixes --- src/xenia/gpu/d3d12/primitive_converter.cc | 2 +- src/xenia/gpu/dxbc_shader_translator.cc | 3 ++- src/xenia/ui/d3d12/command_list.cc | 17 +++++++---------- src/xenia/ui/d3d12/cpu_fence.cc | 4 ++-- src/xenia/ui/d3d12/d3d12_context.cc | 6 +++--- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/xenia/gpu/d3d12/primitive_converter.cc b/src/xenia/gpu/d3d12/primitive_converter.cc index b302976c6..8892ab48b 100644 --- a/src/xenia/gpu/d3d12/primitive_converter.cc +++ b/src/xenia/gpu/d3d12/primitive_converter.cc @@ -399,12 +399,12 @@ PrimitiveConverter::ConversionResult PrimitiveConverter::ConvertPrimitives( } } else if (source_type == PrimitiveType::kTriangleStrip || source_type == PrimitiveType::kLineStrip) { +#if XE_ARCH_AMD64 // Replace the reset index with the maximum representable value - vector OR // gives 0 or 0xFFFF/0xFFFFFFFF, which is exactly what is needed. // Allocations in the target index buffer are aligned with 16-byte // granularity, and within 16-byte vectors, both the source and the target // start at the same offset. -#if XE_ARCH_AMD64 union { const __m128i* source_aligned_128; uintptr_t source_aligned_uintptr; diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index ca1785d21..ac52c4865 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -7476,9 +7476,10 @@ void DxbcShaderTranslator::WriteResourceDefinitions() { shader_object_.push_back(0); shader_object_.push_back(type_name_offsets[i]); } + +#if 0 // Structure members. Structures are not used currently, but were used in the // past, so the code is kept here. -#if 0 for (uint32_t i = 0; i < uint32_t(RdefTypeIndex::kCount); ++i) { const RdefType& type = rdef_types_[i]; const RdefStructMember* struct_members = type.struct_members; diff --git a/src/xenia/ui/d3d12/command_list.cc b/src/xenia/ui/d3d12/command_list.cc index 315416b80..fbf2e18f3 100644 --- a/src/xenia/ui/d3d12/command_list.cc +++ b/src/xenia/ui/d3d12/command_list.cc @@ -15,11 +15,11 @@ namespace xe { namespace ui { namespace d3d12 { -std::unique_ptr -CommandList::Create(ID3D12Device* device, ID3D12CommandQueue* queue, - D3D12_COMMAND_LIST_TYPE type) { - std::unique_ptr command_list(new CommandList(device, queue, - type)); +std::unique_ptr CommandList::Create(ID3D12Device* device, + ID3D12CommandQueue* queue, + D3D12_COMMAND_LIST_TYPE type) { + std::unique_ptr command_list( + new CommandList(device, queue, type)); if (!command_list->Initialize()) { return nullptr; } @@ -44,7 +44,7 @@ CommandList::~CommandList() { bool CommandList::Initialize() { if (FAILED(device_->CreateCommandAllocator( - type_, IID_PPV_ARGS(&command_allocator_)))) { + type_, IID_PPV_ARGS(&command_allocator_)))) { XELOGE("Failed to create a command allocator"); return false; } @@ -68,9 +68,7 @@ ID3D12GraphicsCommandList* CommandList::BeginRecording() { return command_list_; } -void CommandList::AbortRecording() { - command_list_->Close(); -} +void CommandList::AbortRecording() { command_list_->Close(); } void CommandList::Execute() { command_list_->Close(); @@ -81,4 +79,3 @@ void CommandList::Execute() { } // namespace d3d12 } // namespace ui } // namespace xe - diff --git a/src/xenia/ui/d3d12/cpu_fence.cc b/src/xenia/ui/d3d12/cpu_fence.cc index 9f7ff3a5c..a3095959d 100644 --- a/src/xenia/ui/d3d12/cpu_fence.cc +++ b/src/xenia/ui/d3d12/cpu_fence.cc @@ -15,8 +15,8 @@ namespace xe { namespace ui { namespace d3d12 { -std::unique_ptr -CPUFence::Create(ID3D12Device* device, ID3D12CommandQueue* queue) { +std::unique_ptr CPUFence::Create(ID3D12Device* device, + ID3D12CommandQueue* queue) { std::unique_ptr fence(new CPUFence(device, queue)); if (!fence->Initialize()) { return nullptr; diff --git a/src/xenia/ui/d3d12/d3d12_context.cc b/src/xenia/ui/d3d12/d3d12_context.cc index c799b8a8c..69731f483 100644 --- a/src/xenia/ui/d3d12/d3d12_context.cc +++ b/src/xenia/ui/d3d12/d3d12_context.cc @@ -74,9 +74,9 @@ bool D3D12Context::Initialize() { swap_chain_desc.Flags = 0; IDXGISwapChain1* swap_chain_1; if (FAILED(dxgi_factory->CreateSwapChainForHwnd( - provider->GetDirectQueue(), - static_cast(target_window_->native_handle()), &swap_chain_desc, - nullptr, nullptr, &swap_chain_1))) { + provider->GetDirectQueue(), + static_cast(target_window_->native_handle()), + &swap_chain_desc, nullptr, nullptr, &swap_chain_1))) { XELOGE("Failed to create a DXGI swap chain"); Shutdown(); return false;