+void
+brw_tes_populate_key(struct brw_context *brw,
+ struct brw_tes_prog_key *key)
+{
+ struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
+ struct gl_program *prog = &tep->program;
+
+ 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;
+
+ /* The TCS may have additional outputs which aren't read by the
+ * TES (possibly for cross-thread communication). These need to
+ * be stored in the Patch URB Entry as well.
+ */
+ if (tcp) {
+ struct gl_program *tcp_prog = &tcp->program;
+ per_vertex_slots |= tcp_prog->info.outputs_written &
+ ~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER);
+ per_patch_slots |= tcp_prog->info.patch_outputs_written;
+ }
+
+ key->inputs_read = per_vertex_slots;
+ key->patch_inputs_read = per_patch_slots;
+
+ /* _NEW_TEXTURE */
+ brw_populate_sampler_prog_key_data(&brw->ctx, prog, &key->tex);
+}