Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTX Extensions for DX12, Vulkan and OpenGL #2418

Open
novacrazy opened this issue Sep 21, 2018 · 11 comments
Open

RTX Extensions for DX12, Vulkan and OpenGL #2418

novacrazy opened this issue Sep 21, 2018 · 11 comments

Comments

@novacrazy
Copy link

novacrazy commented Sep 21, 2018

I'm not sure what the protocol is for extension support, but with Nvidia's newest GPUs they have also helped to add ray-tracing extensions to DirectX 12, Vulkan and even OpenGL. These three extensions are very similar, so adding them to the HAL would be nice to have.

Quick links:
VK_NV_raytracing
GLSL_NV_raytracing
SPV_NV_raytracing

Additionally, I found that Metal supports some ray-tracing acceleration via the Metal Performance Shaders.

@anchpop
Copy link

anchpop commented Feb 7, 2019

Any progress on this?

@kvark
Copy link
Member

kvark commented Feb 7, 2019

Whatever we expose will likely be based on Khronos efforts, and there isn't anything yet to target, see KhronosGroup/Vulkan-Docs#686

@dgkoch
Copy link

dgkoch commented Feb 28, 2019

Nvidia's newest GPUs they have also helped to add ray-tracing extensions to DirectX 12, Vulkan and even OpenGL

Actually there is no OpenGL support. The VK/GLSL/SPV are all part of the Vulkan extension (which is now called VK_NV_ray_tracing btw).

@novacrazy
Copy link
Author

Ah, I see. Slightly unfortunate but understandable. I've updated the links as well, which seemed to have rotted due to the name change.

@ghost
Copy link

ghost commented Apr 11, 2019

and even OpenGL

Can be opted by OptiX, but may have some problems with shaders compilation. Can be used Vulkan interop (but better use Vulkan itself).
For DirectX 12 can be used DXR. For Vulkan API can be used VK_NV_ray_tracing. For shading language can be used HLSL with DXC (for both API).

@kvark
Copy link
Member

kvark commented Apr 22, 2019

Let me expand on the previous answer. Surely, there are many targets that support some way of raytracing. However, Vulkan itself doesn't have a vendor-independent API for this, and we are modelling gfx-rs API after Vulkan. So it's not clear how to expose this now. Whatever we implement today would have to be changed (possibly, in a major way) when/if Vulkan comes up with a standard API for raytracing.

Saying that, any ideas and PRs on rolling out the initial implementation here are welcome!

@tangmi
Copy link
Contributor

tangmi commented Jun 17, 2019

Hi @kvark! I'm interested in learning about ray tracing APIs and would love to take a stab at this. Do you think an API in gfx shaped like VK_NV_ray_tracing (i.e. allocating and filling acceleration structures, compiling shaders, and launching initial rays) would be a reasonable starting point?

This, like you've mentioned, could only be implemented on Vulkan for NVIDIA cards, but I think there'd be a reasonable mapping from DX12's DXR and Metal ray tracing. A polyfill might be possible for other devices/APIs (built on a non-raytracing subset of gfx-hal, based on D3D12RaytracingFallback?). I wonder also if it'd be reasonable to (for now) ask gfx-hal users to query the backend/system/etc for ray tracing support (like the GL backend does with e.g. compute support) and giving them the burden of switching on support while there's no vendor-independent API.

@kvark
Copy link
Member

kvark commented Jun 18, 2019

@tangmi thank you for the interest!
We definitely can get something today (compatible with Metal, DX12, and VK NVidia), but we'll potentially have to rewrite this later when KhronosGroup/Vulkan-Docs#686 is done in order to fit the Vulkan API.

So if you want to work on this - great! We'll accept the PRs delivering this function, but beware of the future change please.

@kvark kvark removed the api: hal label Jun 26, 2019
@BrandonDyer64
Copy link
Contributor

Is this gaining any traction, now that ray tracing is officially part of the Vulkan specification?

@kvark
Copy link
Member

kvark commented Apr 5, 2020

@BrandonDyer64 it would be great to expose this Vulkan API, but also it's very important to look at how it will map to DX12 and Metal. As far as I know, nobody has started looking at this yet.

@kvark
Copy link
Member

kvark commented Nov 23, 2020

The Vulkan extension is out of the provisional status - https://www.khronos.org/blog/vulkan-ray-tracing-final-specification-release.
Edit: here is some code to help us writing DX12 backend for this - https://github.com/maierfelix/dawn-ray-tracing/blob/master/src/dawn_native/d3d12/RayTracingPipelineD3D12.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants