diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index a2f9f4ac2fe..8e858bd0480 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -1232,7 +1232,7 @@ fs_visitor::emit_gs_thread_end() 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; 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_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); 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 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) .exec_all(inst->force_writemask_all) .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_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 = (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()) 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 * 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); 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 || 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. */ 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"); 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); 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); @@ -7005,7 +7005,7 @@ fs_visitor::run_cs(bool allow_spilling) { assert(gl_shader_stage_is_compute(stage)); 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); diff --git a/src/intel/compiler/brw_fs_builder.h b/src/intel/compiler/brw_fs_builder.h index 2c2f48e790d..c9c33f9e79e 100644 --- a/src/intel/compiler/brw_fs_builder.h +++ b/src/intel/compiler/brw_fs_builder.h @@ -54,7 +54,7 @@ namespace brw { * Construct an fs_builder that inserts instructions into \p shader. * \p dispatch_width gives the native execution width of the program. */ - fs_builder(backend_shader *shader, + fs_builder(fs_visitor *shader, unsigned dispatch_width) : shader(shader), block(NULL), cursor(NULL), _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 * before instruction \p inst in basic block \p block. The default * execution controls and debug annotation are initialized from the * 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), _dispatch_width(inst->exec_size), _group(inst->group), @@ -832,7 +834,7 @@ namespace brw { return inst; } - backend_shader *shader; + fs_visitor *shader; fs_inst *BREAK() { return emit(BRW_OPCODE_BREAK); } fs_inst *DO() { return emit(BRW_OPCODE_DO); } diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 264091c8768..24910704e30 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -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); - 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 fwa_bld = bld.exec_all(); @@ -8470,7 +8470,7 @@ fs_visitor::emit_nir_code() ntb->s = this; ntb->devinfo = devinfo; 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); diff --git a/src/intel/compiler/brw_fs_thread_payload.cpp b/src/intel/compiler/brw_fs_thread_payload.cpp index be7283a9585..3e64c097d56 100644 --- a/src/intel/compiler/brw_fs_thread_payload.cpp +++ b/src/intel/compiler/brw_fs_thread_payload.cpp @@ -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_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. */ 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. */ - const fs_builder bld = fs_builder(&v, v.dispatch_width).at_end(); + const fs_builder bld = fs_builder(&v).at_end(); unsigned r = 0; assert(subgroup_id_.file != BAD_FILE); diff --git a/src/intel/compiler/brw_fs_visitor.cpp b/src/intel/compiler/brw_fs_visitor.cpp index 5696cad56fc..1492f779baa 100644 --- a/src/intel/compiler/brw_fs_visitor.cpp +++ b/src/intel/compiler/brw_fs_visitor.cpp @@ -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); - 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_y = vgrf(glsl_type::uint_type); 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(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"); this->delta_xy[BRW_BARYCENTRIC_PERSPECTIVE_PIXEL] = @@ -153,7 +153,7 @@ fs_visitor::emit_interpolation_setup_gfx4() void 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"); this->pixel_x = vgrf(glsl_type::float_type); @@ -606,7 +606,7 @@ fs_visitor::emit_alpha_test() { assert(stage == MESA_SHADER_FRAGMENT); 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"); fs_inst *cmp; @@ -680,7 +680,7 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld, void 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; 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"); } - 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; @@ -1091,7 +1091,7 @@ fs_visitor::emit_urb_writes(const fs_reg &gs_vertex_count) void 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_inst *fence = bld.emit(SHADER_OPCODE_MEMORY_FENCE, dst, brw_vec8_grf(0, 0), @@ -1111,7 +1111,7 @@ void fs_visitor::emit_cs_terminate() { 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 * g112-127. So, copy it to a virtual register, The register allocator will diff --git a/src/intel/compiler/test_fs_cmod_propagation.cpp b/src/intel/compiler/test_fs_cmod_propagation.cpp index b821e10a095..2d84524a3d0 100644 --- a/src/intel/compiler/test_fs_cmod_propagation.cpp +++ b/src/intel/compiler/test_fs_cmod_propagation.cpp @@ -83,7 +83,7 @@ cmod_propagation_test::cmod_propagation_test() 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->verx10 = devinfo->ver * 10; diff --git a/src/intel/compiler/test_fs_copy_propagation.cpp b/src/intel/compiler/test_fs_copy_propagation.cpp index 147f62027a2..363435e3804 100644 --- a/src/intel/compiler/test_fs_copy_propagation.cpp +++ b/src/intel/compiler/test_fs_copy_propagation.cpp @@ -72,7 +72,7 @@ copy_propagation_test::copy_propagation_test() 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->verx10 = devinfo->ver * 10; diff --git a/src/intel/compiler/test_fs_saturate_propagation.cpp b/src/intel/compiler/test_fs_saturate_propagation.cpp index 417d3a75f4f..a48fadf3b40 100644 --- a/src/intel/compiler/test_fs_saturate_propagation.cpp +++ b/src/intel/compiler/test_fs_saturate_propagation.cpp @@ -72,7 +72,7 @@ saturate_propagation_test::saturate_propagation_test() 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->verx10 = devinfo->ver * 10; diff --git a/src/intel/compiler/test_fs_scoreboard.cpp b/src/intel/compiler/test_fs_scoreboard.cpp index 7119057574d..48dfc2e9cf8 100644 --- a/src/intel/compiler/test_fs_scoreboard.cpp +++ b/src/intel/compiler/test_fs_scoreboard.cpp @@ -65,7 +65,7 @@ scoreboard_test::scoreboard_test() v = new fs_visitor(compiler, ¶ms, NULL, &prog_data->base, shader, 8, false, false); - bld = fs_builder(v, v->dispatch_width).at_end(); + bld = fs_builder(v).at_end(); } scoreboard_test::~scoreboard_test()