[Mesa-dev] [PATCH 11/20] i965/fs: Append uniform entries to the gather table

Matt Turner mattst88 at gmail.com
Fri Oct 23 11:29:40 PDT 2015


On Fri, Oct 23, 2015 at 11:23 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> Abdiel Janulgue <abdiel.janulgue at linux.intel.com> writes:
>
>> This patch generates the gather table entries for ordinary uniforms
>> if they are present. The uniform constants here will later be packed
>> together with UBO constants.
>>
>> Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 18 +++++++++++++++++-
>>  1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index d240371..e39d821 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -1863,8 +1863,11 @@ fs_visitor::assign_constant_locations()
>>        }
>>     }
>>
>> -   stage_prog_data->nr_params = num_push_constants;
>>     stage_prog_data->nr_pull_params = num_pull_constants;
>> +   stage_prog_data->nr_params = 0;
>
> I doubt it's useful to set this to zero here only to calculate it again
> below.
>
>> +
>> +   unsigned const_reg_access[uniforms];
>
> VLAs are a non-standard extension to C++.  Usually I'd recommend to use
> the C++ standard library instead, but because it's banned from the i965
> back-end I guess the best you can get is new[]/delete[].

So... why not just use the extension to C++? Does some compiler we
care about not support them?

GCC does: https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html

Looks like this use would be allowed by clang as well:
http://clang.llvm.org/compatibility.html#vla


More information about the mesa-dev mailing list