Skip to content

Commit

Permalink
Rename async to compute
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Dec 1, 2024
1 parent 2fc8123 commit 8b40695
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ void kope_d3d12_device_create(kope_g5_device *device, const kope_g5_device_wishl
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;

kinc_microsoft_affirm(device->d3d12.device->CreateCommandQueue(&desc, IID_PPV_ARGS(&device->d3d12.queue)));
kinc_microsoft_affirm(device->d3d12.device->CreateCommandQueue(&desc, IID_PPV_ARGS(&device->d3d12.graphics_queue)));
}

{
D3D12_COMMAND_QUEUE_DESC desc = {};
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
desc.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE;

kinc_microsoft_affirm(device->d3d12.device->CreateCommandQueue(&desc, IID_PPV_ARGS(&device->d3d12.async_queue)));
kinc_microsoft_affirm(device->d3d12.device->CreateCommandQueue(&desc, IID_PPV_ARGS(&device->d3d12.compute_queue)));
}

{
Expand All @@ -139,7 +139,7 @@ void kope_d3d12_device_create(kope_g5_device *device, const kope_g5_device_wishl
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
desc.Windowed = true;

kinc_microsoft_affirm(dxgi_factory->CreateSwapChain((IUnknown *)device->d3d12.queue, &desc, &device->d3d12.swap_chain));
kinc_microsoft_affirm(dxgi_factory->CreateSwapChain((IUnknown *)device->d3d12.graphics_queue, &desc, &device->d3d12.swap_chain));
}

device->d3d12.cbv_srv_uav_increment = device->d3d12.device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
Expand Down Expand Up @@ -322,7 +322,7 @@ static D3D12_COMMAND_LIST_TYPE convert_command_list_type(kope_g5_command_list_ty
switch (type) {
case KOPE_G5_COMMAND_LIST_TYPE_GRAPHICS:
return D3D12_COMMAND_LIST_TYPE_DIRECT;
case KOPE_G5_COMMAND_LIST_TYPE_ASYNC:
case KOPE_G5_COMMAND_LIST_TYPE_COMPUTE:
return D3D12_COMMAND_LIST_TYPE_COMPUTE;
case KOPE_G5_COMMAND_LIST_TYPE_COPY:
return D3D12_COMMAND_LIST_TYPE_COPY;
Expand Down Expand Up @@ -660,12 +660,12 @@ void kope_d3d12_device_execute_command_list(kope_g5_device *device, kope_g5_comm

ID3D12CommandList *lists[] = {list->d3d12.list};
if (list->d3d12.list_type == D3D12_COMMAND_LIST_TYPE_DIRECT) {
device->d3d12.queue->ExecuteCommandLists(1, lists);
device->d3d12.queue->Signal(device->d3d12.execution_fence, device->d3d12.execution_index);
device->d3d12.graphics_queue->ExecuteCommandLists(1, lists);
device->d3d12.graphics_queue->Signal(device->d3d12.execution_fence, device->d3d12.execution_index);
}
else if (list->d3d12.list_type == D3D12_COMMAND_LIST_TYPE_COMPUTE) {
device->d3d12.async_queue->ExecuteCommandLists(1, lists);
device->d3d12.async_queue->Signal(device->d3d12.execution_fence, device->d3d12.execution_index);
device->d3d12.compute_queue->ExecuteCommandLists(1, lists);
device->d3d12.compute_queue->Signal(device->d3d12.execution_fence, device->d3d12.execution_index);
}
else if (list->d3d12.list_type == D3D12_COMMAND_LIST_TYPE_COPY) {
device->d3d12.copy_queue->ExecuteCommandLists(1, lists);
Expand All @@ -691,7 +691,7 @@ void kope_d3d12_device_execute_command_list(kope_g5_device *device, kope_g5_comm

kinc_microsoft_affirm(device->d3d12.swap_chain->Present(1, 0));

device->d3d12.queue->Signal(device->d3d12.frame_fence, device->d3d12.current_frame_index);
device->d3d12.graphics_queue->Signal(device->d3d12.frame_fence, device->d3d12.current_frame_index);

device->d3d12.current_frame_index += 1;
device->d3d12.framebuffer_index = (device->d3d12.framebuffer_index + 1) % KOPE_D3D12_FRAME_COUNT;
Expand Down Expand Up @@ -890,10 +890,10 @@ void kope_d3d12_device_create_fence(kope_g5_device *device, kope_g5_fence *fence
void kope_d3d12_device_signal(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) {
switch (list_type) {
case KOPE_G5_COMMAND_LIST_TYPE_GRAPHICS:
device->d3d12.queue->Signal(fence->d3d12.fence, value);
device->d3d12.graphics_queue->Signal(fence->d3d12.fence, value);
break;
case KOPE_G5_COMMAND_LIST_TYPE_ASYNC:
device->d3d12.async_queue->Signal(fence->d3d12.fence, value);
case KOPE_G5_COMMAND_LIST_TYPE_COMPUTE:
device->d3d12.compute_queue->Signal(fence->d3d12.fence, value);
break;
case KOPE_G5_COMMAND_LIST_TYPE_COPY:
device->d3d12.copy_queue->Signal(fence->d3d12.fence, value);
Expand All @@ -904,10 +904,10 @@ void kope_d3d12_device_signal(kope_g5_device *device, kope_g5_command_list_type
void kope_d3d12_device_wait(kope_g5_device *device, kope_g5_command_list_type list_type, kope_g5_fence *fence, uint64_t value) {
switch (list_type) {
case KOPE_G5_COMMAND_LIST_TYPE_GRAPHICS:
device->d3d12.queue->Wait(fence->d3d12.fence, value);
device->d3d12.graphics_queue->Wait(fence->d3d12.fence, value);
break;
case KOPE_G5_COMMAND_LIST_TYPE_ASYNC:
device->d3d12.async_queue->Wait(fence->d3d12.fence, value);
case KOPE_G5_COMMAND_LIST_TYPE_COMPUTE:
device->d3d12.compute_queue->Wait(fence->d3d12.fence, value);
break;
case KOPE_G5_COMMAND_LIST_TYPE_COPY:
device->d3d12.copy_queue->Wait(fence->d3d12.fence, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ struct ID3D12QueryHeap;

typedef struct kope_d3d12_device {
struct ID3D12Device5 *device;
struct ID3D12CommandQueue *queue;
struct ID3D12CommandQueue *async_queue;
struct ID3D12CommandQueue *graphics_queue;
struct ID3D12CommandQueue *compute_queue;
struct ID3D12CommandQueue *copy_queue;
struct IDXGISwapChain *swap_chain;

Expand Down
2 changes: 1 addition & 1 deletion Sources/kope/graphics5/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ KOPE_FUNC void kope_g5_device_create_sampler(kope_g5_device *device, const kope_

typedef enum kope_g5_command_list_type {
KOPE_G5_COMMAND_LIST_TYPE_GRAPHICS,
KOPE_G5_COMMAND_LIST_TYPE_ASYNC,
KOPE_G5_COMMAND_LIST_TYPE_COMPUTE,
KOPE_G5_COMMAND_LIST_TYPE_COPY
} kope_g5_command_list_type;

Expand Down

0 comments on commit 8b40695

Please sign in to comment.