Skip to content

Commit a10bb77

Browse files
committed
detect nv proprietary driver using driver_propertiesKHR
1 parent 15e6fd4 commit a10bb77

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/runtime/vulkan/vk_runtime_device.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ static bool fill_device_properties(VkrDeviceCaps* caps) {
110110
caps->subgroup_size.min = caps->properties.subgroup.subgroupSize;
111111
}
112112
debug_print("Subgroup size range for device '%s' is [%d; %d]\n", caps->properties.base.properties.deviceName, caps->subgroup_size.min, caps->subgroup_size.max);
113+
114+
if (caps->supported_extensions[ShadySupportsKHR_driver_properties]) {
115+
caps->properties.driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
116+
append_pnext((VkBaseOutStructure*) &caps->properties.base, &caps->properties.driver_properties);
117+
}
113118
return true;
114119
}
115120

src/runtime/vulkan/vk_runtime_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ X(0, EXT_subgroup_size_control, empty_fns) \
3939
X(0, KHR_shader_float16_int8, empty_fns) \
4040
X(0, KHR_8bit_storage, empty_fns) \
4141
X(0, KHR_16bit_storage, empty_fns) \
42+
X(0, KHR_driver_properties, empty_fns) \
4243

4344
#define E(is_required, name, _) ShadySupports##name,
4445
typedef enum {
@@ -118,6 +119,7 @@ typedef struct {
118119
VkPhysicalDeviceSubgroupProperties subgroup;
119120
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroup_size_control;
120121
VkPhysicalDeviceExternalMemoryHostPropertiesEXT external_memory_host;
122+
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
121123
} properties;
122124
struct {
123125
bool is_moltenvk;

src/runtime/vulkan/vk_runtime_program.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static CompilerConfig get_compiler_config_for_device(VkrDevice* device, const Co
317317
warn_print("Hack: MoltenVK does not support pointers to unsized arrays properly.\n");
318318
config.lower.decay_ptrs = true;
319319
}
320-
if (device->caps.properties.base.properties.vendorID == 0x10de) {
320+
if (device->caps.properties.driver_properties.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY) {
321321
warn_print("Hack: NVidia somehow has unreliable broadcast_first. Emulating it with shuffles seemingly fixes the issue.\n");
322322
config.hacks.spv_shuffle_instead_of_broadcast_first = true;
323323
}

0 commit comments

Comments
 (0)