[D3D12] Subsystem management order cleanup

This commit is contained in:
Triang3l 2022-05-14 22:30:06 +03:00
parent 60052fb4fc
commit f9b3b90a68
2 changed files with 21 additions and 21 deletions

View File

@ -862,6 +862,13 @@ bool D3D12CommandProcessor::SetupContext() {
draw_resolution_scale_x, draw_resolution_scale_y);
}
shared_memory_ =
std::make_unique<D3D12SharedMemory>(*this, *memory_, trace_writer_);
if (!shared_memory_->Initialize()) {
XELOGE("Failed to initialize shared memory");
return false;
}
// Initialize the render target cache before configuring binding - need to
// know if using rasterizer-ordered views for the bindless root signature.
render_target_cache_ = std::make_unique<D3D12RenderTargetCache>(
@ -1144,13 +1151,6 @@ bool D3D12CommandProcessor::SetupContext() {
}
}
shared_memory_ =
std::make_unique<D3D12SharedMemory>(*this, *memory_, trace_writer_);
if (!shared_memory_->Initialize()) {
XELOGE("Failed to initialize shared memory");
return false;
}
primitive_processor_ = std::make_unique<D3D12PrimitiveProcessor>(
*register_file_, *memory_, trace_writer_, *shared_memory_, *this);
if (!primitive_processor_->Initialize()) {
@ -1615,13 +1615,11 @@ void D3D12CommandProcessor::ShutdownContext() {
gamma_ramp_upload_buffer_.Reset();
gamma_ramp_buffer_.Reset();
pipeline_cache_.reset();
texture_cache_.reset();
primitive_processor_.reset();
pipeline_cache_.reset();
shared_memory_.reset();
primitive_processor_.reset();
// Shut down binding - bindless descriptors may be owned by subsystems like
// the texture cache.
@ -1654,6 +1652,8 @@ void D3D12CommandProcessor::ShutdownContext() {
render_target_cache_.reset();
shared_memory_.reset();
deferred_command_list_.Reset();
ui::d3d12::util::ReleaseAndNull(command_list_1_);
ui::d3d12::util::ReleaseAndNull(command_list_);
@ -2787,10 +2787,10 @@ void D3D12CommandProcessor::CheckSubmissionFence(uint64_t await_submission) {
shared_memory_->CompletedSubmissionUpdated();
primitive_processor_->CompletedSubmissionUpdated();
render_target_cache_->CompletedSubmissionUpdated();
primitive_processor_->CompletedSubmissionUpdated();
texture_cache_->CompletedSubmissionUpdated(submission_completed_);
}
@ -2870,10 +2870,10 @@ bool D3D12CommandProcessor::BeginSubmission(bool is_guest_command) {
}
primitive_topology_ = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
primitive_processor_->BeginSubmission();
render_target_cache_->BeginSubmission();
primitive_processor_->BeginSubmission();
texture_cache_->BeginSubmission(submission_current_);
}
@ -3043,12 +3043,10 @@ bool D3D12CommandProcessor::EndSubmission(bool is_swap) {
}
constant_buffer_pool_->ClearCache();
pipeline_cache_->ClearCache();
render_target_cache_->ClearCache();
texture_cache_->ClearCache();
pipeline_cache_->ClearCache();
for (auto it : root_signatures_bindful_) {
it.second->Release();
}
@ -3056,6 +3054,8 @@ bool D3D12CommandProcessor::EndSubmission(bool is_swap) {
primitive_processor_->ClearCache();
render_target_cache_->ClearCache();
shared_memory_->ClearCache();
}
}

View File

@ -427,6 +427,8 @@ class D3D12CommandProcessor : public CommandProcessor {
// of UpdateBindings time, and that's outside the emulator's control even).
bool bindless_resources_used_ = false;
std::unique_ptr<D3D12SharedMemory> shared_memory_;
std::unique_ptr<D3D12RenderTargetCache> render_target_cache_;
std::unique_ptr<ui::d3d12::D3D12UploadBufferPool> constant_buffer_pool_;
@ -491,8 +493,6 @@ class D3D12CommandProcessor : public CommandProcessor {
ID3D12RootSignature* root_signature_bindless_vs_ = nullptr;
ID3D12RootSignature* root_signature_bindless_ds_ = nullptr;
std::unique_ptr<D3D12SharedMemory> shared_memory_;
std::unique_ptr<D3D12PrimitiveProcessor> primitive_processor_;
std::unique_ptr<PipelineCache> pipeline_cache_;