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