iris: crocus: Use shader_info::is_arb_asm flag
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 10 Aug 2021 23:46:09 +0000 (16:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 17 Sep 2021 23:36:08 +0000 (16:36 -0700)
...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 <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12858>

src/gallium/drivers/crocus/crocus_context.h
src/gallium/drivers/crocus/crocus_program.c
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_program.c

index 06a0ff0..3836689 100644 (file)
@@ -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 */
index b4a4ce6..14001b1 100644 (file)
@@ -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)
index d45c49c..f98987c 100644 (file)
@@ -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. */
index 1071ac8..b53bdd6 100644 (file)
@@ -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)