Mesa (master): i965: Move TES input VUE map calculation out a layer.

Kenneth Graunke kwg at kemper.freedesktop.org
Sun Jan 8 20:07:15 UTC 2017


Module: Mesa
Branch: master
Commit: 86b9be777f11b1226565350363e6b39f7b2f22c8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=86b9be777f11b1226565350363e6b39f7b2f22c8

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Mar  7 15:46:47 2016 -0800

i965: Move TES input VUE map calculation out a layer.

In Vulkan, we'll compile the TCS and TES at the same time, so I can just
pass the TCS output VUE map to brw_compile_tes as the TES input VUE map.

So, we only need to do this in GL.  Move it to the GL-specific layer.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index db8f39c..c378e93 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -801,6 +801,7 @@ const unsigned *
 brw_compile_tes(const struct brw_compiler *compiler, void *log_data,
                 void *mem_ctx,
                 const struct brw_tes_prog_key *key,
+                const struct brw_vue_map *input_vue_map,
                 struct brw_tes_prog_data *prog_data,
                 const struct nir_shader *shader,
                 struct gl_program *prog,
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index daa0c24..fb4cde9 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -1301,6 +1301,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
                 void *log_data,
                 void *mem_ctx,
                 const struct brw_tes_prog_key *key,
+                const struct brw_vue_map *input_vue_map,
                 struct brw_tes_prog_data *prog_data,
                 const nir_shader *src_shader,
                 struct gl_program *prog,
@@ -1315,12 +1316,8 @@ brw_compile_tes(const struct brw_compiler *compiler,
    nir->info->inputs_read = key->inputs_read;
    nir->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,
-                            nir->info->patch_inputs_read);
-
    nir = brw_nir_apply_sampler_key(nir, compiler, &key->tex, is_scalar);
-   brw_nir_lower_tes_inputs(nir, &input_vue_map);
+   brw_nir_lower_tes_inputs(nir, input_vue_map);
    brw_nir_lower_vue_outputs(nir, is_scalar);
    nir = brw_postprocess_nir(nir, compiler, is_scalar);
 
@@ -1383,7 +1380,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
 
    if (unlikely(INTEL_DEBUG & DEBUG_TES)) {
       fprintf(stderr, "TES Input ");
-      brw_print_vue_map(stderr, &input_vue_map);
+      brw_print_vue_map(stderr, input_vue_map);
       fprintf(stderr, "TES Output ");
       brw_print_vue_map(stderr, &prog_data->base.vue_map);
    }
@@ -1391,7 +1388,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, NULL, nir, 8,
-                   shader_time_index, &input_vue_map);
+                   shader_time_index, input_vue_map);
       if (!v.run_tes()) {
          if (error_str)
             *error_str = ralloc_strdup(mem_ctx, v.fail_msg);
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index e88fba9..57dcda7 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -125,12 +125,16 @@ brw_codegen_tes_prog(struct brw_context *brw,
       start_time = get_time();
    }
 
+   struct brw_vue_map input_vue_map;
+   brw_compute_tess_vue_map(&input_vue_map, key->inputs_read,
+                            key->patch_inputs_read);
+
    void *mem_ctx = ralloc_context(NULL);
    unsigned program_size;
    char *error_str;
    const unsigned *program =
-      brw_compile_tes(compiler, brw, mem_ctx, key, &prog_data, nir,
-                      &tep->program, st_index, &program_size, &error_str);
+      brw_compile_tes(compiler, brw, mem_ctx, key, &input_vue_map, &prog_data,
+                      nir, &tep->program, st_index, &program_size, &error_str);
    if (program == NULL) {
       tep->program.sh.data->LinkStatus = false;
       ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);




More information about the mesa-commit mailing list