Skip to content
  • Pierre-Eric Pelloux-Prayer's avatar
    mesa: extend GLSLZeroInit semantics · ea289d15
    Pierre-Eric Pelloux-Prayer authored
    
    
    This commit introduces a new way to zero-init variables but keep the
    old one to not break any existing behavior.
    
    With this change GLSLZeroInit becomes an integer, with the following
    possible values:
     - 0: no 0 init
     - 1: current behavior
     - 2: new behavior. Similar to 1, except ir_var_function_out type are
          0 initialized but ir_var_shader_out.
    
    The rationale behind 2 is: zero initializing ir_var_shader_out can
    prevent some optimization where out variables are completely eliminated
    when not written to.
    
    On the other hand, zero initializing "ir_var_function_out" has no
    effect on correct shaders but typically helps shadertoy since the main
    function is:
    
       void mainImage(out vec4 fragColor) { ... }
    
    So with this change we're sure that fragColor will always get a value.
    
    Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
    Part-of: <!4607>
    ea289d15