[Mesa-dev] [PATCH 2/3] mesa/st: use ESSL cap top enable gpu_shader5
Ilia Mirkin
imirkin at alum.mit.edu
Thu Mar 21 14:26:03 UTC 2019
On Thu, Mar 21, 2019 at 10:18 AM Rob Clark <robdclark at gmail.com> wrote:
>
> On Thu, Mar 21, 2019 at 10:09 AM Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> >
> > On Thu, Mar 21, 2019 at 9:55 AM Rob Clark <robdclark at gmail.com> wrote:
> > >
> > > For GLES2+ contexts, enable EXT_gpu_shader5 if the driver exposes a
> > > sufficiently high ESSL feature level, even if the GLSL feature level
> > > isn't high enough.
> > >
> > > This allows drivers to support EXT_gpu_shader5 in GLES contexts before
> > > they support all the additional features of ARB_gpu_shader5 in GL
> > > contexts.
> > >
> > > We can also use this cap to enable ARB_ES3_1_compatibility.
> > >
> > > Signed-off-by: Rob Clark <robdclark at gmail.com>
> > > ---
> > > src/mesa/state_tracker/st_extensions.c | 12 ++++++++++++
> > > 1 file changed, 12 insertions(+)
> > >
> > > diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> > > index c953bfd9f7a..92450d88acf 100644
> > > --- a/src/mesa/state_tracker/st_extensions.c
> > > +++ b/src/mesa/state_tracker/st_extensions.c
> > > @@ -1056,6 +1056,8 @@ void st_init_extensions(struct pipe_screen *screen,
> > > consts->GLSLVersionCompat =
> > > screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY);
> > >
> > > + const unsigned ESSLVersion =
> > > + screen->get_param(screen, PIPE_CAP_ESSL_FEATURE_LEVEL);
> > > const unsigned GLSLVersion =
> > > api == API_OPENGL_COMPAT ? consts->GLSLVersionCompat :
> > > consts->GLSLVersion;
> > > @@ -1077,6 +1079,13 @@ void st_init_extensions(struct pipe_screen *screen,
> > >
> > > consts->AllowGLSLCrossStageInterpolationMismatch = options->allow_glsl_cross_stage_interpolation_mismatch;
> > >
> > > + /* Technically we are turning on the EXT_gpu_shader5 extension,
> > > + * ARB_gpu_shader5 does not exist in GLES, but this flag is what
> > > + * switches on EXT_gpu_shader5:
> > > + */
> > > + if (api == API_OPENGLES2 && ESSLVersion >= 320)
> > > + extensions->ARB_gpu_shader5 = GL_TRUE;
> > > +
> > > if (GLSLVersion >= 400)
> > > extensions->ARB_gpu_shader5 = GL_TRUE;
> > > if (GLSLVersion >= 410)
> > > @@ -1539,6 +1548,9 @@ void st_init_extensions(struct pipe_screen *screen,
> > > extensions->ARB_gpu_shader5 &&
> > > extensions->EXT_shader_integer_mix;
> > >
> > > + if (ESSLVersion >= 310)
> > > + extensions->ARB_ES3_1_compatibility = GL__TRUE;
> >
> > I'd make this also conditional on api == API_OPENGLES2 as well. This
> > extension nominally requires GL 4.4, and I think it'd be VERY awkward
> > to provide prior to GL 4.0 (which includes ARB_gpu_shader5 as a
> > component of it).
>
> hmm, I'd just added this since I noticed this extension went away
> compared to my earlier hack soln of reporting 400 for the GSLS feature
> level cap. (Maybe that is a separate bug that it was getting exposed
> despite only exposing GL 3.1?) At any rate, I guess this extension
> doesn't exist in GLES contexts, so I can just drop this hunk.
I think stuff further down depends on this bit being enabled, so you
do need it. It's used as a proxy for "at least ESSL 3.10" further
down. It's a bit circular since the exts determine the version, but
some exts kinda want to know that at least some version is supported.
So I ended up using proxies for "the GL version" by saying
"ES3_1_compat" is supported. But you could flip that to the
ESSLVersion instead.
-ilia
More information about the mesa-dev
mailing list