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

Allow the use of builtin bit functions from ES 3.1 #3704

Open
wizgrav opened this issue Dec 13, 2024 · 3 comments
Open

Allow the use of builtin bit functions from ES 3.1 #3704

wizgrav opened this issue Dec 13, 2024 · 3 comments

Comments

@wizgrav
Copy link

wizgrav commented Dec 13, 2024

I'm working on a project where the bulk of work is traversing hierarchies of bitmasks in u32s and having the ability to use hardware instructions to find the LSB MSB and count the set bits would help a lot. Could we bring those functions from ES 3.1 (bitCount, findLSB, findMSB) as an extension to WebGL 2?

@kdashg
Copy link
Contributor

kdashg commented Dec 16, 2024

Yeah, this sounds pretty easy to add.

@lexaknyazev
Copy link
Member

lexaknyazev commented Dec 17, 2024

FWIW, all math ops (integer as well as a few others) introduced in GLSL ES 3.10 are equally easy to add since they are already supported in the translator:

  • Integer Functions

    • bitfieldExtract and bitfieldInsert
    • bitfieldReverse
    • bitCount
    • findLSB and findMSB
    • uaddCarry and usubBorrow
    • umulExtended and imulExtended
  • Floating-Point Pack and Unpack Functions

    • [un]packUnorm4x8
    • [un]packSnorm4x8
  • Common Functions

    • mix with genIType/genUType/genBType
    • frexp and ldexp

@wizgrav
Copy link
Author

wizgrav commented Dec 17, 2024

@lexaknyazev yeah probably best to pack as many functions as possible in one extension to avoid polluting the registry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants