Skip to content

Commit 6fcfc0b

Browse files
alsepkowCopilot
andcommitted
[VK] Fix EnabledDeviceExtensions redefinition and drop on macOS build
Two local variables both named `EnabledDeviceExtensions` were declared in the same enclosing scope of `VulkanDevice::create`: one added by #1177 (mesh shader) and one added inside `#ifdef VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME` by #1195 (InterlockedOr). On platforms where the Vulkan SDK defines that macro (e.g. the macOS runner with Vulkan 1.4.335), clang rejects the file with `error: redefinition of 'EnabledDeviceExtensions' with a different type`. Beyond the build break, the inner block also overwrote `DeviceInfo.enabledExtensionCount` and `ppEnabledExtensionNames` that the mesh-shader block had populated, silently dropping `VK_EXT_mesh_shader` whenever both extensions were available. Append the AtomicInt64 extension to the single `EnabledDeviceExtensions` vector and assign the `DeviceInfo` extension fields once, after both blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a2e657a commit 6fcfc0b

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

lib/API/VK/Device.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,22 +1315,19 @@ class VulkanDevice : public offloadtest::Device {
13151315
Features.pNext = &MeshFeatures;
13161316
}
13171317

1318-
DeviceInfo.enabledExtensionCount =
1319-
static_cast<uint32_t>(EnabledDeviceExtensions.size());
1320-
DeviceInfo.ppEnabledExtensionNames = EnabledDeviceExtensions.data();
1321-
DeviceInfo.pEnabledFeatures = &Features.features;
1322-
DeviceInfo.pNext = Features.pNext;
1323-
13241318
#ifdef VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME
1325-
llvm::SmallVector<const char *, 1> EnabledDeviceExtensions;
13261319
if (HasShaderImageAtomicInt64Ext &&
13271320
FeaturesImageAtomicInt64.shaderImageInt64Atomics)
13281321
EnabledDeviceExtensions.push_back(
13291322
VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME);
1330-
DeviceInfo.enabledExtensionCount = EnabledDeviceExtensions.size();
1331-
DeviceInfo.ppEnabledExtensionNames = EnabledDeviceExtensions.data();
13321323
#endif
13331324

1325+
DeviceInfo.enabledExtensionCount =
1326+
static_cast<uint32_t>(EnabledDeviceExtensions.size());
1327+
DeviceInfo.ppEnabledExtensionNames = EnabledDeviceExtensions.data();
1328+
DeviceInfo.pEnabledFeatures = &Features.features;
1329+
DeviceInfo.pNext = Features.pNext;
1330+
13341331
VkDevice Device = VK_NULL_HANDLE;
13351332
if (auto Err = VK::toError(
13361333
vkCreateDevice(PhysicalDevice, &DeviceInfo, nullptr, &Device),

0 commit comments

Comments
 (0)