From 419d9b21e14d67776ec3a47df110dcbb6566dc03 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 20 May 2019 11:24:21 -0700 Subject: [PATCH] intel: Move brw_prog_key_set_id from i965 to the compiler. I want to use it in iris. Reviewed-by: Dylan Baker --- src/intel/compiler/brw_compiler.c | 17 +++++++++++++++++ src/intel/compiler/brw_compiler.h | 3 +++ src/mesa/drivers/dri/i965/brw_program.c | 16 ---------------- src/mesa/drivers/dri/i965/brw_program.h | 4 ---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index 6a41cd20270..bded536c948 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -262,3 +262,20 @@ 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; +} diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 8c6ae35636b..3c109c504b1 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -1230,6 +1230,9 @@ brw_prog_data_size(gl_shader_stage stage); unsigned brw_prog_key_size(gl_shader_stage stage); +void +brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage, unsigned id); + /** * Compile a vertex shader. * diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index deb0f1cf225..9eac83b7254 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -868,22 +868,6 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo, return next_binding_table_offset; } -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; -} - void brw_populate_default_key(const struct brw_compiler *compiler, union brw_any_prog_key *prog_key, diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index 117019d00c7..8eb9620ab1e 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -81,10 +81,6 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo, struct brw_stage_prog_data *stage_prog_data, uint32_t next_binding_table_offset); -void -brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage stage, - unsigned id); - void brw_populate_default_key(const struct brw_compiler *compiler, union brw_any_prog_key *prog_key, -- 2.30.2