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

[OpenGL ES] NV_pixel_buffer_object doesn't define GL_STREAM_READ #66

Open
emersion opened this issue Apr 2, 2020 · 4 comments
Open
Assignees

Comments

@emersion
Copy link

emersion commented Apr 2, 2020

OpenGL ES 2.0 core only defines GL_STREAM_WRITE. NV_pixel_buffer_object advertises that it allows "Asynchronous glReadPixels". The code examples use GL_STREAM_READ. However including both <GLES2/gl2.h> and <GLES2/gl2ext.h> isn't enough to get access to this symbol necessary for creating a PBO that can be read from. No other GLES2 extension seems to define it.

Is this an oversight?

cc @pow2clk

@pow2clk
Copy link

pow2clk commented Apr 2, 2020

@mheyer32 is the contact on this spec now. These were pretty heavily "inspired" by the desktop specs. It's entirely possible that the enum was inadvertently copied from there.

@nvmheyer
Copy link

nvmheyer commented Apr 2, 2020

@nvmheyer would be me with NVIDIA hat on :-)

This is certainly a mistake in the NV_pbo extension specs (which are in fact based off the desktop extension spec language) to use GL_STREAM_READ. The other example uses GL_STREAM_DRAW.

One could argue that the EXT_map_buffer_range extension should have introduced new usage hints as it allows reading back from buffers for the first time in GLES.

This should not be a huge problem, though. The buffer usage hints are not a good indicator of how a buffer is going to be used. The NVIDIA driver, for instance, will mostly ignore the hints and instead infer the optimal buffer storage from the actual usage.

@emersion
Copy link
Author

emersion commented Apr 2, 2020

This should not be a huge problem, though.

Ah, indeed, it seems like this is just a hint and that it doesn't constrain the actual usage. It's unfortunate that there's no "no hint" enum value.

Mesa also ignores the hint in this situation: https://gitlab.freedesktop.org/mesa/mesa/-/blob/e5339fe4a47c242693962c9f90bbab8b74935cba/src/mesa/state_tracker/st_cb_bufferobjects.c#L248

This is certainly a mistake in the NV_pbo extension specs

Should we somehow fix the examples?

One could argue that the EXT_map_buffer_range extension should have introduced new usage hints as it allows reading back from buffers for the first time in GLES.

Indeed. I'm not sure if/how we can fix that.

@pdaniell-nv
Copy link

@nvmheyer Would you mind creating a PR to fix this minor issue? Thanks.

nvmheyer added a commit to nvmheyer/OpenGL-Registry that referenced this issue May 6, 2020
GL_STREAM_READ is not available in ES2.0. In fact, EXT_map_buffer_range
was the first time a mapped buffer could be read from legally.
Just use GL_STREAM_DRAW instead. This  is not a major problem, though,
as the usage hints do not affect the legal usage of a buffer and are
taken by the drivers merely as hints, sometimes even being ignored.

KhronosGroup/OpenGL-API#66
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

4 participants