i965: switch tcs over to shared shader_info
authorTimothy Arceri <timothy.arceri@collabora.com>
Wed, 19 Oct 2016 00:08:18 +0000 (11:08 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Wed, 26 Oct 2016 03:29:36 +0000 (14:29 +1100)
Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c

index 0f03fab02a02a31b4b49619182885a3247ac255b..20ea4f1d57cef45260d3ba7855fd2cbdc0c4365e 100644 (file)
@@ -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;
    }
 }
 
index 59e4d50f490a8295e685e16aee4b2417782a68f1..3f01c07dffb9c74a5bf643f3899036c3db620965 100644 (file)
@@ -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,