diff options
author | Eduardo Lima Mitev <[email protected]> | 2015-07-22 09:34:35 +0200 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-03 09:40:47 -0700 |
commit | 59006d3ad3ed5d29e84afa5931f425344e2ef658 (patch) | |
tree | a69ca1990713f6252b2ed4d78c08ed0051f4fe4b /src/mesa/drivers | |
parent | 4023b55fdd7005a8a100637c229a1c40648cdd2b (diff) |
i965/nir/vec4: Add shader function implementation
It basically allocates registers local to a function in a nir_locals map,
then emits all its control-flow blocks.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 722f9a1f4c5..01f88e641e7 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -414,6 +414,7 @@ public: virtual dst_reg *make_reg_for_system_value(int location, const glsl_type *type) = 0; + dst_reg *nir_locals; src_reg *nir_inputs; unsigned *nir_uniform_driver_location; dst_reg *nir_system_values; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 989b8e3b6b5..f8bcbb7cd42 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -241,7 +241,16 @@ vec4_visitor::nir_setup_builtin_uniform(nir_variable *var) void vec4_visitor::nir_emit_impl(nir_function_impl *impl) { - /* @TODO: Not yet implemented */ + nir_locals = ralloc_array(mem_ctx, dst_reg, impl->reg_alloc); + + foreach_list_typed(nir_register, reg, node, &impl->registers) { + unsigned array_elems = + reg->num_array_elems == 0 ? 1 : reg->num_array_elems; + + nir_locals[reg->index] = dst_reg(GRF, alloc.allocate(array_elems)); + } + + nir_emit_cf_list(&impl->body); } void |