nir: rename nir_io_glsl_opt_varyings to nir_io_dont_optimize and deprecate it
The meaning is negated. This NIR option is deprecated and shouldn't be used. It means any IO optimizations can be disabled and it's a currently a workaround for zink, which is the only driver that asks for it by default. The original option is replaced by an environment variable for the GLSL linker. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32173>
This commit is contained in:
@@ -1513,7 +1513,7 @@ gl_nir_lower_optimize_varyings(const struct gl_constants *consts,
|
||||
unsigned num_shaders = 0;
|
||||
unsigned max_ubos = UINT_MAX;
|
||||
unsigned max_uniform_comps = UINT_MAX;
|
||||
bool optimize_io = true;
|
||||
bool optimize_io = !debug_get_bool_option("MESA_GLSL_DISABLE_IO_OPT", false);
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||
struct gl_linked_shader *shader = prog->_LinkedShaders[i];
|
||||
@@ -1532,7 +1532,7 @@ gl_nir_lower_optimize_varyings(const struct gl_constants *consts,
|
||||
consts->Program[i].MaxUniformComponents);
|
||||
max_ubos = MIN2(max_ubos, consts->Program[i].MaxUniformBlocks);
|
||||
num_shaders++;
|
||||
optimize_io &= !!(nir->options->io_options & nir_io_glsl_opt_varyings);
|
||||
optimize_io &= !(nir->options->io_options & nir_io_dont_optimize);
|
||||
}
|
||||
|
||||
/* Lower IO derefs to load and store intrinsics. */
|
||||
|
||||
@@ -3859,9 +3859,12 @@ typedef enum {
|
||||
nir_io_has_intrinsics = BITFIELD_BIT(16),
|
||||
|
||||
/**
|
||||
* Run nir_opt_varyings in the GLSL linker.
|
||||
* Don't run nir_opt_varyings and nir_opt_vectorize_io.
|
||||
*
|
||||
* This option is deprecated and is a hack. DO NOT USE.
|
||||
* Use MESA_GLSL_DISABLE_IO_OPT=1 instead.
|
||||
*/
|
||||
nir_io_glsl_opt_varyings = BITFIELD_BIT(17),
|
||||
nir_io_dont_optimize = BITFIELD_BIT(17),
|
||||
} nir_io_options;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -1577,7 +1577,7 @@ void si_init_screen_get_functions(struct si_screen *sscreen)
|
||||
*/
|
||||
options->force_f2f16_rtz = true;
|
||||
options->io_options |= (!has_mediump ? nir_io_mediump_is_32bit : 0) | nir_io_has_intrinsics |
|
||||
(sscreen->options.optimize_io ? nir_io_glsl_opt_varyings : 0);
|
||||
(sscreen->options.optimize_io ? 0 : nir_io_dont_optimize);
|
||||
options->lower_mediump_io = has_mediump ? si_lower_mediump_io : NULL;
|
||||
/* HW supports indirect indexing for: | Enabled in driver
|
||||
* -------------------------------------------------------
|
||||
|
||||
@@ -1402,8 +1402,6 @@ zink_screen_init_compiler(struct zink_screen *screen)
|
||||
}
|
||||
|
||||
if (screen->driver_compiler_workarounds.io_opt) {
|
||||
screen->nir_options.io_options |= nir_io_glsl_opt_varyings;
|
||||
|
||||
switch (zink_driverid(screen)) {
|
||||
case VK_DRIVER_ID_MESA_RADV:
|
||||
case VK_DRIVER_ID_AMD_OPEN_SOURCE:
|
||||
@@ -1416,6 +1414,8 @@ zink_screen_init_compiler(struct zink_screen *screen)
|
||||
screen->nir_options.varying_expression_max_cost = amd_varying_expression_max_cost;
|
||||
screen->nir_options.varying_estimate_instr_cost = amd_varying_estimate_instr_cost;
|
||||
}
|
||||
} else {
|
||||
screen->nir_options.io_options |= nir_io_dont_optimize;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1005,7 +1005,10 @@ disk_cache_enabled()
|
||||
"use MESA_SHADER_CACHE_DISABLE instead ***\n");
|
||||
}
|
||||
|
||||
if (debug_get_bool_option(envvar_name, disable_by_default))
|
||||
if (debug_get_bool_option(envvar_name, disable_by_default) ||
|
||||
/* MESA_GLSL_DISABLE_IO_OPT must disable the cache to get expected
|
||||
* results because it only takes effect on a cache miss. */
|
||||
debug_get_bool_option("MESA_GLSL_DISABLE_IO_OPT", false))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user