From 50a90fd5d633b5bd4f84ff5d695f83d00cf180d1 Mon Sep 17 00:00:00 2001 From: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com> Date: Wed, 2 Dec 2026 06:20:25 +0100 Subject: [PATCH] shader: keep mesh output rows with an integer element constant A DXIL signature row holds one interpolation mode, and integer elements are constant. The direct graphics translator made integer outputs constant and float outputs linear, so a guest row that packs a u32 and an f32 failed DXIL validation. Every element of an output row that holds a non-float element is now constant, which matches the flat attribute read of such a row on the guest. Co-Authored-By: Claude Opus 5.5 --- src/gfx1013_direct_graphics.inl | 8 ++++++-- tests/native_direct_mesh_check.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gfx1013_direct_graphics.inl b/src/gfx1013_direct_graphics.inl index 0ee9bd2fc..cad320cfd 100644 --- a/src/gfx1013_direct_graphics.inl +++ b/src/gfx1013_direct_graphics.inl @@ -195,8 +195,12 @@ struct GraphicsStage { unsigned component = s.component == 1 ? 5 : s.component == 2 ? 4 : s.component == 3 ? 9 : 0; if (!component) refuse(pc, "unknown signature component"); - return row(input, s.name, s.index, system(s.name), component, s.row, s.mask, - !input && component != 9 ? 1 : interpolation); + // A DXIL signature row has one interpolation mode, and integers are + // constant, so a float packed beside an integer output is constant too. + const bool flat = !input && std::any_of(signature.begin(), signature.end(), [&](const auto &o) { + return o.row == s.row && !o.system && o.component != 3; + }); + return row(input, s.name, s.index, system(s.name), component, s.row, s.mask, flat ? 1 : interpolation); } refuse(pc, "missing generic graphics signature row"); } diff --git a/tests/native_direct_mesh_check.py b/tests/native_direct_mesh_check.py index bcb2ce87d..5916340be 100644 --- a/tests/native_direct_mesh_check.py +++ b/tests/native_direct_mesh_check.py @@ -835,6 +835,23 @@ def run_offen(name, words, error=None): text = subprocess.check_output([sdk/'dxc.exe', '-dumpbin', out], text=True) assert text.count('call float @dx.op.legacyF16ToF32') == 7, text assert 'TEXCOORD' in text and 'COLOR' in text, text + # A DXIL row has one interpolation mode. A float packed beside an + # integer is constant; a float beside another float stays linear. + body[io + 0xc8:io + 0xce] = bytes((6, 1, 0, 0, 0, 0)) + code = isa_words(*program[:11], 0xf80000cf, program[12], + 0xf8000203, program[12], *program[13:]) + struct.pack_into('