@@ -195,7 +195,8 @@ class HelloTriangleApplication {
195195 vk::KHRCreateRenderpass2ExtensionName,
196196 vk::KHRAccelerationStructureExtensionName,
197197 vk::KHRBufferDeviceAddressExtensionName,
198- vk::KHRDeferredHostOperationsExtensionName
198+ vk::KHRDeferredHostOperationsExtensionName,
199+ vk::KHRRayQueryExtensionName
199200 };
200201
201202 void initWindow () {
@@ -372,7 +373,8 @@ class HelloTriangleApplication {
372373 vk::PhysicalDeviceVulkan12Features,
373374 vk::PhysicalDeviceVulkan13Features,
374375 vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
375- vk::PhysicalDeviceAccelerationStructureFeaturesKHR>();
376+ vk::PhysicalDeviceAccelerationStructureFeaturesKHR,
377+ vk::PhysicalDeviceRayQueryFeaturesKHR>();
376378 bool supportsRequiredFeatures = features.template get <vk::PhysicalDeviceFeatures2>().features .samplerAnisotropy &&
377379 features.template get <vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
378380 features.template get <vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState &&
@@ -382,7 +384,8 @@ class HelloTriangleApplication {
382384 features.template get <vk::PhysicalDeviceVulkan12Features>().runtimeDescriptorArray &&
383385 features.template get <vk::PhysicalDeviceVulkan12Features>().shaderSampledImageArrayNonUniformIndexing &&
384386 features.template get <vk::PhysicalDeviceVulkan12Features>().bufferDeviceAddress &&
385- features.template get <vk::PhysicalDeviceAccelerationStructureFeaturesKHR>().accelerationStructure ;
387+ features.template get <vk::PhysicalDeviceAccelerationStructureFeaturesKHR>().accelerationStructure &&
388+ features.template get <vk::PhysicalDeviceRayQueryFeaturesKHR>().rayQuery ;
386389
387390 return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
388391 } );
@@ -447,14 +450,15 @@ class HelloTriangleApplication {
447450 // query for Vulkan 1.3 features
448451 vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan12Features,
449452 vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
450- vk::PhysicalDeviceAccelerationStructureFeaturesKHR> featureChain = {
451- {.features = {.samplerAnisotropy = true } }, // vk::PhysicalDeviceFeatures2
453+ vk::PhysicalDeviceAccelerationStructureFeaturesKHR, vk::PhysicalDeviceRayQueryFeaturesKHR > featureChain = {
454+ {.features = {.samplerAnisotropy = true } }, // vk::PhysicalDeviceFeatures2
452455 {.shaderSampledImageArrayNonUniformIndexing = true , .descriptorBindingSampledImageUpdateAfterBind = true ,
453456 .descriptorBindingPartiallyBound = true , .descriptorBindingVariableDescriptorCount = true ,
454- .runtimeDescriptorArray = true , .bufferDeviceAddress = true }, // vk::PhysicalDeviceVulkan12Features
455- {.synchronization2 = true , .dynamicRendering = true }, // vk::PhysicalDeviceVulkan13Features
456- {.extendedDynamicState = true }, // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
457- {.accelerationStructure = true }, // vk::PhysicalDeviceAccelerationStructureFeaturesKHR
457+ .runtimeDescriptorArray = true , .bufferDeviceAddress = true }, // vk::PhysicalDeviceVulkan12Features
458+ {.synchronization2 = true , .dynamicRendering = true }, // vk::PhysicalDeviceVulkan13Features
459+ {.extendedDynamicState = true }, // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
460+ {.accelerationStructure = true }, // vk::PhysicalDeviceAccelerationStructureFeaturesKHR
461+ {.rayQuery = true } // vk::PhysicalDeviceRayQueryFeaturesKHR
458462 };
459463
460464 // create a Device
@@ -1002,14 +1006,10 @@ class HelloTriangleApplication {
10021006 vk::AccelerationStructureGeometryDataKHR geomData (trianglesData);
10031007 vk::AccelerationStructureGeometryKHR blasGeometry{
10041008 .geometryType = vk::GeometryTypeKHR::eTriangles,
1005- .geometry = geomData
1009+ .geometry = geomData,
1010+ .flags = vk::GeometryFlagBitsKHR::eOpaque
10061011 };
10071012
1008- if (!submesh.alphaCut )
1009- {
1010- blasGeometry.flags = vk::GeometryFlagBitsKHR::eOpaque;
1011- }
1012-
10131013 vk::AccelerationStructureBuildRangeInfoKHR blasRangeInfo{
10141014 .primitiveCount = static_cast <uint32_t >(submesh.indexCount / 3 ),
10151015 .primitiveOffset = 0 ,
0 commit comments