[Mesa-dev] [PATCH 1/2] glsl: add driconf to zero-init unintialized vars

Alan Swanson reiver at improbability.net
Mon Jun 27 11:13:15 UTC 2016


On 2016-06-25 13:37, Rob Clark wrote:
> Some games are sloppy.. perhaps because it is defined behavior for DX 
> or
> perhaps because nv blob driver defaults things to zero.
> 
> So add driconf param to force uninitialized variables to default to 
> zero.
> 
> This issue was observed with rust, from steam store.  But has surfaced
> elsewhere in the past.
> 
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
> Note that I left out the drirc bit, since not entirely sure how to
> identify this game.  (I don't actually have the game, just working off
> of an apitrace)
> 
> Possibly worth mentioning that for the shaders using uninitialized vars
> having zero-initializers lets constant-propagation get rid of a whole
> lot of instructions.  One shader I saw dropped to less than half of
> it's original instruction count.

If the default for uninitialised variables is undefined, then with the
reported shader optimisations why bother with the (DRI) option when
zeroing could still essentially be classed as undefined?

Cuts the patch down to just the src/compiler/glsl/ast_to_hir.cpp change.

-- 
Alan.



More information about the mesa-dev mailing list