Skip to content

r300: Enable NIR to TGSI also with swctl

Pavel Ondračka requested to merge ondracka/mesa:r300_swtcl_nir into main

We currently request NIR for fragment shaders and gallivm requests TGSI for vertex shaders, so we end with TGSI but with some extra bugs as the core mesa is not ready for this inconsistency.

This just sets consistent PIPE_SHADER_CAP_PREFERRED_IR across stages for both hwtcl and swtcl chipsets with NIR by default. The first patch is needed to prevent some fallout from the switch inspired by what i915 does.

There are some regressions from the switch to NIR. However in general piglit is happy:

Before   skip: 52432, pass: 4979, warn: 4, fail: 270, crash: 23
After    skip: 52432, pass: 5014, warn: 4, fail: 242, crash: 16

For the regressed tests:

shaders@ssa@fs-if-def-else-break will be fixed with !14661 (merged)

spec@glsl-1.10@execution@glsl-fs-conditional-output-write is the infamous r300 FP: Compiler Error: Rewrite of inst 2 failed Can't allocate source for Inst 8 src_type=1 new_index=2 new_mask=3

spec@glsl-1.10@execution@loops@glsl-fs-unroll-explosion is already tracked in #5821

I get 5 new crashes, for example: spec@glsl-1.10@execution@variable-indexing@vs-output-array-vec4-index-wr. There is a NIR validation failure after nir_lower_locals_to_regs that I have no clue about. Output here nir-validation.txt if anyone sees anything obvious.

And few some new fails like:

spec@glsl-1.20@execution@fs-const-array-of-struct
spec@glsl-1.20@execution@fs-const-array-of-struct-of-array
spec@glsl-1.20@execution@fs-function-inout-array-of-structs
spec@glsl-1.20@execution@fs-vec4-const-array-indirect-access-008-elements

Regarding the new crashes, this doesn't happen with hwtcl, so its likely we need to set some cap or something, however I tried to set other caps to be 100% identical to what i915 does (i.e., explicitly set PIPE_SHADER_CAP_INT16 and PIPE_SHADER_CAP_FP16* to 0 and remove the PIPE_SHADER_CAP_SUBROUTINES which we set to 0 now but i915 does not), but I don't see any changes.

Edited by Pavel Ondračka

Merge request reports