Inneficient and not-standarized way to upload buffers to OpenGL in WATERMeDIA #75
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
I'm not an expert in graphics, but I digged a bit and found this so far : According to https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml, the importants parameters on
According to https://www.khronos.org/opengl/wiki/Pixel_Transfer#Format_conversion, the best would be to match the OpenGL parameters to the source buffer we have as much as we can, so that OpenGL will handle the conversion work, possibly in hardware (so MUCH faster). For exemple, if we have a buffer made of type BufferedImage.TYPE_INT_ARGB.
Another exemple, if we had an image with a BufferedImage.TYPE_3BYTE_BGR (BMP for exemple), we should have the following parameters for
When I did my PR, I assumed that the order you had set was mendatory because of the byteswapping you used. |
Beta Was this translation helpful? Give feedback.
-
LETS TALK
133a000 introduced by @ZenoArrows changes the target format and buffer type to BGRA
PR #65 introduced by @zFERDQFREZrzfq changes the impl and also applies BGRA uploading a ARGB buffer
CONCERN
Zeno args BGRA is the most efficient format for the GPU and the drivers while FEDO args is better just pass the ARGB format natively.
Right now
glTeexImage2D
burns on profilers, specially on videos.WHAT DOCS SAYS
After some research, i find this:
https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_upload_and_pixel_reads
complemented with this: https://www.khronos.org/opengl/wiki/Pixel_Transfer#Pixel_format
TL;DR: BGRA is preferred on windows? nope
Aparently (assuming) that was a very old information involving windows phone and many other rusty techs. but all concludes ARGB and BGRA performs the same. So this information is inconcluse
Also it mentions a little bit about image convertion but nothing than states about performance (only functionality)
REASON OF THE DISCUSSION
Format, Buffers and many other rendering stuff is not well done
This need to place a spec on the table to workout using default and interfaces to manage properties about a picture/video, its format and pixel type, and start preparing the API rewrite of the RenderAPI, PlayerAPI and ImageAPI making them work with almost the same spec
TOPIC OF DISCUSSION
Beta Was this translation helpful? Give feedback.
All reactions