brw: factor out base prog_data setting
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Michael Cheng <michael.cheng@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33643>
This commit is contained in:
committed by
Marge Bot
parent
754752865a
commit
2f156ddb50
@@ -76,7 +76,6 @@ compile_single_bs(const struct brw_compiler *compiler,
|
||||
{
|
||||
const bool debug_enabled = brw_should_print_shader(shader, DEBUG_RT);
|
||||
|
||||
prog_data->base.stage = shader->info.stage;
|
||||
prog_data->max_stack_size = MAX2(prog_data->max_stack_size,
|
||||
shader->scratch_size);
|
||||
|
||||
@@ -170,9 +169,7 @@ brw_compile_bs(const struct brw_compiler *compiler,
|
||||
nir_shader **resume_shaders = params->resume_shaders;
|
||||
const bool debug_enabled = brw_should_print_shader(shader, DEBUG_RT);
|
||||
|
||||
prog_data->base.stage = shader->info.stage;
|
||||
prog_data->base.ray_queries = shader->info.ray_queries;
|
||||
prog_data->base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base, ¶ms->base);
|
||||
|
||||
prog_data->max_stack_size = 0;
|
||||
prog_data->num_resume_shaders = num_resume_shaders;
|
||||
|
||||
@@ -142,10 +142,7 @@ brw_compile_cs(const struct brw_compiler *compiler,
|
||||
brw_should_print_shader(nir, params->base.debug_flag ?
|
||||
params->base.debug_flag : DEBUG_CS);
|
||||
|
||||
prog_data->base.stage = MESA_SHADER_COMPUTE;
|
||||
prog_data->base.total_shared = nir->info.shared_size;
|
||||
prog_data->base.ray_queries = nir->info.ray_queries;
|
||||
prog_data->base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base, ¶ms->base);
|
||||
prog_data->uses_inline_data = brw_nir_uses_inline_data(nir) ||
|
||||
key->base.uses_inline_push_addr;
|
||||
assert(compiler->devinfo->verx10 >= 125 || !prog_data->uses_inline_data);
|
||||
|
||||
@@ -1541,9 +1541,7 @@ brw_compile_fs(const struct brw_compiler *compiler,
|
||||
brw_should_print_shader(nir, params->base.debug_flag ?
|
||||
params->base.debug_flag : DEBUG_WM);
|
||||
|
||||
prog_data->base.stage = MESA_SHADER_FRAGMENT;
|
||||
prog_data->base.ray_queries = nir->info.ray_queries;
|
||||
prog_data->base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base, ¶ms->base);
|
||||
|
||||
const struct intel_device_info *devinfo = compiler->devinfo;
|
||||
const unsigned max_subgroup_size = 32;
|
||||
|
||||
@@ -149,9 +149,7 @@ brw_compile_gs(const struct brw_compiler *compiler,
|
||||
|
||||
const bool debug_enabled = brw_should_print_shader(nir, DEBUG_GS);
|
||||
|
||||
prog_data->base.base.stage = MESA_SHADER_GEOMETRY;
|
||||
prog_data->base.base.ray_queries = nir->info.ray_queries;
|
||||
prog_data->base.base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
/* The GLSL linker will have already matched up GS inputs and the outputs
|
||||
* of prior stages. The driver does extend VS outputs in some cases, but
|
||||
@@ -382,4 +380,3 @@ brw_compile_gs(const struct brw_compiler *compiler,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -373,9 +373,7 @@ brw_compile_task(const struct brw_compiler *compiler,
|
||||
|
||||
NIR_PASS(_, nir, brw_nir_lower_launch_mesh_workgroups);
|
||||
|
||||
prog_data->base.base.stage = MESA_SHADER_TASK;
|
||||
prog_data->base.base.total_shared = nir->info.shared_size;
|
||||
prog_data->base.base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
prog_data->base.local_size[0] = nir->info.workgroup_size[0];
|
||||
prog_data->base.local_size[1] = nir->info.workgroup_size[1];
|
||||
@@ -1657,9 +1655,7 @@ brw_compile_mesh(const struct brw_compiler *compiler,
|
||||
struct brw_mesh_prog_data *prog_data = params->prog_data;
|
||||
const bool debug_enabled = brw_should_print_shader(nir, DEBUG_MESH);
|
||||
|
||||
prog_data->base.base.stage = MESA_SHADER_MESH;
|
||||
prog_data->base.base.total_shared = nir->info.shared_size;
|
||||
prog_data->base.base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
prog_data->base.local_size[0] = nir->info.workgroup_size[0];
|
||||
prog_data->base.local_size[1] = nir->info.workgroup_size[1];
|
||||
|
||||
@@ -194,9 +194,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
|
||||
|
||||
const bool debug_enabled = brw_should_print_shader(nir, DEBUG_TCS);
|
||||
|
||||
vue_prog_data->base.stage = MESA_SHADER_TESS_CTRL;
|
||||
prog_data->base.base.ray_queries = nir->info.ray_queries;
|
||||
prog_data->base.base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
nir->info.outputs_written = key->outputs_written;
|
||||
nir->info.patch_outputs_written = key->patch_outputs_written;
|
||||
|
||||
@@ -72,8 +72,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
|
||||
|
||||
const bool debug_enabled = brw_should_print_shader(nir, DEBUG_TES);
|
||||
|
||||
prog_data->base.base.stage = MESA_SHADER_TESS_EVAL;
|
||||
prog_data->base.base.ray_queries = nir->info.ray_queries;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
nir->info.inputs_read = key->inputs_read;
|
||||
nir->info.patch_inputs_read = key->patch_inputs_read;
|
||||
@@ -184,4 +183,3 @@ brw_compile_tes(const struct brw_compiler *compiler,
|
||||
|
||||
return g.get_assembly();
|
||||
}
|
||||
|
||||
|
||||
@@ -246,9 +246,7 @@ brw_compile_vs(const struct brw_compiler *compiler,
|
||||
*/
|
||||
assert(!key->no_vf_slot_compaction || key->vf_component_packing);
|
||||
|
||||
prog_data->base.base.stage = MESA_SHADER_VERTEX;
|
||||
prog_data->base.base.ray_queries = nir->info.ray_queries;
|
||||
prog_data->base.base.total_scratch = 0;
|
||||
brw_prog_data_init(&prog_data->base.base, ¶ms->base);
|
||||
|
||||
brw_nir_apply_key(nir, compiler, &key->base, dispatch_width);
|
||||
|
||||
|
||||
@@ -1536,3 +1536,15 @@ brw_generator::get_assembly()
|
||||
|
||||
return brw_get_program(p, &prog_data->program_size);
|
||||
}
|
||||
|
||||
void brw_prog_data_init(struct brw_stage_prog_data *prog_data,
|
||||
const struct brw_compile_params *params)
|
||||
{
|
||||
/* Do not memset the structure to 0, the driver might have put some bits of
|
||||
* information in there.
|
||||
*/
|
||||
prog_data->ray_queries = params->nir->info.ray_queries;
|
||||
prog_data->stage = params->nir->info.stage;
|
||||
prog_data->total_scratch = 0;
|
||||
prog_data->total_shared = params->nir->info.shared_size;
|
||||
}
|
||||
|
||||
@@ -76,3 +76,6 @@ private:
|
||||
gl_shader_stage stage;
|
||||
void *mem_ctx;
|
||||
};
|
||||
|
||||
void brw_prog_data_init(struct brw_stage_prog_data *prog_data,
|
||||
const struct brw_compile_params *params);
|
||||
|
||||
Reference in New Issue
Block a user