summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-08-02 15:13:59 +1000
committerTimothy Arceri <[email protected]>2019-08-07 10:12:49 +1000
commitdca119f12c291d7665d72464c92a8bf4328ef38e (patch)
tree4c2d81ab1b55694930ad0d427cb7d1c7e76e2b6e /src
parentc95e2a1c6ba40f017ca451e862a794d45ddb62cf (diff)
mesa/gallium: add dric option to allow overriding GL vendor string
Will be used in the following patch. Reviewed-by: Marek Olšák <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/pipe-loader/driinfo_gallium.h1
-rw-r--r--src/gallium/include/state_tracker/st_api.h1
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c7
-rw-r--r--src/mesa/main/getstring.c4
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/state_tracker/st_extensions.c2
-rw-r--r--src/util/xmlpool/t_options.h5
7 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 9db0dc01117..8ccb6a0b454 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -31,6 +31,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS("false")
DRI_CONF_FORCE_COMPAT_PROFILE("false")
+ DRI_CONF_FORCE_GL_VENDOR()
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index b2b81b6ebc4..516408c77c7 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -230,6 +230,7 @@ struct st_config_options
bool force_glsl_abs_sqrt;
bool allow_glsl_cross_stage_interpolation_mismatch;
bool allow_glsl_layout_qualifier_on_function_parameters;
+ char *force_gl_vendor;
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 5a555eacd09..67e956e1d21 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -89,6 +89,11 @@ dri_fill_st_options(struct dri_screen *screen)
options->allow_glsl_layout_qualifier_on_function_parameters =
driQueryOptionb(optionCache, "allow_glsl_layout_qualifier_on_function_parameters");
+ char *vendor_str = driQueryOptionstr(optionCache, "force_gl_vendor");
+ /* not an empty string */
+ if (*vendor_str)
+ options->force_gl_vendor = strdup(vendor_str);
+
driComputeOptionsSha1(optionCache, options->config_options_sha1);
}
@@ -481,6 +486,8 @@ dri_destroy_screen(__DRIscreen * sPriv)
pipe_loader_release(&screen->dev, 1);
+ free(screen->options.force_gl_vendor);
+
/* The caller in dri_util preserves the fd ownership */
free(screen);
sPriv->driverPrivate = NULL;
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index bd02b9db0b0..4db08f15e28 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -124,6 +124,10 @@ _mesa_GetString( GLenum name )
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+ if (ctx->Const.VendorOverride && name == GL_VENDOR) {
+ return (const GLubyte *) ctx->Const.VendorOverride;
+ }
+
/* this is a required driver function */
assert(ctx->Driver.GetString);
{
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 30fe50affc0..569e793ca27 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4135,6 +4135,8 @@ struct gl_constants
/** GL_ARB_spirv_extensions */
struct spirv_supported_extensions *SpirVExtensions;
+
+ char *VendorOverride;
};
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index abc816ed0d4..b31869e059e 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1153,6 +1153,8 @@ void st_init_extensions(struct pipe_screen *screen,
consts->GLSLZeroInit = options->glsl_zero_init;
+ consts->VendorOverride = options->force_gl_vendor;
+
consts->UniformBooleanTrue = consts->NativeIntegers ? ~0U : fui(1.0f);
/* Below are the cases which cannot be moved into tables easily. */
diff --git a/src/util/xmlpool/t_options.h b/src/util/xmlpool/t_options.h
index bfa9cc72bcb..86a72e9b39f 100644
--- a/src/util/xmlpool/t_options.h
+++ b/src/util/xmlpool/t_options.h
@@ -140,6 +140,11 @@ DRI_CONF_OPT_BEGIN_B(allow_glsl_layout_qualifier_on_function_parameters, def) \
DRI_CONF_DESC(en,gettext("Allow layout qualifiers on function parameters.")) \
DRI_CONF_OPT_END
+#define DRI_CONF_FORCE_GL_VENDOR(def) \
+DRI_CONF_OPT_BEGIN(force_gl_vendor, string, def) \
+ DRI_CONF_DESC(en,gettext("Allow GPU vendor to be overridden.")) \
+DRI_CONF_OPT_END
+
#define DRI_CONF_FORCE_COMPAT_PROFILE(def) \
DRI_CONF_OPT_BEGIN_B(force_compat_profile, def) \
DRI_CONF_DESC(en,gettext("Force an OpenGL compatibility context")) \