Skip to content

Commit

Permalink
Receive dynamic offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Oct 6, 2024
1 parent 3a7eea9 commit c7a2a7b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void kope_d3d12_command_list_draw_indexed(kope_g5_command_list *list, uint32_t i
list->d3d12.list->DrawIndexedInstanced(index_count, instance_count, first_index, base_vertex, first_instance);
}

void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set) {
void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set, uint32_t *dynamic_offsets) {
if (set->descriptor_count > 0) {
D3D12_GPU_DESCRIPTOR_HANDLE gpu_descriptor = list->d3d12.device->descriptor_heap->GetGPUDescriptorHandleForHeapStart();
gpu_descriptor.ptr += set->descriptor_allocation.offset * list->d3d12.device->cbv_srv_uav_increment;
Expand All @@ -239,6 +239,18 @@ void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, ui
table_index += 1;
}

if (set->dynamic_descriptor_count > 0) {
D3D12_GPU_DESCRIPTOR_HANDLE gpu_descriptor = list->d3d12.device->descriptor_heap->GetGPUDescriptorHandleForHeapStart();
/*gpu_descriptor.ptr += set->descriptor_allocation.offset * list->d3d12.device->cbv_srv_uav_increment;
if (list->d3d12.compute_pipe != NULL || list->d3d12.ray_pipe != NULL) {
list->d3d12.list->SetComputeRootDescriptorTable(table_index, gpu_descriptor);
}
else {
list->d3d12.list->SetGraphicsRootDescriptorTable(table_index, gpu_descriptor);
}*/
table_index += 1;
}

if (set->sampler_count > 0) {
D3D12_GPU_DESCRIPTOR_HANDLE gpu_descriptor = list->d3d12.device->sampler_heap->GetGPUDescriptorHandleForHeapStart();
gpu_descriptor.ptr += set->sampler_allocation.offset * list->d3d12.device->sampler_increment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void kope_d3d12_command_list_draw(kope_g5_command_list *list, uint32_t vertex_co
void kope_d3d12_command_list_draw_indexed(kope_g5_command_list *list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t base_vertex,
uint32_t first_instance);

void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set);
void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set, uint32_t *dynamic_offsets);

void kope_d3d12_command_list_set_root_constants(kope_g5_command_list *list, uint32_t table_index, const void *data, size_t data_size);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ typedef struct kope_d3d12_descriptor_set {
oa_allocation_t descriptor_allocation;
size_t descriptor_count;

size_t dynamic_descriptor_count;

oa_allocation_t sampler_allocation;
size_t sampler_count;
} kope_d3d12_descriptor_set;
Expand Down

0 comments on commit c7a2a7b

Please sign in to comment.