Skip to content

st/mesa: Replace glsl_to_tgsi() with glsl_to_nir() and nir_to_tgsi().

Emma Anholt requested to merge anholt/mesa:st-glsl-ntt into main

From the main commit:

    st/mesa: Always generate NIR from GLSL, and use nir_to_tgsi for TGSI drivers.
    
    The NIR path through the frontend is effectively the only one maintained
    for a quite a while now.  We can see that effect with !15540, where the
    TGSI generation path was regressed to assertion fail on real-world
    shaders, and nobody noticed until I came along trying to test the
    NIR-to-TGSI transition.
    
    We already have a nir_to_tgsi() call for translating NIR representation
    for ARB programs into TGSI before handing them off to the driver.  This
    change makes that path get taken for GLSL programs as well.
    
    This is the minimum change to get all the drivers on NIR from GLSL, to
    give a simple commit to bisect too.  The dead code removal comes next.
    
    Now every driver benefits from shared NIR optimizations for GLSL, and we
    can start retiring GLSL optimizations.

Removing 20k lines and unifying major paths through the compiler feels well worth finishing this off. Some remaining issues:

  • Lots of piglit regressions on SOFTPIPE_DEBUG=use_tgsi (such as getuniform-03 -auto -fbo), at least some of which are an issue in gl_nir_link_uniforms.c with buffer overflows in the UniformRemapTable
  • Need to set size of UBOs (virgl)
  • Need to translate HW atomics (virgl)
  • ntt needs to set cont/break labels (svga, nv30, nv50)
  • ntt needs to support PIPE_CAP_LOAD_CONSTBUF (nv, llvmpipe, GL using rasterpos/select/feedback modes)
  • ntt needs to declare SSBO's BUFFERs (r600, nv50 llvmpipe)
  • ntt needs to set ArrayID for GS inputs (r600)
  • ntt needs to set ArrayID for tess outputs (svga)
  • ntt needs to emit sample index in image load/store (r600, nouveau, llvmpipe)
  • ntt should probably support emitting txp (i915g, r300) (!11912 (merged))
  • ntt should probably support generating TXF_LZ (nv, llvmpipe)
  • ntt should set ALU insn Precise flag based on nir's exact. (nv50, r600, svga) (!14201 (merged))
  • !7658 (merged) fixes
  • depth clamp lowering (virgl)
  • test for regressions on etnaviv
  • test for regressions on nv30 (!14130 (merged))
  • test for regressions on nv50 (!15541 (closed)) (included)
  • test for regressions on nvc0 (!15949 (merged) or !15932 (merged) and !15934 (merged))
  • test for regressions on r300 (!14096 (merged))
  • test for regressions on r600 (!14319 (merged)) (included)
  • test for regressions on virgl (!13295 (merged)) (included)
  • test for regressions on svga (!14160 (merged) couldn't get a regression test from vmware but they acked)
  • test for regressions on swr (gone in !11264 (merged))
Edited by Emma Anholt

Merge request reports