[vlc-devel] [PATCH] opengl: api: drain error in case of error

Rémi Denis-Courmont remi at remlab.net
Wed Jan 27 17:37:56 UTC 2021


Le keskiviikkona 27. tammikuuta 2021, 19.24.34 EET Romain Vimont a écrit :
> Le 27 janvier 2021 18:13:45 GMT+01:00, Alexandre Janniaux 
<ajanni at videolabs.io> a écrit :
> >Otherwise, the error might be detected afterwards in an unrelated part
> >of the code, leading to potential failure or assertion depending on the
> >compilation options.
> >
> >Indeed, an OpenGL call can lead to multiple errors and glGetError must
> >be called in loop, as mentioned by the documentation.
> >
> >https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetError.xhtml
> >
> >> To allow for distributed implementations, there may be several error
> >> flags. If any single error flag has recorded an error, the value of
> >> that flag is returned and that flag is reset to GL_NO_ERROR when
> >> glGetError is called. If more than one flag has recorded an error,
> >> glGetError returns and clears an arbitrary error flag value. Thus,
> >> glGetError should always be called in a loop, until it returns
> >> GL_NO_ERROR, if all error flags are to be reset.
> >
> >---
> >
> > modules/video_output/opengl/gl_api.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> >diff --git a/modules/video_output/opengl/gl_api.c
> >b/modules/video_output/opengl/gl_api.c
> >index 1264dde2a1..d990493832 100644
> >--- a/modules/video_output/opengl/gl_api.c
> >+++ b/modules/video_output/opengl/gl_api.c
> >@@ -163,6 +163,10 @@ vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t
> >*gl)
> >
> >      */
> >     
> >     api->supports_multisample = version >= 3 && error == GL_NO_ERROR;
> >
> >+    /* Drain the errors before continuing. */
> >+    while (error != GL_NO_ERROR)
> 
> Calling it once should be sufficient, isn't it?

The quoted paragraph implies otherwise. (And don't ask me.)

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list