Skip to content

zink: adjust swizzled deref loads by the variable component offset

Mike Blumenkrantz requested to merge zmike/mesa:zink-swizzle into main

What does this MR do and why?

zink: adjust swizzled deref loads by the variable component offset

this code is intended to transform a block like:

  32    %306 = @load_interpolated_input (%34, %0 (0x0)) (base=3, component=2, dest_type=float32, io location=VARYING_SLOT_VAR3 slots=1)
  32x2  %307 = fsub %305, %306.xx

into derefs. the existing code generates this:

decl_var shader_in INTERP_MODE_NONE none vec2 #7 (VARYING_SLOT_VAR3.zw, 0, 0)
  32    %516 = deref_var &#7 (shader_in vec2)
  32x2  %517 = @load_deref (%516) (access=none)
  32    %518 = mov %517.z
error: src->swizzle[i] < num_components (../src/compiler/nir/nir_validate.c:216)

the problem is attempting to reapply the component offset to a variable which is already at an offset

fixes #10567 (closed)

Fixes: 17a35412 ("zink: re-rework i/o variable handling to make having variables entirely optional")

Edited by Mike Blumenkrantz

Merge request reports