diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 742489b74..29818dd27 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -644,7 +644,7 @@ namespace dxvk { uint32_t z) { this->commitComputeState(); - if (m_cpActivePipeline != VK_NULL_HANDLE) { + if (this->validateComputeState()) { m_cmd->cmdDispatch(x, y, z); this->commitComputeBarriers(); @@ -658,7 +658,7 @@ namespace dxvk { auto physicalSlice = buffer.physicalSlice(); - if (m_cpActivePipeline != VK_NULL_HANDLE) { + if (this->validateComputeState()) { m_cmd->cmdDispatchIndirect( physicalSlice.handle(), physicalSlice.offset()); @@ -675,7 +675,7 @@ namespace dxvk { uint32_t firstInstance) { this->commitGraphicsState(); - if (m_gpActivePipeline != VK_NULL_HANDLE) { + if (this->validateGraphicsState()) { m_cmd->cmdDraw( vertexCount, instanceCount, firstVertex, firstInstance); @@ -689,7 +689,7 @@ namespace dxvk { uint32_t stride) { this->commitGraphicsState(); - if (m_gpActivePipeline != VK_NULL_HANDLE) { + if (this->validateGraphicsState()) { auto physicalSlice = buffer.physicalSlice(); m_cmd->cmdDrawIndirect( @@ -708,7 +708,7 @@ namespace dxvk { uint32_t firstInstance) { this->commitGraphicsState(); - if (m_gpActivePipeline != VK_NULL_HANDLE) { + if (this->validateGraphicsState()) { m_cmd->cmdDrawIndexed( indexCount, instanceCount, firstIndex, vertexOffset, @@ -723,7 +723,7 @@ namespace dxvk { uint32_t stride) { this->commitGraphicsState(); - if (m_gpActivePipeline != VK_NULL_HANDLE) { + if (this->validateGraphicsState()) { auto physicalSlice = buffer.physicalSlice(); m_cmd->cmdDrawIndexedIndirect( @@ -1644,6 +1644,22 @@ namespace dxvk { } + bool DxvkContext::validateComputeState() { + return m_cpActivePipeline != nullptr; + } + + + bool DxvkContext::validateGraphicsState() { + if (m_gpActivePipeline == nullptr) + return false; + + if (!m_flags.test(DxvkContextFlag::GpRenderPassBound)) + return false; + + return true; + } + + void DxvkContext::commitComputeState() { this->renderPassEnd(); this->updateComputePipeline(); diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 4c01ae062..51db5feb9 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -616,6 +616,9 @@ namespace dxvk { void updateIndexBufferBinding(); void updateVertexBufferBindings(); + bool validateComputeState(); + bool validateGraphicsState(); + void commitComputeState(); void commitGraphicsState();