1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxvk] Eliminate some redundant state checks

This commit is contained in:
Philip Rebohle 2019-09-26 14:20:50 +02:00
parent 7cdc402a58
commit a920a7275b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -3552,7 +3552,6 @@ namespace dxvk {
void DxvkContext::updateComputePipeline() { void DxvkContext::updateComputePipeline() {
if (m_flags.test(DxvkContextFlag::CpDirtyPipeline)) {
m_flags.clr(DxvkContextFlag::CpDirtyPipeline); m_flags.clr(DxvkContextFlag::CpDirtyPipeline);
m_state.cp.state.bsBindingMask.clear(); m_state.cp.state.bsBindingMask.clear();
@ -3562,11 +3561,9 @@ namespace dxvk {
&& m_state.cp.pipeline->layout()->pushConstRange().size) && m_state.cp.pipeline->layout()->pushConstRange().size)
m_flags.set(DxvkContextFlag::DirtyPushConstants); m_flags.set(DxvkContextFlag::DirtyPushConstants);
} }
}
void DxvkContext::updateComputePipelineState() { void DxvkContext::updateComputePipelineState() {
if (m_flags.test(DxvkContextFlag::CpDirtyPipelineState)) {
m_flags.clr(DxvkContextFlag::CpDirtyPipelineState); m_flags.clr(DxvkContextFlag::CpDirtyPipelineState);
m_cpActivePipeline = m_state.cp.pipeline != nullptr m_cpActivePipeline = m_state.cp.pipeline != nullptr
@ -3579,7 +3576,6 @@ namespace dxvk {
m_cpActivePipeline); m_cpActivePipeline);
} }
} }
}
void DxvkContext::unbindGraphicsPipeline() { void DxvkContext::unbindGraphicsPipeline() {
@ -3602,7 +3598,6 @@ namespace dxvk {
void DxvkContext::updateGraphicsPipeline() { void DxvkContext::updateGraphicsPipeline() {
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) {
m_flags.clr(DxvkContextFlag::GpDirtyPipeline); m_flags.clr(DxvkContextFlag::GpDirtyPipeline);
m_state.gp.state.bsBindingMask.clear(); m_state.gp.state.bsBindingMask.clear();
@ -3616,11 +3611,9 @@ namespace dxvk {
m_flags.set(DxvkContextFlag::DirtyPushConstants); m_flags.set(DxvkContextFlag::DirtyPushConstants);
} }
} }
}
void DxvkContext::updateGraphicsPipelineState() { void DxvkContext::updateGraphicsPipelineState() {
if (m_flags.test(DxvkContextFlag::GpDirtyPipelineState)) {
m_flags.clr(DxvkContextFlag::GpDirtyPipelineState); m_flags.clr(DxvkContextFlag::GpDirtyPipelineState);
this->pauseTransformFeedback(); this->pauseTransformFeedback();
@ -3659,8 +3652,7 @@ namespace dxvk {
// Retrieve and bind actual Vulkan pipeline handle // Retrieve and bind actual Vulkan pipeline handle
m_gpActivePipeline = m_state.gp.pipeline != nullptr && m_state.om.framebuffer != nullptr m_gpActivePipeline = m_state.gp.pipeline != nullptr && m_state.om.framebuffer != nullptr
? m_state.gp.pipeline->getPipelineHandle(m_state.gp.state, ? m_state.gp.pipeline->getPipelineHandle(m_state.gp.state, m_state.om.framebuffer->getRenderPass())
m_state.om.framebuffer->getRenderPass())
: VK_NULL_HANDLE; : VK_NULL_HANDLE;
if (m_gpActivePipeline != VK_NULL_HANDLE) { if (m_gpActivePipeline != VK_NULL_HANDLE) {
@ -3669,7 +3661,6 @@ namespace dxvk {
m_gpActivePipeline); m_gpActivePipeline);
} }
} }
}
void DxvkContext::updateComputeShaderResources() { void DxvkContext::updateComputeShaderResources() {
@ -3979,7 +3970,6 @@ namespace dxvk {
void DxvkContext::updateFramebuffer() { void DxvkContext::updateFramebuffer() {
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer)) {
m_flags.clr(DxvkContextFlag::GpDirtyFramebuffer); m_flags.clr(DxvkContextFlag::GpDirtyFramebuffer);
this->spillRenderPass(); this->spillRenderPass();
@ -3999,11 +3989,9 @@ namespace dxvk {
m_flags.set(DxvkContextFlag::GpDirtyPipelineState); m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
} }
}
void DxvkContext::updateIndexBufferBinding() { void DxvkContext::updateIndexBufferBinding() {
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer)) {
m_flags.clr(DxvkContextFlag::GpDirtyIndexBuffer); m_flags.clr(DxvkContextFlag::GpDirtyIndexBuffer);
if (m_state.vi.indexBuffer.defined()) { if (m_state.vi.indexBuffer.defined()) {
@ -4022,11 +4010,9 @@ namespace dxvk {
0, VK_INDEX_TYPE_UINT32); 0, VK_INDEX_TYPE_UINT32);
} }
} }
}
void DxvkContext::updateVertexBufferBindings() { void DxvkContext::updateVertexBufferBindings() {
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers)) {
m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers); m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers);
if (unlikely(!m_state.gp.state.ilBindingCount)) if (unlikely(!m_state.gp.state.ilBindingCount))
@ -4059,7 +4045,6 @@ namespace dxvk {
0, m_state.gp.state.ilBindingCount, 0, m_state.gp.state.ilBindingCount,
buffers.data(), offsets.data()); buffers.data(), offsets.data());
} }
}
void DxvkContext::updateTransformFeedbackBuffers() { void DxvkContext::updateTransformFeedbackBuffers() {
@ -4094,7 +4079,6 @@ namespace dxvk {
void DxvkContext::updateTransformFeedbackState() { void DxvkContext::updateTransformFeedbackState() {
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) {
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) { if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers); m_flags.clr(DxvkContextFlag::GpDirtyXfbBuffers);
@ -4104,11 +4088,9 @@ namespace dxvk {
this->startTransformFeedback(); this->startTransformFeedback();
} }
}
void DxvkContext::updateConditionalRendering() { void DxvkContext::updateConditionalRendering() {
if (m_flags.test(DxvkContextFlag::GpDirtyPredicate)) {
m_flags.clr(DxvkContextFlag::GpDirtyPredicate); m_flags.clr(DxvkContextFlag::GpDirtyPredicate);
pauseConditionalRendering(); pauseConditionalRendering();
@ -4116,11 +4098,10 @@ namespace dxvk {
if (m_state.cond.predicate.defined()) if (m_state.cond.predicate.defined())
startConditionalRendering(); startConditionalRendering();
} }
}
void DxvkContext::updateDynamicState() { void DxvkContext::updateDynamicState() {
if (m_gpActivePipeline == VK_NULL_HANDLE) if (!m_gpActivePipeline)
return; return;
if (m_flags.test(DxvkContextFlag::GpDirtyViewport)) { if (m_flags.test(DxvkContextFlag::GpDirtyViewport)) {
@ -4169,7 +4150,6 @@ namespace dxvk {
template<VkPipelineBindPoint BindPoint> template<VkPipelineBindPoint BindPoint>
void DxvkContext::updatePushConstants() { void DxvkContext::updatePushConstants() {
if (m_flags.test(DxvkContextFlag::DirtyPushConstants)) {
m_flags.clr(DxvkContextFlag::DirtyPushConstants); m_flags.clr(DxvkContextFlag::DirtyPushConstants);
auto layout = BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS auto layout = BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS
@ -4190,7 +4170,6 @@ namespace dxvk {
pushConstRange.size, pushConstRange.size,
&m_state.pc.data[pushConstRange.offset]); &m_state.pc.data[pushConstRange.offset]);
} }
}
void DxvkContext::commitComputeState() { void DxvkContext::commitComputeState() {