Skip to content

Commit

Permalink
Fix querying of physical device features
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Mar 27, 2021
1 parent c786c93 commit 747b1fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/org/lwjgl/demo/vulkan/raytracing/HybridMagicaVoxel.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR)
.pNext(NULL);
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeaturesKHR = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeatures = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR)
.pNext(accelerationStructureFeatures.address());
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR bufferDeviceAddressFeatures = VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR)
.pNext(rayTracingPipelineFeaturesKHR.address());
.pNext(rayTracingPipelineFeatures.address());
VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = VkPhysicalDeviceFeatures2
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2)
Expand All @@ -459,8 +459,8 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {

// If any of the above is not supported, we continue with the next physical device
if (!bufferDeviceAddressFeatures.bufferDeviceAddress() ||
!accelerationStructureFeatures.accelerationStructure() ||
!bufferDeviceAddressFeatures.bufferDeviceAddress())
!rayTracingPipelineFeatures.rayTracingPipeline() ||
!accelerationStructureFeatures.accelerationStructure())
continue;

// Check if the physical device supports the VK_FORMAT_R16G16B16_UNORM vertexFormat for acceleration structure geometry
Expand Down
10 changes: 5 additions & 5 deletions src/org/lwjgl/demo/vulkan/raytracing/ReflectiveMagicaVoxel.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,14 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR)
.pNext(bitStorageFeatures.address());
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeaturesKHR = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeatures = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR)
.pNext(accelerationStructureFeatures.address());
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR bufferDeviceAddressFeatures = VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR)
.pNext(rayTracingPipelineFeaturesKHR.address());
.pNext(rayTracingPipelineFeatures.address());
VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = VkPhysicalDeviceFeatures2
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2)
Expand All @@ -448,8 +448,8 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {

// If any of the above is not supported, we continue with the next physical device
if (!bufferDeviceAddressFeatures.bufferDeviceAddress() ||
!rayTracingPipelineFeatures.rayTracingPipeline() ||
!accelerationStructureFeatures.accelerationStructure() ||
!bufferDeviceAddressFeatures.bufferDeviceAddress() ||
!bitStorageFeatures.storageBuffer16BitAccess())
continue;

Expand Down Expand Up @@ -502,14 +502,14 @@ private static VkDevice createDevice(List<String> requiredExtensions) {
if (DEBUG) {
ppEnabledLayerNames = stack.pointers(stack.UTF8("VK_LAYER_KHRONOS_validation"));
}
VkPhysicalDevice16BitStorageFeaturesKHR bitStorageFeaturesKHR = VkPhysicalDevice16BitStorageFeaturesKHR
VkPhysicalDevice16BitStorageFeaturesKHR bitStorageFeatures = VkPhysicalDevice16BitStorageFeaturesKHR
.callocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES)
.storageBuffer16BitAccess(true);
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR bufferDeviceAddressFeatures = VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
.callocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR)
.pNext(bitStorageFeaturesKHR.address())
.pNext(bitStorageFeatures.address())
.bufferDeviceAddress(true);
VkPhysicalDeviceDescriptorIndexingFeaturesEXT indexingFeatures = VkPhysicalDeviceDescriptorIndexingFeaturesEXT
.callocStack(stack)
Expand Down
8 changes: 4 additions & 4 deletions src/org/lwjgl/demo/vulkan/raytracing/SimpleTriangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,14 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR)
.pNext(NULL);
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeaturesKHR = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineFeatures = VkPhysicalDeviceRayTracingPipelineFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR)
.pNext(accelerationStructureFeatures.address());
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR bufferDeviceAddressFeatures = VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR)
.pNext(rayTracingPipelineFeaturesKHR.address());
.pNext(rayTracingPipelineFeatures.address());
VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = VkPhysicalDeviceFeatures2
.mallocStack(stack)
.sType(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2)
Expand All @@ -408,8 +408,8 @@ private static DeviceAndQueueFamilies selectPhysicalDevice() {

// If any of the above is not supported, we continue with the next physical device
if (!bufferDeviceAddressFeatures.bufferDeviceAddress() ||
!accelerationStructureFeatures.accelerationStructure() ||
!bufferDeviceAddressFeatures.bufferDeviceAddress())
!rayTracingPipelineFeatures.rayTracingPipeline() ||
!accelerationStructureFeatures.accelerationStructure())
continue;

// Retrieve physical device properties (limits, offsets, alignments, ...)
Expand Down

0 comments on commit 747b1fb

Please sign in to comment.