[Mesa-dev] [PATCH 10/14] tgsi/ureg: don't call tgsi_sanity when it's too slow

Marek Olšák maraeo at gmail.com
Thu Aug 9 15:44:08 UTC 2018


On Thu, Aug 9, 2018 at 1:28 AM, Roland Scheidegger <sroland at vmware.com> wrote:
> Am 09.08.2018 um 01:55 schrieb Marek Olšák:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_ureg.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
>> index 92c98c763eb..c1c8851486e 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
>> @@ -2099,21 +2099,32 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
>>
>>     tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
>>
>>     if (0) {
>>        debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
>>                     ureg->domain[DOMAIN_DECL].count);
>>        tgsi_dump( tokens, 0 );
>>     }
>>
>>  #if DEBUG
>> -   if (tokens && !tgsi_sanity_check(tokens)) {
>> +   /* tgsi_sanity doesn't seem to return if there are too many constants. */
>> +   bool too_many_constants = false;
>> +   for (unsigned i = 0; i < ARRAY_SIZE(ureg->const_decls); i++) {
>> +      for (unsigned j = 0; j < ureg->const_decls[i].nr_constant_ranges; j++) {
>> +         if (ureg->const_decls[i].constant_range[j].last > 4096) {
>> +            too_many_constants = true;
>> +            break;
>> +         }
>> +      }
>> +   }
> Err, is it actually too slow, is there a bug in sanity checking or are you
> making it pass sanity but tgsi emitting garbage?

I don't know. It's possible that TGSI doesn't like when there are too
many CONST declarations, perhaps too many to fit into the declaration
and source operand tokens. On the other hand, we have
PIPE_CAP_LOAD_CONSTBUF, which switches glsl_to_tgsi to use LOAD, so
the CONST limit doesn't apply. It's possible that TGSI is indeed
incorrect with regard to CONST file usage, but I don't care as long as
piglit tests pass for large UBOs.

Marek


More information about the mesa-dev mailing list