diff options
author | Jason Ekstrand <[email protected]> | 2015-12-29 09:56:44 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-29 13:44:05 -0800 |
commit | 0119773ffca586c9e51fa19248c3dfaab0500b25 (patch) | |
tree | 8a2fc7dd315a956146e69c41115cf7e17a5b1e2d /src/gallium/auxiliary | |
parent | 55ca5b0e74dff2b2f7df57af332b73e2a1b7d081 (diff) |
nir/builder: Add an init function that creates a simple shader for you
A hugely common case when using nir_builder is to have a shader with a
single function called main. This adds a helper that gives you just that.
This commit also makes us use it in the NIR control-flow unit tests as well
as tgsi_to_nir and prog_to_nir.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Acked-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/nir/tgsi_to_nir.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 01426e86e61..94d992b0031 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -1968,14 +1968,10 @@ tgsi_to_nir(const void *tgsi_tokens, tgsi_scan_shader(tgsi_tokens, &scan); c->scan = &scan; - s = nir_shader_create(NULL, tgsi_processor_to_shader_stage(scan.processor), - options); - - nir_function *func = nir_function_create(s, "main"); - nir_function_impl *impl = nir_function_impl_create(func); - - nir_builder_init(&c->build, impl); - c->build.cursor = nir_after_cf_list(&impl->body); + nir_builder_init_simple_shader(&c->build, NULL, + tgsi_processor_to_shader_stage(scan.processor), + options); + s = c->build.shader; s->num_inputs = scan.file_max[TGSI_FILE_INPUT] + 1; s->num_uniforms = scan.const_file_max[0] + 1; |