gfx-rs / portability

Vulkan Portability Implementation
Mozilla Public License 2.0
383 stars 25 forks source link

Vulkan API portability for C++? #223

Open ghost opened 3 years ago

ghost commented 3 years ago

I'm wondering if this portability can be supported by C++ programs? I just would like to have support for Vulkan API through DirectX 12, and in C++ code... Also, I would like to have direct DXIL shaders in the DirectX 12 backend, without SPIR-V conversion. I hadn't thought to ask such a question for many years.

kvark commented 3 years ago

Vulkan is a C API, so you can use it from C++. The fact that gfx-portability is written in Rust is not standing in the way. It still produces a regular dynamic library.

Also, I would like to have direct DXIL shaders in the DirectX 12 backend, without SPIR-V conversion

That part is problematic, because we generate HLSL code based on the pipeline states and pipeline layout. We can't just work with a random DX12 shader provided by the user.

Are you interested in this with the goal of making shader translation faster? or for a different reason?

ghost commented 3 years ago

Are you interested in this with the goal of making shader translation faster? or for a different reason?

I'm interesting for more direct HLSL Source Code <=> GFX D3D12 compilation and backends.

kvark commented 3 years ago

We don't have this ability right now. We reserve the right to parametrize shader generation not only by the pipeline layout and states, but also the hardware capabilities of the target machine. The best idiomatic way to accelerate pipeline creation is by using Vulkan pipeline caches.