nir: Add nir_builder_at
Creates and returns a nir_builder from a cursor. The nir_function_impl is retrieved using said cursor. This should be fine as long as it is not used on extracted control flow. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Faith Ekstrand <faith.ekstrand@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23883>
This commit is contained in:

committed by
Marge Bot

parent
b774d5f9d5
commit
a7cd206937
@@ -58,6 +58,18 @@ nir_builder_create(nir_function_impl *impl)
|
||||
return b;
|
||||
}
|
||||
|
||||
/* Requires the cursor to be inside a nir_function_impl. */
|
||||
static inline nir_builder
|
||||
nir_builder_at(nir_cursor cursor)
|
||||
{
|
||||
nir_cf_node *current_block = &nir_cursor_current_block(cursor)->cf_node;
|
||||
|
||||
nir_builder b;
|
||||
nir_builder_init(&b, nir_cf_node_get_function(current_block));
|
||||
b.cursor = cursor;
|
||||
return b;
|
||||
}
|
||||
|
||||
nir_builder MUST_CHECK PRINTFLIKE(3, 4)
|
||||
nir_builder_init_simple_shader(gl_shader_stage stage,
|
||||
const nir_shader_compiler_options *options,
|
||||
|
Reference in New Issue
Block a user