[vlc-devel] [PATCH 20/27] opengl: enable multisampling

Romain Vimont rom1v at videolabs.io
Mon Jun 29 19:16:55 CEST 2020


On Mon, Jun 29, 2020 at 06:03:25PM +0200, Alexandre Janniaux wrote:
> Hi
> 
> On Mon, Jun 29, 2020 at 05:24:25PM +0200, Romain Vimont wrote:
> > On Mon, Jun 29, 2020 at 04:57:18PM +0200, Alexandre Janniaux wrote:
> > > On Thu, Jun 25, 2020 at 02:23:07PM +0200, Romain Vimont wrote:
> > > > +    const char *version = (const char *) api->vt.GetString(GL_VERSION);
> > > > +#ifdef USE_OPENGL_ES2
> > > > +#   define PREFIX "OpenGL ES "
> > > > +    /* starts with "OpenGL ES " */
> > > > +    assert(!strncmp(version, PREFIX, sizeof(PREFIX) - 1));
> > > > +    /* skip the prefix */
> > > > +    version += sizeof(PREFIX) - 1;
> > > > +#endif
> > > > +
> > > > +    /* OpenGL >= 3.0:
> > > > +     *     https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glRenderbufferStorageMultisample.xhtml
> > > > +     * OpenGL ES >= 3.0:
> > > > +     *     https://www.khronos.org/registry/OpenGL-Refpages/es3.1/html/glRenderbufferStorageMultisample.xhtml
> > > > +     */
> > > > +    api->supports_multisample = strverscmp(version, "3.0") >= 0;
> > >
> > > Might be replaced and simplified into
> > >
> > > ```
> > > GL_ASSERT_NO_ERROR(vt);
> > > GLint version;
> > > vt->GetIntegerv(GL_MAJOR_VERSION, &version);
> >
> > GL_MAJOR_VERSION is available only for OpenGL >= 3.
> >
> > Note that it could be a hacky way to detect OpenGL >= 3 ;)
> 
> I know, hence the code right below, and probably less hacky
> than relying on driver to respect the norm when it comes to
> formatting a string correctly (which they don't ;) ).

Oh, yes, sorry, I didn't read until the end :)

OK, I changed locally.

> >
> > > GLenum error = vt->GetError();
> > > api->supports_multisample = version >= 3 && error == GL_NO_ERROR;
> > > ```
> > >
> > > > +
> > > >  #ifdef USE_OPENGL_ES2
> > > >      api->is_gles = true;
> > > >      /* OpenGL ES 2 includes support for non-power of 2 textures by specification
> > > > diff --git a/modules/video_output/opengl/gl_api.h b/modules/video_output/opengl/gl_api.h
> > > > index 2ddae33178..49b46ae110 100644
> > > > --- a/modules/video_output/opengl/gl_api.h
> > > > +++ b/modules/video_output/opengl/gl_api.h
> > > > @@ -43,6 +43,9 @@ struct vlc_gl_api {
> > > >
> > > >      /* Non-power-of-2 texture size support */
> > > >      bool supports_npot;
> > > > +
> > > > +    /* Multisampling for anti-aliasing */
> > > > +    bool supports_multisample;
> > > >  };
> > > >
> > > >  int
> > > > --
> > > > 2.27.0
> > > >
> > > _______________________________________________
> > > vlc-devel mailing list
> > > To unsubscribe or modify your subscription options:
> > > https://mailman.videolan.org/listinfo/vlc-devel
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list