1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxvk] Bind descriptor sets at descriptor update time

Gets rid of one 'if' per draw/dispatch and two functions.
This commit is contained in:
Philip Rebohle 2019-11-28 15:17:42 +01:00
parent 49e7df96ec
commit 2aa1ff414c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 8 additions and 31 deletions

View File

@ -3853,45 +3853,31 @@ namespace dxvk {
void DxvkContext::updateComputeShaderResources() { void DxvkContext::updateComputeShaderResources() {
if ((m_flags.test(DxvkContextFlag::CpDirtyResources)) if ((m_flags.test(DxvkContextFlag::CpDirtyResources))
|| (m_flags.test(DxvkContextFlag::CpDirtyDescriptorBinding) || (m_state.cp.pipeline->layout()->hasStaticBufferBindings())) {
&& m_state.cp.pipeline->layout()->hasStaticBufferBindings())) {
m_flags.clr(DxvkContextFlag::CpDirtyResources);
if (this->updateShaderResources<VK_PIPELINE_BIND_POINT_COMPUTE>(m_state.cp.pipeline->layout())) if (this->updateShaderResources<VK_PIPELINE_BIND_POINT_COMPUTE>(m_state.cp.pipeline->layout()))
m_flags.set(DxvkContextFlag::CpDirtyPipelineState); m_flags.set(DxvkContextFlag::CpDirtyPipelineState);
m_flags.set(DxvkContextFlag::CpDirtyDescriptorBinding);
} }
}
void DxvkContext::updateComputeShaderDescriptors() {
this->updateShaderDescriptorSetBinding<VK_PIPELINE_BIND_POINT_COMPUTE>( this->updateShaderDescriptorSetBinding<VK_PIPELINE_BIND_POINT_COMPUTE>(
m_cpSet, m_state.cp.pipeline->layout()); m_cpSet, m_state.cp.pipeline->layout());
m_flags.clr(DxvkContextFlag::CpDirtyDescriptorBinding); m_flags.clr(DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::CpDirtyDescriptorBinding);
} }
void DxvkContext::updateGraphicsShaderResources() { void DxvkContext::updateGraphicsShaderResources() {
if ((m_flags.test(DxvkContextFlag::GpDirtyResources)) if ((m_flags.test(DxvkContextFlag::GpDirtyResources))
|| (m_flags.test(DxvkContextFlag::GpDirtyDescriptorBinding) || (m_state.gp.pipeline->layout()->hasStaticBufferBindings())) {
&& m_state.gp.pipeline->layout()->hasStaticBufferBindings())) {
m_flags.clr(DxvkContextFlag::GpDirtyResources);
if (this->updateShaderResources<VK_PIPELINE_BIND_POINT_GRAPHICS>(m_state.gp.pipeline->layout())) if (this->updateShaderResources<VK_PIPELINE_BIND_POINT_GRAPHICS>(m_state.gp.pipeline->layout()))
m_flags.set(DxvkContextFlag::GpDirtyPipelineState); m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
m_flags.set(DxvkContextFlag::GpDirtyDescriptorBinding);
} }
}
void DxvkContext::updateGraphicsShaderDescriptors() {
this->updateShaderDescriptorSetBinding<VK_PIPELINE_BIND_POINT_GRAPHICS>( this->updateShaderDescriptorSetBinding<VK_PIPELINE_BIND_POINT_GRAPHICS>(
m_gpSet, m_state.gp.pipeline->layout()); m_gpSet, m_state.gp.pipeline->layout());
m_flags.clr(DxvkContextFlag::GpDirtyDescriptorBinding); m_flags.clr(DxvkContextFlag::GpDirtyResources,
DxvkContextFlag::GpDirtyDescriptorBinding);
} }
@ -4336,9 +4322,6 @@ namespace dxvk {
return false; return false;
} }
if (m_flags.test(DxvkContextFlag::CpDirtyDescriptorBinding))
this->updateComputeShaderDescriptors();
if (m_flags.test(DxvkContextFlag::DirtyPushConstants)) if (m_flags.test(DxvkContextFlag::DirtyPushConstants))
this->updatePushConstants<VK_PIPELINE_BIND_POINT_COMPUTE>(); this->updatePushConstants<VK_PIPELINE_BIND_POINT_COMPUTE>();
@ -4385,9 +4368,6 @@ namespace dxvk {
if (m_flags.test(DxvkContextFlag::GpDirtyPredicate)) if (m_flags.test(DxvkContextFlag::GpDirtyPredicate))
this->updateConditionalRendering(); this->updateConditionalRendering();
if (m_flags.test(DxvkContextFlag::GpDirtyDescriptorBinding))
this->updateGraphicsShaderDescriptors();
if (m_flags.any( if (m_flags.any(
DxvkContextFlag::GpDirtyViewport, DxvkContextFlag::GpDirtyViewport,
DxvkContextFlag::GpDirtyBlendConstants, DxvkContextFlag::GpDirtyBlendConstants,

View File

@ -1148,10 +1148,7 @@ namespace dxvk {
bool updateGraphicsPipelineState(); bool updateGraphicsPipelineState();
void updateComputeShaderResources(); void updateComputeShaderResources();
void updateComputeShaderDescriptors();
void updateGraphicsShaderResources(); void updateGraphicsShaderResources();
void updateGraphicsShaderDescriptors();
template<VkPipelineBindPoint BindPoint> template<VkPipelineBindPoint BindPoint>
bool updateShaderResources( bool updateShaderResources(