[Mesa-dev] [PATCH] nir: don't emit empty initializers for MSVC

Connor Abbott cwabbott0 at gmail.com
Thu May 2 19:36:17 UTC 2019


Whoops, that should be "radeonsi with radeonsi_enable_nir=true" since NIR
isn't enabled by default yet.

On Thu, May 2, 2019 at 9:35 PM Connor Abbott <cwabbott0 at gmail.com> wrote:

> This will crash at runtime, since it'll construct a "struct transform"
> with all NULL pointers, and then the loop below in ${pass_name}_block()
> will see that there's one transform in the array since it uses ARRAY_SIZE
> and then crash trying to access it.
>
> Running piglit with i965, or radeonsi will reproduce the crash.
>
> On Thu, May 2, 2019 at 7:52 PM Brian Paul <brianp at vmware.com> wrote:
>
>> This fixes a build failure with MSVC.
>>
>> ---
>>
>> I've compiled tested this, but not sure how to runtime test it.
>> ---
>>  src/compiler/nir/nir_algebraic.py | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/compiler/nir/nir_algebraic.py
>> b/src/compiler/nir/nir_algebraic.py
>> index 6db749e..dc25421 100644
>> --- a/src/compiler/nir/nir_algebraic.py
>> +++ b/src/compiler/nir/nir_algebraic.py
>> @@ -997,6 +997,9 @@ static const struct transform
>> ${pass_name}_state${state_id}_xforms[] = {
>>  % for i in state_xforms:
>>    { ${xforms[i].search.c_ptr(cache)},
>> ${xforms[i].replace.c_value_ptr(cache)}, ${xforms[i].condition_index} },
>>  % endfor
>> +% if state_xforms == []: # avoid empty initializers for MSVC
>> +  0
>> +% endif
>>  };
>>  % endfor
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190502/f8e41107/attachment.html>


More information about the mesa-dev mailing list