Add support for VK_KHR_unified_image_layouts

This commit is contained in:
baldurk
2025-08-25 10:19:31 +01:00
parent 0e260dc490
commit 0b17720e3b
9 changed files with 102 additions and 7 deletions
+1 -1
View File
@@ -230,6 +230,7 @@ Maintainers can update this file by updating vk.xml in this folder and running `
* `VK_KHR_swapchain_maintenance1`
* `VK_KHR_synchronization2`
* `VK_KHR_timeline_semaphore`
* `VK_KHR_unified_image_layouts`
* `VK_KHR_uniform_buffer_standard_layout`
* `VK_KHR_variable_pointers`
* `VK_KHR_vertex_attribute_divisor`
@@ -274,7 +275,6 @@ KHR extensions will definitely be implemented at some point, though KHR extensio
* `VK_KHR_present_id2`
* `VK_KHR_present_mode_fifo_latest_ready`
* `VK_KHR_present_wait2`
* `VK_KHR_unified_image_layouts`
## KHR Portability
+4
View File
@@ -1457,6 +1457,7 @@ DECLARE_REFLECTION_STRUCT(VkAcquireProfilingLockInfoKHR);
DECLARE_REFLECTION_STRUCT(VkApplicationInfo);
DECLARE_REFLECTION_STRUCT(VkAttachmentDescription2);
DECLARE_REFLECTION_STRUCT(VkAttachmentDescriptionStencilLayout);
DECLARE_REFLECTION_STRUCT(VkAttachmentFeedbackLoopInfoEXT);
DECLARE_REFLECTION_STRUCT(VkAttachmentReference2);
DECLARE_REFLECTION_STRUCT(VkAttachmentReferenceStencilLayout);
DECLARE_REFLECTION_STRUCT(VkAttachmentSampleLocationsEXT);
@@ -1797,6 +1798,7 @@ DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceTimelineSemaphoreProperties);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceToolProperties);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceTransformFeedbackFeaturesEXT);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceTransformFeedbackPropertiesEXT);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceUniformBufferStandardLayoutFeatures);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceVariablePointersFeatures);
DECLARE_REFLECTION_STRUCT(VkPhysicalDeviceVertexAttributeDivisorFeatures);
@@ -1953,6 +1955,7 @@ DECLARE_DESERIALISE_TYPE(VkAcquireProfilingLockInfoKHR);
DECLARE_DESERIALISE_TYPE(VkApplicationInfo);
DECLARE_DESERIALISE_TYPE(VkAttachmentDescription2);
DECLARE_DESERIALISE_TYPE(VkAttachmentDescriptionStencilLayout);
DECLARE_DESERIALISE_TYPE(VkAttachmentFeedbackLoopInfoEXT);
DECLARE_DESERIALISE_TYPE(VkAttachmentReference2);
DECLARE_DESERIALISE_TYPE(VkAttachmentReferenceStencilLayout);
DECLARE_DESERIALISE_TYPE(VkAttachmentSampleLocationsEXT);
@@ -2287,6 +2290,7 @@ DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceTimelineSemaphoreProperties);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceToolProperties);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceTransformFeedbackFeaturesEXT);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceTransformFeedbackPropertiesEXT);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceUniformBufferStandardLayoutFeatures);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceVariablePointersFeatures);
DECLARE_DESERIALISE_TYPE(VkPhysicalDeviceVertexAttributeDivisorFeatures);
+4
View File
@@ -1866,6 +1866,10 @@ static const VkExtensionProperties supportedExtensions[] = {
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME,
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION,
},
{
VK_KHR_UNIFIED_IMAGE_LAYOUTS_EXTENSION_NAME,
VK_KHR_UNIFIED_IMAGE_LAYOUTS_SPEC_VERSION,
},
{
VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME,
VK_KHR_VARIABLE_POINTERS_SPEC_VERSION,
+3 -2
View File
@@ -105,6 +105,7 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
COPY_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2, VkAttachmentDescription2); \
COPY_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT, \
VkAttachmentDescriptionStencilLayout); \
COPY_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT, VkAttachmentFeedbackLoopInfoEXT); \
COPY_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2, VkAttachmentReference2); \
COPY_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT, \
VkAttachmentReferenceStencilLayout); \
@@ -555,6 +556,8 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
VkPhysicalDeviceVertexAttributeDivisorProperties); \
COPY_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT, \
VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT); \
COPY_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR, \
VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR); \
COPY_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES, \
VkPhysicalDeviceUniformBufferStandardLayoutFeatures); \
COPY_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, \
@@ -917,7 +920,6 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
case VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID: \
case VK_STRUCTURE_TYPE_ANTI_LAG_DATA_AMD: \
case VK_STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD: \
case VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT: \
case VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD: \
case VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV: \
case VK_STRUCTURE_TYPE_BIND_DATA_GRAPH_PIPELINE_SESSION_MEMORY_INFO_ARM: \
@@ -1246,7 +1248,6 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_SHADING_FEATURES_QCOM: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_SHADING_PROPERTIES_QCOM: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_ROBUSTNESS_FEATURES_EXT: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_DECODE_VP9_FEATURES_KHR: \
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_ENCODE_AV1_FEATURES_KHR: \
+39 -4
View File
@@ -1514,6 +1514,11 @@ SERIALISE_VK_HANDLES();
PNEXT_STRUCT(VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, VkSemaphoreWaitInfo) \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO, VkSemaphoreSignalInfo) \
\
/* VK_KHR_unified_image_layouts */ \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR, \
VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR) \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT, VkAttachmentFeedbackLoopInfoEXT) \
\
/* VK_KHR_uniform_buffer_standard_layout */ \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES, \
VkPhysicalDeviceUniformBufferStandardLayoutFeatures) \
@@ -1955,10 +1960,6 @@ SERIALISE_VK_HANDLES();
/* VK_KHR_present_mode_fifo_latest_ready */ \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_MODE_FIFO_LATEST_READY_FEATURES_KHR) \
\
/* VK_KHR_unified_image_layouts */ \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT) \
\
/* VK_KHR_video_decode_av1 */ \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_KHR) \
@@ -5386,6 +5387,38 @@ void Deserialise(const VkPhysicalDeviceVulkan13Properties &el)
DeserialiseNext(el.pNext);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR &el)
{
RDCASSERT(ser.IsReading() ||
el.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR);
SerialiseNext(ser, el.sType, el.pNext);
SERIALISE_MEMBER(unifiedImageLayouts);
SERIALISE_MEMBER(unifiedImageLayoutsVideo);
}
template <>
void Deserialise(const VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR &el)
{
DeserialiseNext(el.pNext);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VkAttachmentFeedbackLoopInfoEXT &el)
{
RDCASSERT(ser.IsReading() || el.sType == VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT);
SerialiseNext(ser, el.sType, el.pNext);
SERIALISE_MEMBER(feedbackLoopEnable);
}
template <>
void Deserialise(const VkAttachmentFeedbackLoopInfoEXT &el)
{
DeserialiseNext(el.pNext);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VkPhysicalDeviceUniformBufferStandardLayoutFeatures &el)
{
@@ -13832,6 +13865,7 @@ INSTANTIATE_SERIALISE_TYPE(VkAcquireProfilingLockInfoKHR);
INSTANTIATE_SERIALISE_TYPE(VkApplicationInfo);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentDescription2);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentDescriptionStencilLayout);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentFeedbackLoopInfoEXT);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentReference2);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentReferenceStencilLayout);
INSTANTIATE_SERIALISE_TYPE(VkAttachmentSampleLocationsEXT);
@@ -14169,6 +14203,7 @@ INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceTimelineSemaphoreProperties);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceToolProperties);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceTransformFeedbackFeaturesEXT);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceTransformFeedbackPropertiesEXT);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceUniformBufferStandardLayoutFeatures);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceVariablePointersFeatures);
INSTANTIATE_SERIALISE_TYPE(VkPhysicalDeviceVertexAttributeDivisorFeatures);
+31
View File
@@ -136,6 +136,37 @@ void setupRenderingInfo(const VulkanRenderState::DynamicRendering &dynamicRender
}
} // namespace
void VulkanRenderState::DynamicRendering::CopyAttachmentNext(VkRenderingAttachmentInfo &info)
{
void *newNext = NULL;
VkAttachmentFeedbackLoopInfoEXT *feedback = (VkAttachmentFeedbackLoopInfoEXT *)FindNextStruct(
&info, VK_STRUCTURE_TYPE_ATTACHMENT_FEEDBACK_LOOP_INFO_EXT);
if(feedback)
{
feedbacks.push_back(*feedback);
feedbacks.back().pNext = newNext;
newNext = &feedbacks.back();
}
// if other structs are added, they can be checked the same here and prepended to newNext in the same way
info.pNext = newNext;
}
void VulkanRenderState::DynamicRendering::CopyAttachmentNexts()
{
// ensure we don't invalidate any pointers in the loop below, reserve enough space
feedbacks.clear();
feedbacks.reserve(color.size() + 2);
for(VkRenderingAttachmentInfo &info : color)
CopyAttachmentNext(info);
CopyAttachmentNext(depth);
CopyAttachmentNext(stencil);
}
VulkanRenderState::VulkanRenderState()
{
RDCEraseEl(ibuffer);
+8
View File
@@ -315,6 +315,8 @@ struct VulkanRenderState
VkRenderingAttachmentInfo depth = {};
VkRenderingAttachmentInfo stencil = {};
void CopyAttachmentNexts();
VkImageView fragmentDensityView = VK_NULL_HANDLE;
VkImageLayout fragmentDensityLayout = VK_IMAGE_LAYOUT_UNDEFINED;
@@ -327,6 +329,12 @@ struct VulkanRenderState
// VK_KHR_dynamic_rendering_local_read
DynamicRenderingLocalRead localRead;
private:
// VK_KHR_unified_image_layouts
rdcarray<VkAttachmentFeedbackLoopInfoEXT> feedbacks;
void CopyAttachmentNext(VkRenderingAttachmentInfo &info);
} dynamicRendering;
// fdm offset
@@ -7392,6 +7392,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRendering(SerialiserType &ser, VkCommand
if(RenderingInfo.pStencilAttachment)
renderstate.dynamicRendering.stencil = *RenderingInfo.pStencilAttachment;
renderstate.dynamicRendering.CopyAttachmentNexts();
const VkRenderingFragmentDensityMapAttachmentInfoEXT *fragmentDensityAttachment =
(const VkRenderingFragmentDensityMapAttachmentInfoEXT *)FindNextStruct(
&RenderingInfo,
@@ -7576,6 +7578,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRendering(SerialiserType &ser, VkCommand
if(RenderingInfo.pStencilAttachment)
renderstate.dynamicRendering.stencil = *RenderingInfo.pStencilAttachment;
renderstate.dynamicRendering.CopyAttachmentNexts();
const VkRenderingFragmentDensityMapAttachmentInfoEXT *fragmentDensityAttachment =
(const VkRenderingFragmentDensityMapAttachmentInfoEXT *)FindNextStruct(
&RenderingInfo, VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT);
@@ -3526,6 +3526,14 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
CHECK_PHYS_EXT_FEATURE(shaderBFloat16CooperativeMatrix);
}
END_PHYS_EXT_CHECK();
BEGIN_PHYS_EXT_CHECK(VkPhysicalDeviceUnifiedImageLayoutsFeaturesKHR,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFIED_IMAGE_LAYOUTS_FEATURES_KHR);
{
CHECK_PHYS_EXT_FEATURE(unifiedImageLayouts);
CHECK_PHYS_EXT_FEATURE(unifiedImageLayoutsVideo);
}
END_PHYS_EXT_CHECK();
}
if(availFeatures.depthClamp)