1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[dxvk] Pull 'if's into commit{Graphics,Compute}State methods

Improves performance because GCC generates silly code around those
if blocks, most of which have a false condition anyway. Improves
performance of 100k empty draw calls with no state changes by as
much as 25%.
This commit is contained in:
Philip Rebohle 2018-11-03 00:49:57 +01:00
parent 963bd66fb3
commit b6ded02a5d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -2813,17 +2813,16 @@ namespace dxvk {
void DxvkContext::updateTransformFeedbackState() { void DxvkContext::updateTransformFeedbackState() {
if (!m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) {
return; if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) { this->pauseTransformFeedback();
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers); this->updateTransformFeedbackBuffers();
}
this->pauseTransformFeedback(); this->startTransformFeedback();
this->updateTransformFeedbackBuffers();
} }
this->startTransformFeedback();
} }
@ -2875,25 +2874,67 @@ namespace dxvk {
void DxvkContext::commitComputeState() { void DxvkContext::commitComputeState() {
this->spillRenderPass(); if (m_flags.any(
this->updateComputePipeline(); DxvkContextFlag::GpRenderPassBound,
DxvkContextFlag::GpClearRenderTargets))
this->spillRenderPass();
if (m_flags.test(DxvkContextFlag::CpDirtyPipeline))
this->updateComputePipeline();
if (m_flags.any(
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::CpDirtyDescriptorOffsets))
this->updateComputeShaderResources(); this->updateComputeShaderResources();
this->updateComputePipelineState();
this->updateComputeShaderDescriptors(); if (m_flags.test(DxvkContextFlag::CpDirtyPipelineState))
this->updateComputePipelineState();
if (m_flags.any(
DxvkContextFlag::CpDirtyDescriptorSet,
DxvkContextFlag::CpDirtyDescriptorOffsets))
this->updateComputeShaderDescriptors();
} }
void DxvkContext::commitGraphicsState() { void DxvkContext::commitGraphicsState() {
this->updateFramebuffer(); if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer))
this->startRenderPass(); this->updateFramebuffer();
this->updateGraphicsPipeline();
this->updateIndexBufferBinding(); if (!m_flags.test(DxvkContextFlag::GpRenderPassBound))
this->updateVertexBufferBindings(); this->startRenderPass();
this->updateGraphicsShaderResources();
this->updateGraphicsPipelineState(); if (m_flags.test(DxvkContextFlag::GpDirtyPipeline))
this->updateTransformFeedbackState(); this->updateGraphicsPipeline();
this->updateGraphicsShaderDescriptors();
this->updateDynamicState(); if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer))
this->updateIndexBufferBinding();
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers))
this->updateVertexBufferBindings();
if (m_flags.any(
DxvkContextFlag::GpDirtyResources,
DxvkContextFlag::GpDirtyDescriptorOffsets))
this->updateGraphicsShaderResources();
if (m_flags.test(DxvkContextFlag::GpDirtyPipelineState))
this->updateGraphicsPipelineState();
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback))
this->updateTransformFeedbackState();
if (m_flags.any(
DxvkContextFlag::GpDirtyDescriptorSet,
DxvkContextFlag::GpDirtyDescriptorOffsets))
this->updateGraphicsShaderDescriptors();
if (m_flags.any(
DxvkContextFlag::GpDirtyViewport,
DxvkContextFlag::GpDirtyBlendConstants,
DxvkContextFlag::GpDirtyStencilRef,
DxvkContextFlag::GpDirtyDepthBias))
this->updateDynamicState();
} }