Skip to content

webgl: lot of functions fail when pointers go above 2GB #20533

Closed

Description

@jspanchu

Here's a list of functions we had to patch to use >>> instead of >>.

_glClearBufferfv
_glClearBufferiv
_glClearBufferuiv
_glTexImage2D
_glTexImage3D
_glTexSubImage2D
 
_glReadPixels
 
_glUniform1fv
_glUniform1iv
_glUniform1uiv
_glUniform2fv
_glUniform2iv
_glUniform2uiv
_glUniform3fv
_glUniform3iv
_glUniform3uiv
_glUniform4fv
_glUniform4iv
_glUniform4uiv
 
_glUniformMatrix2fv
_glUniformMatrix2x3fv
_glUniformMatrix2x4fv
_glUniformMatrix3fv
_glUniformMatrix3x2fv
_glUniformMatrix3x4fv
_glUniformMatrix4fv
_glUniformMatrix4x2fv
_glUniformMatrix4x3fv

Activity

  1. kripken commented on Oct 25, 2023

    @kripken
    Member

    @juj I think you had a PR for that?

  2. Ono-Sendai commented on Feb 16, 2024

    @Ono-Sendai

    I'm running into this issue as well. Some examples (from Firefox:)

    TypeError: WebGL2RenderingContext.uniform4fv: Float32Array branch of (Float32Array or sequence) can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB

    TypeError: WebGL2RenderingContext.compressedTexSubImage2D: Argument 8 can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB

    TypeError: WebGL2RenderingContext.bufferSubData: Argument 3 can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB

    This is from some C++ code compiled to WASM with Emscripten.
    None of my buffers in my C++ code are greater than 2 GB in size, they are individually quite small.

  3. jspanchu commented on Feb 16, 2024

    @jspanchu
    ContributorAuthor

    Yup. That seems about correct. None of the buffers were bigger than 2GB. We ran into this issue when there were so many small buffers that memory addresses beyond 2GB were passed into gl functions.

    Data structures like transform matrices which maybe allocated and passed to glUniform at a later frame were the most hit by this issue.

  4. sbc100 commented on Feb 16, 2024

    @sbc100
    Collaborator

    I believe all the issues in emscripten related to these function have now been fixed. See #21268 and #21334.

    What remain and browser implementation limits. I wonder if there is already an open firefox bug for the ...can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB issue?

    @Ono-Sendai would you mind opening a new issue for the ...can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB firefox issue here in emscripten so we can close this one?

  5. Ono-Sendai commented on Feb 17, 2024

    @Ono-Sendai

    It looks like there is an open issue for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1838218

    Emscripten could work around this by copying or making new buffer views that are smaller than 2GB, to work around this Firefox limitation.

  6. sbc100 commented on Feb 20, 2024

    @sbc100
    Collaborator

    @Ono-Sendai do you know if we can pass a smaller view of larger 2Gb+ array buffer?

  7. added 8 commits that reference this issue on Feb 28, 2024
    e488455
    dfca95b
    5fe50e6
    879e8e6
    42b17c1
    2ec8f35
    c2031ed
    cf496d8
  8. added a commit that references this issue on Mar 1, 2024
    4de9bbb
  9. added a commit that references this issue on Apr 12, 2024
    baa07c9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions