Skip to content
New issue

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

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

Already on GitHub? # to your account

GLSL / WGSL #128

Open
FluorescentHallucinogen opened this issue Nov 29, 2023 · 1 comment · May be fixed by #168
Open

GLSL / WGSL #128

FluorescentHallucinogen opened this issue Nov 29, 2023 · 1 comment · May be fixed by #168
Labels
library: new Adding a new language/library

Comments

@FluorescentHallucinogen

I see that GLSL support coming soon (https://github.com/material-foundation/material-color-utilities#library-availability).

Two questions:

  1. Any ETA?

  2. Would it be (and is it even technically possible) to rewrite the quantizer as a shader in GLSL to do all math on GPU instead of CPU?

I mean to pass from JS an array of pixel colors to the GLSL shader and take back to JS an array of dominant colors.

If so, this could be used in a TypeScript version of the library for web app. Browsers now have pretty good WebGL support. I expect a significant increase in performance for (very) large images.

2.1. Is Celebi's algorithm optimized for GPU i.e. can take advantage of the parallel processing on a large number of GPU cores?

@FluorescentHallucinogen
Copy link
Author

I've also been thinking about WGSL (WebGPU Shading Language) (https://google.github.io/tour-of-wgsl/).

As far as I understand from the https://developer.chrome.com/articles/gpu-compute/ and https://surma.dev/things/webgpu/index.html blog posts, WebGPU is designed for general-purpose computing on GPU. So it will be easier to rewrite the algorithm to WGSL than to GLSL. Also, WebGPU seems easier to debug (see https://chrome.google.com/webstore/detail/webgpu-devtools/ckabpgjkjmbkfmichbbgcgbelkbbpopi).

But WebGL support in browsers is much better than WebGPU.

@pennzht pennzht added the library: new Adding a new language/library label Feb 1, 2024
@FluorescentHallucinogen FluorescentHallucinogen changed the title GLSL GLSL / WGSL Jan 31, 2025
@IvanLudvig IvanLudvig linked a pull request Feb 14, 2025 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
library: new Adding a new language/library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants