Skip to content
  • Ian Romanick's avatar
    glsl-1.10: Avoid NIR optimization in gl_FrontFacing test · 372d06b5
    Ian Romanick authored and Marge Bot's avatar Marge Bot committed
    
    
    Use some non-obvious arithmetic to try to avoid some NIR optimizations
    that hide a bug in the Intel compiler backend for Gfx12+ (Tigerlake and
    newer) GPUs.  Basically, when NIR sees
    
       x = (gl_FrontFacing ? -1.0 : 1.0) * a;
    
    it converts it to
    
        x = gl_FrontFacing ? -a : a;
    
    This avoids the bad code generation for the (gl_FrontFacing ? -1.0 :
    1.0) case.
    
    v2: Make this a separate test.  Suggested by Marcin.
    
    Reviewed-by: default avatarMarcin Ślusarz <marcin.slusarz@intel.com>
    Part-of: <!627>
    372d06b5