[Mesa-dev] [PATCH 07/11] nir/lower_vec_to_movs: Handle partially SSA shaders
Eduardo Lima Mitev
elima at igalia.com
Thu Sep 10 23:07:19 PDT 2015
On 09/10/2015 08:38 PM, Jason Ekstrand wrote:
> On Thu, Sep 10, 2015 at 9:08 AM, Eduardo Lima Mitev <elima at igalia.com> wrote:
>> On 09/10/2015 02:50 AM, Jason Ekstrand wrote:
>>> ---
>>> src/glsl/nir/nir_lower_vec_to_movs.c | 18 ++++++++++++++++--
>>> 1 file changed, 16 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c
>>> index e297cb8..7d31e36 100644
>>> --- a/src/glsl/nir/nir_lower_vec_to_movs.c
>>> +++ b/src/glsl/nir/nir_lower_vec_to_movs.c
>>> @@ -34,6 +34,7 @@
>>>
>>> struct vec_to_movs_state {
>>> nir_shader *shader;
>>> + nir_function_impl *impl;
>>> };
>>>
>>> static bool
>>> @@ -107,8 +108,20 @@ lower_vec_to_movs_block(nir_block *block, void *void_state)
>>> continue; /* The loop */
>>> }
>>>
>>> - /* Since we insert multiple MOVs, we have to be non-SSA. */
>>> - assert(!vec->dest.dest.is_ssa);
>>> + if (vec->dest.dest.is_ssa) {
>>> + /* Since we insert multiple MOVs, we have a register destination. */
>>> + nir_register *reg = nir_local_reg_create(state->impl);
>>> + reg->num_components = vec->dest.dest.ssa.num_components;
>>> +
>>> + nir_ssa_def_rewrite_uses(&vec->dest.dest.ssa, nir_src_for_reg(reg));
>>> +
>>> + assert(list_empty(&vec->dest.dest.ssa.uses));
>>> + assert(list_empty(&vec->dest.dest.ssa.if_uses));
>>> +
>>> + vec->dest.dest = nir_dest_for_reg(reg);
>>> + vec->dest.dest.reg.parent_instr = &vec->instr;
>>> + list_addtail(&vec->dest.dest.reg.def_link, ®->defs);
>>> + }
>>>
>>> unsigned finished_write_mask = 0;
>>>
>>> @@ -151,6 +164,7 @@ nir_lower_vec_to_movs_impl(nir_function_impl *impl)
>>> struct vec_to_movs_state state;
>>>
>>> state.shader = impl->overload->function->shader;
>>> + state.impl = impl;
>>>
>>
>> Since 'shader' can be dereferenced from 'impl', wouldn't be enough to
>> keep 'impl' as state and dereference 'shader' the two times it's needed?
>
> Sure, we can do that. In fact, we can just pass the impl and drop the
> patch to use the state struct all together. Would that be better?
Yeah, I think that would be simpler and cleaner. Thanks.
> --Jason
>
>> Eduardo
>>
>>> nir_foreach_block(impl, lower_vec_to_movs_block, &state);
>>> }
>>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list