[Mesa-dev] [PATCH] st/mesa: replace _mesa_sysval_to_semantic table with function

Brian Paul brianp at vmware.com
Tue Apr 12 13:51:27 UTC 2016


On 04/12/2016 04:56 AM, Emil Velikov wrote:
> Hi Brian,
>
> I can see that the fix is in, so just a question for posterity.
>
> On 11 April 2016 at 23:39, Brian Paul <brianp at vmware.com> wrote:
>> Instead of using an array indexed by SYSTEM_VALUE_x, just use a
>> switch statement.  This fixes a regression caused by inserting new
>> SYSTEM_VALUE_ enums but not updating the mapping to TGSI semantics.
>>
> Considering the switch has a default statement, is there any benefit
> of going that way (we won't get any compiler warnings as we add new
> values) over using designated initializer* for the const data ? I'm
> leaning (although I've not tried it) that MSVC 2013 should be fine
> with the latter. It seems to work fine with structs at the very least.

I guess I was thinking that if someone added a new SYSTEM_VALUE_ but 
wasn't working on Gallium, they wouldn't have to worry about this code. 
  But if someone was also working on gallium, they'd be sure to hit the 
assertion upon testing with a suitable piglit test.

Feel free to change the code if you think it can be improved.

-Brian



More information about the mesa-dev mailing list