Commit graph

223686 commits

Author SHA1 Message Date
Faith Ekstrand
fb2c44bc51 compiler/rust/smallvec: Implement Extend<T> for SmallVec<T>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41941>
2026-06-03 18:50:41 +00:00
Faith Ekstrand
1a34d1ed3a compiler/rust/smallvec: Implement Deref[Mut]<Target = [T]>
We now get last_mut() for free since it's part of `&mut [T]`.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41941>
2026-06-03 18:50:41 +00:00
Faith Ekstrand
ab017fd8fc compiler/rust/smallvec: Add a push_mut() method
This is analagous to `Vec::push_mut()`, which was stabilied in Rust
1.95.0.  Since we can't use that rust version yet, we internally
implement it as `push()` followed by `last_mut().unwrap()`.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41941>
2026-06-03 18:50:41 +00:00
Faith Ekstrand
1eaee3b619 compiler/rust/smallvec: Implement Clone, Default, and new()
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41941>
2026-06-03 18:50:41 +00:00
Marek Olšák
4373a48457 radv: don't leave SPI_PS_INPUT_ENA uninitialized with NULL PS to fix a hang
Fixes: 22e40edfb9 - radv: move SPI_PS_INPUT_ENA emission into radv_emit_ps_state
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15579

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42001>
2026-06-03 18:25:19 +00:00
Ashley Smith
fea2af1b7b panfrost: Fix tiler_desc assignment
Bifrost/valhall descriptor pointers are incorrectly assigned

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 11fcb23f74 ("pan/desc: Add a struct for valhall/bifrost to the union in pan_tiler_context")
Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41126>
2026-06-03 17:42:57 +00:00
Pavel Ondračka
5b6e9374b6 r300: fix R300_VAP_TCL_BYPASS state leak
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This fixes state leakage when using the RADEON_DEBUG=notcl debug option.
This manifested as heavy desktop corruption when running GL clients with
this flag, since the R300_VAP_TCL_BYPASS state would leak into other HWTCL
users such as Xorg/glamor or Wayland compositors.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41996>
2026-06-03 17:23:11 +00:00
Job Noorman
67b3f7166a ir3: don't store shader_options in the cache
It's quite large (228B) and is only needed during compilation.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41994>
2026-06-03 16:48:37 +00:00
Job Noorman
2c5fdc16eb ir3: don't use bitfields in ir3_shader_output
Using bitfields results in nondeterministic bit patterns in the unused
bits. Since ir3_shader_output is stored in the cache, this makes it
difficult to verify cache equality between different builds.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41999>
2026-06-03 16:25:32 +00:00
Karol Herbst
aaf9e01c69 rusticl/util: fix rustc-1.95 compilation error
Somehow newer rustc complains about into(), just use to_owned() instead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41998>
2026-06-03 16:06:40 +00:00
squidbus
74665ac901 kk: Support VK_EXT_primitive_topology_list_restart
Limited only to if the user explicitly requests it, to avoid unroll costs
otherwise.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41888>
2026-06-03 15:51:53 +00:00
squidbus
7051f481c0 kk: Support VK_EXT_primitive_restart_index
Requires unrolling, but only if the user explicitly requests a non-standard
restart index.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41888>
2026-06-03 15:51:53 +00:00
squidbus
685e0c9891 kk: Support VK_EXT_custom_resolve
Similar to RADV, restarts render pass with resolve attachments. Not
the most ideal for tiling, but we don't even use native resolve for
built-in modes due to Metal format limitations.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41888>
2026-06-03 15:51:52 +00:00
squidbus
2263841ced kk: Support VK_EXT_blend_operation_advanced
Already supported by blend lowering, just needs to be wired up.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41888>
2026-06-03 15:51:51 +00:00
squidbus
8a65042bee kk: Support VK_EXT_vertex_attribute_robustness
Functionality is the same as provided by maintenance9, which is enabled.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41888>
2026-06-03 15:51:51 +00:00
Caio Oliveira
52ad6f58ec intel/gen: Support symbolic print/parse of BFN function
Use the format from src/util/lut.h.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Caio Oliveira
b74eff31d9 util: Add runtime parser for boolean lookup tables
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
0dcca5ad8c jay: Unroll loops before lowering deferred URB writes
Multiview often involves a loop over view indexes, and our output
handling assumes that everything is constant-indexed.  Unrolling
the loops takes care of this.  (brw already does this.)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
191dc6cb81 jay: Add an INTEL_JAY=all option
This enables Jay for all shader stages it currently supports.
Less typing than vs,tes,fs,cs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
4d49efc831 jay: Add tessellation evaluation shader support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
06c19e86ef jay: Pass proper simd_width to brw_nir_apply_key for fragment shaders
Thanks to Caio Marcelo for noticing this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
bfa07e906a jay: Implement fragment shader barycentrics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
7be50b714c jay: Don't swap FS interpolation .yz deltas
load_fs_interp_deltas wants .yz swapped, but load_input_vertex does not.
For simplicity, keep the payload fields in hardware order and have the
individual intrinsics swap.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
d89a0b486a jay: Implement dual color blending (but require SIMD16)
It's mildly tempting to reuse the src0_alpha source for color1 since
the two features should never overlap, but for now we add an extra
optional source.

We require SIMD16 for now as we only have SIMD16 messages.  Eventually,
we're likely to want to support SIMD32 with 2x16 sends, but this gets
us going for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
79fda8977e jay: Drop render target stores with unconditional discards
Surprisingly, this actually appears to come up.  Two Baldur's Gate 3
shaders optimized away to have unconditional "demote" in a shader with
no other side-effects, meaning no writes occur and we can eliminate the
entire program.  One of the shaders still did a fair amount of math to
produce color values that were never used.

We introduce a pass to detect store_render_target_intel intrinsics
where discard == true and eliminate them.  We then DCE and see if we
eliminated the entire program other than "demote" or "terminate" and
drop those too.  We then add back a Null RT store if needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
cbd572e8d7 jay: Fix null render target writes
jay_emit_fb_writes recognizes target < 0 to mean a null render target
write, so we want to avoid clamping it here.  We clamp it there already.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
b9233e4a35 jay: Implement viewport index FS input
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
b1b579293a jay: Handle facing that differs across subspans
Will be useful for multipolygon modes.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Kenneth Graunke
e3d7d4a77d jay: Generalize EXTRACT_LAYER to take an arbitrary mask
This will let us use it for the other per-pair-of-subspan fields too.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Alyssa Rosenzweig
2c9df4caad jay: workaround the while bug
fixes dEQP-VK.reconvergence.maximal.compute.nesting2.6.2

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Alyssa Rosenzweig
ccf936dd9f jay: fix mismatched files with predication
fixes dEQP-VK.rasterization.line_continuity.line-strip

jay shader validation failed (after jay_opt_propagate_backwards):
   invalid instruction in block 7: f281 = (-uf55/uf55)cmp.s32.ne u265, 0xFFFFFFFF
   assertion failed at ../src/intel/compiler/jay/jay_validate.c:233
   jay_inst_get_default(I)->file == dst.file

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:20 +00:00
Alyssa Rosenzweig
31d02365d8 jay/assign_flags: require ballots to be in the balloted src
otherwise we get garbage in the other lanes. this was a pain to debug.
dEQP-VK.subgroups.clustered.compute.subgroupclusteredand_bvec2

this should be optimized (and maybe reworked/simplified too) but now this should
be /correct/ at least.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
8ff543ec6a jay: fix 8/16-bit inline_data loads
dEQP-VK.spirv_assembly.instruction.compute.untyped_pointers.vulkan_memory_model.type_punning.load.push_constant.vec4_float16_to_float64

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
a110a4a6d6 jay/validate: add validation for bogus uflag cases
this would've caught the previous bug

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
8b75e06196 jay: add unit test for bogus copyprop case
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
16927d537c jay: avoid bogus copyprop with cmods
fixes dEQP-VK.sparse_resources.shader_intrinsics.3d_sparse_fetch.r16.503_137_3

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Kenneth Graunke
65697d6438 jay: Remember sp_delta_B when rematerializing stack pointer lane 0
The stack pointer starts out at b.shader->scratch_size, plus per-lane
offsets.  Every time we spill/fill, we adjust the stack pointer to
the offset for our desired memory location, and leave it there.  Over
the course of each block's spills/fills, we track the current delta from
the original value, and restore it to there at the end of the block.

However, when we started clobbering lane 0 and rematerializing it,
we were recreating it as the original base value (b.shader->scratch_size
+ sizeof(uint32_t) * 0).  We need to include sp_delta_B too, or else we
will calculate our deltas incorrectly for that lane, and restore it
incorrectly at the end of the block too.

Found while debugging the issue fixed by the previous commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Kenneth Graunke
5e157f3e6a jay: Fix scratch surface address save/restore
The idea here is that the scratch surface address is stored in
ADDRESS_REGISTER, while per-lane offsets are stored in `sp', an
array of UGPR[dispatch_width].  When we encounter an opcode that
needs to clobber the address register, we stash it in the first
UGPR of `sp'.  This clobbers the first lane offset, but that's
easy to reconstruct since it's lane 0.  When we need to spill/fill,
we restore the address register and rematerialize the offset for
lane 0.

This is all good.  However, we were saving the address register
every time we found an opcode that clobbered it...even if we'd
_already_ clobbered it.  So if you had back to back shuffles,
the first would save the scratch surface address, and the second
would save...some part of the first shuffle.  So we'd never get
the scratch address back again.  Easy fix, only save if valid.

Fixes misrendering in Baldurs Gate 3 compute shaders.

Fixes: 64acab1d69 ("jay/lower_spill: use 1 less temporary")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
40276305fa jay/to_binary: big clean up post-gen
instead of appending instructions like brw_eu helpers, just construct a single
gen_inst at a time. this involves a lot less indirection.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
ee72fcc8fc jay: lower JAY_OPCODE_LOOP_ONCE earlier
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
6708364d83 jay/lower_scoreboard: allow multiple jumps
for next commit

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
41abff84ec jay: clang-format
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
5ff84fedc1 jay: drop dead if
relic from before we had npot stuff wired good.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
96c9878153 jay/partition: reduce 16-bit partitioning more
affects conversions etc.

SIMD16:
   Totals from 811 (30.64% of 2647) affected shaders:
   Instrs: 1710558 -> 1709635 (-0.05%); split: -0.17%, +0.12%
   CodeSize: 25412768 -> 25417424 (+0.02%); split: -0.21%, +0.23%

SIMD32:
   Totals from 1070 (40.42% of 2647) affected shaders:
   Instrs: 2368611 -> 2327748 (-1.73%); split: -1.89%, +0.17%
   CodeSize: 35487424 -> 34847968 (-1.80%); split: -1.92%, +0.12%

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
1d1598d6d7 jay/register_allocate: don't hang if a block is missing
handle gracefully.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
87ce33bbf3 jay: replace BYTE/WORD_PACK with a simple MOV
Equivalent now that the IR allows it.

For the dynamic case:

< (32&W)      mov.u16 g0, g38<16,8,2>                             │ I@1
---
> (32&W)      mov.u16 g0, g38<2>                                  │ I@1

For the constant case it's actually better since copyprop can see through it:

< (1&W)       mov.u32 u0.0, 0xaaaaaaaa                            │
< (32&W)      mov.u16 g1, u0.0                                    │ I@1
---
> (32&W)      mov.u16 g0, 0xaaaa                                  │

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
6bf1dc6a48 jay: replace GPR_FROM_UGPRs with a simple CVT
use the new implicit UGPR-vector-source-as-GPR mechanism to avoid the special
op. the new code gen is slightly different but not meaningfully worse:

(32)        mov.u32 g14, g2:u16                                 │
(32)        mov.f32 acc0, g14<4>:u8                             │ I@1
(32)        mul.f32 g18, acc0, 0x3d800000 /* 0.0625 */          │
(32)        mov.u32 g20, g14.1<4>:u8                            │ I@1
(32)        mov.f32 acc0, g20<4>:u8                             │ I@1
(32)        mul.f32 acc0, acc0, 0x3d800000 /* 0.0625 */         │

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
1ce2d57a31 jay: rework lane ID calculations
Previously we had special ops doing data model breaking things on GPRs. But
there's no real reason for that, we can calculate lane IDs as UGPR vectors
within the Jay data model just fine. Adjust jay_ir/jay_validate to define packed
16-bit UGPR vectors, giving them the natural semantics, then use that to
calculate lane IDs, peeling back all the hacks we added along the way.

This also unfortunately pessimizes inverse_ballot() but only in a corner case
that could be revisited later. Stats are net positive.

In addition to the code clean up, this has 3 other benefits:

* Now that we can rematerialize the lane ID code anywhere we want, we could
  theoretically reduce register pressure in some scenarios. Stats show this
  doesn't help in the current implementation, though.

* Now that we can calculate lane IDs in control flow, the issues with divergent
  function calls all go away. (Well, the lane ID issue. There are other issues.)

* Now that we use UGPRs for this, we don't need a stride=16 GRF in shaders that
  don't actually use 16-bit math, meaning less shuffling from bad partitions.
  That's reflected in the positive stats here.

SIMD16:
   Totals from 1643 (62.07% of 2647) affected shaders:
   Instrs: 2227750 -> 2221032 (-0.30%); split: -0.44%, +0.14%
   CodeSize: 33138416 -> 33034224 (-0.31%); split: -0.52%, +0.20%

SIMD32:
   Totals from 1643 (62.07% of 2647) affected shaders:
   Instrs: 2864583 -> 2806217 (-2.04%); split: -2.22%, +0.19%
   CodeSize: 43088064 -> 42171504 (-2.13%); split: -2.29%, +0.17%

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
3ededec51c jay: generalize jay_extract_range_post_ra
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00
Alyssa Rosenzweig
0adcaeced4 jay/to_binary: relax packed float restriction
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
2026-06-03 15:23:19 +00:00