diff options
author | Kenneth Graunke <[email protected]> | 2016-08-24 19:09:57 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-08-25 19:18:24 -0700 |
commit | 93bfa1d7a2e70a72a01c48a04c208845c22f9376 (patch) | |
tree | e15311ebb02be905f41d94d09afb5e5c1ac5ca65 /src/compiler | |
parent | 8479b03c5826f32355775d865d99d69c829e65bb (diff) |
nir: Change nir_shader_get_entrypoint to return an impl.
Jason suggested adding an assert(function->impl) here. All callers
of this function actually want ->impl, so I decided just to change
the API.
We also change the nir_lower_io_to_temporaries API here. All but one
caller passed nir_shader_get_entrypoint(), and with the previous commit,
it now uses a nir_function_impl internally. Folding this change in
avoids the need to change it and change it back.
v2: Fix one call I missed in ir3_compiler (caught by Eric).
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir.h | 8 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_bitmap.c | 7 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_io_to_temporaries.c | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_passthrough_edgeflags.c | 4 |
4 files changed, 9 insertions, 14 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 1407b2d9f0e..d0dfb0d04b3 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1902,7 +1902,7 @@ typedef struct nir_shader { gl_shader_stage stage; } nir_shader; -static inline nir_function * +static inline nir_function_impl * nir_shader_get_entrypoint(nir_shader *shader) { assert(exec_list_length(&shader->functions) == 1); @@ -1910,7 +1910,8 @@ nir_shader_get_entrypoint(nir_shader *shader) nir_function *func = exec_node_data(nir_function, func_node, node); assert(func->return_type == glsl_void_type()); assert(func->num_params == 0); - return func; + assert(func->impl); + return func->impl; } #define nir_foreach_function(func, shader) \ @@ -2378,7 +2379,8 @@ bool nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes); bool nir_lower_locals_to_regs(nir_shader *shader); -void nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint, +void nir_lower_io_to_temporaries(nir_shader *shader, + nir_function_impl *entrypoint, bool outputs, bool inputs); void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint); diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c index e182579a398..bd5c30f8dc1 100644 --- a/src/compiler/nir/nir_lower_bitmap.c +++ b/src/compiler/nir/nir_lower_bitmap.c @@ -128,12 +128,7 @@ void nir_lower_bitmap(nir_shader *shader, const nir_lower_bitmap_options *options) { - nir_function *function; - assert(shader->stage == MESA_SHADER_FRAGMENT); - function = nir_shader_get_entrypoint(shader); - - if (function->impl) - lower_bitmap_impl(function->impl, options); + lower_bitmap_impl(nir_shader_get_entrypoint(shader), options); } diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c b/src/compiler/nir/nir_lower_io_to_temporaries.c index 8cbf6838ee8..4f615d3e3bd 100644 --- a/src/compiler/nir/nir_lower_io_to_temporaries.c +++ b/src/compiler/nir/nir_lower_io_to_temporaries.c @@ -148,7 +148,7 @@ create_shadow_temp(struct lower_io_state *state, nir_variable *var) } void -nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint, +nir_lower_io_to_temporaries(nir_shader *shader, nir_function_impl *entrypoint, bool outputs, bool inputs) { struct lower_io_state state; @@ -157,7 +157,7 @@ nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint, return; state.shader = shader; - state.entrypoint = entrypoint->impl; + state.entrypoint = entrypoint; if (inputs) exec_list_move_nodes_to(&shader->inputs, &state.old_inputs); diff --git a/src/compiler/nir/nir_lower_passthrough_edgeflags.c b/src/compiler/nir/nir_lower_passthrough_edgeflags.c index c570c8ef333..f34078c8999 100644 --- a/src/compiler/nir/nir_lower_passthrough_edgeflags.c +++ b/src/compiler/nir/nir_lower_passthrough_edgeflags.c @@ -52,7 +52,5 @@ lower_impl(nir_function_impl *impl) void nir_lower_passthrough_edgeflags(nir_shader *shader) { - nir_function *function = nir_shader_get_entrypoint(shader); - if (function->impl) - lower_impl(function->impl); + lower_impl(nir_shader_get_entrypoint(shader)); } |