From 89879d8fe21bb1612f2408012bb714b90ff07040 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 27 Jan 2023 13:05:33 -0800 Subject: [PATCH] dzn: Add a driconf entry for enabling 8bit loads and stores Part-of: --- src/microsoft/vulkan/dzn_device.c | 14 ++++++++++---- src/util/00-mesa-defaults.conf | 4 ++++ src/util/driconf.h | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c index b09622b..1ad89cd 100644 --- a/src/microsoft/vulkan/dzn_device.c +++ b/src/microsoft/vulkan/dzn_device.c @@ -387,6 +387,9 @@ dzn_physical_device_create(struct vk_instance *instance, } dzn_physical_device_get_extensions(pdev); + if (driQueryOptionb(&dzn_instance->dri_options, "dzn_enable_8bit_loads_stores") && + pdev->options4.Native16BitShaderOpsSupported) + pdev->vk.supported_extensions.KHR_8bit_storage = true; return VK_SUCCESS; } @@ -1132,6 +1135,7 @@ dzn_enumerate_physical_devices(struct vk_instance *instance) static const driOptionDescription dzn_dri_options[] = { DRI_CONF_SECTION_DEBUG DRI_CONF_DZN_CLAIM_WIDE_LINES(false) + DRI_CONF_DZN_ENABLE_8BIT_LOADS_STORES(false) DRI_CONF_SECTION_END }; @@ -1383,17 +1387,19 @@ dzn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, }; bool support_descriptor_indexing = pdev->shader_model >= D3D_SHADER_MODEL_6_6; + bool support_8bit = driQueryOptionb(&instance->dri_options, "dzn_enable_8bit_loads_stores") && + pdev->options4.Native16BitShaderOpsSupported; const VkPhysicalDeviceVulkan12Features core_1_2 = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, .samplerMirrorClampToEdge = false, .drawIndirectCount = true, - .storageBuffer8BitAccess = false, - .uniformAndStorageBuffer8BitAccess = false, - .storagePushConstant8 = false, + .storageBuffer8BitAccess = support_8bit, + .uniformAndStorageBuffer8BitAccess = support_8bit, + .storagePushConstant8 = support_8bit, .shaderBufferInt64Atomics = false, .shaderSharedInt64Atomics = false, .shaderFloat16 = pdev->options4.Native16BitShaderOpsSupported, - .shaderInt8 = false, + .shaderInt8 = support_8bit, .descriptorIndexing = support_descriptor_indexing, .shaderInputAttachmentArrayDynamicIndexing = true, diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index ffae6b9..3452f16 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -1041,6 +1041,10 @@ TODO: document the other workarounds. + + diff --git a/src/util/driconf.h b/src/util/driconf.h index fecff85..83b2533 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -661,4 +661,7 @@ #define DRI_CONF_DZN_CLAIM_WIDE_LINES(def) \ DRI_CONF_OPT_B(dzn_claim_wide_lines, def, "Claim wide line support") +#define DRI_CONF_DZN_ENABLE_8BIT_LOADS_STORES(def) \ + DRI_CONF_OPT_B(dzn_enable_8bit_loads_stores, def, "Enable VK_KHR_8bit_loads_stores") + #endif -- 2.7.4