From: Kenneth Graunke Date: Tue, 21 May 2019 23:10:21 +0000 (-0700) Subject: iris: Fix ALT mode regressions from shader cache X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6dc1c2d8bdbcb75795e73ee08e56a2d9c4a6b784;p=mesa.git iris: Fix ALT mode regressions from shader cache We were checking this based on nir->info.name, but with the shader cache enabled, nir_strip throws out the name, causing us to use IEEE mode for ARB programs. gl-1.0-spot-light regressed because it wants ALT mode for 0^0 behavior. Fixes: dc5dc727d59 iris: Serialize the NIR to a blob we can use for shader cache purposes. --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index add6a9a9e34..75e13778631 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -271,6 +271,9 @@ struct iris_uncompiled_shader { /** Have any shader variants been compiled yet? */ bool compiled_once; + + /** Should we use ALT mode for math? Useful for ARB programs. */ + bool use_alt_mode; }; /** diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 21651bfd2c9..a5cd987664f 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -543,8 +543,7 @@ iris_compile_vs(struct iris_context *ice, nir_shader_gather_info(nir, impl); } - if (nir->info.name && strncmp(nir->info.name, "ARB", 3) == 0) - prog_data->use_alt_mode = true; + prog_data->use_alt_mode = ish->use_alt_mode; iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); @@ -1061,8 +1060,7 @@ iris_compile_fs(struct iris_context *ice, nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir); - if (nir->info.name && strncmp(nir->info.name, "ARB", 3) == 0) - prog_data->use_alt_mode = true; + prog_data->use_alt_mode = ish->use_alt_mode; iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); @@ -1490,6 +1488,10 @@ iris_create_uncompiled_shader(struct pipe_context *ctx, update_so_info(&ish->stream_output, nir->info.outputs_written); } + /* Save this now before potentially dropping nir->info.name */ + if (nir->info.name && strncmp(nir->info.name, "ARB", 3) == 0) + ish->use_alt_mode = true; + if (screen->disk_cache) { /* Serialize the NIR to a binary blob that we can hash for the disk * cache. First, drop unnecessary information (like variable names)