webgpu-native / webgpu-headers

**NOT STABLE YET!** See README.
https://webgpu-native.github.io/webgpu-headers/
BSD 3-Clause "New" or "Revised" License
388 stars 45 forks source link

Questions: Shader stages, texture formats, vertex formats, spirv #59

Closed Nielsbishere closed 4 years ago

Nielsbishere commented 4 years ago

I have the following questions:

kainino0x commented 4 years ago

Shader stages: No, the only supported stages are vertex, fragment, and compute. We don't have plans to add geometry shaders unless there is significant demand. Tessellation shaders are difficult because the shape of the API differs between backends (Vulkan, Metal, D3D12) so we don't have a plan for them yet either. Mesh and raytracing shaders are very new and only just becoming non-Nvidia-specific. Since these will be optional features, we will wait for these to mature and standardize further while we work on being able to ship the core API.

ASTC: We plan to guarantee that every platform has either BC or ETC2 support. ASTC is a likely later extension, but it's not a priority yet since ETC2 will be available on mobile. Support is exposed as GPUAdapter.extensions and must be requested with GPUDeviceDescriptor.extensions.

Vertex formats: The core vertex format list is approximately complete. Those which have not been included were removed for specific reasons (not available on some backend API, or on some hardware.) The 3- and 1-attribute vertex formats are IIRC not available on D3D12. RGB11_11_10 I don't remember offhand, but I think it's missing in Metal.

Shading language: The standard will be WGSL, and SPIR-V will not be supported. The WGSL spec and implementations (and tooling) are still in progress and not ready for use yet, though.

kvark commented 4 years ago

@Nielsbishere you should also clarify explicitly if you are interested in native-only, or the Web target with these headers. For native-only we can expose tessellation, mesh shades, whatever, on limited platforms, as native extensions. Same goes for SPIR-V, we can accept this for native-only scenario, at least.

Nielsbishere commented 4 years ago

For targetting web, so as far as I looked into this, that means using dawn with c++ webasm and the other web apis for input and stuff. Though I remember reading that apple had trouble with querying a lot of things in safari due to fingerprinting. I thought this repo was for c++ bindings for webasm/webgpu, but I guess this is more for a client running outside of the web?

kvark commented 4 years ago

This repo is for both. The idea is that if your app is built against this header, you can target both native and the Web. The other way to do this is via https://github.com/gfx-rs/wgpu-rs, which targets the Web directly (but it's Rust).

Nielsbishere commented 4 years ago

Ah nice, but dawn is the only C++ implementation?

Kangz commented 4 years ago

The only C++ implementation as a library. WebKit has an implementation (or will have) in C++ but it's buried inside WebKit and not usable on its own.

Nielsbishere commented 4 years ago

Okay thanks guys. I'll keep this in mind. I think tesselation, mesh shaders and raytracing shaders will be really cool for the future of webgpu though. But of course first get a base that is safe, performant and cross platform which is a challenge to be sure.

kainino0x commented 4 years ago

Sorry, I got this in my email and didn't realize it was on the webgpu-headers repo when I wrote my reply.

We definitely expect many extensions/optional features to show up here that don't show up in WebGPU until later or never.

kainino0x commented 4 years ago

(Like SPIR-V, which is available in this header.)