[Mesa-dev] [PATCH] mesa: Implement GL_ARB_polygon_offset_clamp

Ilia Mirkin imirkin at alum.mit.edu
Thu Aug 24 21:43:32 UTC 2017


My personal inclination would have been the inverse (i.e. alias
glPolygonOffsetClampEXT to glPolygonOffsetClamp), but ... you've been
through enough silly revisions, and I don't sufficiently care.

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Thu, Aug 24, 2017 at 5:00 PM, Adam Jackson <ajax at redhat.com> wrote:
> Semantically identical to the EXT version (whose string is still valid
> for GLES), so rename the bit but expose both extension strings.
> (Suggested by Ilia Mirkin and Ian Romanick.)
>
> v3: Fix the entrypoint alias in GL4x.xml (Ilia)
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  docs/features.txt                            | 2 +-
>  docs/relnotes/17.3.0.html                    | 1 +
>  src/mapi/glapi/gen/GL4x.xml                  | 9 +++++++++
>  src/mesa/drivers/dri/i965/intel_extensions.c | 2 +-
>  src/mesa/main/dlist.c                        | 2 +-
>  src/mesa/main/extensions_table.h             | 3 ++-
>  src/mesa/main/get.c                          | 2 +-
>  src/mesa/main/get_hash_params.py             | 4 ++--
>  src/mesa/main/mtypes.h                       | 2 +-
>  src/mesa/main/polygon.c                      | 9 +++------
>  src/mesa/main/version.c                      | 2 +-
>  src/mesa/state_tracker/st_extensions.c       | 2 +-
>  12 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/docs/features.txt b/docs/features.txt
> index 3f91c2daae..0435ce61ff 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -226,7 +226,7 @@ GL 4.6, GLSL 4.60
>    GL_ARB_gl_spirv                                       in progress (Nicolai Hähnle, Ian Romanick)
>    GL_ARB_indirect_parameters                            DONE (nvc0, radeonsi)
>    GL_ARB_pipeline_statistics_query                      DONE (i965, nvc0, radeonsi, softpipe, swr)
> -  GL_ARB_polygon_offset_clamp                           not started
> +  GL_ARB_polygon_offset_clamp                           DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, swr)
>    GL_ARB_shader_atomic_counter_ops                      DONE (i965/gen7+, nvc0, radeonsi, softpipe)
>    GL_ARB_shader_draw_parameters                         DONE (i965, nvc0, radeonsi)
>    GL_ARB_shader_group_vote                              DONE (i965, nvc0, radeonsi)
> diff --git a/docs/relnotes/17.3.0.html b/docs/relnotes/17.3.0.html
> index 8da43f22f0..4a74284632 100644
> --- a/docs/relnotes/17.3.0.html
> +++ b/docs/relnotes/17.3.0.html
> @@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.
>  </p>
>
>  <ul>
> +<li>GL_ARB_polygon_offset_clamp on i965, nv50, nvc0, r600, radeonsi, llvmpipe, swr</li>
>  <li>GL_ARB_transform_feedback_overflow_query on radeonsi</li>
>  <li>GL_ARB_texture_filter_anisotropic on i965, nv50, nvc0, r600, radeonsi</li>
>  <li>GL_EXT_memory_object on radeonsi</li>
> diff --git a/src/mapi/glapi/gen/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml
> index e958ee70c7..88dba5cd71 100644
> --- a/src/mapi/glapi/gen/GL4x.xml
> +++ b/src/mapi/glapi/gen/GL4x.xml
> @@ -66,4 +66,13 @@
>    </function>
>  </category>
>
> +<category name="4.6">
> +  <function name="PolygonOffsetClamp" alias="PolygonOffsetClampEXT">
> +    <param name="factor" type="GLfloat"/>
> +    <param name="units" type="GLfloat"/>
> +    <param name="clamp" type="GLfloat"/>
> +  </function>
> +  <enum name="POLYGON_OFFSET_CLAMP" value="0x8E1B"/>
> +</category>
> +
>  </OpenGLAPI>
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index c3cd8004a1..deacd0d9df 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -66,6 +66,7 @@ intelInitExtensions(struct gl_context *ctx)
>     ctx->Extensions.ARB_occlusion_query = true;
>     ctx->Extensions.ARB_occlusion_query2 = true;
>     ctx->Extensions.ARB_point_sprite = true;
> +   ctx->Extensions.ARB_polygon_offset_clamp = true;
>     ctx->Extensions.ARB_seamless_cube_map = true;
>     ctx->Extensions.ARB_shader_bit_encoding = true;
>     ctx->Extensions.ARB_shader_draw_parameters = true;
> @@ -100,7 +101,6 @@ intelInitExtensions(struct gl_context *ctx)
>     ctx->Extensions.EXT_packed_float = true;
>     ctx->Extensions.EXT_pixel_buffer_object = true;
>     ctx->Extensions.EXT_point_parameters = true;
> -   ctx->Extensions.EXT_polygon_offset_clamp = true;
>     ctx->Extensions.EXT_provoking_vertex = true;
>     ctx->Extensions.EXT_stencil_two_side = true;
>     ctx->Extensions.EXT_texture_array = true;
> diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
> index 208471aca7..b7d1406eb7 100644
> --- a/src/mesa/main/dlist.c
> +++ b/src/mesa/main/dlist.c
> @@ -10062,7 +10062,7 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
>     SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
>     SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
>
> -   /* GL_EXT_polygon_offset_clamp */
> +   /* GL_{ARB,EXT}_polygon_offset_clamp */
>     SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
>
>     /* GL_EXT_window_rectangles */
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index d096260891..9475c1b69d 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -94,6 +94,7 @@ EXT(ARB_pipeline_statistics_query           , ARB_pipeline_statistics_query
>  EXT(ARB_pixel_buffer_object                 , EXT_pixel_buffer_object                , GLL, GLC,  x ,  x , 2004)
>  EXT(ARB_point_parameters                    , EXT_point_parameters                   , GLL,  x ,  x ,  x , 1997)
>  EXT(ARB_point_sprite                        , ARB_point_sprite                       , GLL, GLC,  x ,  x , 2003)
> +EXT(ARB_polygon_offset_clamp                , ARB_polygon_offset_clamp               , GLL, GLC,  x ,  x , 2017)
>  EXT(ARB_post_depth_coverage                 , ARB_post_depth_coverage                ,  x , GLC,  x ,  x,  2015)
>  EXT(ARB_program_interface_query             , dummy_true                             , GLL, GLC,  x ,  x , 2012)
>  EXT(ARB_provoking_vertex                    , EXT_provoking_vertex                   , GLL, GLC,  x ,  x , 2009)
> @@ -236,7 +237,7 @@ EXT(EXT_packed_pixels                       , dummy_true
>  EXT(EXT_pixel_buffer_object                 , EXT_pixel_buffer_object                , GLL, GLC,  x ,  x , 2004)
>  EXT(EXT_point_parameters                    , EXT_point_parameters                   , GLL,  x ,  x ,  x , 1997)
>  EXT(EXT_polygon_offset                      , dummy_true                             , GLL,  x ,  x ,  x , 1995)
> -EXT(EXT_polygon_offset_clamp                , EXT_polygon_offset_clamp               , GLL, GLC, ES1, ES2, 2014)
> +EXT(EXT_polygon_offset_clamp                , ARB_polygon_offset_clamp               , GLL, GLC, ES1, ES2, 2014)
>  EXT(EXT_primitive_bounding_box              , OES_primitive_bounding_box             ,  x ,  x ,  x ,  31, 2014)
>  EXT(EXT_provoking_vertex                    , EXT_provoking_vertex                   , GLL, GLC,  x ,  x , 2009)
>  EXT(EXT_read_format_bgra                    , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 8c3958b096..4c4a4a79c0 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -489,7 +489,7 @@ EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
>  EXTRA_EXT(INTEL_performance_query);
>  EXTRA_EXT(ARB_explicit_uniform_location);
>  EXTRA_EXT(ARB_clip_control);
> -EXTRA_EXT(EXT_polygon_offset_clamp);
> +EXTRA_EXT(ARB_polygon_offset_clamp);
>  EXTRA_EXT(ARB_framebuffer_no_attachments);
>  EXTRA_EXT(ARB_tessellation_shader);
>  EXTRA_EXT(ARB_shader_storage_buffer_object);
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 9d67ca49f8..acd5cd1f01 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -136,8 +136,8 @@ descriptor=[
>    [ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ],
>    [ "DEBUG_GROUP_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
>
> -# GL_EXT_polygon_offset_clamp
> -  [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_EXT_polygon_offset_clamp" ],
> +# GL_ARB_polygon_offset_clamp / GL_EXT_polygon_offset_clamp
> +  [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_ARB_polygon_offset_clamp" ],
>  ]},
>
>  # Enums in OpenGL and GLES1
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 99b6dfa611..19135673dc 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4055,6 +4055,7 @@ struct gl_extensions
>     GLboolean ARB_occlusion_query2;
>     GLboolean ARB_pipeline_statistics_query;
>     GLboolean ARB_point_sprite;
> +   GLboolean ARB_polygon_offset_clamp;
>     GLboolean ARB_post_depth_coverage;
>     GLboolean ARB_query_buffer_object;
>     GLboolean ARB_robust_buffer_access_behavior;
> @@ -4133,7 +4134,6 @@ struct gl_extensions
>     GLboolean EXT_packed_float;
>     GLboolean EXT_pixel_buffer_object;
>     GLboolean EXT_point_parameters;
> -   GLboolean EXT_polygon_offset_clamp;
>     GLboolean EXT_provoking_vertex;
>     GLboolean EXT_shader_integer_mix;
>     GLboolean EXT_shader_samples_identical;
> diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
> index 44d943e930..effd4d27fb 100644
> --- a/src/mesa/main/polygon.c
> +++ b/src/mesa/main/polygon.c
> @@ -328,7 +328,6 @@ _mesa_PolygonOffset( GLfloat factor, GLfloat units )
>     _mesa_polygon_offset_clamp(ctx, factor, units, 0.0);
>  }
>
> -
>  void GLAPIENTRY
>  _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
>  {
> @@ -342,20 +341,18 @@ _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp )
>  {
>     GET_CURRENT_CONTEXT(ctx);
>
> -   if (!ctx->Extensions.EXT_polygon_offset_clamp) {
> +   if (!ctx->Extensions.ARB_polygon_offset_clamp) {
>        _mesa_error(ctx, GL_INVALID_OPERATION,
> -                  "unsupported function (glPolygonOffsetClampEXT) called");
> +                  "unsupported function (%s) called", "glPolygonOffsetClamp");
>        return;
>     }
>
>     if (MESA_VERBOSE&VERBOSE_API)
> -      _mesa_debug(ctx, "glPolygonOffsetClampEXT %f %f %f\n", factor, units, clamp);
> +      _mesa_debug(ctx, "glPolygonOffsetClamp %f %f %f\n", factor, units, clamp);
>
>     _mesa_polygon_offset_clamp(ctx, factor, units, clamp);
>  }
>
> -
> -
>  /**********************************************************************/
>  /** \name Initialization */
>  /*@{*/
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 59e7b89ff6..90c5c5f84e 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -391,7 +391,7 @@ compute_version(const struct gl_extensions *extensions,
>                           /* extensions->ARB_spirv_extensions */ 0 &&
>                           extensions->ARB_indirect_parameters &&
>                           extensions->ARB_pipeline_statistics_query &&
> -                         /* extensions->ARB_polygon_offset_clamp */ 0 &&
> +                         extensions->ARB_polygon_offset_clamp &&
>                           extensions->ARB_shader_atomic_counter_ops &&
>                           extensions->ARB_shader_draw_parameters &&
>                           extensions->ARB_shader_group_vote &&
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 9a22e54675..8785903251 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -601,6 +601,7 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ARB_occlusion_query2),             PIPE_CAP_OCCLUSION_QUERY                  },
>        { o(ARB_pipeline_statistics_query),    PIPE_CAP_QUERY_PIPELINE_STATISTICS        },
>        { o(ARB_point_sprite),                 PIPE_CAP_POINT_SPRITE                     },
> +      { o(ARB_polygon_offset_clamp),         PIPE_CAP_POLYGON_OFFSET_CLAMP             },
>        { o(ARB_post_depth_coverage),          PIPE_CAP_POST_DEPTH_COVERAGE              },
>        { o(ARB_query_buffer_object),          PIPE_CAP_QUERY_BUFFER_OBJECT              },
>        { o(ARB_robust_buffer_access_behavior), PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR   },
> @@ -633,7 +634,6 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(EXT_blend_equation_separate),      PIPE_CAP_BLEND_EQUATION_SEPARATE          },
>        { o(EXT_depth_bounds_test),            PIPE_CAP_DEPTH_BOUNDS_TEST                },
>        { o(EXT_draw_buffers2),                PIPE_CAP_INDEP_BLEND_ENABLE               },
> -      { o(EXT_polygon_offset_clamp),         PIPE_CAP_POLYGON_OFFSET_CLAMP             },
>        { o(EXT_memory_object),                PIPE_CAP_MEMOBJ                           },
>        { o(EXT_memory_object_fd),             PIPE_CAP_MEMOBJ                           },
>        { o(EXT_stencil_two_side),             PIPE_CAP_TWO_SIDED_STENCIL                },
> --
> 2.13.5
>


More information about the mesa-dev mailing list