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('