diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 9d0eb3a8a6..2ac2382cb6 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -249,6 +249,10 @@ struct st_config_options boolean allow_higher_compat_version; boolean glsl_zero_init; boolean force_glsl_abs_sqrt; + boolean allow_minus_one_index_uniform; + boolean allow_extended_primitive_type; + boolean allow_gl_extensions_in_core; + boolean allow_relaxed_vbo_validation; unsigned char config_options_sha1[20]; }; diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 998e8ef8cb..e1ac604c32 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -75,6 +75,10 @@ const __DRIconfigOptionsExtension gallium_config_options = { DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false") DRI_CONF_FORCE_GLSL_VERSION(0) DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false") + DRI_CONF_ALLOW_RELAXED_VBO_VALIDATION("false") + DRI_CONF_ALLOW_MINUS_ONE_INDEX_UNIFORM("false") + DRI_CONF_ALLOW_EXTENDED_PRIMITIVE_TYPE("false") + DRI_CONF_ALLOW_GL_EXTENSIONS_IN_CORE("false") DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false") DRI_CONF_FORCE_GLSL_ABS_SQRT("false") DRI_CONF_SECTION_END @@ -113,6 +117,14 @@ dri_fill_st_options(struct dri_screen *screen) options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init"); options->force_glsl_abs_sqrt = driQueryOptionb(optionCache, "force_glsl_abs_sqrt"); + options->allow_minus_one_index_uniform = + driQueryOptionb(optionCache, "allow_minus_one_index_uniform"); + options->allow_extended_primitive_type = + driQueryOptionb(optionCache, "allow_extended_primitive_type"); + options->allow_gl_extensions_in_core = + driQueryOptionb(optionCache, "allow_gl_extensions_in_core"); + options->allow_relaxed_vbo_validation = + driQueryOptionb(optionCache, "allow_relaxed_vbo_validation"); driComputeOptionsSha1(optionCache, options->config_options_sha1); } diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index cd4f0252b9..85b1eeace1 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -120,6 +120,27 @@ DRI_CONF_OPT_BEGIN_B(allow_higher_compat_version, def) \ DRI_CONF_DESC(en,gettext("Allow a higher compat profile (version 3.1+) for apps that request it")) \ DRI_CONF_OPT_END +#define DRI_CONF_ALLOW_RELAXED_VBO_VALIDATION(def)\ +DRI_CONF_OPT_BEGIN_B(allow_relaxed_vbo_validation,def) \ +DRI_CONF_DESC(en,gettext("Allow a uncompatible VBO validation against core profile")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_ALLOW_MINUS_ONE_INDEX_UNIFORM(def)\ +DRI_CONF_OPT_BEGIN_B(allow_minus_one_index_uniform,def) \ +DRI_CONF_DESC(en,gettext("Bypass mesa_Uniform when location is -1")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_ALLOW_EXTENDED_PRIMITIVE_TYPE(def)\ +DRI_CONF_OPT_BEGIN_B(allow_extended_primitive_type,def) \ +DRI_CONF_DESC(en,gettext("In core profile allow glDrawArray with primitives > GL_TRIANGLES")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_ALLOW_GL_EXTENSIONS_IN_CORE(def)\ +DRI_CONF_OPT_BEGIN_B(allow_gl_extensions_in_core,def) \ +DRI_CONF_DESC(en,gettext("In core profile allow glGetString(GL_EXTENSIONS)")) \ +DRI_CONF_OPT_END + + #define DRI_CONF_FORCE_GLSL_ABS_SQRT(def) \ DRI_CONF_OPT_BEGIN_B(force_glsl_abs_sqrt, def) \ DRI_CONF_DESC(en,gettext("Force computing the absolute value for sqrt() and inversesqrt()")) \ diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 5055dd76a8..f1ecf3c271 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -934,6 +934,18 @@ brw_process_driconf_options(struct brw_context *brw) ctx->Const.AllowGLSLExtensionDirectiveMidShader = driQueryOptionb(options, "allow_glsl_extension_directive_midshader"); + ctx->Const.AllowMinusOneIndexUniform = + driQueryOptionb(options, "allow_minus_one_index_uniform"); + + ctx->Const.AllowExtendedPrimitiveType = + driQueryOptionb(options, "allow_extended_primitive_type"); + + ctx->Const.AllowGLExtensionsInCore = + driQueryOptionb(options, "allow_gl_extensions_in_core"); + + ctx->Const.AllowRelaxedVboValidation = + driQueryOptionb(options, "allow_relaxed_vbo_validation"); + ctx->Const.AllowHigherCompatVersion = driQueryOptionb(options, "allow_higher_compat_version"); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 371772867e..d282de9bce 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -91,6 +91,10 @@ DRI_CONF_BEGIN DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false") DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false") DRI_CONF_FORCE_GLSL_ABS_SQRT("false") + DRI_CONF_ALLOW_RELAXED_VBO_VALIDATION("false") + DRI_CONF_ALLOW_MINUS_ONE_INDEX_UNIFORM("false") + DRI_CONF_ALLOW_EXTENDED_PRIMITIVE_TYPE("false") + DRI_CONF_ALLOW_GL_EXTENSIONS_IN_CORE("false") DRI_CONF_OPT_BEGIN_B(shader_precompile, "true") DRI_CONF_DESC(en, "Perform code generation at shader link time.") diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index cbb2361552..9c6b699a50 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -299,7 +299,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function) * "An INVALID_OPERATION error is generated if no vertex array * object is bound (see section 10.3.1)." */ - if (ctx->Array.VAO == ctx->Array.DefaultVAO) { + if (ctx->Array.VAO == ctx->Array.DefaultVAO && (!ctx->Const.AllowRelaxedVboValidation)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function); return false; } @@ -331,7 +331,7 @@ _mesa_is_valid_prim_mode(const struct gl_context *ctx, GLenum mode) * right approach, but at least GCC 4.7.2 generates some pretty dire code * for the common case. */ - if (likely(mode <= GL_TRIANGLE_FAN)) + if (likely(mode <= GL_TRIANGLE_FAN) || (ctx->Const.AllowExtendedPrimitiveType)) return true; if (mode <= GL_POLYGON) diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 5da405d9fa..6c0af649eb 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -137,7 +137,7 @@ _mesa_GetString( GLenum name ) case GL_VERSION: return (const GLubyte *) ctx->VersionString; case GL_EXTENSIONS: - if (ctx->API == API_OPENGL_CORE) { + if (ctx->API == API_OPENGL_CORE && (!ctx->Const.AllowGLExtensionsInCore)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetString(GL_EXTENSIONS)"); return (const GLubyte *) 0; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 28d3d948fc..41f833a45a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3637,6 +3637,27 @@ struct gl_constants GLboolean AllowHigherCompatVersion; /** + * Allow more types of primitives with glDrawArrays* while being + * in a core profile. + */ + GLboolean AllowExtendedPrimitiveType; + + /** + * Allow an index value of -1 for _mesa_uniform + */ + GLboolean AllowMinusOneIndexUniform; + + /** + * Allow glGetString(GL_EXTENSIONS) in a core profile + */ + GLboolean AllowGLExtensionsInCore; + + /** + * Allow Relaxed Validation when using VBO in a core profile + */ + GLboolean AllowRelaxedVboValidation; + + /** * Force computing the absolute value for sqrt() and inversesqrt() to follow * D3D9 when apps rely on this behaviour. */ diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 0e02a764a9..a9fd0ffcff 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -910,6 +910,9 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, int size_mul = glsl_base_type_is_64bit(basicType) ? 2 : 1; struct gl_uniform_storage *uni; + if (ctx->Const.AllowMinusOneIndexUniform && ( location == -1 )) { + return; + } if (_mesa_is_no_error_enabled(ctx)) { uni = shProg->UniformRemapTable[location]; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 0eb8e623dc..9d4302cb73 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -479,7 +479,7 @@ validate_array(struct gl_context *ctx, const char *func, * * The check for VBOs is handled below. */ - if (ctx->API == API_OPENGL_CORE && (vao == ctx->Array.DefaultVAO)) { + if (ctx->API == API_OPENGL_CORE && (vao == ctx->Array.DefaultVAO) && (!ctx->Const.AllowRelaxedVboValidation)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)", func); return; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index fffc0ef8ee..b53084934b 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -887,6 +887,14 @@ void st_init_extensions(struct pipe_screen *screen, consts->AllowHigherCompatVersion = options->allow_higher_compat_version; + consts->AllowMinusOneIndexUniform = options->allow_minus_one_index_uniform; + + consts->AllowRelaxedVboValidation = options->allow_relaxed_vbo_validation; + + consts->AllowExtendedPrimitiveType = options->allow_extended_primitive_type; + + consts->AllowGLExtensionsInCore = options->allow_gl_extensions_in_core; + consts->ForceGLSLAbsSqrt = options->force_glsl_abs_sqrt; consts->dri_config_options_sha1 = options->config_options_sha1;