diff options
| author | HDFreitas <halissonfreitas@hotmail.com> | 2026-11-22 17:56:12 -0300 |
|---|---|---|
| committer | HDFreitas <halissonfreitas@hotmail.com> | 2026-11-22 17:56:12 -0300 |
| commit | c533c1d6384bbb76e726cfde5203dc18ab73f934 (patch) | |
| tree | ddeb57eb49f6adb02156835b5ad5b4265eafe65c /runtime/test/vulkan13_features_test.cpp | |
| parent | 9dc7ce6f940fe03ab7b838248e49b7bb28c70300 (diff) | |
tests(runtime): cover 1.2 feature-bit rejection, enable flags, and 1.3 choose()
Diffstat (limited to 'runtime/test/vulkan13_features_test.cpp')
| -rw-r--r-- | runtime/test/vulkan13_features_test.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/runtime/test/vulkan13_features_test.cpp b/runtime/test/vulkan13_features_test.cpp index cf1b4d99c..d0c446495 100644 --- a/runtime/test/vulkan13_features_test.cpp +++ b/runtime/test/vulkan13_features_test.cpp | |||
| @@ -248,11 +248,30 @@ int main() { | |||
| 248 | EXPECT(types[2] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); | 248 | EXPECT(types[2] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); |
| 249 | EXPECT(types[3] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2); | 249 | EXPECT(types[3] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2); |
| 250 | 250 | ||
| 251 | const auto* rendering = static_cast<const VkPhysicalDeviceDynamicRenderingFeaturesKHR*>(head); | ||
| 252 | const auto* sync2 = static_cast<const VkPhysicalDeviceSynchronization2FeaturesKHR*>(rendering->pNext); | ||
| 253 | EXPECT(rendering->dynamicRendering == VK_TRUE); | ||
| 254 | EXPECT(sync2->synchronization2 == VK_TRUE); | ||
| 255 | |||
| 251 | std::vector<const char*> exts; | 256 | std::vector<const char*> exts; |
| 252 | v13.add_extensions(exts); | 257 | v13.add_extensions(exts); |
| 253 | EXPECT(exts.size() == 2); | 258 | EXPECT(exts.size() == 2); |
| 254 | EXPECT(std::strcmp(exts[0], VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME) == 0); | 259 | EXPECT(std::strcmp(exts[0], VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME) == 0); |
| 255 | EXPECT(std::strcmp(exts[1], VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) == 0); | 260 | EXPECT(std::strcmp(exts[1], VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) == 0); |
| 261 | |||
| 262 | // Extensions advertised, but each required feature bit cleared in turn after a successful query. | ||
| 263 | dev.features2_calls = 0; | ||
| 264 | dev.dynamic_rendering = VK_FALSE; | ||
| 265 | dev.synchronization2 = VK_TRUE; | ||
| 266 | v13.query(VK_NULL_HANDLE, VK_API_VERSION_1_2, fake_get_features2, fake_enumerate_extensions); | ||
| 267 | EXPECT(dev.features2_calls == 1); | ||
| 268 | EXPECT(!v13.core && !v13.dynamic_rendering && v13.synchronization2 && !v13.usable()); | ||
| 269 | |||
| 270 | dev.dynamic_rendering = VK_TRUE; | ||
| 271 | dev.synchronization2 = VK_FALSE; | ||
| 272 | v13.query(VK_NULL_HANDLE, VK_API_VERSION_1_2, fake_get_features2, fake_enumerate_extensions); | ||
| 273 | EXPECT(dev.features2_calls == 2); | ||
| 274 | EXPECT(!v13.core && v13.dynamic_rendering && !v13.synchronization2 && !v13.usable()); | ||
| 256 | } | 275 | } |
| 257 | 276 | ||
| 258 | // Vulkan 1.2 with only EDS1 (missing EDS2), or both extensions with one feature bit false: EDS stays off. | 277 | // Vulkan 1.2 with only EDS1 (missing EDS2), or both extensions with one feature bit false: EDS stays off. |
| @@ -323,6 +342,15 @@ int main() { | |||
| 323 | EXPECT(types[4] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); | 342 | EXPECT(types[4] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); |
| 324 | EXPECT(types[5] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2); | 343 | EXPECT(types[5] == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2); |
| 325 | 344 | ||
| 345 | const auto* rendering = static_cast<const VkPhysicalDeviceDynamicRenderingFeaturesKHR*>(head); | ||
| 346 | const auto* sync2 = static_cast<const VkPhysicalDeviceSynchronization2FeaturesKHR*>(rendering->pNext); | ||
| 347 | const auto* eds = static_cast<const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT*>(sync2->pNext); | ||
| 348 | const auto* eds2 = static_cast<const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT*>(eds->pNext); | ||
| 349 | EXPECT(rendering->dynamicRendering == VK_TRUE); | ||
| 350 | EXPECT(sync2->synchronization2 == VK_TRUE); | ||
| 351 | EXPECT(eds->extendedDynamicState == VK_TRUE); | ||
| 352 | EXPECT(eds2->extendedDynamicState2 == VK_TRUE); | ||
| 353 | |||
| 326 | std::vector<const char*> exts; | 354 | std::vector<const char*> exts; |
| 327 | chosen.add_extensions(exts); | 355 | chosen.add_extensions(exts); |
| 328 | EXPECT(exts.size() == 4); | 356 | EXPECT(exts.size() == 4); |
| @@ -332,6 +360,39 @@ int main() { | |||
| 332 | EXPECT(std::strcmp(exts[3], VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) == 0); | 360 | EXPECT(std::strcmp(exts[3], VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) == 0); |
| 333 | } | 361 | } |
| 334 | 362 | ||
| 363 | // choose() with a Vulkan 1.3 candidate preserves core=true and subgroup flags after source overwrite. | ||
| 364 | { | ||
| 365 | FakeDevice dev; | ||
| 366 | dev.dynamic_rendering = VK_TRUE; | ||
| 367 | dev.synchronization2 = VK_TRUE; | ||
| 368 | dev.subgroup_size_control = VK_TRUE; | ||
| 369 | dev.compute_full_subgroups = VK_TRUE; | ||
| 370 | g_device = &dev; | ||
| 371 | |||
| 372 | Vulkan13Features candidate; | ||
| 373 | candidate.query(VK_NULL_HANDLE, VK_API_VERSION_1_3, fake_get_features2, nullptr); | ||
| 374 | EXPECT(candidate.core && candidate.usable()); | ||
| 375 | |||
| 376 | Vulkan13Features chosen; | ||
| 377 | chosen.choose(candidate); | ||
| 378 | candidate.query(VK_NULL_HANDLE, VK_API_VERSION_1_1, fake_get_features2, fake_enumerate_extensions); | ||
| 379 | EXPECT(!candidate.core && !candidate.usable()); | ||
| 380 | EXPECT(chosen.core && chosen.usable() && chosen.extended_dynamic_state); | ||
| 381 | EXPECT(chosen.subgroup_size_control && chosen.compute_full_subgroups); | ||
| 382 | |||
| 383 | VkBaseOutStructure tail{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr}; | ||
| 384 | void* head = chosen.enable(&tail); | ||
| 385 | const auto* enable13 = static_cast<const VkPhysicalDeviceVulkan13Features*>(head); | ||
| 386 | EXPECT(enable13->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES); | ||
| 387 | EXPECT(enable13->dynamicRendering == VK_TRUE && enable13->synchronization2 == VK_TRUE); | ||
| 388 | EXPECT(enable13->subgroupSizeControl == VK_TRUE && enable13->computeFullSubgroups == VK_TRUE); | ||
| 389 | EXPECT(enable13->pNext == &tail); | ||
| 390 | |||
| 391 | std::vector<const char*> exts; | ||
| 392 | chosen.add_extensions(exts); | ||
| 393 | EXPECT(exts.empty()); | ||
| 394 | } | ||
| 395 | |||
| 335 | // device_proc_or_khr resolves core first, then KHR, then EXT, else null. | 396 | // device_proc_or_khr resolves core first, then KHR, then EXT, else null. |
| 336 | { | 397 | { |
| 337 | ProcLookup lookup; | 398 | ProcLookup lookup; |