[Mesa-dev] [PATCH 2/3] mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile

Mark Janes mark.a.janes at intel.com
Wed Nov 1 21:58:29 UTC 2017


Marek Olšák <maraeo at gmail.com> writes:

> Hi Mark,
>
> Can you try the attached patches instead?

After talking with Ken and Dylan, I realize that I missed a one-line
patch from your thread with my last test (Oct 25 patch to
intel_extensions.c).  With that patch, there are no regressions in CI.

I'm testing the attached patches as well.

> Thanks,
> Marek
>
> On Wed, Nov 1, 2017 at 9:49 PM, Mark Janes <mark.a.janes at intel.com> wrote:
>> Dylan Baker <dylan at pnwbakers.com> writes:
>>
>>> I haven't run the CTS tests, but both the deqp and the piglit test pass on my
>>> skl with Marek's patches applied.
>>
>> I must have tested with only the patch 2 applied.  Running with all
>> three patches in the series, I see no piglit/deqp regressions.
>>
>> However, GLES CTS fails thousands of ES31-CTS.functional.texture tests,
>> eg:
>>
>> ES31-CTS.functional.texture.format.buffer.rg8i_npot
>> glGetIntegerv() failed: glGetError() returned GL_INVALID_ENUM at gluContextInfo.cpp:229
>>
>> -Mark
>>
>>>
>>> Dylan
>>>
>>> Quoting Marek Olšák (2017-10-31 18:16:51)
>>>> This is how I run piglit on i965:
>>>> WAFFLE_GBM_DEVICE=/dev/dri/renderD128 PIGLIT_PLATFORM=gbm piglit/bin/glinfo|head
>>>> GL_RENDERER = Mesa DRI Intel(R) Ivybridge Desktop
>>>>
>>>> Of course I have Radeon as my main GPU.
>>>>
>>>> Marek
>>>>
>>>> On Wed, Nov 1, 2017 at 12:52 AM, Mark Janes <mark.a.janes at intel.com> wrote:
>>>> > No, please don't.  We can't have thousands of failures added to CI.
>>>> >
>>>> > Dylan, can you double check this for Marek?  I'm surprised that it
>>>> > doesn't reproduce for him.
>>>> >
>>>> > -Mark
>>>> >
>>>> > Marek Olšák <maraeo at gmail.com> writes:
>>>> >
>>>> >> I can't reproduce the issue on my IVB. How about I just push this and
>>>> >> you guys fix i965 when you have time?
>>>> >>
>>>> >> Marek
>>>> >>
>>>> >> On Thu, Oct 26, 2017 at 5:46 PM, Mark Janes <mark.a.janes at intel.com> wrote:
>>>> >>> That fixed many issues, but:
>>>> >>>
>>>> >>> On deqp EGL tests, we get:
>>>> >>>
>>>> >>> dEQP-EGL.functional.create_context_ext.gl_42.rgba8888_no_depth_no_stencil
>>>> >>> deqp-egl: main/api_exec.c:135: _mesa_initialize_exec_table: Assertion `ctx->Version > 0' failed.
>>>> >>>
>>>> >>> On ES31 CTS tests:
>>>> >>> ES31-CTS.functional.texture.texture_buffer.render.as_vertex_array_as_vertex_texture_as_fragment_texture.range_size_513
>>>> >>> glGetIntegerv() failed: glGetError() returned GL_INVALID_ENUM at
>>>> >>> gluContextInfo.cpp:229
>>>> >>>
>>>> >>> on GL46 CTS (27 failures):
>>>> >>> src/mesa/main/teximage.c:595: _mesa_tex_target_is_layered: Assertion
>>>> >>> `!"Invalid texture target."' failed.
>>>> >>>
>>>> >>> Piglit fails 3.5k tests with the same `ctx->Version > 0' assertion as
>>>> >>> deqp-egl.
>>>> >>>
>>>> >>> -Mark
>>>> >>>
>>>> >>> Dylan Baker <dylan at pnwbakers.com> writes:
>>>> >>>
>>>> >>>> I've pushed it to our CI, I'll let you know tomorrow what it looks like
>>>> >>>>
>>>> >>>> Dylan
>>>> >>>>
>>>> >>>> Quoting Marek Olšák (2017-10-25 19:52:43)
>>>> >>>>> Hi Dylan,
>>>> >>>>>
>>>> >>>>> Can you please add this and re-test?
>>>> >>>>>
>>>> >>>>> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/
>>>> >>>>> dri/i965/intel_extensions.c
>>>> >>>>> index 21cf632..4d17393 100644
>>>> >>>>> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
>>>> >>>>> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
>>>> >>>>> @@ -178,7 +178,7 @@ intelInitExtensions(struct gl_context *ctx)
>>>> >>>>>        ctx->Extensions.ARB_pipeline_statistics_query = true;
>>>> >>>>>        ctx->Extensions.ARB_sample_shading = true;
>>>> >>>>>        ctx->Extensions.ARB_shading_language_420pack = true;
>>>> >>>>> -      if (ctx->API == API_OPENGL_CORE) {
>>>> >>>>> +      if (ctx->API != API_OPENGL_COMPAT) {
>>>> >>>>>           ctx->Extensions.ARB_texture_buffer_object = true;
>>>> >>>>>           ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
>>>> >>>>>           ctx->Extensions.ARB_texture_buffer_range = true;
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> Marek
>>>> >>>>>
>>>> >>>>> On Wed, Oct 25, 2017 at 11:42 PM, Dylan Baker <dylanx.c.baker at intel.com> wrote:
>>>> >>>>>
>>>> >>>>>     There are a significant number of i965 regressions from
>>>> >>>>>     d96c68146a781c79a23f5181d7050174f1070d90, largely related to texturing (I
>>>> >>>>>     can
>>>> >>>>>     send you a complete list of regressions if you care, but due to the large
>>>> >>>>>     number
>>>> >>>>>     of them I suspect it's something fairly simple).
>>>> >>>>>
>>>> >>>>>     For example:
>>>> >>>>>     ES31-CTS.functional.texture.format.buffer.r32ui_npot
>>>> >>>>>
>>>> >>>>>     glGetIntegerv() failed: glGetError() returned GL_INVALID_ENUM at
>>>> >>>>>     gluContextInfo.cpp:229
>>>> >>>>>
>>>> >>>>>     dEQP-GLES31.functional.state_query.integer.texture_buffer_
>>>> >>>>>     binding_getinteger:
>>>> >>>>>
>>>> >>>>>     glGetIntegerv(GL_TEXTURE_BUFFER_BINDING, 0x00007ffee0c43834);
>>>> >>>>>     // data = { -555819298 }
>>>> >>>>>     glGetError();
>>>> >>>>>     // GL_INVALID_ENUM returned
>>>> >>>>>      // ERROR: glGetIntegerv: glGetError() returned GL_INVALID_ENUM
>>>> >>>>>
>>>> >>>>>     Dylan
>>>> >>>>>
>>>> >>>>>     Quoting Emil Velikov (2017-10-24 09:30:03)
>>>> >>>>>     > Hi Marek,
>>>> >>>>>     >
>>>> >>>>>     > On 21 October 2017 at 13:54, Marek Olšák <maraeo at gmail.com> wrote:
>>>> >>>>>     > > From: Marek Olšák <marek.olsak at amd.com>
>>>> >>>>>     > >
>>>> >>>>>     > > We already have piglit tests testing alpha, luminance, and intensity
>>>> >>>>>     > > formats. They were skipped by piglit until now.
>>>> >>>>>     > >
>>>> >>>>>     > > Additionally, I'm enabling one ARB_texture_buffer_range piglit test to
>>>> >>>>>     run
>>>> >>>>>     > > with the compat profile.
>>>> >>>>>     >
>>>> >>>>>     > Can you please mention that ARB_texture_buffer_* on i965 is unchanged
>>>> >>>>>     > - aka still enabled only for core profiles.
>>>> >>>>>     > Out of curiosity - can you tried the series with anything more than
>>>> >>>>>     piglit?
>>>> >>>>>     >
>>>> >>>>>     > The Intel guys can run the lot through CTS, dEQP... admittedly only on
>>>> >>>>>     > Intel hardware.
>>>> >>>>>     > Still it should help catch if a piece is missing somewhere.
>>>> >>>>>     >
>>>> >>>>>     >
>>>> >>>>>     > -Emil
>>>> >>>>>     > _______________________________________________
>>>> >>>>>     > mesa-dev mailing list
>>>> >>>>>     > mesa-dev at lists.freedesktop.org
>>>> >>>>>     > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>> >>>>>
>>>> >>>>>
> From 1881027bf1840e4c83f31d30175ef2d1d11d2f8f Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.olsak at amd.com>
> Date: Thu, 19 Oct 2017 22:22:15 +0200
> Subject: [PATCH 1/2] mesa: enable ARB_texture_buffer_* extensions in the
>  Compatibility profile
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> We already have piglit tests testing alpha, luminance, and intensity
> formats. They were skipped by piglit until now.
>
> Additionally, I'm enabling one ARB_texture_buffer_range piglit test to run
> with the compat profile.
>
> i965 behavior is unchanged.
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> Reviewed-by: Eric Anholt <eric at anholt.net>
> ---
>  src/mapi/glapi/gen/apiexec.py                | 12 +++++-------
>  src/mesa/drivers/dri/i965/intel_extensions.c |  8 +++++---
>  src/mesa/main/extensions_table.h             |  6 +++---
>  src/mesa/main/get.c                          |  2 --
>  src/mesa/main/get_hash_params.py             | 20 ++++++++++----------
>  src/mesa/main/tests/dispatch_sanity.cpp      |  8 ++++----
>  src/mesa/main/texparam.c                     |  4 ++--
>  src/mesa/state_tracker/st_context.c          |  2 +-
>  src/mesa/state_tracker/st_extensions.c       |  8 +++++++-
>  src/mesa/state_tracker/st_extensions.h       |  3 ++-
>  src/mesa/state_tracker/st_manager.c          |  2 +-
>  11 files changed, 40 insertions(+), 35 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py
> index 61eda4b..7da0818 100644
> --- a/src/mapi/glapi/gen/apiexec.py
> +++ b/src/mapi/glapi/gen/apiexec.py
> @@ -35,7 +35,7 @@ class exec_info():
>      Each of the attributes that is not None must have a valid value.  The
>      valid ranges are:
>  
> -        compatiblity: [10, 30]
> +        compatibility: [10, )
>          core: [31, )
>          es1: [10, 11]
>          es2: [20, )
> @@ -66,9 +66,8 @@ class exec_info():
>          self.es2 = es2
>  
>  functions = {
> -    # OpenGL 3.1 / GL_ARB_texture_buffer_object.  Mesa only exposes this
> -    # extension with core profile.
> -    "TexBuffer": exec_info(core=31, es2=31),
> +    # OpenGL 3.1 / GL_ARB_texture_buffer_object.
> +    "TexBuffer": exec_info(compatibility=20, core=31, es2=31),
>  
>      # OpenGL 3.2 / GL_OES_geometry_shader.
>      "FramebufferTexture": exec_info(core=32, es2=31),
> @@ -144,9 +143,8 @@ functions = {
>      # GetFloati_v also GL_ARB_shader_atomic_counters
>      # GetDoublei_v also GL_ARB_shader_atomic_counters
>  
> -    # OpenGL 4.3 / GL_ARB_texture_buffer_range.  Mesa can expose the extension
> -    # with OpenGL 3.1.
> -    "TexBufferRange": exec_info(core=31, es2=31),
> +    # OpenGL 4.3 / GL_ARB_texture_buffer_range.
> +    "TexBufferRange": exec_info(compatibility=20, core=31, es2=31),
>  
>      # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments.  Mesa can expose the
>      # extension with OpenGL 3.0.
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index 519d0a5..4d17393 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -178,9 +178,11 @@ intelInitExtensions(struct gl_context *ctx)
>        ctx->Extensions.ARB_pipeline_statistics_query = true;
>        ctx->Extensions.ARB_sample_shading = true;
>        ctx->Extensions.ARB_shading_language_420pack = true;
> -      ctx->Extensions.ARB_texture_buffer_object = true;
> -      ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
> -      ctx->Extensions.ARB_texture_buffer_range = true;
> +      if (ctx->API != API_OPENGL_COMPAT) {
> +         ctx->Extensions.ARB_texture_buffer_object = true;
> +         ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
> +         ctx->Extensions.ARB_texture_buffer_range = true;
> +      }
>        ctx->Extensions.ARB_texture_cube_map_array = true;
>        ctx->Extensions.ARB_texture_gather = true;
>        ctx->Extensions.ARB_texture_multisample = true;
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 8d8b637..5b66e7d 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -133,9 +133,9 @@ EXT(ARB_sync                                , ARB_sync
>  EXT(ARB_tessellation_shader                 , ARB_tessellation_shader                ,  x , GLC,  x ,  x , 2009)
>  EXT(ARB_texture_barrier                     , NV_texture_barrier                     , GLL, GLC,  x ,  x , 2014)
>  EXT(ARB_texture_border_clamp                , ARB_texture_border_clamp               , GLL,  x ,  x ,  x , 2000)
> -EXT(ARB_texture_buffer_object               , ARB_texture_buffer_object              ,  x , GLC,  x ,  x , 2008)
> -EXT(ARB_texture_buffer_object_rgb32         , ARB_texture_buffer_object_rgb32        ,  x , GLC,  x ,  x , 2009)
> -EXT(ARB_texture_buffer_range                , ARB_texture_buffer_range               ,  x , GLC,  x ,  x , 2012)
> +EXT(ARB_texture_buffer_object               , ARB_texture_buffer_object              , GLL, GLC,  x ,  x , 2008)
> +EXT(ARB_texture_buffer_object_rgb32         , ARB_texture_buffer_object_rgb32        , GLL, GLC,  x ,  x , 2009)
> +EXT(ARB_texture_buffer_range                , ARB_texture_buffer_range               , GLL, GLC,  x ,  x , 2012)
>  EXT(ARB_texture_compression                 , dummy_true                             , GLL,  x ,  x ,  x , 2000)
>  EXT(ARB_texture_compression_bptc            , ARB_texture_compression_bptc           , GLL, GLC,  x ,  x , 2010)
>  EXT(ARB_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  x , 2004)
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index e68a93b..ea8d932 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -309,8 +309,6 @@ static const int extra_GLSL_130_es3[] = {
>  };
>  
>  static const int extra_texture_buffer_object[] = {
> -   EXTRA_API_GL_CORE,
> -   EXTRA_VERSION_31,
>     EXT(ARB_texture_buffer_object),
>     EXTRA_END
>  };
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index acd5cd1..20ef6e4 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -442,6 +442,16 @@ descriptor=[
>  
>  # Enums in OpenGL and ES 3.1
>  { "apis": ["GL", "GL_CORE", "GLES31"], "params": [
> +# GL_ARB_texture_buffer_object / GL_OES_texture_buffer
> +  [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ],
> +  [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> +  [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ],
> +  [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> +  [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> +
> +# GL_ARB_texture_buffer_range
> +  [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ],
> +
>  # GL_ARB_shader_image_load_store / GLES 3.1
>    [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), extra_ARB_shader_image_load_store" ],
>    [ "MAX_VERTEX_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), extra_ARB_shader_image_load_store" ],
> @@ -602,16 +612,6 @@ descriptor=[
>  # GL_ARB_gpu_shader5 / GL_OES_geometry_shader
>    [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5_or_oes_geometry_shader" ],
>  
> -# GL_ARB_texture_buffer_object / GL_OES_texture_buffer
> -  [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ],
> -  [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> -  [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ],
> -  [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> -  [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ],
> -
> -# GL_ARB_texture_buffer_range
> -  [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ],
> -
>  # GL_OES_primitive_bounding_box
>    [ "PRIMITIVE_BOUNDING_BOX_ARB", "CONTEXT_FLOAT8(PrimitiveBoundingBox), extra_OES_primitive_bounding_box" ],
>  
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index 8c51180..d7183de 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -504,6 +504,10 @@ const struct function common_desktop_functions_possible[] = {
>     { "glDrawArraysInstanced", 31, -1 },
>     { "glDrawElementsInstanced", 31, -1 },
>     { "glPrimitiveRestartIndex", 31, -1 },
> +   { "glTexBuffer", 31, -1 },
> +
> +   /* GL_ARB_texture_buffer_range */
> +   { "glTexBufferRange", 43, -1 },
>  
>     /* GL_ARB_shader_objects */
>     { "glDeleteObjectARB", 31, -1 },
> @@ -1501,9 +1505,6 @@ const struct function gl_compatibility_functions_possible[] = {
>  };
>  
>  const struct function gl_core_functions_possible[] = {
> -   /* GL 3.1 */
> -   { "glTexBuffer", 31, -1 },
> -
>     /* GL 3.2 */
>     { "glFramebufferTexture", 32, -1 },
>  
> @@ -1808,7 +1809,6 @@ const struct function gl_core_functions_possible[] = {
>     { "glGetProgramResourceLocation", 43, -1 },
>     { "glGetProgramResourceLocationIndex", 43, -1 },
>  // { "glShaderStorageBlockBinding", 43, -1 },           // XXX: Add to xml
> -   { "glTexBufferRange", 43, -1 },
>  // { "glTextureBufferRangeEXT", 43, -1 },               // XXX: Add to xml
>     { "glTexStorage2DMultisample", 43, -1 },
>     { "glTexStorage3DMultisample", 43, -1 },
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index 039b933..4a0f61e 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -1287,8 +1287,8 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
>         * From the OpenGL 3.1 spec:
>         * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
>         */
> -      return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
> -         _mesa_has_OES_texture_buffer(ctx);
> +      return (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) ||
> +             _mesa_has_OES_texture_buffer(ctx);
>     case GL_TEXTURE_CUBE_MAP_ARRAY:
>        return _mesa_has_texture_cube_map_array(ctx);
>     }
> diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
> index 5d8dd8b..a96e454 100644
> --- a/src/mesa/state_tracker/st_context.c
> +++ b/src/mesa/state_tracker/st_context.c
> @@ -408,7 +408,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
>     /* GL limits and extensions */
>     st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
>     st_init_extensions(pipe->screen, &ctx->Const,
> -                      &ctx->Extensions, &st->options);
> +                      &ctx->Extensions, &st->options, ctx->API);
>  
>     if (st_have_perfmon(st)) {
>        ctx->Extensions.AMD_performance_monitor = GL_TRUE;
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index fa2d002..f21885f 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -578,7 +578,8 @@ get_max_samples_for_formats(struct pipe_screen *screen,
>  void st_init_extensions(struct pipe_screen *screen,
>                          struct gl_constants *consts,
>                          struct gl_extensions *extensions,
> -                        struct st_config_options *options)
> +                        struct st_config_options *options,
> +                        gl_api api)
>  {
>     unsigned i;
>     GLboolean *extension_table = (GLboolean *) extensions;
> @@ -1095,6 +1096,11 @@ void st_init_extensions(struct pipe_screen *screen,
>     consts->MinMapBufferAlignment =
>        screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
>  
> +   /* The OpenGL Compatibility profile requires arbitrary buffer swizzling. */
> +   if (api == API_OPENGL_COMPAT &&
> +       screen->get_param(screen, PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY))
> +      extensions->ARB_texture_buffer_object = GL_FALSE;
> +
>     if (extensions->ARB_texture_buffer_object) {
>        consts->MaxTextureBufferSize =
>           _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
> diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h
> index 951185c..7bf1aa8 100644
> --- a/src/mesa/state_tracker/st_extensions.h
> +++ b/src/mesa/state_tracker/st_extensions.h
> @@ -40,7 +40,8 @@ extern void st_init_limits(struct pipe_screen *screen,
>  extern void st_init_extensions(struct pipe_screen *screen,
>                                 struct gl_constants *consts,
>                                 struct gl_extensions *extensions,
> -                               struct st_config_options *options);
> +                               struct st_config_options *options,
> +                               gl_api api);
>  
>  
>  #endif /* ST_EXTENSIONS_H */
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index eebde62..dab987c 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -1168,7 +1168,7 @@ get_version(struct pipe_screen *screen,
>     _mesa_init_extensions(&extensions);
>  
>     st_init_limits(screen, &consts, &extensions);
> -   st_init_extensions(screen, &consts, &extensions, options);
> +   st_init_extensions(screen, &consts, &extensions, options, api);
>  
>     return _mesa_get_version(&extensions, &consts, api);
>  }
> -- 
> 2.7.4
>
> From bbcc2d52c00744324876f309227c1b8820afef60 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.olsak at amd.com>
> Date: Fri, 20 Oct 2017 04:08:29 +0200
> Subject: [PATCH 2/2] mesa: final changes to expose OpenGL 3.1 with
>  ARB_compatibility
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> ---
>  docs/relnotes/17.4.0.html              |  1 +
>  src/mesa/drivers/dri/common/dri_util.c |  7 -------
>  src/mesa/main/extensions_table.h       |  1 +
>  src/mesa/main/mtypes.h                 |  1 +
>  src/mesa/main/version.c                | 13 ++++++++-----
>  5 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/docs/relnotes/17.4.0.html b/docs/relnotes/17.4.0.html
> index f81b5bd..a419a74 100644
> --- a/docs/relnotes/17.4.0.html
> +++ b/docs/relnotes/17.4.0.html
> @@ -45,6 +45,7 @@ Note: some of the new features are only available with certain drivers.
>  
>  <ul>
>  <li>Disk shader cache support for i965 when MESA_GLSL_CACHE_DISABLE environment variable is set to "0" or "false"</li>
> +<li>OpenGL 3.1 with ARB_compatibility is supported on many gallium drivers (including radeonsi).
>  </ul>
>  
>  <h2>Bug fixes</h2>
> diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
> index 1cff0dd..2af18ce 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -362,13 +362,6 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
>  	}
>      }
>  
> -    /* Mesa does not support the GL_ARB_compatibilty extension or the
> -     * compatibility profile.  This means that we treat a API_OPENGL_COMPAT 3.1 as
> -     * API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+.
> -     */
> -    if (mesa_api == API_OPENGL_COMPAT && major_version == 3 && minor_version == 1)
> -       mesa_api = API_OPENGL_CORE;
> -
>      if (mesa_api == API_OPENGL_COMPAT
>          && ((major_version > 3)
>              || (major_version == 3 && minor_version >= 2))) {
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 5b66e7d..2fb668e 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -40,6 +40,7 @@ EXT(ARB_clear_buffer_object                 , dummy_true
>  EXT(ARB_clear_texture                       , ARB_clear_texture                      , GLL, GLC,  x ,  x , 2013)
>  EXT(ARB_clip_control                        , ARB_clip_control                       , GLL, GLC,  x ,  x , 2014)
>  EXT(ARB_color_buffer_float                  , ARB_color_buffer_float                 , GLL, GLC,  x ,  x , 2004)
> +EXT(ARB_compatibility                       , ARB_compatibility                      , GLL,  x ,  x ,  x , 2009)
>  EXT(ARB_compressed_texture_pixel_storage    , dummy_true                             , GLL, GLC,  x ,  x , 2011)
>  EXT(ARB_compute_shader                      , ARB_compute_shader                     , GLL, GLC,  x ,  x , 2012)
>  EXT(ARB_compute_variable_group_size         , ARB_compute_variable_group_size        , GLL, GLC,  x ,  x , 2013)
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 2acf64e..fd5306c 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4026,6 +4026,7 @@ struct gl_extensions
>     GLboolean ARB_clear_texture;
>     GLboolean ARB_clip_control;
>     GLboolean ARB_color_buffer_float;
> +   GLboolean ARB_compatibility;
>     GLboolean ARB_compute_shader;
>     GLboolean ARB_compute_variable_group_size;
>     GLboolean ARB_conditional_render_inverted;
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 90c5c5f..06b8e4d 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -579,11 +579,11 @@ _mesa_get_version(const struct gl_extensions *extensions,
>  {
>     switch (api) {
>     case API_OPENGL_COMPAT:
> -      /* Disable GLSL 1.40 and later for legacy contexts.
> -       * This disallows creation of the GL 3.1 compatibility context. */
> +      /* Disable higher GLSL versions for legacy contexts.
> +       * This disallows creation of higher compatibility contexts. */
>        if (!consts->AllowHigherCompatVersion) {
> -         if (consts->GLSLVersion > 130) {
> -            consts->GLSLVersion = 130;
> +         if (consts->GLSLVersion > 140) {
> +            consts->GLSLVersion = 140;
>           }
>        }
>        /* fall through */
> @@ -611,10 +611,13 @@ _mesa_compute_version(struct gl_context *ctx)
>     ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
>     ctx->Extensions.Version = ctx->Version;
>  
> +   if (ctx->API == API_OPENGL_COMPAT && ctx->Version >= 31)
> +      ctx->Extensions.ARB_compatibility = GL_TRUE;
> +
>     /* Make sure that the GLSL version lines up with the GL version. In some
>      * cases it can be too high, e.g. if an extension is missing.
>      */
> -   if (ctx->API == API_OPENGL_CORE) {
> +   if (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) {
>        switch (ctx->Version) {
>        case 31:
>           ctx->Const.GLSLVersion = 140;
> -- 
> 2.7.4


More information about the mesa-dev mailing list