gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.36k stars 546 forks source link

[meta][ll] Vulkan portability issues #1354

Open kvark opened 7 years ago

kvark commented 7 years ago

Khronos - Vulkan Portability Initiative

Here is a rough list of areas where Vulkan translation to other next-gen APIs is not straightforward. Related to #1226, #1241, and #1102 cc @msiglreith @JohnColanduoni

The following Vulkan pipeline states are not represented in D3D12 and Metal (see https://github.com/gpuweb/gpuweb/issues/26 for detailed PSO comparison):

Direct3D 12

Metal

TODO

Sort the remaining of #1241:

Suggested new feature flags

JohnColanduoni commented 7 years ago

The SwapChain implementation I wrote uses an API that is considered private by Apple on iOS prior to the upcoming iOS 11. If we want to support Metal 1 on iOS that's another sticking point.

msiglreith commented 7 years ago

Events will probably be hard to implement for both APIs, requiring to split command buffers.

kvark commented 7 years ago

I think we should migrate all the points from #1241 here, describe them in great detail, and close the other issue as a duplicate.

Kangz commented 7 years ago

Not sure if this is the right place to share some of our findings so let me know if I should move this.

kvark commented 7 years ago

@Kangz Thanks for chiming in! I split your comment into corresponding issues (#1383 and #1352). I'd prefer to leave this space for more general concerns.

msiglreith commented 7 years ago

Issues (Portability API)

Aspects where vulkan portability is not straightforward. In particular, hard to map towards D3D12, which exposes a smaller and more restricted API surface:

Memory mapping

Summary: Vulkan allows to map arbitrary slices of Heap/DeviceMemory. in other APIs mapping is coupled with (sub)resources.

Vulkan

D3D12

Metal

(Metal uses contents for mapping MTLBuffer afaik, whicb basically maps the whole buffer.)

API Design

We currently follow D3D12 in core by mapping Buffers instead of directly memory, which is a clear restriction compared to vulkans model.

Resource views

Summary:

Vulkan

D3D12

Metal

API Design

We currently follow D3D12 in core by exposing SRV/CBV/UAV/RTV/DSV and use enums on Vulkan.

icefoxen commented 5 years ago

Triangle fans seem like they should be easy to implement just with strips or lists; if I remember I should someday do a good rummage around and see if I can write something that handles them.