3 #include "util/string.h" 5 #include "renderer/buffers/gpu_resource.h" 6 #include "renderer/buffers/gpu_buffer.h" 7 #include "renderer/buffers/structured_buffer.h" 8 #include "renderer/buffers/byte_address_buffer.h" 9 #include "renderer/buffers/depth_buffer.h" 10 #include "renderer/buffers/color_buffer.h" 11 #include "renderer/buffers/upload_buffer.h" 13 #define COMMAND_CONTEXT_BARRIER_BUFFER_SIZE 16 109 ComputeContext& GetComputeContext();
120 static void InitializeTexture(
GpuResource& dest_resource, UINT num_subresources, D3D12_SUBRESOURCE_DATA subresource_data[]);
130 static void InitializeBuffer(
GpuResource& dest_resource,
const void* data, UINT num_bytes,
bool use_offset =
false, UINT offset = 0);
154 void CopyBufferRegion(
GpuResource& dest_resource, UINT dest_offset,
GpuResource& source_resource, UINT source_offset, UINT num_bytes);
163 void CopySubresource(
GpuResource& dest_resource, UINT dest_subresource_index,
GpuResource& source_resource, UINT source_subresource_index);
177 uint64_t Flush(
bool wait_for_completion =
false);
183 uint64_t Finish(
bool wait_for_completion =
false);
191 void TransitionResource(
GpuResource& resource,
const D3D12_RESOURCE_STATES& new_state,
bool flush_immediate =
false);
199 void BeginResourceTransition(
GpuResource& resource,
const D3D12_RESOURCE_STATES& new_state,
bool flush_immediate =
false);
206 void InsertUAVBarrier(
GpuResource& resource,
bool flush_immediate =
false);
217 void FlushResourceBarriers();
224 void InsertTimeStamp(ID3D12QueryHeap* query_heap, UINT query_idx);
232 void ResolveTimeStamps(ID3D12Resource* read_back_heap, ID3D12QueryHeap* query_heap, UINT num_queries);
239 void SetDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, ID3D12DescriptorHeap* heap);
247 void SetDescriptorHeaps(UINT heap_count, D3D12_DESCRIPTOR_HEAP_TYPE heap_types[], ID3D12DescriptorHeap* heaps[]);
255 void SetPredication(ID3D12Resource* buffer, UINT64 buffer_offset, D3D12_PREDICATION_OP op);
258 ID3D12GraphicsCommandList*
Get();
262 void BindDescriptorHeaps();
268 void SetName(
const WString& name) { list_->SetName(name.c_str()); name_ = name; }
277 D3D12_RESOURCE_BARRIER resource_barrier_buffer_[COMMAND_CONTEXT_BARRIER_BUFFER_SIZE];
279 ID3D12DescriptorHeap* descriptor_heaps_[4];
void operator=(INT i_)
The assignment operator for ints.
Definition: command_context.h:47
Wrapper around D3D12 command lists.
Definition: command_context.h:77
void operator=(FLOAT f_)
The assignment operator for floats.
Definition: command_context.h:35
void operator=(UINT u_)
The assignment operator for uints.
Definition: command_context.h:41
UINT num_flushable_barriers_
The number of resource barriers that are queued up.
Definition: command_context.h:276
INT i
The int value.
Definition: command_context.h:53
ID3D12RootSignature * compute_root_signature_
The compute root signature that is currently bound.
Definition: command_context.h:283
Provides clean access to all subsystems.
Definition: get.h:44
void SetName(const WString &name)
Sets the name of the CommandContext.
Definition: command_context.h:268
ID3D12PipelineState * graphics_pipeline_state_
The GraphicsPSO that is currently bound.
Definition: command_context.h:282
Wraps ID3D12Resource objects.
Definition: gpu_resource.h:19
ID3D12CommandAllocator * allocator_
The allocator used to allocate the commands.
Definition: command_context.h:274
ID3D12PipelineState * compute_pipeline_state_
The ComputePSO that is currently bound.
Definition: command_context.h:284
FLOAT f
The floating point value.
Definition: command_context.h:51
Param32Bit(UINT u_)
Constructs a uint-based Param32Bit.
Definition: command_context.h:26
eastl::wstring WString
Typedef for wrapping the EASTL wstring.
Definition: string.h:20
Param32Bit(INT i_)
Constructs a int-based Param32Bit.
Definition: command_context.h:29
ID3D12RootSignature * graphics_root_signature_
The graphics root signature that is currently bound.
Definition: command_context.h:281
Param32Bit(FLOAT f_)
Constructs a float-based Param32Bit.
Definition: command_context.h:23
Wraps functionality for submitting graphics related command lists.
Definition: graphics_context.h:16
ID3D12GraphicsCommandList * list_
The actual underlying command list.
Definition: command_context.h:273
The main Blowbox namespace.
Definition: image.cc:8
Wrapper for StructuredBuffer types.
Definition: structured_buffer.h:18
Manages the pool of available CommandContexts.
Definition: command_context_manager.h:23
Wraps upload buffer types, which allow you to upload data to the GPU.
Definition: upload_buffer.h:19
Represents a 32 bit parameter, which can either be a float, uint or int.
Definition: command_context.h:20
Utility class - if you inherit from this, the class becomes non-copyable.
Definition: command_context.h:63
WString name_
The name of the CommandContext.
Definition: command_context.h:271
D3D12_COMMAND_LIST_TYPE type_
The type of CommandContext this is.
Definition: command_context.h:272
UINT u
The uint value.
Definition: command_context.h:52