From 19818ecc37ec422e00914afbc1fe2814a81136c4 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Mon, 13 Mar 2023 14:36:20 -0700 Subject: [PATCH] dzn: Support descriptor indexing via bindless Part-of: --- src/microsoft/ci/warp-fails.txt | 3 ++ src/microsoft/ci/warp-skips.txt | 1 + src/microsoft/vulkan/dzn_device.c | 69 +++++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/microsoft/ci/warp-fails.txt b/src/microsoft/ci/warp-fails.txt index e6a0c85..d538908 100644 --- a/src/microsoft/ci/warp-fails.txt +++ b/src/microsoft/ci/warp-fails.txt @@ -629,3 +629,6 @@ dEQP-VK.image.depth_stencil_descriptor.depth_read_only_stencil_attachment_optima # This is due to pretending to resolve stencil sample 0 using min # This needs to be a blit shader instead, but that runs into problems since shader stencil export is optional dEQP-VK.imageless_framebuffer.depth_stencil_resolve,Fail + +# This needs D3D API changes to enable sampler heaps >= 4k entries, which is incoming +dEQP-VK.api.object_management.max_concurrent.sampler,Fail diff --git a/src/microsoft/ci/warp-skips.txt b/src/microsoft/ci/warp-skips.txt index 35862c3..1680277 100644 --- a/src/microsoft/ci/warp-skips.txt +++ b/src/microsoft/ci/warp-skips.txt @@ -4,3 +4,4 @@ dEQP-VK.dynamic_state.ds_state.stencil_params* # Intermittent timeouts in CI. dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail dEQP-VK.memory.pipeline_barrier.host_write_vertex_buffer.1048576_vertex_buffer_stride_2 +dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.1048576 diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c index f295c60..825d6d6 100644 --- a/src/microsoft/vulkan/dzn_device.c +++ b/src/microsoft/vulkan/dzn_device.c @@ -113,6 +113,7 @@ dzn_physical_device_get_extensions(struct dzn_physical_device *pdev) #ifdef DZN_USE_WSI_PLATFORM .KHR_swapchain = true, #endif + .EXT_descriptor_indexing = pdev->shader_model >= D3D_SHADER_MODEL_6_6, .EXT_shader_subgroup_ballot = true, .EXT_shader_subgroup_vote = true, .EXT_subgroup_size_control = true, @@ -1381,6 +1382,7 @@ dzn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, .shaderDrawParameters = true, }; + bool support_descriptor_indexing = pdev->shader_model >= D3D_SHADER_MODEL_6_6; const VkPhysicalDeviceVulkan12Features core_1_2 = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, .samplerMirrorClampToEdge = false, @@ -1393,25 +1395,25 @@ dzn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, .shaderFloat16 = pdev->options4.Native16BitShaderOpsSupported, .shaderInt8 = false, - .descriptorIndexing = false, + .descriptorIndexing = support_descriptor_indexing, .shaderInputAttachmentArrayDynamicIndexing = true, .shaderUniformTexelBufferArrayDynamicIndexing = true, .shaderStorageTexelBufferArrayDynamicIndexing = true, - .shaderUniformBufferArrayNonUniformIndexing = false, - .shaderSampledImageArrayNonUniformIndexing = false, - .shaderStorageBufferArrayNonUniformIndexing = false, - .shaderStorageImageArrayNonUniformIndexing = false, - .shaderInputAttachmentArrayNonUniformIndexing = false, - .shaderUniformTexelBufferArrayNonUniformIndexing = false, - .shaderStorageTexelBufferArrayNonUniformIndexing = false, - .descriptorBindingUniformBufferUpdateAfterBind = false, - .descriptorBindingSampledImageUpdateAfterBind = false, - .descriptorBindingStorageImageUpdateAfterBind = false, - .descriptorBindingStorageBufferUpdateAfterBind = false, - .descriptorBindingUniformTexelBufferUpdateAfterBind = false, - .descriptorBindingStorageTexelBufferUpdateAfterBind = false, - .descriptorBindingUpdateUnusedWhilePending = false, - .descriptorBindingPartiallyBound = false, + .shaderUniformBufferArrayNonUniformIndexing = support_descriptor_indexing, + .shaderSampledImageArrayNonUniformIndexing = support_descriptor_indexing, + .shaderStorageBufferArrayNonUniformIndexing = support_descriptor_indexing, + .shaderStorageImageArrayNonUniformIndexing = support_descriptor_indexing, + .shaderInputAttachmentArrayNonUniformIndexing = support_descriptor_indexing, + .shaderUniformTexelBufferArrayNonUniformIndexing = support_descriptor_indexing, + .shaderStorageTexelBufferArrayNonUniformIndexing = support_descriptor_indexing, + .descriptorBindingUniformBufferUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingSampledImageUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingStorageImageUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingStorageBufferUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingUniformTexelBufferUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingStorageTexelBufferUpdateAfterBind = support_descriptor_indexing, + .descriptorBindingUpdateUnusedWhilePending = support_descriptor_indexing, + .descriptorBindingPartiallyBound = support_descriptor_indexing, .descriptorBindingVariableDescriptorCount = false, .runtimeDescriptorArray = false, @@ -1814,21 +1816,22 @@ dzn_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, .shaderInputAttachmentArrayNonUniformIndexingNative = true, .robustBufferAccessUpdateAfterBind = true, .quadDivergentImplicitLod = false, - .maxPerStageDescriptorUpdateAfterBindSamplers = 0, - .maxPerStageDescriptorUpdateAfterBindUniformBuffers = 0, - .maxPerStageDescriptorUpdateAfterBindStorageBuffers = 0, - .maxPerStageDescriptorUpdateAfterBindSampledImages = 0, - .maxPerStageDescriptorUpdateAfterBindStorageImages = 0, - .maxPerStageDescriptorUpdateAfterBindInputAttachments = 0, - .maxPerStageUpdateAfterBindResources = 0, - .maxDescriptorSetUpdateAfterBindSamplers = 0, - .maxDescriptorSetUpdateAfterBindUniformBuffers = 0, - .maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = 0, - .maxDescriptorSetUpdateAfterBindStorageBuffers = 0, - .maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = 0, - .maxDescriptorSetUpdateAfterBindSampledImages = 0, - .maxDescriptorSetUpdateAfterBindStorageImages = 0, - .maxDescriptorSetUpdateAfterBindInputAttachments = 0, + .maxUpdateAfterBindDescriptorsInAllPools = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindSamplers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindUniformBuffers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindStorageBuffers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindSampledImages = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindStorageImages = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageDescriptorUpdateAfterBindInputAttachments = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxPerStageUpdateAfterBindResources = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindSamplers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindUniformBuffers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = MAX_DYNAMIC_UNIFORM_BUFFERS, + .maxDescriptorSetUpdateAfterBindStorageBuffers = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = MAX_DYNAMIC_STORAGE_BUFFERS, + .maxDescriptorSetUpdateAfterBindSampledImages = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindStorageImages = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, + .maxDescriptorSetUpdateAfterBindInputAttachments = MAX_DESCS_PER_CBV_SRV_UAV_HEAP, /* FIXME: add support for VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, * which is required by the VK 1.2 spec. @@ -2364,7 +2367,9 @@ dzn_device_create(struct dzn_physical_device *pdev, device->need_swapchain_blits = true; } - device->bindless = (instance->debug_flags & DZN_DEBUG_BINDLESS) != 0; + device->bindless = (instance->debug_flags & DZN_DEBUG_BINDLESS) != 0 || + device->vk.enabled_features.descriptorIndexing || + device->vk.enabled_extensions.EXT_descriptor_indexing; if (device->bindless) { dzn_foreach_pool_type(type) { -- 2.7.4