mesa: support GL_NV_representative_fragment test

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37081>
This commit is contained in:
Mike Blumenkrantz 2025-08-29 07:09:41 -04:00 committed by Marge Bot
parent 57d273b55b
commit 34641b44c6
11 changed files with 32 additions and 0 deletions

View file

@ -653,6 +653,7 @@ Capability about the features and limits of the driver/GPU.
* ``pipe_caps.shader_subgroup_quad_all_stages``: Whether shader subgroup quad operations are supported by shader stages other than fragment shader.
* ``pipe_caps.multiview``: Whether multiview rendering of array textures is supported. A return of ``1`` indicates support for OVR_multiview, and ``2`` additionally supports OVR_multiview2.
* ``pipe_caps.call_finalize_nir_in_linker``: Whether ``pipe_screen::finalize_nir`` can be called in the GLSL linker before the NIR is stored in the shader cache. It's always called again after st/mesa adds code for shader variants. It must be 1 if the driver wants to report compile failures to the GLSL linker. It must be 0 if two consecutive ``finalize_nir`` calls on the same shader can break it, or if ``finalize_nir`` can't handle NIR that isn't fully lowered for the driver, or if ``finalize_nir`` breaks passes that st/mesa runs after it. Setting it to 1 is generally safe for drivers that expose nir_io_has_intrinsics and that don't enable any optional shader variants in st/mesa. Since it's difficult to support, any future refactoring can change it to 0.
* ``pipe_caps.representative_fragment_test``: Support for GL_NV_representative_fragment_test.
* ``pipe_caps.min_line_width``: The minimum width of a regular line.
* ``pipe_caps.min_line_width_aa``: The minimum width of a smoothed line.
* ``pipe_caps.max_line_width``: The maximum width of a regular line.

View file

@ -1043,6 +1043,7 @@ struct pipe_caps {
bool shader_subgroup_quad_all_stages;
bool call_finalize_nir_in_linker;
bool mesh_shader;
bool representative_fragment_test;
int accelerated;
int min_texel_offset;

View file

@ -203,6 +203,8 @@ struct pipe_rasterizer_state
*/
unsigned clip_plane_enable:PIPE_MAX_CLIP_PLANES;
unsigned representative_fragment_test:1;
unsigned line_stipple_factor:8; /**< [1..256] actually */
unsigned line_stipple_pattern:16;

View file

@ -9310,6 +9310,10 @@
<function name="ResolveDepthValuesNV" es2="3.1" alias="EvaluateDepthValuesARB"/>
</category>
<category name="GL_NV_representative_fragment_test">
<enum name="REPRESENTATIVE_FRAGMENT_TEST_NV" value="0x937F"/>
</category>
<category name="GL_SUN_convolution_border_modes" number="182">
<enum name="WRAP_BORDER_SUN" value="0x81D4"/>
</category>

View file

@ -288,6 +288,7 @@ struct gl_extensions
GLboolean NV_viewport_array2;
GLboolean NV_viewport_swizzle;
GLboolean NV_timeline_semaphore;
GLboolean NV_representative_fragment_test;
GLboolean NVX_gpu_memory_info;
GLboolean TDFX_texture_compression_FXT1;
GLboolean OES_EGL_image;

View file

@ -616,6 +616,15 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
ctx->ConservativeRasterization = state;
break;
case GL_REPRESENTATIVE_FRAGMENT_TEST_NV:
if (!_mesa_has_NV_representative_fragment_test(ctx))
goto invalid_enum_error;
if (ctx->RepresentativeFragmentTest == state)
return;
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
ctx->RepresentativeFragmentTest = state;
break;
case GL_COLOR_LOGIC_OP:
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
goto invalid_enum_error;
@ -1983,6 +1992,11 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->ConservativeRasterization;
case GL_REPRESENTATIVE_FRAGMENT_TEST_NV:
if (!_mesa_has_NV_representative_fragment_test(ctx))
goto invalid_enum_error;
return ctx->RepresentativeFragmentTest;
case GL_TILE_RASTER_ORDER_FIXED_MESA:
if (!_mesa_has_MESA_tile_raster_order(ctx))
goto invalid_enum_error;

View file

@ -434,6 +434,7 @@ EXT(NV_read_buffer , dummy_true
EXT(NV_read_depth , dummy_true , x , x , x , ES2, 2011)
EXT(NV_read_depth_stencil , dummy_true , x , x , x , ES2, 2011)
EXT(NV_read_stencil , dummy_true , x , x , x , ES2, 2011)
EXT(NV_representative_fragment_test , NV_representative_fragment_test , GLL, GLC, x , 32, 2019)
EXT(NV_sample_locations , ARB_sample_locations , GLL, GLC, x , ES2, 2015)
EXT(NV_shader_atomic_float , NV_shader_atomic_float , GLL, GLC, x , x , 2012)
EXT(NV_shader_atomic_int64 , NV_shader_atomic_int64 , GLL, GLC, x , x , 2014)

View file

@ -895,6 +895,9 @@ descriptor=[
[ "EDGE_FLAG_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Stride), NO_EXTRA" ],
[ "EDGE_FLAG_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ],
# GL_NV_representative_fragment_test
[ "REPRESENTATIVE_FRAGMENT_TEST_NV", "CONTEXT_BOOL(RepresentativeFragmentTest), NO_EXTRA" ],
# GL_ARB_texture_compression
[ "TEXTURE_COMPRESSION_HINT_ARB", "CONTEXT_ENUM16(Hint.TextureCompression), NO_EXTRA" ],

View file

@ -3589,6 +3589,8 @@ struct gl_context
GLfloat ConservativeRasterDilate;
GLenum16 ConservativeRasterMode;
GLboolean RepresentativeFragmentTest; /**< GL_REPRESENTATIVE_FRAGMENT_TEST_NV */
GLboolean IntelBlackholeRender; /**< GL_INTEL_blackhole_render */
/** Does glVertexAttrib(0) alias glVertex()? */

View file

@ -165,6 +165,8 @@ st_update_rasterizer(struct st_context *st)
raster->poly_stipple_enable = ctx->Polygon.StippleFlag;
raster->representative_fragment_test = ctx->RepresentativeFragmentTest;
/* Multisampling disables point, line, and polygon smoothing.
*
* GL_ARB_multisample says:

View file

@ -1146,6 +1146,7 @@ void st_init_extensions(struct pipe_screen *screen,
EXT_CAP(NV_conditional_render, conditional_render);
EXT_CAP(NV_fill_rectangle, polygon_mode_fill_rectangle);
EXT_CAP(NV_primitive_restart, primitive_restart);
EXT_CAP(NV_representative_fragment_test, representative_fragment_test);
EXT_CAP(NV_shader_atomic_float, image_atomic_float_add);
EXT_CAP(NV_shader_atomic_int64, shader_atomic_int64);
EXT_CAP(NV_texture_barrier, texture_barrier);