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

Add bindings for Tint #1842

Open
LeNitrous opened this issue Dec 16, 2023 · 6 comments
Open

Add bindings for Tint #1842

LeNitrous opened this issue Dec 16, 2023 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@LeNitrous
Copy link
Contributor

Summary of feature

Tint is Google's compiler for the WebGPU shader language and is used by libraries such as Babylon.js and Naga. It allows compilation of SPIR-V code to and from WGSL. Used in conjunction with Shaderc and SPIRV-Cross, it will enable a full compilation chain between GLSL/HLSL to and from SPIR-V then to and from WGSL.

Comments

Tint is available via Google Git: https://dawn.googlesource.com/tint

@LeNitrous LeNitrous added the enhancement New feature or request label Dec 16, 2023
@Beyley
Copy link
Contributor

Beyley commented Dec 16, 2023

I dont feel Tint bindings are necessary. Both Dawn and wgpu-native are able to intake SPIRV directly without a conversion since Tint and Naga are builtin to the libraries. This doesnt cover the manually translating WGSL -> SPIRV case, however i dont believe that case would be very common, or has many uses.

With shaderc + wpgu-native/dawn, you can already compile GLSL to SPIRV, then pass that SPIRV into the respective implementation directly.

@Perksey
Copy link
Member

Perksey commented Dec 16, 2023

What about WASM?

@Beyley
Copy link
Contributor

Beyley commented Dec 16, 2023

What about WASM?

Both google and mozilla have shown interest in providing this to JS as well through an extension. I believe it already works with chromium behind the "unsafe webgpu support" flag (webgpu itself is also still behind said flag on some platforms on chromium, so thats doesnt mean much)

In either case, you probably dont want to be packing many-megabyte shader compilation and translation libraries into your game's WASM build, and should do any shader translations offline as a build step

@Perksey
Copy link
Member

Perksey commented Dec 16, 2023

What about WebKit?

@Beyley
Copy link
Contributor

Beyley commented Dec 16, 2023

What about WebKit?

Not sure about webkit, however it is extremely unlikely they will provide SPIRV support given apple is probably a very large reason we arent using SPIRV on WebGPU as the standard in the first place.

In that case it would make sense to provide Tint/Naga bindings, but we should try to steer users away from doing this at runtime in their WASM builds as much as possible, given the huge inefficiencies at play here in a web environment

@Perksey
Copy link
Member

Perksey commented Dec 16, 2023

Yeah absolutely agree.

@Perksey Perksey added this to the 3.0 milestone Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

3 participants