[Mesa-dev] [PATCH 3/3] mesa: Implement GL_ARB_polygon_offset_clamp
Ilia Mirkin
imirkin at alum.mit.edu
Tue Aug 8 16:04:28 UTC 2017
IMHO this should be implemented differently. There is no change of
functionality vis-a-vis the EXT version, just a name change. So a
single enable flag should be preserved, and a single function
entrypoint. I'd rename it to the plain name, and make the EXT one an
alias of the non-suffixed one.
Cheers,
-ilia
On Tue, Aug 8, 2017 at 11:52 AM, Adam Jackson <ajax at redhat.com> wrote:
> Identical to the EXT version.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> docs/features.txt | 2 +-
> src/mapi/glapi/gen/GL4x.xml | 9 +++++++++
> src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
> src/mesa/main/dlist.c | 20 ++++++++++++++++++++
> src/mesa/main/extensions_table.h | 1 +
> src/mesa/main/get_hash_params.py | 2 +-
> src/mesa/main/mtypes.h | 1 +
> src/mesa/main/polygon.c | 18 +++++++++++++++++-
> src/mesa/main/polygon.h | 3 +++
> src/mesa/main/version.c | 2 +-
> src/mesa/state_tracker/st_extensions.c | 1 +
> 11 files changed, 56 insertions(+), 4 deletions(-)
>
> diff --git a/docs/features.txt b/docs/features.txt
> index b9cbd8818f..5de50d485c 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/src/mapi/glapi/gen/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml
> index e958ee70c7..9e7685e5fd 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">
> + <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..c94c1b8309 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;
> diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
> index 208471aca7..7875f20ba7 100644
> --- a/src/mesa/main/dlist.c
> +++ b/src/mesa/main/dlist.c
> @@ -3521,6 +3521,23 @@ save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
> }
>
> static void GLAPIENTRY
> +save_PolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp)
> +{
> + GET_CURRENT_CONTEXT(ctx);
> + Node *n;
> + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
> + n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
> + if (n) {
> + n[1].f = factor;
> + n[2].f = units;
> + n[3].f = clamp;
> + }
> + if (ctx->ExecuteFlag) {
> + CALL_PolygonOffsetClamp(ctx->Exec, (factor, units, clamp));
> + }
> +}
> +
> +static void GLAPIENTRY
> save_PopAttrib(void)
> {
> GET_CURRENT_CONTEXT(ctx);
> @@ -10067,6 +10084,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
>
> /* GL_EXT_window_rectangles */
> SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
> +
> + /* GL_ARB_polygon_offset_clamp */
> + SET_PolygonOffsetClamp(table, save_PolygonOffsetClamp);
> }
>
>
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index d096260891..6f2310abab 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)
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 9d67ca49f8..761ce0e0c8 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -136,7 +136,7 @@ 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
> +# GL_ARB_polygon_offset_clamp / GL_EXT_polygon_offset_clamp
> [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_EXT_polygon_offset_clamp" ],
> ]},
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 3caadcfceb..15c260ea0d 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4046,6 +4046,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;
> diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
> index 44d943e930..9497f2bcd5 100644
> --- a/src/mesa/main/polygon.c
> +++ b/src/mesa/main/polygon.c
> @@ -344,7 +344,7 @@ _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp )
>
> if (!ctx->Extensions.EXT_polygon_offset_clamp) {
> _mesa_error(ctx, GL_INVALID_OPERATION,
> - "unsupported function (glPolygonOffsetClampEXT) called");
> + "unsupported function (%s) called", "glPolygonOffsetClampEXT");
> return;
> }
>
> @@ -354,6 +354,22 @@ _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp )
> _mesa_polygon_offset_clamp(ctx, factor, units, clamp);
> }
>
> +void GLAPIENTRY
> +_mesa_PolygonOffsetClamp( GLfloat factor, GLfloat units, GLfloat clamp )
> +{
> + GET_CURRENT_CONTEXT(ctx);
> +
> + if (!ctx->Extensions.EXT_polygon_offset_clamp) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "unsupported function (%s) called", "glPolygonOffsetClamp");
> + return;
> + }
> +
> + if (MESA_VERBOSE&VERBOSE_API)
> + _mesa_debug(ctx, "glPolygonOffsetClamp %f %f %f\n", factor, units, clamp);
> +
> + _mesa_polygon_offset_clamp(ctx, factor, units, clamp);
> +}
>
>
> /**********************************************************************/
> diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h
> index 1b8186892a..70586416cb 100644
> --- a/src/mesa/main/polygon.h
> +++ b/src/mesa/main/polygon.h
> @@ -64,6 +64,9 @@ extern void GLAPIENTRY
> _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
>
> extern void GLAPIENTRY
> +_mesa_PolygonOffsetClamp( GLfloat factor, GLfloat units, GLfloat clamp );
> +
> +extern void GLAPIENTRY
> _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp );
>
> extern void GLAPIENTRY
> 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 6dc9c779dd..c9e199bfb7 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 },
> --
> 2.13.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list