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:
parent
963bd66fb3
commit
b6ded02a5d
@ -2813,9 +2813,7 @@ 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)) {
|
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
|
||||||
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
|
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
|
||||||
|
|
||||||
@ -2825,6 +2823,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
this->startTransformFeedback();
|
this->startTransformFeedback();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::updateDynamicState() {
|
void DxvkContext::updateDynamicState() {
|
||||||
@ -2875,24 +2874,66 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkContext::commitComputeState() {
|
void DxvkContext::commitComputeState() {
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::GpRenderPassBound,
|
||||||
|
DxvkContextFlag::GpClearRenderTargets))
|
||||||
this->spillRenderPass();
|
this->spillRenderPass();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::CpDirtyPipeline))
|
||||||
this->updateComputePipeline();
|
this->updateComputePipeline();
|
||||||
|
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::CpDirtyResources,
|
||||||
|
DxvkContextFlag::CpDirtyDescriptorOffsets))
|
||||||
this->updateComputeShaderResources();
|
this->updateComputeShaderResources();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::CpDirtyPipelineState))
|
||||||
this->updateComputePipelineState();
|
this->updateComputePipelineState();
|
||||||
|
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::CpDirtyDescriptorSet,
|
||||||
|
DxvkContextFlag::CpDirtyDescriptorOffsets))
|
||||||
this->updateComputeShaderDescriptors();
|
this->updateComputeShaderDescriptors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::commitGraphicsState() {
|
void DxvkContext::commitGraphicsState() {
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer))
|
||||||
this->updateFramebuffer();
|
this->updateFramebuffer();
|
||||||
|
|
||||||
|
if (!m_flags.test(DxvkContextFlag::GpRenderPassBound))
|
||||||
this->startRenderPass();
|
this->startRenderPass();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline))
|
||||||
this->updateGraphicsPipeline();
|
this->updateGraphicsPipeline();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer))
|
||||||
this->updateIndexBufferBinding();
|
this->updateIndexBufferBinding();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers))
|
||||||
this->updateVertexBufferBindings();
|
this->updateVertexBufferBindings();
|
||||||
|
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::GpDirtyResources,
|
||||||
|
DxvkContextFlag::GpDirtyDescriptorOffsets))
|
||||||
this->updateGraphicsShaderResources();
|
this->updateGraphicsShaderResources();
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpDirtyPipelineState))
|
||||||
this->updateGraphicsPipelineState();
|
this->updateGraphicsPipelineState();
|
||||||
|
|
||||||
|
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback))
|
||||||
this->updateTransformFeedbackState();
|
this->updateTransformFeedbackState();
|
||||||
|
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::GpDirtyDescriptorSet,
|
||||||
|
DxvkContextFlag::GpDirtyDescriptorOffsets))
|
||||||
this->updateGraphicsShaderDescriptors();
|
this->updateGraphicsShaderDescriptors();
|
||||||
|
|
||||||
|
if (m_flags.any(
|
||||||
|
DxvkContextFlag::GpDirtyViewport,
|
||||||
|
DxvkContextFlag::GpDirtyBlendConstants,
|
||||||
|
DxvkContextFlag::GpDirtyStencilRef,
|
||||||
|
DxvkContextFlag::GpDirtyDepthBias))
|
||||||
this->updateDynamicState();
|
this->updateDynamicState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user