diff --git a/tests/native_direct_container_check.py b/tests/native_direct_container_check.py index 86d6037256..a2d0a2a888 100644 --- a/tests/native_direct_container_check.py +++ b/tests/native_direct_container_check.py @@ -755,6 +755,17 @@ def waterfall_pixel(byte_key=False,modifier=None): capture_output=True,text=True) assert result.returncode and not destination.exists(),(reason,result.stderr) if reason=="unbounded": assert "bounded aligned material index" in result.stderr,result.stderr + # Address bits 1, 11 and 15 allocate I/J, position W and packed XY. + # Reading v2 must use SV_Position.w, and v3 still uses screen XY. + position_entry = words(0x7e000302, 0x7e020303, 0xf800180f, 0x01010000, 0xbf810000) + (folder/"mesh-entry-w-xy.pslayout").write_text("meshps2 34818 64\n") + check("mesh-entry-w-xy", "gfx1013-raw-mesh-ps", position_entry) + w_xy = subprocess.check_output([pathlib.Path(sdk)/"dxc.exe", "-dumpbin", + folder/"mesh-entry-w-xy.cso"], text=True) + for channel in (0, 1, 3): + assert re.search(r"@dx.op.loadInput.f32\(i32 4, i32 \d+, i32 0, i8 " + str(channel) + r",", w_xy), w_xy + (folder/"mesh-entry-w-disabled.pslayout").write_text("meshps1 2 34818 64\n") + check("mesh-entry-w-disabled", "gfx1013-raw-mesh-ps", position_entry, "unsupported pixel entry VGPR 2") check("split-mask-two-arms", "gfx1013-container-ps", patched_pixel(len(two_arms), two_arms, input_address=1 << 8, input_signature=position_input)) cmpx = [0xbefe0a7e, 0xbe8a047e, 0x7c2800f4, 0x7e0002f2, diff --git a/tools/startup/compile_dxil.cpp b/tools/startup/compile_dxil.cpp index c3b00a2bc7..51c6b01aa8 100644 --- a/tools/startup/compile_dxil.cpp +++ b/tools/startup/compile_dxil.cpp @@ -224,8 +224,20 @@ static std::optional compile_one(x2w::ShaderDxilCompiler& compiler, std::ifstream meta(fs::path(input_path).replace_extension(L".pslayout")); std::string tag, extra; unsigned enable, address, wave; - if (!(meta >> tag >> enable >> address >> wave) || tag != "meshps1") - throw std::runtime_error("raw mesh PS needs meshps1 enable address wave (decimal)"); + if (!(meta >> tag)) + throw std::runtime_error("raw mesh PS needs a reviewed entry layout"); + if (tag == "meshps1") { + if (!(meta >> enable >> address >> wave)) + throw std::runtime_error("raw mesh PS needs meshps1 enable address wave (decimal)"); + } else if (tag == "meshps2") { + // As in Victory's native PS reflection, this record names the + // inputs delivered by ADDR when a separate ENA mask is unavailable. + if (!(meta >> address >> wave)) + throw std::runtime_error("raw mesh PS needs meshps2 input-address wave (decimal)"); + enable = address; + } else { + throw std::runtime_error("unknown raw mesh PS entry layout version"); + } const bool guest_root = bool(meta >> extra); if (guest_root && (extra!="guest_root" || (meta >> extra))) throw std::runtime_error("unexpected raw mesh PS layout field"); @@ -1010,7 +1022,7 @@ int wmain(int argc, wchar_t** argv) { "gfx1013-group-clear@BYTE_OFFSET and gfx1013-compute-wave32@BYTE_OFFSET take a req_.c67.\n" "Direct DXIL profiles: gfx1013-direct-cs@BYTE_OFFSET, gfx1013-container-cs, gfx1013-container-vs, gfx1013-container-ps, gfx1013-container-ms.\n" "gfx1013-raw-ms reads guest mesh bytes and an explicit .mslayout sidecar.\n" - "gfx1013-raw-mesh-ps uses an explicit .pslayout sidecar.\n" + "gfx1013-raw-mesh-ps uses a reviewed .pslayout sidecar (meshps1 or meshps2).\n" "gfx1013-container-cs reads an optional req_.views next to the .cdx (GPU-selected heap slot view types).\n" "gfx1013-container-pair accepts two containers and emits VS then PS using the runtime register allocation.\n" "For capture directories use PROFILE --requests DIRECTORY OUTPUT_DIRECTORY. "