mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
d3d12: Avoid uploading constant buffer every draw call
This commit is contained in:
parent
c07b0dc373
commit
7ae680d9d1
@ -319,11 +319,17 @@ void D3D12GSRender::end()
|
||||
.Offset((INT)currentDescriptorIndex + vertex_buffer_count, m_descriptor_stride_srv_cbv_uav)
|
||||
);
|
||||
|
||||
upload_and_bind_vertex_shader_constants(currentDescriptorIndex + 1 + vertex_buffer_count);
|
||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(VERTEX_CONSTANT_BUFFERS_SLOT,
|
||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
||||
.Offset((INT)currentDescriptorIndex + 1 + vertex_buffer_count, m_descriptor_stride_srv_cbv_uav)
|
||||
);
|
||||
if (m_transform_constants_dirty)
|
||||
{
|
||||
m_current_transform_constants_buffer_descriptor_id = (u32)currentDescriptorIndex + 1 + vertex_buffer_count;
|
||||
upload_and_bind_vertex_shader_constants(currentDescriptorIndex + 1 + vertex_buffer_count);
|
||||
m_transform_constants_dirty = false;
|
||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(VERTEX_CONSTANT_BUFFERS_SLOT,
|
||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
||||
.Offset(m_current_transform_constants_buffer_descriptor_id, m_descriptor_stride_srv_cbv_uav)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> constants_duration_end = std::chrono::system_clock::now();
|
||||
m_timers.constants_duration += std::chrono::duration_cast<std::chrono::microseconds>(constants_duration_end - constants_duration_start).count();
|
||||
|
@ -128,6 +128,7 @@ private:
|
||||
ID3D12Resource *m_dummy_texture;
|
||||
|
||||
// Currently used shader resources / samplers descriptor
|
||||
u32 m_current_transform_constants_buffer_descriptor_id;
|
||||
std::array<std::tuple<ID3D12Resource*, D3D12_SHADER_RESOURCE_VIEW_DESC>, 16> m_current_shader_resources = {};
|
||||
std::array<D3D12_SAMPLER_DESC, 16> m_current_samplers = {};
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user