[Mesa-dev] [RFC 08/11] i965/compiler: Take an explicit shader_info parameter in compile_tes

Jason Ekstrand jason at jlekstrand.net
Fri Oct 28 20:46:37 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_compiler.h |  1 +
 src/mesa/drivers/dri/i965/brw_shader.cpp | 26 +++++++++++++-------------
 src/mesa/drivers/dri/i965/brw_tes.c      |  3 ++-
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index be18f18..00120c9 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -805,6 +805,7 @@ brw_compile_tes(const struct brw_compiler *compiler, void *log_data,
                 void *mem_ctx,
                 const struct brw_tes_prog_key *key,
                 struct brw_tes_prog_data *prog_data,
+                shader_info *info,
                 const struct nir_shader *shader,
                 struct gl_shader_program *shader_prog,
                 int shader_time_index,
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 29de130..a007c30 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -1341,6 +1341,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
                 void *mem_ctx,
                 const struct brw_tes_prog_key *key,
                 struct brw_tes_prog_data *prog_data,
+                shader_info *info,
                 const nir_shader *src_shader,
                 struct gl_shader_program *shader_prog,
                 int shader_time_index,
@@ -1353,13 +1354,13 @@ brw_compile_tes(const struct brw_compiler *compiler,
    const bool is_scalar = compiler->scalar_stage[MESA_SHADER_TESS_EVAL];
 
    nir_shader *nir = nir_shader_clone(mem_ctx, src_shader);
-   nir->info->inputs_read = key->inputs_read;
-   nir->info->patch_inputs_read = key->patch_inputs_read;
+   info->inputs_read = key->inputs_read;
+   info->patch_inputs_read = key->patch_inputs_read;
 
    struct brw_vue_map input_vue_map;
    brw_compute_tess_vue_map(&input_vue_map,
-                            nir->info->inputs_read & ~VARYING_BIT_PRIMITIVE_ID,
-                            nir->info->patch_inputs_read);
+                            info->inputs_read & ~VARYING_BIT_PRIMITIVE_ID,
+                            info->patch_inputs_read);
 
    nir = brw_nir_apply_sampler_key(nir, devinfo, &key->tex, is_scalar);
    brw_nir_lower_tes_inputs(nir, &input_vue_map);
@@ -1367,8 +1368,8 @@ brw_compile_tes(const struct brw_compiler *compiler,
    nir = brw_postprocess_nir(nir, compiler->devinfo, is_scalar);
 
    brw_compute_vue_map(devinfo, &prog_data->base.vue_map,
-                       nir->info->outputs_written,
-                       nir->info->separate_shader);
+                       info->outputs_written,
+                       info->separate_shader);
 
    unsigned output_size_bytes = prog_data->base.vue_map.num_slots * 4 * 4;
 
@@ -1382,7 +1383,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
    /* URB entry sizes are stored as a multiple of 64 bytes. */
    prog_data->base.urb_entry_size = ALIGN(output_size_bytes, 64) / 64;
 
-   bool need_patch_header = nir->info->system_values_read &
+   bool need_patch_header = info->system_values_read &
       (BITFIELD64_BIT(SYSTEM_VALUE_TESS_LEVEL_OUTER) |
        BITFIELD64_BIT(SYSTEM_VALUE_TESS_LEVEL_INNER));
 
@@ -1402,7 +1403,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
 
    if (is_scalar) {
       fs_visitor v(compiler, log_data, mem_ctx, (void *) key,
-                   &prog_data->base.base, shader->Program, nir, nir->info, 8,
+                   &prog_data->base.base, shader->Program, nir, info, 8,
                    shader_time_index, &input_vue_map);
       if (!v.run_tes()) {
          if (error_str)
@@ -1419,9 +1420,8 @@ brw_compile_tes(const struct brw_compiler *compiler,
       if (unlikely(INTEL_DEBUG & DEBUG_TES)) {
          g.enable_debug(ralloc_asprintf(mem_ctx,
                                         "%s tessellation evaluation shader %s",
-                                        nir->info->label ? nir->info->label
-                                                        : "unnamed",
-                                        nir->info->name));
+                                        info->label ? info->label : "unnamed",
+                                        info->name));
       }
 
       g.generate_code(v.cfg, 8);
@@ -1429,7 +1429,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
       return g.get_assembly(final_assembly_size);
    } else {
       brw::vec4_tes_visitor v(compiler, log_data, key, prog_data,
-			      nir, nir->info, mem_ctx, shader_time_index);
+			      nir, info, mem_ctx, shader_time_index);
       if (!v.run()) {
 	 if (error_str)
 	    *error_str = ralloc_strdup(mem_ctx, v.fail_msg);
@@ -1440,7 +1440,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
 	 v.dump_instructions();
 
       return brw_vec4_generate_assembly(compiler, log_data, mem_ctx, nir,
-                                        nir->info, &prog_data->base, v.cfg,
+                                        info, &prog_data->base, v.cfg,
 					final_assembly_size);
    }
 }
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index b8c26df..ed4112c 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -187,7 +187,8 @@ brw_codegen_tes_prog(struct brw_context *brw,
    unsigned program_size;
    char *error_str;
    const unsigned *program =
-      brw_compile_tes(compiler, brw, mem_ctx, key, &prog_data, nir,
+      brw_compile_tes(compiler, brw, mem_ctx, key,
+                      &prog_data, &tep->program.info, nir,
                       shader_prog, st_index, &program_size, &error_str);
    if (program == NULL) {
       if (shader_prog) {
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list