brw: Make brw_builder() shader constructor use CFG if available
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Properly pick the end of the last block as a cursor.  Also remove the
default constructor since is not needed anymore.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34681>
This commit is contained in:
Caio Oliveira 2025-04-02 16:12:45 -07:00 committed by Marge Bot
parent ab8af62745
commit 3c7dd0ccf1

View file

@ -38,29 +38,24 @@ class brw_builder {
public:
/**
* Construct an brw_builder that inserts instructions
* at the end of \p shader. The \p dispatch_width gives
* the execution width, that may differ from the shader
* dispatch_width.
* at the end of \p shader. The optional \p dispatch_width
* gives the execution width to be used instead of the
* shader original dispatch_width.
*/
brw_builder(brw_shader *shader,
unsigned dispatch_width) :
unsigned dispatch_width = 0) :
shader(shader), block(NULL), cursor(NULL),
_dispatch_width(dispatch_width),
_dispatch_width(dispatch_width ? dispatch_width : shader->dispatch_width),
_group(0),
force_writemask_all(false),
annotation()
{
if (shader)
if (shader->cfg && shader->cfg->num_blocks > 0) {
block = shader->cfg->last_block();
cursor = &block->instructions.tail_sentinel;
} else {
cursor = (exec_node *)&shader->instructions.tail_sentinel;
}
/**
* Construct an brw_builder that inserts instructions into \p shader,
* using its dispatch width.
*/
explicit brw_builder(brw_shader *s = NULL) :
brw_builder(s, s ? s->dispatch_width : 0)
{
}
}
/**