[D3D12] Minor deferred command list refactoring

This commit is contained in:
Triang3l
2020-10-04 21:53:52 +03:00
parent 81ee7b4c39
commit 75bf2d3c7d
4 changed files with 67 additions and 61 deletions

View File

@@ -11,6 +11,7 @@
#include "xenia/base/assert.h"
#include "xenia/base/math.h"
#include "xenia/base/profiling.h"
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
namespace xe {
@@ -18,7 +19,7 @@ namespace gpu {
namespace d3d12 {
DeferredCommandList::DeferredCommandList(
D3D12CommandProcessor& command_processor, size_t initial_size)
const D3D12CommandProcessor& command_processor, size_t initial_size)
: command_processor_(command_processor) {
command_stream_.reserve(initial_size / sizeof(uintmax_t));
}
@@ -27,6 +28,9 @@ void DeferredCommandList::Reset() { command_stream_.clear(); }
void DeferredCommandList::Execute(ID3D12GraphicsCommandList* command_list,
ID3D12GraphicsCommandList1* command_list_1) {
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
const uintmax_t* stream = command_stream_.data();
size_t stream_remaining = command_stream_.size();
ID3D12PipelineState* current_pipeline_state = nullptr;
@@ -118,6 +122,7 @@ void DeferredCommandList::Execute(ID3D12GraphicsCommandList* command_list,
command_list->OMSetStencilRef(*reinterpret_cast<const UINT*>(stream));
} break;
case Command::kD3DResourceBarrier: {
static_assert(alignof(D3D12_RESOURCE_BARRIER) <= alignof(uintmax_t));
command_list->ResourceBarrier(
*reinterpret_cast<const UINT*>(stream),
reinterpret_cast<const D3D12_RESOURCE_BARRIER*>(