mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-27 14:28:22 +02:00
brw: Use a single brw_compile entrypoint
Reviewed-by: Iván Briano <ivan.briano@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41633>
This commit is contained in:
parent
190ce8280f
commit
7893eefa3b
11 changed files with 98 additions and 97 deletions
|
|
@ -1934,7 +1934,7 @@ iris_compile_vs(struct iris_screen *screen,
|
|||
|
||||
program = bin->kernel;
|
||||
} else {
|
||||
program = brw_compile_vs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
}
|
||||
|
||||
error = params.base.error_str;
|
||||
|
|
@ -2204,7 +2204,7 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||
.prog_data = brw_prog_data,
|
||||
};
|
||||
|
||||
program = brw_compile_tcs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
error = params.base.error_str;
|
||||
|
||||
if (program) {
|
||||
|
|
@ -2415,7 +2415,7 @@ iris_compile_tes(struct iris_screen *screen,
|
|||
.input_vue_map = &input_vue_map,
|
||||
};
|
||||
|
||||
program = brw_compile_tes(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
error = params.base.error_str;
|
||||
|
||||
if (program) {
|
||||
|
|
@ -2609,7 +2609,7 @@ iris_compile_gs(struct iris_screen *screen,
|
|||
.prog_data = brw_prog_data,
|
||||
};
|
||||
|
||||
program = brw_compile_gs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
error = params.base.error_str;
|
||||
if (program) {
|
||||
iris_debug_recompile(dbg, ish, key);
|
||||
|
|
@ -2824,7 +2824,7 @@ iris_compile_fs(struct iris_screen *screen,
|
|||
|
||||
program = bin->kernel;
|
||||
} else {
|
||||
program = brw_compile_fs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
}
|
||||
|
||||
error = params.base.error_str;
|
||||
|
|
@ -3184,7 +3184,7 @@ iris_compile_cs(struct iris_screen *screen,
|
|||
|
||||
program = bin->kernel;
|
||||
} else {
|
||||
program = brw_compile_cs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
}
|
||||
|
||||
error = params.base.error_str;
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
|
|||
.key = &prog_key.fs,
|
||||
.prog_data = prog_data,
|
||||
};
|
||||
program = brw_compile_fs(screen->brw, ¶ms);
|
||||
program = brw_compile(screen->brw, ¶ms.base);
|
||||
assert(program);
|
||||
iris_apply_brw_prog_data(shader, &prog_data->base, NULL);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ blorp_compile_fs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
.max_polygons = 1,
|
||||
};
|
||||
|
||||
const unsigned *kernel = brw_compile_fs(compiler, ¶ms);
|
||||
const unsigned *kernel = brw_compile(compiler, ¶ms.base);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ blorp_compile_vs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
.prog_data = vs_prog_data,
|
||||
};
|
||||
|
||||
const unsigned *kernel = brw_compile_vs(compiler, ¶ms);
|
||||
const unsigned *kernel = brw_compile(compiler, ¶ms.base);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ blorp_compile_cs_brw(struct blorp_context *blorp, void *mem_ctx,
|
|||
.prog_data = cs_prog_data,
|
||||
};
|
||||
|
||||
const unsigned *kernel = brw_compile_cs(compiler, ¶ms);
|
||||
const unsigned *kernel = brw_compile(compiler, ¶ms.base);
|
||||
|
||||
debug_archiver_close(archiver);
|
||||
|
||||
|
|
|
|||
|
|
@ -1321,6 +1321,10 @@ struct brw_compile_params {
|
|||
debug_archiver *archiver;
|
||||
};
|
||||
|
||||
const unsigned *
|
||||
brw_compile(const struct brw_compiler *compiler,
|
||||
struct brw_compile_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a vertex shader.
|
||||
*
|
||||
|
|
@ -1333,15 +1337,6 @@ struct brw_compile_vs_params {
|
|||
struct brw_vs_prog_data *prog_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a vertex shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_vs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_vs_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a tessellation control shader.
|
||||
*
|
||||
|
|
@ -1354,15 +1349,6 @@ struct brw_compile_tcs_params {
|
|||
struct brw_tcs_prog_data *prog_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a tessellation control shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_tcs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_tcs_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a tessellation evaluation shader.
|
||||
*
|
||||
|
|
@ -1376,15 +1362,6 @@ struct brw_compile_tes_params {
|
|||
const struct intel_vue_map *input_vue_map;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a tessellation evaluation shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_tes(const struct brw_compiler *compiler,
|
||||
struct brw_compile_tes_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a geometry shader.
|
||||
*
|
||||
|
|
@ -1397,15 +1374,6 @@ struct brw_compile_gs_params {
|
|||
struct brw_gs_prog_data *prog_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a geometry shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_gs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_gs_params *params);
|
||||
|
||||
struct brw_compile_task_params {
|
||||
struct brw_compile_params base;
|
||||
|
||||
|
|
@ -1413,10 +1381,6 @@ struct brw_compile_task_params {
|
|||
struct brw_task_prog_data *prog_data;
|
||||
};
|
||||
|
||||
const unsigned *
|
||||
brw_compile_task(const struct brw_compiler *compiler,
|
||||
struct brw_compile_task_params *params);
|
||||
|
||||
struct brw_compile_mesh_params {
|
||||
struct brw_compile_params base;
|
||||
|
||||
|
|
@ -1432,10 +1396,6 @@ struct brw_compile_mesh_params {
|
|||
nir_def *(*wa_18019110168_load_provoking_vertex)(nir_builder *b, void *data);
|
||||
};
|
||||
|
||||
const unsigned *
|
||||
brw_compile_mesh(const struct brw_compiler *compiler,
|
||||
struct brw_compile_mesh_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a fragment shader.
|
||||
*
|
||||
|
|
@ -1463,15 +1423,6 @@ struct brw_compile_fs_params {
|
|||
nir_def *(*wa_18019110168_load_per_primitive_remap_table_offset)(nir_builder *b, void *data);
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a fragment shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_fs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_fs_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a compute shader.
|
||||
*
|
||||
|
|
@ -1484,15 +1435,6 @@ struct brw_compile_cs_params {
|
|||
struct brw_cs_prog_data *prog_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a compute shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_cs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_cs_params *params);
|
||||
|
||||
/**
|
||||
* Parameters for compiling a Bindless shader.
|
||||
*
|
||||
|
|
@ -1508,14 +1450,18 @@ struct brw_compile_bs_params {
|
|||
struct nir_shader **resume_shaders;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile a Bindless shader.
|
||||
*
|
||||
* Returns the final assembly and updates the parameters structure.
|
||||
*/
|
||||
const unsigned *
|
||||
brw_compile_bs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_bs_params *params);
|
||||
union brw_any_compile_params {
|
||||
struct brw_compile_params base;
|
||||
struct brw_compile_vs_params vs;
|
||||
struct brw_compile_tcs_params tcs;
|
||||
struct brw_compile_tes_params tes;
|
||||
struct brw_compile_gs_params gs;
|
||||
struct brw_compile_fs_params fs;
|
||||
struct brw_compile_cs_params cs;
|
||||
struct brw_compile_bs_params bs;
|
||||
struct brw_compile_task_params task;
|
||||
struct brw_compile_mesh_params mesh;
|
||||
};
|
||||
|
||||
unsigned
|
||||
brw_cs_push_const_total_size(const struct brw_cs_prog_data *cs_prog_data,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,25 @@ void brw_alloc_reg_sets(struct brw_compiler *compiler);
|
|||
extern const char *const conditional_modifier[16];
|
||||
extern const char *const pred_ctrl_align16[16];
|
||||
|
||||
const unsigned *brw_compile_vs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_vs_params *params);
|
||||
const unsigned *brw_compile_tcs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_tcs_params *params);
|
||||
const unsigned *brw_compile_tes(const struct brw_compiler *compiler,
|
||||
struct brw_compile_tes_params *params);
|
||||
const unsigned *brw_compile_gs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_gs_params *params);
|
||||
const unsigned *brw_compile_task(const struct brw_compiler *compiler,
|
||||
struct brw_compile_task_params *params);
|
||||
const unsigned *brw_compile_mesh(const struct brw_compiler *compiler,
|
||||
struct brw_compile_mesh_params *params);
|
||||
const unsigned *brw_compile_fs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_fs_params *params);
|
||||
const unsigned *brw_compile_cs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_cs_params *params);
|
||||
const unsigned *brw_compile_bs(const struct brw_compiler *compiler,
|
||||
struct brw_compile_bs_params *params);
|
||||
|
||||
typedef struct brw_pass_tracker {
|
||||
nir_shader *nir;
|
||||
unsigned dispatch_width;
|
||||
|
|
|
|||
|
|
@ -1050,6 +1050,44 @@ brw_allocate_vgrf_units(brw_shader &s, unsigned units_of_REGSIZE)
|
|||
return brw_vgrf(brw_allocate_vgrf_number(s, units_of_REGSIZE), BRW_TYPE_UD);
|
||||
}
|
||||
|
||||
const unsigned *
|
||||
brw_compile(const struct brw_compiler *compiler,
|
||||
struct brw_compile_params *params)
|
||||
{
|
||||
assert(params);
|
||||
assert(params->nir);
|
||||
|
||||
switch (params->nir->info.stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
return brw_compile_vs(compiler, (struct brw_compile_vs_params *)params);
|
||||
case MESA_SHADER_TESS_CTRL:
|
||||
return brw_compile_tcs(compiler, (struct brw_compile_tcs_params *)params);
|
||||
case MESA_SHADER_TESS_EVAL:
|
||||
return brw_compile_tes(compiler, (struct brw_compile_tes_params *)params);
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
return brw_compile_gs(compiler, (struct brw_compile_gs_params *)params);
|
||||
case MESA_SHADER_TASK:
|
||||
return brw_compile_task(compiler, (struct brw_compile_task_params *)params);
|
||||
case MESA_SHADER_MESH:
|
||||
return brw_compile_mesh(compiler, (struct brw_compile_mesh_params *)params);
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
return brw_compile_fs(compiler, (struct brw_compile_fs_params *)params);
|
||||
case MESA_SHADER_COMPUTE:
|
||||
case MESA_SHADER_KERNEL:
|
||||
return brw_compile_cs(compiler, (struct brw_compile_cs_params *)params);
|
||||
case MESA_SHADER_RAYGEN:
|
||||
case MESA_SHADER_ANY_HIT:
|
||||
case MESA_SHADER_CLOSEST_HIT:
|
||||
case MESA_SHADER_MISS:
|
||||
case MESA_SHADER_INTERSECTION:
|
||||
case MESA_SHADER_CALLABLE:
|
||||
return brw_compile_bs(compiler, (struct brw_compile_bs_params *)params);
|
||||
default:
|
||||
UNREACHABLE("Unsupported shader stage");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void brw_prog_data_init(struct brw_stage_prog_data *prog_data,
|
||||
const struct brw_compile_params *params)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ struct brw_shader_params
|
|||
const nir_shader *nir;
|
||||
const brw_base_prog_key *key;
|
||||
brw_stage_prog_data *prog_data;
|
||||
|
||||
unsigned dispatch_width;
|
||||
|
||||
/* Fragment shader. */
|
||||
|
|
@ -125,7 +124,6 @@ public:
|
|||
const brw_base_prog_key *const key;
|
||||
|
||||
struct brw_stage_prog_data *prog_data;
|
||||
|
||||
brw_analysis<brw_live_variables, brw_shader> live_analysis;
|
||||
brw_analysis<brw_register_pressure, brw_shader> regpressure_analysis;
|
||||
brw_analysis<brw_performance, brw_shader> performance_analysis;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ compile_shader(struct anv_device *device,
|
|||
.prog_data = &prog_data.fs,
|
||||
};
|
||||
prog_data.base.push_sizes[0] = align(prog_data.base.push_sizes[0], REG_SIZE);
|
||||
program = brw_compile_fs(compiler, ¶ms);
|
||||
program = brw_compile(compiler, ¶ms.base);
|
||||
|
||||
if (!ANV_DEBUG(SHADER_PRINT)) {
|
||||
unsigned stat_idx = 0;
|
||||
|
|
@ -216,7 +216,7 @@ compile_shader(struct anv_device *device,
|
|||
.key = &key.cs,
|
||||
.prog_data = &prog_data.cs,
|
||||
};
|
||||
program = brw_compile_cs(compiler, ¶ms);
|
||||
program = brw_compile(compiler, ¶ms.base);
|
||||
|
||||
if (!ANV_DEBUG(SHADER_PRINT)) {
|
||||
check_sends(&stats, sends_count_expectation);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ struct anv_shader_data {
|
|||
|
||||
bool uses_bt_for_push_descs;
|
||||
|
||||
unsigned *code;
|
||||
const unsigned *code;
|
||||
|
||||
debug_archiver *archiver;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -960,7 +960,7 @@ anv_shader_compile_vs(struct anv_device *device,
|
|||
|
||||
shader_data->code = (void *) bin->kernel;
|
||||
} else {
|
||||
shader_data->code = (void *) brw_compile_vs(compiler, ¶ms);
|
||||
shader_data->code = (void *) brw_compile(compiler, ¶ms.base);
|
||||
}
|
||||
|
||||
*error_str = params.base.error_str;
|
||||
|
|
@ -993,7 +993,7 @@ anv_shader_compile_tcs(struct anv_device *device,
|
|||
.prog_data = &shader_data->prog_data.tcs,
|
||||
};
|
||||
|
||||
shader_data->code = (void *)brw_compile_tcs(compiler, ¶ms);
|
||||
shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ anv_shader_compile_tes(struct anv_device *device,
|
|||
&tcs_shader_data->prog_data.tcs.base.vue_map : NULL,
|
||||
};
|
||||
|
||||
tes_shader_data->code = (void *)brw_compile_tes(compiler, ¶ms);
|
||||
tes_shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
@ -1059,7 +1059,7 @@ anv_shader_compile_gs(struct anv_device *device,
|
|||
.prog_data = &shader_data->prog_data.gs,
|
||||
};
|
||||
|
||||
shader_data->code = (void *)brw_compile_gs(compiler, ¶ms);
|
||||
shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
@ -1087,7 +1087,7 @@ anv_shader_compile_task(struct anv_device *device,
|
|||
.prog_data = &shader_data->prog_data.task,
|
||||
};
|
||||
|
||||
shader_data->code = (void *)brw_compile_task(compiler, ¶ms);
|
||||
shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
@ -1161,7 +1161,7 @@ anv_shader_compile_mesh(struct anv_device *device,
|
|||
.wa_18019110168_data = (void *)&mesh_shader_data->bind_map,
|
||||
};
|
||||
|
||||
mesh_shader_data->code = (void *)brw_compile_mesh(compiler, ¶ms);
|
||||
mesh_shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
@ -1218,7 +1218,7 @@ anv_shader_compile_fs(struct anv_device *device,
|
|||
|
||||
shader_data->code = (void *) bin->kernel;
|
||||
} else {
|
||||
shader_data->code = (void *) brw_compile_fs(compiler, ¶ms);
|
||||
shader_data->code = (void *) brw_compile(compiler, ¶ms.base);
|
||||
}
|
||||
|
||||
*error_str = params.base.error_str;
|
||||
|
|
@ -1279,7 +1279,7 @@ anv_shader_compile_cs(struct anv_device *device,
|
|||
params.prog_data->local_size[1] = nir->info.workgroup_size[1];
|
||||
params.prog_data->local_size[2] = nir->info.workgroup_size[2];
|
||||
} else {
|
||||
shader_data->code = (void*)brw_compile_cs(compiler, ¶ms);
|
||||
shader_data->code = (void*)brw_compile(compiler, ¶ms.base);
|
||||
}
|
||||
|
||||
*error_str = params.base.error_str;
|
||||
|
|
@ -1356,7 +1356,7 @@ anv_shader_compile_bs(struct anv_device *device,
|
|||
.resume_shaders = resume_shaders,
|
||||
};
|
||||
|
||||
shader_data->code = (void *)brw_compile_bs(compiler, ¶ms);
|
||||
shader_data->code = (void *)brw_compile(compiler, ¶ms.base);
|
||||
*error_str = params.base.error_str;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ anv_device_init_rt_shaders(struct anv_device *device)
|
|||
.prog_data = &trampoline_prog_data,
|
||||
};
|
||||
const unsigned *tramp_data =
|
||||
brw_compile_cs(device->physical->compiler, ¶ms);
|
||||
brw_compile(device->physical->compiler, ¶ms.base);
|
||||
|
||||
struct anv_shader_upload_params upload_params = {
|
||||
.stage = MESA_SHADER_COMPUTE,
|
||||
|
|
@ -480,7 +480,7 @@ anv_device_init_rt_shaders(struct anv_device *device)
|
|||
.prog_data = &return_prog_data,
|
||||
};
|
||||
const unsigned *return_data =
|
||||
brw_compile_bs(device->physical->compiler, ¶ms);
|
||||
brw_compile(device->physical->compiler, ¶ms.base);
|
||||
|
||||
struct anv_shader_upload_params upload_params = {
|
||||
.stage = MESA_SHADER_CALLABLE,
|
||||
|
|
@ -538,7 +538,7 @@ anv_device_init_rt_shaders(struct anv_device *device)
|
|||
.prog_data = &return_prog_data,
|
||||
};
|
||||
const unsigned *return_data =
|
||||
brw_compile_bs(device->physical->compiler, ¶ms);
|
||||
brw_compile(device->physical->compiler, ¶ms.base);
|
||||
|
||||
struct anv_shader_upload_params upload_params = {
|
||||
.stage = MESA_SHADER_CALLABLE,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue