emscripten-core/emscripten

glMapBufferData requires INVALIDATE_BUFFER?

Open

#6.692 geöffnet am 13. Juni 2018

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (3.519 Forks)batch import
GLgood first bughelp wanted

Repository-Metriken

Stars
 (27.361 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 10h) (147 gemergte PRs in 30 T)

Beschreibung

The emulation for glMapBufferRange requires MAP_WRITE and INVALIDATE_BUFFER here: https://github.com/kripken/emscripten/blob/a4d732f3094cfb2377609e1661044679f9c79734/src/library_gl.js#L1744

Under the hood, in glUnmapBufferData, the call is translated into a glBufferSubData. I don't think requiring INVALIDATE_BUFFER is correct here -- that means that the entire buffer should be discarded, not just the range that's mapped (which is INVALIDATE_RANGE). I think that:

  1. The requirement should be changed to INVALIDATE_RANGE
  2. A check should be done that there isn't an existing mapping for that buffer (additional restriction of only one range mapping per buffer, which GL doesn't have -- this could be relaxed with additional code, but probably not necessary in practice)

(Note I haven't tested any of this, this is just by code inspection from a question someone asked)

Contributor Guide