mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-23 10:54:14 +01:00
[dxvk] Add context flag for active secondary command buffers
Makes some checks more explicit.
This commit is contained in:
parent
d6f4e83777
commit
a359e5a9a4
@ -4648,12 +4648,9 @@ namespace dxvk {
|
||||
VkFormat format,
|
||||
VkResolveModeFlagBits depthMode,
|
||||
VkResolveModeFlagBits stencilMode) {
|
||||
// This optimization is only available in tiler mode
|
||||
if (!m_device->perfHints().preferRenderPassOps)
|
||||
return false;
|
||||
|
||||
// Need an active render pass to fold resolve into it
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassBound))
|
||||
// Need an active render pass with secondary command buffers to
|
||||
// fold resolve operations into it
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassSecondaryCmd))
|
||||
return false;
|
||||
|
||||
// Check whether we're dealing with a color or depth attachment, one
|
||||
@ -5256,6 +5253,8 @@ namespace dxvk {
|
||||
if (m_device->perfHints().preferRenderPassOps) {
|
||||
// Begin secondary command buffer on tiling GPUs so that subsequent
|
||||
// resolve, discard and clear commands can modify render pass ops.
|
||||
m_flags.set(DxvkContextFlag::GpRenderPassSecondaryCmd);
|
||||
|
||||
renderingInfo.flags = VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT;
|
||||
|
||||
m_cmd->beginSecondaryCommandBuffer(inheritance);
|
||||
@ -5279,7 +5278,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::renderPassUnbindFramebuffer() {
|
||||
if (m_device->perfHints().preferRenderPassOps) {
|
||||
if (m_flags.test(DxvkContextFlag::GpRenderPassSecondaryCmd)) {
|
||||
m_flags.clr(DxvkContextFlag::GpRenderPassSecondaryCmd);
|
||||
VkCommandBuffer cmdBuffer = m_cmd->endSecondaryCommandBuffer();
|
||||
|
||||
// Record scoped rendering commands with potentially
|
||||
@ -7300,8 +7300,7 @@ namespace dxvk {
|
||||
void DxvkContext::discardRenderTarget(
|
||||
const DxvkImage& image,
|
||||
const VkImageSubresourceRange& subresources) {
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassBound)
|
||||
|| !m_device->perfHints().preferRenderPassOps)
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassSecondaryCmd))
|
||||
return;
|
||||
|
||||
for (uint32_t i = 0; i < m_state.om.framebufferInfo.numAttachments(); i++) {
|
||||
|
@ -23,6 +23,7 @@ namespace dxvk {
|
||||
enum class DxvkContextFlag : uint32_t {
|
||||
GpRenderPassBound, ///< Render pass is currently bound
|
||||
GpRenderPassSuspended, ///< Render pass is currently suspended
|
||||
GpRenderPassSecondaryCmd, ///< Render pass uses secondary command buffer
|
||||
GpXfbActive, ///< Transform feedback is enabled
|
||||
GpDirtyFramebuffer, ///< Framebuffer binding is out of date
|
||||
GpDirtyPipeline, ///< Graphics pipeline binding is out of date
|
||||
@ -48,14 +49,18 @@ namespace dxvk {
|
||||
GpDynamicRasterizerState, ///< Cull mode and front face are dynamic
|
||||
GpDynamicVertexStrides, ///< Vertex buffer strides are dynamic
|
||||
GpIndependentSets, ///< Graphics pipeline layout was created with independent sets
|
||||
|
||||
|
||||
CpDirtyPipelineState, ///< Compute pipeline is out of date
|
||||
CpDirtySpecConstants, ///< Compute spec constants are out of date
|
||||
|
||||
|
||||
DirtyDrawBuffer, ///< Indirect argument buffer is dirty
|
||||
DirtyPushConstants, ///< Push constant data has changed
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
|
||||
static_assert(uint32_t(DxvkContextFlag::Count) <= 32u);
|
||||
|
||||
using DxvkContextFlags = Flags<DxvkContextFlag>;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user