mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +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:
parent
963bd66fb3
commit
b6ded02a5d
@ -2813,17 +2813,16 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::updateTransformFeedbackState() {
|
||||
if (!m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback))
|
||||
return;
|
||||
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
|
||||
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
|
||||
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) {
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
|
||||
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
|
||||
|
||||
this->pauseTransformFeedback();
|
||||
this->updateTransformFeedbackBuffers();
|
||||
this->pauseTransformFeedback();
|
||||
this->updateTransformFeedbackBuffers();
|
||||
}
|
||||
|
||||
this->startTransformFeedback();
|
||||
}
|
||||
|
||||
this->startTransformFeedback();
|
||||
}
|
||||
|
||||
|
||||
@ -2875,25 +2874,67 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::commitComputeState() {
|
||||
this->spillRenderPass();
|
||||
this->updateComputePipeline();
|
||||
if (m_flags.any(
|
||||
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->updateComputePipelineState();
|
||||
this->updateComputeShaderDescriptors();
|
||||
|
||||
if (m_flags.test(DxvkContextFlag::CpDirtyPipelineState))
|
||||
this->updateComputePipelineState();
|
||||
|
||||
if (m_flags.any(
|
||||
DxvkContextFlag::CpDirtyDescriptorSet,
|
||||
DxvkContextFlag::CpDirtyDescriptorOffsets))
|
||||
this->updateComputeShaderDescriptors();
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::commitGraphicsState() {
|
||||
this->updateFramebuffer();
|
||||
this->startRenderPass();
|
||||
this->updateGraphicsPipeline();
|
||||
this->updateIndexBufferBinding();
|
||||
this->updateVertexBufferBindings();
|
||||
this->updateGraphicsShaderResources();
|
||||
this->updateGraphicsPipelineState();
|
||||
this->updateTransformFeedbackState();
|
||||
this->updateGraphicsShaderDescriptors();
|
||||
this->updateDynamicState();
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer))
|
||||
this->updateFramebuffer();
|
||||
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassBound))
|
||||
this->startRenderPass();
|
||||
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline))
|
||||
this->updateGraphicsPipeline();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user