Commit 1fc346d2 authored by Neil Roberts's avatar Neil Roberts Committed by Marge Bot

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's avatarEric Anholt <eric@anholt.net>
Reviewed by: Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <!5559>
parent bb5fc901
......@@ -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;
}
......@@ -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;
......
......@@ -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 =
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment