intel/compiler: Add a "base class" for program keys

Right now, all keys have two things in common: a program string ID and a
sampler_prog_key_data.  I'd like to add another thing or two and need a
place to put it.  This commit adds a new brw_base_prog_key struct which
contains those two common bits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand
2019-02-21 17:20:39 -06:00
committed by Jason Ekstrand
parent 3a4667e502
commit 14781e2122
30 changed files with 182 additions and 239 deletions

View File

@@ -263,20 +263,3 @@ brw_prog_key_size(gl_shader_stage stage)
assert((int)stage >= 0 && stage < ARRAY_SIZE(stage_sizes));
return stage_sizes[stage];
}
void
brw_prog_key_set_id(union brw_any_prog_key *key,
gl_shader_stage stage,
unsigned id)
{
static const unsigned stage_offsets[] = {
offsetof(struct brw_vs_prog_key, program_string_id),
offsetof(struct brw_tcs_prog_key, program_string_id),
offsetof(struct brw_tes_prog_key, program_string_id),
offsetof(struct brw_gs_prog_key, program_string_id),
offsetof(struct brw_wm_prog_key, program_string_id),
offsetof(struct brw_cs_prog_key, program_string_id),
};
assert((int)stage >= 0 && stage < ARRAY_SIZE(stage_offsets));
*(unsigned*)((uint8_t*)key + stage_offsets[stage]) = id;
}