[Mesa-dev] [PATCH 1/2] nir: add const_index parameters to system value builder function

Eric Anholt eric at anholt.net
Mon Jul 23 20:07:27 UTC 2018


Karol Herbst <kherbst at redhat.com> writes:

> On Mon, Jul 23, 2018 at 7:02 PM, Eric Anholt <eric at anholt.net> wrote:
>> Karol Herbst <kherbst at redhat.com> writes:
>>
>>> this allows to replace some nir_load_system_value calls with the specific
>>> system value constructor
>>>
>>> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
>>> Signed-off-by: Karol Herbst <kherbst at redhat.com>
>>> ---
>>>  src/compiler/nir/nir_builder_opcodes_h.py | 21 +++++++++++++++++++--
>>>  1 file changed, 19 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py
>>> index 72cf5b4549d..0440875dade 100644
>>> --- a/src/compiler/nir/nir_builder_opcodes_h.py
>>> +++ b/src/compiler/nir/nir_builder_opcodes_h.py
>>> @@ -55,11 +55,28 @@ nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index)
>>>     return &load->dest.ssa;
>>>  }
>>>
>>> +<%
>>> +def sysval_decl_list(opcode):
>>> +   res = ''
>>> +   if opcode.indices:
>>> +      res += ', unsigned ' + opcode.indices[0].lower()
>>> +   return res
>>> +
>>> +def sysval_arg_list(opcode):
>>> +   args = []
>>> +   if opcode.indices:
>>> +      args.append(opcode.indices[0].lower())
>>> +   else:
>>> +      args.append('0')
>>> +   return ', '.join(args)
>>> +%>
>>
>> I was confused why only indices[0] was used, but it looks like system
>> values can only have one index.  Maybe assert(len(opcode.indices) <= 1)?
>> Other than that, these are:
>>
>> Reviewed-by: Eric Anholt <eric at anholt.net>
>
> maybe a static assert that verifies this instead? We could put it
> inside nir_intrinsics_c.py and add a note that nir_load_system_value
> needs to be adjusted in case we want more.

Either way is fine with me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180723/62e1f0d4/attachment.sig>


More information about the mesa-dev mailing list