Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ hashes are given where a change is easiest to understand by reading the commit.

## November 2026

### Newport colour-index shading

- With the REX3 JIT (always on in iris-gui), smooth-shaded colour-index
drawing no longer turns into black and white stripes on Indy and Indigo2
Newport. SideFX PRISMS's "smooth" and "facet" views now draw correctly
(issue #798).

### jitv2 interrupts

- Under jitv2, software interrupts are taken as soon as they are enabled, not
Expand Down
8 changes: 7 additions & 1 deletion src/dev/ng1/rex3_jit/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,9 @@ fn emit_shader(
// DRAW path (possibly HOSTW): resolve source color from DDA / host pixel.
let raw_src = if is_hostw && dm0.colorhost() {
host_pixel_v
} else if dm0.shade() && !dm1.rgbmode() {
// CI: the red DDA is the index (get_colori), not a clamped byte.
b.ins().ushr_imm_s(colorred_v, 11)
} else if dm0.shade() {
let r = clamp_color_component(&mut b, colorred_v);
let g = clamp_color_component(&mut b, colorgrn_v);
Expand Down Expand Up @@ -2082,7 +2085,10 @@ fn emit_draw_iline(
let _ = depth_mask; // used indirectly via emit_pixel_write

let src_color: Value = {
let raw_src = if dm0.shade() {
let raw_src = if dm0.shade() && !dm1.rgbmode() {
// CI: the red DDA is the index (get_colori), not a clamped byte.
b.ins().ushr_imm_s(colorred_v, 11)
} else if dm0.shade() {
let r = clamp_color_component(&mut b, colorred_v);
let g = clamp_color_component(&mut b, colorgrn_v);
let bl = clamp_color_component(&mut b, colorblue_v);
Expand Down
52 changes: 52 additions & 0 deletions src/dev/ng1/rex3_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5821,6 +5821,58 @@ mod jit_tests {
);
}

/// Shaded colour-index spans at 12bpp, as IRIS GL draws lit CI surfaces
/// (SideFX PRISMS "smooth"/"facet", issue #798): the index is the red
/// DDA's integer part. The JIT used to pack clamped R/G/B bytes instead,
/// so the green and blue registers (left holding floats by the client)
/// leaked into the index and the surface drew as stripes. DRAWMODE1 is
/// the guest's: 12bpp CI with DITHER, single and double buffered.
#[test]
fn jit_span_shade_ci12() {
for dm1 in [0x3009_7011u32, 0x3009_7031] {
let dm0 = DM0_DRAW_SPAN | (1 << 18) | (1 << 12); // SHADE, ENZPAT
compare_jit_interp(0, 0, 40, 0,
|rex| {
reg(rex, REX3_DRAWMODE1, dm1);
reg(rex, REX3_WRMASK, 0xFFF);
// 12bpp CI takes COLORRED as o12.9: index 0x950 + 0.5.
reg(rex, REX3_COLORRED, 0x46d2_a100);
reg(rex, REX3_COLORGRN, 0x3f72_3ede);
reg(rex, REX3_COLORBLUE, 0x3f72_3ede);
reg(rex, REX3_SLOPERED, 3 << 9);
reg(rex, REX3_SLOPEGRN, 0x4580_0018);
reg(rex, REX3_SLOPEBLUE, 0x4580_0018);
reg(rex, REX3_ZPATTERN, 0xFFFF_FBFF);
reg(rex, REX3_XYENDI, xy(40, 0));
reg(rex, REX3_XYSTARTI, xy(0, 0));
},
dm0, dm1,
);
}
}

/// The line shader's copy of the same colour selection.
#[test]
fn jit_iline_shade_ci12() {
let dm1 = 0x3009_7011u32;
let dm0 = DM0_DRAW_ILINE | (1 << 18);
compare_jit_interp(0, 0, 16, 6,
|rex| {
reg(rex, REX3_DRAWMODE1, dm1);
reg(rex, REX3_WRMASK, 0xFFF);
reg(rex, REX3_COLORRED, 0x46d1_e000);
reg(rex, REX3_COLORGRN, 0x3f50_bf9e);
reg(rex, REX3_COLORBLUE, 0x3f50_bf9e);
reg(rex, REX3_SLOPERED, 5 << 9);
reg(rex, REX3_SLOPEGRN, 0);
reg(rex, REX3_SLOPEBLUE, 0);
reg(rex, REX3_XYENDI, xy(14, 4));
reg(rex, REX3_XYSTARTI, xy(0, 0));
},
dm0, dm1,
);
}

/// F_LINE with a fractional (half-pixel) start endpoint. Exercises the
/// same fractional-endpoint Bresenham correction (fline_apply_fract) as
/// the interpreter-only test_fline_all_octants_half_pixel, but now
Expand Down