st/nine: Control shader constant inlining with drirc
authorAxel Davy <davyaxel0@gmail.com>
Sat, 27 Apr 2019 16:30:02 +0000 (18:30 +0200)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 30 Apr 2019 17:18:51 +0000 (19:18 +0200)
Until we use async shader compilation for constant inlining,
don't enable it unless user asks for it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/adapter9.h
src/gallium/state_trackers/nine/device9.c
src/gallium/targets/d3dadapter9/drm.c
src/util/xmlpool/t_options.h

index ba20a3abe872c0febec76633d3cc7e893f1bb915..605444cbc8dc03c3098bf61d2216bab1f6cd7e12 100644 (file)
@@ -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 );
 };
index 78ca58d3c270cbd2173b33cdcd39c48966cac111..6d29378a7bc3b41003d163a169282a619a4e7fc0 100644 (file)
@@ -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 */
 
index b9ae076c544ab026cdb627ba400e6671b9d965c8..d6453bec13119aeb802b3f3726d1f5c68ee07c99 100644 (file)
@@ -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);
 
index 1cc9ec33055339bc32c1720f3a316f73782fadea..c7ebd3a4600c4032ba6716e49e5a0edb33dae587 100644 (file)
@@ -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
  */