Skip to content

Hardware ray tracing and ray queries.#122

Merged
crud89 merged 131 commits intomainfrom
ray-tracing
Feb 3, 2024
Merged

Hardware ray tracing and ray queries.#122
crud89 merged 131 commits intomainfrom
ray-tracing

Conversation

@crud89
Copy link
Copy Markdown
Owner

@crud89 crud89 commented Feb 3, 2024

Describe the pull request

This PR implements support for hardware ray tracing and hardware ray queries. Additionally, many improvements have been made alongside to further streamline resource handling, synchronization and ...

This is quite a large PR, which results from the complexity of the feature. The following major aspects have been implemented:

  • Acceleration Structures are a new resource type introduced to the rendering infrastructure. Bottom-level and top-level acceleration structures both have their own interfaces and implementations within the graphics backends. The general workflow to interact with acceleration structures is demonstrated in the ray tracing and ray queries example. Acceleration structures can allocate their backing buffers on their own, however this may not be optimal, depending on the requirements. It is also possible to pre-allocate buffers in order to pack acceleration structures. The examples demonstrate this. Furthermore, acceleration structures can be copied and compacted, further reducing memory footprints on the GPU.
  • Ray-Tracing Pipelines can be used to perform ray-tracing as a standalone command issued to a command buffer. Such pipelines need to be pre-configured and provided with a shader binding table (SBT). The ray-tracing example demonstrates how to use them.
  • Ray Queries are an alternative to ray-tracing pipeline, where any shader can issue ray queries and opt to handle intersection events. The ray queries example demonstrates how to use them.

There are many smaller improvements:

  • The minimum required DirectX feature level has been raised to 12.1.
  • The DirectX Agility SDK version has been raised to fix a false positive in the debug layer.
  • BufferType was renamed to ResourceHeap and a new ResourceUsage flag has been added. This helps to specialize behavior for different backends.
  • A matrix type has been added to the math library.
  • The Vulkan backend now uses synchronization primitives from the Synchronization2 extension.
  • Images no longer track their layout. This also allows to execute barriers on const resources.
  • Image views are no longer stored by the image itself in Vulkan, but rather by the descriptor set that binds the image, or the frame buffer and swap chain.
  • Buffers now expose their virtual addresses. Images do too, but this is only supported in DirectX.
  • Shader programs implement shared_from_this.
  • Device creation now takes an argument (GraphicsDeviceFeatures) to enable optional features. This is supported for mesh shaders, ray tracing pipelines and ray queries at the moment.
  • Builders now return rvalue references to themselves by default.
  • Command buffers release their shared resources on reset.
  • Pipeline layouts now ensure that the associated shader program contains a valid combination of shaders.
  • The Vulkan native swap chain now supports proper asynchronous presentation.
  • The Vulkan compute pipeline layout constructor argument order is now consistent with the DirectX backend.

The following bugs have been fixed:

  • DirectX exceptions now properly print the error message.
  • Image transitions now work correct if applied to individual layers only.
  • The VulkanDescriptorSetLayout::allocateMultiple overload that uses a callback now passes the right set index.
  • The Vulkan pipeline layout now correctly inserts empty descriptor sets, if there's only one descriptor set that is not bound to space0.

Related issues

crud89 added 30 commits January 10, 2024 10:14
@crud89 crud89 added Vulkan πŸŒ‹ The issue involves the Vulkan backend. DX12 ❎ The issue involves the DX12 backend. labels Feb 3, 2024
@crud89 crud89 added this to the Alpha #04 milestone Feb 3, 2024
@crud89 crud89 self-assigned this Feb 3, 2024
@crud89 crud89 linked an issue Feb 3, 2024 that may be closed by this pull request
15 tasks
@crud89 crud89 marked this pull request as ready for review February 3, 2024 18:36
@crud89 crud89 merged commit fe9a0cb into main Feb 3, 2024
@crud89 crud89 deleted the ray-tracing branch February 5, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX12 ❎ The issue involves the DX12 backend. Vulkan πŸŒ‹ The issue involves the Vulkan backend.

Projects

Status: v0.4.1

Development

Successfully merging this pull request may close these issues.

Implement Raytracing support.

1 participant