From 4bd97f44c8dfb8d621fc5ecd1b1d5c4165cfe258 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 3 Mar 2025 12:22:59 +0100 Subject: [PATCH] [dxvk] Add binding flag for multisampled images --- src/d3d11/d3d11_video.cpp | 2 +- src/dxbc/dxbc_compiler.cpp | 3 ++- src/dxvk/dxvk_pipelayout.cpp | 6 +++++- src/dxvk/dxvk_pipelayout.h | 15 ++++++++------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/d3d11/d3d11_video.cpp b/src/d3d11/d3d11_video.cpp index e76063111..7522b2df7 100644 --- a/src/d3d11/d3d11_video.cpp +++ b/src/d3d11/d3d11_video.cpp @@ -1333,7 +1333,7 @@ namespace dxvk { SpirvCodeBuffer fsCode(d3d11_video_blit_frag); const std::array fsBindings = {{ - { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, VK_IMAGE_VIEW_TYPE_MAX_ENUM, VK_SHADER_STAGE_FRAGMENT_BIT, VK_ACCESS_UNIFORM_READ_BIT, VK_TRUE }, + { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, VK_IMAGE_VIEW_TYPE_MAX_ENUM, VK_SHADER_STAGE_FRAGMENT_BIT, VK_ACCESS_UNIFORM_READ_BIT, DxvkAccessOp::None, true }, { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_IMAGE_VIEW_TYPE_2D, VK_SHADER_STAGE_FRAGMENT_BIT, VK_ACCESS_SHADER_READ_BIT }, { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 2, VK_IMAGE_VIEW_TYPE_2D, VK_SHADER_STAGE_FRAGMENT_BIT, VK_ACCESS_SHADER_READ_BIT }, }}; diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 529b6f93b..6897428ed 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -871,7 +871,7 @@ namespace dxvk { binding.viewType = VK_IMAGE_VIEW_TYPE_MAX_ENUM; binding.access = VK_ACCESS_UNIFORM_READ_BIT; binding.resourceBinding = bindingId; - binding.uboSet = VK_TRUE; + binding.uboSet = true; m_bindings.push_back(binding); } @@ -1080,6 +1080,7 @@ namespace dxvk { DxvkBindingInfo binding = { }; binding.viewType = typeInfo.vtype; binding.resourceBinding = bindingId; + binding.isMultisampled = typeInfo.ms; if (isUav) { binding.descriptorType = resourceType == DxbcResourceDim::Buffer diff --git a/src/dxvk/dxvk_pipelayout.cpp b/src/dxvk/dxvk_pipelayout.cpp index cf3f69553..e3da3e1b4 100644 --- a/src/dxvk/dxvk_pipelayout.cpp +++ b/src/dxvk/dxvk_pipelayout.cpp @@ -37,7 +37,9 @@ namespace dxvk { && viewType == other.viewType && stage == other.stage && access == other.access - && uboSet == other.uboSet; + && accessOp == other.accessOp + && uboSet == other.uboSet + && isMultisampled == other.isMultisampled; } @@ -48,7 +50,9 @@ namespace dxvk { hash.add(uint32_t(viewType)); hash.add(uint32_t(stage)); hash.add(access); + hash.add(uint32_t(accessOp)); hash.add(uint32_t(uboSet)); + hash.add(uint32_t(isMultisampled)); return hash; } diff --git a/src/dxvk/dxvk_pipelayout.h b/src/dxvk/dxvk_pipelayout.h index 64d534d99..a4da93779 100644 --- a/src/dxvk/dxvk_pipelayout.h +++ b/src/dxvk/dxvk_pipelayout.h @@ -73,13 +73,14 @@ namespace dxvk { * a given shader, or for the whole pipeline. */ struct DxvkBindingInfo { - VkDescriptorType descriptorType; ///< Vulkan descriptor type - uint32_t resourceBinding; ///< API binding slot for the resource - VkImageViewType viewType; ///< Image view type - VkShaderStageFlagBits stage; ///< Shader stage - VkAccessFlags access; ///< Access mask for the resource - VkBool32 uboSet; ///< Whether to include this in the UBO set - DxvkAccessOp accessOp; ///< Order-invariant store type, if any + VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_MAX_ENUM; ///< Vulkan descriptor type + uint32_t resourceBinding = 0u; ///< API binding slot for the resource + VkImageViewType viewType = VK_IMAGE_VIEW_TYPE_MAX_ENUM; ///< Image view type + VkShaderStageFlagBits stage = VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM; ///< Shader stage + VkAccessFlags access = 0u; ///< Access mask for the resource + DxvkAccessOp accessOp = DxvkAccessOp::None; ///< Order-invariant store type, if any + bool uboSet = false; ///< Whether to include this in the UBO set + bool isMultisampled = false; ///< Multisampled binding /** * \brief Computes descriptor set index for the given binding