mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
intel/compiler: Add ctor to fs_builder that just takes the shader
Uses the dispatch_width from the shader (fs_visitor). This was not possible before because the dispatch_width was not part of backend_shader. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26323>
This commit is contained in:
parent
cf730adc58
commit
38a42e5aa1
9 changed files with 30 additions and 28 deletions
|
|
@ -1232,7 +1232,7 @@ fs_visitor::emit_gs_thread_end()
|
||||||
emit_gs_control_data_bits(this->final_gs_vertex_count);
|
emit_gs_control_data_bits(this->final_gs_vertex_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fs_builder abld = fs_builder(this, dispatch_width).at_end().annotate("thread end");
|
const fs_builder abld = fs_builder(this).at_end().annotate("thread end");
|
||||||
fs_inst *inst;
|
fs_inst *inst;
|
||||||
|
|
||||||
if (gs_prog_data->static_vertex_count != -1) {
|
if (gs_prog_data->static_vertex_count != -1) {
|
||||||
|
|
@ -3308,7 +3308,7 @@ fs_visitor::emit_repclear_shader()
|
||||||
BRW_VERTICAL_STRIDE_8, BRW_WIDTH_2, BRW_HORIZONTAL_STRIDE_4,
|
BRW_VERTICAL_STRIDE_8, BRW_WIDTH_2, BRW_HORIZONTAL_STRIDE_4,
|
||||||
BRW_SWIZZLE_XYZW, WRITEMASK_XYZW);
|
BRW_SWIZZLE_XYZW, WRITEMASK_XYZW);
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
bld.exec_all().group(4, 0).MOV(color_output, color_input);
|
bld.exec_all().group(4, 0).MOV(color_output, color_input);
|
||||||
|
|
||||||
if (key->nr_color_regions > 1) {
|
if (key->nr_color_regions > 1) {
|
||||||
|
|
@ -5313,7 +5313,7 @@ fs_visitor::lower_simd_width()
|
||||||
*/
|
*/
|
||||||
const unsigned max_width = MAX2(inst->exec_size, lower_width);
|
const unsigned max_width = MAX2(inst->exec_size, lower_width);
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
const fs_builder ibld = bld.at(block, inst)
|
const fs_builder ibld = bld.at(block, inst)
|
||||||
.exec_all(inst->force_writemask_all)
|
.exec_all(inst->force_writemask_all)
|
||||||
.group(max_width, inst->group / max_width);
|
.group(max_width, inst->group / max_width);
|
||||||
|
|
@ -6691,7 +6691,7 @@ fs_visitor::set_tcs_invocation_id()
|
||||||
{
|
{
|
||||||
struct brw_tcs_prog_data *tcs_prog_data = brw_tcs_prog_data(prog_data);
|
struct brw_tcs_prog_data *tcs_prog_data = brw_tcs_prog_data(prog_data);
|
||||||
struct brw_vue_prog_data *vue_prog_data = &tcs_prog_data->base;
|
struct brw_vue_prog_data *vue_prog_data = &tcs_prog_data->base;
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
const unsigned instance_id_mask =
|
const unsigned instance_id_mask =
|
||||||
(devinfo->verx10 >= 125) ? INTEL_MASK(7, 0) :
|
(devinfo->verx10 >= 125) ? INTEL_MASK(7, 0) :
|
||||||
|
|
@ -6743,7 +6743,7 @@ fs_visitor::emit_tcs_thread_end()
|
||||||
if (devinfo->ver != 8 && mark_last_urb_write_with_eot())
|
if (devinfo->ver != 8 && mark_last_urb_write_with_eot())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
/* Emit a URB write to end the thread. On Broadwell, we use this to write
|
/* Emit a URB write to end the thread. On Broadwell, we use this to write
|
||||||
* zero to the "TR DS Cache Disable" bit (we haven't implemented a fancy
|
* zero to the "TR DS Cache Disable" bit (we haven't implemented a fancy
|
||||||
|
|
@ -6766,7 +6766,7 @@ fs_visitor::run_tcs()
|
||||||
assert(stage == MESA_SHADER_TESS_CTRL);
|
assert(stage == MESA_SHADER_TESS_CTRL);
|
||||||
|
|
||||||
struct brw_vue_prog_data *vue_prog_data = brw_vue_prog_data(prog_data);
|
struct brw_vue_prog_data *vue_prog_data = brw_vue_prog_data(prog_data);
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
assert(vue_prog_data->dispatch_mode == DISPATCH_MODE_TCS_SINGLE_PATCH ||
|
assert(vue_prog_data->dispatch_mode == DISPATCH_MODE_TCS_SINGLE_PATCH ||
|
||||||
vue_prog_data->dispatch_mode == DISPATCH_MODE_TCS_MULTI_PATCH);
|
vue_prog_data->dispatch_mode == DISPATCH_MODE_TCS_MULTI_PATCH);
|
||||||
|
|
@ -6866,7 +6866,7 @@ fs_visitor::run_gs()
|
||||||
* Otherwise, we need to initialize it to 0 here.
|
* Otherwise, we need to initialize it to 0 here.
|
||||||
*/
|
*/
|
||||||
if (gs_compile->control_data_header_size_bits <= 32) {
|
if (gs_compile->control_data_header_size_bits <= 32) {
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
const fs_builder abld = bld.annotate("initialize control data bits");
|
const fs_builder abld = bld.annotate("initialize control data bits");
|
||||||
abld.MOV(this->control_data_bits, brw_imm_ud(0u));
|
abld.MOV(this->control_data_bits, brw_imm_ud(0u));
|
||||||
}
|
}
|
||||||
|
|
@ -6929,7 +6929,7 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send)
|
||||||
{
|
{
|
||||||
struct brw_wm_prog_data *wm_prog_data = brw_wm_prog_data(this->prog_data);
|
struct brw_wm_prog_data *wm_prog_data = brw_wm_prog_data(this->prog_data);
|
||||||
brw_wm_prog_key *wm_key = (brw_wm_prog_key *) this->key;
|
brw_wm_prog_key *wm_key = (brw_wm_prog_key *) this->key;
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
assert(stage == MESA_SHADER_FRAGMENT);
|
assert(stage == MESA_SHADER_FRAGMENT);
|
||||||
|
|
||||||
|
|
@ -7005,7 +7005,7 @@ fs_visitor::run_cs(bool allow_spilling)
|
||||||
{
|
{
|
||||||
assert(gl_shader_stage_is_compute(stage));
|
assert(gl_shader_stage_is_compute(stage));
|
||||||
assert(devinfo->ver >= 7);
|
assert(devinfo->ver >= 7);
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
payload_ = new cs_thread_payload(*this);
|
payload_ = new cs_thread_payload(*this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace brw {
|
||||||
* Construct an fs_builder that inserts instructions into \p shader.
|
* Construct an fs_builder that inserts instructions into \p shader.
|
||||||
* \p dispatch_width gives the native execution width of the program.
|
* \p dispatch_width gives the native execution width of the program.
|
||||||
*/
|
*/
|
||||||
fs_builder(backend_shader *shader,
|
fs_builder(fs_visitor *shader,
|
||||||
unsigned dispatch_width) :
|
unsigned dispatch_width) :
|
||||||
shader(shader), block(NULL), cursor(NULL),
|
shader(shader), block(NULL), cursor(NULL),
|
||||||
_dispatch_width(dispatch_width),
|
_dispatch_width(dispatch_width),
|
||||||
|
|
@ -64,13 +64,15 @@ namespace brw {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explicit fs_builder(fs_visitor *s) : fs_builder(s, s->dispatch_width) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an fs_builder that inserts instructions into \p shader
|
* Construct an fs_builder that inserts instructions into \p shader
|
||||||
* before instruction \p inst in basic block \p block. The default
|
* before instruction \p inst in basic block \p block. The default
|
||||||
* execution controls and debug annotation are initialized from the
|
* execution controls and debug annotation are initialized from the
|
||||||
* instruction passed as argument.
|
* instruction passed as argument.
|
||||||
*/
|
*/
|
||||||
fs_builder(backend_shader *shader, bblock_t *block, fs_inst *inst) :
|
fs_builder(fs_visitor *shader, bblock_t *block, fs_inst *inst) :
|
||||||
shader(shader), block(block), cursor(inst),
|
shader(shader), block(block), cursor(inst),
|
||||||
_dispatch_width(inst->exec_size),
|
_dispatch_width(inst->exec_size),
|
||||||
_group(inst->group),
|
_group(inst->group),
|
||||||
|
|
@ -832,7 +834,7 @@ namespace brw {
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
backend_shader *shader;
|
fs_visitor *shader;
|
||||||
|
|
||||||
fs_inst *BREAK() { return emit(BRW_OPCODE_BREAK); }
|
fs_inst *BREAK() { return emit(BRW_OPCODE_BREAK); }
|
||||||
fs_inst *DO() { return emit(BRW_OPCODE_DO); }
|
fs_inst *DO() { return emit(BRW_OPCODE_DO); }
|
||||||
|
|
|
||||||
|
|
@ -2219,7 +2219,7 @@ fs_visitor::emit_gs_control_data_bits(const fs_reg &vertex_count)
|
||||||
|
|
||||||
struct brw_gs_prog_data *gs_prog_data = brw_gs_prog_data(prog_data);
|
struct brw_gs_prog_data *gs_prog_data = brw_gs_prog_data(prog_data);
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
const fs_builder abld = bld.annotate("emit control data bits");
|
const fs_builder abld = bld.annotate("emit control data bits");
|
||||||
const fs_builder fwa_bld = bld.exec_all();
|
const fs_builder fwa_bld = bld.exec_all();
|
||||||
|
|
||||||
|
|
@ -8470,7 +8470,7 @@ fs_visitor::emit_nir_code()
|
||||||
ntb->s = this;
|
ntb->s = this;
|
||||||
ntb->devinfo = devinfo;
|
ntb->devinfo = devinfo;
|
||||||
ntb->nir = nir;
|
ntb->nir = nir;
|
||||||
ntb->bld = fs_builder(this, this->dispatch_width).at_end();
|
ntb->bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
emit_shader_float_controls_execution_mode(ntb);
|
emit_shader_float_controls_execution_mode(ntb);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ gs_thread_payload::gs_thread_payload(fs_visitor &v)
|
||||||
{
|
{
|
||||||
struct brw_vue_prog_data *vue_prog_data = brw_vue_prog_data(v.prog_data);
|
struct brw_vue_prog_data *vue_prog_data = brw_vue_prog_data(v.prog_data);
|
||||||
struct brw_gs_prog_data *gs_prog_data = brw_gs_prog_data(v.prog_data);
|
struct brw_gs_prog_data *gs_prog_data = brw_gs_prog_data(v.prog_data);
|
||||||
const fs_builder bld = fs_builder(&v, v.dispatch_width).at_end();
|
const fs_builder bld = fs_builder(&v).at_end();
|
||||||
|
|
||||||
/* R0: thread header. */
|
/* R0: thread header. */
|
||||||
unsigned r = reg_unit(v.devinfo);
|
unsigned r = reg_unit(v.devinfo);
|
||||||
|
|
@ -439,7 +439,7 @@ task_mesh_thread_payload::task_mesh_thread_payload(fs_visitor &v)
|
||||||
* the address to descriptors.
|
* the address to descriptors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(&v, v.dispatch_width).at_end();
|
const fs_builder bld = fs_builder(&v).at_end();
|
||||||
|
|
||||||
unsigned r = 0;
|
unsigned r = 0;
|
||||||
assert(subgroup_id_.file != BAD_FILE);
|
assert(subgroup_id_.file != BAD_FILE);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ fs_visitor::emit_interpolation_setup_gfx4()
|
||||||
{
|
{
|
||||||
struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW);
|
struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW);
|
||||||
|
|
||||||
fs_builder abld = fs_builder(this, dispatch_width).at_end().annotate("compute pixel centers");
|
fs_builder abld = fs_builder(this).at_end().annotate("compute pixel centers");
|
||||||
this->pixel_x = vgrf(glsl_type::uint_type);
|
this->pixel_x = vgrf(glsl_type::uint_type);
|
||||||
this->pixel_y = vgrf(glsl_type::uint_type);
|
this->pixel_y = vgrf(glsl_type::uint_type);
|
||||||
this->pixel_x.type = BRW_REGISTER_TYPE_UW;
|
this->pixel_x.type = BRW_REGISTER_TYPE_UW;
|
||||||
|
|
@ -107,7 +107,7 @@ fs_visitor::emit_interpolation_setup_gfx4()
|
||||||
fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)),
|
fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)),
|
||||||
fs_reg(brw_imm_v(0x11001100)));
|
fs_reg(brw_imm_v(0x11001100)));
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
abld = bld.annotate("compute pixel deltas from v0");
|
abld = bld.annotate("compute pixel deltas from v0");
|
||||||
|
|
||||||
this->delta_xy[BRW_BARYCENTRIC_PERSPECTIVE_PIXEL] =
|
this->delta_xy[BRW_BARYCENTRIC_PERSPECTIVE_PIXEL] =
|
||||||
|
|
@ -153,7 +153,7 @@ fs_visitor::emit_interpolation_setup_gfx4()
|
||||||
void
|
void
|
||||||
fs_visitor::emit_interpolation_setup_gfx6()
|
fs_visitor::emit_interpolation_setup_gfx6()
|
||||||
{
|
{
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
fs_builder abld = bld.annotate("compute pixel centers");
|
fs_builder abld = bld.annotate("compute pixel centers");
|
||||||
|
|
||||||
this->pixel_x = vgrf(glsl_type::float_type);
|
this->pixel_x = vgrf(glsl_type::float_type);
|
||||||
|
|
@ -606,7 +606,7 @@ fs_visitor::emit_alpha_test()
|
||||||
{
|
{
|
||||||
assert(stage == MESA_SHADER_FRAGMENT);
|
assert(stage == MESA_SHADER_FRAGMENT);
|
||||||
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
|
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
const fs_builder abld = bld.annotate("Alpha test");
|
const fs_builder abld = bld.annotate("Alpha test");
|
||||||
|
|
||||||
fs_inst *cmp;
|
fs_inst *cmp;
|
||||||
|
|
@ -680,7 +680,7 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld,
|
||||||
void
|
void
|
||||||
fs_visitor::do_emit_fb_writes(int nr_color_regions, bool replicate_alpha)
|
fs_visitor::do_emit_fb_writes(int nr_color_regions, bool replicate_alpha)
|
||||||
{
|
{
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
fs_inst *inst = NULL;
|
fs_inst *inst = NULL;
|
||||||
|
|
||||||
for (int target = 0; target < nr_color_regions; target++) {
|
for (int target = 0; target < nr_color_regions; target++) {
|
||||||
|
|
@ -815,7 +815,7 @@ fs_visitor::emit_urb_writes(const fs_reg &gs_vertex_count)
|
||||||
unreachable("invalid stage");
|
unreachable("invalid stage");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
fs_reg per_slot_offsets;
|
fs_reg per_slot_offsets;
|
||||||
|
|
||||||
|
|
@ -1091,7 +1091,7 @@ fs_visitor::emit_urb_writes(const fs_reg &gs_vertex_count)
|
||||||
void
|
void
|
||||||
fs_visitor::emit_urb_fence()
|
fs_visitor::emit_urb_fence()
|
||||||
{
|
{
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
fs_reg dst = bld.vgrf(BRW_REGISTER_TYPE_UD);
|
fs_reg dst = bld.vgrf(BRW_REGISTER_TYPE_UD);
|
||||||
fs_inst *fence = bld.emit(SHADER_OPCODE_MEMORY_FENCE, dst,
|
fs_inst *fence = bld.emit(SHADER_OPCODE_MEMORY_FENCE, dst,
|
||||||
brw_vec8_grf(0, 0),
|
brw_vec8_grf(0, 0),
|
||||||
|
|
@ -1111,7 +1111,7 @@ void
|
||||||
fs_visitor::emit_cs_terminate()
|
fs_visitor::emit_cs_terminate()
|
||||||
{
|
{
|
||||||
assert(devinfo->ver >= 7);
|
assert(devinfo->ver >= 7);
|
||||||
const fs_builder bld = fs_builder(this, dispatch_width).at_end();
|
const fs_builder bld = fs_builder(this).at_end();
|
||||||
|
|
||||||
/* We can't directly send from g0, since sends with EOT have to use
|
/* We can't directly send from g0, since sends with EOT have to use
|
||||||
* g112-127. So, copy it to a virtual register, The register allocator will
|
* g112-127. So, copy it to a virtual register, The register allocator will
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ cmod_propagation_test::cmod_propagation_test()
|
||||||
|
|
||||||
v = new cmod_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
v = new cmod_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
||||||
|
|
||||||
bld = fs_builder(v, v->dispatch_width).at_end();
|
bld = fs_builder(v).at_end();
|
||||||
|
|
||||||
devinfo->ver = 7;
|
devinfo->ver = 7;
|
||||||
devinfo->verx10 = devinfo->ver * 10;
|
devinfo->verx10 = devinfo->ver * 10;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ copy_propagation_test::copy_propagation_test()
|
||||||
|
|
||||||
v = new copy_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
v = new copy_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
||||||
|
|
||||||
bld = fs_builder(v, v->dispatch_width).at_end();
|
bld = fs_builder(v).at_end();
|
||||||
|
|
||||||
devinfo->ver = 4;
|
devinfo->ver = 4;
|
||||||
devinfo->verx10 = devinfo->ver * 10;
|
devinfo->verx10 = devinfo->ver * 10;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ saturate_propagation_test::saturate_propagation_test()
|
||||||
|
|
||||||
v = new saturate_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
v = new saturate_propagation_fs_visitor(compiler, ¶ms, prog_data, shader);
|
||||||
|
|
||||||
bld = fs_builder(v, v->dispatch_width).at_end();
|
bld = fs_builder(v).at_end();
|
||||||
|
|
||||||
devinfo->ver = 6;
|
devinfo->ver = 6;
|
||||||
devinfo->verx10 = devinfo->ver * 10;
|
devinfo->verx10 = devinfo->ver * 10;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ scoreboard_test::scoreboard_test()
|
||||||
v = new fs_visitor(compiler, ¶ms, NULL, &prog_data->base, shader, 8,
|
v = new fs_visitor(compiler, ¶ms, NULL, &prog_data->base, shader, 8,
|
||||||
false, false);
|
false, false);
|
||||||
|
|
||||||
bld = fs_builder(v, v->dispatch_width).at_end();
|
bld = fs_builder(v).at_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoreboard_test::~scoreboard_test()
|
scoreboard_test::~scoreboard_test()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue