Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Engine: fix the stale expectation of test_table_of_uniform_handles (patch 0083)

v0lumehi03864d780653
diff --git a/patches/0083-test-table-of-uniform-handles-expects-the-pool-m.patch b/patches/0083-test-table-of-uniform-handles-expects-the-pool-m.patch
new file mode 100644
index 00000000..ab2679a0
--- /dev/null
+++ b/patches/0083-test-table-of-uniform-handles-expects-the-pool-m.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: v0lumehi <[email protected]>
+Date: Fri, 6 Nov 2026 12:06:45 +0100
+Subject: [PATCH] test_table_of_uniform_handles expects the pool marker: the
+ texture read goes through dm_pool_mark
+
+The test failed on main. It asserted the texture read of a table of uniform
+handles as (&base->e[0])[min(uint(_7), base->n)]. Since the pool marker
+(POOL_MARK, dm_pool_mark) a read of a texture pool also sets the ID's bit in
+the bitmap at seen, so pool_arrays emits (&base->e[0])[dm_pool_mark(base,
+min(uint(_7), base->n))] for the texture. A sampler pool is still read
+without it. The code is right and the test predates the marker.
+
+The test now checks the texture read with dm_pool_mark and the sampler read
+without it. Only the test changes.
+
+Upstream-Status: forwarded seedds/nxnative#1478
+Reason: the test predates the pool marker and fails on upstream's main too
+Issue: LNPANDY/NX2Apple#813
+
+---
+ dm/tools/tests/test_dmsh_pool_arrays.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/dm/tools/tests/test_dmsh_pool_arrays.py b/dm/tools/tests/test_dmsh_pool_arrays.py
+index d779daa..29b7502 100644
+--- a/dm/tools/tests/test_dmsh_pool_arrays.py
++++ b/dm/tools/tests/test_dmsh_pool_arrays.py
+@@ -97,7 +97,8 @@ kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0
+ }
+ '''
+ out = NS['pool_arrays'](src)
+- self.assertIn('(&spvDescriptorSet0.cp_t2da_cb196612_10570000->e[0])[min(uint(_7), spvDescriptorSet0.cp_t2da_cb196612_10570000->n)]', out)
++ self.assertIn('(&spvDescriptorSet0.cp_t2da_cb196612_10570000->e[0])[dm_pool_mark(spvDescriptorSet0.cp_t2da_cb196612_10570000, min(uint(_7), spvDescriptorSet0.cp_t2da_cb196612_10570000->n))]', out) # a texture read marks its ID as seen
++ self.assertIn('(&spvDescriptorSet0.cp_t2da_cb196612_10570000Smplr->e[0])[min(uint(_7), spvDescriptorSet0.cp_t2da_cb196612_10570000Smplr->n)]', out) # a sampler read does not
+ self.assertIn('array<texture2d<float>, 32> fp_t2d_cb14_0 [[id(2)]];', out) # a pointer takes one ID; an array of 32 stays an array (nothing in the game's buffers is that short now but images and buffer textures)
+ b = {e['msl_name']: e for e in NS['reflect']('k', 'cs', out, {'sbufs': []})}
+ t, s = b['cp_t2da_cb196612_10570000'], b['cp_t2da_cb196612_10570000Smplr']
diff --git a/patches/series b/patches/series
index 907dddff..6815aba9 100644
--- a/patches/series
+++ b/patches/series
@@ -50,3 +50,4 @@
0080-keep-the-selected-python-when-generating-the-mac.patch
0081-support-steam-controller-and-shared-mac-control.patch
0082-ios-shell-copy-a-game-s-packed-shader-image-into.patch
+0083-test-table-of-uniform-handles-expects-the-pool-m.patch