[D3D12] Cleanup: remove inline

This commit is contained in:
Triang3l
2020-11-14 17:02:09 +03:00
parent 6b988d43c7
commit fe9b5b4a8f
8 changed files with 86 additions and 95 deletions

View File

@@ -33,7 +33,7 @@ class DeferredCommandList {
void Execute(ID3D12GraphicsCommandList* command_list,
ID3D12GraphicsCommandList1* command_list_1);
inline void D3DClearUnorderedAccessViewUint(
void D3DClearUnorderedAccessViewUint(
D3D12_GPU_DESCRIPTOR_HANDLE view_gpu_handle_in_current_heap,
D3D12_CPU_DESCRIPTOR_HANDLE view_cpu_handle, ID3D12Resource* resource,
const UINT values[4], UINT num_rects, const D3D12_RECT* rects) {
@@ -51,9 +51,9 @@ class DeferredCommandList {
}
}
inline void D3DCopyBufferRegion(ID3D12Resource* dst_buffer, UINT64 dst_offset,
ID3D12Resource* src_buffer, UINT64 src_offset,
UINT64 num_bytes) {
void D3DCopyBufferRegion(ID3D12Resource* dst_buffer, UINT64 dst_offset,
ID3D12Resource* src_buffer, UINT64 src_offset,
UINT64 num_bytes) {
auto& args = *reinterpret_cast<D3DCopyBufferRegionArguments*>(WriteCommand(
Command::kD3DCopyBufferRegion, sizeof(D3DCopyBufferRegionArguments)));
args.dst_buffer = dst_buffer;
@@ -63,26 +63,26 @@ class DeferredCommandList {
args.num_bytes = num_bytes;
}
inline void D3DCopyResource(ID3D12Resource* dst_resource,
ID3D12Resource* src_resource) {
void D3DCopyResource(ID3D12Resource* dst_resource,
ID3D12Resource* src_resource) {
auto& args = *reinterpret_cast<D3DCopyResourceArguments*>(WriteCommand(
Command::kD3DCopyResource, sizeof(D3DCopyResourceArguments)));
args.dst_resource = dst_resource;
args.src_resource = src_resource;
}
inline void CopyTexture(const D3D12_TEXTURE_COPY_LOCATION& dst,
const D3D12_TEXTURE_COPY_LOCATION& src) {
void CopyTexture(const D3D12_TEXTURE_COPY_LOCATION& dst,
const D3D12_TEXTURE_COPY_LOCATION& src) {
auto& args = *reinterpret_cast<CopyTextureArguments*>(
WriteCommand(Command::kCopyTexture, sizeof(CopyTextureArguments)));
std::memcpy(&args.dst, &dst, sizeof(D3D12_TEXTURE_COPY_LOCATION));
std::memcpy(&args.src, &src, sizeof(D3D12_TEXTURE_COPY_LOCATION));
}
inline void CopyTextureRegion(const D3D12_TEXTURE_COPY_LOCATION& dst,
UINT dst_x, UINT dst_y, UINT dst_z,
const D3D12_TEXTURE_COPY_LOCATION& src,
const D3D12_BOX& src_box) {
void CopyTextureRegion(const D3D12_TEXTURE_COPY_LOCATION& dst, UINT dst_x,
UINT dst_y, UINT dst_z,
const D3D12_TEXTURE_COPY_LOCATION& src,
const D3D12_BOX& src_box) {
auto& args = *reinterpret_cast<CopyTextureRegionArguments*>(WriteCommand(
Command::kCopyTextureRegion, sizeof(CopyTextureRegionArguments)));
std::memcpy(&args.dst, &dst, sizeof(D3D12_TEXTURE_COPY_LOCATION));
@@ -93,8 +93,8 @@ class DeferredCommandList {
args.src_box = src_box;
}
inline void D3DDispatch(UINT thread_group_count_x, UINT thread_group_count_y,
UINT thread_group_count_z) {
void D3DDispatch(UINT thread_group_count_x, UINT thread_group_count_y,
UINT thread_group_count_z) {
auto& args = *reinterpret_cast<D3DDispatchArguments*>(
WriteCommand(Command::kD3DDispatch, sizeof(D3DDispatchArguments)));
args.thread_group_count_x = thread_group_count_x;
@@ -102,11 +102,10 @@ class DeferredCommandList {
args.thread_group_count_z = thread_group_count_z;
}
inline void D3DDrawIndexedInstanced(UINT index_count_per_instance,
UINT instance_count,
UINT start_index_location,
INT base_vertex_location,
UINT start_instance_location) {
void D3DDrawIndexedInstanced(UINT index_count_per_instance,
UINT instance_count, UINT start_index_location,
INT base_vertex_location,
UINT start_instance_location) {
auto& args = *reinterpret_cast<D3DDrawIndexedInstancedArguments*>(
WriteCommand(Command::kD3DDrawIndexedInstanced,
sizeof(D3DDrawIndexedInstancedArguments)));
@@ -117,9 +116,9 @@ class DeferredCommandList {
args.start_instance_location = start_instance_location;
}
inline void D3DDrawInstanced(UINT vertex_count_per_instance,
UINT instance_count, UINT start_vertex_location,
UINT start_instance_location) {
void D3DDrawInstanced(UINT vertex_count_per_instance, UINT instance_count,
UINT start_vertex_location,
UINT start_instance_location) {
auto& args = *reinterpret_cast<D3DDrawInstancedArguments*>(WriteCommand(
Command::kD3DDrawInstanced, sizeof(D3DDrawInstancedArguments)));
args.vertex_count_per_instance = vertex_count_per_instance;
@@ -128,7 +127,7 @@ class DeferredCommandList {
args.start_instance_location = start_instance_location;
}
inline void D3DIASetIndexBuffer(const D3D12_INDEX_BUFFER_VIEW* view) {
void D3DIASetIndexBuffer(const D3D12_INDEX_BUFFER_VIEW* view) {
auto& args = *reinterpret_cast<D3D12_INDEX_BUFFER_VIEW*>(WriteCommand(
Command::kD3DIASetIndexBuffer, sizeof(D3D12_INDEX_BUFFER_VIEW)));
if (view != nullptr) {
@@ -142,14 +141,13 @@ class DeferredCommandList {
}
}
inline void D3DIASetPrimitiveTopology(
D3D12_PRIMITIVE_TOPOLOGY primitive_topology) {
void D3DIASetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY primitive_topology) {
auto& arg = *reinterpret_cast<D3D12_PRIMITIVE_TOPOLOGY*>(WriteCommand(
Command::kD3DIASetPrimitiveTopology, sizeof(D3D12_PRIMITIVE_TOPOLOGY)));
arg = primitive_topology;
}
inline void D3DOMSetBlendFactor(const FLOAT blend_factor[4]) {
void D3DOMSetBlendFactor(const FLOAT blend_factor[4]) {
auto args = reinterpret_cast<FLOAT*>(
WriteCommand(Command::kD3DOMSetBlendFactor, 4 * sizeof(FLOAT)));
args[0] = blend_factor[0];
@@ -158,7 +156,7 @@ class DeferredCommandList {
args[3] = blend_factor[3];
}
inline void D3DOMSetRenderTargets(
void D3DOMSetRenderTargets(
UINT num_render_target_descriptors,
const D3D12_CPU_DESCRIPTOR_HANDLE* render_target_descriptors,
BOOL rts_single_handle_to_descriptor_range,
@@ -185,14 +183,14 @@ class DeferredCommandList {
}
}
inline void D3DOMSetStencilRef(UINT stencil_ref) {
void D3DOMSetStencilRef(UINT stencil_ref) {
auto& arg = *reinterpret_cast<UINT*>(
WriteCommand(Command::kD3DOMSetStencilRef, sizeof(UINT)));
arg = stencil_ref;
}
inline void D3DResourceBarrier(UINT num_barriers,
const D3D12_RESOURCE_BARRIER* barriers) {
void D3DResourceBarrier(UINT num_barriers,
const D3D12_RESOURCE_BARRIER* barriers) {
if (num_barriers == 0) {
return;
}
@@ -207,21 +205,22 @@ class DeferredCommandList {
num_barriers * sizeof(D3D12_RESOURCE_BARRIER));
}
inline void RSSetScissorRect(const D3D12_RECT& rect) {
void RSSetScissorRect(const D3D12_RECT& rect) {
auto& arg = *reinterpret_cast<D3D12_RECT*>(
WriteCommand(Command::kRSSetScissorRect, sizeof(D3D12_RECT)));
arg = rect;
}
inline void RSSetViewport(const D3D12_VIEWPORT& viewport) {
void RSSetViewport(const D3D12_VIEWPORT& viewport) {
auto& arg = *reinterpret_cast<D3D12_VIEWPORT*>(
WriteCommand(Command::kRSSetViewport, sizeof(D3D12_VIEWPORT)));
arg = viewport;
}
inline void D3DSetComputeRoot32BitConstants(
UINT root_parameter_index, UINT num_32bit_values_to_set,
const void* src_data, UINT dest_offset_in_32bit_values) {
void D3DSetComputeRoot32BitConstants(UINT root_parameter_index,
UINT num_32bit_values_to_set,
const void* src_data,
UINT dest_offset_in_32bit_values) {
if (num_32bit_values_to_set == 0) {
return;
}
@@ -235,9 +234,10 @@ class DeferredCommandList {
std::memcpy(args + 1, src_data, num_32bit_values_to_set * sizeof(uint32_t));
}
inline void D3DSetGraphicsRoot32BitConstants(
UINT root_parameter_index, UINT num_32bit_values_to_set,
const void* src_data, UINT dest_offset_in_32bit_values) {
void D3DSetGraphicsRoot32BitConstants(UINT root_parameter_index,
UINT num_32bit_values_to_set,
const void* src_data,
UINT dest_offset_in_32bit_values) {
if (num_32bit_values_to_set == 0) {
return;
}
@@ -251,7 +251,7 @@ class DeferredCommandList {
std::memcpy(args + 1, src_data, num_32bit_values_to_set * sizeof(uint32_t));
}
inline void D3DSetComputeRootConstantBufferView(
void D3DSetComputeRootConstantBufferView(
UINT root_parameter_index, D3D12_GPU_VIRTUAL_ADDRESS buffer_location) {
auto& args = *reinterpret_cast<SetRootConstantBufferViewArguments*>(
WriteCommand(Command::kD3DSetComputeRootConstantBufferView,
@@ -260,7 +260,7 @@ class DeferredCommandList {
args.buffer_location = buffer_location;
}
inline void D3DSetGraphicsRootConstantBufferView(
void D3DSetGraphicsRootConstantBufferView(
UINT root_parameter_index, D3D12_GPU_VIRTUAL_ADDRESS buffer_location) {
auto& args = *reinterpret_cast<SetRootConstantBufferViewArguments*>(
WriteCommand(Command::kD3DSetGraphicsRootConstantBufferView,
@@ -269,7 +269,7 @@ class DeferredCommandList {
args.buffer_location = buffer_location;
}
inline void D3DSetComputeRootDescriptorTable(
void D3DSetComputeRootDescriptorTable(
UINT root_parameter_index, D3D12_GPU_DESCRIPTOR_HANDLE base_descriptor) {
auto& args = *reinterpret_cast<SetRootDescriptorTableArguments*>(
WriteCommand(Command::kD3DSetComputeRootDescriptorTable,
@@ -278,7 +278,7 @@ class DeferredCommandList {
args.base_descriptor.ptr = base_descriptor.ptr;
}
inline void D3DSetGraphicsRootDescriptorTable(
void D3DSetGraphicsRootDescriptorTable(
UINT root_parameter_index, D3D12_GPU_DESCRIPTOR_HANDLE base_descriptor) {
auto& args = *reinterpret_cast<SetRootDescriptorTableArguments*>(
WriteCommand(Command::kD3DSetGraphicsRootDescriptorTable,
@@ -287,42 +287,40 @@ class DeferredCommandList {
args.base_descriptor.ptr = base_descriptor.ptr;
}
inline void D3DSetComputeRootSignature(ID3D12RootSignature* root_signature) {
void D3DSetComputeRootSignature(ID3D12RootSignature* root_signature) {
auto& arg = *reinterpret_cast<ID3D12RootSignature**>(WriteCommand(
Command::kD3DSetComputeRootSignature, sizeof(ID3D12RootSignature*)));
arg = root_signature;
}
inline void D3DSetGraphicsRootSignature(ID3D12RootSignature* root_signature) {
void D3DSetGraphicsRootSignature(ID3D12RootSignature* root_signature) {
auto& arg = *reinterpret_cast<ID3D12RootSignature**>(WriteCommand(
Command::kD3DSetGraphicsRootSignature, sizeof(ID3D12RootSignature*)));
arg = root_signature;
}
inline void SetDescriptorHeaps(
ID3D12DescriptorHeap* cbv_srv_uav_descriptor_heap,
ID3D12DescriptorHeap* sampler_descriptor_heap) {
void SetDescriptorHeaps(ID3D12DescriptorHeap* cbv_srv_uav_descriptor_heap,
ID3D12DescriptorHeap* sampler_descriptor_heap) {
auto& args = *reinterpret_cast<SetDescriptorHeapsArguments*>(WriteCommand(
Command::kSetDescriptorHeaps, sizeof(SetDescriptorHeapsArguments)));
args.cbv_srv_uav_descriptor_heap = cbv_srv_uav_descriptor_heap;
args.sampler_descriptor_heap = sampler_descriptor_heap;
}
inline void D3DSetPipelineState(ID3D12PipelineState* pipeline_state) {
void D3DSetPipelineState(ID3D12PipelineState* pipeline_state) {
auto& arg = *reinterpret_cast<ID3D12PipelineState**>(WriteCommand(
Command::kD3DSetPipelineState, sizeof(ID3D12PipelineState*)));
arg = pipeline_state;
}
inline void SetPipelineStateHandle(void* pipeline_state_handle) {
void SetPipelineStateHandle(void* pipeline_state_handle) {
auto& arg = *reinterpret_cast<void**>(
WriteCommand(Command::kSetPipelineStateHandle, sizeof(void*)));
arg = pipeline_state_handle;
}
inline void D3DSetSamplePositions(
UINT num_samples_per_pixel, UINT num_pixels,
const D3D12_SAMPLE_POSITION* sample_positions) {
void D3DSetSamplePositions(UINT num_samples_per_pixel, UINT num_pixels,
const D3D12_SAMPLE_POSITION* sample_positions) {
auto& args = *reinterpret_cast<D3DSetSamplePositionsArguments*>(
WriteCommand(Command::kD3DSetSamplePositions,
sizeof(D3DSetSamplePositionsArguments)));