From 653808c209d63bc5dc84f23df51c12ccac189908 Mon Sep 17 00:00:00 2001 From: John Anthony Date: Wed, 13 Nov 2024 14:30:11 +0100 Subject: [PATCH] panvk: Enable VK_KHR_vertex_attribute_divisor Panvk currently enables VK_EXT_vertex_attribute_divisor, but Mali HW does not support a non-zero firstInstance when a divisor is used. supportsNonZeroFirstInstance is correctly set to false to advertise this, however this property was only added when the extension was promoted. Thus we need to remove support for VK_EXT_vertex_attribute_divisor and enable VK_KHR_vertex_attribute_divisor instead. Also fixes an issue with non-zero divisor for v10. Reviewed-by: Chia-I Wu Part-of: --- docs/features.txt | 4 ++-- src/panfrost/ci/panfrost-g610-fails.txt | 16 ---------------- src/panfrost/ci/panfrost-g610-flakes.txt | 1 - src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c | 6 ++++++ src/panfrost/vulkan/panvk_physical_device.c | 4 ++-- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index 791b9f4ad9f..fca943127f1 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -556,7 +556,7 @@ Khronos extensions that are not part of any Vulkan version: VK_KHR_surface_protected_capabilities DONE (anv, lvp, nvk, radv, tu, v3dv, vn) VK_KHR_swapchain DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_swapchain_mutable_format DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn) - VK_KHR_vertex_attribute_divisor DONE (anv, nvk, radv, tu, v3dv) + VK_KHR_vertex_attribute_divisor DONE (anv, nvk, panvk, radv, tu, v3dv) VK_KHR_wayland_surface DONE (anv, dzn, lvp, nvk, panvk, radv, tu, v3dv, vn) VK_KHR_workgroup_memory_explicit_layout DONE (anv, nvk, hasvk, radv, tu, v3dv) VK_KHR_win32_keyed_mutex not started @@ -645,7 +645,7 @@ Khronos extensions that are not part of any Vulkan version: VK_EXT_surface_maintenance1 DONE (anv, lvp, nvk, radv, tu, v3dv) VK_EXT_swapchain_maintenance1 DONE (anv, lvp, nvk, radv, tu, v3dv) VK_EXT_transform_feedback DONE (anv, hasvk, lvp, nvk, radv, tu, vn) - VK_EXT_vertex_attribute_divisor DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn) + VK_EXT_vertex_attribute_divisor DONE (anv, dzn, hasvk, lvp, nvk, radv, tu, v3dv, vn) VK_EXT_vertex_input_dynamic_state DONE (anv, lvp, nvk, radv, tu, vn) VK_EXT_ycbcr_image_arrays DONE (anv, hasvk, lvp, nvk, radv) VK_ANDROID_external_memory_android_hardware_buffer DONE (anv, radv, tu, vn) diff --git a/src/panfrost/ci/panfrost-g610-fails.txt b/src/panfrost/ci/panfrost-g610-fails.txt index 2b7575339b5..8165264d475 100644 --- a/src/panfrost/ci/panfrost-g610-fails.txt +++ b/src/panfrost/ci/panfrost-g610-fails.txt @@ -474,30 +474,14 @@ dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.multiple_interpolatio dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.multiple_interpolation.separate.no_sample_decoration.4_samples,Fail dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.1_sample,Fail dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.4_samples,Fail -dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.16,Fail -dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.2,Fail -dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.16,Fail -dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.2,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.multiple_interpolation.separate.no_sample_decoration.1_sample,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.multiple_interpolation.separate.no_sample_decoration.4_samples,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.1_sample,Fail dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.4_samples,Fail -dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.16,Fail -dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.2,Fail -dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.16,Fail -dEQP-VK.draw.dynamic_rendering.partial_secondary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.2,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.multiple_interpolation.separate.no_sample_decoration.1_sample,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.multiple_interpolation.separate.no_sample_decoration.4_samples,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.1_sample,Fail dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.multiple_interpolation.structured.no_sample_decoration.4_samples,Fail -dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.16,Fail -dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.2,Fail -dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.2,Fail - -dEQP-VK.draw.renderpass.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.16,Fail -dEQP-VK.draw.renderpass.vertex_attribute_divisor.ext.static_pipeline.draw.non_zero.2,Fail -dEQP-VK.draw.renderpass.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.16,Fail -dEQP-VK.draw.renderpass.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.2,Fail dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.2_cmdbuffers_resuming,Fail dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.2_secondary_2_primary_cmdbuffers_resuming,Fail diff --git a/src/panfrost/ci/panfrost-g610-flakes.txt b/src/panfrost/ci/panfrost-g610-flakes.txt index 90e89b46f3d..f9ae6ba04d4 100644 --- a/src/panfrost/ci/panfrost-g610-flakes.txt +++ b/src/panfrost/ci/panfrost-g610-flakes.txt @@ -19,7 +19,6 @@ dEQP-VK.binding_model.shader_access.primary_cmd_buf.bind.sampler_immutable.fragm dEQP-VK.binding_model.shader_access.primary_cmd_buf.bind.with_template.sampler_immutable.tess_eval.multiple_arbitrary_descriptors.2d dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.instanced.draw_vk_primitive_topology_point_list -dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.vertex_attribute_divisor.ext.static_pipeline.draw_indexed.non_zero.16 dEQP-VK.dynamic_rendering.graphics_pipeline_library.dedicated_allocation.formats.r16g16b16a16_uint.input.dont_care.store.self_dep_draw diff --git a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c index eb03b08085e..afb0f7e9e3c 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c @@ -89,6 +89,12 @@ emit_vs_attrib(const struct vk_vertex_attribute_state *attrib_info, } else if (buf_info->divisor == 1) { cfg.attribute_type = MALI_ATTRIBUTE_TYPE_1D; cfg.frequency = MALI_ATTRIBUTE_FREQUENCY_INSTANCE; + } else if (buf_info->divisor == 0) { + cfg.attribute_type = MALI_ATTRIBUTE_TYPE_1D; + /* HW doesn't support a zero divisor, but we can achieve the same by + * not using a divisor and setting the stride to zero */ + cfg.frequency = MALI_ATTRIBUTE_FREQUENCY_INSTANCE; + cfg.stride = 0; } else if (util_is_power_of_two_or_zero(buf_info->divisor)) { /* Per-instance, POT divisor */ cfg.attribute_type = MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR; diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index b65a09a5f63..a717efed8ab 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -225,6 +225,7 @@ get_device_extensions(const struct panvk_physical_device *device, .KHR_synchronization2 = true, .KHR_timeline_semaphore = true, .KHR_variable_pointers = true, + .KHR_vertex_attribute_divisor = true, .KHR_zero_initialize_workgroup_memory = true, .EXT_buffer_device_address = true, .EXT_custom_border_color = true, @@ -244,7 +245,6 @@ get_device_extensions(const struct panvk_physical_device *device, .EXT_sampler_filter_minmax = arch >= 10, .EXT_shader_module_identifier = true, .EXT_tooling_info = true, - .EXT_vertex_attribute_divisor = true, .GOOGLE_decorate_string = true, .GOOGLE_hlsl_functionality1 = true, .GOOGLE_user_type = true, @@ -370,7 +370,7 @@ get_features(const struct panvk_physical_device *device, /* VK_KHR_index_type_uint8 */ .indexTypeUint8 = true, - /* VK_EXT_vertex_attribute_divisor */ + /* VK_KHR_vertex_attribute_divisor */ .vertexAttributeInstanceRateDivisor = true, .vertexAttributeInstanceRateZeroDivisor = true,