intel/compiler: Use a struct for brw_compile_vs parameters

Makes calling code more explicit about what is being set, and allows
take advantage of zero initialization for the ones the callsite don't
care.

Besides moving to the struct, two extra "ergonomic" changes were done:

- Add a new shader_time boolean, so shader_time_index is ignored when
  unused -- this allow taking advantage of the zero initialization of
  unset fields.

- Since we have a struct, provide space for the error_str pointer.
  Both iris and i965 were using it, and the extra rstrdup in case of
  failure shouldn't be a burden for the others.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9779>
This commit is contained in:
Caio Marcelo de Oliveira Filho
2021-03-22 23:07:18 -07:00
committed by Marge Bot
parent f5e1765f98
commit 57d664245e
6 changed files with 85 additions and 59 deletions

View File

@@ -1434,20 +1434,36 @@ 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);
/**
* Parameters for compiling a vertex shader.
*
* Some of these will be modified during the shader compilation.
*/
struct brw_compile_vs_params {
nir_shader *nir;
const struct brw_vs_prog_key *key;
struct brw_vs_prog_data *prog_data;
bool shader_time;
int shader_time_index;
struct brw_compile_stats *stats;
void *log_data;
char *error_str;
};
/**
* Compile a vertex shader.
*
* Returns the final assembly and the program's size.
* Returns the final assembly and updates the parameters structure.
*/
const unsigned *
brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
brw_compile_vs(const struct brw_compiler *compiler,
void *mem_ctx,
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *prog_data,
nir_shader *nir,
int shader_time_index,
struct brw_compile_stats *stats,
char **error_str);
struct brw_compile_vs_params *params);
/**
* Compile a tessellation control shader.