[Mesa-dev] [PATCH 06/42] i965: switch tcs over to shared shader_info

Timothy Arceri timothy.arceri at collabora.com
Wed Oct 19 23:09:23 UTC 2016


Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.
---
 src/mesa/drivers/dri/i965/brw_tcs.c | 19 ++++++++-----------
 src/mesa/drivers/dri/i965/brw_tes.c | 20 +++++++++-----------
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 0f03fab..20ea4f1 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -316,24 +316,21 @@ void
 brw_tcs_populate_key(struct brw_context *brw,
                      struct brw_tcs_prog_key *key)
 {
-   uint64_t per_vertex_slots =
-      brw->tess_eval_program->Base.nir->info->inputs_read;
-   uint32_t per_patch_slots =
-      brw->tess_eval_program->Base.nir->info->patch_inputs_read;
-
    struct brw_tess_ctrl_program *tcp =
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
    struct gl_program *prog = &tcp->program.Base;
+   struct gl_program *tes_prog = &tep->program.Base;
+
+   uint64_t per_vertex_slots = tes_prog->info.inputs_read;
+   uint32_t per_patch_slots = tes_prog->info.patch_inputs_read;
 
    memset(key, 0, sizeof(*key));
 
-   if (brw->tess_ctrl_program) {
-      per_vertex_slots |=
-         brw->tess_ctrl_program->Base.nir->info->outputs_written;
-      per_patch_slots |=
-         brw->tess_ctrl_program->Base.nir->info->patch_outputs_written;
+   if (tcp) {
+      per_vertex_slots |= prog->info.outputs_written;
+      per_patch_slots |= prog->info.patch_outputs_written;
    }
 
    if (brw->gen < 8 || !tcp)
@@ -355,7 +352,7 @@ brw_tcs_populate_key(struct brw_context *brw,
       /* _NEW_TEXTURE */
       brw_populate_sampler_prog_key_data(&brw->ctx, prog, &key->tex);
    } else {
-      key->outputs_written = tep->program.Base.nir->info->inputs_read;
+      key->outputs_written = tes_prog->info.inputs_read;
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 59e4d50..3f01c07 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -233,16 +233,15 @@ void
 brw_tes_populate_key(struct brw_context *brw,
                      struct brw_tes_prog_key *key)
 {
-
-   uint64_t per_vertex_slots =
-      brw->tess_eval_program->Base.nir->info->inputs_read;
-   uint32_t per_patch_slots =
-      brw->tess_eval_program->Base.nir->info->patch_inputs_read;
-
+   struct brw_tess_ctrl_program *tcp =
+      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
    struct gl_program *prog = &tep->program.Base;
 
+   uint64_t per_vertex_slots = prog->info.inputs_read;
+   uint32_t per_patch_slots = prog->info.patch_inputs_read;
+
    memset(key, 0, sizeof(*key));
 
    key->program_string_id = tep->id;
@@ -251,11 +250,10 @@ brw_tes_populate_key(struct brw_context *brw,
     * TES (possibly for cross-thread communication).  These need to
     * be stored in the Patch URB Entry as well.
     */
-   if (brw->tess_ctrl_program) {
-      per_vertex_slots |=
-         brw->tess_ctrl_program->Base.nir->info->outputs_written;
-      per_patch_slots |=
-         brw->tess_ctrl_program->Base.nir->info->patch_outputs_written;
+   if (tcp) {
+      struct gl_program *tcp_prog = &tcp->program.Base;
+      per_vertex_slots |= tcp_prog->info.outputs_written;
+      per_patch_slots |= tcp_prog->info.patch_outputs_written;
    }
 
    /* Ignore gl_TessLevelInner/Outer - we treat them as system values,
-- 
2.7.4



More information about the mesa-dev mailing list