[D3D12] Shorten and batch barriers

This commit is contained in:
Triang3l
2018-08-22 23:00:56 +03:00
parent d204e9ba74
commit bc4125584c
6 changed files with 193 additions and 273 deletions

View File

@@ -47,6 +47,15 @@ class D3D12CommandProcessor : public CommandProcessor {
// Returns the drawing command list for the currently open frame.
ID3D12GraphicsCommandList* GetCurrentCommandList() const;
void PushTransitionBarrier(
ID3D12Resource* resource, D3D12_RESOURCE_STATES old_state,
D3D12_RESOURCE_STATES new_state,
UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES);
void PushAliasingBarrier(ID3D12Resource* old_resource,
ID3D12Resource* new_resource);
void PushUAVBarrier(ID3D12Resource* resource);
void SubmitBarriers();
// Finds or creates root signature for a pipeline.
ID3D12RootSignature* GetRootSignature(const D3D12Shader* vertex_shader,
const D3D12Shader* pixel_shader);
@@ -176,6 +185,9 @@ class D3D12CommandProcessor : public CommandProcessor {
std::unique_ptr<ui::d3d12::DescriptorHeapPool> view_heap_pool_ = nullptr;
std::unique_ptr<ui::d3d12::DescriptorHeapPool> sampler_heap_pool_ = nullptr;
// Unsubmitted barrier batch.
std::vector<D3D12_RESOURCE_BARRIER> barriers_;
struct BufferForDeletion {
ID3D12Resource* buffer;
uint64_t last_usage_frame;