From: Axel Davy Date: Sat, 27 Apr 2019 16:30:02 +0000 (+0200) Subject: st/nine: Control shader constant inlining with drirc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12654a2fda53d46246d4f0f1f792377b57ad769e;p=mesa.git st/nine: Control shader constant inlining with drirc Until we use async shader compilation for constant inlining, don't enable it unless user asks for it. Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/adapter9.h b/src/gallium/state_trackers/nine/adapter9.h index ba20a3abe87..605444cbc8d 100644 --- a/src/gallium/state_trackers/nine/adapter9.h +++ b/src/gallium/state_trackers/nine/adapter9.h @@ -43,6 +43,7 @@ struct d3dadapter9_context BOOL tearfree_discard; int csmt_force; BOOL dynamic_texture_workaround; + BOOL shader_inline_constants; void (*destroy)( struct d3dadapter9_context *ctx ); }; diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 78ca58d3c27..6d29378a7bc 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -491,9 +491,10 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS); This->driver_caps.offset_units_unscaled = GET_PCAP(POLYGON_OFFSET_UNITS_UNSCALED); + This->context.inline_constants = pCTX->shader_inline_constants; /* Code would be needed when integers are not available to correctly * handle the conversion of integer constants */ - This->context.inline_constants = This->driver_caps.vs_integer && This->driver_caps.ps_integer; + This->context.inline_constants &= This->driver_caps.vs_integer && This->driver_caps.ps_integer; nine_ff_init(This); /* initialize fixed function code */ diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c index b9ae076c544..d6453bec131 100644 --- a/src/gallium/targets/d3dadapter9/drm.c +++ b/src/gallium/targets/d3dadapter9/drm.c @@ -60,6 +60,7 @@ DRI_CONF_BEGIN DRI_CONF_NINE_TEARFREEDISCARD("false") DRI_CONF_NINE_CSMT(-1) DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND("false") + DRI_CONF_NINE_SHADERINLINECONSTANTS("false") DRI_CONF_SECTION_END DRI_CONF_END; @@ -304,6 +305,11 @@ drm_create_adapter( int fd, else ctx->base.dynamic_texture_workaround = FALSE; + if (driCheckOption(&userInitOptions, "shader_inline_constants", DRI_BOOL)) + ctx->base.shader_inline_constants = driQueryOptionb(&userInitOptions, "shader_inline_constants"); + else + ctx->base.shader_inline_constants = FALSE; + driDestroyOptionCache(&userInitOptions); driDestroyOptionInfo(&defaultInitOptions); diff --git a/src/util/xmlpool/t_options.h b/src/util/xmlpool/t_options.h index 1cc9ec33055..c7ebd3a4600 100644 --- a/src/util/xmlpool/t_options.h +++ b/src/util/xmlpool/t_options.h @@ -329,6 +329,11 @@ DRI_CONF_OPT_BEGIN_B(dynamic_texture_workaround, def) \ DRI_CONF_DESC(en,gettext("If set to true, use a ram intermediate buffer for dynamic textures. Increases ram usage, which can cause out of memory issues, but can fix glitches for some games.")) \ DRI_CONF_OPT_END +#define DRI_CONF_NINE_SHADERINLINECONSTANTS(def) \ +DRI_CONF_OPT_BEGIN_B(shader_inline_constants, def) \ + DRI_CONF_DESC(en,gettext("If set to true, recompile shaders with integer or boolean constants when the values are known. Can cause stutter, but can increase slightly performance.")) \ +DRI_CONF_OPT_END + /** * \brief radeonsi specific configuration options */