diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist.cpp b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist.cpp index bdf29602c..b6b343486 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist.cpp +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist.cpp @@ -11,6 +11,8 @@ #include "pipeline_structs.h" +#include + #include #ifdef KOPE_PIX @@ -226,7 +228,8 @@ 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, uint32_t *dynamic_offsets) { +void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, 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; @@ -245,8 +248,8 @@ void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, ui for (uint32_t descriptor_index = 0; descriptor_index < set->dynamic_descriptor_count; ++descriptor_index) { D3D12_CONSTANT_BUFFER_VIEW_DESC desc = {}; - // desc.BufferLocation = buffer->d3d12.resource->GetGPUVirtualAddress() + dynamic_offsets[descriptor_index]; - // desc.SizeInBytes = align_pow2((int)buffer->d3d12.size, 256); + desc.BufferLocation = dynamic_buffers[descriptor_index]->d3d12.resource->GetGPUVirtualAddress() + dynamic_offsets[descriptor_index]; + desc.SizeInBytes = align_pow2((int)dynamic_buffers[descriptor_index]->d3d12.size, 256); D3D12_CPU_DESCRIPTOR_HANDLE descriptor_handle = list->d3d12.device->descriptor_heap->GetCPUDescriptorHandleForHeapStart(); descriptor_handle.ptr += (offset + descriptor_index) * list->d3d12.device->cbv_srv_uav_increment; diff --git a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist_functions.h b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist_functions.h index d9ceb4a66..ca6299d90 100644 --- a/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist_functions.h +++ b/Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/commandlist_functions.h @@ -56,7 +56,8 @@ 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, uint32_t *dynamic_offsets); +void kope_d3d12_command_list_set_descriptor_table(kope_g5_command_list *list, uint32_t table_index, kope_d3d12_descriptor_set *set, + kope_g5_buffer **dynamic_buffers, 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);