diff options
author | Neil Roberts <[email protected]> | 2020-06-18 15:48:12 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-22 12:41:56 +0000 |
commit | 1fc346d2bec83adff7e4ff05b28e8855c54eb603 (patch) | |
tree | b96e811c50151cd6585a6b921f6cb5103f6a45d9 /src/mesa | |
parent | bb5fc90135f682fedfce4cb7712fa418e6b4b95d (diff) |
mesa: Add PrimitiveRestartFixedIndex to gl_constants
This is a fine-grained subset of the NV_primitive_restart extension that
only uses the fixed indices provided by GLES 3.0. There’s no public
extension to advertise this behaviour so the bool is added to
gl_constants instead of gl_extensions.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5559>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_extensions.c | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 7 | ||||
-rw-r--r-- | src/mesa/main/version.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 6 |
4 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index 276f7aa3d07..ce2989fa86b 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -389,4 +389,6 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.ANGLE_texture_compression_dxt = true; ctx->Extensions.EXT_demote_to_helper_invocation = true; + + ctx->Const.PrimitiveRestartFixedIndex = true; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index eff6f496eb6..b74f81ee06d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4180,6 +4180,13 @@ struct gl_constants /** Whether to allow the fast path for frequently updated VAOs. */ bool AllowDynamicVAOFastPath; + /** Whether the driver can support primitive restart with a fixed index. + * This is essentially a subset of NV_primitive_restart with enough support + * to be able to enable GLES 3.1. Some hardware can support this but not the + * full NV extension with arbitrary restart indices. + */ + bool PrimitiveRestartFixedIndex; + /** GL_ARB_gl_spirv */ struct spirv_supported_capabilities SpirVCapabilities; diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 7e51bb53439..3517bfe8f64 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -524,7 +524,8 @@ compute_version_es2(const struct gl_extensions *extensions, extensions->ARB_draw_instanced && extensions->ARB_uniform_buffer_object && extensions->EXT_texture_snorm && - extensions->NV_primitive_restart && + (extensions->NV_primitive_restart || + consts->PrimitiveRestartFixedIndex) && extensions->OES_depth_texture_cube_map && extensions->EXT_texture_type_2_10_10_10_REV); const bool es31_compute_shader = diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 461d197a041..0efd16bfd4a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1132,6 +1132,9 @@ void st_init_extensions(struct pipe_screen *screen, consts->AllowGLSLCrossStageInterpolationMismatch = options->allow_glsl_cross_stage_interpolation_mismatch; + consts->PrimitiveRestartFixedIndex = + screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX); + /* 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: @@ -1505,7 +1508,8 @@ void st_init_extensions(struct pipe_screen *screen, */ if (GLSLVersion >= 130 && extensions->ARB_uniform_buffer_object && - extensions->NV_primitive_restart && + (extensions->NV_primitive_restart || + consts->PrimitiveRestartFixedIndex) && screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS) >= 16 && /* Requirements for ETC2 emulation. */ |