|
4 | 4 | #include <fstream> |
5 | 5 | #include <cstring> |
6 | 6 |
|
7 | | -void VulkanRTPipeline::loadRTPipelineFunctions(VkDevice device) { |
| 7 | +void VulkanRTPipeline::loadRTPipelineFunctions(VkInstance instance, VkDevice device) { |
8 | 8 | vkGetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR) |
9 | 9 | vkGetDeviceProcAddr(device, "vkGetRayTracingShaderGroupHandlesKHR"); |
10 | 10 | vkCreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR) |
11 | 11 | vkGetDeviceProcAddr(device, "vkCreateRayTracingPipelinesKHR"); |
12 | 12 | vkCmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR) |
13 | 13 | vkGetDeviceProcAddr(device, "vkCmdTraceRaysKHR"); |
14 | 14 |
|
| 15 | + vkGetPhysicalDeviceProperties2KHR = (PFN_vkGetPhysicalDeviceProperties2KHR) |
| 16 | + vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2KHR"); |
| 17 | + if (!vkGetPhysicalDeviceProperties2KHR) { |
| 18 | + vkGetPhysicalDeviceProperties2KHR = (PFN_vkGetPhysicalDeviceProperties2KHR) |
| 19 | + vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2"); |
| 20 | + } |
| 21 | + |
15 | 22 | std::cout << "RT pipeline function pointers loaded\n"; |
16 | 23 | } |
17 | 24 |
|
@@ -374,7 +381,15 @@ void VulkanRTPipeline::createShaderBindingTable(VkPhysicalDevice physicalDevice, |
374 | 381 | VkPhysicalDeviceProperties2 deviceProps{}; |
375 | 382 | deviceProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; |
376 | 383 | deviceProps.pNext = &rtProperties; |
377 | | - vkGetPhysicalDeviceProperties2(physicalDevice, &deviceProps); |
| 384 | + |
| 385 | + if (vkGetPhysicalDeviceProperties2KHR) { |
| 386 | + vkGetPhysicalDeviceProperties2KHR(physicalDevice, &deviceProps); |
| 387 | + } else { |
| 388 | + std::cerr << "Warning: vkGetPhysicalDeviceProperties2 not available, RT properties may be invalid\n"; |
| 389 | + // Fallback to basic properties, though rtProperties will remain uninitialized by the call |
| 390 | + VkPhysicalDeviceProperties basicProps; |
| 391 | + vkGetPhysicalDeviceProperties(physicalDevice, &basicProps); |
| 392 | + } |
378 | 393 |
|
379 | 394 | handleSize = rtProperties.shaderGroupHandleSize; |
380 | 395 |
|
|
0 commit comments