Skip to content
Closed
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
3 changes: 2 additions & 1 deletion make_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,8 @@ def wave64_settings(mode: str, *, mesh_compute: bool = False) -> tuple[bool, boo
if exe:
try:
r = subprocess.run([exe], capture_output=True, text=True, errors="replace", timeout=120)
size = smallest_max_subgroup(r.stdout)
if r.returncode == 0:
size = smallest_max_subgroup(r.stdout)
except (OSError, subprocess.SubprocessError):
size = None
if size is None:
Expand Down
8 changes: 6 additions & 2 deletions tests/test_make_game_wave64.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def test_no_subgroup_size_gives_none(self):
class Wave64EmulateTest(unittest.TestCase):
"""wave64_emulate(): on and off are taken as given; auto asks vulkaninfo and falls back to on."""

def decide(self, mode, which="vulkaninfo", stdout="", error=None):
def decide(self, mode, which="vulkaninfo", stdout="", error=None, returncode=0):
def fake_run(args, **kw):
if error:
raise error
return subprocess.CompletedProcess(args, 0, stdout=stdout, stderr="")
return subprocess.CompletedProcess(args, returncode, stdout=stdout, stderr="")
with mock.patch.object(make_game.shutil, "which", return_value=which), \
mock.patch.object(make_game.subprocess, "run", side_effect=fake_run) as run, \
mock.patch.object(make_game, "log", lambda *a: None):
Expand Down Expand Up @@ -84,6 +84,10 @@ def test_auto_when_vulkaninfo_cannot_run_turns_it_on(self):
self.assertTrue(self.decide("auto", error=OSError("cannot start"))[0])
self.assertTrue(self.decide("auto", error=subprocess.TimeoutExpired("vulkaninfo", 120))[0])

def test_auto_ignores_partial_stdout_when_vulkaninfo_fails(self):
partial = real_format(("First adapter", 64, []))
self.assertEqual(self.decide("auto", stdout=partial, returncode=1), (True, True))

def test_auto_when_vulkaninfo_prints_no_subgroup_size_turns_it_on(self):
self.assertTrue(self.decide("auto", stdout="ERROR: no Vulkan device\n")[0])

Expand Down
Loading