From e33055874b7f62948257f72e7997474538fe6e7e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 10 Aug 2021 16:46:09 -0700 Subject: [PATCH] iris: crocus: Use shader_info::is_arb_asm flag ...instead of looking for "ARB" in the name of the shader. This matches the behavior of i965. Using "ARB" was added in a1ebac3750e ("iris: Implement ALT mode for ARB_{vertex,fragment}_shader"), but there's no explanation of why that method was used. v2: Just use shader_info::is_arb_asm everywhere instead of iris_uncompiled_shader::use_alt_mode. Suggested by Ken. Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/crocus/crocus_context.h | 3 --- src/gallium/drivers/crocus/crocus_program.c | 8 ++------ src/gallium/drivers/iris/iris_context.h | 3 --- src/gallium/drivers/iris/iris_program.c | 8 ++------ 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h index 06a0ff0..3836689 100644 --- a/src/gallium/drivers/crocus/crocus_context.h +++ b/src/gallium/drivers/crocus/crocus_context.h @@ -318,9 +318,6 @@ struct crocus_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; - bool needs_edge_flag; /** Constant data scraped from the shader by nir_opt_large_constants */ diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index b4a4ce6..14001b1 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -1200,7 +1200,7 @@ crocus_compile_vs(struct crocus_context *ice, nir_shader_gather_info(nir, impl); } - prog_data->use_alt_mode = ish->use_alt_mode; + prog_data->use_alt_mode = nir->info.is_arb_asm; crocus_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); @@ -1829,7 +1829,7 @@ crocus_compile_fs(struct crocus_context *ice, nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir); - prog_data->use_alt_mode = ish->use_alt_mode; + prog_data->use_alt_mode = nir->info.is_arb_asm; crocus_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); @@ -2695,10 +2695,6 @@ crocus_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. Drop unnecessary information (like variable names) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index d45c49c..f98987c 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -403,9 +403,6 @@ 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; - bool needs_edge_flag; /* Whether shader uses atomic operations. */ diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 1071ac8..b53bdd6 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1279,7 +1279,7 @@ iris_compile_vs(struct iris_screen *screen, nir_shader_gather_info(nir, impl); } - prog_data->use_alt_mode = ish->use_alt_mode; + prog_data->use_alt_mode = nir->info.is_arb_asm; iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, 0, &system_values, &num_system_values, &num_cbufs); @@ -1898,7 +1898,7 @@ iris_compile_fs(struct iris_screen *screen, nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir); const struct iris_fs_prog_key *const key = &shader->key.fs; - prog_data->use_alt_mode = ish->use_alt_mode; + prog_data->use_alt_mode = nir->info.is_arb_asm; iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, 0, &system_values, &num_system_values, &num_cbufs); @@ -2408,10 +2408,6 @@ iris_create_uncompiled_shader(struct iris_screen *screen, 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. Drop unnecessary information (like variable names) -- 2.7.4