glGetError() function called twice inside glBufferData

classic Classic list List threaded Threaded
3 messages Options
ac
Reply | Threaded
Open this post in threaded view
|

glGetError() function called twice inside glBufferData

ac
Hey guys, after some gl profiling, we have noticed that the glGetError() function gets called twice inside glBufferData()... this looks strange as it might affect performance with continuous state queries... Maybe it does not have a noticeable effect, but it is often recommended not to use glGetError() in production code, so just wondering.

Andres
Reply | Threaded
Open this post in threaded view
|

Re: glGetError() function called twice inside glBufferData

elect
ac wrote
Hey guys, after some gl profiling, we have noticed that the glGetError() function gets called twice inside glBufferData()... this looks strange as it might affect performance with continuous state queries... Maybe it does not have a noticeable effect, but it is often recommended not to use glGetError() in production code, so just wondering.

Andres
Hi Andres,

given what you said it is true, you shouldn't call glBufferData that often if you can

Are you relying on that quite often?
Reply | Threaded
Open this post in threaded view
|

Re: glGetError() function called twice inside glBufferData

Sven Gothel
Administrator
In reply to this post by ac
On 09/13/2015 10:59 PM, ac [via jogamp] wrote:
> Hey guys, after some gl profiling, we have noticed that the glGetError()
> function gets called twice inside glBufferData()... this looks strange as it
> might affect performance with continuous state queries... Maybe it does not
> have a noticeable effect, but it is often recommended not to use glGetError()
> in production code, so just wondering.
>

Look at:
'jogamp.opengl.GLBufferObjectTracker.createBufferStorage(GLBufferStateTracker,
GL, int, long, Buffer, int, int, CreateStorageDispatch)'

you see we need to clear an eventual pre-existing error,
since we need to learn about an GL error after dispatching for storage
creation. The latter has no success return code sadly,
hence the glGetError to be safe!

Since this call is expensive anyways (buffer creation)
it shall not matter that we sync the command stream.

Usually we try to avoid this ofc, since it creates a
performance hit as you mentioned.

~Sven



signature.asc (828 bytes) Download Attachment