Module: Mesa
Branch: main
Commit: 89879d8fe21bb1612f2408012bb714b90ff07040
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89879d8fe21bb1612f2408012bb714b90ff07040

Author: Jesse Natalie <[email protected]>
Date:   Fri Jan 27 13:05:33 2023 -0800

dzn: Add a driconf entry for enabling 8bit loads and stores

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>

---

 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 b09622b005f..1ad89cd8ee9 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 ffae6b99c28..3452f16b950 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -1041,6 +1041,10 @@ TODO: document the other workarounds.
         </engine>
     </device>
     <device driver="dzn">
+        <application name="DOOMEternal" executable="DOOMEternalx64vk.exe">
+            <option name="dzn_enable_8bit_loads_stores" value="true" />
+            <option name="dzn_claim_wide_lines" value="true" />
+        </application>
         <application name="No Man's Sky" executable="NMS.exe">
             <option name="dzn_claim_wide_lines" value="true" />
         </application>
diff --git a/src/util/driconf.h b/src/util/driconf.h
index fecff85f730..83b2533fc57 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

Reply via email to