From 2d6ad3cba1a84a9c107b2ec8e945dd917da1e49f Mon Sep 17 00:00:00 2001 From: squidbus <1249084-squidbus@users.noreply.gitlab.freedesktop.org> Date: Tue, 19 May 2026 21:53:44 -0700 Subject: [PATCH] kk: Support VK_KHR_shader_untyped_pointers With memcpy lowering and fix for infinite optimize loop on 4x16 packs, passes `dEQP-VK.spirv_assembly.instruction.compute.untyped_pointers.*`. Reviewed-by: Aitor Camacho Part-of: --- docs/features.txt | 2 +- src/kosmickrisp/compiler/nir_to_msl.c | 1 + src/kosmickrisp/compiler/nir_to_msl.h | 1 + src/kosmickrisp/vulkan/kk_physical_device.c | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 91a960ae296..1287a039051 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -586,7 +586,7 @@ Khronos extensions that are not part of any Vulkan version: VK_KHR_shader_quad_control DONE (anv, hk, lvp, nvk, panvk/v10+, radv, vn) VK_KHR_shader_relaxed_extended_instruction DONE (anv, hasvk, hk, kk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_shader_subgroup_uniform_control_flow DONE (anv, hasvk, hk, kk, nvk, panvk/v10+, radv, tu, vn) - VK_KHR_shader_untyped_pointers DONE (anv, nvk, panvk/v9+, radv, vn) + VK_KHR_shader_untyped_pointers DONE (anv, kk, nvk, panvk/v9+, radv, vn) VK_KHR_shared_presentable_image not started VK_KHR_surface DONE (anv, dzn, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_surface_maintenance1 DONE (anv, hk, lvp, nvk, panvk, radv, tu, v3dv, vn) diff --git a/src/kosmickrisp/compiler/nir_to_msl.c b/src/kosmickrisp/compiler/nir_to_msl.c index cd403a26554..c79b0745f1d 100644 --- a/src/kosmickrisp/compiler/nir_to_msl.c +++ b/src/kosmickrisp/compiler/nir_to_msl.c @@ -2035,6 +2035,7 @@ msl_preprocess_nir(struct nir_shader *nir) NIR_PASS(_, nir, nir_opt_combine_barriers, NULL, NULL); NIR_PASS(_, nir, nir_lower_var_copies); NIR_PASS(_, nir, nir_split_var_copies); + NIR_PASS(_, nir, nir_lower_memcpy); NIR_PASS(_, nir, nir_split_array_vars, nir_var_function_temp | nir_var_shader_in | nir_var_shader_out); diff --git a/src/kosmickrisp/compiler/nir_to_msl.h b/src/kosmickrisp/compiler/nir_to_msl.h index 1bfdee8d0db..c2a6d6647a0 100644 --- a/src/kosmickrisp/compiler/nir_to_msl.h +++ b/src/kosmickrisp/compiler/nir_to_msl.h @@ -99,6 +99,7 @@ static const nir_shader_compiler_options kk_nir_options = { .lower_pack_64_2x32_split = true, .lower_unpack_64_2x32_split = true, .lower_pack_64_2x32 = true, + .lower_pack_64_4x16 = true, .lower_pack_half_2x16 = true, .lower_pack_split = true, .lower_unpack_half_2x16 = true, diff --git a/src/kosmickrisp/vulkan/kk_physical_device.c b/src/kosmickrisp/vulkan/kk_physical_device.c index ebada16a761..cf7d3eaa1b2 100644 --- a/src/kosmickrisp/vulkan/kk_physical_device.c +++ b/src/kosmickrisp/vulkan/kk_physical_device.c @@ -146,6 +146,7 @@ kk_get_device_extensions(const struct kk_instance *instance, .KHR_shader_maximal_reconvergence = true, .KHR_shader_relaxed_extended_instruction = true, .KHR_shader_subgroup_uniform_control_flow = true, + .KHR_shader_untyped_pointers = true, #ifdef KK_USE_WSI_PLATFORM .KHR_swapchain = true, .KHR_swapchain_mutable_format = true, @@ -352,6 +353,9 @@ kk_get_device_features( /* VK_KHR_shader_relaxed_extended_instruction */ .shaderRelaxedExtendedInstruction = true, + /* VK_KHR_shader_untyped_pointers */ + .shaderUntypedPointers = true, + /* VK_KHR_unified_image_layouts */ .unifiedImageLayouts = true, .unifiedImageLayoutsVideo = false,