From 6cd9877ac9197b422ecd3dea24baf68e95669a4f Mon Sep 17 00:00:00 2001 From: squidbus Date: Thu, 23 Apr 2026 17:33:52 -0700 Subject: [PATCH] kk: Support VK_(KHR/EXT)_index_type_uint8 Simple implementation which takes advantage of poly geometry unrolling. Reviewed-by: Aitor Camacho Part-of: --- docs/features.txt | 4 ++-- src/kosmickrisp/vulkan/kk_cmd_draw.c | 4 ++++ src/kosmickrisp/vulkan/kk_physical_device.c | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index 3da3f8c6982..c39a247d827 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -521,7 +521,7 @@ Vulkan 1.4 -- all DONE: anv, hk, lvp, nvk, panvk/v10+, radv/gfx8+, tu/a7xx+, vn VK_KHR_dynamic_rendering_local_read DONE (anv, lvp, nvk, panvk, radv, tu, vn) VK_KHR_global_priority DONE (anv, kk, lvp, nvk, panvk, radv, tu, vn) - VK_KHR_index_type_uint8 DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) + VK_KHR_index_type_uint8 DONE (anv, kk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_line_rasterization DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_load_store_op_none DONE (anv, kk, lvp, nvk, panvk, radv, tu, v3dv, vn) VK_KHR_maintenance5 DONE (anv, hasvk, lvp, nvk, panvk/v10+, radv, tu, v3dv, vn) @@ -653,7 +653,7 @@ Khronos extensions that are not part of any Vulkan version: VK_EXT_image_drm_format_modifier DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv/gfx9+, tu, v3dv, vn) VK_EXT_image_sliced_view_of_3d DONE (anv, hk, lvp, nvk, radv/gfx10+, vn) VK_EXT_image_view_min_lod DONE (anv, hasvk, hk, nvk, panvk, radv, tu, vn) - VK_EXT_index_type_uint8 DONE (anv, hasvk, hk, nvk, lvp, panvk, pvr, radv/gfx8+, tu, v3dv, vn) + VK_EXT_index_type_uint8 DONE (anv, hasvk, hk, kk, nvk, lvp, panvk, pvr, radv/gfx8+, tu, v3dv, vn) VK_EXT_legacy_dithering DONE (anv, panvk, tu, vn) VK_EXT_legacy_vertex_attributes DONE (anv, lvp, nvk, radv, tu, vn) VK_EXT_line_rasterization DONE (anv, hasvk, hk, nvk, panvk, pvr, lvp, radv, tu, v3dv, vn) diff --git a/src/kosmickrisp/vulkan/kk_cmd_draw.c b/src/kosmickrisp/vulkan/kk_cmd_draw.c index 55b7e9bdf95..47ac7b94a0c 100644 --- a/src/kosmickrisp/vulkan/kk_cmd_draw.c +++ b/src/kosmickrisp/vulkan/kk_cmd_draw.c @@ -1032,6 +1032,10 @@ kk_dispatch_draw(struct kk_cmd_buffer *cmd, struct kk_draw_data data) static bool requires_index_promotion(struct kk_draw_data data) { + /* uint8_t indices must be promoted since they are not natively supported. */ + if (data.index_size == sizeof(uint8_t)) + return true; + /* For primitive types that support primitive restart, if restart is disabled * and the index size is less than uint32_t, we need to make sure to perform * unrolling as it automatically promotes the type to uint32_t, preventing diff --git a/src/kosmickrisp/vulkan/kk_physical_device.c b/src/kosmickrisp/vulkan/kk_physical_device.c index 886d46d2c92..f9cfd293e12 100644 --- a/src/kosmickrisp/vulkan/kk_physical_device.c +++ b/src/kosmickrisp/vulkan/kk_physical_device.c @@ -116,6 +116,7 @@ kk_get_device_extensions(const struct kk_instance *instance, /* Vulkan 1.4 */ .KHR_global_priority = true, + .KHR_index_type_uint8 = true, .KHR_load_store_op_none = true, .KHR_map_memory2 = true, .KHR_push_descriptor = true, @@ -124,6 +125,7 @@ kk_get_device_extensions(const struct kk_instance *instance, .KHR_vertex_attribute_divisor = true, .EXT_global_priority = true, .EXT_global_priority_query = true, + .EXT_index_type_uint8 = true, .EXT_vertex_attribute_divisor = true, /* Optional extensions */ @@ -283,6 +285,7 @@ kk_get_device_features( /* Vulkan 1.4 */ .globalPriorityQuery = true, + .indexTypeUint8 = true, .pushDescriptor = true, .shaderSubgroupRotate = true, .shaderSubgroupRotateClustered = true,