[Mesa-dev] [PATCH 2/6] mesa/st/glsl_to_tgsi: Correct debug output for indirect access

Nicolai Hähnle nhaehnle at gmail.com
Tue Oct 10 12:01:20 UTC 2017


On 10.10.2017 13:15, Gert Wollny wrote:
> 
>>> +   os << "[";
>>> +   if (reg.reladdr)
>>> +      os << *reg.reladdr << "+";
>>> +   if (reg.reladdr2)
>>> +      os << *reg.reladdr2 << "+";
>>
>> This isn't how that works. reladdr2 is the relative address for 2D
>> register accesses; see has_index2 and index2D.
> 
> Actually, I don't like this part of the dump at all: it is not known
> from the register information I can access here whether an address
> which address register index goes where and if an address register is
> used at all. - and documentation on the issue is also very sparse. From
> the code accessing has_index2 I figured that the dump should look
> something like this: ?
> 
> template <typename st_reg>
> void dump_reg_access(std::ostream& os, const st_reg& reg)
> {
>     os << tgsi_file_names[reg.file];
>     if (reg.file == PROGRAM_ARRAY)
>        os << "(" << reg.array_id << ")";
> 
>     os << "[";
>     if (reg.reladdr)
>        os << *reg.reladdr << "+";
>     os << reg.index << "]";
> 
>     if (reg.has_index2) {
>        os << "[";
>        if (reg.reladdr2)
>           os << *reg.reladdr2 << "+";
>        os << reg.index2D << "]";
>     }

They should be the other way around, actually. index2D/reladdr2 are used 
for determining which constant buffer to use or which input/output 
vertex to reference in geometry/tessellation shaders. Those indices come 
first.

About the fact that reladdr can be present but it's not clear which 
register is actually used for the reladdr: totally agreed that this is 
pretty horrible code.

Perhaps a separate cleanup patch is in order where reladdr and reladdr2 
are appropriately modified when ARL instructions are generated.

Cheers,
Nicolai


> }
> 
> 
>>
>> Besides, you're not actually printing reg.index.
>>
>> Same for when you're printing the destination.
> 
> This I was already about to fix.
> 
> Many thanks for you comments (also the other ones).
> 
> Best,
> Gert
> 
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list