[Mesa-dev] killing off the address reg in tgsi

Roland Scheidegger sroland at vmware.com
Fri Jan 30 09:13:55 PST 2015


Am 29.01.2015 um 22:39 schrieb Axel Davy:
> Hi,
> 
> for Gallium Nine we use ARR and UARL.
> 
> Do all cards supporting integers support indexing with an integer
> register ?
> If yes we could remove our UARL usage.
The idea would indeed have been that drivers would just do that on their
own if they have some kind of explicit address reg - after all they can
easily recognize that there's indirect addressing.

> 
> As for ARR, if all cards are ok with normal registers, we could use a
> normal one
> too, as long as we can get the same rounding behaviour (either to a
> integer directly
> if card supports it, or to float).
I'm pretty sure that at least for cards supporting native integers
round+f2i should be always doable.

The issue I have with these opcodes is really that newer languages just
don't support them. Neither glsl, d3d10, or opencl have anything like
ARR (at least this one is roughly the same in terms of arithmetic as c99
lrintf/lroundf) and certainly not like ARL (which would be "lfloorf"),
though both with the caveat that the hardware implementing these
instructions with the address reg directly do some clamp to some
"arbitrary" numbers. So, you can only really get them through "legacy"
stuff (d3d9 vs, opengl arb_vp), or possibly sometimes when emulating
things for not quite capable hardware (glsl will emit ARL instead of
UARL for not integer capable hardware, but I'm nearly sure the rounding
was done previously anyway).

So the idea was that drivers for hardware which actually does have such
combined round+f2i capability would probably be better off recognizing
such combinations on their own (which would also benefit if some glsl
shader would actually do some round + use the result for indirect
addressing). I didn't think though that there's newish hardware out
there whose indirect addressing is exposed exactly as those old vertex
shader models...

Roland


> 
> Axel Davy
> 
> On 29/01/2015 22:20, Roland Scheidegger wrote :
>> Hi,
>>
>> the address reg in tgsi is quite a nuisance. glsl-to-tgsi code assumes
>> that indirections can only be done through the address reg and has quite
>> some extra code to deal with this. Even though hardware and apis which
>> worked like that are definitely old by now.
>> Thus, I'm proposing the address reg be nuked. I am however not quite
>> sure what the implications for drivers are, other than I'm certain
>> llvmpipe can handle that already.
>> For that reason, I suspect at least initially a new cap bit would be
>> required so glsl-to-tgsi would skip the extra code. I tend to think
>> longer term it would be great if it could be nuked completely, I am
>> however not sure if that is easily done with drivers for old hw (such as
>> r300) - I guess if necessary we could keep operations such as ARL (or
>> even ARR though clearly not UARL!) and just define them to be usable
>> with temp regs.
>>
>> Opinions?
>>
>> Roland
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwICaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=6GeAqsaRV_4yCXpGZu8B7UAkQf-pPNexnVxGrfSktNw&s=VlPVXaJo2Mc6vTtc2rs-P4gzJfPC83JAGMfBkmQkHbI&e=
> 
> 



More information about the mesa-dev mailing list