From e69a7c71c52c2e9316f4bd7f95af7a084a1a2870 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 21 Jul 2023 10:09:57 -0700 Subject: [PATCH 01/56] build: Update to header 1.3.258 - Update known-good - Modify vulkaninfo_generator.py to wrap dynamically-sized ArrayWrapper with scope brackets - Modify vulkaninfo_generator.py to add padding after VkPhysicalDeviceHostImageCopyFeaturesEXT to work around pre-release drivers with larger versions of this struct. - Generate source --- build-android/vulkan-headers_revision_android | 2 +- common/vulkan_wrapper.cpp | 9 +- icd/generated/function_declarations.h | 58 ++++++- icd/generated/function_definitions.h | 77 +++++++-- icd/generated/vk_typemap_helper.h | 153 +++++++++++++++--- scripts/generate_vulkan_wrapper.py | 19 ++- scripts/known_good.json | 4 +- scripts/vulkaninfo_generator.py | 22 +-- vulkaninfo/generated/vulkaninfo.hpp | 105 +++++++++++- 9 files changed, 392 insertions(+), 57 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index e00e07ec..07d69683 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.257 +v1.3.258 diff --git a/common/vulkan_wrapper.cpp b/common/vulkan_wrapper.cpp index 85466dec..1df2d709 100644 --- a/common/vulkan_wrapper.cpp +++ b/common/vulkan_wrapper.cpp @@ -1048,6 +1048,11 @@ PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +PFN_vkCopyMemoryToImageEXT vkCopyMemoryToImageEXT; +PFN_vkCopyImageToMemoryEXT vkCopyImageToMemoryEXT; +PFN_vkCopyImageToImageEXT vkCopyImageToImageEXT; +PFN_vkTransitionImageLayoutEXT vkTransitionImageLayoutEXT; +PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT; PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; PFN_vkCmdPreprocessGeneratedCommandsNV vkCmdPreprocessGeneratedCommandsNV; @@ -1074,7 +1079,6 @@ PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT vkGetImageViewOpaqueCaptureDesc PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT vkGetSamplerOpaqueCaptureDescriptorDataEXT; PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT; PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; -PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT; PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI; @@ -1113,6 +1117,9 @@ PFN_vkCmdCopyMemoryIndirectNV vkCmdCopyMemoryIndirectNV; PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; +PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; +PFN_vkCmdUpdatePipelineIndirectBuffer vkCmdUpdatePipelineIndirectBuffer; +PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; PFN_vkCmdSetPolygonModeEXT vkCmdSetPolygonModeEXT; diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index c7e98171..5b0abe56 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -251,6 +251,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_extended_dynamic_state", 1}, {"VK_KHR_deferred_host_operations", 4}, {"VK_KHR_pipeline_executable_properties", 1}, + {"VK_EXT_host_image_copy", 1}, {"VK_KHR_map_memory2", 1}, {"VK_EXT_shader_atomic_float2", 1}, {"VK_EXT_swapchain_maintenance1", 1}, @@ -324,7 +325,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_image_2d_view_of_3d", 1}, {"VK_EXT_shader_tile_image", 1}, {"VK_EXT_opacity_micromap", 2}, - {"VK_NV_displacement_micromap", 1}, + {"VK_NV_displacement_micromap", 2}, {"VK_EXT_load_store_op_none", 1}, {"VK_HUAWEI_cluster_culling_shader", 2}, {"VK_EXT_border_color_swizzle", 1}, @@ -338,6 +339,7 @@ static const std::unordered_map device_extension_map = { {"VK_QCOM_fragment_density_map_offset", 1}, {"VK_NV_copy_memory_indirect", 1}, {"VK_NV_memory_decompression", 1}, + {"VK_NV_device_generated_commands_compute", 1}, {"VK_NV_linear_color_attachment", 1}, {"VK_EXT_image_compression_control_swapchain", 1}, {"VK_QCOM_image_processing", 1}, @@ -3308,6 +3310,30 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( VkCompareOp compareOp); +static VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions); + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2EXT* pSubresource, + VkSubresourceLayout2EXT* pLayout); + + static VKAPI_ATTR VkResult VKAPI_CALL ReleaseSwapchainImagesEXT( @@ -3486,12 +3512,6 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( -static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout); - @@ -3834,6 +3854,21 @@ static VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryIndirectCountNV( uint32_t stride); +static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements); + +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBuffer( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo); + + @@ -4798,6 +4833,11 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdSetDepthBoundsTestEnableEXT", (void*)CmdSetDepthBoundsTestEnableEXT}, {"vkCmdSetStencilTestEnableEXT", (void*)CmdSetStencilTestEnableEXT}, {"vkCmdSetStencilOpEXT", (void*)CmdSetStencilOpEXT}, + {"vkCopyMemoryToImageEXT", (void*)CopyMemoryToImageEXT}, + {"vkCopyImageToMemoryEXT", (void*)CopyImageToMemoryEXT}, + {"vkCopyImageToImageEXT", (void*)CopyImageToImageEXT}, + {"vkTransitionImageLayoutEXT", (void*)TransitionImageLayoutEXT}, + {"vkGetImageSubresourceLayout2EXT", (void*)GetImageSubresourceLayout2EXT}, {"vkReleaseSwapchainImagesEXT", (void*)ReleaseSwapchainImagesEXT}, {"vkGetGeneratedCommandsMemoryRequirementsNV", (void*)GetGeneratedCommandsMemoryRequirementsNV}, {"vkCmdPreprocessGeneratedCommandsNV", (void*)CmdPreprocessGeneratedCommandsNV}, @@ -4827,7 +4867,6 @@ static const std::unordered_map name_to_funcptr_map = { {"vkGetSamplerOpaqueCaptureDescriptorDataEXT", (void*)GetSamplerOpaqueCaptureDescriptorDataEXT}, {"vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT", (void*)GetAccelerationStructureOpaqueCaptureDescriptorDataEXT}, {"vkCmdSetFragmentShadingRateEnumNV", (void*)CmdSetFragmentShadingRateEnumNV}, - {"vkGetImageSubresourceLayout2EXT", (void*)GetImageSubresourceLayout2EXT}, {"vkGetDeviceFaultInfoEXT", (void*)GetDeviceFaultInfoEXT}, #ifdef VK_USE_PLATFORM_WIN32_KHR {"vkAcquireWinrtDisplayNV", (void*)AcquireWinrtDisplayNV}, @@ -4911,6 +4950,9 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdCopyMemoryToImageIndirectNV", (void*)CmdCopyMemoryToImageIndirectNV}, {"vkCmdDecompressMemoryNV", (void*)CmdDecompressMemoryNV}, {"vkCmdDecompressMemoryIndirectCountNV", (void*)CmdDecompressMemoryIndirectCountNV}, + {"vkGetPipelineIndirectMemoryRequirementsNV", (void*)GetPipelineIndirectMemoryRequirementsNV}, + {"vkCmdUpdatePipelineIndirectBuffer", (void*)CmdUpdatePipelineIndirectBuffer}, + {"vkGetPipelineIndirectDeviceAddressNV", (void*)GetPipelineIndirectDeviceAddressNV}, {"vkCmdSetTessellationDomainOriginEXT", (void*)CmdSetTessellationDomainOriginEXT}, {"vkCmdSetDepthClampEnableEXT", (void*)CmdSetDepthClampEnableEXT}, {"vkCmdSetPolygonModeEXT", (void*)CmdSetPolygonModeEXT}, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 3a0d02c8..186dfc84 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -5360,6 +5360,49 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetStencilOpEXT( } +static VKAPI_ATTR VkResult VKAPI_CALL CopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL CopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2EXT* pSubresource, + VkSubresourceLayout2EXT* pLayout) +{ +//Not a CREATE or DESTROY function +} + + static VKAPI_ATTR VkResult VKAPI_CALL ReleaseSwapchainImagesEXT( @@ -5633,15 +5676,6 @@ static VKAPI_ATTR void VKAPI_CALL CmdSetFragmentShadingRateEnumNV( -static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout) -{ -//Not a CREATE or DESTROY function -} - @@ -6171,6 +6205,31 @@ static VKAPI_ATTR void VKAPI_CALL CmdDecompressMemoryIndirectCountNV( } +static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBuffer( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + + diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index 88aa600b..aca43761 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -5100,6 +5100,114 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceHostImageCopyFeaturesEXT Type; +}; + +// Map type VkPhysicalDeviceHostImageCopyPropertiesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceHostImageCopyPropertiesEXT Type; +}; + +// Map type VkMemoryToImageCopyEXT to id VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkMemoryToImageCopyEXT Type; +}; + +// Map type VkImageToMemoryCopyEXT to id VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkImageToMemoryCopyEXT Type; +}; + +// Map type VkCopyMemoryToImageInfoEXT to id VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyMemoryToImageInfoEXT Type; +}; + +// Map type VkCopyImageToMemoryInfoEXT to id VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyImageToMemoryInfoEXT Type; +}; + +// Map type VkCopyImageToImageInfoEXT to id VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkCopyImageToImageInfoEXT Type; +}; + +// Map type VkHostImageLayoutTransitionInfoEXT to id VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkHostImageLayoutTransitionInfoEXT Type; +}; + +// Map type VkSubresourceHostMemcpySizeEXT to id VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkSubresourceHostMemcpySizeEXT Type; +}; + +// Map type VkHostImageCopyDevicePerformanceQueryEXT to id VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkHostImageCopyDevicePerformanceQueryEXT Type; +}; + +// Map type VkSubresourceLayout2EXT to id VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkSubresourceLayout2EXT Type; +}; + +// Map type VkImageSubresource2EXT to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkImageSubresource2EXT Type; +}; + // Map type VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; @@ -5853,24 +5961,6 @@ template <> struct LvlSTypeMap typedef VkImageCompressionControlEXT Type; }; -// Map type VkSubresourceLayout2EXT to id VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT -template <> struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkSubresourceLayout2EXT Type; -}; - -// Map type VkImageSubresource2EXT to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT -template <> struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkImageSubresource2EXT Type; -}; - // Map type VkImageCompressionPropertiesEXT to id VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; @@ -6730,6 +6820,33 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV Type; +}; + +// Map type VkComputePipelineIndirectBufferInfoNV to id VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkComputePipelineIndirectBufferInfoNV Type; +}; + +// Map type VkPipelineIndirectDeviceAddressInfoNV to id VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineIndirectDeviceAddressInfoNV Type; +}; + // Map type VkPhysicalDeviceLinearColorAttachmentFeaturesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index f2f06460..94cc53fa 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1169,6 +1169,14 @@ def __repr__(self): Command(name='vkCmdSetStencilOpEXT', dispatch='VkCommandBuffer'), ]) +VK_EXT_host_image_copy = Extension(name='VK_EXT_host_image_copy', version=1, guard=None, commands=[ + Command(name='vkCopyMemoryToImageEXT', dispatch='VkDevice'), + Command(name='vkCopyImageToMemoryEXT', dispatch='VkDevice'), + Command(name='vkCopyImageToImageEXT', dispatch='VkDevice'), + Command(name='vkTransitionImageLayoutEXT', dispatch='VkDevice'), + Command(name='vkGetImageSubresourceLayout2EXT', dispatch='VkDevice'), +]) + VK_EXT_shader_atomic_float2 = Extension(name='VK_EXT_shader_atomic_float2', version=1, guard=None, commands=[ ]) @@ -1283,7 +1291,6 @@ def __repr__(self): ]) VK_EXT_image_compression_control = Extension(name='VK_EXT_image_compression_control', version=1, guard=None, commands=[ - Command(name='vkGetImageSubresourceLayout2EXT', dispatch='VkDevice'), ]) VK_EXT_attachment_feedback_loop_layout = Extension(name='VK_EXT_attachment_feedback_loop_layout', version=2, guard=None, commands=[ @@ -1435,6 +1442,12 @@ def __repr__(self): Command(name='vkCmdDecompressMemoryIndirectCountNV', dispatch='VkCommandBuffer'), ]) +VK_NV_device_generated_commands_compute = Extension(name='VK_NV_device_generated_commands_compute', version=1, guard=None, commands=[ + Command(name='vkGetPipelineIndirectMemoryRequirementsNV', dispatch='VkDevice'), + Command(name='vkCmdUpdatePipelineIndirectBuffer', dispatch='VkCommandBuffer'), + Command(name='vkGetPipelineIndirectDeviceAddressNV', dispatch='VkDevice'), +]) + VK_NV_linear_color_attachment = Extension(name='VK_NV_linear_color_attachment', version=1, guard=None, commands=[ ]) @@ -1738,7 +1751,7 @@ def __repr__(self): VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) -VK_NV_displacement_micromap = Extension(name='VK_NV_displacement_micromap', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_NV_displacement_micromap = Extension(name='VK_NV_displacement_micromap', version=2, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) extensions = [ @@ -1948,6 +1961,7 @@ def __repr__(self): VK_EXT_host_query_reset, VK_EXT_index_type_uint8, VK_EXT_extended_dynamic_state, + VK_EXT_host_image_copy, VK_EXT_shader_atomic_float2, VK_EXT_surface_maintenance1, VK_EXT_swapchain_maintenance1, @@ -2015,6 +2029,7 @@ def __repr__(self): VK_QCOM_fragment_density_map_offset, VK_NV_copy_memory_indirect, VK_NV_memory_decompression, + VK_NV_device_generated_commands_compute, VK_NV_linear_color_attachment, VK_GOOGLE_surfaceless_query, VK_EXT_image_compression_control_swapchain, diff --git a/scripts/known_good.json b/scripts/known_good.json index 7981770b..e4e28f18 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.257" + "commit": "v1.3.258" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.257", + "commit": "v1.3.258", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 37ca830b..6668d046 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -567,15 +567,17 @@ def PrintStructure(struct, types_to_gen, structure_names, aliases): out += f' for (uint32_t i = 0; i < {v.arrayLength}; i++) {{ p.PrintElement(obj.{v.name}[i]); }}\n' out += f" }}\n" else: # dynamic array length based on other member - out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' - out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n" + out += f" {{\n" + out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' + out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n" if v.typeID in types_to_gen: - out += f" if (obj.{v.name} != nullptr) {{\n" - out += f" p.SetElementIndex(i);\n" - out += f' Dump{v.typeID}(p, "{v.name}", obj.{v.name}[i]);\n' - out += f" }}\n" + out += f" if (obj.{v.name} != nullptr) {{\n" + out += f" p.SetElementIndex(i);\n" + out += f' Dump{v.typeID}(p, "{v.name}", obj.{v.name}[i]);\n' + out += f" }}\n" else: - out += f" p.PrintElement(obj.{v.name}[i]);\n" + out += f" p.PrintElement(obj.{v.name}[i]);\n" + out += f" }}\n" out += f" }}\n" elif v.typeID == "VkBool32": out += f' p.PrintKeyBool("{v.name}", static_cast(obj.{v.name}));\n' @@ -642,13 +644,13 @@ def PrintChainStruct(listName, structures, all_structures, chain_details): out += AddGuardHeader(s) if s.sTypeName is not None: out += f" {s.name} {s.name[2:]}{{}};\n" - # Specific versions of drivers have an incorrect definition of the size of this struct. + # Specific versions of drivers have an incorrect definition of the size of these structs. # We need to artificially pad the structure it just so the driver doesn't write out of bounds and # into other structures that are adjacent. This bug comes from the in-development version of # the extension having a larger size than the final version, so older drivers try to write to # members which don't exist. - if s.sTypeName == "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES": - out += " char padding[64];\n" + if s.name in ['VkPhysicalDeviceShaderIntegerDotProductFeatures', 'VkPhysicalDeviceHostImageCopyFeaturesEXT']: + out += f" char {s.name}_padding[64];\n" out += AddGuardFooter(s) out += f" void initialize_chain() noexcept {{\n" for s in structs_to_print: diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 6f8a10a9..fb556d58 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -366,6 +366,45 @@ void DumpVkFormat(Printer &p, std::string name, VkFormat value) { else p.PrintKeyString(name, VkFormatString(value)); } +std::string VkImageLayoutString(VkImageLayout value) { + switch (value) { + case (VK_IMAGE_LAYOUT_UNDEFINED): return "IMAGE_LAYOUT_UNDEFINED"; + case (VK_IMAGE_LAYOUT_GENERAL): return "IMAGE_LAYOUT_GENERAL"; + case (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL): return "IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL"; + case (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL): return "IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL"; + case (VK_IMAGE_LAYOUT_PREINITIALIZED): return "IMAGE_LAYOUT_PREINITIALIZED"; + case (VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL): return "IMAGE_LAYOUT_READ_ONLY_OPTIMAL"; + case (VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL): return "IMAGE_LAYOUT_ATTACHMENT_OPTIMAL"; + case (VK_IMAGE_LAYOUT_PRESENT_SRC_KHR): return "IMAGE_LAYOUT_PRESENT_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR): return "IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR"; + case (VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR): return "IMAGE_LAYOUT_SHARED_PRESENT_KHR"; + case (VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT): return "IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT"; + case (VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR): return "IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR"; + case (VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR): return "IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR"; + case (VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT): return "IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT"; + default: return std::string("UNKNOWN_VkImageLayout_value") + std::to_string(value); + } +} +void DumpVkImageLayout(Printer &p, std::string name, VkImageLayout value) { + if (p.Type() == OutputType::json) + p.PrintKeyString(name, std::string("VK_") + VkImageLayoutString(value)); + else + p.PrintKeyString(name, VkImageLayoutString(value)); +} std::string VkImageTilingString(VkImageTiling value) { switch (value) { case (VK_IMAGE_TILING_OPTIMAL): return "IMAGE_TILING_OPTIMAL"; @@ -710,6 +749,7 @@ std::vector VkFormatFeatureFlagBits2GetStrings(VkFormatFeatureFlag if (VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR"); if (VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT & value) strings.push_back("FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT"); if (VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"); + if (VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT & value) strings.push_back("FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT"); if (VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR"); if (VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR & value) strings.push_back("FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR"); if (VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV & value) strings.push_back("FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV"); @@ -764,6 +804,7 @@ std::vector VkImageUsageFlagBitsGetStrings(VkImageUsageFlagBits va if (VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR"); if (VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT & value) strings.push_back("IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT"); if (VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR & value) strings.push_back("IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"); + if (VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT & value) strings.push_back("IMAGE_USAGE_HOST_TRANSFER_BIT_EXT"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR"); if (VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR & value) strings.push_back("IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR"); @@ -1919,6 +1960,37 @@ void DumpVkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT(Printer &p, std::s p.PrintKeyBool("graphicsPipelineLibraryFastLinking", static_cast(obj.graphicsPipelineLibraryFastLinking)); p.PrintKeyBool("graphicsPipelineLibraryIndependentInterpolationDecoration", static_cast(obj.graphicsPipelineLibraryIndependentInterpolationDecoration)); } +void DumpVkPhysicalDeviceHostImageCopyFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceHostImageCopyFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(13); + p.PrintKeyBool("hostImageCopy", static_cast(obj.hostImageCopy)); +} +void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceHostImageCopyPropertiesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(35); + p.PrintKeyValue("copySrcLayoutCount", obj.copySrcLayoutCount); + { + ArrayWrapper arr(p,"pCopySrcLayouts", obj.copySrcLayoutCount); + for (uint32_t i = 0; i < obj.copySrcLayoutCount; i++) { + if (obj.pCopySrcLayouts != nullptr) { + p.SetElementIndex(i); + DumpVkImageLayout(p, "pCopySrcLayouts", obj.pCopySrcLayouts[i]); + } + } + } + p.PrintKeyValue("copyDstLayoutCount", obj.copyDstLayoutCount); + { + ArrayWrapper arr(p,"pCopyDstLayouts", obj.copyDstLayoutCount); + for (uint32_t i = 0; i < obj.copyDstLayoutCount; i++) { + if (obj.pCopyDstLayouts != nullptr) { + p.SetElementIndex(i); + DumpVkImageLayout(p, "pCopyDstLayouts", obj.pCopyDstLayouts[i]); + } + } + } + p.PrintKeyValue("optimalTilingLayoutUUID", obj.optimalTilingLayoutUUID); + p.PrintKeyBool("identicalMemoryTypeRequirements", static_cast(obj.identicalMemoryTypeRequirements)); +} void DumpVkPhysicalDeviceHostQueryResetFeatures(Printer &p, std::string name, const VkPhysicalDeviceHostQueryResetFeatures &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(14); @@ -3114,11 +3186,13 @@ void DumpVkSurfacePresentModeCompatibilityEXT(Printer &p, std::string name, cons ObjectWrapper object{p, name}; p.SetMinKeyWidth(31); p.PrintKeyValue("presentModeCount", obj.presentModeCount); - ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); - for (uint32_t i = 0; i < obj.presentModeCount; i++) { - if (obj.pPresentModes != nullptr) { - p.SetElementIndex(i); - DumpVkPresentModeKHR(p, "pPresentModes", obj.pPresentModes[i]); + { + ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); + for (uint32_t i = 0; i < obj.presentModeCount; i++) { + if (obj.pPresentModes != nullptr) { + p.SetElementIndex(i); + DumpVkPresentModeKHR(p, "pPresentModes", obj.pPresentModes[i]); + } } } } @@ -3162,6 +3236,7 @@ struct phys_device_props2_chain { VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR PhysicalDeviceFragmentShaderBarycentricPropertiesKHR{}; VkPhysicalDeviceFragmentShadingRatePropertiesKHR PhysicalDeviceFragmentShadingRatePropertiesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT{}; + VkPhysicalDeviceHostImageCopyPropertiesEXT PhysicalDeviceHostImageCopyPropertiesEXT{}; VkPhysicalDeviceIDProperties PhysicalDeviceIDProperties{}; VkPhysicalDeviceInlineUniformBlockProperties PhysicalDeviceInlineUniformBlockProperties{}; VkPhysicalDeviceLineRasterizationPropertiesEXT PhysicalDeviceLineRasterizationPropertiesEXT{}; @@ -3219,6 +3294,7 @@ struct phys_device_props2_chain { PhysicalDeviceFragmentShaderBarycentricPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR; PhysicalDeviceFragmentShadingRatePropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT; + PhysicalDeviceHostImageCopyPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; PhysicalDeviceIDProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; PhysicalDeviceInlineUniformBlockProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES; PhysicalDeviceLineRasterizationPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; @@ -3276,6 +3352,7 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderBarycentricPropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRatePropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceIDProperties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceInlineUniformBlockProperties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationPropertiesEXT)); @@ -3391,6 +3468,8 @@ struct phys_device_features2_chain { VkPhysicalDeviceFragmentShadingRateFeaturesKHR PhysicalDeviceFragmentShadingRateFeaturesKHR{}; VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR PhysicalDeviceGlobalPriorityQueryFeaturesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT{}; + VkPhysicalDeviceHostImageCopyFeaturesEXT PhysicalDeviceHostImageCopyFeaturesEXT{}; + char VkPhysicalDeviceHostImageCopyFeaturesEXT_padding[64]; VkPhysicalDeviceHostQueryResetFeatures PhysicalDeviceHostQueryResetFeatures{}; VkPhysicalDeviceImage2DViewOf3DFeaturesEXT PhysicalDeviceImage2DViewOf3DFeaturesEXT{}; VkPhysicalDeviceImageCompressionControlFeaturesEXT PhysicalDeviceImageCompressionControlFeaturesEXT{}; @@ -3449,7 +3528,7 @@ struct phys_device_features2_chain { VkPhysicalDeviceShaderFloat16Int8Features PhysicalDeviceShaderFloat16Int8Features{}; VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT PhysicalDeviceShaderImageAtomicInt64FeaturesEXT{}; VkPhysicalDeviceShaderIntegerDotProductFeatures PhysicalDeviceShaderIntegerDotProductFeatures{}; - char padding[64]; + char VkPhysicalDeviceShaderIntegerDotProductFeatures_padding[64]; VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT PhysicalDeviceShaderModuleIdentifierFeaturesEXT{}; VkPhysicalDeviceShaderObjectFeaturesEXT PhysicalDeviceShaderObjectFeaturesEXT{}; VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures PhysicalDeviceShaderSubgroupExtendedTypesFeatures{}; @@ -3513,6 +3592,7 @@ struct phys_device_features2_chain { PhysicalDeviceFragmentShadingRateFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; PhysicalDeviceGlobalPriorityQueryFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; + PhysicalDeviceHostImageCopyFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; PhysicalDeviceHostQueryResetFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; PhysicalDeviceImage2DViewOf3DFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; PhysicalDeviceImageCompressionControlFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; @@ -3634,6 +3714,7 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRateFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGlobalPriorityQueryFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostQueryResetFeatures)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceImage2DViewOf3DFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceImageCompressionControlFeaturesEXT)); @@ -3957,6 +4038,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT(p, "VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME))) { + VkPhysicalDeviceHostImageCopyPropertiesEXT* props = (VkPhysicalDeviceHostImageCopyPropertiesEXT*)structure; + DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES && (inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME) || gpu.api_version.minor >= 1)) { @@ -4402,6 +4489,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT(p, "VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME))) { + VkPhysicalDeviceHostImageCopyFeaturesEXT* props = (VkPhysicalDeviceHostImageCopyFeaturesEXT*)structure; + DumpVkPhysicalDeviceHostImageCopyFeaturesEXT(p, "VkPhysicalDeviceHostImageCopyFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME) || gpu.api_version.minor >= 2)) { From ed6820d508fd24b1a50166a600dbf7ee8300e9d9 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Mon, 24 Jul 2023 10:27:24 -0700 Subject: [PATCH 02/56] build: Update to header 1.3.259 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- common/vulkan_wrapper.cpp | 2 +- icd/generated/function_declarations.h | 6 +++--- icd/generated/function_definitions.h | 2 +- scripts/generate_vulkan_wrapper.py | 4 ++-- scripts/known_good.json | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 07d69683..edec0e59 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.258 +v1.3.259 diff --git a/common/vulkan_wrapper.cpp b/common/vulkan_wrapper.cpp index 1df2d709..fc9d8b94 100644 --- a/common/vulkan_wrapper.cpp +++ b/common/vulkan_wrapper.cpp @@ -1118,7 +1118,7 @@ PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; -PFN_vkCmdUpdatePipelineIndirectBuffer vkCmdUpdatePipelineIndirectBuffer; +PFN_vkCmdUpdatePipelineIndirectBufferNV vkCmdUpdatePipelineIndirectBufferNV; PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 5b0abe56..4ac4d18c 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -339,7 +339,7 @@ static const std::unordered_map device_extension_map = { {"VK_QCOM_fragment_density_map_offset", 1}, {"VK_NV_copy_memory_indirect", 1}, {"VK_NV_memory_decompression", 1}, - {"VK_NV_device_generated_commands_compute", 1}, + {"VK_NV_device_generated_commands_compute", 2}, {"VK_NV_linear_color_attachment", 1}, {"VK_EXT_image_compression_control_swapchain", 1}, {"VK_QCOM_image_processing", 1}, @@ -3859,7 +3859,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( const VkComputePipelineCreateInfo* pCreateInfo, VkMemoryRequirements2* pMemoryRequirements); -static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBuffer( +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBufferNV( VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); @@ -4951,7 +4951,7 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdDecompressMemoryNV", (void*)CmdDecompressMemoryNV}, {"vkCmdDecompressMemoryIndirectCountNV", (void*)CmdDecompressMemoryIndirectCountNV}, {"vkGetPipelineIndirectMemoryRequirementsNV", (void*)GetPipelineIndirectMemoryRequirementsNV}, - {"vkCmdUpdatePipelineIndirectBuffer", (void*)CmdUpdatePipelineIndirectBuffer}, + {"vkCmdUpdatePipelineIndirectBufferNV", (void*)CmdUpdatePipelineIndirectBufferNV}, {"vkGetPipelineIndirectDeviceAddressNV", (void*)GetPipelineIndirectDeviceAddressNV}, {"vkCmdSetTessellationDomainOriginEXT", (void*)CmdSetTessellationDomainOriginEXT}, {"vkCmdSetDepthClampEnableEXT", (void*)CmdSetDepthClampEnableEXT}, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 186dfc84..014cfa6f 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6213,7 +6213,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPipelineIndirectMemoryRequirementsNV( //Not a CREATE or DESTROY function } -static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBuffer( +static VKAPI_ATTR void VKAPI_CALL CmdUpdatePipelineIndirectBufferNV( VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 94cc53fa..a6d21ede 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1442,9 +1442,9 @@ def __repr__(self): Command(name='vkCmdDecompressMemoryIndirectCountNV', dispatch='VkCommandBuffer'), ]) -VK_NV_device_generated_commands_compute = Extension(name='VK_NV_device_generated_commands_compute', version=1, guard=None, commands=[ +VK_NV_device_generated_commands_compute = Extension(name='VK_NV_device_generated_commands_compute', version=2, guard=None, commands=[ Command(name='vkGetPipelineIndirectMemoryRequirementsNV', dispatch='VkDevice'), - Command(name='vkCmdUpdatePipelineIndirectBuffer', dispatch='VkCommandBuffer'), + Command(name='vkCmdUpdatePipelineIndirectBufferNV', dispatch='VkCommandBuffer'), Command(name='vkGetPipelineIndirectDeviceAddressNV', dispatch='VkDevice'), ]) diff --git a/scripts/known_good.json b/scripts/known_good.json index e4e28f18..55d17c25 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.258" + "commit": "v1.3.259" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.258", + "commit": "v1.3.259", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", From ab9d7a042d152f0f36ef7e43cf33edea438fc6ab Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 25 Jul 2023 10:27:45 -0600 Subject: [PATCH 03/56] vulkaninfo: Enable Swapchain Colorspace ext This extension may be required to be enabled to enumerate HDR formats, best to enable it if its available. --- vulkaninfo/vulkaninfo.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 2daa3ca6..5bc13056 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -798,6 +798,9 @@ struct AppInstance { if (strcmp(VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME, ext.extensionName) == 0) { inst_extensions.push_back(ext.extensionName); } + if (strcmp(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME, ext.extensionName) == 0) { + inst_extensions.push_back(ext.extensionName); + } } } From adf8532bc503066a9c4cf8ea30cc0f8217044f0f Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Mon, 31 Jul 2023 15:45:59 -0700 Subject: [PATCH 04/56] build: Update to header 1.3.260 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- common/vulkan_wrapper.cpp | 21 +++ common/vulkan_wrapper.h | 6 + icd/generated/function_declarations.h | 96 +++++++++++- icd/generated/function_definitions.h | 108 ++++++++++++- icd/generated/vk_typemap_helper.h | 145 +++++++++++++++--- scripts/generate_vulkan_wrapper.py | 19 +++ scripts/known_good.json | 4 +- vulkaninfo/generated/vulkaninfo.hpp | 35 +++++ 9 files changed, 411 insertions(+), 25 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index edec0e59..709013b4 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.259 +v1.3.260 diff --git a/common/vulkan_wrapper.cpp b/common/vulkan_wrapper.cpp index fc9d8b94..dff9616d 100644 --- a/common/vulkan_wrapper.cpp +++ b/common/vulkan_wrapper.cpp @@ -488,6 +488,13 @@ int InitVulkan(void) { reinterpret_cast(dlsym(libvulkan, "vkGetDeviceImageMemoryRequirementsKHR")); vkGetDeviceImageSparseMemoryRequirementsKHR = reinterpret_cast( dlsym(libvulkan, "vkGetDeviceImageSparseMemoryRequirementsKHR")); + vkCmdBindIndexBuffer2KHR = reinterpret_cast(dlsym(libvulkan, "vkCmdBindIndexBuffer2KHR")); + vkGetRenderingAreaGranularityKHR = + reinterpret_cast(dlsym(libvulkan, "vkGetRenderingAreaGranularityKHR")); + vkGetDeviceImageSubresourceLayoutKHR = + reinterpret_cast(dlsym(libvulkan, "vkGetDeviceImageSubresourceLayoutKHR")); + vkGetImageSubresourceLayout2KHR = + reinterpret_cast(dlsym(libvulkan, "vkGetImageSubresourceLayout2KHR")); vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR = reinterpret_cast( dlsym(libvulkan, "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR")); vkCreateAccelerationStructureKHR = @@ -932,6 +939,10 @@ PFN_vkCmdTraceRaysIndirect2KHR vkCmdTraceRaysIndirect2KHR; PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirementsKHR; PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; +PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT; PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT; @@ -1322,6 +1333,16 @@ PFN_vkGetEncodedVideoSessionParametersKHR vkGetEncodedVideoSessionParametersKHR; PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR; #endif +#ifdef VK_ENABLE_BETA_EXTENSIONS +PFN_vkCreateExecutionGraphPipelinesAMDX vkCreateExecutionGraphPipelinesAMDX; +PFN_vkGetExecutionGraphPipelineScratchSizeAMDX vkGetExecutionGraphPipelineScratchSizeAMDX; +PFN_vkGetExecutionGraphPipelineNodeIndexAMDX vkGetExecutionGraphPipelineNodeIndexAMDX; +PFN_vkCmdInitializeGraphScratchMemoryAMDX vkCmdInitializeGraphScratchMemoryAMDX; +PFN_vkCmdDispatchGraphAMDX vkCmdDispatchGraphAMDX; +PFN_vkCmdDispatchGraphIndirectAMDX vkCmdDispatchGraphIndirectAMDX; +PFN_vkCmdDispatchGraphIndirectCountAMDX vkCmdDispatchGraphIndirectCountAMDX; +#endif + #ifdef __cplusplus } #endif diff --git a/common/vulkan_wrapper.h b/common/vulkan_wrapper.h index 42000d78..678fdcfe 100644 --- a/common/vulkan_wrapper.h +++ b/common/vulkan_wrapper.h @@ -458,6 +458,12 @@ extern PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequire extern PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; extern PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; +// VK_KHR_maintenance5 +extern PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +extern PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +extern PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +extern PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; + // VK_KHR_cooperative_matrix extern PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 4ac4d18c..64c78387 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -155,6 +155,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_sampler_filter_minmax", 2}, {"VK_KHR_storage_buffer_storage_class", 1}, {"VK_AMD_gpu_shader_int16", 2}, + {"VK_AMDX_shader_enqueue", 1}, {"VK_AMD_mixed_attachment_samples", 1}, {"VK_AMD_shader_fragment_mask", 1}, {"VK_EXT_inline_uniform_block", 1}, @@ -351,6 +352,7 @@ static const std::unordered_map device_extension_map = { {"VK_NV_optical_flow", 1}, {"VK_EXT_legacy_dithering", 1}, {"VK_EXT_pipeline_protected_access", 1}, + {"VK_KHR_maintenance5", 1}, {"VK_KHR_ray_tracing_position_fetch", 1}, {"VK_EXT_shader_object", 1}, {"VK_QCOM_tile_properties", 1}, @@ -2427,6 +2429,30 @@ static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); +static VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType); + +static VKAPI_ATTR void VKAPI_CALL GetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity); + +static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout); + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); + + static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesKHR( VkPhysicalDevice physicalDevice, @@ -2844,6 +2870,47 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( +#ifdef VK_ENABLE_BETA_EXTENSIONS + +static VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex); + +static VKAPI_ATTR void VKAPI_CALL CmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo); +#endif /* VK_ENABLE_BETA_EXTENSIONS */ + @@ -3330,8 +3397,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( VkDevice device, VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout); + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); @@ -4673,6 +4740,10 @@ static const std::unordered_map name_to_funcptr_map = { {"vkGetDeviceBufferMemoryRequirementsKHR", (void*)GetDeviceBufferMemoryRequirementsKHR}, {"vkGetDeviceImageMemoryRequirementsKHR", (void*)GetDeviceImageMemoryRequirementsKHR}, {"vkGetDeviceImageSparseMemoryRequirementsKHR", (void*)GetDeviceImageSparseMemoryRequirementsKHR}, + {"vkCmdBindIndexBuffer2KHR", (void*)CmdBindIndexBuffer2KHR}, + {"vkGetRenderingAreaGranularityKHR", (void*)GetRenderingAreaGranularityKHR}, + {"vkGetDeviceImageSubresourceLayoutKHR", (void*)GetDeviceImageSubresourceLayoutKHR}, + {"vkGetImageSubresourceLayout2KHR", (void*)GetImageSubresourceLayout2KHR}, {"vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR", (void*)GetPhysicalDeviceCooperativeMatrixPropertiesKHR}, {"vkCreateDebugReportCallbackEXT", (void*)CreateDebugReportCallbackEXT}, {"vkDestroyDebugReportCallbackEXT", (void*)DestroyDebugReportCallbackEXT}, @@ -4751,6 +4822,27 @@ static const std::unordered_map name_to_funcptr_map = { #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR {"vkGetMemoryAndroidHardwareBufferANDROID", (void*)GetMemoryAndroidHardwareBufferANDROID}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCreateExecutionGraphPipelinesAMDX", (void*)CreateExecutionGraphPipelinesAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkGetExecutionGraphPipelineScratchSizeAMDX", (void*)GetExecutionGraphPipelineScratchSizeAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkGetExecutionGraphPipelineNodeIndexAMDX", (void*)GetExecutionGraphPipelineNodeIndexAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdInitializeGraphScratchMemoryAMDX", (void*)CmdInitializeGraphScratchMemoryAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphAMDX", (void*)CmdDispatchGraphAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphIndirectAMDX", (void*)CmdDispatchGraphIndirectAMDX}, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + {"vkCmdDispatchGraphIndirectCountAMDX", (void*)CmdDispatchGraphIndirectCountAMDX}, #endif {"vkCmdSetSampleLocationsEXT", (void*)CmdSetSampleLocationsEXT}, {"vkGetPhysicalDeviceMultisamplePropertiesEXT", (void*)GetPhysicalDeviceMultisamplePropertiesEXT}, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 014cfa6f..9f9155ba 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -3985,6 +3985,42 @@ static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirementsKHR( } +static VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) +{ +//Not a CREATE or DESTROY function +} + + static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixPropertiesKHR( VkPhysicalDevice physicalDevice, @@ -4636,6 +4672,74 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryAndroidHardwareBufferANDROID( +#ifdef VK_ENABLE_BETA_EXTENSIONS + +static VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines) +{ + unique_lock_t lock(global_lock); + for (uint32_t i = 0; i < createInfoCount; ++i) { + pPipelines[i] = (VkPipeline)global_unique_handle++; + } + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL GetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL CmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL CmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo) +{ +//Not a CREATE or DESTROY function +} +#endif /* VK_ENABLE_BETA_EXTENSIONS */ + @@ -5396,8 +5500,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL TransitionImageLayoutEXT( static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout2EXT( VkDevice device, VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout) + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout) { //Not a CREATE or DESTROY function } diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index aca43761..ea240a54 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -3204,6 +3204,78 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceMaintenance5FeaturesKHR Type; +}; + +// Map type VkPhysicalDeviceMaintenance5PropertiesKHR to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceMaintenance5PropertiesKHR Type; +}; + +// Map type VkRenderingAreaInfoKHR to id VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkRenderingAreaInfoKHR Type; +}; + +// Map type VkImageSubresource2KHR to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkImageSubresource2KHR Type; +}; + +// Map type VkDeviceImageSubresourceInfoKHR to id VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkDeviceImageSubresourceInfoKHR Type; +}; + +// Map type VkSubresourceLayout2KHR to id VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkSubresourceLayout2KHR Type; +}; + +// Map type VkPipelineCreateFlags2CreateInfoKHR to id VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineCreateFlags2CreateInfoKHR Type; +}; + +// Map type VkBufferUsageFlags2CreateInfoKHR to id VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; +}; + +template <> struct LvlSTypeMap { + typedef VkBufferUsageFlags2CreateInfoKHR Type; +}; + // Map type VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; @@ -4152,6 +4224,61 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_FEATURES_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceShaderEnqueueFeaturesAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkPhysicalDeviceShaderEnqueuePropertiesAMDX to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceShaderEnqueuePropertiesAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkExecutionGraphPipelineScratchSizeAMDX to id VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkExecutionGraphPipelineScratchSizeAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkExecutionGraphPipelineCreateInfoAMDX to id VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkExecutionGraphPipelineCreateInfoAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS +#ifdef VK_ENABLE_BETA_EXTENSIONS +// Map type VkPipelineShaderStageNodeCreateInfoAMDX to id VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX; +}; + +template <> struct LvlSTypeMap { + typedef VkPipelineShaderStageNodeCreateInfoAMDX Type; +}; + +#endif // VK_ENABLE_BETA_EXTENSIONS // Map type VkSampleLocationsInfoEXT to id VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT; @@ -5190,24 +5317,6 @@ template <> struct LvlSTypeMap struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkSubresourceLayout2EXT Type; -}; - -// Map type VkImageSubresource2EXT to id VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT -template <> struct LvlTypeMap { - static const VkStructureType kSType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT; -}; - -template <> struct LvlSTypeMap { - typedef VkImageSubresource2EXT Type; -}; - // Map type VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index a6d21ede..cd4defb8 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -697,6 +697,13 @@ def __repr__(self): Command(name='vkGetDeviceImageSparseMemoryRequirementsKHR', dispatch='VkDevice'), ]) +VK_KHR_maintenance5 = Extension(name='VK_KHR_maintenance5', version=1, guard=None, commands=[ + Command(name='vkCmdBindIndexBuffer2KHR', dispatch='VkCommandBuffer'), + Command(name='vkGetRenderingAreaGranularityKHR', dispatch='VkDevice'), + Command(name='vkGetDeviceImageSubresourceLayoutKHR', dispatch='VkDevice'), + Command(name='vkGetImageSubresourceLayout2KHR', dispatch='VkDevice'), +]) + VK_KHR_ray_tracing_position_fetch = Extension(name='VK_KHR_ray_tracing_position_fetch', version=1, guard=None, commands=[ ]) @@ -1751,6 +1758,16 @@ def __repr__(self): VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) +VK_AMDX_shader_enqueue = Extension(name='VK_AMDX_shader_enqueue', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ + Command(name='vkCreateExecutionGraphPipelinesAMDX', dispatch='VkDevice'), + Command(name='vkGetExecutionGraphPipelineScratchSizeAMDX', dispatch='VkDevice'), + Command(name='vkGetExecutionGraphPipelineNodeIndexAMDX', dispatch='VkDevice'), + Command(name='vkCmdInitializeGraphScratchMemoryAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphIndirectAMDX', dispatch='VkCommandBuffer'), + Command(name='vkCmdDispatchGraphIndirectCountAMDX', dispatch='VkCommandBuffer'), +]) + VK_NV_displacement_micromap = Extension(name='VK_NV_displacement_micromap', version=2, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) @@ -1842,6 +1859,7 @@ def __repr__(self): VK_KHR_ray_tracing_maintenance1, VK_KHR_portability_enumeration, VK_KHR_maintenance4, + VK_KHR_maintenance5, VK_KHR_ray_tracing_position_fetch, VK_KHR_cooperative_matrix, VK_EXT_debug_report, @@ -2091,6 +2109,7 @@ def __repr__(self): VK_KHR_video_encode_queue, VK_EXT_video_encode_h264, VK_EXT_video_encode_h265, + VK_AMDX_shader_enqueue, VK_NV_displacement_micromap, ] # end of generated code diff --git a/scripts/known_good.json b/scripts/known_good.json index 55d17c25..da94482b 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.259" + "commit": "v1.3.260" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.259", + "commit": "v1.3.260", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index fb556d58..df1f00e3 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -357,6 +357,8 @@ std::string VkFormatString(VkFormat value) { case (VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG): return "FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG"; case (VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG): return "FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG"; case (VK_FORMAT_R16G16_S10_5_NV): return "FORMAT_R16G16_S10_5_NV"; + case (VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR): return "FORMAT_A1B5G5R5_UNORM_PACK16_KHR"; + case (VK_FORMAT_A8_UNORM_KHR): return "FORMAT_A8_UNORM_KHR"; default: return std::string("UNKNOWN_VkFormat_value") + std::to_string(value); } } @@ -2231,6 +2233,21 @@ void DumpVkPhysicalDeviceMaintenance4Properties(Printer &p, std::string name, co p.SetMinKeyWidth(13); p.PrintKeyValue("maxBufferSize", to_hex_str(p, obj.maxBufferSize)); } +void DumpVkPhysicalDeviceMaintenance5FeaturesKHR(Printer &p, std::string name, const VkPhysicalDeviceMaintenance5FeaturesKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(12); + p.PrintKeyBool("maintenance5", static_cast(obj.maintenance5)); +} +void DumpVkPhysicalDeviceMaintenance5PropertiesKHR(Printer &p, std::string name, const VkPhysicalDeviceMaintenance5PropertiesKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(51); + p.PrintKeyBool("earlyFragmentMultisampleCoverageAfterSampleCounting", static_cast(obj.earlyFragmentMultisampleCoverageAfterSampleCounting)); + p.PrintKeyBool("earlyFragmentSampleMaskTestBeforeSampleCounting", static_cast(obj.earlyFragmentSampleMaskTestBeforeSampleCounting)); + p.PrintKeyBool("depthStencilSwizzleOneSupport", static_cast(obj.depthStencilSwizzleOneSupport)); + p.PrintKeyBool("polygonModePointSize", static_cast(obj.polygonModePointSize)); + p.PrintKeyBool("nonStrictSinglePixelWideLinesUseParallelogram", static_cast(obj.nonStrictSinglePixelWideLinesUseParallelogram)); + p.PrintKeyBool("nonStrictWideLinesUseParallelogram", static_cast(obj.nonStrictWideLinesUseParallelogram)); +} void DumpVkPhysicalDeviceMemoryBudgetPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceMemoryBudgetPropertiesEXT &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(14); @@ -3242,6 +3259,7 @@ struct phys_device_props2_chain { VkPhysicalDeviceLineRasterizationPropertiesEXT PhysicalDeviceLineRasterizationPropertiesEXT{}; VkPhysicalDeviceMaintenance3Properties PhysicalDeviceMaintenance3Properties{}; VkPhysicalDeviceMaintenance4Properties PhysicalDeviceMaintenance4Properties{}; + VkPhysicalDeviceMaintenance5PropertiesKHR PhysicalDeviceMaintenance5PropertiesKHR{}; VkPhysicalDeviceMeshShaderPropertiesEXT PhysicalDeviceMeshShaderPropertiesEXT{}; VkPhysicalDeviceMultiDrawPropertiesEXT PhysicalDeviceMultiDrawPropertiesEXT{}; VkPhysicalDeviceMultiviewProperties PhysicalDeviceMultiviewProperties{}; @@ -3300,6 +3318,7 @@ struct phys_device_props2_chain { PhysicalDeviceLineRasterizationPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; PhysicalDeviceMaintenance3Properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; PhysicalDeviceMaintenance4Properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES; + PhysicalDeviceMaintenance5PropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; PhysicalDeviceMeshShaderPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT; PhysicalDeviceMultiDrawPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; PhysicalDeviceMultiviewProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; @@ -3358,6 +3377,7 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance3Properties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance4Properties)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance5PropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMeshShaderPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiDrawPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiviewProperties)); @@ -3483,6 +3503,7 @@ struct phys_device_features2_chain { VkPhysicalDeviceLegacyDitheringFeaturesEXT PhysicalDeviceLegacyDitheringFeaturesEXT{}; VkPhysicalDeviceLineRasterizationFeaturesEXT PhysicalDeviceLineRasterizationFeaturesEXT{}; VkPhysicalDeviceMaintenance4Features PhysicalDeviceMaintenance4Features{}; + VkPhysicalDeviceMaintenance5FeaturesKHR PhysicalDeviceMaintenance5FeaturesKHR{}; VkPhysicalDeviceMemoryPriorityFeaturesEXT PhysicalDeviceMemoryPriorityFeaturesEXT{}; VkPhysicalDeviceMeshShaderFeaturesEXT PhysicalDeviceMeshShaderFeaturesEXT{}; VkPhysicalDeviceMultiDrawFeaturesEXT PhysicalDeviceMultiDrawFeaturesEXT{}; @@ -3606,6 +3627,7 @@ struct phys_device_features2_chain { PhysicalDeviceLegacyDitheringFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; PhysicalDeviceLineRasterizationFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; PhysicalDeviceMaintenance4Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; + PhysicalDeviceMaintenance5FeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; PhysicalDeviceMemoryPriorityFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; PhysicalDeviceMeshShaderFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; PhysicalDeviceMultiDrawFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; @@ -3728,6 +3750,7 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceLegacyDitheringFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance4Features)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceMaintenance5FeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMemoryPriorityFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMeshShaderFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiDrawFeaturesEXT)); @@ -4078,6 +4101,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceMaintenance4Properties(p, gpu.api_version.minor >= 3 ?"VkPhysicalDeviceMaintenance4Properties":"VkPhysicalDeviceMaintenance4PropertiesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))) { + VkPhysicalDeviceMaintenance5PropertiesKHR* props = (VkPhysicalDeviceMaintenance5PropertiesKHR*)structure; + DumpVkPhysicalDeviceMaintenance5PropertiesKHR(p, "VkPhysicalDeviceMaintenance5PropertiesKHR", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MESH_SHADER_EXTENSION_NAME))) { VkPhysicalDeviceMeshShaderPropertiesEXT* props = (VkPhysicalDeviceMeshShaderPropertiesEXT*)structure; @@ -4578,6 +4607,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceMaintenance4Features(p, gpu.api_version.minor >= 3 ?"VkPhysicalDeviceMaintenance4Features":"VkPhysicalDeviceMaintenance4FeaturesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_5_EXTENSION_NAME))) { + VkPhysicalDeviceMaintenance5FeaturesKHR* props = (VkPhysicalDeviceMaintenance5FeaturesKHR*)structure; + DumpVkPhysicalDeviceMaintenance5FeaturesKHR(p, "VkPhysicalDeviceMaintenance5FeaturesKHR", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME))) { VkPhysicalDeviceMemoryPriorityFeaturesEXT* props = (VkPhysicalDeviceMemoryPriorityFeaturesEXT*)structure; From b8f2f1406ef3e7b9a2e01edaaaf62d82eef1eb00 Mon Sep 17 00:00:00 2001 From: Water Chika Date: Wed, 26 Jul 2023 11:13:32 +0000 Subject: [PATCH 05/56] pMessageIdName maybe NULL. --- cube/cube.c | 2 +- cube/cube.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cube/cube.c b/cube/cube.c index 75d573b4..c3e3613f 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -521,7 +521,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debug_messenger_callback(VkDebugUtilsMessageSever } sprintf(message, "%s - Message Id Number: %d | Message Id Name: %s\n\t%s\n", prefix, pCallbackData->messageIdNumber, - pCallbackData->pMessageIdName, pCallbackData->pMessage); + pCallbackData->pMessageIdName == NULL ? "" : pCallbackData->pMessageIdName, pCallbackData->pMessage); if (pCallbackData->objectCount > 0) { char tmp_message[500]; sprintf(tmp_message, "\n\tObjects - %d\n", pCallbackData->objectCount); diff --git a/cube/cube.cpp b/cube/cube.cpp index 1e7d48cf..f7ddaf75 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -1051,7 +1051,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL Demo::debug_messenger_callback(VkDebugUtilsMessag } message << " - Message Id Number: " << std::to_string(pCallbackData->messageIdNumber); - message << " | Message Id Name: " << pCallbackData->pMessageIdName << "\n\t" << pCallbackData->pMessage << "\n"; + message << " | Message Id Name: " << (pCallbackData->pMessageIdName == nullptr ? "" : pCallbackData->pMessageIdName) << "\n\t" + << pCallbackData->pMessage << "\n"; if (pCallbackData->objectCount > 0) { message << "\n\tObjects - " << pCallbackData->objectCount << "\n"; From 1d8188a974ccd08caffb5bd7fec58751e0c7d786 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 4 Aug 2023 16:57:24 -0700 Subject: [PATCH 06/56] build: Update to header 1.3.261 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- scripts/known_good.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 709013b4..22a12fc0 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.260 +v1.3.261 diff --git a/scripts/known_good.json b/scripts/known_good.json index da94482b..d9e26910 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.260" + "commit": "v1.3.261" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.260", + "commit": "v1.3.261", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", From 300d9bf6b3cf7b237ee5e2c1d0ae10b9236f82d3 Mon Sep 17 00:00:00 2001 From: Tony Barbour Date: Wed, 2 Aug 2023 13:11:28 -0600 Subject: [PATCH 07/56] icd: Add support for VK_EXT_host_image_copy --- icd/generated/function_definitions.h | 33 ++++++++++++++++++++++++++++ scripts/mock_icd_generator.py | 33 ++++++++++++++++++++++++++++ tests/icd/mock_icd_tests.cpp | 3 ++- 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 9f9155ba..bd4b8476 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -2898,6 +2898,11 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2KHR( feat_bools = (VkBool32*)&blendop_features->advancedBlendCoherentOperations; SetBoolArrayTrue(feat_bools, num_bools); } + const auto *host_image_copy_features = lvl_find_in_chain(pFeatures->pNext); + if (host_image_copy_features) { + feat_bools = (VkBool32*)&host_image_copy_features->hostImageCopy; + SetBoolArrayTrue(feat_bools, 1); + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( @@ -2993,6 +2998,33 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( fragment_density_map2_props->maxSubsampledArrayLayers = 2; fragment_density_map2_props->maxDescriptorSetSubsampledSamplers = 1; } + + const uint32_t num_copy_layouts = 5; + const VkImageLayout HostCopyLayouts[]{ + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_GENERAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, + }; + + auto *host_image_copy_props = lvl_find_mod_in_chain< VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext); + if (host_image_copy_props){ + if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copyDstLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopyDstLayouts[i] = HostCopyLayouts[i]; + } + } + if (host_image_copy_props->pCopySrcLayouts == nullptr) host_image_copy_props->copySrcLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copySrcLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopySrcLayouts[i] = HostCopyLayouts[i]; + } + } + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( @@ -3006,6 +3038,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures; props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures; props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures; + props_3->optimalTilingFeatures |= VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; } } diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 687ee594..636205c6 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -387,6 +387,11 @@ feat_bools = (VkBool32*)&blendop_features->advancedBlendCoherentOperations; SetBoolArrayTrue(feat_bools, num_bools); } + const auto *host_image_copy_features = lvl_find_in_chain(pFeatures->pNext); + if (host_image_copy_features) { + feat_bools = (VkBool32*)&host_image_copy_features->hostImageCopy; + SetBoolArrayTrue(feat_bools, 1); + } ''', 'vkGetPhysicalDeviceFormatProperties': ''' if (VK_FORMAT_UNDEFINED == format) { @@ -417,6 +422,7 @@ props_3->linearTilingFeatures = pFormatProperties->formatProperties.linearTilingFeatures; props_3->optimalTilingFeatures = pFormatProperties->formatProperties.optimalTilingFeatures; props_3->bufferFeatures = pFormatProperties->formatProperties.bufferFeatures; + props_3->optimalTilingFeatures |= VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; } ''', 'vkGetPhysicalDeviceImageFormatProperties': ''' @@ -575,6 +581,33 @@ fragment_density_map2_props->maxSubsampledArrayLayers = 2; fragment_density_map2_props->maxDescriptorSetSubsampledSamplers = 1; } + + const uint32_t num_copy_layouts = 5; + const VkImageLayout HostCopyLayouts[]{ + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_GENERAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, + }; + + auto *host_image_copy_props = lvl_find_mod_in_chain< VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext); + if (host_image_copy_props){ + if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copyDstLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopyDstLayouts[i] = HostCopyLayouts[i]; + } + } + if (host_image_copy_props->pCopySrcLayouts == nullptr) host_image_copy_props->copySrcLayoutCount = num_copy_layouts; + else { + uint32_t num_layouts = (std::min)(host_image_copy_props->copySrcLayoutCount, num_copy_layouts); + for (uint32_t i = 0; i < num_layouts; i++) { + host_image_copy_props->pCopySrcLayouts[i] = HostCopyLayouts[i]; + } + } + } ''', 'vkGetPhysicalDeviceExternalSemaphoreProperties':''' // Hard code support for all handle types and features diff --git a/tests/icd/mock_icd_tests.cpp b/tests/icd/mock_icd_tests.cpp index 4605658c..ee1cbcb5 100644 --- a/tests/icd/mock_icd_tests.cpp +++ b/tests/icd/mock_icd_tests.cpp @@ -441,6 +441,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceFormatProperties2) { VkFormatProperties3 format_properties3{}; format_properties3.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3; VkFormatProperties2 format_properties2{}; + format_properties2.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2; format_properties2.pNext = static_cast(&format_properties3); vkGetPhysicalDeviceFormatProperties2(physical_device, VK_FORMAT_R8G8B8A8_SRGB, &format_properties2); ASSERT_EQ(format_properties2.formatProperties.bufferFeatures, 0x00FFFDFF); @@ -448,7 +449,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceFormatProperties2) { ASSERT_EQ(format_properties2.formatProperties.optimalTilingFeatures, 0x00FFFDFF); ASSERT_EQ(format_properties3.bufferFeatures, 0x00FFFDFF); ASSERT_EQ(format_properties3.linearTilingFeatures, 0x00FFFDFF); - ASSERT_EQ(format_properties3.optimalTilingFeatures, 0x00FFFDFF); + ASSERT_EQ(format_properties3.optimalTilingFeatures, 0x400000FFFDFF); } TEST_F(MockICD, vkGetPhysicalDeviceImageFormatProperties) { From a7da7027ca9fd0901639f02619c226da9c6036f1 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Sun, 20 Aug 2023 11:36:31 -0600 Subject: [PATCH 08/56] vulkaninfo: Make -j= work The help text indicates that -j= should work, but was never implemented when the code was refactored. --- vulkaninfo/vulkaninfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 37c9a684..0696cff8 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -913,11 +913,15 @@ util::vulkaninfo_optional parse_arguments(int argc, char **argv, #endif ++i; } - } else if (strncmp("--json", argv[i], 6) == 0 || strcmp(argv[i], "-j") == 0) { + } else if (strncmp("--json", argv[i], 6) == 0 || strncmp(argv[i], "-j", 2) == 0) { if (strlen(argv[i]) > 7 && strncmp("--json=", argv[i], 7) == 0) { results.selected_gpu = static_cast(strtol(argv[i] + 7, nullptr, 10)); results.has_selected_gpu = true; } + if (strlen(argv[i]) > 3 && strncmp("-j=", argv[i], 3) == 0) { + results.selected_gpu = static_cast(strtol(argv[i] + 3, nullptr, 10)); + results.has_selected_gpu = true; + } results.output_category = OutputCategory::profile_json; results.default_filename = "vulkaninfo.json"; results.print_to_file = true; From c3b438e7901e7ee0d56d3ac39d7431091d82df3d Mon Sep 17 00:00:00 2001 From: "Richard S. Wright Jr" Date: Mon, 21 Aug 2023 15:03:33 -0400 Subject: [PATCH 09/56] Update known_good.json Minor change just to update to the latest good tag of MoltenVK --- scripts/known_good.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/known_good.json b/scripts/known_good.json index d9e26910..adbb34c1 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -15,7 +15,7 @@ "sub_dir": "MoltenVK", "build_dir": "MoltenVK", "install_dir": "MoltenVK", - "commit": "v1.2.4", + "commit": "v1.2.5", "custom_build": [ "./fetchDependencies --macos --no-parallel-build", "xcodebuild -project MoltenVKPackaging.xcodeproj GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS MVK_CONFIG_LOG_LEVEL=1' -scheme \"MoltenVK Package (macOS only)\" build" From 944f91b48811d072654d3a0db4f6d704c04fadbd Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Sat, 19 Aug 2023 14:08:34 -0600 Subject: [PATCH 10/56] build: Use Vulkan-Loader on windows Previously, the vulkan-1.lib file was checked into the tree, so that it wasn't a required build step for windows builds. This means that to use functions in new versions of vulkan, the vulkan-1.lib file would have to be updated, which is annoying. This commit makes the necessary changes to allow linking to the vulkan-1.lib built by Vulkan-Loader directly, as well as adding Vulkan-Loader as a dependency for windows builds. It was previously only built for linux & macOS. With the use of the Vulkan-Loader, the FindVulkan.cmake file could be removed, as well as the checked in vulkan-1.lib files, one each for x86 and x64. --- CMakeLists.txt | 37 ++++------------ cmake/FindVulkan.cmake | 80 ---------------------------------- external/x64/lib/vulkan-1.lib | Bin 48602 -> 0 bytes external/x86/lib/vulkan-1.lib | Bin 52334 -> 0 bytes scripts/known_good.json | 4 -- tests/CMakeLists.txt | 15 +++++++ 6 files changed, 23 insertions(+), 113 deletions(-) delete mode 100644 cmake/FindVulkan.cmake delete mode 100644 external/x64/lib/vulkan-1.lib delete mode 100644 external/x86/lib/vulkan-1.lib diff --git a/CMakeLists.txt b/CMakeLists.txt index 6525f513..57d05a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,29 +53,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # "Helper" targets that don't have interesting source code should set their FOLDER property to this set(TOOLS_HELPER_FOLDER "Helper Targets") -# ~~~ -# Find Vulkan Headers and Loader -# Search order: -# User-supplied CMAKE_PREFIX_PATH containing paths to the header and/or loader install dirs -# CMake options VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR -# Env vars VULKAN_HEADERS_INSTALL_DIR and/or VULKAN_LOADER_INSTALL_DIR -# If on MacOS -# CMake option MOTLENVK_REPO_ROOT -# Env vars MOLTENVK_REPO_ROOT -# Fallback to FindVulkan operation using SDK install or system installed components. -# ~~~ -set(VULKAN_HEADERS_INSTALL_DIR "HEADERS-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Headers install directory") -set(VULKAN_LOADER_INSTALL_DIR "LOADER-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Loader install directory") -if(WIN32 AND "${VULKAN_LOADER_INSTALL_DIR}" STREQUAL "LOADER-NOTFOUND") - if(CMAKE_CL_64) - set(VULKAN_LOADER_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/x64") - else() - set(VULKAN_LOADER_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/x86") - endif() -endif() -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};${VULKAN_HEADERS_INSTALL_DIR};${VULKAN_LOADER_INSTALL_DIR}; - $ENV{VULKAN_HEADERS_INSTALL_DIR};$ENV{VULKAN_LOADER_INSTALL_DIR}) - if(APPLE) set(MOLTENVK_REPO_ROOT "MOLTENVK-NOTFOUND" CACHE PATH "Absolute path to a MoltenVK repo directory") if(NOT MOLTENVK_REPO_ROOT AND NOT DEFINED ENV{MOLTENVK_REPO_ROOT}) @@ -87,13 +64,15 @@ if(APPLE) endif() message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") endif() -message(STATUS "Using find_package to locate Vulkan") -find_package(Vulkan) + find_package(VulkanHeaders REQUIRED CONFIG) -get_filename_component(Vulkan_LIBRARY_DIR ${Vulkan_LIBRARY} DIRECTORY) -message(STATUS "Vulkan FOUND = ${Vulkan_FOUND}") -message(STATUS "Vulkan Lib Dir = ${Vulkan_LIBRARY_DIR}") -message(STATUS "Vulkan Lib = ${Vulkan_LIBRARY}") + +# Find and create the Vulkan::Vulkan library +find_library(Vulkan_LIBRARY NAMES vulkan vulkan-1) +add_library(Vulkan::Vulkan UNKNOWN IMPORTED) +set_target_properties(Vulkan::Vulkan PROPERTIES + IMPORTED_LOCATION ${Vulkan_LIBRARY}) +target_link_libraries(Vulkan::Vulkan INTERFACE Vulkan::Headers) include(GNUInstallDirs) diff --git a/cmake/FindVulkan.cmake b/cmake/FindVulkan.cmake deleted file mode 100644 index 846708e1..00000000 --- a/cmake/FindVulkan.cmake +++ /dev/null @@ -1,80 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindVulkan -# ---------- -# -# Try to find Vulkan -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if -# Vulkan has been found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables:: -# -# Vulkan_FOUND - True if Vulkan was found -# Vulkan_INCLUDE_DIRS - include directories for Vulkan -# Vulkan_LIBRARIES - link against this library to use Vulkan -# -# The module will also define two cache variables:: -# -# Vulkan_INCLUDE_DIR - the Vulkan include directory -# Vulkan_LIBRARY - the path to the Vulkan library -# - -if(WIN32) - find_path(Vulkan_INCLUDE_DIR - NAMES vulkan/vulkan.h - HINTS - "$ENV{VULKAN_SDK}/Include" - ) - - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - find_library(Vulkan_LIBRARY - NAMES vulkan-1 - HINTS - "$ENV{VULKAN_SDK}/Lib" - "$ENV{VULKAN_SDK}/Bin" - ) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - find_library(Vulkan_LIBRARY - NAMES vulkan-1 - HINTS - "$ENV{VULKAN_SDK}/Lib32" - "$ENV{VULKAN_SDK}/Bin32" - NO_SYSTEM_ENVIRONMENT_PATH - ) - endif() -else() - find_path(Vulkan_INCLUDE_DIR - NAMES vulkan/vulkan.h - HINTS - "$ENV{VULKAN_SDK}/include") - find_library(Vulkan_LIBRARY - NAMES vulkan - HINTS - "$ENV{VULKAN_SDK}/lib") -endif() - -set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) -set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vulkan - DEFAULT_MSG - Vulkan_LIBRARY Vulkan_INCLUDE_DIR) - -mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) - -if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) - add_library(Vulkan::Vulkan UNKNOWN IMPORTED) - set_target_properties(Vulkan::Vulkan PROPERTIES - IMPORTED_LOCATION "${Vulkan_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") -endif() diff --git a/external/x64/lib/vulkan-1.lib b/external/x64/lib/vulkan-1.lib deleted file mode 100644 index 3e23a7bcf37126b6cbcb040496c6066e039e3057..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48602 zcmeHQd6*PMvJVuGWf6Iv>pkA6fQlR*JmnVT5NAeocU_^GX_%It>9OaKLje&%5fSl1 zKtxcHLqt>*L}fkkLLRcHclYkT&4|2)1gn5oFf_+>^$ z9u=8cb9CoKwyfgZW~Uap|Jt1HKHI0$%rB?6Yu8@?KBO5ylj{M7oD4AZQh>7Q02ANU zbju6?qM2`KTC^U3Xz}x!mb?r=wCr+Cj|>7JTDnQo1G4~#=1$Nw{v!aQslRBtb0YxJ z9ft10yhL}FYMT2G%!l+;TSKVpDWuzxM>K4$rdjgTGJeW=Is*`mJyg?_#rTYL-A+x@ zRss+`P^4*M1-2v7EyrlO0e>gDZI-6%djSwl&uV%c>rAwAi>B))qF$u2sGn&1Zkn!N zjrowKf2wJ63#>2FjB_=OLq5^erkci~exjSEX=Y~)(oKhJS~VK=A|*Fzx_b?_Khkj2O?1alO{?}sIiwLM zYZ~({0MTfyJJG0Rnyx~gqO0*I(#Rp2Mo&dKq%nx4256WKp2D9~ceA<4>gO0}LTvHB#jkO;uQSqI3&QRlV^UDbq^R)t3Vh)mCXrZ$mkxN-QT) zdbFminq&EqMq&Ag>RW5NdOhYxs>605N}+v-YS4d(>St-XrZf5`6HOAU!=t)4kXRM3b-9G-E0DE2KHQX}Sjh6ivjRNDsfOsr)MdqVYpCO&yE<4{6Ov zO$(1h`yoBpLesri9-?`#X}W(dj(bQ;`w+fO zVpzEz$(q`1W)u?)a;#*}s=CT#7L^XH7*&%hOQd@w>r-XP8q^(`Wb>Y%taWqs!qU}c zRp#il=-ioXWukUqHdCF<)}|t~1Z5(%^{Gq@PxcCm*N+GlOcspPo4b50HB!Sxb;-J9 zuS8`kJ&K77C6fgs_4ZFzX0i>a49PHU)?2VpWnIh5v*-e7tPq#w(7xiz2Y6Omd#+CO z{MI~L8RMg#ko#<p8MESyhwDR5{knODv>QV>h5NS}3H?ma$)AR5F{pd_j?r zE)5$LWBpVXuzIj9wSaOf-ME}#-O$QZEei1`N8*x1sL+& za;>L0Q8iqRLQyF;XP>J2L^@SYb&#^>Otw0_*3sDAGnHun%48L_L3EnU-7QsB-mPxf zuw>RVL5Rg=)tKjqa*mZmT&}b@d1YNHo1{X~^pGo+X<&-O3ZfE&`Ae!3*&5UO5n3We zm@ap=(m7NS@|h=ciCYZS6Ug#f*!B&^v66Z`?3LuxxPGz{X7sZn&ZCtnPSzxAl?1g2 zf3gzTN-Dji7N=&@Y@A``sGp)0JYDXymC~gyNn&5B$YlKmh|jT-rnr6r^?$V}@mW?@ zYwcODy`4W<36s@|IFD8aYpT+DO*zBLl^8iRnD?tqQx>!+?7^n%vSBOZJe$d+QALnr zB~1~zXozKHvE-f{g4U&N{|a$!4vnfir&kE`Xk`qXC*(d`DXwWyDtT2vn_^j6M}rX# z^Q^Sith$${R6kh>lh=wkk5&e4qtbCg$|h?vb=k5c&VZRZGcHD?+1#uQPUTcKscwFP z=dV7?)ml=KD97vDb;hm2HNjm=8AqEg(PI2Bgc z;rod(hMzH%VDklRfk;7)m2~awIhM$_c>=n;Ofui*(ke?5mDTAat*qT=D`j-}VgZJg z)44IRESsvX&17*P^U4vOW^)^*a`qgFHh&Po847)^if!|R)S65(-{w+7a6qG(=K@@t z!!92EWV8+WOhkgsM+?eO9)W4)FRrHbUMPpiwt2MOdSw%p$)Reo=J^5VS!vWw@9;dy zb7ao6@>+XwvI<9~fr%QwpD>n{HM&`fr<(DsG!6)w+ZDqP*paL1(ur)Ub`%yrGRfxE zrK06*qN?0+6wb5Krd&M9D;Q^5dF3BG!8iwJSy}4V=YW)2RB8*5kbYz`-O?Ccp$Mjy@gJFtue~(GWW(%09wl3v2^Q34 zvpjlEODiEK8d z7m=0T&~BMbUd=h`71B5nO-%ZkN#R_>WV|OPp~~#NifUZ}9+Or>TxqHjS1-8O)zSeT zlO|{NRHIV!?n^BsrLdd>F zszh~JMIu$Dt1B?AylovfgT%Etut7ZaYOL|AFYs-yu4O6+OAe_r>4HgIn*+O7UD8xj zO9wetGUOsOE2a}{ODUq&MY#sGrV~|IF1y>;fa%S`FG!n3%4e$hLXV`n-g}E~K{sOoLEGg928M12RyXgbgD(lU*Gcn#v~2J!dqQ z)C#0DH}@r}sx#U-Bbd$^ z_WW$7u9}8(Pl1?jwS;PE_srX&iX4fN`F-~kHSpv}9l`AnQBznbQlA=Nf;-%z(g?{& z&3ey@S4yy2SSV6oj!hl0ygB6~QD{FoTa_?tW54uLlSj%nsNLIG$qzshZxBQ659Oyn zC~9@no1=b7(CtKa4)eIQn&@0%hh=4H1XZV3RG%D}w7a3Ui)nM`7O}eYdS1&qF#yJ5 zvNUqj+hn&yjd^8rI93u%$V$$4GL5%IrZNrOc!G-PWUHezo2oSHP!o|0a;&6hQPodP z8MOrr$4Z)6LC3d$TQ;-|-|(vHz0oyivejW%OHoR4r&}$m%%Q-znLDftM5a4h=p>Z( zCB2>uPPuwcW-cd-$vVx{7+in`bw-FWo$h>N^c7>^1kW#|BiFy8oYfj!Pqx$R7m;oA z=qAQCGJ6s_NKl%@9S@9@qv0D6uzE}@=TOv;gw-Sj<1b0oRZNV zYAlqeV1s(yb059Un(v$J@=%sl2bb1-UyLh^E#w`GE%mi4!2;lj}052~A zxO^GFpho~U;i=SF58&x`JT>~!cz|D~0&Kh!=?+Z43!oH#{|BbEeG27}{&73N+F^Lw zbQYd~T?x>94M2~(k^cn1-Y7S3IO?hZXf_+5)dGMc@5d9Z%K-*Fi6>SkV0mr^Scj)< zSI@_j&CdXApN!?b4d84{OJiC;=3qe@?pz;EPoN7hwI`V*R#b-S)%0JrHLumgNmB%br-zDX8mklpT$-o051k z7wg{^>pc{0wm0%l9s%&}7{niq{A&_RFeEF5A zA8C0OZGm(^HReOwQi=Mju)Jx2-uSas25p0S2%g68}{-apG6?oDbsq{uXfsFjI zSl=O7$7iwq7B56y4`Tb>hwV8JF|I|z-=D>wThR6|W1bnPXY*Z{j{eqrG4hw8{gxme z`r4p}u};eYPJ0N;x(M3>f3~au_&d`0Ip}j}pYd4d`RF&3W@CAu#yZ@Kw!^ksIs@Ae zW$4)SM5K37*H`6OHuTxC*nT6|033(qYk}q4h$endIyAu>GO!yw4R^q0 za1k5=mqQUOg`?qNxDIZF5s-!iR6;#m17qN7sD-Pb4o1Rc$ii}{fhx$rl~4^6;U<_0 zqhSh6fE!>uTn}Sm7$jjhJObmO9Lk^qu7DH_g;8)VOoEPZCj1t9!2sw7YhYiPjfHOu zCqgOogtOs4p(%8Q-f#vCf(zgYXbtDVT$lm(LMJ#2eg_vqe|QF3!l}>-E{1d9T-XE7 zhi=dZ+QTK#7gj0+z0bvPdEbp0L5@990M!hNmvF?!74Zk zTEKzuIQ$W2!SgT&?uOIgWH=Tch2!7_=nVV7T9^sX!CkNjmcU}z3l_lM@BsV@UWDeb z5LQDoxF3EE55n>A5ZnUO;Z~Ri^PoF)fJ@PD})I>&e>7 zm19FY_%i3`3BCDQ5Xz#aZoW7r zz$}q_pz@X-?Q%tII|aAJSOHX0?p-c_=aJ|0xORsykf?0Vt3dc3HW+dMu z7UGErL^JuL4qA8zTv)lIcC+PO*r>fsbu-IsetXIp(>ZObUxj%L#?68$?wLn7*&oH6 zGj_ojY%;z+D;t$P@Qxl7qgM8vLRE&nE%G_WK(p-$7WsG827E+mRk6YVQuGg709uNl`mDCLR-TeuwK=-lRzGZ<6qbi6S`;9!d>+ct|9|#XUL4#|_tYQNwh7 z)H2y&PHQZasi7 zLSnWh^U`UB^VVuNEJLtvB+TqeHX!BC_zhig%W>W{$02D-3asccKpM3{;WbVU8UGCc zh0s-k=ihCZ-&R~n`Cx1kj5 zvvvMd?BOf6YZE;M3&CElQxXbRkj>@X4l3ds))k8T=1?ad(O@do@N2GdF}50j!)!Iq zYTNQqGWVtk5yx;!CMqr+QWhmBs0>|PVpX!;Uut-_Lz{J%GPA$`8f=Vw@&p=2&f@NC zuo5>Qo>Te1zO@~-my8|3Es%wXwYlx>4@cJ1N;u8yA_un}xXa|0%%M~{W&WB)@f_-P zukqa}y39ez97=O;EQT5^A8=nL2do+jgJ({nD7@@JbaQqq zGyiBeQHQi5{kY+&%5_yE&kkNis?O*56}3LU)2J>SGL6_Ma&QSV>cwgB1`^BctqWBn zId;hF20q^1*Iw?mXRcd~%6}+ksN2}fqxhx^@K#fN^Hl{~XvGVySyg~XUbXTh=fy}R z_{*Vin)^nh#MPMUuK@8?$`y(_6C!;(A>Vy;LC!A$SpuEdlnZa{1&+F!z2+dBtn6R! za|}nv^6a%Q-#S=Ro?seXyrUI9nS>gH@ojs6N%@_x4Sj=gNXUk#vE8$DdCoqw_b$!E ztfArxA!<+9b}FM2v%6twE$Ch;3EhBDLct)k&kTp3b($Aq*5KjWC!UzHhA*Way)d&U zrHn%kj85v`2C!jdo!vf#Ph0h|;bf)Hy@!Np6e~6={Frh$kIV4_#!9CfD%PyPDSpLd z;bHa61H+188_kA6$yK!P8>wFwk6@oy&Tal{0iln4vf>Swxw=UhWk(KbH| zdsOil%%xan08v9IwN|E{J-x}2d_o6Bn} zRVOv1lBeh=7PGRva7fjrc)eETRZot+>?@3?-ukut)q;RE96weF?qH}`Hu_|X6cHTt zlD&A7$Kin{#tel*y)+&Kwaj4n)4P)6ITf}$UD?*p#!80gx|L!2eq!7w#OMAKN(?!W zCt*CuJX>clkJcOPqvH;SX+J8p`2h&&Q$MQGSjYo%Z3AkhidaV z8=e(IfI&?WZ&XZ7*M|Ck_=8^fX3IXcr`-j60fzdR0>!X(^k)P1R;(umd`V)vbAEC# zH596A_z)!m#B7*NHiu;sZsGaZMU2vj+#(#PL<#GIJbG+ zE|Mc4r*z~a?U_{;c7t#^w0eRO3T;$OcQ4;Fw6$DtE329;KT&Ud%`I+&XcDSTGmYaG zDHH$`Oc9h36)C?6N=n5M1x1zGhjUjvC?hHo!)8K7b3^&5B8VDFLP0VCMHCcO=7@1g zmdzn9tCxdeLXpE^uxKG;Y}zI9?}xfh7Y=<1>T(6Ww0J1orPyd*H_)ZHa)?VM3Bj%U z5jn$J_)#t|pe28x%Y3+#1+ff=g|FNXfCfMH>3(g;TL!B)RCmFvSpM{Hmb;2;SEuSh zjXJb4z=f|(2nM3+NAM67K7~KU)bKSA!f*pl(O+M-pJi@ao=(#ZfrkDM@KG=D2# zNVD=uyTeIsTfN=_PeSjFhp6da+j9K=)9~X;^b?-Q#$WItweznFwCvWFzA2hGuANOd z0DoDJ^xuZDJO1nfr>!+|9Ss{#8{;`v#dEm~~s&rIF*;~qWlJ`IJmNP7qyakWs zJO9XA{ykohPs<*GWr_Uwc{A=Q`Sh}OXS%)Yo3#~ReS`?Qon^b_=w%(Op{SQqFXR8Z zKo{G~+FL%!ZMF~QC&@Lwee<#HkywJp^T`e!%>Y(Jf8&IDYWbwr+g|@269sF*3D180!BL2~w}+_SU8E+Ak0)4k!To!DOcwo>gcqnF zuWddSZGTqSqUT+-=O&srnkhWHW2V;6g<4ba&^0erDG&X%gT{l9yaD6ZuS2JB{T}SQ zDDEi$WL2vL_cE8 z%^JUk!ff@~!Owg`v(>&FFR&}hLF3l3y)cFsFX;Tk;fUGN!}PaY3&E0R#>sCUw3TMY z|FBr${ag+i-=>1s9QN}uZxW9uaY(;b6*maf0 zomD5c*+%2e0Uk2j=q?CNT3b!}V*XF$tp|qD?9DB1PN#e3HL?oc`aDe8PTqPD$5fMt zquzPQ2TQ8oi@RU= zRyz(u+(Rs`J+0ta5@KU{uZev2f3xp9G^!pN#L_1t3aXnl>fF8eJulIyb6611KQU1d zW_w{x^+H*zcMe9(!#zwqx>2Yt?H_Yww!E<9z1L|id<4f)b0VD?;nm^~d3mSM`~Ljk zOKWMpf24pW8#6YlFrM!B(8`sbf%Hay0|3myaFRgBwu(wtO!Ugz~RCmm}M`57Y) z7Q5}Fcf)ta{Phj$564+F=L8dni(9u2f;C^BTl584^LUG9*M{ElsDcm$e|hG$mY)?N z;t3w2d-kdjJgN0sUHSelYP}OJ9*=%=u=uSfjGDcRNBux=qOBY>Z~AiwwD^d^*wXc_ zE`Ou3sG4cDGZaHr{i$( zZ7Q_lm(M@cV^`AwE*v3Kh&jND5xE7UWh$nu3>!&nBv}Jf^ zmZD6$4|fO zYZ}`+d1!$ny9FUi@tJ9F&3cvIc+b>`>TIdqwB}&3dxbELK63dUuNNWKSs^TajItm+ z!J1oFJp5O(=GhF-*@EYQvAsp=_nXf<@1N8I&v6k02cc>b5e$F;T8 zUkqvDz8Iq3RqaUobzgeW`V-uI|oyKpT3uw!VeFK+!h3hx|?UhVl=YsBmt##Cn{ z%@Lr2v88p-W#@hO1Fd_yG3>@z_efZ)mM&dOSlt4A zY5mxr;dz%exG`h5pfq|{bv*4O8odXE(Ly&tICx{U+C zbJ4kfq3GB^j^|uz;*fD`D6M&xeck^pTJv1wB8G2Fao|R&>jV9JzeaT}=E%+^91a<` zuF@X-sr}CQnD*dH7-HzM7YB`9PpP+jRsX|(QEw?#sJNc=uZ|TOofF;a9bBM6II^o{Eex`OD#1SK3NgAUa2YxhhGk2w_`_Pls&X>@`IBR z^->u%;`JbIeLD)fE3=P3WYejL{9740*Xu#-noAzMW9HX?BM<(aiywYLh>s@hm^GQ) zM(tPso}&p%=D3!X-h6J^eEM4yDY%Sd2}|aKCcVhdC zex%x6&Jl&BYg{a8SMH$!qdqD^tid6y@URmbPgrBU+H~G#S}6~4@WiESY_F7d;Lm^M z(G7%`;COcNTIe_~tXmg;xcv=Uw+@x?gvD}fn+oI1!r3RjLgQ+ggefhS<6Bl3S8x6F zf?Y+3TFy};mdmkgDa?>d7CowF$Rx*$S}w=0q41V<;60`5=`Cv*M-&&#aqHJnI7@x= z!~uV6gJ{DAw44j(_;nRpv)SV--=x;8aM0x?bKKfW@07niBA3kZ>nM28 z;#uE*NNcPs987knyr4CtRLe0Jobw9Ra)g5zxmb>0OTlZuTs-Cz^4he)r0JeE3e<-; zdDA(gUtZ^A1ixwXo2>GiN`)4_Y|l-~!SliEB-CygwE2cETvZu7=i8s+4g5k%AjN!- zO@H_%#e6eT2|}0q3qkKB*c(b0zE4+Ns$Fz@Bf9Y|AguJB{&?W_)36Lz%4KL&8%R5; zM~|Pifp$`}GQRiqghFgDjnIF&_USKZgsyRM-FvC_(+nIucE6TtJ>tMYs@Ao+&Tq76u+%gxRGC#D5$>Dy8GQJ2YyWJ?s|=jU!pKCr+Q1U(3%Qw#Alq6+D3?1 zd5HeYY2o*K+6$}2cXuEAX7}VS8Y!># z(P=u?f3qI_(CYh!tfet@VovN3bo_b?@A$3z^w>bL#Onjt5g!ZU%^V+Jn5nkT ztJp%T-boGNhpHdf%Q^{BqvVsLU#E-nlO=TdJ4XdsKss-I_9thmySO*lGN{<5{b&-0 zi(6v}?aiN?{x|jF8!eiOZZ-y*6eC}?vdIRDkx#K`?2>Bq;vjB4r9QQ2#Xjq(PuVcYE9=z{@B6{&h<|fl_yt=)=vSrdAKFUu;xxAe z;jeD-s>dErq{v9?eOm3J$jB`ovWWpV(#+UNu=kB`|FrQO#GGz1-8Z*fUkod#{+$Hh zJLrx_Kca7)+#07Wg^#VmThI4XuiiwTZkdt0B;Gg73jdNsC*l3%$z|U>PoMa>EzeSf zOcC2FI|;LFub%(2{wyrT?Q$vXx7YN$lfT?>msRmgBFwkbAOGFfGqEIh#~3T@LXRbG*~UEsL~@-{Y}kchG2cms}S6jk*F`Lz*8SI%=Pf zXnvfT8#ypU$F8$5X1)2#g@2bJYsHsB?uTHZm*DLi)P0i{u9j>_sS)ZztzYcB7RE`hMaNdu-9mYyk9Oyjt^?O6IEQBoGGm5XT5awpZ*ie z@<8me6lxi1#H@Jvbk#x+MwBMv)1ll^Vz-dAXZZHEZ$6~)YGKZD=ov(RZj=`xZo5d9 zc;(fzza(FMC}#;mUp?i;XcSA#Tk)%HWQj#N%V7d4p(S=)OGv%tiu5~wqTaGtEAiQU#q>_h;B|BT_f$A!>{gd{ z4p07c%1^Xk`mn{+r)GkGtBIS`8JhBn4GV8mKX)GWC7nxJW^tvjBRRIp-+5v&7WSRo$ZwhO?}wH*-Ur3 zyYrAwPms=)9(`@iCq;<(WC$^Q%$r*`FFc{=J@?Brb<*l7AJ5R>v^n&oEl}&a^ llg+fUc`gb+;5c!6pfsZGbI-ERX+&GAFx_vrbN$fle*t3e*u4M% diff --git a/external/x86/lib/vulkan-1.lib b/external/x86/lib/vulkan-1.lib deleted file mode 100644 index 3caa7ba045a0aef089104feb0843cb55bd78bf58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52334 zcmeHwdED32w*QI{r<1N@I2?yKhRkVrijzEzL`Y@4sBh2nrRVfazR%ELD1;D_5R%M^ zk|~)(r5rluOF6hsC!wq3T<2!YZ>>FiK5OsK`h32h&-3l~y8ql>ujT8r_uA{d_PqAm z!?Rb3*7?ITe8Dxog2LUH~9^xPzu^F9aaEt&OI8I{^^g z(^1pCi|`xip81;QAs^AQshVB|0HV852cklwra5~65G`4v={4jhx__ajC8#gaLw9Rx zcpHGI@fl4Iwgn)1v|7_+^#DXK?xtz!TmYi$hiSTP9qNy?qFmF0@c=}B{z=nxEK8!< zqcmN&27u_cv6>cOo`_Z~(6k(NA)1EiiDq4`>1C8bbaf|9w;T#UboFdax8N_))P89f}&Hf1WLYjtoCc0yWrkBq_Jfx+aHBCJdnQq6HzYG1DFq@0)`Xa{e-4hQ5Mk{ z)QxEJNKIE@8b$5!7im(trpuNC5KY4LL|6P%)0OK06xHG{QZwqHXe$09jTx`$BCK~s zYw#E8;x`SQioZw~?yl(~z<8u_D>aQ@1VA(f@rcHwK13IE)HL~B)EjByEKOrq0T7KF ztZ6Lfi|Ddpnl48^qD!kaU3Dw~(IuB^YC05vXhJ_tmwt?VNLM|h>4Mpai*(6%nws$c zi7sicX#$oF(L~gb=q|)1dI>RzUYx6GaT$Q3=kOQl=3biadJXxJUNLlj8>~m9WqW9P zaw-7P6Js?!G7*4i-Vd6tU611n()>-DuB*g;hji0oO*f-%L@#0a65ZF+&?5XrdTNQL z=NfT5Lt6BLrsoSdt|2}1siqeu0}w6TP193dF&)yvIhq>I!tn*Eae$_|?Er`_KTy+! z*awIfpsqx7@c)Tk+g;Pc({a2+nvQLQ=+3p89z-6ZxzjW~g!n|yeyOP*%Z6wQmIu+T zlQjJquwNlPiEW+e@pYQ!jmL6Bns4Y)ltc9NYed6`4?JP;NkfJW@7I55-ys7B4?Ahd z@aCrK(Ye|~4u|2xPdsJNpeP4Suq>Kk*s-Uac>M5wy@&P2Bvm!_!-qGI?pw&`8uJ5d z8ya)975VbRJA)i(`TOM?8Vhyff&@K?UkJ4P{cD?Q@&$w#JZfA+RYk74U%t7jBHv(; z5~Hn*WAcq|>H(;8Qvro2^u*|R8Fhu4T;t$EU46dLSQRJ~6(;e;N*!2}J1;-LPtsY| zGoCqCKGRp0=`zI1Ik_p{lpm0*sj42wQs~-`6hS<5to#%5HFX6pTGm!#V=`?kLlrA} zS5_8+`j#SCI^D)1siMI)jqU|HzWngAun({x%WE3DiBb8A1Xbrpov3pC5Qp=$Tvg-1%IbW1*MOA=SzfIIkD-B(1~(pNxqDYv z*Hz#!s9U_zSqQZJ0}6SU*9)+GC*uRtLYx1>?ex-}?R!X0$+R8pn z=boD{n4;3-u^7zLsPQ?H#1FM8P*)BzB!7NWRUuEx;$)}lrWgm4#6V<0NesT6q4l{! zgK15UG~F3cEhR0HjmdQ9Vx39}h|GIklr@3!vn8=us+UqNX$;nrD!!qOXrNeTA<**ENP(qhWOr5rPBhGN z>)Z{^V_zOsS3qNp<;`ZtHY%nz}gMmlGW1X*4z1jXl&N7aHsS1rv8uzXs7Y)xp9)YVlx<>rRk6eb&PWKeEyuuX$G3?fjGrfTf> zUDa$87h_Xu{q*4BD93^Y54_d9)ttn(RED9B-vC-2%OXl@A&0L8wi^bqpe1 zJ%eDIMxzWJm8-;grmnIH4G5=$`Vlsr!4eY2#n_Y@ad1_AzPhS5-#1q=%7u)^*pxlgl_FRm9?KYK=TJS5se| zFSyN+g;{Qc<+2NbmS0OphKfQ}ePdk#2WO^(?OAd0R*C_LV+*nw$6)37+C+xXpN zwXUhQ(l#Ego*(X}8j4=8imGa?Q(TIoU!Y;M^)&0EkfTKzr(xfWmEcB->4)Ue51D#03lieI)B|xO8*5soUg(*meuS6qRCG_==5`>}A6#23FN|YJ0;J~O=GDuD& zPhZtgpKGib752-1JVf9OC8?Dc!I%_I3`^O!u6~@Y7Mmw8%;VO}l%V>FISgXFeX7xq zNXrYe45V6ff*5azIIPYHv#nE(^3tj_!|F^%wBH5s0^OV_mR8UDezHg?OEI9Ty4vUW z!Weho>U^%yx30RbpmP;88!5t1r^XaBbV$kNcwb8I#ztHjX+NBvvZ!E4FF%H*#A&0h zx;byELi<^2DkGsR1x^6m5rP;_2;)>!lE>?XF>Z1PDQ5I0s96vtdtr>*&SZUZg+djY z{@MY7Nu&stPEE(keG!fsUKr!XiCFWR#Y|156T&!Ez5=&MC|d|;snjq&tf~fWM_jIi zsf2KriW++Wg#g+E!~3)t%Ong&-*-4G25mJO%+jb*;wGou;b`S~WDaPh2aG`6=C^lL57b0vrW04MRDx90E$RB^~5Hs@1;Wia5`<>lg zlYVGZJsC+PCh#<;VJs%MZ>~N!vI>V%+_nvMjMGBmE{32z*-Ch_<{o1)xq}PnO0I20 z_mI{+S-8Y)5%h{<=$Kr6#i(3WZCDI35jLHz$!Nm37@HEyH-J;)qFX#MaW-}D3bh?V zEnFogh4tVR7h_Xmr)|ocqM%f&vj~BfKhh4!0;tZh&1h9vs+*?gEh@b_SBqNO(*!9X zP?KME9I3rgPC#LeJakVWNL=4%0YWH5@il6NjEjdO1U>sMR|d_RwRY3RV&YvXr&ZN<=^Ueq6lYUMTBc$) z-5}S9CkWW+s=7qh6c#Dic(*(GxU8TP3VQoHDK;X(9o&y8)HT)Hi6@W~%VVWQ@?lT= zbkumg-ixM*MWb^rh1#51gM@jBtAs@UqA0-@X?mczBt@~*E^vAriQQt5 zyFxG0bXD3`B!}}AtPqIkZz_qikAZJ_UuZokYX(xW|ZlO4dcE?Y<-?E6=oxur@`3X}GLJ zEg%$#!^LS;jiUk;wP~7$%Syx+>DGp|Sp!3#m0$+uqVnCvK^l;l6by-3VgfKAT>ock=^mw6nZ!^3z_ z;aY$;w*hpz7og)kcpn0P=i_gid3ZNy84AV=S$*!tdk%O%Vh_CkKzFdF;{AbzD7zp2 z|J@G(yxoBJCK>_SJ_u0#DBe+c3}Ckx@eadMfMM4ItV8+bEAVd10)U_JqQd)l_hHm* zfHl|Q{S}OBgW(G>{_W)$k9Qxgo`pOwqfS=?9C{1hWy0Ut_`4AAKCHYQ^MUgB!#wuF zJRWxwz(**nEvB1s2f#U)t~25uiM&@|1F#QcaC z12A$j#$5r>4yk++-hsLdO_`U8*ynlzZb2FA7(s<+_dlBk{^ybA_KS;Y@h~LID;)1JpttoDcOd39f-D zFdnXkOJOohgv;S#I2ZD89y|gQpb{!z6#NOQU?hx#OW+D9gC1}O41g115IhIl!|iYf z918oxFz63Q!cou~dc(2M1x|(I;7K?bj)qw<4eo^Qa0HwQC&3BuJhX?ypd*|De}rDJ z6&wS7U?6mb)8Kem2!}v9TnjhCZ(%s>06W6J!EfL$xEr>H-^1B31a^bRU~hN|=EEX* z8uo;C@C57xFTri_GR%Zqp%WYkkHR0|71#%Q!mnX5%zzi+7I+XIg1K-HYy5px44vTs zI2;~_-Qfio3J3jP4g9ayz?OJ7t0i~6f*V~$4LP5IY(R3w+G#W4sEE(v*jn1vhVZ5Yx4zcOr(<#SDf*?T}3u>VvYt_SQ3pn!tH0f zi?3XyUbNkwbIQpiP2A>>-%&2I!`bo;Sf+ZoH|-Z^7{fQTy`-wH)IkaT5HGMJs@U~%#13zBx=)zaSxB=1KckVV9t zn)iKPZc>bmp4oO;!igyGo5e9;v1zA~J2s?uTv$g4`IaOZdb^R<&~`t}Q^o8@(yG|o z8FCqgCa1Jio?ihu`7Et`cHTwQ19G(TRCr9?*=-}`pmW99!6UqyAjiknM>s@8bz&OIwnNZe%(lQh-VV6e5QoN$p2le9Z%ykbIUb7CSjW@6*In~BCB z<6w<+rU-}Jn<8w2Z_k!!z^nQbn;=a@v=^9&Xg9DC-WhcdDcZ^yDxSGD<-Zd*m(CSkyjP5T|m#oG!NOE z*fu5FKkm{24?~4<=CKK#oVNZVm+e_U3-+WnJJx`6&z&wxMn7V4NU{{P;l$tH%C^hbjn+~i)Vu!MWibfM;lG&C^p(S=)2DcC#leO)L#R(zGISvow#EcW*Epn+!MY?O8NG zT+IWTUA1p5oO82a!%RCNbdeYvQ(>GrQfR~Y3K;88-7O?cFGs~dY% zbU|oz2S!IZxA|0%c&{vsiM3CqP{C$s3?>p59^HAck>LOnNf$;@`RW&o^yq0f53I*RaEylXgB^w-C|r)y z_%7VFNxJ&tRK2&8U=jR11RE~z9@tnt;P4!(kVrXO2bVd_s|&++vd~3p#o8F51j7!+ zQTbe;CM)BQXOG@k*$Mjq0gL1K3_^X6CyPkFFciIWr`3}@{lOz3%*XGAvC_r%Mz5?y zo3V)q+aqhLkvPAtMi|7#8gN;7EHj;oR>YD3sXZY(lTe+2ClKvoWrJJp_w3wy00Nd9>tB zr_fY>^a!KxG}`NGwWD{d-#N1c@wi;LPg7Sp1U!$H&SR=6$^y0K-Sx6((qj*NFD68zju zsJ8HFaAF>A7LRU}z_-nUvClQ-?Ycl^mNKG3SqX$QV(5)g%OYCxYiSaTnm#>_7M^C0 z6&35TR%)rykvXJQpc)_jKsD;=LX2rCF&tqrDTZX9w8Bs1Gqx*Mg=Q1|&{~Y(fmRW2 zpDf~gPMv~kK#w)3n+y^4Hz!CBm=gqB$FJ_BVcUyS#PX{ePR}0aR~EFlzT&w1tu~&# zHd1oYi=2WnF2|~o$ev?Cs>p4Y|B+hNogpm6xGej8F&+U19;~6DiZ#=i>~-+q{1YAyeNT0xqc{XJ?C`-h6Q<1Hmk zFYDaH{`EZF%Vy2J^{e+0LD#cfZVA1tn=LA8jnvEdKi12-+Hm4~+kTke&0D@{%5)Dz z-h6Gb%ob^f5!(S!4;|F1;=HjxYlz!=1h7nqT%u z+*Ww6O~56)95=T(5@c>eWu2qAqxYNs!GVaog~5&8I&+};N17Z<$nU)~@q0qv(nStu zR-7x9e}aQKC6ETWo4$sO84v4t*8HEp+8dEuyU5yhCZn-5#O~2jZhh_44f`VERvJ;< zQFK5v*KIce^-sqvdxKE7F{o%VaSw~~G?a*17R_t_6GyGs2T`|{QE7$afbx%2H7a2K z>C%6EN0{4&m}+^Yt2CO?%$VJx`K*~S=$k(vW*ZSRlFjTj+9itl(>Jp|pjm!9jcIp; zmBCKV3ZAd*<3l%V$g#fi=T%RAy&od}%0=XU;La{A*C9=PmRW;m~jT}HT8oIh}%BI<;Mz2!xLuKUDmh$fo9f! z3-F{f3l41N@|Ai{pT(yxqn5OTi|d|PQ2BMqLE&oKkH`i%0qOB9bEaw!d0sL?^Utz35y;{Mjbje3Z@Nj-ZH5@vyE z2d{f)PsH9ez_#aZN*@uWQTT*!>ffVLc((|iJ^kYpZ}vP2qtk=!UU-j2r{6^|an1?O z7L|tERj>`Oo_zj){SI+=4{^=OrP8n@d%OOme*a1K_U|1mHK*!xQ4S>kNYz_}-r485 zi+-fF#U2u3Sg>BB&5A6wpvv^GkVs|$twRy(~i0cqu=UF&s$6L z*&hN__aGg|XhA*&#Oc4i=|e)?CqQ(M>6M5mlyfQ&_1=*f{oXRkeB!J#sjv*auL`||t0AYa*0GOlwv+yT#A-ra?r z#{OsA_Y)m<=p~~^kDfa!@Q*a*F8QzyIpofFJD>(fyBert?WOL5N%g$VkZIpiJ(oLp z;bB#EuGCvRX3b}ru)^7G?T+tsLfqa0u5f*XLuPJg!SM#Rn{oEjAG}LeR3DDNxvVI` zYCCyC^{0f_m*WK&5uEI0ZpqSkwdEV1eM;k1KL^jf3fMaXtuitU9m#|<_%&42clx+WFB6#8?lpRyBQ}>_S^-Hpwj&(5Y z#S=Wv<`gUcNHrb_Ysd{pANDh?AqR3q>x>BQuW+OmSmeS;yv_2tFVnbmoP--*j&Xqb zN2>e^wL0aTRja60kLS3dZ=m#+B-k?_pIQA6vS$WyOy;}uK{Mx5=&AMB{p%I7O;6yM z?8XqsXhDq%BmOt{ANL)N_$La8!UJHA0{o+;HGB4_J=F@}BnO{gb>b-5^DON*9$oj& z3i9I(b}+qrR1PfvNRv~^hFbmC+K&E(UVE&6DS*fhT`Yc^=}RdpE%xSpJbJ z&%*rrm$@^)r_%{TIjV4{kz=(Wzd}#?X2d_w;;`-WxwlYp9O?f-k@bY zm(kpQih#J8<{qK{-n;%SbqeED2Q_I4#LK#+^?L4O@B`KBX%1?Ug-GU7E)z!O8(#eD z4~HW1=`qOhOOdSk?k=?F4fEbwLI-Kjh(Ry16vj0d+Xj(?KmpO5LXu z{0Iy7etje1{kwxF8|7KcSjykNQ&+Abyt5oU*(lG9C-k6MzuWsiXkA@0%LuibJ;KGbhHfw{#B+9d{TH%{ zt1T{>4D5zqi8&R<vbBBYc!(pq(o_$-Gx5;$Lcnd^y7EF-|$8c)S%wez`l$T^V9~6orM{i8jp!6F=QpxXk+@eiX@=Y2$;rW!(@-6v!7H)gvw`AEj8*F@b z+$@Z>A3$CCbzu2Nn)WWCe)Pa@8whnwh#D@8)lDt``blO~!7~ewPy2}O{EZD!H`6UG zX`d+HVeSv)H5{+e@ZA7@T`KYt3D02WF{MnHx5qWl{Ex#Be_T=g&0zBjefoo+_gqSS z`ho!8sbXz>v*&i40?0h7bQji-8)q+GLRU^NWE#+Pu3za9AMmVe%$glU*WVM!Gx4Pm@b&v^(Oo1D4QecUg!SZpDXBy4a_sIAr#A zC5(0loHhSF8to<}L3*Z*C$OYkVd<64zB-+M!PFT4dNd3;>eq){WnZm`x3SP$$=iq7aP6|=0Ng~G&z^f z1-|+1h))RdssK@WV>c6`G{3(yb*D|#;;#u1*(K#<^CEL=lXe+SUp?fXw99aHG5nIp zo9@CoeV_XEYw6jEYhCojH`;hTXK!bcg>g#t8OzDSn37J5$N_z>QJR(~?U|m_^Np1> zqh9CfAU!X~@v@hIWXX4%deSRo$zLC$M<1_qVEIRyJogZ4|MS;3zI-&IP7P4qm16SC zcwB?*rO-pLG`rSbvA!4Tb3-P5XcR8lt0C;xtXkA%6}{Cnt%x?kJAIqw9g^k%}bqXw^gTuqV(TcxKhl(tG`>&mHtZkNZtjoMNAEBD zuF;ZDB}((|z6*~3h34G{l67$(;N^wj6i-V_WYP}Xzey!BCs_;Obzeu7>@%LwTIL*Z z{3}!<4<_s4z8&nS!9UWJh_uSf-LU~>5SH1ZqorQQfzzxn3;gbXQ@8of$7UWlG1^YM8`kZXxc>%6IOC
uANKHA3_rt`+P1Ia(q)TMN@YnOWt`;KmQJ;4yeKk~>CT2PyUAL_K- z2dewbPcpo?!%G}JRsIAkeCbzhU!t>N3pJj40L3{z;G3M8XD4YFZ`tZS)!E9YqNtnY zcCXY=h9BPduhdT#G0bp3TZGM?SHV;C>(^H-r!xyrGhB17yhN)^YOg2k`t|$NUY}uT z$_Eua_>wtyU4^ms@y1)0?v8lRYCJsov6=EFj5s&UxKo|8dro5skLB|o(SrUccpcZA zbI^xWp3iGc?.h.in using binary_locations.h.in as a source file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$.h" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/binary_locations.h.in") From b441f434a036d6fe463ba944c8d7e0a9cd30faa6 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Sat, 19 Aug 2023 16:45:26 -0600 Subject: [PATCH 11/56] test: Make mock ICD tests work on windows This does not enable testing in CI on windows, due to the loader ignoring VK_DRIVER_FILES when running in admin mode. --- tests/CMakeLists.txt | 13 +++++++++++- tests/icd/mock_icd_tests.cpp | 38 ++++++++++-------------------------- tests/test_common.h | 37 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 tests/test_common.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 66d9adc6..d95b00a9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -50,19 +50,30 @@ find_package(GTest REQUIRED CONFIG QUIET) add_executable(vulkan_tools_tests) target_sources(vulkan_tools_tests PRIVATE main.cpp + test_common.h icd/mock_icd_tests.cpp ) get_target_property(TEST_SOURCES vulkan_tools_tests SOURCES) source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${TEST_SOURCES}) -target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Vulkan) add_dependencies(vulkan_tools_tests generate_binary_locations) +if (WIN32) + target_compile_definitions(vulkan_tools_tests PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -DNOMINMAX) +endif() +set_target_properties(vulkan_tools_tests PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") if (ENABLE_ADDRESS_SANITIZER) target_compile_options(vulkan_tools_tests PUBLIC -fsanitize=address) target_link_options(vulkan_tools_tests PUBLIC -fsanitize=address) endif () +if (WIN32) + # Copy the loader shared lib (if built) to the test application directory so the test app finds it. + add_custom_command(TARGET vulkan_tools_tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $) +endif() + include(GoogleTest) gtest_discover_tests(vulkan_tools_tests DISCOVERY_TIMEOUT 100) diff --git a/tests/icd/mock_icd_tests.cpp b/tests/icd/mock_icd_tests.cpp index ee1cbcb5..bcae57a9 100644 --- a/tests/icd/mock_icd_tests.cpp +++ b/tests/icd/mock_icd_tests.cpp @@ -17,25 +17,7 @@ * */ -#include - -#include -#include -#include - -#include "gtest/gtest.h" -#include "vulkan/vulkan.h" - -// Location of the built binaries in this repo -#include "binary_locations.h" - -#if defined(WIN32) -#define WIN32_LEAN_AND_MEAN -#include -int set_environment_var(const char* name, const char* value) { return SetEnvironmentVariable(name, value); } -#else -int set_environment_var(const char* name, const char* value) { return setenv(name, value, 1); } -#endif +#include "test_common.h" void setup_mock_icd_env_vars() { // Necessary to point the loader at the mock driver @@ -256,7 +238,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfacePresentModesKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array present_modes{}; res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &count, nullptr); @@ -278,7 +260,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceFormatsKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array surface_formats{}; res = vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &count, nullptr); @@ -298,7 +280,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceFormats2KHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); uint32_t count = 0; std::array surface_formats2{}; VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; @@ -322,7 +304,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceSupportKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkBool32 supported = false; res = vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, 0, surface, &supported); ASSERT_EQ(res, VK_SUCCESS); @@ -335,7 +317,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceCapabilitiesKHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSurfaceCapabilitiesKHR surface_capabilities{}; res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, &surface_capabilities); ASSERT_EQ(res, VK_SUCCESS); @@ -354,7 +336,7 @@ TEST_F(MockICD, vkGetPhysicalDeviceSurfaceCapabilities2KHR) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSurfaceCapabilities2KHR surface_capabilities2{}; VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; surface_info.surface = surface; @@ -899,7 +881,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { VkSurfaceKHR surface{}; res = create_surface(instance, surface); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(surface, nullptr); + ASSERT_NE(surface, VK_NULL_HANDLE); VkSwapchainCreateInfoKHR swapchain_create_info{}; swapchain_create_info.surface = surface; @@ -907,7 +889,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { VkSwapchainKHR swapchain{}; res = vkCreateSwapchainKHR(device, &swapchain_create_info, nullptr, &swapchain); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(swapchain, nullptr); + ASSERT_NE(swapchain, VK_NULL_HANDLE); uint32_t count = 0; res = vkGetSwapchainImagesKHR(device, swapchain, &count, nullptr); @@ -916,7 +898,7 @@ TEST_F(MockICD, SwapchainLifeCycle) { std::array swapchain_images; res = vkGetSwapchainImagesKHR(device, swapchain, &count, swapchain_images.data()); ASSERT_EQ(res, VK_SUCCESS); - ASSERT_NE(swapchain_images[0], nullptr); + ASSERT_NE(swapchain_images[0], VK_NULL_HANDLE); uint32_t image_index = 10; // arbitrary non zero value res = vkAcquireNextImageKHR(device, swapchain, 0, VK_NULL_HANDLE, VK_NULL_HANDLE, &image_index); diff --git a/tests/test_common.h b/tests/test_common.h new file mode 100644 index 00000000..de06a784 --- /dev/null +++ b/tests/test_common.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 The Khronos Group Inc. + * Copyright (c) 2023 Valve Corporation + * Copyright (c) 2023 LunarG, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include +#include +#include + +#include "gtest/gtest.h" +#include "vulkan/vulkan.h" + +// Location of the built binaries in this repo +#include "binary_locations.h" + +#if defined(WIN32) +#include +inline int set_environment_var(const char* name, const char* value) { return SetEnvironmentVariable(name, value); } +#else +inline int set_environment_var(const char* name, const char* value) { return setenv(name, value, 1); } +#endif From 0c08a569d0a4d0990494490ced6a9bb35dfd5d88 Mon Sep 17 00:00:00 2001 From: Mike Gorchak Date: Thu, 24 Aug 2023 15:11:56 -0400 Subject: [PATCH 12/56] Add public support for QNX to vulkaninfo Sample output: ========== VULKANINFO ========== Vulkan Instance Version: 1.3.261 Instance Extensions: count = 16 =============================== VK_EXT_debug_report : extension revision 10 VK_EXT_debug_utils : extension revision 2 VK_EXT_direct_mode_display : extension revision 1 VK_EXT_display_surface_counter : extension revision 1 VK_KHR_device_group_creation : extension revision 1 VK_KHR_display : extension revision 23 VK_KHR_external_fence_capabilities : extension revision 1 VK_KHR_external_memory_capabilities : extension revision 1 VK_KHR_external_semaphore_capabilities : extension revision 1 VK_KHR_get_display_properties2 : extension revision 1 VK_KHR_get_physical_device_properties2 : extension revision 2 VK_KHR_get_surface_capabilities2 : extension revision 1 VK_KHR_portability_enumeration : extension revision 1 VK_KHR_surface : extension revision 25 VK_LUNARG_direct_driver_loading : extension revision 1 VK_QNX_screen_surface : extension revision 1 Layers: count = 1 ================= VK_LAYER_KHRONOS_validation (Khronos Validation Layer) Vulkan version 1.2.190, layer version 1: Layer Extensions: count = 3 VK_EXT_debug_report : extension revision 9 VK_EXT_debug_utils : extension revision 1 VK_EXT_validation_features : extension revision 2 Devices: count = 1 GPU id = 0 (Samsung Xclipse 930A) Layer-Device Extensions: count = 3 VK_EXT_debug_marker : extension revision 4 VK_EXT_tooling_info : extension revision 1 VK_EXT_validation_cache : extension revision 1 Presentable Surfaces: ===================== GPU id : 0 (Samsung Xclipse 930A): Surface type = VK_QNX_screen_surface Formats: count = 8 SurfaceFormat[0]: format = FORMAT_B8G8R8A8_UNORM colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[1]: format = FORMAT_B8G8R8A8_SRGB colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[2]: format = FORMAT_R8G8B8A8_UNORM colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[3]: format = FORMAT_R8G8B8A8_SRGB colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[4]: format = FORMAT_A2R10G10B10_UNORM_PACK32 colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[5]: format = FORMAT_A2B10G10R10_UNORM_PACK32 colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[6]: format = FORMAT_A1R5G5B5_UNORM_PACK16 colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR SurfaceFormat[7]: format = FORMAT_R5G6B5_UNORM_PACK16 colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR Present Modes: count = 4 PRESENT_MODE_IMMEDIATE_KHR PRESENT_MODE_MAILBOX_KHR PRESENT_MODE_FIFO_KHR PRESENT_MODE_FIFO_RELAXED_KHR ... ... ... --- vulkaninfo/vulkaninfo.h | 78 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 5bc13056..9a2f642e 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -67,7 +67,7 @@ #endif #endif // _WIN32 -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) #include #endif @@ -252,7 +252,7 @@ auto GetVector(const char *func_name, F &&f, Ts &&...ts) -> std::vector { // ----------- Instance Setup ------- // struct VkDll { VkResult Initialize() { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) library = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); if (!library) library = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); #elif defined(_WIN32) @@ -264,7 +264,7 @@ struct VkDll { return VK_SUCCESS; } void Close() { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) dlclose(library); #elif defined(_WIN32) FreeLibrary(library); @@ -356,6 +356,11 @@ struct VkDll { #ifdef VK_USE_PLATFORM_METAL_EXT PFN_vkCreateMetalSurfaceEXT fp_vkCreateMetalSurfaceEXT = APPLE_FP(vkCreateMetalSurfaceEXT); #endif // VK_USE_PLATFORM_METAL_EXT +#ifdef VK_USE_PLATFORM_SCREEN_QNX + PFN_vkCreateScreenSurfaceQNX fp_vkCreateScreenSurfaceQNX = APPLE_FP(vkCreateScreenSurfaceQNX); + PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX fp_vkGetPhysicalDeviceScreenPresentationSupportQNX = + APPLE_FP(vkGetPhysicalDeviceScreenPresentationSupportQNX); +#endif // VK_USE_PLATFORM_SCREEN_QNX void InitializeDispatchPointers() { Load(fp_vkCreateInstance, "vkCreateInstance"); Load(fp_vkDestroyInstance, "vkDestroyInstance"); @@ -420,18 +425,21 @@ struct VkDll { #ifdef VK_USE_PLATFORM_METAL_EXT Load(fp_vkCreateMetalSurfaceEXT, "vkCreateMetalSurfaceEXT"); #endif // VK_USE_PLATFORM_METAL_EXT +#ifdef VK_USE_PLATFORM_SCREEN_QNX + Load(fp_vkCreateScreenSurfaceQNX, "vkCreateScreenSurfaceQNX"); +#endif // VK_USE_PLATFORM_SCREEN_QNX } private: template void Load(T &func_dest, const char *func_name) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) func_dest = reinterpret_cast(dlsym(library, func_name)); #elif defined(_WIN32) func_dest = reinterpret_cast(GetProcAddress(library, func_name)); #endif } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) void *library; #elif defined(_WIN32) HMODULE library; @@ -621,6 +629,10 @@ struct AppInstance { #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR // TODO ANativeWindow *window; +#endif +#ifdef VK_USE_PLATFORM_SCREEN_QNX + struct _screen_context* context; + struct _screen_window* window; #endif AppInstance() { VkResult dllErr = dll.Initialize(); @@ -825,7 +837,8 @@ struct AppInstance { #if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_GGP) + defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_GGP) || defined(VK_USE_PLATFORM_SCREEN_QNX) + #define VULKANINFO_WSI_ENABLED #endif @@ -1190,6 +1203,47 @@ static VkSurfaceKHR AppCreateGgpSurface(AppInstance &inst) { static void AppDestroyGgpWindow(AppInstance &inst) {} #endif //----------------------------------------------------------- +//----------------------QNX SCREEN--------------------------- +#ifdef VK_USE_PLATFORM_SCREEN_QNX +static void AppCreateScreenWindow(AppInstance &inst) { + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&inst.context, 0); + if (rc) { + THROW_ERR("Could not create a QNX Screen context.\nExiting..."); + } + rc = screen_create_window(&inst.window, inst.context); + if (rc) { + THROW_ERR("Could not create a QNX Screen window.\nExiting..."); + } + rc = screen_set_window_property_iv(inst.window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + THROW_ERR("Could not set SCREEN_USAGE_VULKAN flag for QNX Screen window!\nExiting..."); + } +} + +static VkSurfaceKHR AppCreateScreenSurface(AppInstance &inst) { + VkScreenSurfaceCreateInfoQNX createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX; + createInfo.pNext = nullptr; + createInfo.flags = 0; + createInfo.context = inst.context; + createInfo.window = inst.window; + + VkSurfaceKHR surface; + VkResult err = inst.dll.fp_vkCreateScreenSurfaceQNX(inst.instance, &createInfo, nullptr, &surface); + if (err) THROW_VK_ERR("vkCreateScreenSurfaceQNX", err); + return surface; +} + +static void AppDestroyScreenWindow(AppInstance &inst) +{ + screen_destroy_window(inst.window); + screen_destroy_context(inst.context); +} +#endif // VK_USE_PLATFORM_SCREEN_QNX +//----------------------------------------------------------- // ------------ Setup Windows ------------- // void SetupWindowExtensions(AppInstance &inst) { @@ -1322,6 +1376,18 @@ void SetupWindowExtensions(AppInstance &inst) { inst.AddSurfaceExtension(surface_ext_ggp); } #endif +//--QNX_SCREEN-- +#ifdef VK_USE_PLATFORM_SCREEN_QNX + SurfaceExtension surface_ext_qnx_screen; + if (inst.CheckExtensionEnabled(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME)) { + surface_ext_qnx_screen.name = VK_QNX_SCREEN_SURFACE_EXTENSION_NAME; + surface_ext_qnx_screen.create_window = AppCreateScreenWindow; + surface_ext_qnx_screen.create_surface = AppCreateScreenSurface; + surface_ext_qnx_screen.destroy_window = AppDestroyScreenWindow; + + inst.AddSurfaceExtension(surface_ext_qnx_screen); + } +#endif } // ---------- Surfaces -------------- // From c536182ca9fa2a149f0e42515909de5417655bc3 Mon Sep 17 00:00:00 2001 From: Mike Gorchak Date: Thu, 24 Aug 2023 20:26:13 -0400 Subject: [PATCH 13/56] Add QNX support (VK_QNX_screen_surface) to C and C++ variants of vkcube. Additionally add support for RGB565 and RGBA5551 pixel formats, because some Vulkan drivers under QNX report these formats first as preferable. --- cube/cube.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++++ cube/cube.cpp | 203 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 403 insertions(+), 1 deletion(-) diff --git a/cube/cube.c b/cube/cube.c index c3e3613f..fc10edcd 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -33,6 +33,7 @@ #include #include #include +#include #if defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_XCB_KHR) #include #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) @@ -359,7 +360,12 @@ struct demo { struct ANativeWindow *window; #elif defined(VK_USE_PLATFORM_METAL_EXT) void *caMetalLayer; +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_context_t screen_context; + screen_window_t screen_window; + screen_event_t screen_event; #endif + VkSurfaceKHR surface; bool prepared; bool use_staging_buffer; @@ -2485,6 +2491,10 @@ static void demo_cleanup(struct demo *demo) { demo->event_buffer->Release(demo->event_buffer); demo->window->Release(demo->window); demo->dfb->Release(demo->dfb); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_destroy_event(demo->screen_event); + screen_destroy_window(demo->screen_window); + screen_destroy_context(demo->screen_context); #endif vkDestroyInstance(demo->inst, NULL); @@ -3157,6 +3167,170 @@ static void demo_run_display(struct demo *demo) { } } } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + +#include + +static void demo_run(struct demo *demo) { + int size[2] = { 0, 0 }; + screen_window_t win; + int val; + int rc; + + while (!demo->quit) { + while (!screen_get_event(demo->screen_context, demo->screen_event, demo->pause ? ~0 : 0)) { + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_TYPE, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_TYPE of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (val == SCREEN_EVENT_NONE) { + break; + } + switch (val) { + case SCREEN_EVENT_KEYBOARD: + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_FLAGS, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_FLAGS of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (val & KEY_DOWN) { + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_SYM, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SYM of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + switch (val) { + case KEYCODE_ESCAPE: + demo->quit = true; + break; + case KEYCODE_SPACE: + demo->pause = !demo->pause; + break; + case KEYCODE_LEFT: + demo->spin_angle -= demo->spin_increment; + break; + case KEYCODE_RIGHT: + demo->spin_angle += demo->spin_increment; + break; + default: + break; + } + } + break; + case SCREEN_EVENT_PROPERTY: + rc = screen_get_event_property_pv(demo->screen_event, SCREEN_PROPERTY_WINDOW, (void **)&win); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_WINDOW of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + rc = screen_get_event_property_iv(demo->screen_event, SCREEN_PROPERTY_NAME, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_NAME of the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + if (win == demo->screen_window) { + switch(val) { + case SCREEN_PROPERTY_SIZE: + rc = screen_get_window_property_iv(win, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SIZE of the window in the event! (%s)\n", strerror(errno)); + fflush(stdout); + demo->quit = true; + break; + } + demo->width = size[0]; + demo->height = size[1]; + demo_resize(demo); + break; + default: + /* We are not interested in any other events for now */ + break; + } + } + break; + } + } + + if (demo->pause) { + } else { + demo_draw(demo); + demo->curFrame++; + if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) { + demo->quit = true; + } + } + } +} + +static void demo_create_window(struct demo *demo) { + const char *idstr = APP_SHORT_NAME; + int size[2]; + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&demo->screen_context, 0); + if (rc) { + printf("Cannot create QNX Screen context!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_window(&demo->screen_window, demo->screen_context); + if (rc) { + printf("Cannot create QNX Screen window!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_event(&demo->screen_event); + if (rc) { + printf("Cannot create QNX Screen event!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Set window caption */ + screen_set_window_property_cv(demo->screen_window, SCREEN_PROPERTY_ID_STRING, strlen(idstr), idstr); + + /* Setup VULKAN usage flags */ + rc = screen_set_window_property_iv(demo->screen_window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + printf("Cannot set SCREEN_USAGE_VULKAN flag!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Setup window size */ + if ((demo->width == 0) || (demo->height == 0)) { + /* Obtain automatically set window size provided by WM */ + rc = screen_get_window_property_iv(demo->screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot obtain current window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + demo->width = size[0]; + demo->height = size[1]; + } else { + size[0] = demo->width; + size[1] = demo->height; + rc = screen_set_window_property_iv(demo->screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot set window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + } +} #endif /* @@ -3299,6 +3473,11 @@ static void demo_init_vk(struct demo *demo) { platformSurfaceExtFound = 1; demo->extension_names[demo->enabled_extension_count++] = VK_EXT_METAL_SURFACE_EXTENSION_NAME; } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + if (!strcmp(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) { + platformSurfaceExtFound = 1; + demo->extension_names[demo->enabled_extension_count++] = VK_QNX_SCREEN_SURFACE_EXTENSION_NAME; + } #endif if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) { demo->extension_names[demo->enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME; @@ -3376,6 +3555,12 @@ static void demo_init_vk(struct demo *demo) { "Do you have a compatible Vulkan installable client driver (ICD) installed?\n" "Please look at the Getting Started guide for additional information.\n", "vkCreateInstance Failure"); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the " VK_QNX_SCREEN_SURFACE_EXTENSION_NAME + " extension.\n\n" + "Do you have a compatible Vulkan installable client driver (ICD) installed?\n" + "Please look at the Getting Started guide for additional information.\n", + "vkCreateInstance Failure"); #endif } const VkApplicationInfo app = { @@ -3744,6 +3929,15 @@ static void demo_create_surface(struct demo *demo) { surface.pLayer = demo->caMetalLayer; err = vkCreateMetalSurfaceEXT(demo->inst, &surface, NULL, &demo->surface); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + VkScreenSurfaceCreateInfoQNX createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.context = demo->screen_context; + createInfo.window = demo->screen_window; + + err = vkCreateScreenSurfaceQNX(demo->inst, &createInfo, NULL, &demo->surface); #endif assert(!err); } @@ -3755,7 +3949,10 @@ static VkSurfaceFormatKHR pick_surface_format(const VkSurfaceFormatKHR *surfaceF if (format == VK_FORMAT_R8G8B8A8_UNORM || format == VK_FORMAT_B8G8R8A8_UNORM || format == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || format == VK_FORMAT_A2R10G10B10_UNORM_PACK32 || + format == VK_FORMAT_A1R5G5B5_UNORM_PACK16 || format == VK_FORMAT_R5G6B5_UNORM_PACK16 || format == VK_FORMAT_R16G16B16A16_SFLOAT) { + + return surfaceFormats[i]; } } @@ -4386,6 +4583,8 @@ int main(int argc, char **argv) { demo_create_window(&demo); #elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) demo_create_directfb_window(&demo); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo_create_window(&demo); #endif demo_init_vk_swapchain(&demo); @@ -4402,6 +4601,8 @@ int main(int argc, char **argv) { demo_run_directfb(&demo); #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) demo_run_display(&demo); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo_run(&demo); #endif demo_cleanup(&demo); diff --git a/cube/cube.cpp b/cube/cube.cpp index f7ddaf75..a59e6dbe 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -286,6 +286,9 @@ struct Demo { #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) vk::Result create_display_surface(); void run_display(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + void run(); + void create_window(); #endif std::string name = "vkcubepp"; // Name to put on the window/icon @@ -322,6 +325,10 @@ struct Demo { IDirectFBEventBuffer *event_buffer = nullptr; #elif defined(VK_USE_PLATFORM_METAL_EXT) void *caMetalLayer; +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_context_t screen_context = nullptr; + screen_window_t screen_window = nullptr; + screen_event_t screen_event = nullptr; #endif vk::SurfaceKHR surface; @@ -620,6 +627,10 @@ void Demo::cleanup() { event_buffer->Release(event_buffer); window->Release(window); dfb->Release(dfb); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + screen_destroy_event(screen_event); + screen_destroy_window(screen_window); + screen_destroy_context(screen_context); #endif if (use_debug_messenger) { inst.destroyDebugUtilsMessengerEXT(debug_messenger); @@ -1195,6 +1206,11 @@ void Demo::init_vk() { platformSurfaceExtFound = 1; enabled_instance_extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME); } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + else if (!strcmp(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, extension.extensionName)) { + platformSurfaceExtFound = 1; + enabled_instance_extensions.push_back(VK_QNX_SCREEN_SURFACE_EXTENSION_NAME); + } #endif } @@ -1250,6 +1266,13 @@ void Demo::init_vk() { "look at the Getting Started guide for additional " "information.\n", "vkCreateInstance Failure"); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the " VK_QNX_SCREEN_SURFACE_EXTENSION_NAME + " extension.\n\nDo you have a compatible " + "Vulkan installable client driver (ICD) installed?\nPlease " + "look at the Getting Started guide for additional " + "information.\n", + "vkCreateInstance Failure"); #endif } @@ -1455,6 +1478,13 @@ void Demo::create_surface() { auto result = create_display_surface(); VERIFY(result == vk::Result::eSuccess); } +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + { + auto const createInfo = vk::ScreenSurfaceCreateInfoQNX().setContext(screen_context).setWindow(screen_window); + + auto result = inst.createScreenSurfaceQNX(&createInfo, nullptr, &surface); + VERIFY(result == vk::Result::eSuccess); + } #endif } @@ -2493,6 +2523,7 @@ vk::SurfaceFormatKHR Demo::pick_surface_format(const std::vector + +void Demo::run() +{ + int size[2] = { 0, 0 }; + screen_window_t win; + int val; + int rc; + + while (!quit) { + while (!screen_get_event(screen_context, screen_event, pause ? ~0 : 0)) { + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_TYPE of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (val == SCREEN_EVENT_NONE) { + break; + } + switch (val) { + case SCREEN_EVENT_KEYBOARD: + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_FLAGS, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_FLAGS of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (val & KEY_DOWN) { + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_SYM, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SYM of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + switch (val) { + case KEYCODE_ESCAPE: + quit = true; + break; + case KEYCODE_SPACE: + pause = !pause; + break; + case KEYCODE_LEFT: + spin_angle -= spin_increment; + break; + case KEYCODE_RIGHT: + spin_angle += spin_increment; + break; + default: + break; + } + } + break; + case SCREEN_EVENT_PROPERTY: + rc = screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void **)&win); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_WINDOW of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_NAME, &val); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_NAME of the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + if (win == screen_window) { + switch(val) { + case SCREEN_PROPERTY_SIZE: + rc = screen_get_window_property_iv(win, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot get SCREEN_PROPERTY_SIZE of the window in the event! (%s)\n", strerror(errno)); + fflush(stdout); + quit = true; + break; + } + width = size[0]; + height = size[1]; + resize(); + break; + default: + /* We are not interested in any other events for now */ + break; + } + } + break; + } + } + + if (pause) { + } else { + update_data_buffer(); + draw(); + curFrame++; + if (frameCount != UINT32_MAX && curFrame == frameCount) { + quit = true; + } + } + } +} + +void Demo::create_window() +{ + const char *idstr = APP_SHORT_NAME; + int size[2]; + int usage = SCREEN_USAGE_VULKAN; + int rc; + + rc = screen_create_context(&screen_context, 0); + if (rc) { + printf("Cannot create QNX Screen context!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_window(&screen_window, screen_context); + if (rc) { + printf("Cannot create QNX Screen window!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + rc = screen_create_event(&screen_event); + if (rc) { + printf("Cannot create QNX Screen event!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Set window caption */ + screen_set_window_property_cv(screen_window, SCREEN_PROPERTY_ID_STRING, strlen(idstr), idstr); + + /* Setup VULKAN usage flags */ + rc = screen_set_window_property_iv(screen_window, SCREEN_PROPERTY_USAGE, &usage); + if (rc) { + printf("Cannot set SCREEN_USAGE_VULKAN flag!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + + /* Setup window size */ + if ((width == 0) || (height == 0)) { + rc = screen_get_window_property_iv(screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot obtain current window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + width = size[0]; + height = size[1]; + } else { + size[0] = width; + size[1] = height; + rc = screen_set_window_property_iv(screen_window, SCREEN_PROPERTY_SIZE, size); + if (rc) { + printf("Cannot set window size!\n"); + fflush(stdout); + exit(EXIT_FAILURE); + } + } +} #endif #if _WIN32 @@ -3187,7 +3384,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, return static_cast(msg.wParam); } -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) int main(int argc, char **argv) { Demo demo; @@ -3202,6 +3399,8 @@ int main(int argc, char **argv) { demo.create_window(); #elif defined(VK_USE_PLATFORM_DIRECTFB_EXT) demo.create_directfb_window(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo.create_window(); #endif demo.init_vk_swapchain(); @@ -3218,6 +3417,8 @@ int main(int argc, char **argv) { demo.run_directfb(); #elif defined(VK_USE_PLATFORM_DISPLAY_KHR) demo.run_display(); +#elif defined(VK_USE_PLATFORM_SCREEN_QNX) + demo.run(); #endif demo.cleanup(); From 3f141894d2d9e7edfc2fb5596af0cf3e23de9597 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 25 Aug 2023 12:46:56 -0700 Subject: [PATCH 14/56] build: Update to header 1.3.262 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- icd/generated/function_declarations.h | 8 ++ icd/generated/function_definitions.h | 4 + icd/generated/vk_typemap_helper.h | 81 +++++++++++++++++++ scripts/generate_vulkan_wrapper.py | 16 ++++ scripts/known_good.json | 4 +- 6 files changed, 112 insertions(+), 3 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 22a12fc0..98e7f65e 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.261 +v1.3.262 diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 64c78387..4fe0a2e3 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -365,6 +365,10 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_dynamic_rendering_unused_attachments", 1}, {"VK_KHR_cooperative_matrix", 2}, {"VK_QCOM_multiview_per_view_render_areas", 1}, + {"VK_QCOM_image_processing2", 1}, + {"VK_QCOM_filter_cubic_weights", 1}, + {"VK_QCOM_ycbcr_degamma", 1}, + {"VK_QCOM_filter_cubic_clamp", 1}, {"VK_EXT_attachment_feedback_loop_dynamic_state", 1}, {"VK_QNX_external_memory_screen_buffer", 1}, }; @@ -4169,6 +4173,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( + + + + static VKAPI_ATTR void VKAPI_CALL CmdSetAttachmentFeedbackLoopEnableEXT( VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask); diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index bd4b8476..9006570d 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6747,6 +6747,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( + + + + static VKAPI_ATTR void VKAPI_CALL CmdSetAttachmentFeedbackLoopEnableEXT( VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask) diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index ea240a54..3665e6a6 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -7343,6 +7343,87 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceImageProcessing2FeaturesQCOM Type; +}; + +// Map type VkPhysicalDeviceImageProcessing2PropertiesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceImageProcessing2PropertiesQCOM Type; +}; + +// Map type VkSamplerBlockMatchWindowCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerBlockMatchWindowCreateInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceCubicWeightsFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceCubicWeightsFeaturesQCOM Type; +}; + +// Map type VkSamplerCubicWeightsCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerCubicWeightsCreateInfoQCOM Type; +}; + +// Map type VkBlitImageCubicWeightsInfoQCOM to id VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkBlitImageCubicWeightsInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceYcbcrDegammaFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceYcbcrDegammaFeaturesQCOM Type; +}; + +// Map type VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM to id VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM Type; +}; + +// Map type VkPhysicalDeviceCubicClampFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceCubicClampFeaturesQCOM Type; +}; + // Map type VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index cd4defb8..9cff2aa6 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1568,6 +1568,18 @@ def __repr__(self): VK_QCOM_multiview_per_view_render_areas = Extension(name='VK_QCOM_multiview_per_view_render_areas', version=1, guard=None, commands=[ ]) +VK_QCOM_image_processing2 = Extension(name='VK_QCOM_image_processing2', version=1, guard=None, commands=[ +]) + +VK_QCOM_filter_cubic_weights = Extension(name='VK_QCOM_filter_cubic_weights', version=1, guard=None, commands=[ +]) + +VK_QCOM_ycbcr_degamma = Extension(name='VK_QCOM_ycbcr_degamma', version=1, guard=None, commands=[ +]) + +VK_QCOM_filter_cubic_clamp = Extension(name='VK_QCOM_filter_cubic_clamp', version=1, guard=None, commands=[ +]) + VK_EXT_attachment_feedback_loop_dynamic_state = Extension(name='VK_EXT_attachment_feedback_loop_dynamic_state', version=1, guard=None, commands=[ Command(name='vkCmdSetAttachmentFeedbackLoopEnableEXT', dispatch='VkCommandBuffer'), ]) @@ -2071,6 +2083,10 @@ def __repr__(self): VK_EXT_pipeline_library_group_handles, VK_EXT_dynamic_rendering_unused_attachments, VK_QCOM_multiview_per_view_render_areas, + VK_QCOM_image_processing2, + VK_QCOM_filter_cubic_weights, + VK_QCOM_ycbcr_degamma, + VK_QCOM_filter_cubic_clamp, VK_EXT_attachment_feedback_loop_dynamic_state, VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline, diff --git a/scripts/known_good.json b/scripts/known_good.json index 52d78d07..830ab76f 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.261" + "commit": "v1.3.262" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.261", + "commit": "v1.3.262", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", From 6087a5844480e1f9cce9c645c2123f07314ce574 Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Mon, 28 Aug 2023 11:15:36 +0900 Subject: [PATCH 15/56] icd: Add VkSurfacePresentModeCompatibilityEXT support --- icd/generated/function_definitions.h | 12 ++++++++++++ scripts/mock_icd_generator.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 9006570d..d7885403 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -3461,6 +3461,18 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2KHR( VkSurfaceCapabilities2KHR* pSurfaceCapabilities) { GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pSurfaceInfo->surface, &pSurfaceCapabilities->surfaceCapabilities); + + auto *present_mode_compatibility = lvl_find_mod_in_chain(pSurfaceCapabilities->pNext); + if (present_mode_compatibility) { + if (!present_mode_compatibility->pPresentModes) { + present_mode_compatibility->presentModeCount = 3; + } else { + // arbitrary + present_mode_compatibility->pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR; + present_mode_compatibility->pPresentModes[1] = VK_PRESENT_MODE_FIFO_KHR; + present_mode_compatibility->pPresentModes[2] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR; + } + } return VK_SUCCESS; } diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 636205c6..ce1e3135 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -300,6 +300,18 @@ ''', 'vkGetPhysicalDeviceSurfaceCapabilities2KHR': ''' GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pSurfaceInfo->surface, &pSurfaceCapabilities->surfaceCapabilities); + + auto *present_mode_compatibility = lvl_find_mod_in_chain(pSurfaceCapabilities->pNext); + if (present_mode_compatibility) { + if (!present_mode_compatibility->pPresentModes) { + present_mode_compatibility->presentModeCount = 3; + } else { + // arbitrary + present_mode_compatibility->pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR; + present_mode_compatibility->pPresentModes[1] = VK_PRESENT_MODE_FIFO_KHR; + present_mode_compatibility->pPresentModes[2] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR; + } + } return VK_SUCCESS; ''', 'vkGetInstanceProcAddr': ''' From 42340d6ba88f6848fa39dfdee82dba312c3b4955 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 30 Aug 2023 12:17:33 -0600 Subject: [PATCH 16/56] Remove cmake-format --- .cmake-format.py | 34 ---------------------------------- CONTRIBUTING.md | 15 --------------- 2 files changed, 49 deletions(-) delete mode 100644 .cmake-format.py diff --git a/.cmake-format.py b/.cmake-format.py deleted file mode 100644 index 07d2f99d..00000000 --- a/.cmake-format.py +++ /dev/null @@ -1,34 +0,0 @@ -# Configuration for cmake-format (v0.4.1, circa Jul 2018) -# https://github.com/cheshirekow/cmake_format - -# How wide to allow formatted cmake files -line_width = 132 - -# How many spaces to tab for indent -tab_size = 4 - -# If arglists are longer than this, break them always -max_subargs_per_line = 3 - -# If true, separate flow control names from their parentheses with a space -separate_ctrl_name_with_space = False - -# If true, separate function names from parentheses with a space -separate_fn_name_with_space = False - -# If a statement is wrapped to more than one line, than dangle the closing -# parenthesis on it's own line -dangle_parens = False - -# What character to use for bulleted lists -bullet_char = u'*' - -# What character to use as punctuation after numerals in an enumerated list -enum_char = u'.' - -# What style line endings to use in the output. -line_ending = u'unix' - -# Format command names consistently as 'lower' or 'upper' case -command_case = u'lower' - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e3d5f0f3..39101aed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,21 +97,6 @@ scripts and before building and testing your changes. More details can be found * The indent is 4 spaces. * CMake functions are lower-case. * Variable and keyword names are upper-case. -* The format is defined by - [cmake-format](https://github.com/cheshirekow/cmake_format) - using the `.cmake-format.py` file in the repository to define the settings. - See the cmake-format page for information about its simple markup for comments. -* Disable reformatting of a block of comment lines by inserting - a `# ~~~` comment line before and after that block. -* Disable any formatting of a block of lines by surrounding that block with - `# cmake-format: off` and `# cmake-format: on` comment lines. -* To install: `sudo pip install cmake_format` -* To run: `cmake-format --in-place $FILENAME` -* **IMPORTANT (June 2018)** cmake-format v0.3.6 has a - [bug]( https://github.com/cheshirekow/cmake_format/issues/50) - that can corrupt the formatting of comment lines in CMake files. - A workaround is to use the following command _before_ running cmake-format: - `sed --in-place='' 's/^ *#/#/' $FILENAME` ### **Contributor License Agreement (CLA)** From 389110e4600669d82bca042859fddf898387c0d2 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 30 Aug 2023 16:11:01 -0600 Subject: [PATCH 17/56] git: Ignore CMakeUserPresets.json --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cd76636c..ec965a68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ CMakeCache.txt CMakeLists.txt.user +CMakeUserPresets.json CMakeFiles/ cmake_install.cmake Makefile From e50622314dfc8efa00e2e5f824a63464f1a94665 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Tue, 5 Sep 2023 12:51:44 -0700 Subject: [PATCH 18/56] build: Update to header 1.3.263 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- icd/generated/function_declarations.h | 8 +++++--- icd/generated/function_definitions.h | 1 + icd/generated/vk_typemap_helper.h | 9 +++++++++ scripts/generate_vulkan_wrapper.py | 10 +++++++--- scripts/known_good.json | 4 ++-- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 98e7f65e..8caf4cb8 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.262 +v1.3.263 diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 4fe0a2e3..ce0b88b8 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -93,8 +93,8 @@ static const std::unordered_map device_extension_map = { {"VK_AMD_negative_viewport_height", 1}, {"VK_AMD_gpu_shader_half_float", 2}, {"VK_AMD_shader_ballot", 1}, - {"VK_EXT_video_encode_h264", 11}, - {"VK_EXT_video_encode_h265", 11}, + {"VK_EXT_video_encode_h264", 12}, + {"VK_EXT_video_encode_h265", 12}, {"VK_KHR_video_decode_h264", 8}, {"VK_AMD_texture_gather_bias_lod", 1}, {"VK_AMD_shader_info", 1}, @@ -273,7 +273,7 @@ static const std::unordered_map device_extension_map = { {"VK_KHR_present_id", 1}, {"VK_EXT_private_data", 1}, {"VK_EXT_pipeline_creation_cache_control", 3}, - {"VK_KHR_video_encode_queue", 9}, + {"VK_KHR_video_encode_queue", 10}, {"VK_NV_device_diagnostics_config", 2}, {"VK_QCOM_render_pass_store_ops", 2}, {"VK_NV_low_latency", 1}, @@ -371,6 +371,7 @@ static const std::unordered_map device_extension_map = { {"VK_QCOM_filter_cubic_clamp", 1}, {"VK_EXT_attachment_feedback_loop_dynamic_state", 1}, {"VK_QNX_external_memory_screen_buffer", 1}, + {"VK_NV_descriptor_pool_overallocation", 1}, }; @@ -4190,6 +4191,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( #endif /* VK_USE_PLATFORM_SCREEN_QNX */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index d7885403..cc849615 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6783,6 +6783,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( #endif /* VK_USE_PLATFORM_SCREEN_QNX */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index 3665e6a6..818f4932 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -7488,6 +7488,15 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV Type; +}; + // Map type VkAccelerationStructureGeometryTrianglesDataKHR to id VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 9cff2aa6..0195da04 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1584,6 +1584,9 @@ def __repr__(self): Command(name='vkCmdSetAttachmentFeedbackLoopEnableEXT', dispatch='VkCommandBuffer'), ]) +VK_NV_descriptor_pool_overallocation = Extension(name='VK_NV_descriptor_pool_overallocation', version=1, guard=None, commands=[ +]) + VK_KHR_acceleration_structure = Extension(name='VK_KHR_acceleration_structure', version=13, guard=None, commands=[ Command(name='vkCreateAccelerationStructureKHR', dispatch='VkDevice'), Command(name='vkDestroyAccelerationStructureKHR', dispatch='VkDevice'), @@ -1758,16 +1761,16 @@ def __repr__(self): VK_KHR_portability_subset = Extension(name='VK_KHR_portability_subset', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) -VK_KHR_video_encode_queue = Extension(name='VK_KHR_video_encode_queue', version=9, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_KHR_video_encode_queue = Extension(name='VK_KHR_video_encode_queue', version=10, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ Command(name='vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR', dispatch='VkPhysicalDevice'), Command(name='vkGetEncodedVideoSessionParametersKHR', dispatch='VkDevice'), Command(name='vkCmdEncodeVideoKHR', dispatch='VkCommandBuffer'), ]) -VK_EXT_video_encode_h264 = Extension(name='VK_EXT_video_encode_h264', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_EXT_video_encode_h264 = Extension(name='VK_EXT_video_encode_h264', version=12, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) -VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=11, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ +VK_EXT_video_encode_h265 = Extension(name='VK_EXT_video_encode_h265', version=12, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ ]) VK_AMDX_shader_enqueue = Extension(name='VK_AMDX_shader_enqueue', version=1, guard='VK_ENABLE_BETA_EXTENSIONS', commands=[ @@ -2088,6 +2091,7 @@ def __repr__(self): VK_QCOM_ycbcr_degamma, VK_QCOM_filter_cubic_clamp, VK_EXT_attachment_feedback_loop_dynamic_state, + VK_NV_descriptor_pool_overallocation, VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline, VK_KHR_ray_query, diff --git a/scripts/known_good.json b/scripts/known_good.json index 830ab76f..e0c51440 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.262" + "commit": "v1.3.263" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.262", + "commit": "v1.3.263", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", From d3c1c1ade0488aca289b34157ce38e3f359d2f4c Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Tue, 12 Sep 2023 16:46:58 +0900 Subject: [PATCH 19/56] icd: Add second VkCooperativeMatrixPropertiesKHR field --- icd/generated/function_definitions.h | 7 +++++-- scripts/mock_icd_generator.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index cc849615..b0cbe1ea 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -4073,7 +4073,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixProperti VkCooperativeMatrixPropertiesKHR* pProperties) { if (!pProperties) { - *pPropertyCount = 1; + *pPropertyCount = 2; } else { // arbitrary pProperties[0].MSize = 16; @@ -4084,7 +4084,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceCooperativeMatrixProperti pProperties[0].CType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].ResultType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].saturatingAccumulation = VK_FALSE; - pProperties[0].scope = VK_SCOPE_DEVICE_KHR; + pProperties[0].scope = VK_SCOPE_SUBGROUP_KHR; + + pProperties[1] = pProperties[0]; + pProperties[1].scope = VK_SCOPE_DEVICE_KHR; } return VK_SUCCESS; } diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index ce1e3135..6eda0e2e 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -968,7 +968,7 @@ ''', 'vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR': ''' if (!pProperties) { - *pPropertyCount = 1; + *pPropertyCount = 2; } else { // arbitrary pProperties[0].MSize = 16; @@ -979,7 +979,10 @@ pProperties[0].CType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].ResultType = VK_COMPONENT_TYPE_UINT32_KHR; pProperties[0].saturatingAccumulation = VK_FALSE; - pProperties[0].scope = VK_SCOPE_DEVICE_KHR; + pProperties[0].scope = VK_SCOPE_SUBGROUP_KHR; + + pProperties[1] = pProperties[0]; + pProperties[1].scope = VK_SCOPE_DEVICE_KHR; } return VK_SUCCESS; ''', From 45095e1b094ae45d4437ad516aaffbb499882d18 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Mon, 11 Sep 2023 11:15:43 -0700 Subject: [PATCH 20/56] build: Update to header 1.3.264 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- icd/generated/function_declarations.h | 4 +++ icd/generated/function_definitions.h | 2 ++ icd/generated/vk_typemap_helper.h | 27 +++++++++++++++++++ scripts/generate_vulkan_wrapper.py | 8 ++++++ scripts/known_good.json | 4 +-- vulkaninfo/generated/vulkaninfo.hpp | 14 ++++++++++ 7 files changed, 58 insertions(+), 3 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 8caf4cb8..25483b07 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.263 +v1.3.264 diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index ce0b88b8..2750e4d4 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -315,6 +315,7 @@ static const std::unordered_map device_extension_map = { {"VK_HUAWEI_invocation_mask", 1}, {"VK_NV_external_memory_rdma", 1}, {"VK_EXT_pipeline_properties", 1}, + {"VK_EXT_frame_boundary", 1}, {"VK_EXT_multisampled_render_to_single_sampled", 1}, {"VK_EXT_extended_dynamic_state2", 1}, {"VK_EXT_color_write_enable", 1}, @@ -371,6 +372,7 @@ static const std::unordered_map device_extension_map = { {"VK_QCOM_filter_cubic_clamp", 1}, {"VK_EXT_attachment_feedback_loop_dynamic_state", 1}, {"VK_QNX_external_memory_screen_buffer", 1}, + {"VK_MSFT_layered_driver", 1}, {"VK_NV_descriptor_pool_overallocation", 1}, }; @@ -3717,6 +3719,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPipelinePropertiesEXT( + static VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( VkCommandBuffer commandBuffer, uint32_t patchControlPoints); @@ -4192,6 +4195,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index b0cbe1ea..22dae97e 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6039,6 +6039,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPipelinePropertiesEXT( + static VKAPI_ATTR void VKAPI_CALL CmdSetPatchControlPointsEXT( VkCommandBuffer commandBuffer, uint32_t patchControlPoints) @@ -6787,6 +6788,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetScreenBufferPropertiesQNX( + static VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index 818f4932..0f8db1fb 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -6489,6 +6489,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceFrameBoundaryFeaturesEXT Type; +}; + +// Map type VkFrameBoundaryEXT to id VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkFrameBoundaryEXT Type; +}; + // Map type VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; @@ -7488,6 +7506,15 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceLayeredDriverPropertiesMSFT Type; +}; + // Map type VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 0195da04..43e4b909 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1352,6 +1352,9 @@ def __repr__(self): Command(name='vkGetPipelinePropertiesEXT', dispatch='VkDevice'), ]) +VK_EXT_frame_boundary = Extension(name='VK_EXT_frame_boundary', version=1, guard=None, commands=[ +]) + VK_EXT_multisampled_render_to_single_sampled = Extension(name='VK_EXT_multisampled_render_to_single_sampled', version=1, guard=None, commands=[ ]) @@ -1584,6 +1587,9 @@ def __repr__(self): Command(name='vkCmdSetAttachmentFeedbackLoopEnableEXT', dispatch='VkCommandBuffer'), ]) +VK_MSFT_layered_driver = Extension(name='VK_MSFT_layered_driver', version=1, guard=None, commands=[ +]) + VK_NV_descriptor_pool_overallocation = Extension(name='VK_NV_descriptor_pool_overallocation', version=1, guard=None, commands=[ ]) @@ -2040,6 +2046,7 @@ def __repr__(self): VK_HUAWEI_invocation_mask, VK_NV_external_memory_rdma, VK_EXT_pipeline_properties, + VK_EXT_frame_boundary, VK_EXT_multisampled_render_to_single_sampled, VK_EXT_extended_dynamic_state2, VK_EXT_color_write_enable, @@ -2091,6 +2098,7 @@ def __repr__(self): VK_QCOM_ycbcr_degamma, VK_QCOM_filter_cubic_clamp, VK_EXT_attachment_feedback_loop_dynamic_state, + VK_MSFT_layered_driver, VK_NV_descriptor_pool_overallocation, VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline, diff --git a/scripts/known_good.json b/scripts/known_good.json index e0c51440..6eed5f45 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.263" + "commit": "v1.3.264" }, { "name": "MoltenVK", @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.263", + "commit": "v1.3.264", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index df1f00e3..1e06b76b 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -1946,6 +1946,11 @@ void DumpVkPhysicalDeviceFragmentShadingRatePropertiesKHR(Printer &p, std::strin p.PrintKeyBool("fragmentShadingRateWithCustomSampleLocations", static_cast(obj.fragmentShadingRateWithCustomSampleLocations)); p.PrintKeyBool("fragmentShadingRateStrictMultiplyCombiner", static_cast(obj.fragmentShadingRateStrictMultiplyCombiner)); } +void DumpVkPhysicalDeviceFrameBoundaryFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceFrameBoundaryFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(13); + p.PrintKeyBool("frameBoundary", static_cast(obj.frameBoundary)); +} void DumpVkPhysicalDeviceGlobalPriorityQueryFeaturesKHR(Printer &p, std::string name, const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(19); @@ -3486,6 +3491,7 @@ struct phys_device_features2_chain { VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR PhysicalDeviceFragmentShaderBarycentricFeaturesKHR{}; VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT PhysicalDeviceFragmentShaderInterlockFeaturesEXT{}; VkPhysicalDeviceFragmentShadingRateFeaturesKHR PhysicalDeviceFragmentShadingRateFeaturesKHR{}; + VkPhysicalDeviceFrameBoundaryFeaturesEXT PhysicalDeviceFrameBoundaryFeaturesEXT{}; VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR PhysicalDeviceGlobalPriorityQueryFeaturesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT{}; VkPhysicalDeviceHostImageCopyFeaturesEXT PhysicalDeviceHostImageCopyFeaturesEXT{}; @@ -3611,6 +3617,7 @@ struct phys_device_features2_chain { PhysicalDeviceFragmentShaderBarycentricFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; PhysicalDeviceFragmentShaderInterlockFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; PhysicalDeviceFragmentShadingRateFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; + PhysicalDeviceFrameBoundaryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; PhysicalDeviceGlobalPriorityQueryFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; PhysicalDeviceHostImageCopyFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; @@ -3734,6 +3741,7 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderBarycentricFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderInterlockFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRateFeaturesKHR)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceFrameBoundaryFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGlobalPriorityQueryFeaturesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyFeaturesEXT)); @@ -4506,6 +4514,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceFragmentShadingRateFeaturesKHR(p, "VkPhysicalDeviceFragmentShadingRateFeaturesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME))) { + VkPhysicalDeviceFrameBoundaryFeaturesEXT* props = (VkPhysicalDeviceFrameBoundaryFeaturesEXT*)structure; + DumpVkPhysicalDeviceFrameBoundaryFeaturesEXT(p, "VkPhysicalDeviceFrameBoundaryFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME) || gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME))) { VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR* props = (VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR*)structure; From a01cfc0b78dc7a2d14913b33b53a7420fabd73a3 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 12 Sep 2023 16:18:02 -0600 Subject: [PATCH 21/56] vulkaninfo: Support VK_EXT_surface_maintenance1 properly The struct VkSurfacePresentModeCompatibilityEXT and VkSurfacePresentScalingCapabilitiesEXT can only be included in the VkSurfaceCapabilities2KHR pNext chain if a VkSurfacePresentModeEXT struct is in the pNext chain for VkPhysicalDeviceSurfaceInfo2KHR. In other words, the autogen for this extension is not adequate and needs to be special cased. This is doubly true because the aformentioned structs are 'per-present-mode' so the output needs to handle printing each struct once per present mode available, which is not possible with autogenerated code currently. The easiest solution is to just remove the surface_maintenance1 structs from autogen in the pNext chain (but keep the autogenerated printing functions). Then setup the pNext chains appropriate and make the necessary calls, before printing the data directly. --- scripts/vulkaninfo_generator.py | 56 ++++++++++++++++++++++------- vulkaninfo/generated/vulkaninfo.hpp | 18 ---------- vulkaninfo/vulkaninfo.cpp | 44 +++++++++++++++++++++++ vulkaninfo/vulkaninfo.h | 10 +++--- 4 files changed, 93 insertions(+), 35 deletions(-) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 6668d046..9d7d683a 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -81,7 +81,8 @@ # used in the .cpp code structures_to_gen = ['VkExtent3D', 'VkExtent2D', 'VkPhysicalDeviceLimits', 'VkPhysicalDeviceFeatures', 'VkPhysicalDeviceSparseProperties', - 'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties'] + 'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties', + 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT'] enums_to_gen = ['VkResult', 'VkFormat', 'VkPresentModeKHR', 'VkPhysicalDeviceType', 'VkImageTiling'] flags_to_gen = ['VkSurfaceTransformFlagsKHR', 'VkCompositeAlphaFlagsKHR', 'VkSurfaceCounterFlagsEXT', 'VkQueueFlags', @@ -110,12 +111,37 @@ # Types that need pNext Chains built. 'extends' is the xml tag used in the structextends member. 'type' can be device, instance, or both EXTENSION_CATEGORIES = OrderedDict(( - ('phys_device_props2', {'extends': 'VkPhysicalDeviceProperties2', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkPhysicalDeviceProperties2', 'print_iterator': True}), - ('phys_device_mem_props2', {'extends': 'VkPhysicalDeviceMemoryProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type':'VkPhysicalDeviceMemoryProperties2', 'print_iterator': False}), - ('phys_device_features2', {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', 'type': EXTENSION_TYPE_DEVICE, 'holder_type': 'VkPhysicalDeviceFeatures2', 'print_iterator': True}), - ('surface_capabilities2', {'extends': 'VkSurfaceCapabilities2KHR', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkSurfaceCapabilities2KHR', 'print_iterator': True}), - ('format_properties2', {'extends': 'VkFormatProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type':'VkFormatProperties2', 'print_iterator': True}), - ('queue_properties2', {'extends': 'VkQueueFamilyProperties2', 'type': EXTENSION_TYPE_DEVICE, 'holder_type': 'VkQueueFamilyProperties2', 'print_iterator': True}) + ('phys_device_props2', + {'extends': 'VkPhysicalDeviceProperties2', + 'type': EXTENSION_TYPE_BOTH, + 'holder_type': 'VkPhysicalDeviceProperties2', + 'print_iterator': True}), + ('phys_device_mem_props2', + {'extends': 'VkPhysicalDeviceMemoryProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type':'VkPhysicalDeviceMemoryProperties2', + 'print_iterator': False}), + ('phys_device_features2', + {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type': 'VkPhysicalDeviceFeatures2', + 'print_iterator': True}), + ('surface_capabilities2', + {'extends': 'VkSurfaceCapabilities2KHR', + 'type': EXTENSION_TYPE_BOTH, + 'holder_type': 'VkSurfaceCapabilities2KHR', + 'print_iterator': True, + 'exclude': ['VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT']}), + ('format_properties2', + {'extends': 'VkFormatProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type':'VkFormatProperties2', + 'print_iterator': True}), + ('queue_properties2', + {'extends': 'VkQueueFamilyProperties2', + 'type': EXTENSION_TYPE_DEVICE, + 'holder_type': 'VkQueueFamilyProperties2', + 'print_iterator': True}) )) class VulkanInfoGeneratorOptions(GeneratorOptions): def __init__(self, @@ -243,9 +269,9 @@ def endFile(self): types_to_gen.update( GatherTypesToGen(self.all_structures, structures_to_gen)) - for key in EXTENSION_CATEGORIES.keys(): + for key, info in EXTENSION_CATEGORIES.items(): types_to_gen.update( - GatherTypesToGen(self.all_structures, self.extension_sets[key])) + GatherTypesToGen(self.all_structures, self.extension_sets[key], info.get('exclude'))) types_to_gen = sorted(types_to_gen) names_of_structures_to_gen = set() @@ -365,10 +391,13 @@ def genType(self, typeinfo, name, alias): for key, value in EXTENSION_CATEGORIES.items(): if str(typeinfo.elem.get('structextends')).find(value.get('extends')) != -1: - self.extension_sets[key].add(name) + if value.get('exclude') is None or name not in value.get('exclude'): + self.extension_sets[key].add(name) -def GatherTypesToGen(structure_list, structures): +def GatherTypesToGen(structure_list, structures, exclude = []): + if exclude == None: + exclude = [] types = set() for s in structures: types.add(s) @@ -380,8 +409,9 @@ def GatherTypesToGen(structure_list, structures): for m in s.members: if m.typeID not in predefined_types and m.name not in names_to_ignore: if m.typeID not in types: - types.add(m.typeID) - added_stuff = True + if s.name not in exclude: + types.add(m.typeID) + added_stuff = True return types diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 1e06b76b..81c4d744 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -3853,24 +3853,18 @@ struct surface_capabilities2_chain { #ifdef VK_USE_PLATFORM_WIN32_KHR VkSurfaceCapabilitiesFullScreenExclusiveEXT SurfaceCapabilitiesFullScreenExclusiveEXT{}; #endif // VK_USE_PLATFORM_WIN32_KHR - VkSurfacePresentModeCompatibilityEXT SurfacePresentModeCompatibilityEXT{}; - VkSurfacePresentScalingCapabilitiesEXT SurfacePresentScalingCapabilitiesEXT{}; VkSurfaceProtectedCapabilitiesKHR SurfaceProtectedCapabilitiesKHR{}; void initialize_chain() noexcept { SharedPresentSurfaceCapabilitiesKHR.sType = VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR; #ifdef VK_USE_PLATFORM_WIN32_KHR SurfaceCapabilitiesFullScreenExclusiveEXT.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT; #endif // VK_USE_PLATFORM_WIN32_KHR - SurfacePresentModeCompatibilityEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; - SurfacePresentScalingCapabilitiesEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; SurfaceProtectedCapabilitiesKHR.sType = VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR; std::vector chain_members; chain_members.push_back(reinterpret_cast(&SharedPresentSurfaceCapabilitiesKHR)); #ifdef VK_USE_PLATFORM_WIN32_KHR chain_members.push_back(reinterpret_cast(&SurfaceCapabilitiesFullScreenExclusiveEXT)); #endif // VK_USE_PLATFORM_WIN32_KHR - chain_members.push_back(reinterpret_cast(&SurfacePresentModeCompatibilityEXT)); - chain_members.push_back(reinterpret_cast(&SurfacePresentScalingCapabilitiesEXT)); chain_members.push_back(reinterpret_cast(&SurfaceProtectedCapabilitiesKHR)); for(size_t i = 0; i < chain_members.size() - 1; i++){ @@ -5084,18 +5078,6 @@ void chain_iterator_surface_capabilities2(Printer &p, AppInstance &inst, AppGpu p.AddNewline(); } #endif // VK_USE_PLATFORM_WIN32_KHR - if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT && - (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME))) { - VkSurfacePresentModeCompatibilityEXT* props = (VkSurfacePresentModeCompatibilityEXT*)structure; - DumpVkSurfacePresentModeCompatibilityEXT(p, "VkSurfacePresentModeCompatibilityEXT", *props); - p.AddNewline(); - } - if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT && - (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME))) { - VkSurfacePresentScalingCapabilitiesEXT* props = (VkSurfacePresentScalingCapabilitiesEXT*)structure; - DumpVkSurfacePresentScalingCapabilitiesEXT(p, "VkSurfacePresentScalingCapabilitiesEXT", *props); - p.AddNewline(); - } if (structure->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR && (inst.CheckExtensionEnabled(VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME))) { VkSurfaceProtectedCapabilitiesKHR* props = (VkSurfaceProtectedCapabilitiesKHR*)structure; diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 0696cff8..cad6779c 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -155,6 +155,50 @@ void DumpSurfaceCapabilities(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurf if (inst.CheckExtensionEnabled(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME)) { chain_iterator_surface_capabilities2(p, inst, gpu, surface.surface_capabilities2_khr.pNext); } + if (inst.CheckExtensionEnabled(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME)) { + p.SetSubHeader(); + ObjectWrapper obj(p, "VK_EXT_surface_maintenance_1"); + for (auto &mode : surface.surf_present_modes) { + VkSurfacePresentModeEXT present_mode{}; + present_mode.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT; + present_mode.presentMode = mode; + + VkPhysicalDeviceSurfaceInfo2KHR surface_info{}; + surface_info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR; + surface_info.surface = surface.surface_extension.surface; + surface_info.pNext = &present_mode; + + VkSurfacePresentModeCompatibilityEXT SurfacePresentModeCompatibilityEXT{}; + SurfacePresentModeCompatibilityEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; + + VkSurfacePresentScalingCapabilitiesEXT SurfacePresentScalingCapabilitiesEXT{}; + SurfacePresentScalingCapabilitiesEXT.sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; + SurfacePresentScalingCapabilitiesEXT.pNext = &SurfacePresentModeCompatibilityEXT; + + VkSurfaceCapabilities2KHR surface_caps2{}; + surface_caps2.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR; + surface_caps2.pNext = &SurfacePresentScalingCapabilitiesEXT; + + VkResult err = + inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2); + if (err != VK_SUCCESS) { + continue; + } + + std::vector compatible_present_modes{SurfacePresentModeCompatibilityEXT.presentModeCount}; + SurfacePresentModeCompatibilityEXT.pPresentModes = compatible_present_modes.data(); + + err = inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2); + + if (err == VK_SUCCESS) { + ObjectWrapper present_mode_obj(p, VkPresentModeKHRString(mode)); + DumpVkSurfacePresentScalingCapabilitiesEXT(p, "VkSurfacePresentScalingCapabilitiesEXT", + SurfacePresentScalingCapabilitiesEXT); + DumpVkSurfacePresentModeCompatibilityEXT(p, "VkSurfacePresentModeCompatibilityEXT", + SurfacePresentModeCompatibilityEXT); + } + } + } } void DumpSurface(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurface &surface, std::set surface_types) { diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 9a2f642e..1390863b 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -631,8 +631,8 @@ struct AppInstance { ANativeWindow *window; #endif #ifdef VK_USE_PLATFORM_SCREEN_QNX - struct _screen_context* context; - struct _screen_window* window; + struct _screen_context *context; + struct _screen_window *window; #endif AppInstance() { VkResult dllErr = dll.Initialize(); @@ -813,6 +813,9 @@ struct AppInstance { if (strcmp(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME, ext.extensionName) == 0) { inst_extensions.push_back(ext.extensionName); } + if (strcmp(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME, ext.extensionName) == 0) { + inst_extensions.push_back(ext.extensionName); + } } } @@ -1237,8 +1240,7 @@ static VkSurfaceKHR AppCreateScreenSurface(AppInstance &inst) { return surface; } -static void AppDestroyScreenWindow(AppInstance &inst) -{ +static void AppDestroyScreenWindow(AppInstance &inst) { screen_destroy_window(inst.window); screen_destroy_context(inst.context); } From 1ecbed6db368efc5dab956974d660e79faf28a0f Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 18 Sep 2023 21:46:46 -0600 Subject: [PATCH 22/56] cube: Check in SPIRV code The shader code used by vkcube & vkcubepp is now checked into the source. This prevents users from needing a version of glslang on the system in order to build the project. While the existing mechanism of fetching a glslang binary from github was adequate, the version used linked to VS 2013 which caused build failures with rather cryptic linker errors. Since changing the shaders happens very infrequently, the decision has been made to check in the spir-v code. The CMake logic to compile the shaders remainds, but is put behind a new build flag COMPILE_CUBE_SHADERS. --- BUILD.md | 31 +----------- cube/CMakeLists.txt | 61 +++++++----------------- cube/cube.frag.inc | 41 ++++++++++++++++ cube/cube.vert.inc | 50 +++++++++++++++++++ scripts/fetch_glslangvalidator.py | 79 ------------------------------- 5 files changed, 110 insertions(+), 152 deletions(-) create mode 100644 cube/cube.frag.inc create mode 100644 cube/cube.vert.inc delete mode 100755 scripts/fetch_glslangvalidator.py diff --git a/BUILD.md b/BUILD.md index a0990a56..a5423cf8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -87,27 +87,6 @@ below. Note that this dependency can be ignored if not building the mock ICD (CMake option: `-DBUILD_ICD=OFF`). -#### glslang - -This repository has a required dependency on the `glslangValidator` (shader -compiler) for compiling the shader programs for the vkcube demos. - -The CMake code in this repository downloads release binaries of glslang if a -build glslang repository is not provided. The glslangValidator is obtained -from this set of release binaries. - -If you don't wish the CMake code to download these binaries, then you must -clone the [glslang repository](https://github.com/KhronosGroup/glslang) and -build its `install` target. Follow the build instructions in the glslang -[README.md](https://github.com/KhronosGroup/glslang/blob/main/README.md) -file. Ensure that the `update_glslang_sources.py` script has been run as part -of building glslang. You must also take note of the glslang install directory -and pass it on the CMake command line for building this repository, as -described below. - -Note that this dependency can be ignored if not building the vkcube demo -(CMake option: `-DBUILD_CUBE=OFF`). - ### Build and Install Directories A common convention is to place the build directory in the top directory of @@ -206,6 +185,7 @@ on/off options currently supported by this repository: | -------------------------- | -------- | ------- | -------------------------------------------------------------------------------- | | BUILD_TESTS | All | `OFF` | Controls whether the tests are built. | | BUILD_CUBE | All | `ON` | Controls whether or not the vkcube demo is built. | +| COMPILE_CUBE_SHADERS | All | `OFF` | Controls whether glslang is found and cube's shaders are compiled | | BUILD_VULKANINFO | All | `ON` | Controls whether or not the vulkaninfo utility is built. | | BUILD_ICD | All | `ON` | Controls whether or not the mock ICD is built. | | INSTALL_ICD | All | `OFF` | Controls whether or not the mock ICD is installed as part of the install target. | @@ -333,15 +313,6 @@ location of the loader's install directory: cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ -DVULKAN_LOADER_INSTALL_DIR=absolute_path_to_install_dir .. -#### Using glslang Built from a Repository - -If you do need to build and use your own glslang, build the glslang repository -with the install target and modify your CMake invocation to add the location -of the glslang's install directory: - - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DGLSLANG_INSTALL_DIR=absolute_path_to_install_dir .. - ### Windows Notes #### CMake Visual Studio Generators diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 9b16da31..02674f75 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -15,39 +15,10 @@ # limitations under the License. # ~~~ -set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/..) +set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts") -if (NOT GLSLANG_INSTALL_DIR AND DEFINED ENV{GLSLANG_INSTALL_DIR}) - set(GLSLANG_INSTALL_DIR $ENV{GLSLANG_INSTALL_DIR}) -endif() - -if(GLSLANG_INSTALL_DIR) - message(STATUS "Using GLSLANG_INSTALL_DIR to look for glslangValidator") - find_program(GLSLANG_VALIDATOR names glslangValidator HINTS "${GLSLANG_INSTALL_DIR}/bin") -else() - find_package(Python3 REQUIRED QUIET) - set(GLSLANG_VALIDATOR_NAME "glslangValidator") - message(STATUS "Using cmake find_program to look for glslangValidator") - if(WIN32) - execute_process( - COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-windows-x64-Release.zip) - set(GLSLANG_VALIDATOR_NAME "glslangValidator.exe") - elseif(APPLE) - execute_process(COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-osx-Release.zip) - elseif(UNIX AND NOT APPLE) # i.e. Linux - execute_process(COMMAND ${Python3_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-linux-Release.zip) - endif() - if (WIN32) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/windows/bin") - elseif(APPLE) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/darwin/bin") - else() - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/linux/bin") - endif() - find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS ${PLATFORM_DIR}) -endif() if(UNIX AND NOT APPLE) # i.e. Linux option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) @@ -177,19 +148,23 @@ endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -add_custom_command(COMMENT "Compiling cube vertex shader" - OUTPUT cube.vert.inc - COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.vert.inc - ${PROJECT_SOURCE_DIR}/cube/cube.vert - MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert - DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}) -add_custom_command(COMMENT "Compiling cube fragment shader" - OUTPUT cube.frag.inc - COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.frag.inc - ${PROJECT_SOURCE_DIR}/cube/cube.frag - MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag - DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +if (COMPILE_CUBE_SHADERS) + # Try to find glslang in system paths or in an SDK if the VULKAN_SDK env-var is set + find_program(GLSLANG_VALIDATOR names glslang glslangValidator HINTS $ENV{GLSLANG_INSTALL_DIR} $ENV{VULKAN_SDK}/bin $ENV{VULKAN_SDK}/Bin) + + add_custom_command(COMMENT "Compiling cube vertex shader" + OUTPUT cube.vert.inc + COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.vert.inc + ${PROJECT_SOURCE_DIR}/cube/cube.vert + MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert + DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}) + add_custom_command(COMMENT "Compiling cube fragment shader" + OUTPUT cube.frag.inc + COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.frag.inc + ${PROJECT_SOURCE_DIR}/cube/cube.frag + MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag + DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR}) +endif() if(WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") diff --git a/cube/cube.frag.inc b/cube/cube.frag.inc new file mode 100644 index 00000000..98ff5213 --- /dev/null +++ b/cube/cube.frag.inc @@ -0,0 +1,41 @@ + // 7.9.2888 + 0x07230203,0x00010000,0x00080007,0x00000030,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x00000022,0x0000002a, + 0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47, + 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004, + 0x415f4c47,0x735f4252,0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361, + 0x00040005,0x00000004,0x6e69616d,0x00000000,0x00030005,0x00000009,0x00005864,0x00050005, + 0x0000000b,0x67617266,0x736f705f,0x00000000,0x00030005,0x0000000e,0x00005964,0x00040005, + 0x00000011,0x6d726f6e,0x00006c61,0x00040005,0x00000017,0x6867696c,0x00000074,0x00050005, + 0x00000022,0x61724675,0x6c6f4367,0x0000726f,0x00030005,0x00000027,0x00786574,0x00050005, + 0x0000002a,0x63786574,0x64726f6f,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000001, + 0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047,0x00000027,0x00000022,0x00000000, + 0x00040047,0x00000027,0x00000021,0x00000001,0x00040047,0x0000002a,0x0000001e,0x00000000, + 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, + 0x00040017,0x00000007,0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,0x00000007, + 0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001, + 0x00040020,0x00000016,0x00000007,0x00000006,0x0004002b,0x00000006,0x00000018,0x00000000, + 0x0004002b,0x00000006,0x00000019,0x3ed91687,0x0004002b,0x00000006,0x0000001a,0x3f10e560, + 0x0004002b,0x00000006,0x0000001b,0x3f34fdf4,0x0006002c,0x00000007,0x0000001c,0x00000019, + 0x0000001a,0x0000001b,0x00040017,0x00000020,0x00000006,0x00000004,0x00040020,0x00000021, + 0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022,0x00000003,0x00090019,0x00000024, + 0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b, + 0x00000025,0x00000024,0x00040020,0x00000026,0x00000000,0x00000025,0x0004003b,0x00000026, + 0x00000027,0x00000000,0x00040020,0x00000029,0x00000001,0x00000020,0x0004003b,0x00000029, + 0x0000002a,0x00000001,0x00040017,0x0000002b,0x00000006,0x00000002,0x00050036,0x00000002, + 0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009, + 0x00000007,0x0004003b,0x00000008,0x0000000e,0x00000007,0x0004003b,0x00000008,0x00000011, + 0x00000007,0x0004003b,0x00000016,0x00000017,0x00000007,0x0004003d,0x00000007,0x0000000c, + 0x0000000b,0x000400cf,0x00000007,0x0000000d,0x0000000c,0x0003003e,0x00000009,0x0000000d, + 0x0004003d,0x00000007,0x0000000f,0x0000000b,0x000400d0,0x00000007,0x00000010,0x0000000f, + 0x0003003e,0x0000000e,0x00000010,0x0004003d,0x00000007,0x00000012,0x00000009,0x0004003d, + 0x00000007,0x00000013,0x0000000e,0x0007000c,0x00000007,0x00000014,0x00000001,0x00000044, + 0x00000012,0x00000013,0x0006000c,0x00000007,0x00000015,0x00000001,0x00000045,0x00000014, + 0x0003003e,0x00000011,0x00000015,0x0004003d,0x00000007,0x0000001d,0x00000011,0x00050094, + 0x00000006,0x0000001e,0x0000001c,0x0000001d,0x0007000c,0x00000006,0x0000001f,0x00000001, + 0x00000028,0x00000018,0x0000001e,0x0003003e,0x00000017,0x0000001f,0x0004003d,0x00000006, + 0x00000023,0x00000017,0x0004003d,0x00000025,0x00000028,0x00000027,0x0004003d,0x00000020, + 0x0000002c,0x0000002a,0x0007004f,0x0000002b,0x0000002d,0x0000002c,0x0000002c,0x00000000, + 0x00000001,0x00050057,0x00000020,0x0000002e,0x00000028,0x0000002d,0x0005008e,0x00000020, + 0x0000002f,0x0000002e,0x00000023,0x0003003e,0x00000022,0x0000002f,0x000100fd,0x00010038 diff --git a/cube/cube.vert.inc b/cube/cube.vert.inc new file mode 100644 index 00000000..5d029c64 --- /dev/null +++ b/cube/cube.vert.inc @@ -0,0 +1,50 @@ + // 7.9.2888 + 0x07230203,0x00010000,0x00080007,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00000015,0x0000001e, + 0x0000002b,0x00030003,0x00000002,0x00000190,0x00090004,0x415f4c47,0x735f4252,0x72617065, + 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00090004,0x415f4c47,0x735f4252, + 0x69646168,0x6c5f676e,0x75676e61,0x5f656761,0x70303234,0x006b6361,0x00040005,0x00000004, + 0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000,0x00030005, + 0x0000000f,0x00667562,0x00040006,0x0000000f,0x00000000,0x0050564d,0x00060006,0x0000000f, + 0x00000001,0x69736f70,0x6e6f6974,0x00000000,0x00050006,0x0000000f,0x00000002,0x72747461, + 0x00000000,0x00040005,0x00000011,0x66756275,0x00000000,0x00060005,0x00000015,0x565f6c67, + 0x65747265,0x646e4978,0x00007865,0x00060005,0x0000001c,0x505f6c67,0x65567265,0x78657472, + 0x00000000,0x00060006,0x0000001c,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00070006, + 0x0000001c,0x00000001,0x505f6c67,0x746e696f,0x657a6953,0x00000000,0x00070006,0x0000001c, + 0x00000002,0x435f6c67,0x4470696c,0x61747369,0x0065636e,0x00030005,0x0000001e,0x00000000, + 0x00050005,0x0000002b,0x67617266,0x736f705f,0x00000000,0x00040047,0x00000009,0x0000001e, + 0x00000000,0x00040047,0x0000000d,0x00000006,0x00000010,0x00040047,0x0000000e,0x00000006, + 0x00000010,0x00040048,0x0000000f,0x00000000,0x00000005,0x00050048,0x0000000f,0x00000000, + 0x00000023,0x00000000,0x00050048,0x0000000f,0x00000000,0x00000007,0x00000010,0x00050048, + 0x0000000f,0x00000001,0x00000023,0x00000040,0x00050048,0x0000000f,0x00000002,0x00000023, + 0x00000280,0x00030047,0x0000000f,0x00000002,0x00040047,0x00000011,0x00000022,0x00000000, + 0x00040047,0x00000011,0x00000021,0x00000000,0x00040047,0x00000015,0x0000000b,0x0000002a, + 0x00050048,0x0000001c,0x00000000,0x0000000b,0x00000000,0x00050048,0x0000001c,0x00000001, + 0x0000000b,0x00000001,0x00050048,0x0000001c,0x00000002,0x0000000b,0x00000003,0x00030047, + 0x0000001c,0x00000002,0x00040047,0x0000002b,0x0000001e,0x00000001,0x00020013,0x00000002, + 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007, + 0x00000006,0x00000004,0x00040020,0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008, + 0x00000009,0x00000003,0x00040018,0x0000000a,0x00000007,0x00000004,0x00040015,0x0000000b, + 0x00000020,0x00000000,0x0004002b,0x0000000b,0x0000000c,0x00000024,0x0004001c,0x0000000d, + 0x00000007,0x0000000c,0x0004001c,0x0000000e,0x00000007,0x0000000c,0x0005001e,0x0000000f, + 0x0000000a,0x0000000d,0x0000000e,0x00040020,0x00000010,0x00000002,0x0000000f,0x0004003b, + 0x00000010,0x00000011,0x00000002,0x00040015,0x00000012,0x00000020,0x00000001,0x0004002b, + 0x00000012,0x00000013,0x00000002,0x00040020,0x00000014,0x00000001,0x00000012,0x0004003b, + 0x00000014,0x00000015,0x00000001,0x00040020,0x00000017,0x00000002,0x00000007,0x0004002b, + 0x0000000b,0x0000001a,0x00000001,0x0004001c,0x0000001b,0x00000006,0x0000001a,0x0005001e, + 0x0000001c,0x00000007,0x00000006,0x0000001b,0x00040020,0x0000001d,0x00000003,0x0000001c, + 0x0004003b,0x0000001d,0x0000001e,0x00000003,0x0004002b,0x00000012,0x0000001f,0x00000000, + 0x00040020,0x00000020,0x00000002,0x0000000a,0x0004002b,0x00000012,0x00000023,0x00000001, + 0x00040017,0x00000029,0x00000006,0x00000003,0x00040020,0x0000002a,0x00000003,0x00000029, + 0x0004003b,0x0000002a,0x0000002b,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000, + 0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000012,0x00000016,0x00000015,0x00060041, + 0x00000017,0x00000018,0x00000011,0x00000013,0x00000016,0x0004003d,0x00000007,0x00000019, + 0x00000018,0x0003003e,0x00000009,0x00000019,0x00050041,0x00000020,0x00000021,0x00000011, + 0x0000001f,0x0004003d,0x0000000a,0x00000022,0x00000021,0x0004003d,0x00000012,0x00000024, + 0x00000015,0x00060041,0x00000017,0x00000025,0x00000011,0x00000023,0x00000024,0x0004003d, + 0x00000007,0x00000026,0x00000025,0x00050091,0x00000007,0x00000027,0x00000022,0x00000026, + 0x00050041,0x00000008,0x00000028,0x0000001e,0x0000001f,0x0003003e,0x00000028,0x00000027, + 0x00050041,0x00000008,0x0000002c,0x0000001e,0x0000001f,0x0004003d,0x00000007,0x0000002d, + 0x0000002c,0x0008004f,0x00000029,0x0000002e,0x0000002d,0x0000002d,0x00000000,0x00000001, + 0x00000002,0x0003003e,0x0000002b,0x0000002e,0x000100fd,0x00010038 diff --git a/scripts/fetch_glslangvalidator.py b/scripts/fetch_glslangvalidator.py deleted file mode 100755 index 936def89..00000000 --- a/scripts/fetch_glslangvalidator.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2018 The Khronos Group Inc. -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Author: Mark Lobodzinski - - -# This script will download the latest glslang release binary and extract the -# glslangValidator binary needed by the vkcube and vkcubepp applications. -# -# It takes as its lone argument the filname (no path) describing the release -# binary name from the glslang github releases page. - -import sys -import os -import shutil -import ssl -import subprocess -import urllib.request -import zipfile -import platform - -SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__)) -REPO_DIR = os.path.join(SCRIPTS_DIR, '..') -GLSLANG_URL = "https://github.com/KhronosGroup/glslang/releases/download/7.9.2888" - -def platformDir(): return platform.system().lower() - -if __name__ == '__main__': - if len(sys.argv) != 2: - print("ERROR -- must include a single glslang release zipfile name argument") - sys.exit(); - - GLSLANG_FILENAME = sys.argv[1] - GLSLANG_COMPLETE_URL = GLSLANG_URL + "/" + GLSLANG_FILENAME - GLSLANG_OUTFILENAME = os.path.join(REPO_DIR, "glslang", GLSLANG_FILENAME) - GLSLANG_DIR = os.path.join(REPO_DIR, "glslang", platformDir()) - GLSLANG_VALIDATOR_PATH = os.path.join(GLSLANG_DIR, "bin") - GLSLANG_VALIDATOR_FULL_PATH = os.path.join(GLSLANG_VALIDATOR_PATH, "glslangValidator") - if platform.system() == 'Windows': - GLSLANG_VALIDATOR_FULL_PATH = GLSLANG_VALIDATOR_FULL_PATH + '.exe' - - if os.path.isdir(GLSLANG_DIR): - if os.path.exists(GLSLANG_VALIDATOR_FULL_PATH): - print(" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH) - sys.exit() - else: - os.makedirs(GLSLANG_DIR) - print(" Downloading glslangValidator binary from glslang releases dir") - sys.stdout.flush() - - # Download release zip file from glslang github releases site - with urllib.request.urlopen(GLSLANG_COMPLETE_URL, context=ssl._create_unverified_context()) as response, open(GLSLANG_OUTFILENAME, 'wb') as out_file: - shutil.copyfileobj(response, out_file) - # Unzip the glslang binary archive - zipped_file = zipfile.ZipFile(GLSLANG_OUTFILENAME, 'r') - namelist = zipped_file.namelist() - for afile in namelist: - if "glslangValidator" in afile: - EXE_FILE_PATH = os.path.join(GLSLANG_DIR, afile) - zipped_file.extract(afile, GLSLANG_DIR) - os.chmod(EXE_FILE_PATH, 0o775) - break - zipped_file.close() - sys.exit(); From 54f0d66861b0586e49c0b6b2e301d44cdfe86a30 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Fri, 25 Aug 2023 10:53:04 -0600 Subject: [PATCH 23/56] build: Use Vulkan-Loader find_package support The Vulkan-Loader now supports find_package properly, allowing this repo to drop the ad-hoc creation of the Vulkan::Vulkan target. --- CMakeLists.txt | 8 +------- cube/CMakeLists.txt | 10 +++++----- cube/macOS/cube/cube.cmake | 2 +- cube/macOS/cubepp/cubepp.cmake | 2 +- scripts/known_good.json | 2 +- tests/CMakeLists.txt | 19 ++----------------- vulkaninfo/CMakeLists.txt | 2 +- 7 files changed, 12 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57d05a39..efc3f1e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,13 +66,7 @@ if(APPLE) endif() find_package(VulkanHeaders REQUIRED CONFIG) - -# Find and create the Vulkan::Vulkan library -find_library(Vulkan_LIBRARY NAMES vulkan vulkan-1) -add_library(Vulkan::Vulkan UNKNOWN IMPORTED) -set_target_properties(Vulkan::Vulkan PROPERTIES - IMPORTED_LOCATION ${Vulkan_LIBRARY}) -target_link_libraries(Vulkan::Vulkan INTERFACE Vulkan::Headers) +find_package(VulkanLoader REQUIRED CONFIG) include(GNUInstallDirs) diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 02674f75..1fa75d7f 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -186,7 +186,7 @@ elseif(NOT WIN32) cube.vert.inc cube.frag.inc ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube Vulkan::Vulkan) + target_link_libraries(vkcube Vulkan::Headers Vulkan::Loader) target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) @@ -212,7 +212,7 @@ else() ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc) - target_link_libraries(vkcube Vulkan::Vulkan) + target_link_libraries(vkcube Vulkan::Headers Vulkan::Loader) endif() if(APPLE) @@ -241,7 +241,7 @@ elseif(NOT WIN32) cube.vert.inc cube.frag.inc ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcubepp Vulkan::Vulkan) + target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader) target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) if (ENABLE_ADDRESS_SANITIZER) @@ -262,7 +262,7 @@ else() ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc) - target_link_libraries(vkcubepp Vulkan::Vulkan) + target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader) endif() if(APPLE) @@ -298,7 +298,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux cube.vert.inc cube.frag.inc ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube-wayland Vulkan::Vulkan) + target_link_libraries(vkcube-wayland Vulkan::Headers Vulkan::Loader) target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake index 9b823f95..ee98135d 100644 --- a/cube/macOS/cube/cube.cmake +++ b/cube/macOS/cube/cube.cmake @@ -55,7 +55,7 @@ add_dependencies(vkcube MoltenVK_icd-staging-json) target_include_directories(vkcube PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include) # We do this so vulkaninfo is linked to an individual library and NOT a framework. -target_link_libraries(vkcube ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore") +target_link_libraries(vkcube Vulkan::Loader "-framework Cocoa -framework QuartzCore") set_target_properties(vkcube PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Info.plist) diff --git a/cube/macOS/cubepp/cubepp.cmake b/cube/macOS/cubepp/cubepp.cmake index eae4de3c..4ff82b6b 100644 --- a/cube/macOS/cubepp/cubepp.cmake +++ b/cube/macOS/cubepp/cubepp.cmake @@ -57,7 +57,7 @@ add_dependencies(vkcubepp MoltenVK_icd-staging-json) target_include_directories(vkcubepp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include) # We do this so vulkaninfo is linked to an individual library and NOT a framework. -target_link_libraries(vkcubepp ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore") +target_link_libraries(vkcubepp Vulkan::Loader "-framework Cocoa -framework QuartzCore") set_target_properties(vkcubepp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Info.plist) diff --git a/scripts/known_good.json b/scripts/known_good.json index 6eed5f45..239693ff 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -32,7 +32,7 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", - "commit": "v1.3.264", + "commit": "d40385b1748ae5270fcab18c5aae1a2e5a301465", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d95b00a9..a543e86c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,21 +15,6 @@ # limitations under the License. # ~~~ -# On Windows, We only need the .lib to build the repo, but to run tests we need the .dll. -# Thus, we have to fixup the Vulkan::Vulkan target to contain the correct details. -if (WIN32) - list(APPEND CMAKE_PROGRAM_PATH ${VULKAN_LOADER_INSTALL_DIR}) - - find_program(Vulkan_LIBRARY_DLL NAMES vulkan-1.dll) - find_library(Vulkan_LIBRARY_IMPLIB NAMES vulkan-1) - - # Change Vulkan::Vulkan's location to vulkan-1.dll and set the IMPLIB to vulkan-1.lib - set_target_properties(Vulkan::Vulkan PROPERTIES - IMPORTED_LOCATION ${Vulkan_LIBRARY_DLL}) - set_target_properties(Vulkan::Vulkan PROPERTIES - IMPORTED_IMPLIB ${Vulkan_LIBRARY_IMPLIB}) -endif() - # setup binary_locations_$.h.in using binary_locations.h.in as a source file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$.h" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/binary_locations.h.in") @@ -57,7 +42,7 @@ get_target_property(TEST_SOURCES vulkan_tools_tests SOURCES) source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${TEST_SOURCES}) target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Vulkan) +target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Headers Vulkan::Loader) add_dependencies(vulkan_tools_tests generate_binary_locations) if (WIN32) target_compile_definitions(vulkan_tools_tests PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -DNOMINMAX) @@ -72,7 +57,7 @@ endif () if (WIN32) # Copy the loader shared lib (if built) to the test application directory so the test app finds it. add_custom_command(TARGET vulkan_tools_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ $) + COMMAND ${CMAKE_COMMAND} -E copy $ $) endif() include(GoogleTest) diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 68900286..6ac7ef21 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -104,7 +104,7 @@ endif() if(APPLE) # We do this so vulkaninfo is linked to an individual library and NOT a framework. - target_link_libraries(vulkaninfo ${Vulkan_LIBRARY} "-framework AppKit -framework QuartzCore") + target_link_libraries(vulkaninfo Vulkan::Loader "-framework AppKit -framework QuartzCore") target_include_directories(vulkaninfo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo) endif() From 8a9f85e7125615995af864fd47f5e64e0aa9bc9c Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Wed, 13 Sep 2023 14:03:22 -0600 Subject: [PATCH 24/56] test: Turn windows tests on in github CI Now that the Vulkan-Loader's find_package support is available, this repo can enable testing on windows and have it work. Github actions runs everything in 'admin mode' which causes the loader to ignore environment variables, which is how the tests find MockICD. Thus, to work around this behavior we build the loader with LOADER_USE_UNSAFE_FILE_SEARCH so that it will use environment variables again. --- .github/workflows/tools.yml | 6 +++++- scripts/known_good.json | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index f3771964..dad2ec9c 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -116,7 +116,7 @@ jobs: arch: ${{ matrix.arch }} - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON - name: Build run: cmake --build ./build @@ -124,6 +124,10 @@ jobs: - name: Install run: cmake --install build/ --prefix build/install + - name: Test + working-directory: ./build + run: ctest --output-on-failure + - name: Verify generated source files run: python scripts/generate_source.py --verify external/${{matrix.config}}/Vulkan-Headers/build/install/share/vulkan/registry diff --git a/scripts/known_good.json b/scripts/known_good.json index 239693ff..bbba09d8 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -32,6 +32,9 @@ "sub_dir": "Vulkan-Loader", "build_dir": "Vulkan-Loader/build", "install_dir": "Vulkan-Loader/build/install", + "cmake_options": [ + "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" + ], "commit": "d40385b1748ae5270fcab18c5aae1a2e5a301465", "deps": [ { From 6944374dff6d0f9aa9735ca38811ffa6437d955f Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Fri, 22 Sep 2023 09:02:24 -0600 Subject: [PATCH 25/56] cube: Fix shader compilation destination The build step to compile shaders put them in the build directory rather than the source directory. --- cube/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 1fa75d7f..85b0890d 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -153,13 +153,13 @@ if (COMPILE_CUBE_SHADERS) find_program(GLSLANG_VALIDATOR names glslang glslangValidator HINTS $ENV{GLSLANG_INSTALL_DIR} $ENV{VULKAN_SDK}/bin $ENV{VULKAN_SDK}/Bin) add_custom_command(COMMENT "Compiling cube vertex shader" - OUTPUT cube.vert.inc + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cube.vert.inc COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.vert.inc ${PROJECT_SOURCE_DIR}/cube/cube.vert MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}) add_custom_command(COMMENT "Compiling cube fragment shader" - OUTPUT cube.frag.inc + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cube.frag.inc COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_SOURCE_DIR}/cube.frag.inc ${PROJECT_SOURCE_DIR}/cube/cube.frag MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag From 9616098f617c4a53ecb72a1456bb229989e2d0e4 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 22 Sep 2023 11:43:06 -0600 Subject: [PATCH 26/56] cmake: Fix ICD json logic closes #861 --- BUILD.gn | 80 +++---- CMakeLists.txt | 3 - build-gn/generate_vulkan_layers_json.py | 36 ++-- icd/CMakeLists.txt | 200 ++++++++---------- ...D_mock_icd.json => VkICD_mock_icd.json.in} | 3 +- icd/linux/VkICD_mock_icd.json | 12 -- icd/windows/VkICD_mock_icd.json | 12 -- 7 files changed, 137 insertions(+), 209 deletions(-) rename icd/{macos/VkICD_mock_icd.json => VkICD_mock_icd.json.in} (63%) delete mode 100644 icd/linux/VkICD_mock_icd.json delete mode 100644 icd/windows/VkICD_mock_icd.json diff --git a/BUILD.gn b/BUILD.gn index 40cd58f9..3144bd28 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,5 +1,5 @@ # Copyright (C) 2018-2019 The ANGLE Project Authors. -# Copyright (C) 2019, 2023 LunarG, Inc. +# Copyright (C) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,32 +16,6 @@ import("//build_overrides/build.gni") import("//build_overrides/vulkan_tools.gni") -# Vulkan-tools isn't ported to Fuchsia yet. -# TODO(spang): Port mock ICD to Fuchsia. -assert(!is_fuchsia) - -config("vulkan_internal_config") { - defines = [ "VULKAN_NON_CMAKE_BUILD" ] - if (is_clang || !is_win) { - cflags = [ "-Wno-unused-function" ] - } - if (is_linux || is_chromeos) { - defines += [ - "SYSCONFDIR=\"/etc\"", - "FALLBACK_CONFIG_DIRS=\"/etc/xdg\"", - "FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"", - ] - } -} - -# Vulkan tool generated utility headers -source_set("vulkan_tools_headers") { - public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] - sources = [ - "icd/generated/vk_typemap_helper.h", - ] -} - if (!is_android) { vulkan_undefine_configs = [] if (is_win && build_with_chromium) { @@ -51,23 +25,20 @@ if (!is_android) { ] } - raw_vulkan_icd_dir = rebase_path("icd", root_build_dir) - - vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir" - raw_vulkan_data_dir = rebase_path(vulkan_data_dir, root_build_dir) - # Vulkan Mock ICD # --------------- shared_library("VkICD_mock_icd") { configs -= vulkan_undefine_configs - deps = [ ":vulkan_tools_headers" ] - public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] + deps = [ + "$vulkan_headers_dir:vulkan_headers" + ] data_deps = [ ":vulkan_gen_icd_json_file" ] sources = [ "icd/mock_icd.h", "icd/mock_icd.cpp", "icd/generated/function_declarations.h", "icd/generated/function_definitions.h", + "icd/generated/vk_typemap_helper.h", ] include_dirs = [ "icd", @@ -84,25 +55,34 @@ if (!is_android) { action("vulkan_gen_icd_json_file") { script = "build-gn/generate_vulkan_layers_json.py" + public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] - sources = [ "$vulkan_headers_dir/include/vulkan/vulkan_core.h" ] - args = [ "--icd" ] - if (is_win) { - sources += [ "icd/windows/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/windows" ] - } - if (is_linux || is_chromeos) { - sources += [ "icd/linux/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/linux" ] - } - if (is_mac) { - sources += [ "icd/macos/VkICD_mock_icd.json" ] - args += [ "$raw_vulkan_icd_dir/macos" ] - } - # The layer JSON files are part of the necessary data deps. + sources = [ "icd/VkICD_mock_icd.json.in" ] + + vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir" + outputs = [ "$vulkan_data_dir/VkICD_mock_icd.json" ] + + if (is_linux) { + _platform = "Linux" + } else if (is_win) { + _platform = "Windows" + } else if (is_mac) { + _platform = "Darwin" + } else if (is_fuchsia) { + _platform = "Fuchsia" + } else { + _platform = "Other" + } + + args = [ + "--icd", + "--platform", _platform, + rebase_path("icd/", root_build_dir), + rebase_path(vulkan_data_dir, root_build_dir) + ] + rebase_path(sources, root_build_dir) + data = outputs - args += [ raw_vulkan_data_dir ] + rebase_path(sources, root_build_dir) } } diff --git a/CMakeLists.txt b/CMakeLists.txt index efc3f1e8..67dfd348 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") option(BUILD_CUBE "Build cube" ON) option(BUILD_VULKANINFO "Build vulkaninfo" ON) option(BUILD_ICD "Build icd" ON) -# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. -# Require the user to ask that it be installed if they really want it. -option(INSTALL_ICD "Install icd" OFF) if (UNIX AND NOT APPLE) # i.e. Linux option(ENABLE_ADDRESS_SANITIZER "Use addres sanitization" OFF) diff --git a/build-gn/generate_vulkan_layers_json.py b/build-gn/generate_vulkan_layers_json.py index 93d105b6..c4135db4 100755 --- a/build-gn/generate_vulkan_layers_json.py +++ b/build-gn/generate_vulkan_layers_json.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2016 The ANGLE Project Authors. +# Copyright (c) 2022-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,18 +27,19 @@ import platform import sys - def glob_slash(dirname): """Like regular glob but replaces \ with / in returned paths.""" return [s.replace('\\', '/') for s in glob.glob(dirname)] - def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--icd', action='store_true') + parser.add_argument('--no-path-prefix', action='store_true') + parser.add_argument('--platform', type=str, default=platform.system(), + help='Target platform to build validation layers for: ' + 'Linux|Darwin|Windows|Fuchsia|...') parser.add_argument('source_dir') parser.add_argument('target_dir') - parser.add_argument('version_header', help='path to vulkan_core.h') parser.add_argument('json_files', nargs='*') args = parser.parse_args() @@ -82,25 +84,17 @@ def main(): with open(target_fname, 'w') as outfile: json.dump(data, outfile) - # Get the Vulkan version from the vulkan_core.h file - vk_header_filename = args.version_header - vk_version = None - with open(vk_header_filename) as vk_header_file: - for line in vk_header_file: - if line.startswith('#define VK_HEADER_VERSION'): - vk_version = line.split()[-1] - break - if not vk_version: - print('failed to extract vk_version', file=sys.stderr) - return 1 - # Set json file prefix and suffix for generating files, default to Linux. - relative_path_prefix = '../lib' - file_type_suffix = '.so' - if platform.system() == 'Windows': + if args.no_path_prefix: + relative_path_prefix = '' + elif args.platform == 'Windows': relative_path_prefix = r'..\\' # json-escaped, hence two backslashes. + else: + relative_path_prefix = '../lib' + file_type_suffix = '.so' + if args.platform == 'Windows': file_type_suffix = '.dll' - elif platform.system() == 'Darwin': + elif args.platform == 'Darwin': file_type_suffix = '.dylib' # For each *.json.in template files in source dir generate actual json file @@ -119,9 +113,7 @@ def main(): with open(json_out_fname,'w') as json_out_file, \ open(json_in_name) as infile: for line in infile: - line = line.replace('@RELATIVE_LAYER_BINARY@', - relative_path_prefix + layer_lib_name) - line = line.replace('@VK_VERSION@', '1.1.' + vk_version) + line = line.replace('@JSON_LIBRARY_PATH@', relative_path_prefix + layer_lib_name) json_out_file.write(line) if __name__ == '__main__': diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index 3311f572..f36849de 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -16,6 +16,10 @@ # limitations under the License. # ~~~ +if (ANDROID) + return() +endif() + # These variables enable downstream users to customize the CMake targets # based on the target API variant (e.g. Vulkan SC) set(MOCK_ICD_NAME VkICD_mock_icd) @@ -23,8 +27,6 @@ set(GENERATED generated) if(WIN32) add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN) -elseif(ANDROID) - add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR -DVK_USE_PLATFORM_ANDROID_KHX) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_MACOS_MVK) elseif(UNIX AND NOT APPLE) # i.e. Linux @@ -43,128 +45,110 @@ else() message(FATAL_ERROR "Unsupported Platform!") endif() -# Copy or link the JSON files to the binary directory for ease of use in the build tree. -if(WIN32) - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json src_json) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$/${MOCK_ICD_NAME}.json dst_json) - add_custom_target(VkICD_mock_icd-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM) - set_target_properties(VkICD_mock_icd-json PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - else() - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json src_json) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${MOCK_ICD_NAME}.json dst_json) - add_custom_target(VkICD_mock_icd-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM) - endif() - endif() -elseif(APPLE) - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - if(CMAKE_GENERATOR MATCHES "^Xcode.*") - add_custom_target(mk_icd_config_dir ALL - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/$) - add_custom_target(VkICD_mock_icd-json ALL - DEPENDS mk_icd_config_dir - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/macos/${MOCK_ICD_NAME}.json - $ ${CMAKE_CURRENT_BINARY_DIR}/$/${MOCK_ICD_NAME}.json - VERBATIM) - else() - add_custom_target(VkICD_mock_icd-json ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/macos/${MOCK_ICD_NAME}.json - ${MOCK_ICD_NAME}.json - VERBATIM) - endif() +add_custom_target(generate_icd_files + DEPENDS mock_icd.cpp ${GENERATED}/function_definitions.h ${GENERATED}/function_declarations.h +) +set_target_properties( + generate_icd_files PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER} +) + +add_library(VkICD_mock_icd MODULE) +target_sources(VkICD_mock_icd PRIVATE mock_icd.cpp) +target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) + +target_include_directories(VkICD_mock_icd PRIVATE + ${GENERATED} + . +) +if(BUILD_WSI_WAYLAND_SUPPORT) + target_include_directories(VkICD_mock_icd PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR}) +endif() + +if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang") + target_compile_options(VkICD_mock_icd PRIVATE + -Wpointer-arith + -Wno-unused-function + -Wno-sign-compare + ) + + if (ENABLE_ADDRESS_SANITIZER) + target_compile_options(VkICD_mock_icd PUBLIC -fsanitize=address) + target_link_options(VkICD_mock_icd PUBLIC -fsanitize=address) endif() +endif() + +if(MSVC) + target_compile_options(VkICD_mock_icd PRIVATE /bigobj) + target_compile_definitions(VkICD_mock_icd PRIVATE _CRT_SECURE_NO_WARNINGS) + target_link_options(VkICD_mock_icd PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def) +elseif(MINGW) + target_sources(VkICD_mock_icd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def) else() - # extra setup for out-of-tree builds - if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - add_custom_target(VkICD_mock_icd-json ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json - ${MOCK_ICD_NAME}.json - VERBATIM) + if(APPLE) + set_target_properties(VkICD_mock_icd PROPERTIES SUFFIX ".dylib") endif() + message(DEBUG "Mock ICD Functions are exported via EXPORT") endif() -# For ICD with a direct dependency on a project with the same name, use it. -if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) - add_dependencies(VkICD_mock_icd-json VkICD_mock_icd) +set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME}) + +# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. +# Require the user to ask that it be installed if they really want it. +option(INSTALL_ICD "Install icd") +if (INSTALL_ICD) + message(STATUS "Installing Mock ICD") endif() -add_custom_target(generate_icd_files DEPENDS mock_icd.cpp ${GENERATED}/function_definitions.h ${GENERATED}/function_declarations.h) -set_target_properties(generate_icd_files PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATED} - ${CMAKE_CURRENT_BINARY_DIR} - ${PROJECT_BINARY_DIR} - ${CMAKE_BINARY_DIR}) -if(BUILD_WSI_WAYLAND_SUPPORT) - include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + +# There are 2 primary deliverables for the mock driver. +# - The actual library (lib)VkICD_mock_icd.(dll|so|dylib) +# - The respective json file, VkICD_mock_icd.json +# This code generates the appropriate json for both local testing and the installation. +# NOTE: For WIN32 the JSON and dll MUST be placed in the same location, due to Win32 using a relative path for installation. +set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.json.in") +set(INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/mock_icd.json") +set(OUTPUT_FILE_FINAL_NAME "${MOCK_ICD_NAME}.json") +set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) +if (WIN32) + set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}) # WIN32/MINGW expect the dll in the `bin` dir, this matches our WIN32 SDK process endif() -if(WIN32) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") - # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015. The changed behavior is - # that constructor initializers are now fixed to clear the struct members. - add_compile_options("$<$,$,19>>:/wd4351>") +if (WIN32) + set(JSON_LIBRARY_PATH ".\\\\${MOCK_ICD_NAME}.dll") +elseif(APPLE) + set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.dylib") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") + set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.so") endif() +configure_file(${INPUT_FILE} ${INTERMEDIATE_FILE} @ONLY) -if(WIN32) - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def DEF_FILE) - add_custom_target(copy-mock_icd-def-file ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} ${MOCK_ICD_NAME}.def - VERBATIM) - set_target_properties(copy-mock_icd-def-file PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER}) - add_library(VkICD_mock_icd SHARED mock_icd.cpp ${MOCK_ICD_NAME}.def) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - if(INSTALL_ICD) - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() -elseif(APPLE) - add_library(VkICD_mock_icd SHARED mock_icd.cpp ) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - set_target_properties(VkICD_mock_icd PROPERTIES LINK_FLAGS "-Wl") - if(INSTALL_ICD) - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +# To support both multi/single configuration generators just copy the json to the correct directory +add_custom_command(TARGET VkICD_mock_icd POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $/${OUTPUT_FILE_FINAL_NAME} +) + +# For UNIX-based systems, `library_path` should not contain a relative path (indicated by "./") before installing to system directories +# This json isn't used for regular local development, it's used for installation +if (UNIX) + set(UNIX_INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/unix_install_mock_icd.json") + + if(APPLE) + set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.dylib") + else() + set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.so") endif() -else() - add_library(VkICD_mock_icd SHARED mock_icd.cpp ) - target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) - set_target_properties(VkICD_mock_icd PROPERTIES LINK_FLAGS "-Wl,-export-dynamic,-Bsymbolic,--exclude-libs,ALL") - if((UNIX AND NOT APPLE) AND INSTALL_ICD) # i.e. Linux - install(TARGETS VkICD_mock_icd DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + configure_file(${INPUT_FILE} ${UNIX_INTERMEDIATE_FILE} @ONLY) + + if (INSTALL_ICD) + install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() - if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(VkICD_mock_icd PUBLIC -fsanitize=address) - target_link_options(VkICD_mock_icd PUBLIC -fsanitize=address) - endif () endif() -set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME}) - -# JSON file(s) install targets. For Linux, need to remove the "./" from the library path before installing to system directories. -if((UNIX AND NOT APPLE) AND INSTALL_ICD) # i.e. Linux - add_custom_target(VkICD_mock_icd-staging-json ALL - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json - COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json - COMMAND sed -i -e "/\"library_path\":/s$./libVkICD$libVkICD$" - ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${MOCK_ICD_NAME}.json - VERBATIM - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${MOCK_ICD_NAME}.json) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${MOCK_ICD_NAME}.json - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${API_TYPE}/icd.d) +if (WIN32 AND INSTALL_ICD) + install(FILES ${INTERMEDIATE_FILE} DESTINATION ${LAYER_INSTALL_DIR} RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() -# Windows uses the JSON file as-is. -if(WIN32 AND INSTALL_ICD) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/windows/${MOCK_ICD_NAME}.json DESTINATION ${CMAKE_INSTALL_BINDIR}) +if (INSTALL_ICD) + install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR}) endif() diff --git a/icd/macos/VkICD_mock_icd.json b/icd/VkICD_mock_icd.json.in similarity index 63% rename from icd/macos/VkICD_mock_icd.json rename to icd/VkICD_mock_icd.json.in index 71019868..f550bb27 100644 --- a/icd/macos/VkICD_mock_icd.json +++ b/icd/VkICD_mock_icd.json.in @@ -1,8 +1,7 @@ { "file_format_version" : "1.0.1", "ICD": { - "library_path": "./libVkICD_mock_icd.dylib", + "library_path": "@JSON_LIBRARY_PATH@", "api_version": "1.1.97" } } - diff --git a/icd/linux/VkICD_mock_icd.json b/icd/linux/VkICD_mock_icd.json deleted file mode 100644 index bf32f8e6..00000000 --- a/icd/linux/VkICD_mock_icd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "file_format_version" : "1.0.1", - "ICD": { - "library_path": "./libVkICD_mock_icd.so", - "api_version": "1.1.97" - } -} - - - - - diff --git a/icd/windows/VkICD_mock_icd.json b/icd/windows/VkICD_mock_icd.json deleted file mode 100644 index d192f5c2..00000000 --- a/icd/windows/VkICD_mock_icd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "file_format_version" : "1.0.1", - "ICD": { - "library_path": ".\\VkICD_mock_icd.dll", - "api_version": "1.1.97" - } -} - - - - - From c92c1e0654045eccca6a7f2559102d5264ee938f Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 22 Sep 2023 12:52:13 -0600 Subject: [PATCH 27/56] cmake: Remove generate_icd_files Does nothing --- icd/CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index f36849de..1183c074 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -45,13 +45,6 @@ else() message(FATAL_ERROR "Unsupported Platform!") endif() -add_custom_target(generate_icd_files - DEPENDS mock_icd.cpp ${GENERATED}/function_definitions.h ${GENERATED}/function_declarations.h -) -set_target_properties( - generate_icd_files PROPERTIES FOLDER ${TOOLS_HELPER_FOLDER} -) - add_library(VkICD_mock_icd MODULE) target_sources(VkICD_mock_icd PRIVATE mock_icd.cpp) target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers) From 520163b4b3f3f6e4696a6355f029d9e05d3bb9cf Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 18 Sep 2023 22:24:49 -0600 Subject: [PATCH 28/56] icd: Add VkPhysicalDeviceDriverProperties This commit adds support for the VkPhysicalDeviceDriverProperties struct in the output of vkGetPhysicalDeviceProperties2. This is useful for users of Mock ICD wishing to know the version of MockICD used. The driverInfo field is used for this purpose and contains the git branch & tag info data. The use of Git in CMake is how the information is seamlessly gotten and provided to the source code in the form of compile definitions. --- CMakeLists.txt | 21 +++++++++++++++++++++ icd/CMakeLists.txt | 4 ++++ icd/generated/function_declarations.h | 1 + icd/generated/function_definitions.h | 12 +++++++++++- scripts/mock_icd_generator.py | 13 ++++++++++++- tests/CMakeLists.txt | 4 ++++ tests/icd/mock_icd_tests.cpp | 8 +++++++- 7 files changed, 60 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67dfd348..bc1ff2c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,27 @@ endif() # Default to using the static CRT set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +# Find the Git branch & tag info for use in Mock ICD +find_package (Git) +if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD") + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags --always + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GIT_TAG_INFO) + string(REGEX REPLACE "\n$" "" GIT_TAG_INFO "${GIT_TAG_INFO}") + + file(READ "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD" GIT_HEAD_REF_INFO) + if (GIT_HEAD_REF_INFO) + string(REGEX MATCH "ref: refs/heads/(.*)" _ ${GIT_HEAD_REF_INFO}) + if (CMAKE_MATCH_1) + set(GIT_BRANCH_NAME ${CMAKE_MATCH_1}) + else() + set(GIT_BRANCH_NAME ${GIT_HEAD_REF_INFO}) + endif() + string(REGEX REPLACE "\n$" "" GIT_BRANCH_NAME "${GIT_BRANCH_NAME}") + endif() +endif() + if(APPLE) include(mac_common.cmake) endif() diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index 1183c074..f59d93cb 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -85,6 +85,10 @@ endif() set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME}) +if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) + target_compile_definitions(VkICD_mock_icd PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") +endif() + # Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. # Require the user to ask that it be installed if they really want it. option(INSTALL_ICD "Install icd") diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 2750e4d4..e5d91626 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -23,6 +23,7 @@ #pragma once #include +#include #include #include #include diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 22dae97e..75620690 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -3008,7 +3008,7 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, }; - auto *host_image_copy_props = lvl_find_mod_in_chain< VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext); + auto *host_image_copy_props = lvl_find_mod_in_chain(pProperties->pNext); if (host_image_copy_props){ if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; else { @@ -3025,6 +3025,16 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR( } } } + + auto *driver_properties = lvl_find_mod_in_chain(pProperties->pNext); + if (driver_properties) { + std::strncpy(driver_properties->driverName, "Vulkan Mock Device", VK_MAX_DRIVER_NAME_SIZE); +#if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) + std::strncpy(driver_properties->driverInfo, "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO, VK_MAX_DRIVER_INFO_SIZE); +#else + std::strncpy(driver_properties->driverInfo, "Branch: --unknown-- Tag Info: --unknown--", VK_MAX_DRIVER_INFO_SIZE); +#endif + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR( diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 6eda0e2e..3de3e540 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -603,7 +603,7 @@ VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, }; - auto *host_image_copy_props = lvl_find_mod_in_chain< VkPhysicalDeviceHostImageCopyPropertiesEXT>(pProperties->pNext); + auto *host_image_copy_props = lvl_find_mod_in_chain(pProperties->pNext); if (host_image_copy_props){ if (host_image_copy_props->pCopyDstLayouts == nullptr) host_image_copy_props->copyDstLayoutCount = num_copy_layouts; else { @@ -620,6 +620,16 @@ } } } + + auto *driver_properties = lvl_find_mod_in_chain(pProperties->pNext); + if (driver_properties) { + std::strncpy(driver_properties->driverName, "Vulkan Mock Device", VK_MAX_DRIVER_NAME_SIZE); +#if defined(GIT_BRANCH_NAME) && defined(GIT_TAG_INFO) + std::strncpy(driver_properties->driverInfo, "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO, VK_MAX_DRIVER_INFO_SIZE); +#else + std::strncpy(driver_properties->driverInfo, "Branch: --unknown-- Tag Info: --unknown--", VK_MAX_DRIVER_INFO_SIZE); +#endif + } ''', 'vkGetPhysicalDeviceExternalSemaphoreProperties':''' // Hard code support for all handle types and features @@ -1224,6 +1234,7 @@ def beginFile(self, genOpts): break write('#pragma once\n',file=self.outFile) write('#include ',file=self.outFile) + write('#include ',file=self.outFile) write('#include ',file=self.outFile) write('#include ',file=self.outFile) write('#include ',file=self.outFile) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a543e86c..0d9fb1b4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -49,6 +49,10 @@ if (WIN32) endif() set_target_properties(vulkan_tools_tests PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) + target_compile_definitions(vulkan_tools_tests PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") +endif() + if (ENABLE_ADDRESS_SANITIZER) target_compile_options(vulkan_tools_tests PUBLIC -fsanitize=address) target_link_options(vulkan_tools_tests PUBLIC -fsanitize=address) diff --git a/tests/icd/mock_icd_tests.cpp b/tests/icd/mock_icd_tests.cpp index bcae57a9..cad067a3 100644 --- a/tests/icd/mock_icd_tests.cpp +++ b/tests/icd/mock_icd_tests.cpp @@ -569,8 +569,12 @@ TEST_F(MockICD, vkGetPhysicalDeviceProperties2) { fragment_density_map2_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT; fragment_density_map2_properties.pNext = static_cast(&mesh_shader_properties); + VkPhysicalDeviceDriverProperties driver_properties{}; + driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; + driver_properties.pNext = static_cast(&fragment_density_map2_properties); + VkPhysicalDeviceProperties2 properties2{}; - properties2.pNext = static_cast(&fragment_density_map2_properties); + properties2.pNext = static_cast(&driver_properties); vkGetPhysicalDeviceProperties2(physical_device, &properties2); ASSERT_EQ(properties2.properties.apiVersion, VK_HEADER_VERSION_COMPLETE); ASSERT_EQ(properties2.properties.driverVersion, 1); @@ -624,6 +628,8 @@ TEST_F(MockICD, vkGetPhysicalDeviceProperties2) { ASSERT_EQ(fragment_density_map2_properties.subsampledCoarseReconstructionEarlyAccess, VK_FALSE); ASSERT_EQ(fragment_density_map2_properties.maxSubsampledArrayLayers, 2); ASSERT_EQ(fragment_density_map2_properties.maxDescriptorSetSubsampledSamplers, 1); + ASSERT_EQ(std::string(driver_properties.driverName), "Vulkan Mock Device"); + ASSERT_EQ(std::string(driver_properties.driverInfo), "Branch: " GIT_BRANCH_NAME " Tag Info: " GIT_TAG_INFO); } TEST_F(MockICD, vkGetPhysicalDeviceExternalSemaphoreProperties) { From 04b4832c8790c32ea15523f4adb219a04a6adbc7 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Mon, 25 Sep 2023 11:18:29 -0700 Subject: [PATCH 29/56] build: Update to header 1.3.265 - Update known-good - Generate source (no change) --- build-android/vulkan-headers_revision_android | 2 +- scripts/known_good.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 25483b07..3e18c7d6 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.264 +v1.3.265 diff --git a/scripts/known_good.json b/scripts/known_good.json index bbba09d8..cc6e084e 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.264" + "commit": "v1.3.265" }, { "name": "MoltenVK", @@ -35,7 +35,7 @@ "cmake_options": [ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], - "commit": "d40385b1748ae5270fcab18c5aae1a2e5a301465", + "commit": "v1.3.265", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", From 576f3286e10ca0c98fc481787b27e229bd61ac8f Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 27 Sep 2023 13:10:36 -0600 Subject: [PATCH 30/56] gn: Fix Chromium build closes #866 --- BUILD.gn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 3144bd28..f280e489 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -83,6 +83,10 @@ if (!is_android) { rebase_path(vulkan_data_dir, root_build_dir) ] + rebase_path(sources, root_build_dir) + if (is_win) { + args += [ "--no-path-prefix" ] + } + data = outputs } } From 65875362ad968b9eff0611b7f32a0cead5ddc9d1 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 29 Sep 2023 10:14:37 -0600 Subject: [PATCH 31/56] cmake: General cleanup - APPEND CMAKE_MODULE_PATH - Remove overly specific CMake code - Use CMAKE_SYSTEM_NAME to detect Linux/BSD - Remove unused code - Simplify install target code - Use PRIVATE instead of PUBLIC - Prefer target based commands --- CMakeLists.txt | 12 ++---------- cube/CMakeLists.txt | 24 ++++++------------------ icd/CMakeLists.txt | 2 +- vulkaninfo/CMakeLists.txt | 31 ++++++++++++++++++------------- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc1ff2c7..6c73e28a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ # limitations under the License. # ~~~ cmake_minimum_required(VERSION 3.17.2) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") project(Vulkan-Tools) @@ -25,19 +26,10 @@ set(API_TYPE "vulkan") add_subdirectory(scripts) -# User-interface declarations ---------------------------------------------------------------------------------------------------- -# This section contains variables that affect development GUIs (e.g. CMake GUI and IDEs), such as option(), folders, and variables -# with the CACHE property. - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - option(BUILD_CUBE "Build cube" ON) option(BUILD_VULKANINFO "Build vulkaninfo" ON) option(BUILD_ICD "Build icd" ON) - -if (UNIX AND NOT APPLE) # i.e. Linux - option(ENABLE_ADDRESS_SANITIZER "Use addres sanitization" OFF) -endif() +option(ENABLE_ADDRESS_SANITIZER "Use address sanitization") if(WIN32) # Optional: Allow specify the exact version used in the vulkaninfo executable diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 85b0890d..c5646469 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -20,7 +20,7 @@ set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts") -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON) @@ -97,7 +97,7 @@ elseif(ANDROID) add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_METAL_EXT) -elseif(UNIX AND NOT APPLE) # i.e. Linux +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(NOT CUBE_WSI_SELECTION) set(CUBE_WSI_SELECTION "XCB") endif() @@ -199,12 +199,6 @@ elseif(NOT WIN32) target_link_options(vkcube PUBLIC -fsanitize=address) endif () else() - if(CMAKE_CL_64) - set(LIB_DIR "Win64") - else() - set(LIB_DIR "Win32") - endif() - add_executable(vkcube WIN32 cube.c @@ -225,7 +219,7 @@ if(APPLE) fixup_bundle(\${CMAKE_INSTALL_PREFIX}/cube/vkcube.app \"\" \"${Vulkan_LIBRARY_DIR}\") ") else() - install(TARGETS vkcube RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcube) endif() # ---------------------------------------------------------------------------- @@ -249,12 +243,6 @@ elseif(NOT WIN32) target_link_options(vkcubepp PUBLIC -fsanitize=address) endif () else() - if(CMAKE_CL_64) - set(LIB_DIR "Win64") - else() - set(LIB_DIR "Win32") - endif() - add_executable(vkcubepp WIN32 cube.cpp @@ -275,13 +263,13 @@ if(APPLE) fixup_bundle(\${CMAKE_INSTALL_PREFIX}/cube/vkcubepp.app \"\" \"${Vulkan_LIBRARY_DIR}\") ") else() - install(TARGETS vkcubepp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcubepp) endif() # ---------------------------------------------------------------------------- # vkcube-wayland -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_WAYLAND_SUPPORT AND EXISTS ${WAYLAND_PROTOCOLS_PATH}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS}) link_libraries(${WAYLAND_CLIENT_LIBRARIES}) @@ -305,7 +293,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux if (NEED_RT) target_link_libraries(vkcube-wayland rt) endif() - install(TARGETS vkcube-wayland RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vkcube-wayland) if (ENABLE_ADDRESS_SANITIZER) target_compile_options(vkcube-wayland PUBLIC -fsanitize=address) diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index f59d93cb..f908906c 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -29,7 +29,7 @@ if(WIN32) add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_MACOS_MVK) -elseif(UNIX AND NOT APPLE) # i.e. Linux +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_XCB_SUPPORT) add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX) endif() diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 6ac7ef21..73947d28 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -63,7 +63,7 @@ endif() target_compile_definitions(vulkaninfo PRIVATE -DVK_ENABLE_BETA_EXTENSIONS) -if(UNIX AND NOT APPLE) # i.e. Linux +if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON) @@ -97,8 +97,8 @@ if(UNIX AND NOT APPLE) # i.e. Linux endif() if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(vulkaninfo PUBLIC -fsanitize=address) - target_link_options(vulkaninfo PUBLIC -fsanitize=address) + target_compile_options(vulkaninfo PRIVATE -fsanitize=address) + target_link_options(vulkaninfo PRIVATE -fsanitize=address) endif () endif() @@ -111,22 +111,27 @@ endif() target_link_libraries(vulkaninfo Vulkan::Headers) if(WIN32) - target_compile_definitions(vulkaninfo PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -DVK_NO_PROTOTYPES) - if(MSVC AND NOT MSVC_VERSION LESS 1900) - # If MSVC, Enable control flow guard - message(STATUS "Building vulkaninfo with control flow guard") - add_compile_options("$<$:/guard:cf>") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") - endif() + target_compile_definitions(vulkaninfo PRIVATE + VK_USE_PLATFORM_WIN32_KHR + WIN32_LEAN_AND_MEAN + _CRT_SECURE_NO_WARNINGS + VK_NO_PROTOTYPES + ) + + message(STATUS "Building vulkaninfo with control flow guard") + target_compile_options(vulkaninfo PRIVATE /guard:cf) + target_link_options(vulkaninfo PRIVATE /guard:cf) elseif(APPLE) - add_definitions(-DVK_USE_PLATFORM_MACOS_MVK -DVK_USE_PLATFORM_METAL_EXT) + target_compile_definitions(vulkaninfo PRIVATE + VK_USE_PLATFORM_MACOS_MVK + VK_USE_PLATFORM_METAL_EXT + ) endif() if(APPLE) install(TARGETS vulkaninfo RUNTIME DESTINATION "vulkaninfo") else() - install(TARGETS vulkaninfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS vulkaninfo) endif() From 8091ef4f9fd4df3aa7192095eca3ae9cbee56198 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 29 Sep 2023 08:03:04 -0700 Subject: [PATCH 32/56] build: Update to header 1.3.266 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- common/vulkan_wrapper.cpp | 5 + icd/generated/function_declarations.h | 36 ++++++ icd/generated/function_definitions.h | 46 +++++++ icd/generated/vk_typemap_helper.h | 114 ++++++++++++++++++ scripts/generate_vulkan_wrapper.py | 13 ++ scripts/known_good.json | 4 +- vulkaninfo/generated/vulkaninfo.hpp | 2 + 8 files changed, 219 insertions(+), 3 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 3e18c7d6..293a60c9 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.265 +v1.3.266 diff --git a/common/vulkan_wrapper.cpp b/common/vulkan_wrapper.cpp index dff9616d..c663f9ee 100644 --- a/common/vulkan_wrapper.cpp +++ b/common/vulkan_wrapper.cpp @@ -1175,6 +1175,11 @@ PFN_vkGetShaderBinaryDataEXT vkGetShaderBinaryDataEXT; PFN_vkCmdBindShadersEXT vkCmdBindShadersEXT; PFN_vkGetFramebufferTilePropertiesQCOM vkGetFramebufferTilePropertiesQCOM; PFN_vkGetDynamicRenderingTilePropertiesQCOM vkGetDynamicRenderingTilePropertiesQCOM; +PFN_vkSetLatencySleepModeNV vkSetLatencySleepModeNV; +PFN_vkLatencySleepNV vkLatencySleepNV; +PFN_vkSetLatencyMarkerNV vkSetLatencyMarkerNV; +PFN_vkGetLatencyTimingsNV vkGetLatencyTimingsNV; +PFN_vkQueueNotifyOutOfBandNV vkQueueNotifyOutOfBandNV; PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT vkCmdSetAttachmentFeedbackLoopEnableEXT; PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR; PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR; diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index e5d91626..1e9e9504 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -354,6 +354,7 @@ static const std::unordered_map device_extension_map = { {"VK_NV_optical_flow", 1}, {"VK_EXT_legacy_dithering", 1}, {"VK_EXT_pipeline_protected_access", 1}, + {"VK_ANDROID_external_format_resolve", 1}, {"VK_KHR_maintenance5", 1}, {"VK_KHR_ray_tracing_position_fetch", 1}, {"VK_EXT_shader_object", 1}, @@ -365,6 +366,7 @@ static const std::unordered_map device_extension_map = { {"VK_ARM_shader_core_builtins", 2}, {"VK_EXT_pipeline_library_group_handles", 1}, {"VK_EXT_dynamic_rendering_unused_attachments", 1}, + {"VK_NV_low_latency2", 1}, {"VK_KHR_cooperative_matrix", 2}, {"VK_QCOM_multiview_per_view_render_areas", 1}, {"VK_QCOM_image_processing2", 1}, @@ -4132,6 +4134,9 @@ static VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT( VkDevice device, @@ -4177,6 +4182,32 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( +static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkLatencySleepModeInfoNV* pSleepModeInfo); + +static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkLatencySleepInfoNV* pSleepInfo); + +static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pTimingCount, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( + VkQueue queue, + VkOutOfBandQueueTypeInfoNV pQueueTypeInfo); + + @@ -5104,6 +5135,11 @@ static const std::unordered_map name_to_funcptr_map = { {"vkCmdBindShadersEXT", (void*)CmdBindShadersEXT}, {"vkGetFramebufferTilePropertiesQCOM", (void*)GetFramebufferTilePropertiesQCOM}, {"vkGetDynamicRenderingTilePropertiesQCOM", (void*)GetDynamicRenderingTilePropertiesQCOM}, + {"vkSetLatencySleepModeNV", (void*)SetLatencySleepModeNV}, + {"vkLatencySleepNV", (void*)LatencySleepNV}, + {"vkSetLatencyMarkerNV", (void*)SetLatencyMarkerNV}, + {"vkGetLatencyTimingsNV", (void*)GetLatencyTimingsNV}, + {"vkQueueNotifyOutOfBandNV", (void*)QueueNotifyOutOfBandNV}, {"vkCmdSetAttachmentFeedbackLoopEnableEXT", (void*)CmdSetAttachmentFeedbackLoopEnableEXT}, #ifdef VK_USE_PLATFORM_SCREEN_QNX {"vkGetScreenBufferPropertiesQNX", (void*)GetScreenBufferPropertiesQNX}, diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 75620690..3e0c45a6 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6702,6 +6702,9 @@ static VKAPI_ATTR void VKAPI_CALL CmdOpticalFlowExecuteNV( +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + static VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT( VkDevice device, @@ -6772,6 +6775,49 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( +static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkLatencySleepModeInfoNV* pSleepModeInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkLatencySleepInfoNV* pSleepInfo) +{ +//Not a CREATE or DESTROY function + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pTimingCount, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo) +{ +//Not a CREATE or DESTROY function +} + +static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( + VkQueue queue, + VkOutOfBandQueueTypeInfoNV pQueueTypeInfo) +{ +//Not a CREATE or DESTROY function +} + + diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index 0f8db1fb..cacbd530 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -7217,6 +7217,39 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExternalFormatResolveFeaturesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR +#ifdef VK_USE_PLATFORM_ANDROID_KHR +// Map type VkPhysicalDeviceExternalFormatResolvePropertiesANDROID to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_PROPERTIES_ANDROID +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_PROPERTIES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExternalFormatResolvePropertiesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR +#ifdef VK_USE_PLATFORM_ANDROID_KHR +// Map type VkAndroidHardwareBufferFormatResolvePropertiesANDROID to id VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID; +}; + +template <> struct LvlSTypeMap { + typedef VkAndroidHardwareBufferFormatResolvePropertiesANDROID Type; +}; + +#endif // VK_USE_PLATFORM_ANDROID_KHR // Map type VkPhysicalDeviceShaderObjectFeaturesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; @@ -7343,6 +7376,87 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SLEEP_MODE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySleepModeInfoNV Type; +}; + +// Map type VkLatencySleepInfoNV to id VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySleepInfoNV Type; +}; + +// Map type VkSetLatencyMarkerInfoNV to id VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkSetLatencyMarkerInfoNV Type; +}; + +// Map type VkLatencyTimingsFrameReportNV to id VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencyTimingsFrameReportNV Type; +}; + +// Map type VkGetLatencyMarkerInfoNV to id VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkGetLatencyMarkerInfoNV Type; +}; + +// Map type VkLatencySubmissionPresentIdNV to id VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySubmissionPresentIdNV Type; +}; + +// Map type VkSwapchainLatencyCreateInfoNV to id VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkSwapchainLatencyCreateInfoNV Type; +}; + +// Map type VkOutOfBandQueueTypeInfoNV to id VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkOutOfBandQueueTypeInfoNV Type; +}; + +// Map type VkLatencySurfaceCapabilitiesNV to id VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkLatencySurfaceCapabilitiesNV Type; +}; + // Map type VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 43e4b909..2e4fe996 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1568,6 +1568,14 @@ def __repr__(self): VK_EXT_dynamic_rendering_unused_attachments = Extension(name='VK_EXT_dynamic_rendering_unused_attachments', version=1, guard=None, commands=[ ]) +VK_NV_low_latency2 = Extension(name='VK_NV_low_latency2', version=1, guard=None, commands=[ + Command(name='vkSetLatencySleepModeNV', dispatch='VkDevice'), + Command(name='vkLatencySleepNV', dispatch='VkDevice'), + Command(name='vkSetLatencyMarkerNV', dispatch='VkDevice'), + Command(name='vkGetLatencyTimingsNV', dispatch='VkDevice'), + Command(name='vkQueueNotifyOutOfBandNV', dispatch='VkQueue'), +]) + VK_QCOM_multiview_per_view_render_areas = Extension(name='VK_QCOM_multiview_per_view_render_areas', version=1, guard=None, commands=[ ]) @@ -1639,6 +1647,9 @@ def __repr__(self): Command(name='vkGetMemoryAndroidHardwareBufferANDROID', dispatch='VkDevice'), ]) +VK_ANDROID_external_format_resolve = Extension(name='VK_ANDROID_external_format_resolve', version=1, guard='VK_USE_PLATFORM_ANDROID_KHR', commands=[ +]) + VK_FUCHSIA_imagepipe_surface = Extension(name='VK_FUCHSIA_imagepipe_surface', version=1, guard='VK_USE_PLATFORM_FUCHSIA', commands=[ Command(name='vkCreateImagePipeSurfaceFUCHSIA', dispatch='VkInstance'), ]) @@ -2092,6 +2103,7 @@ def __repr__(self): VK_ARM_shader_core_builtins, VK_EXT_pipeline_library_group_handles, VK_EXT_dynamic_rendering_unused_attachments, + VK_NV_low_latency2, VK_QCOM_multiview_per_view_render_areas, VK_QCOM_image_processing2, VK_QCOM_filter_cubic_weights, @@ -2106,6 +2118,7 @@ def __repr__(self): VK_EXT_mesh_shader, VK_KHR_android_surface, VK_ANDROID_external_memory_android_hardware_buffer, + VK_ANDROID_external_format_resolve, VK_FUCHSIA_imagepipe_surface, VK_FUCHSIA_external_memory, VK_FUCHSIA_external_semaphore, diff --git a/scripts/known_good.json b/scripts/known_good.json index cc6e084e..62392372 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.265" + "commit": "v1.3.266" }, { "name": "MoltenVK", @@ -35,7 +35,7 @@ "cmake_options": [ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], - "commit": "v1.3.265", + "commit": "v1.3.266", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 81c4d744..765e9030 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -98,6 +98,7 @@ std::string VkDriverIdString(VkDriverId value) { case (VK_DRIVER_ID_MESA_DOZEN): return "DRIVER_ID_MESA_DOZEN"; case (VK_DRIVER_ID_MESA_NVK): return "DRIVER_ID_MESA_NVK"; case (VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA): return "DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA"; + case (VK_DRIVER_ID_MESA_AGXV): return "DRIVER_ID_MESA_AGXV"; default: return std::string("UNKNOWN_VkDriverId_value") + std::to_string(value); } } @@ -1066,6 +1067,7 @@ std::vector VkResolveModeFlagBitsGetStrings(VkResolveModeFlagBits if (VK_RESOLVE_MODE_AVERAGE_BIT & value) strings.push_back("RESOLVE_MODE_AVERAGE_BIT"); if (VK_RESOLVE_MODE_MIN_BIT & value) strings.push_back("RESOLVE_MODE_MIN_BIT"); if (VK_RESOLVE_MODE_MAX_BIT & value) strings.push_back("RESOLVE_MODE_MAX_BIT"); + if (VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID & value) strings.push_back("RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID"); return strings; } void DumpVkResolveModeFlags(Printer &p, std::string name, VkResolveModeFlags value) { From 3a19c1973f0e4732b8f3746593aee2ac425ecb78 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 29 Sep 2023 14:17:54 -0600 Subject: [PATCH 33/56] android: Various fixes to get closer to Android on CMake Remove vulkaninfo from Android builds Don't use the loader on Android --- CMakeLists.txt | 4 +++- build-android/build_all.sh | 12 ------------ scripts/known_good.json | 7 ++++++- tests/CMakeLists.txt | 4 ++++ vulkaninfo/CMakeLists.txt | 4 +++- vulkaninfo/android/.gitignore | 3 --- vulkaninfo/android/jni/Android.mk | 28 --------------------------- vulkaninfo/android/jni/Application.mk | 22 --------------------- 8 files changed, 16 insertions(+), 68 deletions(-) delete mode 100644 vulkaninfo/android/.gitignore delete mode 100644 vulkaninfo/android/jni/Android.mk delete mode 100644 vulkaninfo/android/jni/Application.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c73e28a..fb8f36f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,9 @@ if(APPLE) endif() find_package(VulkanHeaders REQUIRED CONFIG) -find_package(VulkanLoader REQUIRED CONFIG) +if (NOT ANDROID) + find_package(VulkanLoader REQUIRED CONFIG) +endif() include(GNUInstallDirs) diff --git a/build-android/build_all.sh b/build-android/build_all.sh index 9f502452..1a842e61 100755 --- a/build-android/build_all.sh +++ b/build-android/build_all.sh @@ -47,9 +47,6 @@ findtool jarsigner set -ev -VULKANINFO_BUILD_DIR=$PROJECT_DIR/vulkaninfo/android -echo VULKANINFO_BUILD_DIR="${VULKANINFO_BUILD_DIR}" - DEMO_BUILD_DIR=$PROJECT_DIR/cube/android echo DEMO_BUILD_DIR="${DEMO_BUILD_DIR}" @@ -72,15 +69,6 @@ python3 scripts/generate_source.py $ANDROID_BUILD_DIR/third_party/Vulkan-Headers popd ) -# -# build vulkaninfo -# -( -pushd $VULKANINFO_BUILD_DIR -ndk-build -j $cores -popd -) - # # build vkcube APK # diff --git a/scripts/known_good.json b/scripts/known_good.json index 62392372..e96eda81 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -36,6 +36,11 @@ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], "commit": "v1.3.266", + "build_platforms": [ + "windows", + "linux", + "darwin" + ], "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR", @@ -66,4 +71,4 @@ "MoltenVK": "MOLTENVK_REPO_ROOT", "googletest": "GOOGLETEST_INSTALL_DIR" } -} +} \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0d9fb1b4..9e419c9c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,6 +15,10 @@ # limitations under the License. # ~~~ +if (ANDROID) + return() +endif() + # setup binary_locations_$.h.in using binary_locations.h.in as a source file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$.h" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/binary_locations.h.in") diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 73947d28..43148642 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -15,7 +15,9 @@ # limitations under the License. # ~~~ -# CMakeLists.txt file for building Vulkaninfo +if (ANDROID) + return() +endif() if(WIN32) # ~~~ diff --git a/vulkaninfo/android/.gitignore b/vulkaninfo/android/.gitignore deleted file mode 100644 index 8008f254..00000000 --- a/vulkaninfo/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -libs -obj diff --git a/vulkaninfo/android/jni/Android.mk b/vulkaninfo/android/jni/Android.mk deleted file mode 100644 index f3adbd5b..00000000 --- a/vulkaninfo/android/jni/Android.mk +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../.. -VULKANINFO_DIR := $(SRC_DIR)/vulkaninfo - -include $(CLEAR_VARS) -LOCAL_MODULE := vulkaninfo -LOCAL_SRC_FILES += $(VULKANINFO_DIR)/vulkaninfo.cpp -LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ - $(VULKANINFO_DIR) \ - $(VULKANINFO_DIR)/generated -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR -DVK_ENABLE_BETA_EXTENSIONS -LOCAL_LDLIBS := -llog -landroid -include $(BUILD_EXECUTABLE) diff --git a/vulkaninfo/android/jni/Application.mk b/vulkaninfo/android/jni/Application.mk deleted file mode 100644 index c294bc5a..00000000 --- a/vulkaninfo/android/jni/Application.mk +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 -APP_PLATFORM := android-23 -APP_STL := c++_static -APP_MODULES := vulkaninfo -APP_CPPFLAGS += -std=c++11 -fexceptions -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -APP_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -NDK_TOOLCHAIN_VERSION := clang From 6e451d98d3c56a573cee654745101a78acadf5f1 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Mon, 2 Oct 2023 16:53:41 -0600 Subject: [PATCH 34/56] cmake: Fix vulkaninfo on Android --- vulkaninfo/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 43148642..37f6a57b 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -15,9 +15,13 @@ # limitations under the License. # ~~~ -if (ANDROID) - return() -endif() +# TODO: Document this properly +# cmake -S . -B android-build -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=28 -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Debug -DBUILD_CUBE=OFF -DBUILD_WSI_XCB_SUPPORT=OFF -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_WAYLAND_SUPPORT=OFF -C external/helper.cmake +# cmake --build android-build --target vulkaninfo +# +# adb push android-build/vulkaninfo/vulkaninfo /data/local/tmp +# adb shell /data/local/tmp/vulkaninfo --json --output /data/local/tmp/VP_Pixel_6.json +# adb pull /data/local/tmp/VP_Pixel_6.json if(WIN32) # ~~~ From e483d0dfc7b33483cefd80632d141fe0bacdfb9a Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Mon, 2 Oct 2023 16:22:19 -0600 Subject: [PATCH 35/56] cmake: Minor cube cleanup Remove unused vars Remove pointless code Remove usage of CMAKE_LANG_FLAGS --- cube/CMakeLists.txt | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index c5646469..2318d912 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -15,11 +15,6 @@ # limitations under the License. # ~~~ -set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - -set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts") - - if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) @@ -118,7 +113,6 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(NOT BUILD_WSI_WAYLAND_SUPPORT) message(FATAL_ERROR "Selected Wayland for vkcube build but not building Wayland support") endif() - set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS}) link_libraries(${WAYLAND_CLIENT_LIBRARIES}) set(CUBE_PLATFORM VK_USE_PLATFORM_WAYLAND_KHR) set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml) @@ -145,9 +139,6 @@ else() message(FATAL_ERROR "Unsupported Platform!") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - if (COMPILE_CUBE_SHADERS) # Try to find glslang in system paths or in an SDK if the VULKAN_SDK env-var is set find_program(GLSLANG_VALIDATOR names glslang glslangValidator HINTS $ENV{GLSLANG_INSTALL_DIR} $ENV{VULKAN_SDK}/bin $ENV{VULKAN_SDK}/Bin) @@ -167,12 +158,11 @@ if (COMPILE_CUBE_SHADERS) endif() if(WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + # vkcube / vkcube make use of M_PI and various other math defines. + add_compile_definitions(_USE_MATH_DEFINES) endif() -include_directories(${CUBE_INCLUDE_DIRS}) - # ---------------------------------------------------------------------------- # vkcube @@ -209,6 +199,8 @@ else() target_link_libraries(vkcube Vulkan::Headers Vulkan::Loader) endif() +target_include_directories(vkcube PRIVATE .) + if(APPLE) # Keep RPATH so fixup_bundle can use it to find libraries set_target_properties(vkcube PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -252,6 +244,7 @@ else() cube.frag.inc) target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader) endif() +target_include_directories(vkcubepp PRIVATE .) if(APPLE) # Keep RPATH so fixup_bundle can use it to find libraries @@ -271,14 +264,12 @@ endif() if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_WAYLAND_SUPPORT AND EXISTS ${WAYLAND_PROTOCOLS_PATH}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) - set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS}) link_libraries(${WAYLAND_CLIENT_LIBRARIES}) set(OPTIONAL_WAYLAND_DATA_FILES ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-code.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-header.h ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(vkcube-wayland cube.c ${PROJECT_SOURCE_DIR}/cube/cube.vert @@ -286,6 +277,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") cube.vert.inc cube.frag.inc ${OPTIONAL_WAYLAND_DATA_FILES}) + target_include_directories(vkcube-wayland PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + . + ) target_link_libraries(vkcube-wayland Vulkan::Headers Vulkan::Loader) target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) include(CheckLibraryExists) From 0067d4cb64dad8e8c753efcf1dd120347e682300 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 4 Oct 2023 16:56:58 -0600 Subject: [PATCH 36/56] docs: New SDK branch convention Next SDK we will be changing branch/tag naming scheme from sdk-1.x.yyy to vulkan-sdk-1.x.yyy --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9726955..0196b88c 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ Please see the [GOVERNANCE.md](GOVERNANCE.md) file in this repository for reposi ## Version Tagging Scheme -Updates to the `Vulkan-Tools` repository which correspond to a new Vulkan specification release are tagged using the following format: `v<`_`version`_`>` (e.g., `v1.1.96`). +Updates to this repository which correspond to a new Vulkan specification release are tagged using the following format: `v<`_`version`_`>` (e.g., `v1.3.266`). -**Note**: Marked version releases have undergone thorough testing but do not imply the same quality level as SDK tags. SDK tags follow the `sdk-<`_`version`_`>.<`_`patch`_`>` format (e.g., `sdk-1.1.92.0`). +**Note**: Marked version releases have undergone thorough testing but do not imply the same quality level as SDK tags. SDK tags follow the `vulkan-sdk-<`_`version`_`>.<`_`patch`_`>` format (e.g., `vulkan-sdk-1.3.266.0`). -This scheme was adopted following the 1.1.96 Vulkan specification release. +This scheme was adopted following the `1.3.266` Vulkan specification release. ## License This work is released as open source under a Apache-style license from Khronos including a Khronos copyright. From 8197ec6dae2d27744f0795769277a4e44717d33b Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Thu, 5 Oct 2023 11:29:43 -0600 Subject: [PATCH 37/56] vulkaninfo: Fix printing arrays of Enums Previously, the code generator assumed enums were always printed as key-value pairs, and not in an array. This led to using object syntax inside of arrays in the JSON output, which is invalid, and is now fixed. --- scripts/vulkaninfo_generator.py | 11 +++++++---- vulkaninfo/generated/vulkaninfo.hpp | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 9d7d683a..3aa2a4ec 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -601,10 +601,13 @@ def PrintStructure(struct, types_to_gen, structure_names, aliases): out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' out += f" for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n" if v.typeID in types_to_gen: - out += f" if (obj.{v.name} != nullptr) {{\n" - out += f" p.SetElementIndex(i);\n" - out += f' Dump{v.typeID}(p, "{v.name}", obj.{v.name}[i]);\n' - out += f" }}\n" + out += f' if (obj.{v.name} != nullptr) {{\n' + out += f' p.SetElementIndex(i);\n' + out += ' if (p.Type() == OutputType::json)\n' + out += f' p.PrintString(std::string("VK_") + {v.typeID}String(obj.{v.name}[i]));\n' + out += ' else\n' + out += f' p.PrintString({v.typeID}String(obj.{v.name}[i]));\n' + out += f' }}\n' else: out += f" p.PrintElement(obj.{v.name}[i]);\n" out += f" }}\n" diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 765e9030..3c5b7da2 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -1983,7 +1983,10 @@ void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name for (uint32_t i = 0; i < obj.copySrcLayoutCount; i++) { if (obj.pCopySrcLayouts != nullptr) { p.SetElementIndex(i); - DumpVkImageLayout(p, "pCopySrcLayouts", obj.pCopySrcLayouts[i]); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopySrcLayouts[i])); + else + p.PrintString(VkImageLayoutString(obj.pCopySrcLayouts[i])); } } } @@ -1993,7 +1996,10 @@ void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name for (uint32_t i = 0; i < obj.copyDstLayoutCount; i++) { if (obj.pCopyDstLayouts != nullptr) { p.SetElementIndex(i); - DumpVkImageLayout(p, "pCopyDstLayouts", obj.pCopyDstLayouts[i]); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopyDstLayouts[i])); + else + p.PrintString(VkImageLayoutString(obj.pCopyDstLayouts[i])); } } } @@ -3215,7 +3221,10 @@ void DumpVkSurfacePresentModeCompatibilityEXT(Printer &p, std::string name, cons for (uint32_t i = 0; i < obj.presentModeCount; i++) { if (obj.pPresentModes != nullptr) { p.SetElementIndex(i); - DumpVkPresentModeKHR(p, "pPresentModes", obj.pPresentModes[i]); + if (p.Type() == OutputType::json) + p.PrintString(std::string("VK_") + VkPresentModeKHRString(obj.pPresentModes[i])); + else + p.PrintString(VkPresentModeKHRString(obj.pPresentModes[i])); } } } From f49a190541473611a88a6a621c66471025bf7569 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Thu, 5 Oct 2023 13:44:18 -0600 Subject: [PATCH 38/56] vulkaninfo: Fix VkPhysicalDeviceHostImageCopyPropertiesEXT This struct has pointers to arrays which must be allocated by the user before they can be filled out. Thus, to be able to query the properties, vulkaninfo must call vkGetPhysicalDeviceProperties2 twice. Since there is not an easy way to add this to the code generator, it is instead excluded from the main pNext generation and hand written. --- scripts/vulkaninfo_generator.py | 5 +++-- vulkaninfo/generated/vulkaninfo.hpp | 9 --------- vulkaninfo/vulkaninfo.cpp | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 3aa2a4ec..2062115d 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -82,7 +82,7 @@ # used in the .cpp code structures_to_gen = ['VkExtent3D', 'VkExtent2D', 'VkPhysicalDeviceLimits', 'VkPhysicalDeviceFeatures', 'VkPhysicalDeviceSparseProperties', 'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties', - 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT'] + 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT', 'VkPhysicalDeviceHostImageCopyPropertiesEXT'] enums_to_gen = ['VkResult', 'VkFormat', 'VkPresentModeKHR', 'VkPhysicalDeviceType', 'VkImageTiling'] flags_to_gen = ['VkSurfaceTransformFlagsKHR', 'VkCompositeAlphaFlagsKHR', 'VkSurfaceCounterFlagsEXT', 'VkQueueFlags', @@ -115,7 +115,8 @@ {'extends': 'VkPhysicalDeviceProperties2', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkPhysicalDeviceProperties2', - 'print_iterator': True}), + 'print_iterator': True, + 'exclude': ['VkPhysicalDeviceHostImageCopyPropertiesEXT']}), ('phys_device_mem_props2', {'extends': 'VkPhysicalDeviceMemoryProperties2', 'type': EXTENSION_TYPE_DEVICE, diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 3c5b7da2..4728dc59 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -3269,7 +3269,6 @@ struct phys_device_props2_chain { VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR PhysicalDeviceFragmentShaderBarycentricPropertiesKHR{}; VkPhysicalDeviceFragmentShadingRatePropertiesKHR PhysicalDeviceFragmentShadingRatePropertiesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT{}; - VkPhysicalDeviceHostImageCopyPropertiesEXT PhysicalDeviceHostImageCopyPropertiesEXT{}; VkPhysicalDeviceIDProperties PhysicalDeviceIDProperties{}; VkPhysicalDeviceInlineUniformBlockProperties PhysicalDeviceInlineUniformBlockProperties{}; VkPhysicalDeviceLineRasterizationPropertiesEXT PhysicalDeviceLineRasterizationPropertiesEXT{}; @@ -3328,7 +3327,6 @@ struct phys_device_props2_chain { PhysicalDeviceFragmentShaderBarycentricPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR; PhysicalDeviceFragmentShadingRatePropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT; - PhysicalDeviceHostImageCopyPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; PhysicalDeviceIDProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; PhysicalDeviceInlineUniformBlockProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES; PhysicalDeviceLineRasterizationPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; @@ -3387,7 +3385,6 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShaderBarycentricPropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRatePropertiesKHR)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT)); - chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceIDProperties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceInlineUniformBlockProperties)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceLineRasterizationPropertiesEXT)); @@ -4074,12 +4071,6 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT(p, "VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT", *props); p.AddNewline(); } - if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT && - (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME))) { - VkPhysicalDeviceHostImageCopyPropertiesEXT* props = (VkPhysicalDeviceHostImageCopyPropertiesEXT*)structure; - DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", *props); - p.AddNewline(); - } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES && (inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME) || gpu.api_version.minor >= 1)) { diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index cad6779c..e8e4241f 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -333,6 +333,22 @@ void DumpGroups(Printer &p, AppInstance &inst) { } } +void GetAndDumpHostImageCopyPropertiesEXT(Printer &p, AppGpu &gpu) { + // Manually implement VkPhysicalDeviceHostImageCopyPropertiesEXT due to it needing to be called twice + VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_copy_properties_ext{}; + host_image_copy_properties_ext.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; + VkPhysicalDeviceProperties2KHR props2{}; + props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; + props2.pNext = static_cast(&host_image_copy_properties_ext); + gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); + std::vector src_layouts(host_image_copy_properties_ext.copySrcLayoutCount); + host_image_copy_properties_ext.pCopySrcLayouts = src_layouts.data(); + std::vector dst_layouts(host_image_copy_properties_ext.copyDstLayoutCount); + host_image_copy_properties_ext.pCopyDstLayouts = dst_layouts.data(); + gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); + DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", host_image_copy_properties_ext); +} + void GpuDumpProps(Printer &p, AppGpu &gpu) { auto props = gpu.GetDeviceProperties(); p.SetSubHeader(); @@ -362,6 +378,7 @@ void GpuDumpProps(Printer &p, AppGpu &gpu) { void *place = gpu.props2.pNext; chain_iterator_phys_device_props2(p, gpu.inst, gpu, place); p.AddNewline(); + GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } @@ -658,6 +675,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) { if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { void *place = gpu.props2.pNext; chain_iterator_phys_device_props2(p, gpu.inst, gpu, place); + GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } { From 0bd59f5c160a742d64b23df1244e41b43778c6b1 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Thu, 5 Oct 2023 12:57:25 -0600 Subject: [PATCH 39/56] Remove unused scripts --- scripts/check_code_format.sh | 45 ---------- scripts/check_commit_message_format.sh | 102 --------------------- scripts/determine_vs_version.py | 119 ------------------------- 3 files changed, 266 deletions(-) delete mode 100755 scripts/check_code_format.sh delete mode 100755 scripts/check_commit_message_format.sh delete mode 100755 scripts/determine_vs_version.py diff --git a/scripts/check_code_format.sh b/scripts/check_code_format.sh deleted file mode 100755 index dbd7b799..00000000 --- a/scripts/check_code_format.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright (c) 2017 Google Inc. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Script to determine if source code in Pull Request is properly formatted. -# Exits with non 0 exit code if formatting is needed. -# -# This script assumes to be invoked at the project root directory. - -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -clang-format --version - -FILES_TO_CHECK=$(git diff --name-only main | grep -v -E "^include/vulkan" | grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp)$") - -if [ -z "${FILES_TO_CHECK}" ]; then - echo -e "${GREEN}No source code to check for formatting.${NC}" - exit 0 -fi - -FORMAT_DIFF=$(git diff -U0 main -- ${FILES_TO_CHECK} | python ./scripts/clang-format-diff.py -p1 -style=file) - -if [ -z "${FORMAT_DIFF}" ]; then - echo -e "${GREEN}All source code in PR properly formatted.${NC}" - exit 0 -else - echo -e "${RED}Found formatting errors!${NC}" - echo "${FORMAT_DIFF}" - echo "Be sure you are using the following version of clang-format:" - clang-format --version - exit 1 -fi diff --git a/scripts/check_commit_message_format.sh b/scripts/check_commit_message_format.sh deleted file mode 100755 index 29666356..00000000 --- a/scripts/check_commit_message_format.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Checks commit messages against project standards in CONTRIBUTING.md document -# Script to determine if commit messages in Pull Request are properly formatted. -# Exits with non 0 exit code if reformatting is needed. - -# Disable subshells -shopt -s lastpipe - -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -# TRAVIS_COMMIT_RANGE contains range of commits for this PR - -# Get user-supplied commit message text for applicable commits and insert -# a unique separator string identifier. The git command returns ONLY the -# subject line and body for each of the commits. -COMMIT_TEXT=$(git log ${TRAVIS_COMMIT_RANGE} --pretty=format:"XXXNEWLINEXXX"%n%B) - -# Bail if there are none -if [ -z "${COMMIT_TEXT}" ]; then - echo -e "${GREEN}No commit messgages to check for formatting.${NC}" - exit 0 -elif ! echo $TRAVIS_COMMIT_RANGE | grep -q "\.\.\."; then - echo -e "${GREEN}No commit messgages to check for formatting.${NC}" - exit 0 -fi - -# Process commit messages -success=1 -current_line=0 -prevline="" - -# Process each line of the commit message output, resetting counter on separator -printf %s "$COMMIT_TEXT" | while IFS='' read -r line; do - # echo "Count = $current_line = $line" - current_line=$((current_line+1)) - if [ "$line" = "XXXNEWLINEXXX" ]; then - current_line=0 - fi - chars=${#line} - if [ $current_line -eq 1 ]; then - # Subject line should be 50 chars or less (but give some slack here) - if [ $chars -gt 54 ]; then - echo "The following subject line exceeds 50 characters in length." - echo " '$line'" - success=0 - fi - i=$(($chars-1)) - last_char=${line:$i:1} - # Output error if last char of subject line is not alpha-numeric - if [[ ! $last_char =~ [0-9a-zA-Z] ]]; then - echo "For the following commit, the last character of the subject line must not be non-alphanumeric." - echo " '$line'" - success=0 - fi - # Checking if subject line doesn't start with 'module: ' - prefix=$(echo $line | cut -f1 -d " ") - if [ "${prefix: -1}" != ":" ]; then - echo "The following subject line must start with a single word specifying the functional area of the change, followed by a colon and space. I.e., 'layers: Subject line here'" - echo " '$line'" - success=0 - fi - elif [ $current_line -eq 2 ]; then - # Commit message must have a blank line between subject and body - if [ $chars -ne 0 ]; then - echo "The following subject line must be followed by a blank line." - echo " '$prevline'" - success=0 - fi - else - # Lines in a commit message body must be less than 72 characters in length (but give some slack) - if [ $chars -gt 76 ]; then - echo "The following commit message body line exceeds the 72 character limit." - echo "'$line\'" - success=0 - fi - fi - prevline=$line -done - -if [ $success -eq 1 ]; then - echo -e "${GREEN}All commit messages in pull request are properly formatted.${NC}" - exit 0 -else - exit 1 -fi diff --git a/scripts/determine_vs_version.py b/scripts/determine_vs_version.py deleted file mode 100755 index 7982bf71..00000000 --- a/scripts/determine_vs_version.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2016 The Khronos Group Inc. -# Copyright (c) 2016 Valve Corporation -# Copyright (c) 2016 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Author: Mark Young - -import sys -import os -import subprocess - -# Following function code snippet was found on StackOverflow (with a change to lower -# camel-case on the variable names): -# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python -def find_executable(program): - def is_exe(fPath): - return os.path.isfile(fPath) and os.access(fPath, os.X_OK) - - fPath, fName = os.path.split(program) - if fPath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - return None - -def determine_year(version): - if version == 8: - return 2005 - elif version == 9: - return 2008 - elif version == 10: - return 2010 - elif version == 11: - return 2012 - elif version == 12: - return 2013 - elif version == 14: - return 2015 - elif version == 15: - return 2017 - else: - return 0000 - -# Determine if msbuild is in the path, then call it to determine the version and parse -# it into a format we can use, which is " ". -if __name__ == '__main__': - exeName = 'msbuild.exe' - arguments = '/ver' - - # Determine if the executable exists in the path, this is critical. - # - foundExeName = find_executable(exeName) - - # If not found, return an invalid number but in the appropriate format so it will - # fail if the program above tries to use it. - if foundExeName == None: - print('00 0000') - print('Executable ' + exeName + ' not found in PATH!') - else: - proc = subprocess.Popen([exeName, arguments], stdout=subprocess.PIPE) - sysCallOut = proc.stdout.readline().decode('iso-8859-1').rstrip() - - version = None - - # Split around any spaces first - spaceList = sysCallOut.split(' ') - for spaceString in spaceList: - - # If we've already found it, bail. - if version != None: - break - - # Now split around line feeds - lineList = spaceString.split('\n') - for curLine in lineList: - - # If we've already found it, bail. - if version != None: - break - - # We only want to continue if there's a period in the list - if '.' not in curLine: - continue - - # Get the first element and determine if it is a number, if so, we've - # got our number. - splitAroundPeriod = curLine.split('.') - if splitAroundPeriod[0].isdigit(): - version = int (splitAroundPeriod[0]) - break - - # Failsafe to return a number in the proper format, but one that will fail. - if version == None: - version = 00 - - # Determine the year associated with that version - year = determine_year(version) - - # Output the string we need for Cmake to properly build for this version - print(str(version) + ' ' + str(year)) From 6807aa519f950375f08b18d319eb0dc5fd25e58c Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Thu, 5 Oct 2023 13:16:05 -0600 Subject: [PATCH 40/56] cmake: Use XCODE variable Simplifies CMake code in various places for Apple builds --- cube/macOS/cube/cube.cmake | 6 +++--- cube/macOS/cubepp/cubepp.cmake | 6 +++--- mac_common.cmake | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake index ee98135d..15a56849 100644 --- a/cube/macOS/cube/cube.cmake +++ b/cube/macOS/cube/cube.cmake @@ -28,14 +28,14 @@ set(cube_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/VulkanIcon.icns) # Have Xcode handle the Storyboard -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) set(cube_RESOURCES ${cube_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard) endif() add_executable(vkcube MACOSX_BUNDLE ${cube_SRCS} ${cube_HDRS} ${cube_RESOURCES} cube.vert.inc cube.frag.inc) # Handle the Storyboard ourselves -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Compile the storyboard file with the ibtool. add_custom_command(TARGET vkcube POST_BUILD COMMAND ${IBTOOL} @@ -70,7 +70,7 @@ set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" "Resources/vulkan/icd.d") # Copy the MoltenVK lib into the bundle. -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) add_custom_command(TARGET vkcube POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" ${CMAKE_CURRENT_BINARY_DIR}/$/vkcube.app/Contents/Frameworks/libMoltenVK.dylib diff --git a/cube/macOS/cubepp/cubepp.cmake b/cube/macOS/cubepp/cubepp.cmake index 4ff82b6b..e6a3e485 100644 --- a/cube/macOS/cubepp/cubepp.cmake +++ b/cube/macOS/cubepp/cubepp.cmake @@ -30,14 +30,14 @@ set(cubepp_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/VulkanIcon.icns) # Have Xcode handle the Storyboard -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) set(cubepp_RESOURCES ${cubepp_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard) endif() add_executable(vkcubepp MACOSX_BUNDLE ${cubepp_SRCS} ${cubepp_HDRS} ${cubepp_RESOURCES} cube.vert.inc cube.frag.inc) # Handle the Storyboard ourselves -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Compile the storyboard file with the ibtool. add_custom_command(TARGET vkcubepp POST_BUILD COMMAND ${IBTOOL} @@ -72,7 +72,7 @@ set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" "Resources/vulkan/icd.d") # Copy the MoltenVK lib into the bundle. -if(${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(XCODE) add_custom_command(TARGET vkcubepp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" ${CMAKE_CURRENT_BINARY_DIR}/$/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib diff --git a/mac_common.cmake b/mac_common.cmake index bad3c414..b06dce96 100644 --- a/mac_common.cmake +++ b/mac_common.cmake @@ -45,7 +45,7 @@ set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json P find_library(COCOA NAMES Cocoa) # Locate Interface Builder Tool, needed to build things like Storyboards outside of Xcode. -if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*") +if(NOT XCODE) # Make sure we can find the 'ibtool' program. If we can NOT find it we skip generation of this project. find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND") From 066a1982b249594d17d59b13cb0c1ccee526290a Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Thu, 5 Oct 2023 14:47:32 -0600 Subject: [PATCH 41/56] cmake: Simplify INSTALL_ICD logic --- icd/CMakeLists.txt | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index f908906c..b3a2ca14 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -89,13 +89,6 @@ if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) target_compile_definitions(VkICD_mock_icd PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") endif() -# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. -# Require the user to ask that it be installed if they really want it. -option(INSTALL_ICD "Install icd") -if (INSTALL_ICD) - message(STATUS "Installing Mock ICD") -endif() - # There are 2 primary deliverables for the mock driver. # - The actual library (lib)VkICD_mock_icd.(dll|so|dylib) # - The respective json file, VkICD_mock_icd.json @@ -124,6 +117,15 @@ add_custom_command(TARGET VkICD_mock_icd POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $/${OUTPUT_FILE_FINAL_NAME} ) +# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation. +# Require the user to ask that it be installed if they really want it. +option(INSTALL_ICD "Install Mock icd") +if (INSTALL_ICD) + message(NOTICE "Installing Mock ICD") +else() + return() +endif() + # For UNIX-based systems, `library_path` should not contain a relative path (indicated by "./") before installing to system directories # This json isn't used for regular local development, it's used for installation if (UNIX) @@ -137,15 +139,11 @@ if (UNIX) configure_file(${INPUT_FILE} ${UNIX_INTERMEDIATE_FILE} @ONLY) - if (INSTALL_ICD) - install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME}) - endif() + install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() -if (WIN32 AND INSTALL_ICD) +if (WIN32) install(FILES ${INTERMEDIATE_FILE} DESTINATION ${LAYER_INSTALL_DIR} RENAME ${OUTPUT_FILE_FINAL_NAME}) endif() -if (INSTALL_ICD) - install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR}) -endif() +install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR}) From 76967b12e90c5c9b8e2a099b1a9b2bd8d21ef431 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 6 Oct 2023 09:35:38 -0700 Subject: [PATCH 42/56] build: Update to header 1.3.267 - Update known-good - Generate source --- build-android/vulkan-headers_revision_android | 2 +- icd/generated/function_declarations.h | 12 ++++--- icd/generated/function_definitions.h | 10 +++--- icd/generated/vk_typemap_helper.h | 36 +++++++++++++++++++ scripts/generate_vulkan_wrapper.py | 8 +++++ scripts/known_good.json | 4 +-- vulkaninfo/generated/vulkaninfo.hpp | 30 ++++++++++++++++ 7 files changed, 91 insertions(+), 11 deletions(-) diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android index 293a60c9..15a8013f 100644 --- a/build-android/vulkan-headers_revision_android +++ b/build-android/vulkan-headers_revision_android @@ -1 +1 @@ -v1.3.266 +v1.3.267 diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 1e9e9504..9c7a65d7 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -346,6 +346,7 @@ static const std::unordered_map device_extension_map = { {"VK_NV_linear_color_attachment", 1}, {"VK_EXT_image_compression_control_swapchain", 1}, {"VK_QCOM_image_processing", 1}, + {"VK_EXT_nested_command_buffer", 1}, {"VK_EXT_external_memory_acquire_unmodified", 1}, {"VK_EXT_extended_dynamic_state3", 2}, {"VK_EXT_subpass_merge_feedback", 2}, @@ -362,6 +363,7 @@ static const std::unordered_map device_extension_map = { {"VK_SEC_amigo_profiling", 1}, {"VK_QCOM_multiview_per_view_viewports", 1}, {"VK_NV_ray_tracing_invocation_reorder", 1}, + {"VK_NV_extended_sparse_address_space", 1}, {"VK_EXT_mutable_descriptor_type", 1}, {"VK_ARM_shader_core_builtins", 2}, {"VK_EXT_pipeline_library_group_handles", 1}, @@ -3952,6 +3954,7 @@ static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + static VKAPI_ATTR void VKAPI_CALL CmdSetTessellationDomainOriginEXT( VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin); @@ -4182,20 +4185,21 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( + static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( VkDevice device, VkSwapchainKHR swapchain, - VkLatencySleepModeInfoNV* pSleepModeInfo); + const VkLatencySleepModeInfoNV* pSleepModeInfo); static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( VkDevice device, VkSwapchainKHR swapchain, - VkLatencySleepInfoNV* pSleepInfo); + const VkLatencySleepInfoNV* pSleepInfo); static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( VkDevice device, VkSwapchainKHR swapchain, - VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( VkDevice device, @@ -4205,7 +4209,7 @@ static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( VkQueue queue, - VkOutOfBandQueueTypeInfoNV pQueueTypeInfo); + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo); diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 3e0c45a6..1c24f9f5 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -6398,6 +6398,7 @@ static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetPipelineIndirectDeviceAddressNV( + static VKAPI_ATTR void VKAPI_CALL CmdSetTessellationDomainOriginEXT( VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin) @@ -6775,10 +6776,11 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( + static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( VkDevice device, VkSwapchainKHR swapchain, - VkLatencySleepModeInfoNV* pSleepModeInfo) + const VkLatencySleepModeInfoNV* pSleepModeInfo) { //Not a CREATE or DESTROY function return VK_SUCCESS; @@ -6787,7 +6789,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL SetLatencySleepModeNV( static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( VkDevice device, VkSwapchainKHR swapchain, - VkLatencySleepInfoNV* pSleepInfo) + const VkLatencySleepInfoNV* pSleepInfo) { //Not a CREATE or DESTROY function return VK_SUCCESS; @@ -6796,7 +6798,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL LatencySleepNV( static VKAPI_ATTR void VKAPI_CALL SetLatencyMarkerNV( VkDevice device, VkSwapchainKHR swapchain, - VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo) + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo) { //Not a CREATE or DESTROY function } @@ -6812,7 +6814,7 @@ static VKAPI_ATTR void VKAPI_CALL GetLatencyTimingsNV( static VKAPI_ATTR void VKAPI_CALL QueueNotifyOutOfBandNV( VkQueue queue, - VkOutOfBandQueueTypeInfoNV pQueueTypeInfo) + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo) { //Not a CREATE or DESTROY function } diff --git a/icd/generated/vk_typemap_helper.h b/icd/generated/vk_typemap_helper.h index cacbd530..eb406e15 100644 --- a/icd/generated/vk_typemap_helper.h +++ b/icd/generated/vk_typemap_helper.h @@ -7019,6 +7019,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceNestedCommandBufferFeaturesEXT Type; +}; + +// Map type VkPhysicalDeviceNestedCommandBufferPropertiesEXT to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceNestedCommandBufferPropertiesEXT Type; +}; + // Map type VkExternalMemoryAcquireUnmodifiedEXT to id VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; @@ -7340,6 +7358,24 @@ template <> struct LvlSTypeMap struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV Type; +}; + +// Map type VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV +template <> struct LvlTypeMap { + static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV; +}; + +template <> struct LvlSTypeMap { + typedef VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV Type; +}; + // Map type VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM to id VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM template <> struct LvlTypeMap { static const VkStructureType kSType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 2e4fe996..35e3e5cc 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1470,6 +1470,9 @@ def __repr__(self): VK_QCOM_image_processing = Extension(name='VK_QCOM_image_processing', version=1, guard=None, commands=[ ]) +VK_EXT_nested_command_buffer = Extension(name='VK_EXT_nested_command_buffer', version=1, guard=None, commands=[ +]) + VK_EXT_external_memory_acquire_unmodified = Extension(name='VK_EXT_external_memory_acquire_unmodified', version=1, guard=None, commands=[ ]) @@ -1556,6 +1559,9 @@ def __repr__(self): VK_NV_ray_tracing_invocation_reorder = Extension(name='VK_NV_ray_tracing_invocation_reorder', version=1, guard=None, commands=[ ]) +VK_NV_extended_sparse_address_space = Extension(name='VK_NV_extended_sparse_address_space', version=1, guard=None, commands=[ +]) + VK_EXT_mutable_descriptor_type = Extension(name='VK_EXT_mutable_descriptor_type', version=1, guard=None, commands=[ ]) @@ -2085,6 +2091,7 @@ def __repr__(self): VK_GOOGLE_surfaceless_query, VK_EXT_image_compression_control_swapchain, VK_QCOM_image_processing, + VK_EXT_nested_command_buffer, VK_EXT_external_memory_acquire_unmodified, VK_EXT_extended_dynamic_state3, VK_EXT_subpass_merge_feedback, @@ -2099,6 +2106,7 @@ def __repr__(self): VK_SEC_amigo_profiling, VK_QCOM_multiview_per_view_viewports, VK_NV_ray_tracing_invocation_reorder, + VK_NV_extended_sparse_address_space, VK_EXT_mutable_descriptor_type, VK_ARM_shader_core_builtins, VK_EXT_pipeline_library_group_handles, diff --git a/scripts/known_good.json b/scripts/known_good.json index e96eda81..8cd74f5d 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.266" + "commit": "v1.3.267" }, { "name": "MoltenVK", @@ -35,7 +35,7 @@ "cmake_options": [ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], - "commit": "v1.3.266", + "commit": "v1.3.267", "build_platforms": [ "windows", "linux", diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 4728dc59..e32a57cb 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -2364,6 +2364,18 @@ void DumpVkPhysicalDeviceMutableDescriptorTypeFeaturesEXT(Printer &p, std::strin p.SetMinKeyWidth(21); p.PrintKeyBool("mutableDescriptorType", static_cast(obj.mutableDescriptorType)); } +void DumpVkPhysicalDeviceNestedCommandBufferFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceNestedCommandBufferFeaturesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(34); + p.PrintKeyBool("nestedCommandBuffer", static_cast(obj.nestedCommandBuffer)); + p.PrintKeyBool("nestedCommandBufferRendering", static_cast(obj.nestedCommandBufferRendering)); + p.PrintKeyBool("nestedCommandBufferSimultaneousUse", static_cast(obj.nestedCommandBufferSimultaneousUse)); +} +void DumpVkPhysicalDeviceNestedCommandBufferPropertiesEXT(Printer &p, std::string name, const VkPhysicalDeviceNestedCommandBufferPropertiesEXT &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(28); + p.PrintKeyValue("maxCommandBufferNestingLevel", obj.maxCommandBufferNestingLevel); +} void DumpVkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(18); @@ -3278,6 +3290,7 @@ struct phys_device_props2_chain { VkPhysicalDeviceMeshShaderPropertiesEXT PhysicalDeviceMeshShaderPropertiesEXT{}; VkPhysicalDeviceMultiDrawPropertiesEXT PhysicalDeviceMultiDrawPropertiesEXT{}; VkPhysicalDeviceMultiviewProperties PhysicalDeviceMultiviewProperties{}; + VkPhysicalDeviceNestedCommandBufferPropertiesEXT PhysicalDeviceNestedCommandBufferPropertiesEXT{}; VkPhysicalDeviceOpacityMicromapPropertiesEXT PhysicalDeviceOpacityMicromapPropertiesEXT{}; VkPhysicalDevicePCIBusInfoPropertiesEXT PhysicalDevicePCIBusInfoPropertiesEXT{}; VkPhysicalDevicePerformanceQueryPropertiesKHR PhysicalDevicePerformanceQueryPropertiesKHR{}; @@ -3336,6 +3349,7 @@ struct phys_device_props2_chain { PhysicalDeviceMeshShaderPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT; PhysicalDeviceMultiDrawPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; PhysicalDeviceMultiviewProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; + PhysicalDeviceNestedCommandBufferPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; PhysicalDeviceOpacityMicromapPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT; PhysicalDevicePCIBusInfoPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT; PhysicalDevicePerformanceQueryPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR; @@ -3394,6 +3408,7 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceMeshShaderPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiDrawPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiviewProperties)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceNestedCommandBufferPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceOpacityMicromapPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePCIBusInfoPropertiesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePerformanceQueryPropertiesKHR)); @@ -3524,6 +3539,7 @@ struct phys_device_features2_chain { VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT{}; VkPhysicalDeviceMultiviewFeatures PhysicalDeviceMultiviewFeatures{}; VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT PhysicalDeviceMutableDescriptorTypeFeaturesEXT{}; + VkPhysicalDeviceNestedCommandBufferFeaturesEXT PhysicalDeviceNestedCommandBufferFeaturesEXT{}; VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT PhysicalDeviceNonSeamlessCubeMapFeaturesEXT{}; VkPhysicalDeviceOpacityMicromapFeaturesEXT PhysicalDeviceOpacityMicromapFeaturesEXT{}; VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT{}; @@ -3649,6 +3665,7 @@ struct phys_device_features2_chain { PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; PhysicalDeviceMultiviewFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; PhysicalDeviceMutableDescriptorTypeFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; + PhysicalDeviceNestedCommandBufferFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; PhysicalDeviceNonSeamlessCubeMapFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; PhysicalDeviceOpacityMicromapFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; @@ -3773,6 +3790,7 @@ struct phys_device_features2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMultiviewFeatures)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceMutableDescriptorTypeFeaturesEXT)); + chain_members.push_back(reinterpret_cast(&PhysicalDeviceNestedCommandBufferFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceNonSeamlessCubeMapFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDeviceOpacityMicromapFeaturesEXT)); chain_members.push_back(reinterpret_cast(&PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT)); @@ -4130,6 +4148,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceMultiviewProperties(p, gpu.api_version.minor >= 1 ?"VkPhysicalDeviceMultiviewProperties":"VkPhysicalDeviceMultiviewPropertiesKHR", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME))) { + VkPhysicalDeviceNestedCommandBufferPropertiesEXT* props = (VkPhysicalDeviceNestedCommandBufferPropertiesEXT*)structure; + DumpVkPhysicalDeviceNestedCommandBufferPropertiesEXT(p, "VkPhysicalDeviceNestedCommandBufferPropertiesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME))) { VkPhysicalDeviceOpacityMicromapPropertiesEXT* props = (VkPhysicalDeviceOpacityMicromapPropertiesEXT*)structure; @@ -4660,6 +4684,12 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place) DumpVkPhysicalDeviceMutableDescriptorTypeFeaturesEXT(p, "VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME))) { + VkPhysicalDeviceNestedCommandBufferFeaturesEXT* props = (VkPhysicalDeviceNestedCommandBufferFeaturesEXT*)structure; + DumpVkPhysicalDeviceNestedCommandBufferFeaturesEXT(p, "VkPhysicalDeviceNestedCommandBufferFeaturesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME))) { VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT* props = (VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT*)structure; From a4a8db5a8a9c55f1cd668ecb1bad8b4f66a68d46 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 6 Oct 2023 11:53:54 -0600 Subject: [PATCH 43/56] cmake: Upgrade to C++17 Addresses various other issues with setting compiler flags. CMAKE_C_FLAGS / CMAKE_CXX_FLAGS should NOT be used anymore. Addressed one minor C++17 issue caused by [[nodiscard]]. Remove compiler flags from Application.mk since they weren't needed and will soon be entirely replaced by CMake. closes #711 --- CMakeLists.txt | 64 ++++++++++++++++++--------------- cube/android/jni/Application.mk | 2 -- cube/cube.cpp | 3 +- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb8f36f4..33a9cf84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,17 @@ set(API_TYPE "vulkan") add_subdirectory(scripts) +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_VISIBILITY_INLINES_HIDDEN "YES") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + option(BUILD_CUBE "Build cube" ON) option(BUILD_VULKANINFO "Build vulkaninfo" ON) option(BUILD_ICD "Build icd" ON) @@ -61,42 +72,37 @@ endif() include(GNUInstallDirs) +# TODO: Should be OFF by default. option(BUILD_WERROR "Treat compiler warnings as errors" ON) -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers") - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp") - - if(MAKE_C_COMPILER_ID MATCHES "Clang") - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-string-conversion -Wno-implicit-in-conversion -Wno-enum-enum-conversion") - endif() +if (BUILD_WERROR) + add_compile_options("$,/WX,-Werror>") +endif() - if(BUILD_WERROR) - if((CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.3.0)) OR - (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0))) - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Werror") - endif() - endif() +if (${CMAKE_CXX_COMPILER_ID} MATCHES "(GNU|Clang)") + add_compile_options( + -Wall + -Wextra + -Wno-unused-parameter + -Wno-missing-field-initializers + -fno-strict-aliasing + -fno-builtin-memcmp + ) - # For GCC version 7.1 or greater, we need to disable the implicit fallthrough warning since there's no consistent way to satisfy - # all compilers until they all accept the C++17 standard - if(CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.1)) - set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Wimplicit-fallthrough=0") + if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + add_compile_options(-Wno-stringop-truncation) endif() - if(APPLE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_COMPILE_FLAGS}") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}") - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++14 -fno-rtti") - if(UNIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") + if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + add_compile_options( + -Wno-sign-conversion + -Wno-shorten-64-to-32 + -Wno-string-conversion + -Wno-implicit-int-conversion + -Wno-enum-enum-conversion + ) endif() elseif(MSVC) - if(BUILD_WERROR) - add_compile_options("/WX") - endif() + # TODO: Update to /W4 add_compile_options("/W3") # Warn about nested declarations add_compile_options("/w34456") diff --git a/cube/android/jni/Application.mk b/cube/android/jni/Application.mk index a3d9754e..788ff73b 100644 --- a/cube/android/jni/Application.mk +++ b/cube/android/jni/Application.mk @@ -17,6 +17,4 @@ APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 APP_PLATFORM := android-23 APP_STL := c++_static APP_MODULES := VkCube -APP_CPPFLAGS += -std=c++11 -fexceptions -Wall -Werror -Wextra -Wno-unused-parameter -DVK_NO_PROTOTYES -DGLM_FORCE_RADIANS -APP_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -DVK_NO_PROTOTYES -DGLM_FORCE_RADIANS NDK_TOOLCHAIN_VERSION := clang diff --git a/cube/cube.cpp b/cube/cube.cpp index a59e6dbe..005226e6 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -664,7 +664,8 @@ void Demo::destroy_texture(texture_object &tex_objs) { void Demo::draw() { // Ensure no more than FRAME_LAG renderings are outstanding - device.waitForFences(fences[frame_index], VK_TRUE, UINT64_MAX); + const vk::Result wait_result = device.waitForFences(fences[frame_index], VK_TRUE, UINT64_MAX); + VERIFY(wait_result == vk::Result::eSuccess || wait_result == vk::Result::eTimeout); device.resetFences({fences[frame_index]}); vk::Result acquire_result; From 96bad23002d40ad7e7eba3743ff22af1cd24d8f4 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 6 Oct 2023 16:13:24 -0600 Subject: [PATCH 44/56] mock: Ensure VkICD_mock_icd.json uses up to date API version closes #617 --- .github/workflows/tools.yml | 12 ++++++++++++ CMakeLists.txt | 2 +- icd/VkICD_mock_icd.json.in | 6 +++--- scripts/generate_source.py | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index dad2ec9c..99c4b727 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -208,3 +208,15 @@ jobs: run: | cd build-android ./build_all.sh + + tools_codegen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: sudo apt-get -qq update && sudo apt install libwayland-dev xorg-dev wayland-protocols + - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON + - run: cmake --build build --target tools_codegen + - run: git diff --exit-code diff --git a/CMakeLists.txt b/CMakeLists.txt index 33a9cf84..53042b60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ if (TOOLS_CODEGEN) add_custom_target(tools_codegen COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py "${VULKAN_HEADERS_INSTALL_DIR}/${CMAKE_INSTALL_DATADIR}/vulkan/registry" - --incremental --api ${API_TYPE} + --incremental --generated-version ${VulkanHeaders_VERSION} --api ${API_TYPE} ) endif() diff --git a/icd/VkICD_mock_icd.json.in b/icd/VkICD_mock_icd.json.in index f550bb27..56d09300 100644 --- a/icd/VkICD_mock_icd.json.in +++ b/icd/VkICD_mock_icd.json.in @@ -1,7 +1,7 @@ { - "file_format_version" : "1.0.1", + "file_format_version": "1.0.1", "ICD": { "library_path": "@JSON_LIBRARY_PATH@", - "api_version": "1.1.97" + "api_version": "1.3.267" } -} +} \ No newline at end of file diff --git a/scripts/generate_source.py b/scripts/generate_source.py index abd8a754..6c63f0c9 100755 --- a/scripts/generate_source.py +++ b/scripts/generate_source.py @@ -22,6 +22,7 @@ import argparse import filecmp import os +import json import shutil import subprocess import sys @@ -38,6 +39,7 @@ def main(argv): default='vulkan', choices=['vulkan', 'vulkansc'], help='Specify API name to generate') + parser.add_argument('--generated-version', help='sets the header version used to generate the repo') parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory') group = parser.add_mutually_exclusive_group() group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change') @@ -53,6 +55,19 @@ def main(argv): #base directory for the source repository repo_dir = common_codegen.repo_relative('') + # Update the api_version in the respective json files + if args.generated_version: + json_files = [] + json_files.append(common_codegen.repo_relative('icd/VkICD_mock_icd.json.in')) + for json_file in json_files: + with open(json_file) as f: + data = json.load(f) + + data["ICD"]["api_version"] = args.generated_version + + with open(json_file, mode='w', encoding='utf-8', newline='\n') as f: + f.write(json.dumps(data, indent=4)) + # get directory where generators will run if needed if args.verify or args.incremental: # generate in temp directory so we can compare or copy later From 730234d8e46f6eea3622a4a90a1f4ce537cf2321 Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Sat, 7 Oct 2023 08:21:33 +0900 Subject: [PATCH 45/56] icd: Add support to mock AHB commands --- icd/CMakeLists.txt | 4 ++++ icd/generated/function_definitions.h | 25 +++++++++++++++++++++++-- scripts/mock_icd_generator.py | 27 ++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index b3a2ca14..c42afb01 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -25,10 +25,14 @@ endif() set(MOCK_ICD_NAME VkICD_mock_icd) set(GENERATED generated) +option(BUILD_MOCK_ANDROID_SUPPORT "Build with Android Platform headers" OFF) + if(WIN32) add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN) elseif(APPLE) add_definitions(-DVK_USE_PLATFORM_MACOS_MVK) +elseif(BUILD_MOCK_ANDROID_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_XCB_SUPPORT) add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX) diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 1c24f9f5..c6671acf 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -1836,7 +1836,12 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferProperties( VkExternalBufferProperties* pExternalBufferProperties) { constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; - if (pExternalBufferInfo->handleType & supported_flags) { + if (pExternalBufferInfo->handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + // Can't have dedicated memory with AHB + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = pExternalBufferInfo->handleType; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } else if (pExternalBufferInfo->handleType & supported_flags) { pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; @@ -3057,6 +3062,14 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) { + auto *external_image_prop = lvl_find_mod_in_chain(pImageFormatProperties->pNext); + auto *external_image_format = lvl_find_in_chain(pImageFormatInfo->pNext); + if (external_image_prop && external_image_format && external_image_format->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + external_image_prop->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + } + GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); return VK_SUCCESS; } @@ -4714,7 +4727,15 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties) { -//Not a CREATE or DESTROY function + pProperties->allocationSize = 65536; + pProperties->memoryTypeBits = 1 << 5; // DEVICE_LOCAL only type + + auto *format_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_prop) { + // Likley using this format + format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; + format_prop->externalFormat = 37; + } return VK_SUCCESS; } diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 3de3e540..6b800922 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -454,6 +454,14 @@ return VK_SUCCESS; ''', 'vkGetPhysicalDeviceImageFormatProperties2KHR': ''' + auto *external_image_prop = lvl_find_mod_in_chain(pImageFormatProperties->pNext); + auto *external_image_format = lvl_find_in_chain(pImageFormatInfo->pNext); + if (external_image_prop && external_image_format && external_image_format->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + external_image_prop->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + external_image_prop->externalMemoryProperties.compatibleHandleTypes = external_image_format->handleType; + } + GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties); return VK_SUCCESS; ''', @@ -651,7 +659,12 @@ ''', 'vkGetPhysicalDeviceExternalBufferProperties':''' constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; - if (pExternalBufferInfo->handleType & supported_flags) { + if (pExternalBufferInfo->handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) { + // Can't have dedicated memory with AHB + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = pExternalBufferInfo->handleType; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } else if (pExternalBufferInfo->handleType & supported_flags) { pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; @@ -1043,6 +1056,18 @@ pGranularity->width = 1; pGranularity->height = 1; ''', +'vkGetAndroidHardwareBufferPropertiesANDROID': ''' + pProperties->allocationSize = 65536; + pProperties->memoryTypeBits = 1 << 5; // DEVICE_LOCAL only type + + auto *format_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_prop) { + // Likley using this format + format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; + format_prop->externalFormat = 37; + } + return VK_SUCCESS; +''', } # MockICDGeneratorOptions - subclass of GeneratorOptions. From 31b95ce2372bebb6172e9a546e257d94c162c423 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Mon, 9 Oct 2023 16:09:55 -0600 Subject: [PATCH 46/56] tests: Update googletest to 1.14 --- scripts/known_good.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/known_good.json b/scripts/known_good.json index 8cd74f5d..5e58ef75 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -59,7 +59,7 @@ "-Dgtest_force_shared_crt=ON", "-DBUILD_SHARED_LIBS=OFF" ], - "commit": "v1.13.0", + "commit": "v1.14.0", "optional": [ "tests" ] From 48686ee04f9a7905d415c3207c4b05824230aff2 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Tue, 10 Oct 2023 11:28:05 -0600 Subject: [PATCH 47/56] cube: Move android files to cube directory Despite being in the "common" folder these files are only used by vkcube. --- {common => cube/android}/README.md | 4 ++-- {common => cube/android}/android_util.cpp | 0 {common => cube/android}/android_util.h | 0 cube/android/jni/Android.mk | 8 ++++---- {common => cube/android}/vulkan_wrapper.cpp | 0 {common => cube/android}/vulkan_wrapper.h | 0 6 files changed, 6 insertions(+), 6 deletions(-) rename {common => cube/android}/README.md (87%) rename {common => cube/android}/android_util.cpp (100%) rename {common => cube/android}/android_util.h (100%) rename {common => cube/android}/vulkan_wrapper.cpp (100%) rename {common => cube/android}/vulkan_wrapper.h (100%) diff --git a/common/README.md b/cube/android/README.md similarity index 87% rename from common/README.md rename to cube/android/README.md index 3e496bee..75b1747f 100644 --- a/common/README.md +++ b/cube/android/README.md @@ -22,7 +22,7 @@ Copy contents of parsed_header into generate_vulkan_wrapper.py between the secti Then run the script: popd - ./generate_vulkan_wrapper.py ../common/vulkan_wrapper.h - ./generate_vulkan_wrapper.py ../common/vulkan_wrapper.cpp + ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.h + ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.cpp clang-format -i vulkan_wrapper.h clang-format -i vulkan_wrapper.cpp diff --git a/common/android_util.cpp b/cube/android/android_util.cpp similarity index 100% rename from common/android_util.cpp rename to cube/android/android_util.cpp diff --git a/common/android_util.h b/cube/android/android_util.h similarity index 100% rename from common/android_util.h rename to cube/android/android_util.h diff --git a/cube/android/jni/Android.mk b/cube/android/jni/Android.mk index cc4b93ce..090f7862 100644 --- a/cube/android/jni/Android.mk +++ b/cube/android/jni/Android.mk @@ -20,14 +20,14 @@ DEMO_DIR := $(SRC_DIR)/cube include $(CLEAR_VARS) LOCAL_MODULE := VkCube LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c \ - $(SRC_DIR)/common/vulkan_wrapper.cpp \ - $(SRC_DIR)/common/android_util.cpp + $(DEMO_DIR)/android/vulkan_wrapper.cpp \ + $(DEMO_DIR)/android/android_util.cpp LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ $(DEMO_DIR)/android/include \ $(SRC_DIR)/libs \ - $(SRC_DIR)/common \ + $(DEMO_DIR)/android/ \ $(SRC_DIR)/build-android/generated/include -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(SRC_DIR)/common/vulkan_wrapper.h +LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(DEMO_DIR)/android/vulkan_wrapper.h LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue LOCAL_LDLIBS := -llog -landroid LOCAL_LDFLAGS := -u ANativeActivity_onCreate diff --git a/common/vulkan_wrapper.cpp b/cube/android/vulkan_wrapper.cpp similarity index 100% rename from common/vulkan_wrapper.cpp rename to cube/android/vulkan_wrapper.cpp diff --git a/common/vulkan_wrapper.h b/cube/android/vulkan_wrapper.h similarity index 100% rename from common/vulkan_wrapper.h rename to cube/android/vulkan_wrapper.h From 09d1b5ed777d8f89bbe7bbe72a65a54a868689db Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Tue, 10 Oct 2023 12:45:34 -0600 Subject: [PATCH 48/56] cmake: Use pkg-config for Wayland --- cmake/Copyright_cmake.txt | 126 ------------------------------- cmake/FindWayland.cmake | 68 ----------------- cmake/FindWaylandProtocols.cmake | 18 ----- cmake/FindWaylandScanner.cmake | 18 ----- cube/CMakeLists.txt | 43 ++++++----- icd/CMakeLists.txt | 3 - vulkaninfo/CMakeLists.txt | 7 +- 7 files changed, 29 insertions(+), 254 deletions(-) delete mode 100644 cmake/Copyright_cmake.txt delete mode 100644 cmake/FindWayland.cmake delete mode 100644 cmake/FindWaylandProtocols.cmake delete mode 100644 cmake/FindWaylandScanner.cmake diff --git a/cmake/Copyright_cmake.txt b/cmake/Copyright_cmake.txt deleted file mode 100644 index 743c6341..00000000 --- a/cmake/Copyright_cmake.txt +++ /dev/null @@ -1,126 +0,0 @@ -CMake - Cross Platform Makefile Generator -Copyright 2000-2018 Kitware, Inc. and Contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of Kitware, Inc. nor the names of Contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- - -The following individuals and institutions are among the Contributors: - -* Aaron C. Meadows -* Adriaan de Groot -* Aleksey Avdeev -* Alexander Neundorf -* Alexander Smorkalov -* Alexey Sokolov -* Alex Turbov -* Andreas Pakulat -* Andreas Schneider -* André Rigland Brodtkorb -* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf -* Benjamin Eikel -* Bjoern Ricks -* Brad Hards -* Christopher Harvey -* Christoph Grüninger -* Clement Creusot -* Daniel Blezek -* Daniel Pfeifer -* Enrico Scholz -* Eran Ifrah -* Esben Mose Hansen, Ange Optimization ApS -* Geoffrey Viola -* Google Inc -* Gregor Jasny -* Helio Chissini de Castro -* Ilya Lavrenov -* Insight Software Consortium -* Jan Woetzel -* Kelly Thompson -* Konstantin Podsvirov -* Mario Bensi -* Mathieu Malaterre -* Matthaeus G. Chajdas -* Matthias Kretz -* Matthias Maennich -* Michael Stürmer -* Miguel A. Figueroa-Villanueva -* Mike Jackson -* Mike McQuaid -* Nicolas Bock -* Nicolas Despres -* Nikita Krupen'ko -* NVIDIA Corporation -* OpenGamma Ltd. -* Patrick Stotko -* Per Øyvind Karlsen -* Peter Collingbourne -* Petr Gotthard -* Philip Lowman -* Philippe Proulx -* Raffi Enficiaud, Max Planck Society -* Raumfeld -* Roger Leigh -* Rolf Eike Beer -* Roman Donchenko -* Roman Kharitonov -* Ruslan Baratov -* Sebastian Holtermann -* Stephen Kelly -* Sylvain Joubert -* Thomas Sondergaard -* Tobias Hunger -* Todd Gamblin -* Tristan Carel -* University of Dundee -* Vadim Zhukov -* Will Dicharry - -See version control history for details of individual contributions. - -The above copyright and license notice applies to distributions of -CMake in source and binary form. Third-party software packages supplied -with CMake under compatible licenses provide their own copyright notices -documented in corresponding subdirectories or source files. - ------------------------------------------------------------------------------- - -CMake was initially developed by Kitware with the following sponsorship: - - * National Library of Medicine at the National Institutes of Health - as part of the Insight Segmentation and Registration Toolkit (ITK). - - * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel - Visualization Initiative. - - * National Alliance for Medical Image Computing (NAMIC) is funded by the - National Institutes of Health through the NIH Roadmap for Medical Research, - Grant U54 EB005149. - - * Kitware, Inc. diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake deleted file mode 100644 index 758744d8..00000000 --- a/cmake/FindWayland.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# Try to find Wayland on a Unix system -# -# This will define: -# -# WAYLAND_FOUND - True if Wayland is found -# WAYLAND_LIBRARIES - Link these to use Wayland -# WAYLAND_INCLUDE_DIR - Include directory for Wayland -# WAYLAND_DEFINITIONS - Compiler flags for using Wayland -# -# In addition the following more fine grained variables will be defined: -# -# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES -# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES -# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES -# -# Copyright (c) 2013 Martin Gräßlin -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -IF (NOT WIN32) - IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES) - # In the cache already - SET(WAYLAND_FIND_QUIETLY TRUE) - ENDIF () - - # Use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) - - SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) - - FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) - - FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) - - set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR}) - - set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) - - list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) - - include(FindPackageHandleStandardArgs) - - set(FPHSA_NAME_MISMATCHED ON) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) - unset(FPHSA_NAME_MISMATCHED) - - MARK_AS_ADVANCED( - WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES - WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES - WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES - WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES - WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES - ) - -ENDIF () diff --git a/cmake/FindWaylandProtocols.cmake b/cmake/FindWaylandProtocols.cmake deleted file mode 100644 index 25cf2a62..00000000 --- a/cmake/FindWaylandProtocols.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# Wayland protocols Defines: -# -# * WAYLAND_PROTOCOLS_FOUND True if the wayland-protocols data path is found -# * WAYLAND_PROTOCOLS_PATH Path to the wayland-scanner executable -# - -if(NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(WAYLAND_PROTOCOLS_PATH REQUIRED wayland-protocols) - execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols - OUTPUT_VARIABLE WAYLAND_PROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) - - set(FPHSA_NAME_MISMATCHED ON) - find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_PROTOCOLS_PATH) - unset(FPHSA_NAME_MISMATCHED) - - mark_as_advanced(WAYLAND_PROTOCOLS_PATH) -endif() diff --git a/cmake/FindWaylandScanner.cmake b/cmake/FindWaylandScanner.cmake deleted file mode 100644 index d016c934..00000000 --- a/cmake/FindWaylandScanner.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# Wayland scanner Defines: -# -# * WAYLAND_SCANNER_FOUND True if wayland-scanner is found -# * WAYLAND_SCANNER_EXECUTABLE Path to the wayland-scanner executable -# - -if(NOT WIN32) - # Delegate to pkg-config for our first guess - find_package(PkgConfig) - pkg_check_modules(PKG_WAYLAND_SCANNER QUIET wayland-scanner) - find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner ${PKG_WAYLAND_SCANNER_PREFIX}/bin/wayland-scanner) - - set(FPHSA_NAME_MISMATCHED ON) - find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_SCANNER_EXECUTABLE) - unset(FPHSA_NAME_MISMATCHED) - - mark_as_advanced(WAYLAND_SCANNER_EXECUTABLE) -endif() diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 2318d912..61440492 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -33,10 +33,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") endif() if(BUILD_WSI_WAYLAND_SUPPORT) - find_package(Wayland REQUIRED) - find_package(WaylandScanner REQUIRED) - find_package(WaylandProtocols REQUIRED) - include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) + + pkg_get_variable(WAYLAND_SCANNER_EXECUTABLE wayland-scanner wayland_scanner) + message(STATUS "WAYLAND_SCANNER_EXECUTABLE = ${WAYLAND_SCANNER_EXECUTABLE}") + + pkg_get_variable(WAYLAND_PROTOCOLS_PATH wayland-protocols pkgdatadir) + message(STATUS "WAYLAND_PROTOCOLS_PATH = ${WAYLAND_PROTOCOLS_PATH}") set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml) add_custom_command(COMMENT "Generating xdg-shell protocol dispatch data" OUTPUT xdg-shell-code.c @@ -113,7 +116,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(NOT BUILD_WSI_WAYLAND_SUPPORT) message(FATAL_ERROR "Selected Wayland for vkcube build but not building Wayland support") endif() - link_libraries(${WAYLAND_CLIENT_LIBRARIES}) + link_libraries(PkgConfig::WAYLAND_CLIENT) set(CUBE_PLATFORM VK_USE_PLATFORM_WAYLAND_KHR) set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml) set(OPTIONAL_WAYLAND_DATA_FILES @@ -264,29 +267,33 @@ endif() if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") if(BUILD_WSI_WAYLAND_SUPPORT AND EXISTS ${WAYLAND_PROTOCOLS_PATH}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) - link_libraries(${WAYLAND_CLIENT_LIBRARIES}) - set(OPTIONAL_WAYLAND_DATA_FILES + add_executable(vkcube-wayland) + + target_sources(vkcube-wayland PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-code.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-header.h ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c - ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h) - add_executable(vkcube-wayland - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) + ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h + ) target_include_directories(vkcube-wayland PRIVATE ${CMAKE_CURRENT_BINARY_DIR} . ) - target_link_libraries(vkcube-wayland Vulkan::Headers Vulkan::Loader) - target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) + target_link_libraries(vkcube-wayland PRIVATE + Vulkan::Headers + Vulkan::Loader + PkgConfig::WAYLAND_CLIENT + ) + target_compile_definitions(vkcube-wayland PRIVATE VK_USE_PLATFORM_WAYLAND_KHR) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) if (NEED_RT) - target_link_libraries(vkcube-wayland rt) + target_link_libraries(vkcube-wayland PRIVATE rt) endif() install(TARGETS vkcube-wayland) diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index c42afb01..8ffed4e2 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -57,9 +57,6 @@ target_include_directories(VkICD_mock_icd PRIVATE ${GENERATED} . ) -if(BUILD_WSI_WAYLAND_SUPPORT) - target_include_directories(VkICD_mock_icd PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR}) -endif() if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang") target_compile_options(VkICD_mock_icd PRIVATE diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 37f6a57b..2fe0fc11 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -90,9 +90,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") endif() if(BUILD_WSI_WAYLAND_SUPPORT) - find_package(Wayland REQUIRED) - target_include_directories(vulkaninfo PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR}) - target_link_libraries(vulkaninfo ${WAYLAND_CLIENT_LIBRARIES}) + pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) + add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR) + + target_link_libraries(vulkaninfo PkgConfig::WAYLAND_CLIENT) target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_WAYLAND_KHR -DVK_NO_PROTOTYPES) endif() From 72291571c8e569cbcd5d924e0b1ad24cdefa4442 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Tue, 10 Oct 2023 15:30:07 -0600 Subject: [PATCH 49/56] cmake: vkcube/vulkaninfo successfully compile for Android --- .github/workflows/tools.yml | 32 ++++++++++++++++- CMakeLists.txt | 6 ++-- cube/CMakeLists.txt | 69 +++++++++++++++++++++++-------------- cube/android/CMakeLists.txt | 62 +++++++++++++++++++++++++++++++++ cube/macOS/cube/cube.cmake | 3 ++ icd/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 10 ++++++ 7 files changed, 153 insertions(+), 31 deletions(-) create mode 100644 cube/android/CMakeLists.txt diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 99c4b727..b9efdb75 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -192,7 +192,7 @@ jobs: - name: Build the tools run: ninja -C out/${{matrix.config}} - android: + ndk-build: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -209,6 +209,36 @@ jobs: cd build-android ./build_all.sh + android: + runs-on: ubuntu-22.04 + strategy: + matrix: + abi: [ armeabi-v7a, arm64-v8a ] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - uses: lukka/get-cmake@latest + - name: Configure + run: | + cmake -S . -B build/ --toolchain $ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \ + -D ANDROID_PLATFORM=23 \ + -D CMAKE_ANDROID_ARCH_ABI=${{matrix.abi}} \ + -D CMAKE_ANDROID_STL_TYPE=c++_static \ + -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ + -D CMAKE_BUILD_TYPE=Release \ + -D UPDATE_DEPS=ON \ + -D BUILD_TESTS=ON \ + -G "Ninja" + - name: Build + run: cmake --build build + - name: Test + working-directory: ./build + run: ctest --output-on-failure -C Release + - name: Install + run: cmake --install build --prefix /tmp + tools_codegen: runs-on: ubuntu-latest steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 53042b60..4e6b24e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,10 +65,8 @@ if(APPLE) message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") endif() -find_package(VulkanHeaders REQUIRED CONFIG) -if (NOT ANDROID) - find_package(VulkanLoader REQUIRED CONFIG) -endif() +find_package(VulkanHeaders QUIET CONFIG) +find_package(VulkanLoader QUIET CONFIG) include(GNUInstallDirs) diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 61440492..8ab409e9 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -171,40 +171,55 @@ endif() if(APPLE) include(macOS/cube/cube.cmake) -elseif(NOT WIN32) - add_executable(vkcube - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube Vulkan::Headers Vulkan::Loader) +elseif (ANDROID) + add_library(vkcube MODULE) + + target_sources(vkcube PRIVATE cube.c) + + add_subdirectory(android) + + target_link_libraries(vkcube PRIVATE Vulkan::Headers) +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") + add_executable(vkcube) + target_sources(vkcube PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ${OPTIONAL_WAYLAND_DATA_FILES} + ) target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) if (NEED_RT) - target_link_libraries(vkcube rt) + target_link_libraries(vkcube PRIVATE rt) endif() - - if (ENABLE_ADDRESS_SANITIZER) - target_compile_options(vkcube PUBLIC -fsanitize=address) - target_link_options(vkcube PUBLIC -fsanitize=address) - endif () + target_link_libraries(vkcube PRIVATE Vulkan::Headers Vulkan::Loader) +elseif(WIN32) + add_executable(vkcube WIN32) + target_sources(vkcube PRIVATE + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ) + target_link_libraries(vkcube PRIVATE Vulkan::Headers Vulkan::Loader) else() - add_executable(vkcube - WIN32 - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc) - target_link_libraries(vkcube Vulkan::Headers Vulkan::Loader) + message(FATAL_ERROR "Unsupported Platform!") +endif() + +if (ENABLE_ADDRESS_SANITIZER) + target_compile_options(vkcube PUBLIC -fsanitize=address) + target_link_options(vkcube PUBLIC -fsanitize=address) endif() target_include_directories(vkcube PRIVATE .) -if(APPLE) +if (ANDROID) + install(TARGETS vkcube DESTINATION ${CMAKE_INSTALL_LIBDIR}) +elseif(APPLE) # Keep RPATH so fixup_bundle can use it to find libraries set_target_properties(vkcube PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) install(TARGETS vkcube BUNDLE DESTINATION "cube") @@ -217,12 +232,16 @@ else() install(TARGETS vkcube) endif() +if (ANDROID) + return() +endif() + # ---------------------------------------------------------------------------- # vkcubepp if(APPLE) include(macOS/cubepp/cubepp.cmake) -elseif(NOT WIN32) +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") add_executable(vkcubepp cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert diff --git a/cube/android/CMakeLists.txt b/cube/android/CMakeLists.txt new file mode 100644 index 00000000..9d4e69c8 --- /dev/null +++ b/cube/android/CMakeLists.txt @@ -0,0 +1,62 @@ +# ~~~ +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +target_sources(vkcube PRIVATE + android_util.cpp + android_util.h + vulkan_wrapper.cpp + vulkan_wrapper.h +) + +target_include_directories(vkcube PRIVATE + include + . +) + +target_compile_options(vkcube PRIVATE + --include=${CMAKE_CURRENT_SOURCE_DIR}/vulkan_wrapper.h +) + +set_directory_properties(PROPERTIES "COMPILE_OPTIONS" "") # Disable compiler warnings for android glue + +set(native_app_glue_dir "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue") + +if (NOT EXISTS ${native_app_glue_dir}) + message(FATAL_ERROR "Couldn't find Android Native Glue directory!") +endif() + +# https://stackoverflow.com/questions/57189936/compiling-native-app-glue-c-results-in-an-invalid-library-file/76963564#76963564 +add_library(android_glue OBJECT) + +target_include_directories(android_glue PUBLIC ${native_app_glue_dir}) +target_sources(android_glue PRIVATE + ${native_app_glue_dir}/android_native_app_glue.c + ${native_app_glue_dir}/android_native_app_glue.h +) + +target_link_libraries(vkcube PRIVATE + android_glue + log + android +) + +# https://stackoverflow.com/questions/76631917/cmake-how-to-install-shared-stl-libraries-for-android/76656492#76656492 +if ("${CMAKE_ANDROID_STL_TYPE}" MATCHES "shared") + file(READ "${CMAKE_ANDROID_NDK}/meta/abis.json" JSON_FILE) + string(JSON TRIPLE GET "${JSON_FILE}" "${CMAKE_ANDROID_ARCH_ABI}" "triple") + install(FILES "${CMAKE_SYSROOT}/usr/lib/${TRIPLE}/libc++_shared.so" DESTINATION "${CMAKE_INSTALL_LIBDIR}") +endif() diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake index 15a56849..a3c5624e 100644 --- a/cube/macOS/cube/cube.cmake +++ b/cube/macOS/cube/cube.cmake @@ -57,6 +57,9 @@ target_include_directories(vkcube PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK # We do this so vulkaninfo is linked to an individual library and NOT a framework. target_link_libraries(vkcube Vulkan::Loader "-framework Cocoa -framework QuartzCore") +# Disable warnings about sprintf +target_compile_options(vkcube PRIVATE -Wno-deprecated-declarations) + set_target_properties(vkcube PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Info.plist) # The RESOURCE target property cannot be used in conjunction with the MACOSX_PACKAGE_LOCATION property. We need fine-grained diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt index 8ffed4e2..52ec92fc 100644 --- a/icd/CMakeLists.txt +++ b/icd/CMakeLists.txt @@ -122,7 +122,7 @@ add_custom_command(TARGET VkICD_mock_icd POST_BUILD # Require the user to ask that it be installed if they really want it. option(INSTALL_ICD "Install Mock icd") if (INSTALL_ICD) - message(NOTICE "Installing Mock ICD") + message(NOTICE "INSTALL_ICD enabled!") else() return() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9e419c9c..8d299ee5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,6 +16,16 @@ # ~~~ if (ANDROID) + + # Ensure ANativeActivity_onCreate is being exported from vkcube + find_program(GNU_NM NAMES nm) + if (GNU_NM) + add_test(NAME ANativeActivity_onCreate COMMAND ${GNU_NM} --dynamic $) + set_tests_properties(ANativeActivity_onCreate + PROPERTIES PASS_REGULAR_EXPRESSION "T ANativeActivity_onCreate" + ) + endif() + return() endif() From d6a6498781cbdd63c0c018f5ffab39e16e920035 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Tue, 10 Oct 2023 17:03:54 -0600 Subject: [PATCH 50/56] cmake: Remove ndk-build Successfully ran VkCube.apk on my Pixel3 closes #850 --- .github/workflows/tools.yml | 17 -- .gitignore | 11 +- BUILD.md | 71 +----- build-android/build_all.sh | 86 -------- build-android/install_all.sh | 76 ------- .../update_external_sources_android.bat | 134 ------------ .../update_external_sources_android.sh | 115 ---------- build-android/vulkan-headers_revision_android | 1 - build-android/vulkan-headers_url_android | 1 - cube/android/.gitignore | 3 - cube/android/{cube => }/AndroidManifest.xml | 5 +- cube/android/CMakeLists.txt | 2 + cube/android/README.md | 13 ++ .../cube-with-layers/AndroidManifest.xml | 27 --- .../android/cube-with-layers/custom_rules.xml | 25 --- .../cube-with-layers/res/values/strings.xml | 24 --- cube/android/cube/custom_rules.xml | 6 - cube/android/cube/res/values/strings.xml | 24 --- cube/android/jni/Android.mk | 36 ---- cube/android/jni/Application.mk | 20 -- scripts/android.py | 202 ++++++++++++++++++ 21 files changed, 235 insertions(+), 664 deletions(-) delete mode 100755 build-android/build_all.sh delete mode 100755 build-android/install_all.sh delete mode 100755 build-android/update_external_sources_android.bat delete mode 100755 build-android/update_external_sources_android.sh delete mode 100644 build-android/vulkan-headers_revision_android delete mode 100644 build-android/vulkan-headers_url_android delete mode 100644 cube/android/.gitignore rename cube/android/{cube => }/AndroidManifest.xml (84%) delete mode 100644 cube/android/cube-with-layers/AndroidManifest.xml delete mode 100644 cube/android/cube-with-layers/custom_rules.xml delete mode 100644 cube/android/cube-with-layers/res/values/strings.xml delete mode 100644 cube/android/cube/custom_rules.xml delete mode 100644 cube/android/cube/res/values/strings.xml delete mode 100644 cube/android/jni/Android.mk delete mode 100644 cube/android/jni/Application.mk create mode 100644 scripts/android.py diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b9efdb75..23d12188 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -192,23 +192,6 @@ jobs: - name: Build the tools run: ninja -C out/${{matrix.config}} - ndk-build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Setup Environment - run: | - echo "ANDROID_SDK_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV - echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV - echo "$ANDROID_SDK_ROOT/build-tools/31.0.0" >> $GITHUB_PATH - echo "$ANDROID_NDK_LATEST_HOME" >> $GITHUB_PATH - $ANDROID_SDK_ROOT/tools/bin/sdkmanager "platforms;android-23" - keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug" - - name: Build vkcube - run: | - cd build-android - ./build_all.sh - android: runs-on: ubuntu-22.04 strategy: diff --git a/.gitignore b/.gitignore index ec965a68..385d655a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# By default we install dependencies to the external directory +/external/* + +# Ignore any build directories +*build*/ + CMakeCache.txt CMakeLists.txt.user CMakeUserPresets.json @@ -18,10 +24,6 @@ out64/* *.vcxproj *.sdf *.filters -build -build32 -dbuild -build-android/external *.config *.creator *.creator.user @@ -29,4 +31,3 @@ build-android/external *.includes .vscode/ .DS_Store -external/ diff --git a/BUILD.md b/BUILD.md index a5423cf8..b157635f 100644 --- a/BUILD.md +++ b/BUILD.md @@ -516,73 +516,22 @@ Finally, rebuild the repository using `cmake` and `make`, as explained above. ## Building On Android -Install the required tools for Linux and Windows covered above, then add the -following. +TODO: https://github.com/KhronosGroup/Vulkan-Tools/issues/791 -### Android Build Requirements - -- Install [Android Studio 2.3](https://developer.android.com/studio/index.html) or later. -- From the "Welcome to Android Studio" splash screen, add the following components using - Configure > SDK Manager: - - SDK Platforms > Android 6.0 and newer - - SDK Tools > Android SDK Build-Tools - - SDK Tools > Android SDK Platform-Tools - - SDK Tools > NDK (Side by side) - -#### Add Android specifics to environment - -For each of the below, you may need to specify a different build-tools and ndk -versions, as Android Studio will roll them forward fairly regularly. - -On Linux: - - export ANDROID_SDK_HOME=$HOME/Android/sdk - export ANDROID_NDK_HOME=$HOME/Android/sdk/ndk/23.0.7599858 - export PATH=$ANDROID_NDK_HOME:$PATH - export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH - export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH - -On Windows: - - set ANDROID_SDK_HOME=%LOCALAPPDATA%\Android\sdk - set ANDROID_NDK_HOME=%LOCALAPPDATA%\Android\sdk\ndk\23.0.7599858 - set PATH=%ANDROID_NDK_HOME%;%PATH% - set PATH=%ANDROID_SDK_HOME%\platform-tools;%PATH% - set PATH=%ANDROID_SDK_HOME%\build-tools\31.0.0;%PATH% - -On OSX: - - export ANDROID_SDK_HOME=$HOME/Library/Android/sdk - export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk/23.0.7599858 - export PATH=$ANDROID_NDK_PATH:$PATH - export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH - export PATH=$ANDROID_SDK_HOME/build-tools/31.0.0:$PATH - -Note: If `jarsigner` is missing from your platform, you can find it in the -Android Studio install or in your Java installation. If you do not have Java, -you can get it with something like the following: - - sudo apt-get install openjdk-8-jdk - -### Android Build - -Use the following script to build the vkcube demo for Android: - - cd build-android - ./build_all.sh - -The APK can be installed on production devices with: +### Run vkcube - ./install_all.sh [-s ] +Use the following command to run vkcube for Android: -Note that there are no equivalent scripts on Windows yet, that work needs to -be completed. +```bash +cd build-android -### Run vkcube +# Optional +adb uninstall com.example.VkCube -Use the following command to run vkcube for Android: +adb install -r -g --no-incremental bin/VkCube.apk - adb shell am start com.example.VkCube/android.app.NativeActivity +adb shell am start com.example.VkCube/android.app.NativeActivity +``` ## Building on MacOS diff --git a/build-android/build_all.sh b/build-android/build_all.sh deleted file mode 100755 index 1a842e61..00000000 --- a/build-android/build_all.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ANDROID_BUILD_DIR=$(dirname $(readlink -f $0)) -PROJECT_DIR=$ANDROID_BUILD_DIR/.. - -if [ -z "${ANDROID_SDK_HOME}" ]; -then echo "Please set ANDROID_SDK_HOME, exiting"; exit 1; -else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}"; -fi - -if [ -z "${ANDROID_NDK_HOME}" ]; -then echo "Please set ANDROID_NDK_HOME, exiting"; exit 1; -else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}"; -fi - -if [[ $(uname) == "Linux" ]]; then - cores=$(nproc) || echo 4 -elif [[ $(uname) == "Darwin" ]]; then - cores=$(sysctl -n hw.ncpu) || echo 4 -fi - -function findtool() { - if [[ ! $(type -t $1) ]]; then - echo Command $1 not found, see ../BUILD.md; - exit 1; - fi -} - -# Check for dependencies -findtool aapt -findtool zipalign -findtool jarsigner - -set -ev - -DEMO_BUILD_DIR=$PROJECT_DIR/cube/android -echo DEMO_BUILD_DIR="${DEMO_BUILD_DIR}" - -function create_APK() { - aapt package -f -M AndroidManifest.xml -I "$ANDROID_SDK_HOME/platforms/android-23/android.jar" -S res -F bin/$1-unaligned.apk bin/libs - # update this logic to detect if key is already there. If so, use it, otherwise create it. - jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android bin/$1-unaligned.apk androiddebugkey - zipalign -f 4 bin/$1-unaligned.apk bin/$1.apk -} - -# -# update dependencies -# -( -pushd $ANDROID_BUILD_DIR -./update_external_sources_android.sh --no-build -popd -pushd $PROJECT_DIR -python3 scripts/generate_source.py $ANDROID_BUILD_DIR/third_party/Vulkan-Headers/registry --incremental -popd -) - -# -# build vkcube APK -# -( -pushd $DEMO_BUILD_DIR -ndk-build -j $cores -mkdir -p $DEMO_BUILD_DIR/cube/bin/libs/lib -cp -r $DEMO_BUILD_DIR/libs/* $DEMO_BUILD_DIR/cube/bin/libs/lib/ -cd $DEMO_BUILD_DIR/cube -create_APK vkcube -popd -) - -echo Builds succeeded -exit 0 diff --git a/build-android/install_all.sh b/build-android/install_all.sh deleted file mode 100755 index f2ecd902..00000000 --- a/build-android/install_all.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -# -# Parse parameters -# - -function printUsage { - echo "Supported parameters are:" - echo " -s|--serial (optional)" - echo - echo "i.e. ${0##*/} -s " - exit 1 -} - -if [[ $(($# % 2)) -ne 0 ]] -then - echo Parameters must be provided in pairs. - echo parameter count = $# - echo - printUsage - exit 1 -fi - -while [[ $# -gt 0 ]] -do - case $1 in - -s|--serial) - # include the flag, because we need to leave it off if not provided - serial="$2" - shift 2 - ;; - -*) - # unknown option - echo Unknown option: $1 - echo - printUsage - exit 1 - ;; - esac -done - -if [[ $serial ]]; then - echo serial = "${serial}" - serialFlag="-s $serial" - if [[ $(adb devices) != *"$serial"* ]] - then - echo Device not found: "${serial}" - echo - printUsage - exit 1 - fi -else - echo Using device $(adb get-serialno) -fi - -# Install everything built by build_all.sh -echo "adb $serialFlag install -r ../cube/android/cube/bin/vkcube.apk" -adb $serialFlag install -r ../cube/android/cube/bin/vkcube.apk - -exit $? diff --git a/build-android/update_external_sources_android.bat b/build-android/update_external_sources_android.bat deleted file mode 100755 index 5c6f2554..00000000 --- a/build-android/update_external_sources_android.bat +++ /dev/null @@ -1,134 +0,0 @@ -@echo off -REM Update source for vulkan-headers - -REM -REM Copyright 2016 The Android Open Source Project -REM Copyright (C) 2015 Valve Corporation -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM - -setlocal EnableDelayedExpansion -set errorCode=0 -set ANDROID_BUILD_DIR=%~dp0 -set BUILD_DIR=%ANDROID_BUILD_DIR% -set BASE_DIR=%BUILD_DIR%\third_party -set VULKAN_HEADERS_DIR=%BASE_DIR%\Vulkan-Headers - -for %%X in (where.exe) do (set FOUND=%%~$PATH:X) -if not defined FOUND ( - echo Dependency check failed: - echo where.exe not found - echo This script requires Windows Vista or later, which includes where.exe. - set errorCode=1 -) - -where /q git.exe -if %ERRORLEVEL% equ 1 ( - echo Dependency check failed: - echo git.exe not found - echo Git for Windows can be downloaded here: https://git-scm.com/download/win - echo Install and ensure git.exe makes it into your PATH - set errorCode=1 -) - -where /q ndk-build.cmd -if %ERRORLEVEL% equ 1 ( - echo Dependency check failed: - echo ndk-build.cmd not found - echo Android NDK can be downloaded here: http://developer.android.com/ndk/guides/setup.html - echo Install and ensure ndk-build.cmd makes it into your PATH - set errorCode=1 -) - -REM ensure where is working with below false test -REM where /q foo -REM if %ERRORLEVEL% equ 1 ( -REM echo foo -REM ) - -:main - -if %errorCode% neq 0 (goto:error) - -REM Read the target versions from external file, which is shared with Linux script - -if not exist %ANDROID_BUILD_DIR%\vulkan-headers_revision_android ( - echo. - echo Missing vulkan-headers_revision_android file. Place it in %ANDROID_BUILD_DIR% - set errorCode=1 - goto:error -) - -set /p VULKAN_HEADERS_REVISION= < vulkan-headers_revision_android -echo VULKAN_HEADERS_REVISION=%VULKAN_HEADERS_REVISION% - - -echo Creating vulkan-headers in %BASE_DIR% - -set sync-vulkan-headers=1 - -if %sync-vulkan-headers% equ 1 ( - if %ERRORLEVEL% neq 0 (goto:error) - if not exist %VULKAN_HEADERS_DIR% ( - call:create_vulkan-headers - ) - if %errorCode% neq 0 (goto:error) - call:update_vulkan-headers - if %errorCode% neq 0 (goto:error) -) - -echo. -echo Exiting -goto:finish - -:error -echo. -echo Halting due to error -goto:finish - -:finish -if not "%cd%\" == "%BUILD_DIR%" ( cd %BUILD_DIR% ) -endlocal -REM This needs a fix to return error, something like exit %errorCode% -REM Right now it is returning 0 -goto:eof - - - -REM // ======== Functions ======== // - -:create_vulkan-headers - echo. - echo Creating local vulkan-headers repository %VULKAN_HEADERS_DIR% - if not exist "%VULKAN_HEADERS_DIR%\" mkdir %VULKAN_HEADERS_DIR% - cd %VULKAN_HEADERS_DIR% - git clone https://github.com/KhronosGroup/Vulkan-Headers.git . - git checkout %VULKAN_HEADERS_REVISION% - if not exist %VULKAN_HEADERS_DIR%\registry ( - echo vulkan-headers source download failed! - set errorCode=1 - ) -goto:eof - -:update_vulkan-headers - echo. - echo Updating %VULKAN_HEADERS_DIR% - cd %VULKAN_HEADERS_DIR% - git fetch --all - git checkout %VULKAN_HEADERS_REVISION% - if not exist %VULKAN_HEADERS_DIR%\registry ( - echo vulkan-headers source update failed! - set errorCode=1 - ) -goto:eof diff --git a/build-android/update_external_sources_android.sh b/build-android/update_external_sources_android.sh deleted file mode 100755 index d86682d9..00000000 --- a/build-android/update_external_sources_android.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# Update source for vulkan-headers - -# Copyright 2016 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -sync_vulkan_headers=1 - -ANDROIDBUILDDIR=$PWD -BUILDDIR=$ANDROIDBUILDDIR -BASEDIR=$BUILDDIR/third_party - -VULKAN_HEADERS_REVISION=$(cat $ANDROIDBUILDDIR/vulkan-headers_revision_android) - -echo "VULKAN_HEADERS_REVISION=$VULKAN_HEADERS_REVISION" - -VULKAN_HEADERS_URL=$(cat $ANDROIDBUILDDIR/vulkan-headers_url_android) - -if [[ $(uname) == "Linux" ]]; then - cores="$(nproc || echo 4)" -elif [[ $(uname) == "Darwin" ]]; then - cores=$(sysctl -n hw.ncpu) -fi - -# -# Parse parameters -# - -function printUsage { - echo "Supported parameters are:" - echo " --abi (optional)" - echo " --no-build (optional)" - echo - echo "i.e. ${0##*/} --abi arm64-v8a \\" - exit 1 -} - -while [[ $# -gt 0 ]] -do - case $1 in - --abi) - abi="$2" - shift 2 - ;; - --no-build) - nobuild=1 - shift 1 - ;; - *) - # unknown option - echo Unknown option: $1 - echo - printUsage - exit 1 - ;; - esac -done - -echo abi=$abi -if [[ -z $abi ]] -then - echo No abi provided, so building for all supported abis. -fi - -echo no-build=$nobuild -if [[ $nobuild ]] -then - echo Skipping build. -fi - -function create_vulkan-headers () { - rm -rf $BASEDIR/Vulkan-Headers - echo "Creating local Vulkan-Headers repository ($BASEDIR/Vulkan-Headers)." - mkdir -p $BASEDIR/Vulkan-Headers - cd $BASEDIR/Vulkan-Headers - git clone $VULKAN_HEADERS_URL . - git checkout $VULKAN_HEADERS_REVISION -} - -function update_vulkan-headers () { - echo "Updating $BASEDIR/Vulkan-Headers" - cd $BASEDIR/Vulkan-Headers - if [[ $(git config --get remote.origin.url) != $VULKAN_HEADERS_URL ]]; then - echo "Vulkan-Headers URL mismatch, recreating local repo" - create_vulkan-headers - return - fi - git fetch --all - git checkout $VULKAN_HEADERS_REVISION -} - -if [ $sync_vulkan_headers -eq 1 ]; then - if [ ! -d "$BASEDIR/Vulkan-Headers" -o ! -d "$BASEDIR/Vulkan-Headers/.git" ]; then - create_vulkan-headers - fi - update_vulkan-headers -fi - -echo "" -echo "${0##*/} finished." - diff --git a/build-android/vulkan-headers_revision_android b/build-android/vulkan-headers_revision_android deleted file mode 100644 index 15a8013f..00000000 --- a/build-android/vulkan-headers_revision_android +++ /dev/null @@ -1 +0,0 @@ -v1.3.267 diff --git a/build-android/vulkan-headers_url_android b/build-android/vulkan-headers_url_android deleted file mode 100644 index 9ce98515..00000000 --- a/build-android/vulkan-headers_url_android +++ /dev/null @@ -1 +0,0 @@ -https://github.com/KhronosGroup/Vulkan-Headers.git diff --git a/cube/android/.gitignore b/cube/android/.gitignore deleted file mode 100644 index 8008f254..00000000 --- a/cube/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -libs -obj diff --git a/cube/android/cube/AndroidManifest.xml b/cube/android/AndroidManifest.xml similarity index 84% rename from cube/android/cube/AndroidManifest.xml rename to cube/android/AndroidManifest.xml index 1bf9080b..fbec106d 100644 --- a/cube/android/cube/AndroidManifest.xml +++ b/cube/android/AndroidManifest.xml @@ -6,15 +6,14 @@ - - + - + diff --git a/cube/android/CMakeLists.txt b/cube/android/CMakeLists.txt index 9d4e69c8..5783fa90 100644 --- a/cube/android/CMakeLists.txt +++ b/cube/android/CMakeLists.txt @@ -48,6 +48,8 @@ target_sources(android_glue PRIVATE ${native_app_glue_dir}/android_native_app_glue.h ) +set_target_properties(vkcube PROPERTIES OUTPUT_NAME "VkCube") + target_link_libraries(vkcube PRIVATE android_glue log diff --git a/cube/android/README.md b/cube/android/README.md index 75b1747f..08ed7488 100644 --- a/cube/android/README.md +++ b/cube/android/README.md @@ -26,3 +26,16 @@ Then run the script: ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.cpp clang-format -i vulkan_wrapper.h clang-format -i vulkan_wrapper.cpp + +# Running vkcube on Android + +```bash +cd build-android + +# Optional +adb uninstall com.example.VkCube + +adb install -r -g --no-incremental bin/VkCube.apk + +adb shell am start com.example.VkCube/android.app.NativeActivity +``` \ No newline at end of file diff --git a/cube/android/cube-with-layers/AndroidManifest.xml b/cube/android/cube-with-layers/AndroidManifest.xml deleted file mode 100644 index 50b216e4..00000000 --- a/cube/android/cube-with-layers/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cube/android/cube-with-layers/custom_rules.xml b/cube/android/cube-with-layers/custom_rules.xml deleted file mode 100644 index 0ca5933e..00000000 --- a/cube/android/cube-with-layers/custom_rules.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -VkCubeWithLayers: Creating libs-with-layers - - -VkCubeWithLayers: Copying libs from demos/android - - - - -VkCubeWithLayers: Copying layers from build-android - - - - - -VkCubeWithLayers: Overriding native.libs.absolute.dir with ${cubeWithLayersDir} - - - diff --git a/cube/android/cube-with-layers/res/values/strings.xml b/cube/android/cube-with-layers/res/values/strings.xml deleted file mode 100644 index ecd779e4..00000000 --- a/cube/android/cube-with-layers/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - VkCubeWithLayers - - diff --git a/cube/android/cube/custom_rules.xml b/cube/android/cube/custom_rules.xml deleted file mode 100644 index 31eb31ad..00000000 --- a/cube/android/cube/custom_rules.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - -vkcube: Overriding native.libs.absolute.dir with ../libs - - diff --git a/cube/android/cube/res/values/strings.xml b/cube/android/cube/res/values/strings.xml deleted file mode 100644 index 8adead25..00000000 --- a/cube/android/cube/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - VkCube - - diff --git a/cube/android/jni/Android.mk b/cube/android/jni/Android.mk deleted file mode 100644 index 090f7862..00000000 --- a/cube/android/jni/Android.mk +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(abspath $(call my-dir)) -SRC_DIR := $(LOCAL_PATH)/../../.. -DEMO_DIR := $(SRC_DIR)/cube - -include $(CLEAR_VARS) -LOCAL_MODULE := VkCube -LOCAL_SRC_FILES += $(DEMO_DIR)/cube.c \ - $(DEMO_DIR)/android/vulkan_wrapper.cpp \ - $(DEMO_DIR)/android/android_util.cpp -LOCAL_C_INCLUDES += $(SRC_DIR)/build-android/third_party/Vulkan-Headers/include \ - $(DEMO_DIR)/android/include \ - $(SRC_DIR)/libs \ - $(DEMO_DIR)/android/ \ - $(SRC_DIR)/build-android/generated/include -LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR --include=$(DEMO_DIR)/android/vulkan_wrapper.h -LOCAL_WHOLE_STATIC_LIBRARIES += android_native_app_glue -LOCAL_LDLIBS := -llog -landroid -LOCAL_LDFLAGS := -u ANativeActivity_onCreate -include $(BUILD_SHARED_LIBRARY) - -$(call import-module,android/native_app_glue) diff --git a/cube/android/jni/Application.mk b/cube/android/jni/Application.mk deleted file mode 100644 index 788ff73b..00000000 --- a/cube/android/jni/Application.mk +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2015 The Android Open Source Project -# Copyright (C) 2015 Valve Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 -APP_PLATFORM := android-23 -APP_STL := c++_static -APP_MODULES := VkCube -NDK_TOOLCHAIN_VERSION := clang diff --git a/scripts/android.py b/scripts/android.py new file mode 100644 index 00000000..f976a2f5 --- /dev/null +++ b/scripts/android.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python3 +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# NOTE: Android this documentation is crucial for understanding the layout of the NDK. +# https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md + +# NOTE: Environment variables we can rely on users/environments setting. +# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#environment-variables-2 + +import argparse +import os +import sys +import shutil +import subprocess + +# helper to define paths relative to the repo root +def RepoRelative(path): + return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', path)) + +# Points to the directory containing the top level CMakeLists.txt +PROJECT_SRC_DIR = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')) +if not os.path.isfile(f'{PROJECT_SRC_DIR}/CMakeLists.txt'): + print(f'PROJECT_SRC_DIR invalid! {PROJECT_SRC_DIR}') + sys.exit(1) + +# Runs a command in a directory and returns its return code. +# Directory is project root by default, or a relative path from project root +def RunShellCmd(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False): + # Flush stdout here. Helps when debugging on CI. + sys.stdout.flush() + + if start_dir != PROJECT_SRC_DIR: + start_dir = RepoRelative(start_dir) + cmd_list = command.split(" ") + + if verbose: + print(f'CICMD({cmd_list}, env={env})') + subprocess.check_call(cmd_list, cwd=start_dir, env=env) + +# Manifest file describing out test application +def get_android_manifest() -> str: + manifest = RepoRelative('cube/android/AndroidManifest.xml') + if not os.path.isfile(manifest): + print(f"Unable to find manifest for APK! {manifest}") + sys.exit(-1) + return manifest + +# Generate the APK from the CMake binaries +def generate_apk(SDK_ROOT : str, CMAKE_INSTALL_DIR : str) -> str: + apk_dir = RepoRelative('build-android/bin') + + # Delete APK directory since it could contain files from old runs + if os.path.isdir(apk_dir): + shutil.rmtree(apk_dir) + + shutil.copytree(CMAKE_INSTALL_DIR, apk_dir) + + android_manifest = get_android_manifest() + + android_jar = f"{SDK_ROOT}/platforms/android-26/android.jar" + if not os.path.isfile(android_jar): + print(f"Unable to find {android_jar}!") + sys.exit(-1) + + apk_name = 'VkCube' + + unaligned_apk = f'{apk_dir}/{apk_name}-unaligned.apk' + test_apk = f'{apk_dir}/{apk_name}.apk' + + # Create APK + RunShellCmd(f'aapt package -f -M {android_manifest} -I {android_jar} -F {unaligned_apk} {CMAKE_INSTALL_DIR}') + + # Align APK + RunShellCmd(f'zipalign -f 4 {unaligned_apk} {test_apk}') + + # Create Key (If it doesn't already exist) + debug_key = RepoRelative(f'{apk_dir}/debug.keystore') + ks_pass = 'android' + if not os.path.isfile(debug_key): + dname = 'CN=Android-Debug,O=Android,C=US' + RunShellCmd(f'keytool -genkey -v -keystore {debug_key} -alias androiddebugkey -storepass {ks_pass} -keypass {ks_pass} -keyalg RSA -keysize 2048 -validity 10000 -dname {dname}') + + # Sign APK + RunShellCmd(f'apksigner sign --verbose --ks {debug_key} --ks-pass pass:{ks_pass} {test_apk}') + +# Android APKs can contain binaries for multiple ABIs (armeabi-v7a, arm64-v8a, x86, x86_64). +# https://en.wikipedia.org/wiki/Apk_(file_format)#Package_contents +# +# As a result CMake will need to be run multiple times to create a complete test APK that can be run on any Android device. +def main(): + configs = ['Release', 'Debug'] + + parser = argparse.ArgumentParser() + parser.add_argument('--config', type=str, choices=configs, default=configs[0]) + parser.add_argument('--app-abi', dest='android_abi', type=str, default="arm64-v8a") + parser.add_argument('--app-stl', dest='android_stl', type=str, choices=["c++_static", "c++_shared"], default="c++_static") + parser.add_argument('--apk', action='store_true', help='Generate an APK as a post build step.') + parser.add_argument('--tests', action='store_true', help='Build tests.') + parser.add_argument('--clean', action='store_true', help='Cleans CMake build artifacts') + args = parser.parse_args() + + cmake_config = args.config + android_abis = args.android_abi.split(" ") + android_stl = args.android_stl + create_apk = args.apk + build_tests = args.tests + clean = args.clean + + if "ANDROID_NDK_HOME" not in os.environ: + print("Cannot find ANDROID_NDK_HOME!") + sys.exit(1) + + android_ndk_home = os.environ.get('ANDROID_NDK_HOME') + android_toolchain = f'{android_ndk_home}/build/cmake/android.toolchain.cmake' + + # The only tool we require for building is CMake/Ninja + required_cli_tools = ['cmake', 'ninja'] + + # If we are building an APK we need a few more tools. + if create_apk: + if "ANDROID_SDK_ROOT" not in os.environ: + print("Cannot find ANDROID_SDK_ROOT!") + sys.exit(1) + + android_sdk_root = os.environ.get('ANDROID_SDK_ROOT') + print(f"ANDROID_SDK_ROOT = {android_sdk_root}") + required_cli_tools += ['aapt', 'zipalign', 'keytool', 'apksigner'] + + print(f"ANDROID_NDK_HOME = {android_ndk_home}") + print(f"Build configured for {cmake_config} | {android_stl} | {android_abis} | APK {create_apk}") + + if not os.path.isfile(android_toolchain): + print(f'Unable to find android.toolchain.cmake at {android_toolchain}') + exit(-1) + + for tool in required_cli_tools: + path = shutil.which(tool) + if path is None: + print(f"Unable to find {tool}!") + exit(-1) + + print(f"Using {tool} : {path}") + + cmake_install_dir = RepoRelative('build-android/libs') + + # Delete install directory since it could contain files from old runs + if os.path.isdir(cmake_install_dir): + print("Cleaning CMake install") + shutil.rmtree(cmake_install_dir) + + for abi in android_abis: + build_dir = RepoRelative(f'build-android/cmake/{abi}') + lib_dir = f'lib/{abi}' + + if clean: + print("Deleting CMakeCache.txt") + + # Delete CMakeCache.txt to ensure clean builds + # NOTE: CMake 3.24 has --fresh which would be better to use in the future. + cmake_cache = f'{build_dir}/CMakeCache.txt' + if os.path.isfile(cmake_cache): + os.remove(cmake_cache) + + cmake_cmd = f'cmake -S . -B {build_dir} -G Ninja' + + cmake_cmd += f' -D CMAKE_BUILD_TYPE={cmake_config}' + cmake_cmd += f' -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR={build_dir}' + cmake_cmd += f' -D CMAKE_TOOLCHAIN_FILE={android_toolchain}' + cmake_cmd += f' -D CMAKE_ANDROID_ARCH_ABI={abi}' + cmake_cmd += f' -D CMAKE_INSTALL_LIBDIR={lib_dir}' + cmake_cmd += f' -D BUILD_TESTS={build_tests}' + cmake_cmd += f' -D CMAKE_ANDROID_STL_TYPE={android_stl}' + + cmake_cmd += ' -D ANDROID_PLATFORM=26' + cmake_cmd += ' -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO' + + RunShellCmd(cmake_cmd) + + build_cmd = f'cmake --build {build_dir}' + RunShellCmd(build_cmd) + + install_cmd = f'cmake --install {build_dir} --prefix {cmake_install_dir}' + RunShellCmd(install_cmd) + + if create_apk: + generate_apk(SDK_ROOT = android_sdk_root, CMAKE_INSTALL_DIR = cmake_install_dir) + +if __name__ == '__main__': + main() From ef55edf1d63d1de0df9c81bff305c975074b2a5c Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Wed, 11 Oct 2023 16:16:25 +0900 Subject: [PATCH 51/56] icd: Add VkAndroidHardwareBufferFormatResolvePropertiesANDROID --- icd/generated/function_definitions.h | 5 +++++ scripts/mock_icd_generator.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index c6671acf..1fb95340 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -4736,6 +4736,11 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetAndroidHardwareBufferPropertiesANDROID( format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; format_prop->externalFormat = 37; } + + auto *format_resolve_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_resolve_prop) { + format_resolve_prop->colorAttachmentFormat = VK_FORMAT_R8G8B8A8_UNORM; + } return VK_SUCCESS; } diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 6b800922..bb87af35 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -1066,6 +1066,11 @@ format_prop->format = VK_FORMAT_R8G8B8A8_UNORM; format_prop->externalFormat = 37; } + + auto *format_resolve_prop = lvl_find_mod_in_chain(pProperties->pNext); + if (format_resolve_prop) { + format_resolve_prop->colorAttachmentFormat = VK_FORMAT_R8G8B8A8_UNORM; + } return VK_SUCCESS; ''', } From 08165e9f6459081d91661ee4b0fc73db85d5d655 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 11 Oct 2023 11:59:10 -0600 Subject: [PATCH 52/56] gn: Cleanup chromium build --- .github/workflows/tools.yml | 34 ++--------- .gitignore | 13 +++++ .gn | 24 -------- BUILD.gn | 2 +- {build-gn => scripts/gn}/DEPS | 0 .../gn/generate_vulkan_icd_json.py | 2 +- scripts/gn/gn.py | 56 +++++++++++++++++++ .../gn}/secondary/build_overrides/build.gni | 2 +- .../build_overrides/vulkan_headers.gni | 2 +- .../build_overrides/vulkan_tools.gni | 2 +- {build-gn => scripts/gn}/update_deps.sh | 20 +++++-- 11 files changed, 96 insertions(+), 61 deletions(-) delete mode 100644 .gn rename {build-gn => scripts/gn}/DEPS (100%) rename build-gn/generate_vulkan_layers_json.py => scripts/gn/generate_vulkan_icd_json.py (100%) create mode 100755 scripts/gn/gn.py rename {build-gn => scripts/gn}/secondary/build_overrides/build.gni (94%) rename {build-gn => scripts/gn}/secondary/build_overrides/vulkan_headers.gni (93%) rename {build-gn => scripts/gn}/secondary/build_overrides/vulkan_tools.gni (94%) rename {build-gn => scripts/gn}/update_deps.sh (69%) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 23d12188..21c1c2c9 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -164,34 +164,6 @@ jobs: - name: Verify generated source files run: python scripts/generate_source.py --verify external/Release/Vulkan-Headers/build/install/share/vulkan/registry - gn: - runs-on: ubuntu-20.04 - - strategy: - matrix: - config: [ Debug, Release ] - - steps: - - uses: actions/checkout@v3 - - - name: Get depot tools - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools - echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH - - name: Fetch and install headers - run: ./build-gn/update_deps.sh - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=true" - if: matrix.config != 'Release' - - - name: Generate build files - run: gn gen out/${{matrix.config}} --args="is_debug=false" - if: matrix.config == 'Release' - - - name: Build the tools - run: ninja -C out/${{matrix.config}} - android: runs-on: ubuntu-22.04 strategy: @@ -233,3 +205,9 @@ jobs: - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON - run: cmake --build build --target tools_codegen - run: git diff --exit-code + + chromium: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: scripts/gn/gn.py diff --git a/.gitignore b/.gitignore index 385d655a..8bac04ad 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,16 @@ out64/* *.includes .vscode/ .DS_Store + +# Chromium build artifacts +.cipd/ +.gn +.gclient +.gclient_entries +.gclient_previous_sync_commits +out/ +third_party/ +buildtools/ +depot_tools/ +testing/ +tools/ diff --git a/.gn b/.gn deleted file mode 100644 index 5ac6b839..00000000 --- a/.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2019 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -buildconfig = "//build/config/BUILDCONFIG.gn" -secondary_source = "//build-gn/secondary/" - -script_executable = "python3" - -default_args = { - clang_use_chrome_plugins = false - use_custom_libcxx = false -} - diff --git a/BUILD.gn b/BUILD.gn index f280e489..08bd22a1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -54,7 +54,7 @@ if (!is_android) { } action("vulkan_gen_icd_json_file") { - script = "build-gn/generate_vulkan_layers_json.py" + script = "scripts/gn/generate_vulkan_icd_json.py" public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] diff --git a/build-gn/DEPS b/scripts/gn/DEPS similarity index 100% rename from build-gn/DEPS rename to scripts/gn/DEPS diff --git a/build-gn/generate_vulkan_layers_json.py b/scripts/gn/generate_vulkan_icd_json.py similarity index 100% rename from build-gn/generate_vulkan_layers_json.py rename to scripts/gn/generate_vulkan_icd_json.py index c4135db4..498bc07e 100755 --- a/build-gn/generate_vulkan_layers_json.py +++ b/scripts/gn/generate_vulkan_icd_json.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -# Copyright (C) 2016 The ANGLE Project Authors. # Copyright (c) 2022-2023 LunarG, Inc. +# Copyright (C) 2016 The ANGLE Project Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/gn/gn.py b/scripts/gn/gn.py new file mode 100755 index 00000000..52b20c58 --- /dev/null +++ b/scripts/gn/gn.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Khronos Group Inc. +# Copyright 2023 Valve Corporation +# Copyright 2023 LunarG, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import subprocess +import sys + +# helper to define paths relative to the repo root +def RepoRelative(path): + return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../', path)) + +def BuildGn(): + if not os.path.exists(RepoRelative("depot_tools")): + print("Cloning Chromium depot_tools\n", flush=True) + clone_cmd = 'git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools'.split(" ") + subprocess.call(clone_cmd) + + os.environ['PATH'] = os.environ.get('PATH') + ":" + RepoRelative("depot_tools") + + print("Updating Repo Dependencies and GN Toolchain\n", flush=True) + update_cmd = './scripts/gn/update_deps.sh' + subprocess.call(update_cmd) + + print("Checking Header Dependencies\n", flush=True) + gn_check_cmd = 'gn gen --check out/Debug'.split(" ") + subprocess.call(gn_check_cmd) + + print("Generating Ninja Files\n", flush=True) + gn_gen_cmd = 'gn gen out/Debug'.split(" ") + subprocess.call(gn_gen_cmd) + + print("Running Ninja Build\n", flush=True) + ninja_build_cmd = 'ninja -C out/Debug'.split(" ") + subprocess.call(ninja_build_cmd) + +# +# Module Entrypoint +def main(): + try: + BuildGn() + + except subprocess.CalledProcessError as proc_error: + print('Command "%s" failed with return code %s' % (' '.join(proc_error.cmd), proc_error.returncode)) + sys.exit(proc_error.returncode) + except Exception as unknown_error: + print('An unkown error occured: %s', unknown_error) + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/build-gn/secondary/build_overrides/build.gni b/scripts/gn/secondary/build_overrides/build.gni similarity index 94% rename from build-gn/secondary/build_overrides/build.gni rename to scripts/gn/secondary/build_overrides/build.gni index c6c11fa9..dbf47039 100644 --- a/build-gn/secondary/build_overrides/build.gni +++ b/scripts/gn/secondary/build_overrides/build.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/secondary/build_overrides/vulkan_headers.gni b/scripts/gn/secondary/build_overrides/vulkan_headers.gni similarity index 93% rename from build-gn/secondary/build_overrides/vulkan_headers.gni rename to scripts/gn/secondary/build_overrides/vulkan_headers.gni index 0cd8307d..5f24b39e 100644 --- a/build-gn/secondary/build_overrides/vulkan_headers.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_headers.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2020 LunarG, Inc. +# Copyright (c) 2020-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/secondary/build_overrides/vulkan_tools.gni b/scripts/gn/secondary/build_overrides/vulkan_tools.gni similarity index 94% rename from build-gn/secondary/build_overrides/vulkan_tools.gni rename to scripts/gn/secondary/build_overrides/vulkan_tools.gni index 9f808460..c62fb64d 100644 --- a/build-gn/secondary/build_overrides/vulkan_tools.gni +++ b/scripts/gn/secondary/build_overrides/vulkan_tools.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/build-gn/update_deps.sh b/scripts/gn/update_deps.sh similarity index 69% rename from build-gn/update_deps.sh rename to scripts/gn/update_deps.sh index 41da2ab3..763c3058 100755 --- a/build-gn/update_deps.sh +++ b/scripts/gn/update_deps.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2019 LunarG, Inc. +# Copyright (c) 2019-2023 LunarG, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,17 +15,29 @@ # limitations under the License. # Execute at repo root -cd "$(dirname $0)/.." +cd "$(dirname $0)/../../" # Use update_deps.py to update source dependencies from /scripts/known_good.json scripts/update_deps.py --dir="external" --no-build -# Use gclient to update toolchain dependencies from /build-gn/DEPS (from chromium) +cat << EOF > .gn +buildconfig = "//build/config/BUILDCONFIG.gn" +secondary_source = "//scripts/gn/secondary/" + +script_executable = "python3" + +default_args = { + clang_use_chrome_plugins = false + use_custom_libcxx = false +} +EOF + +# Use gclient to update toolchain dependencies from /scripts/gn/DEPS (from chromium) cat << EOF >> .gclient solutions = [ { "name" : ".", "url" : "https://github.com/KhronosGroup/Vulkan-Tools", - "deps_file" : "build-gn/DEPS", + "deps_file" : "scripts/gn/DEPS", "managed" : False, "custom_deps" : { }, From 413f14eef5de853163539d96ac0eaa26a196c45e Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 11 Oct 2023 13:57:13 -0600 Subject: [PATCH 53/56] cmake: Remove pointless code This doesn't do anything anymore --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e6b24e2..a1a6eb4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ # limitations under the License. # ~~~ cmake_minimum_required(VERSION 3.17.2) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") project(Vulkan-Tools) From 92bf3cac80883a2ba6b80c4e5f7b127c14b0a9c2 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 11 Oct 2023 16:06:45 -0600 Subject: [PATCH 54/56] docs: Cleanup BUILD.md and various other documents - Fixup build documentation up to standard set by VVL - Add documentation for running vkcube/vulkaninfo on Android - Make BUILD_WERROR off by default - Remove out of date documentation - Remove pointless documentation closes #791 --- .github/workflows/tools.yml | 15 +- BUILD.md | 760 ++++++++-------------------- CMakeLists.txt | 3 +- CONTRIBUTING.md | 22 +- cube/android/README.md | 13 - scripts/android.py | 0 tests/README.md | 34 ++ vulkaninfo/CMakeLists.txt | 8 - vulkaninfo/vulkaninfo.md | 2 +- windows-runtime-installer/README.md | 3 +- 10 files changed, 256 insertions(+), 604 deletions(-) mode change 100644 => 100755 scripts/android.py create mode 100644 tests/README.md diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 21c1c2c9..eeaebddf 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -76,7 +76,15 @@ jobs: with: key: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.cc }}-${{matrix.cube_wsi}} - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCUBE_WSI_SELECTION=${{matrix.cube_wsi}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON + run: | + cmake -S. -B build -G "Ninja" \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D CUBE_WSI_SELECTION=${{matrix.cube_wsi}} \ + -D UPDATE_DEPS=ON \ + -D BUILD_WERROR=ON \ + -D INSTALL_ICD=ON \ + -D BUILD_TESTS=ON \ + -D ENABLE_ADDRESS_SANITIZER=ON env: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} @@ -116,7 +124,7 @@ jobs: arch: ${{ matrix.arch }} - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{matrix.config}} -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D BUILD_WERROR=ON - name: Build run: cmake --build ./build @@ -150,7 +158,7 @@ jobs: run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - name: Configure - run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON + run: cmake -S. -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON -D INSTALL_ICD=ON -D BUILD_TESTS=ON -D ENABLE_ADDRESS_SANITIZER=ON -D BUILD_WERROR=ON env: MACOSX_DEPLOYMENT_TARGET: 10.15 @@ -185,6 +193,7 @@ jobs: -D CMAKE_BUILD_TYPE=Release \ -D UPDATE_DEPS=ON \ -D BUILD_TESTS=ON \ + -D BUILD_WERROR=ON \ -G "Ninja" - name: Build run: cmake --build build diff --git a/BUILD.md b/BUILD.md index b157635f..d939cad1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,412 +1,103 @@ # Build Instructions -Instructions for building this repository on Linux, Windows, Android, and MacOS. - -## Index - -1. [Contributing](#contributing-to-the-repository) -1. [Repository Content](#repository-content) -1. [Repository Set-Up](#repository-set-up) -1. [Windows Build](#building-on-windows) +1. [Requirements](#requirements) +1. [Building Overview](#building-overview) +1. [Generated source code](#generated-source-code) +1. [Dependencies](#dependencies) 1. [Linux Build](#building-on-linux) -1. [Android Build](#building-on-android) +1. [Windows Build](#building-on-windows) 1. [MacOS build](#building-on-macos) +1. [Android Build](#building-for-android) +1. [Installed Files](#installed-files) -## Contributing to the Repository - -If you intend to contribute, the preferred work flow is for you to develop -your contribution in a fork of this repository in your GitHub account and then -submit a pull request. Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file -in this repository for more details. - -## Repository Content - -This repository contains the source code necessary to build the following components: - -- vulkaninfo -- vkcube and vkcubepp demos -- mock ICD - -### Installed Files - -The `install` target installs the following files under the directory -indicated by *install_dir*: - -- *install_dir*`/bin` : The `vulkaninfo`, `vkcube` and `vkcubepp` executables - -`MockICD` if `INSTALL_ICD` is configured: - -For Unix operating systems: - -- *install_dir*`/bin` : The Mock ICD -- *install_dir*`/share/vulkan/icd.d` : Mock ICD JSON - -For WIN32: - -- *install_dir*`/bin` : The Mock ICD and JSON - -## Repository Set-Up - -### Display Drivers - -This repository does not contain a Vulkan-capable driver. You will need to -obtain and install a Vulkan driver from your graphics hardware vendor or from -some other suitable source if you intend to run Vulkan applications. - -### Download the Repository - -To create your local git repository: - - git clone https://github.com/KhronosGroup/Vulkan-Tools.git - -### Repository Dependencies - -This repository attempts to resolve some of its dependencies by using -components found from the following places, in this order: - -1. CMake or Environment variable overrides (e.g., -DVULKAN_HEADERS_INSTALL_DIR) -1. LunarG Vulkan SDK, located by the `VULKAN_SDK` environment variable -1. System-installed packages, mostly applicable on Linux - -Dependencies that cannot be resolved by the SDK or installed packages must be -resolved with the "install directory" override and are listed below. The -"install directory" override can also be used to force the use of a specific -version of that dependency. - -#### Vulkan-Headers - -This repository has a required dependency on the -[Vulkan Headers repository](https://github.com/KhronosGroup/Vulkan-Headers). -You must clone the headers repository and build its `install` target before -building this repository. The Vulkan-Headers repository is required because it -contains the Vulkan API definition files (registry) that are required to build -the mock ICD. You must also take note of the headers install directory and -pass it on the CMake command line for building this repository, as described -below. - -Note that this dependency can be ignored if not building the mock ICD -(CMake option: `-DBUILD_ICD=OFF`). - -### Build and Install Directories - -A common convention is to place the build directory in the top directory of -the repository with a name of `build` and place the install directory as a -child of the build directory with the name `install`. The remainder of these -instructions follow this convention, although you can use any name for these -directories and place them in any location. - -### Building Dependent Repositories with Known-Good Revisions +## Requirements -There is a Python utility script, `scripts/update_deps.py`, that you can use to -gather and build the dependent repositories mentioned above. This script uses -information stored in the `scripts/known_good.json` file to check out dependent -repository revisions that are known to be compatible with the revision of this -repository that you currently have checked out. As such, this script is useful -as a quick-start tool for common use cases and default configurations. +1. CMake >= 3.17.2 +1. C++17 compatible toolchain +1. Git +1. Python >= 3.10 -For all platforms, start with: - - git clone git@github.com:KhronosGroup/Vulkan-Tools.git - cd Vulkan-Tools - mkdir build - cd build - -For 64-bit Linux and MacOS, continue with: - - ../scripts/update_deps.py - cmake -C helper.cmake .. - cmake --build . - -For 64-bit Windows, continue with: - - ..\scripts\update_deps.py --arch x64 - cmake -A x64 -C helper.cmake .. - cmake --build . - -For 32-bit Windows, continue with: - - ..\scripts\update_deps.py --arch Win32 - cmake -A Win32 -C helper.cmake .. - cmake --build . - -Please see the more detailed build information later in this file if you have -specific requirements for configuring and building these components. - -#### Notes - -- You may need to adjust some of the CMake options based on your platform. See - the platform-specific sections later in this document. -- The `update_deps.py` script fetches and builds the dependent repositories in - the current directory when it is invoked. In this case, they are built in - the `build` directory. -- The `build` directory is also being used to build this - (Vulkan-Tools) repository. But there shouldn't be any conflicts - inside the `build` directory between the dependent repositories and the - build files for this repository. -- The `--dir` option for `update_deps.py` can be used to relocate the - dependent repositories to another arbitrary directory using an absolute or - relative path. -- The `update_deps.py` script generates a file named `helper.cmake` and places - it in the same directory as the dependent repositories (`build` in this - case). This file contains CMake commands to set the CMake `*_INSTALL_DIR` - variables that are used to point to the install artifacts of the dependent - repositories. You can use this file with the `cmake -C` option to set these - variables when you generate your build files with CMake. This lets you avoid - entering several `*_INSTALL_DIR` variable settings on the CMake command line. -- If using "MINGW" (Git For Windows), you may wish to run - `winpty update_deps.py` in order to avoid buffering all of the script's - "print" output until the end and to retain the ability to interrupt script - execution. -- Please use `update_deps.py --help` to list additional options and read the - internal documentation in `update_deps.py` for further information. +NOTE: Python is needed for working on generated code, and helping grab dependencies. +While it's not technically required, it's practically required for most users. ### Generated source code -This repository contains generated source code in the `icd/generated` -directory which is not intended to be modified directly. Instead, changes should be -made to the corresponding generator in the `scripts` directory. The source files can -then be regenerated using `scripts/generate_source.py`: +This repository contains generated source code which is not intended to be modified directly. - python3 scripts/generate_source.py PATH_TO_VULKAN_HEADERS_REGISTRY_DIR - -A helper CMake target `VulkanTools_generated_source` is also provided to simplify -the invocation of `scripts/generate_source.py` from the build directory: - - cmake --build . --target VulkanTools_generated_source - -### Build Options - -When generating native platform build files through CMake, several options can -be specified to customize the build. Some of the options are binary on/off -options, while others take a string as input. The following is a table of all -on/off options currently supported by this repository: - -| Option | Platform | Default | Description | -| -------------------------- | -------- | ------- | -------------------------------------------------------------------------------- | -| BUILD_TESTS | All | `OFF` | Controls whether the tests are built. | -| BUILD_CUBE | All | `ON` | Controls whether or not the vkcube demo is built. | -| COMPILE_CUBE_SHADERS | All | `OFF` | Controls whether glslang is found and cube's shaders are compiled | -| BUILD_VULKANINFO | All | `ON` | Controls whether or not the vulkaninfo utility is built. | -| BUILD_ICD | All | `ON` | Controls whether or not the mock ICD is built. | -| INSTALL_ICD | All | `OFF` | Controls whether or not the mock ICD is installed as part of the install target. | -| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the components with XCB support. | -| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the components with Xlib support. | -| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the components with Wayland support. | -| BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the components with DirectFB support. | - -The following is a table of all string options currently supported by this repository: - -| Option | Platform | Default | Description | -| -------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------- | -| VULKANINFO_BUILD_DLL_VERSIONINFO | Windows | `""` | Set the Windows specific version information for Vulkaninfo. Format is "major.minor.patch.build". | - -These variables should be set using the `-D` option when invoking CMake to -generate the native platform files. - -## Building On Windows +A helper CMake target `tools_codegen` is also provided to simplify the invocation of `scripts/generate_source.py` from the build directory: -### Windows Development Environment Requirements - -- Windows - - Any Personal Computer version supported by Microsoft -- Microsoft [Visual Studio](https://www.visualstudio.com/) - - Versions - - [2013 (update 4)](https://www.visualstudio.com/vs/older-downloads/) - - [2015](https://www.visualstudio.com/vs/older-downloads/) - - [2017](https://www.visualstudio.com/vs/downloads/) - - The Community Edition of each of the above versions is sufficient, as - well as any more capable edition. -- [CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-win64-x64.zip) is recommended. - - Use the installer option to add CMake to the system PATH -- Git Client Support - - [Git for Windows](http://git-scm.com/download/win) is a popular solution - for Windows - - Some IDEs (e.g., [Visual Studio](https://www.visualstudio.com/), - [GitHub Desktop](https://desktop.github.com/)) have integrated - Git client support - -### Windows Build - Microsoft Visual Studio - -The general approach is to run CMake to generate the Visual Studio project -files. Then either run CMake with the `--build` option to build from the -command line or use the Visual Studio IDE to open the generated solution and -work with the solution interactively. - -#### Windows Quick Start - - cd Vulkan-Tools - mkdir build - cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir - cmake --build . - -The above commands instruct CMake to find and use the default Visual Studio -installation to generate a Visual Studio solution and projects for the x64 -architecture. The second CMake command builds the Debug (default) -configuration of the solution. - -See below for the details. - -#### Use `CMake` to Create the Visual Studio Project Files - -Change your current directory to the top of the cloned repository directory, -create a build directory and generate the Visual Studio project files: - - cd Vulkan-Tools - mkdir build - cd build - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir - -> Note: The `..` parameter tells `cmake` the location of the top of the -> repository. If you place your build directory someplace else, you'll need to -> specify the location of the repository top differently. +```bash +cmake -S . -B build -D TOOLS_CODEGEN=ON +cmake --build build --target tools_codegen +``` -The `-A` option is used to select either the "Win32" or "x64" architecture. +NOTE: `TOOLS_CODEGEN` is `OFF` by default. -If a generator for a specific version of Visual Studio is required, you can -specify it for Visual Studio 2015, for example, with: +## Building Overview - 64-bit: -G "Visual Studio 14 2015 Win64" - 32-bit: -G "Visual Studio 14 2015" +The following will be enough for most people, for more detailed instructions, see below. -See this [list](#cmake-visual-studio-generators) of other possible generators -for Visual Studio. +```bash +git clone https://github.com/KhronosGroup/Vulkan-Tools.git +cd Vulkan-Tools -When generating the project files, the absolute path to a Vulkan-Headers -install directory must be provided. This can be done by setting the -`VULKAN_HEADERS_INSTALL_DIR` environment variable or by setting the -`VULKAN_HEADERS_INSTALL_DIR` CMake variable with the `-D` CMake option. In -either case, the variable should point to the installation directory of a -Vulkan-Headers repository built with the install target. +cmake -S . -B build -D UPDATE_DEPS=ON -D BUILD_WERROR=ON -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug +cmake --build build --config Debug +``` -The above steps create a Windows solution file named -`Vulkan-Tools.sln` in the build directory. +### Warnings as errors off by default! -At this point, you can build the solution from the command line or open the -generated solution with Visual Studio. +By default `BUILD_WERROR` is `OFF`. The idiom for open source projects is to NOT enable warnings as errors. -#### Build the Solution From the Command Line +System/language package managers have to build on multiple different platforms and compilers. -While still in the build directory: +By defaulting to `ON` we cause issues for package managers since there is no standard way to disable warnings until CMake 3.24 - cmake --build . +Add `-D BUILD_WERROR=ON` to your workflow. Or use the `dev` preset shown below which will also enabling warnings as errors. -to build the Debug configuration (the default), or: +## Dependencies - cmake --build . --config Release +Currently this repo has a custom process for grabbing C/C++ dependencies. -to make a Release build. +Keep in mind this repo predates tools like `vcpkg`, `conan`, etc. Our process is most similar to `vcpkg`. -#### Build the Solution With Visual Studio +By specifying `-D UPDATE_DEPS=ON` when configuring CMake we grab dependencies listed in [known_good.json](scripts/known_good.json). -Launch Visual Studio and open the "Vulkan-Tools.sln" solution file in the -build folder. You may select "Debug" or "Release" from the Solution -Configurations drop-down list. Start a build by selecting the Build->Build -Solution menu item. +All we are doing is streamlining `building`/`installing` the `known good` dependencies and helping CMake `find` the dependencies. -#### Using a Loader Built from a Repository +This is done via a combination of `Python` and `CMake` scripting. -If you do need to build and use your own loader, build the Vulkan-Loader -repository with the install target and modify your CMake invocation to add the -location of the loader's install directory: +Misc Useful Information: - cmake -A x64 -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DVULKAN_LOADER_INSTALL_DIR=absolute_path_to_install_dir .. +- By default `UPDATE_DEPS` is `OFF`. The intent is to be friendly by default to system/language package managers. +- You can run `update_deps.py` manually but it isn't recommended for most users. -### Windows Notes +### How to test new dependency versions -#### CMake Visual Studio Generators +Typically most developers alter `known_good.json` with the commit/branch they are testing. -The chosen generator should match one of the Visual Studio versions that you -have installed. Generator strings that correspond to versions of Visual Studio -include: +Alternatively you can modify `CMAKE_PREFIX_PATH` as follows. -| Build Platform | 64-bit Generator | 32-bit Generator | -| ---------------------------- | ----------------------------- | ----------------------- | -| Microsoft Visual Studio 2013 | "Visual Studio 12 2013 Win64" | "Visual Studio 12 2013" | -| Microsoft Visual Studio 2015 | "Visual Studio 14 2015 Win64" | "Visual Studio 14 2015" | -| Microsoft Visual Studio 2017 | "Visual Studio 15 2017 Win64" | "Visual Studio 15 2017" | +```sh +# Delete the CMakeCache.txt which will cache find_* results +rm build/ -rf +cmake -S . -B build/ ... -D CMAKE_PREFIX_PATH=~/foobar/my_custom_glslang_install/ ... +``` ## Building On Linux ### Linux Build Requirements -This repository has been built and tested on the two most recent Ubuntu LTS -versions. Currently, the oldest supported version is Ubuntu 16.04, meaning -that the minimum officially supported C++11 compiler version is GCC 5.4.0, -although earlier versions may work. It should be straightforward to adapt this -repository to other Linux distributions. - -[CMake 3.17.2](https://cmake.org/files/v3.17/cmake-3.17.2-Linux-x86_64.tar.gz) is recommended. - -#### Required Package List +This repository is regularly built and tested on the two most recent Ubuntu LTS versions. - sudo apt-get install git cmake build-essential libx11-xcb-dev \ - libxkbcommon-dev libwayland-dev libxrandr-dev wayland-protocols - -### Linux Build - -The general approach is to run CMake to generate make files. Then either run -CMake with the `--build` option or `make` to build from the command line. - -#### Linux Quick Start - - cd Vulkan-Tools - mkdir build - cd build - cmake -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir .. - make - -See below for the details. - -#### Use CMake to Create the Make Files - -Change your current directory to the top of the cloned repository directory, -create a build directory and generate the make files. - - cd Vulkan-Tools - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DVULKAN_HEADERS_INSTALL_DIR=absolute_path_to_install_dir \ - -DCMAKE_INSTALL_PREFIX=install .. - -> Note: The `..` parameter tells `cmake` the location of the top of the -> repository. If you place your `build` directory someplace else, you'll need -> to specify the location of the repository top differently. - -Use `-DCMAKE_BUILD_TYPE` to specify a Debug or Release build. - -When generating the project files, the absolute path to a Vulkan-Headers -install directory must be provided. This can be done by setting the -`VULKAN_HEADERS_INSTALL_DIR` environment variable or by setting the -`VULKAN_HEADERS_INSTALL_DIR` CMake variable with the `-D` CMake option. In -either case, the variable should point to the installation directory of a -Vulkan-Headers repository built with the install target. - -> Note: For Linux, the default value for `CMAKE_INSTALL_PREFIX` is -> `/usr/local`, which would be used if you do not specify -> `CMAKE_INSTALL_PREFIX`. In this case, you may need to use `sudo` to install -> to system directories later when you run `make install`. - -#### Build the Project - -You can just run `make` to begin the build. - -To speed up the build on a multi-core machine, use the `-j` option for `make` -to specify the number of cores to use for the build. For example: - - make -j4 - -You can also use - - cmake --build . - -If your build system supports ccache, you can enable that via CMake option `-DUSE_CCACHE=On` +```bash +sudo apt-get install git build-essential python3 cmake -### Linux Notes +# Linux WSI system libraries +sudo apt-get install libwayland-dev xorg-dev +``` -#### WSI Support Build Options +### WSI Support Build Options By default, the repository components are built with support for the Vulkan-defined WSI display servers: Xcb, Xlib, and Wayland. It is recommended @@ -415,267 +106,220 @@ maximize their usability across Linux platforms. If it is necessary to build these modules without support for one of the display servers, the appropriate CMake option of the form `BUILD_WSI_xxx_SUPPORT` can be set to `OFF`. -Note vulkaninfo currently only supports Xcb and Xlib WSI display servers. See -the CMakeLists.txt file in `Vulkan-Tools/vulkaninfo` for more info. - -You can select which WSI subsystem is used to execute the vkcube applications -using a CMake option called CUBE_WSI_SELECTION. Supported options are XCB -(default), XLIB, and WAYLAND. Note that you must build using the corresponding -BUILD_WSI_*_SUPPORT enabled at the base repository level. For instance, -creating a build that will use Xlib when running the vkcube demos, your CMake -command line might look like: - - cmake -DCMAKE_BUILD_TYPE=Debug -DCUBE_WSI_SELECTION=XLIB .. - -#### Linux Install to System Directories - -Installing the files resulting from your build to the systems directories is -optional since environment variables can usually be used instead to locate the -binaries. There are also risks with interfering with binaries installed by -packages. If you are certain that you would like to install your binaries to -system directories, you can proceed with these instructions. - -Assuming that you've built the code as described above and the current -directory is still `build`, you can execute: - - sudo make install - -This command installs files to `/usr/local` if no `CMAKE_INSTALL_PREFIX` is -specified when creating the build files with CMake. - -You may need to run `ldconfig` in order to refresh the system loader search -cache on some Linux systems. - -You can further customize the installation location by setting additional -CMake variables to override their defaults. For example, if you would like to -install to `/tmp/build` instead of `/usr/local`, on your CMake command line -specify: - - -DCMAKE_INSTALL_PREFIX=/tmp/build - -Then run `make install` as before. The install step places the files in -`/tmp/build`. This may be useful for collecting the artifacts and providing -them to another project that is dependent on them. - -Note: The Mock ICD is not installed by default since it is a "null" driver -that does not render anything and is used for testing purposes. Installing it -to system directories may cause some applications to discover and use this -driver instead of other full drivers installed on the system. If you really -want to install this null driver, use: - - -DINSTALL_ICD=ON - -See the CMake documentation for more details on using these variables to -further customize your installation. - -Also see the `LoaderAndLayerInterface` document in the `loader` folder of the -Vulkan-Loader repository for more information about loader and layer -operation. - -### Linux Tests - -After making any changes to the repository, you should perform some quick -sanity tests, such as running the vkcube demo with validation enabled. - -To run the **vkcube application** with validation, in a terminal change to the -`build/cube` directory and run: +### Linux 32-bit support - VK_LAYER_PATH=../path/to/validation/layers ./vkcube --validate - -If you have an SDK installed and have run the setup script to set the -`VULKAN_SDK` environment variable, it may be unnecessary to specify a -`VK_LAYER_PATH`. - -#### Linux 32-bit support - -Usage of the contents of this repository in 32-bit Linux environments is not +Usage of this repository's contents in 32-bit Linux environments is not officially supported. However, since this repository is supported on 32-bit Windows, these modules should generally work on 32-bit Linux. Here are some notes for building 32-bit targets on a 64-bit Ubuntu "reference" platform: -If not already installed, install the following 32-bit development libraries: - -`gcc-multilib g++-multilib libx11-dev:i386` - -This list may vary depending on your distribution and which windowing systems -you are building for. +```bash +# 32-bit libs +# your PKG_CONFIG configuration may be different, depending on your distribution +sudo apt-get install gcc-multilib g++-multilib libx11-dev:i386 +``` Set up your environment for building 32-bit targets: - export ASFLAGS=--32 - export CFLAGS=-m32 - export CXXFLAGS=-m32 - export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu +```bash +export ASFLAGS=--32 +export CFLAGS=-m32 +export CXXFLAGS=-m32 +export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu +``` -Again, your PKG_CONFIG configuration may be different, depending on your -distribution. +## Building On Windows -Finally, rebuild the repository using `cmake` and `make`, as explained above. +### Windows Development Environment Requirements -## Building On Android +- Windows 10+ +- Visual Studio -TODO: https://github.com/KhronosGroup/Vulkan-Tools/issues/791 +Note: Anything less than `Visual Studio 2019` is not guaranteed to compile/work. -### Run vkcube +### Visual Studio Generator -Use the following command to run vkcube for Android: +Run CMake to generate [Visual Studio project files](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#command-line-g-option). ```bash -cd build-android +# NOTE: By default CMake picks the latest version of Visual Studio as the default generator. +cmake -S . -B build --preset dev -# Optional -adb uninstall com.example.VkCube +# Open the Visual Studio solution +cmake --open build +``` -adb install -r -g --no-incremental bin/VkCube.apk +See the [CMake documentation](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) for further information on Visual Studio generators. -adb shell am start com.example.VkCube/android.app.NativeActivity -``` +NOTE: Windows developers don't have to develop in Visual Studio. Visual Studio just helps streamlining the needed C++ toolchain requirements (compilers, linker, etc). ## Building on MacOS -### MacOS Build Requirements +### MacOS Development Environment Requirements -Tested on OSX version 10.12 +- Xcode -NOTE: To force the OSX version set the environment variable [MACOSX_DEPLOYMENT_TARGET](https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html) when building VVL and it's dependencies. +NOTE: MacOS developers don't have to develop in Xcode. Xcode just helps streamlining the needed C++ toolchain requirements (compilers, linker, etc). Similar to Visual Studio on Windows. -Setup Homebrew and components +### Xcode Generator -- Ensure Homebrew is at the beginning of your PATH: +To create and open an Xcode project: - export PATH=/usr/local/bin:$PATH +```bash +# Create the Xcode project +cmake -S . -B build -G Xcode --preset dev + +# Open the Xcode project +cmake --open build +``` -- Add packages with the following (may need refinement) +See the [CMake documentation](https://cmake.org/cmake/help/latest/generator/Xcode.html) for further information on the Xcode generator. - brew install python python3 git +## Building For Android -### Clone the Repository +- CMake 3.21+ +- NDK r25+ +- Ninja 1.10+ +- Android SDK Build-Tools 34.0.0+ -Clone the Vulkan-Tools repository as defined above in the [Download the Repository](#download-the-repository) -section. +### Android Build Requirements -### Get the External Libraries +- Download [Android Studio](https://developer.android.com/studio) +- Install (https://developer.android.com/studio/install) +- From the `Welcome to Android Studio` splash screen, add the following components using the SDK Manager: + - SDK Platforms > Android 8.0 and newer (API Level 26 or higher) + - SDK Tools > Android SDK Build-Tools + - SDK Tools > Android SDK Platform-Tools + - SDK Tools > Android SDK Tools + - SDK Tools > NDK + - SDK Tools > CMake -[MoltenVK](https://github.com/KhronosGroup/MoltenVK) Library +#### Add Android specifics to environment -- Building the vkcube and vulkaninfo applications require linking to the - MoltenVK Library (libMoltenVK.dylib) - - The following option should be used on the cmake command line to specify a - vulkan loader library: MOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK - making sure to specify an absolute path, like so: cmake - -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK .... +NOTE: The following commands are streamlined for Linux but easily transferable to other platforms. +The main intent is setting 2 environment variables and ensuring the NDK and build tools are in the `PATH`. -Vulkan Loader Library +```sh +# Set environment variables +# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#environment-variables-2 +export ANDROID_SDK_ROOT=$HOME/Android/Sdk +export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/X.Y.Z -- Building the vkcube and vulkaninfo applications require linking to the Vulkan - Loader Library (libvulkan.1.dylib) - - The following option should be used on the cmake command line to specify a - vulkan loader library: - VULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir - making sure to specify an absolute path. +# Modify path +export PATH=$ANDROID_SDK_ROOT/build-tools/X.Y.Z:$PATH -### MacOS build +# (Optional if you have new enough version of CMake + Ninja) +export PATH=$ANDROID_SDK_ROOT/cmake/3.22.1/bin:$PATH -#### CMake Generators +# Verify SDK build-tools is set correctly +which aapt -This repository uses CMake to generate build or project files that are then -used to build the repository. The CMake generators explicitly supported in -this repository are: +# Verify CMake/Ninja are in the path +which cmake +which ninja -- Unix Makefiles -- Xcode +# Check apksigner +apksigner --help +``` -#### Building with the Unix Makefiles Generator +Note: If `apksigner` gives a `java: not found` error you do not have Java in your path. -This generator is the default generator, so all that is needed for a debug -build is: +```bash +# A common way to install on the system +sudo apt install default-jre +``` - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DVULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir \ - -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK \ - -DCMAKE_INSTALL_PREFIX=install .. - make +### Android Build -To speed up the build on a multi-core machine, use the `-j` option for `make` -to specify the number of cores to use for the build. For example: +1. Building libraries to package with your APK - make -j4 +Invoking CMake directly to build the binary is relatively simple. -You can now run the demo applications from the command line: +See https://developer.android.com/ndk/guides/cmake#command-line for CMake NDK documentation. - open cube/vkcube.app - open cube/vkcubepp.app +```sh +# Build release binary for arm64-v8a +cmake -S . -B build \ + -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ + -D ANDROID_PLATFORM=26 \ + -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a \ + -D CMAKE_ANDROID_STL_TYPE=c++_static \ + -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ + -D CMAKE_BUILD_TYPE=Release \ + -D UPDATE_DEPS=ON \ + -G Ninja -Or you can locate them from `Finder` and launch them from there. +cmake --build build -##### The Install Target and RPATH +cmake --install build --prefix build/install +``` -The applications you just built are "bundled applications", but the -executables are using the `RPATH` mechanism to locate runtime dependencies -that are still in your build tree. +Then you just package the library into your APK under the appropriate lib directory based on the ABI: +https://en.wikipedia.org/wiki/Apk_(file_format)#Package_contents -To see this, run this command from your `build` directory: +Alternatively users can also use `scripts/android.py` to build the binaries. - otool -l cube/cube.app/Contents/MacOS/vkcube +Note: `scripts/android.py` will place the binaries in the `build-android/libs` directory. -and note that the `vkcube` executable contains loader commands: +```sh +# Build release binary for arm64-v8a +python3 scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_static +``` -- `LC_LOAD_DYLIB` to load `libvulkan.1.dylib` via an `@rpath` -- `LC_RPATH` that contains an absolute path to the build location of the Vulkan loader +`android.py` can also streamline building for multiple ABIs: -This makes the bundled application "non-transportable", meaning that it won't -run unless the Vulkan loader is on that specific absolute path. This is useful -for debugging the loader or other components built in this repository, but not -if you want to move the application to another machine or remove your build -tree. +```sh +# Build release binaries for all ABIs +python3 scripts/android.py --config Release --app-abi 'armeabi-v7a arm64-v8a x86 x86_64' --app-stl c++_static +``` -To address this problem, run: +2. Building the test APK for development purposes - make install +Creating the test APK is a bit of an involved process since it requires running multiple CLI tools after the CMake build has finished. -This step copies the bundled applications to the location specified by -CMAKE_INSTALL_PREFIX and "cleans up" the `RPATH` to remove any external -references and performs other bundle fix-ups. After running `make install`, -run the `otool` command again from the `build/install` directory and note: +As a result users are enouraged to use `scripts/android.py` to build the test APK. -- `LC_LOAD_DYLIB` is now `@executable_path/../MacOS/libvulkan.1.dylib` -- `LC_RPATH` is no longer present +This script handles wrapping CMake and various Android CLI tools to create the APK for you. -The "bundle fix-up" operation also puts a copy of the Vulkan loader into the -bundle, making the bundle completely self-contained and self-referencing. +```sh +# Build a complete test APK with debug binaries for all ABIS +python3 scripts/android.py --config Debug --app-abi 'armeabi-v7a arm64-v8a x86 x86_64' --app-stl c++_shared --apk --tests -##### The vulkaninfo Application +# Build a clean test APK with release binaries for arm64-v8a +python3 scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_shared --apk --tests --clean +``` -There is also a `vulkaninfo` application that you can run from the command line: +Note: `scripts/android.py` will place the APK in the `build-android/bin` directory. - vulkaninfo/vulkaninfo +See [tests/README.md](tests/README.md) for running APK / `vulkaninfo` on Android. -If you run this from the build directory, vulkaninfo's RPATH is already -set to point to the Vulkan loader in the build tree, so it has no trouble -finding it. But the loader will not find the MoltenVK driver and you'll see a -message about an incompatible driver. To remedy this: +### Installed Files - VK_ICD_FILENAMES=/MoltenVK/Package/Latest/MoltenVK/macOS/MoltenVK_icd.json vulkaninfo/vulkaninfo +- *install_dir*`/bin` : The `vulkaninfo`, `vkcube` and `vkcubepp` executables -If you run `vulkaninfo` from the install directory, the `RPATH` in the -`vulkaninfo` application got removed and the OS needs extra help to locate -the Vulkan loader: +If `INSTALL_ICD` is configured then MockICD will be installed as follows: - DYLD_LIBRARY_PATH=/Vulkan-Loader/loader VK_ICD_FILENAMES=/MoltenVK/Package/Latest/MoltenVK/macOS/MoltenVK_icd.json vulkaninfo/vulkaninfo +For Unix operating systems: -#### Building with the Xcode Generator +- *install_dir*`/bin` : The Mock ICD +- *install_dir*`/share/vulkan/icd.d` : Mock ICD JSON -To create and open an Xcode project: +For WIN32: - mkdir build-xcode - cd build-xcode - cmake -DVULKAN_LOADER_INSTALL_DIR=/absolute_path_to/Vulkan-Loader_install_dir -DMOLTENVK_REPO_ROOT=/absolute_path_to/MoltenVK -GXcode .. - open VULKAN.xcodeproj +- *install_dir*`/bin` : The Mock ICD and JSON -Within Xcode, you can select Debug or Release builds in the project's Build -Settings. You can also select individual schemes for working with specific -applications like `vkcube`. +### Software Installation + +After you have built your project you can install using CMake's install functionality. + +CMake Docs: +- [Software Installation Guide](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#software-installation) +- [CLI for installing a project](https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project) + +```sh +# EX: Installs Release artifacts into `build/install` directory. +# NOTE: --config is only needed for multi-config generators (Visual Studio, Xcode, etc) +cmake --install build/ --config Release --prefix build/install +``` diff --git a/CMakeLists.txt b/CMakeLists.txt index a1a6eb4b..9951b939 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,8 +69,7 @@ find_package(VulkanLoader QUIET CONFIG) include(GNUInstallDirs) -# TODO: Should be OFF by default. -option(BUILD_WERROR "Treat compiler warnings as errors" ON) +option(BUILD_WERROR "Treat compiler warnings as errors") if (BUILD_WERROR) add_compile_options("$,/WX,-Werror>") endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 39101aed..26c4c9bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,9 +39,7 @@ a good reason is "This violates the style guide, but it improves type safety." * Run **clang-format** on your changes to maintain consistent formatting * There are `.clang-format` files present in the repository to define clang-format settings which are found and used automatically by clang-format. - * **clang-format** binaries are available from the LLVM orginization, here: [LLVM](https://clang.llvm.org/). Our CI system (Travis-CI) - currently uses clang-format version 7.0.0 to check that the lines of code you have changed are formatted properly. It is - recommended that you use the same version to format your code prior to submission. + * **clang-format** binaries are available from the LLVM orginization, here: [LLVM](https://clang.llvm.org/). * A sample git workflow may look like: > # Make changes to the source. @@ -64,16 +62,14 @@ a good reason is "This violates the style guide, but it improves type safety." Strive for commits that implement a single or related set of functionality, using as many commits as is necessary (more is better). That said, please ensure that the repository compiles and passes tests without error for each commit in your pull request. Note that to be accepted into the repository, the pull request must [pass all tests](#testing your changes) on all supported platforms --- the automatic Github Travis and AppVeyor continuous integration features will assist in enforcing this requirement. #### Generated Source Code -The `icd/generated` directory contains source code that is created by several +The `icd/generated` and `vulkaninfo/generated` directories contains source code that is created by several generator scripts in the `scripts` directory. All changes to these scripts _must_ be submitted with the -corresponding generated output to keep the repository self-consistent. This requirement is enforced by both -Travis CI and AppVeyor test configurations. Regenerate source files after modifying any of the generator -scripts and before building and testing your changes. More details can be found in -[BUILD.md](https://github.com/KhronosGroup/Vulkan-Tools/blob/main/BUILD.md#generated-source-code). +corresponding generated output to keep the repository self-consistent. This requirement is enforced by CI. +Regenerate source files after modifying any of the generator scripts and before building and testing your changes. +More details can be found in [BUILD.md](BUILD.md). #### **Testing Your Changes** * Run the repository components with the Vulkan Validation Layers before and after each of your commits to check for any regressions. @@ -90,14 +86,6 @@ scripts and before building and testing your changes. More details can be found * Run tests that explicitly exercise your changes. * Feel free to subject your code changes to other tests as well! -#### Coding Conventions for [CMake](http://cmake.org) files - -* When editing configuration files for CMake, follow the style conventions of the surrounding code. - * The column limit is 132. - * The indent is 4 spaces. - * CMake functions are lower-case. - * Variable and keyword names are upper-case. - ### **Contributor License Agreement (CLA)** You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request diff --git a/cube/android/README.md b/cube/android/README.md index 08ed7488..75b1747f 100644 --- a/cube/android/README.md +++ b/cube/android/README.md @@ -26,16 +26,3 @@ Then run the script: ./generate_vulkan_wrapper.py ../cube/android/vulkan_wrapper.cpp clang-format -i vulkan_wrapper.h clang-format -i vulkan_wrapper.cpp - -# Running vkcube on Android - -```bash -cd build-android - -# Optional -adb uninstall com.example.VkCube - -adb install -r -g --no-incremental bin/VkCube.apk - -adb shell am start com.example.VkCube/android.app.NativeActivity -``` \ No newline at end of file diff --git a/scripts/android.py b/scripts/android.py old mode 100644 new mode 100755 diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..0e0798e7 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,34 @@ +## Android + +### Running vkcube on Android + +```sh +cd Vulkan-Tools + +cd build-android + +# Optional +adb uninstall com.example.VkCube + +adb install -r -g --no-incremental bin/VkCube.apk + +adb shell am start com.example.VkCube/android.app.NativeActivity +``` + +### vulkaninfo on Android + +Unlike `vkcube`, `vulkaninfo` doesn't require the extra step of creating an `APK`. + +So the following should be enough. + +```sh +cd Vulkan-Tools + +scripts/android.py --config Release --app-abi arm64-v8a --app-stl c++_static --clean + +adb push build-android/cmake/arm64-v8a/vulkaninfo/vulkaninfo /data/local/tmp + +adb shell /data/local/tmp/vulkaninfo --json --output /data/local/tmp/foobar.json + +adb pull /data/local/tmp/foobar.json +``` diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index 2fe0fc11..4d654734 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -15,14 +15,6 @@ # limitations under the License. # ~~~ -# TODO: Document this properly -# cmake -S . -B android-build -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=28 -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Debug -DBUILD_CUBE=OFF -DBUILD_WSI_XCB_SUPPORT=OFF -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_WAYLAND_SUPPORT=OFF -C external/helper.cmake -# cmake --build android-build --target vulkaninfo -# -# adb push android-build/vulkaninfo/vulkaninfo /data/local/tmp -# adb shell /data/local/tmp/vulkaninfo --json --output /data/local/tmp/VP_Pixel_6.json -# adb pull /data/local/tmp/VP_Pixel_6.json - if(WIN32) # ~~~ # Setup the vulkaninfo.rc file to contain the correct info diff --git a/vulkaninfo/vulkaninfo.md b/vulkaninfo/vulkaninfo.md index 3e7456a1..8755b415 100644 --- a/vulkaninfo/vulkaninfo.md +++ b/vulkaninfo/vulkaninfo.md @@ -1,5 +1,5 @@ - + [![Khronos Vulkan][1]][2] diff --git a/windows-runtime-installer/README.md b/windows-runtime-installer/README.md index d0dd5958..81c58125 100644 --- a/windows-runtime-installer/README.md +++ b/windows-runtime-installer/README.md @@ -1,5 +1,4 @@ - -## Windows Runtime Installer +# Windows Runtime Installer This directory contains the files required for building the Windows Vulkan Runtime Installer package. The runtime installer is a method of delivering a Vulkan loader to system. From 730552e6702cd73764b28f48271a967fba95162e Mon Sep 17 00:00:00 2001 From: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> Date: Thu, 12 Oct 2023 09:51:11 -0600 Subject: [PATCH 55/56] cubepp: Verify correct pipeline result --- cube/cube.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cube/cube.cpp b/cube/cube.cpp index 005226e6..66748256 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -2072,7 +2072,7 @@ void Demo::prepare_pipeline() { .setPDynamicState(&dynamicStateInfo) .setLayout(pipeline_layout) .setRenderPass(render_pass)); - VERIFY(result == vk::Result::eSuccess); + VERIFY(pipline_return.result == vk::Result::eSuccess); pipeline = pipline_return.value.at(0); device.destroyShaderModule(frag_shader_module); From 1532001f7edae559af1988293eec90bc5e2607d5 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 13 Oct 2023 10:37:12 -0700 Subject: [PATCH 56/56] build: Update to header 1.3.268 - Update known-good - Generate source --- icd/VkICD_mock_icd.json.in | 2 +- scripts/known_good.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/icd/VkICD_mock_icd.json.in b/icd/VkICD_mock_icd.json.in index 56d09300..2ff43409 100644 --- a/icd/VkICD_mock_icd.json.in +++ b/icd/VkICD_mock_icd.json.in @@ -2,6 +2,6 @@ "file_format_version": "1.0.1", "ICD": { "library_path": "@JSON_LIBRARY_PATH@", - "api_version": "1.3.267" + "api_version": "1.3.268" } } \ No newline at end of file diff --git a/scripts/known_good.json b/scripts/known_good.json index 5e58ef75..2b865f83 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,7 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.267" + "commit": "v1.3.268" }, { "name": "MoltenVK", @@ -35,7 +35,7 @@ "cmake_options": [ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], - "commit": "v1.3.267", + "commit": "v1.3.268", "build_platforms": [ "windows", "linux",