Apply the generalized image-atomic bounds and backing checks from PR #178. Also reject unsupported descriptor formats before integer fallback and fail unresolved bindless atomics instead of silently deleting them. Rebuild the translator and record chain 467efdfd0b62, with regression tests and findings. Validation: compiler/helper and sanitizer tests, 96 Metal compile/link checks, ten GPU probes, all 28,603 Z-A shaders for Mac and iPhone, and a 240-second Mac station-area run reaching 6,987 frames without a freeze or GPU fault. Reported iPhone cases and the station-to-world transition remain unverified. Co-authored-by: b4f8abbb24dbf56a7d0280f296e16eeb <51352400+b4f8abbb24dbf56a7d0280f296e16eeb@users.noreply.github.com>
179 lines
10 KiB
Makefile
179 lines
10 KiB
Makefile
# Unit tests: make compiles and runs them (seconds)
|
|
# Source files are included by wildcard, same convention as GFX in the host Makefile (hle_nvn.c is #included directly by t_nvn.c, so it is excluded); adding new source files needs no change here
|
|
# Game profile (same convention as the host Makefile: GAME=base game title ID, required: there is no default game): game_profile.h is generated by the host Makefile; dmsh_chain.h (one for every game) lives beside nvn_mtl.m
|
|
ifeq ($(strip $(GAME)),)
|
|
ifneq ($(filter-out clean,$(or $(MAKECMDGOALS),t_nvn)),)
|
|
$(error GAME is not set: make GAME=<base game title ID>: $(shell python3 ../../games/game.py list | awk -F'\t' '{printf "%s (%s) ", $$1, $$3}'))
|
|
endif
|
|
endif
|
|
GAME_DIR = ../../games/$(GAME)
|
|
GAME_H = ../../host/gen/$(GAME)/game_profile.h
|
|
|
|
# Portable admission contract only; native Metal binding remains an Apple test.
|
|
.PHONY: imga-layout imga-layout-sanitize
|
|
imga-layout: t_imga_layout
|
|
./t_imga_layout
|
|
t_imga_layout: t_imga_layout.c ../nvn/nvn_imga_layout.h
|
|
$(CC) -std=c11 -O2 -g -Wall -Wextra -Werror -o $@ $<
|
|
imga-layout-sanitize: t_imga_layout_sanitize
|
|
./t_imga_layout_sanitize
|
|
t_imga_layout_sanitize: t_imga_layout.c ../nvn/nvn_imga_layout.h
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Werror -fsanitize=address,undefined -fno-omit-frame-pointer -o $@ $<
|
|
|
|
CFLAGS=-O1 -g -Wall -Wno-unused-function -I../nvn/include -I$(dir $(GAME_H))
|
|
GFX=$(filter-out ../nvn/hle_nvn.c,$(sort $(wildcard ../nvn/*.c ../nvn/*.m ../nvn/*.S ../tex/*.c ../tex/*.m)))
|
|
GFX_H=$(wildcard ../nvn/*.h ../nvn/*.inc ../nvn/include/*.h ../tex/*.h) $(GAME_H)
|
|
.DEFAULT_GOAL := t_nvn # the profile header rule comes first, so keep the default goal as before
|
|
$(GAME_H):
|
|
$(MAKE) -C ../../host game_profile GAME=$(GAME)
|
|
FW=-framework Metal -framework Foundation -framework QuartzCore -framework ImageIO -framework CoreGraphics -framework UniformTypeIdentifiers
|
|
# Host crash.c is linked in as well: the write-protect unit tests go through the same page-fault hook as production
|
|
# Tests that #include nvn_mtl.m link the rest of the NVN layer beside it (hle_nvn.c: memory pools, sparse pools, serials) and the host's large stack, with weak stubs of what they need of the host (t_host_stubs.c)
|
|
MTL_T_DEP=../nvn/hle_nvn.c ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(GFX) $(GFX_H)
|
|
MTL_T_SRC=../nvn/hle_nvn.c ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX))
|
|
t_nvn: t_nvn.c ../nvn/hle_nvn.c ../../host/crash.c ../../host/hle_bigstack.c $(GFX) $(GFX_H)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_nvn.c ../../host/crash.c ../../host/hle_bigstack.c $(GFX) $(FW)
|
|
t_dirty_slots: t_dirty_slots.c ../nvn/nvn_dirty.c ../../host/crash.c ../nvn/nvn_dirty.h
|
|
clang $(CFLAGS) -o $@ t_dirty_slots.c ../../host/crash.c ../nvn/nvn_dirty.c
|
|
t_dirty_race: t_dirty_race.c ../nvn/nvn_dirty.c ../../host/crash.c ../nvn/nvn_dirty.h
|
|
clang $(CFLAGS) -o $@ t_dirty_race.c ../../host/crash.c
|
|
t_builtin: t_builtin.m ../nvn/nvn_builtin.h
|
|
clang -O1 -g -Wall -fobjc-arc -o $@ t_builtin.m -framework Metal -framework Foundation
|
|
t_vin: t_vin.m
|
|
clang -O1 -g -Wall -fobjc-arc -o $@ t_vin.m -framework Metal -framework Foundation
|
|
t_tbuf2d: t_tbuf2d.m ../nvn/nvn_tex.c ../nvn/nvn_tex.h
|
|
clang -O1 -g -Wall -fobjc-arc -o $@ t_tbuf2d.m ../nvn/nvn_tex.c -framework Metal -framework Foundation
|
|
t_deswz_gpu: t_deswz_gpu.m ../tex/nvn_deswizzle.c ../tex/nvn_deswizzle_gpu.m ../tex/nvn_deswizzle.h ../tex/nvn_deswizzle_gpu.h ../nvn/nvn_tex.c ../nvn/nvn_tex.h
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_deswz_gpu.m ../tex/nvn_deswizzle.c ../tex/nvn_deswizzle_gpu.m ../nvn/nvn_tex.c -framework Metal -framework Foundation
|
|
t_refl: t_refl.m ../nvn/nvn_refl.m ../nvn/nvn_refl.h ../nvn/dmsh_chain.h
|
|
clang -O1 -g -Wall -I../nvn -fobjc-arc -o $@ t_refl.m ../nvn/nvn_refl.m -framework Metal -framework Foundation
|
|
t_hmap: t_hmap.c ../nvn/nvn_hmap.h
|
|
clang -O1 -Wall -o $@ t_hmap.c
|
|
t_cover: t_cover.c ../nvn/nvn_cover.h
|
|
clang -O1 -Wall -o $@ t_cover.c
|
|
t_pace: t_pace.c ../nvn/nvn_pace.h
|
|
clang -O1 -Wall -o $@ t_pace.c
|
|
t_fstep: t_fstep.c ../nvn/nvn_fstep.h
|
|
clang -O1 -Wall -o $@ t_fstep.c
|
|
t_fuse_check: t_fuse_check.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_fuse_check.m $(MTL_T_SRC) $(FW)
|
|
t_readback: t_readback.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_readback.m ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX)) $(FW)
|
|
.PHONY: check_t_readback
|
|
check_t_readback: t_readback
|
|
MTL_DEBUG_LAYER=1 ./t_readback
|
|
run: check_t_readback
|
|
t_present_crop: t_present_crop.m ../nvn/hle_nvn.c ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(GFX) $(GFX_H)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_present_crop.m ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX)) $(FW)
|
|
t_present_snap: t_present_snap.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_present_snap.m ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX)) $(FW)
|
|
.PHONY: check_t_present_snap
|
|
check_t_present_snap: t_present_snap
|
|
DM_NVN_ENC_THREAD=1 MTL_DEBUG_LAYER=1 ./t_present_snap suspend
|
|
DM_NVN_ENC_THREAD=1 MTL_DEBUG_LAYER=1 ./t_present_snap pacing
|
|
DM_NVN_ENC_THREAD=1 MTL_DEBUG_LAYER=1 ./t_present_snap copy
|
|
DM_NVN_ENC_THREAD=0 MTL_DEBUG_LAYER=1 ./t_present_snap pacing
|
|
run: check_t_present_snap
|
|
t_reorder_chain: t_reorder_chain.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_reorder_chain.m $(MTL_T_SRC) $(FW)
|
|
t_defer_chain: t_defer_chain.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_defer_chain.m $(MTL_T_SRC) $(FW)
|
|
t_zskip: t_zskip.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_zskip.m $(MTL_T_SRC) $(FW)
|
|
t_xv: t_xv.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_xv.m $(MTL_T_SRC) $(FW)
|
|
t_ub: t_ub.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_ub.m $(MTL_T_SRC) $(FW)
|
|
t_vbuf: t_vbuf.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_vbuf.m $(MTL_T_SRC) $(FW)
|
|
t_geometry: t_geometry.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_geometry.m $(MTL_T_SRC) $(FW)
|
|
t_mip_extent: t_mip_extent.m ../nvn/hle_nvn.c ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(GFX) $(GFX_H)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_mip_extent.m ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX)) $(FW)
|
|
t_rt_range_shape: t_rt_range_shape.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_rt_range_shape.m $(MTL_T_SRC) $(FW)
|
|
t_rt_range_ro: t_rt_range_ro.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_rt_range_ro.m $(MTL_T_SRC) $(FW)
|
|
t_rt_range: t_rt_range.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_rt_range.m $(MTL_T_SRC) $(FW)
|
|
t_rt_depth_ro: t_rt_depth_ro.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_rt_depth_ro.m $(MTL_T_SRC) $(FW)
|
|
t_pso_pending: t_pso_pending.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_pso_pending.m $(MTL_T_SRC) $(FW)
|
|
t_pso_archive: t_pso_archive.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_pso_archive.m $(MTL_T_SRC) $(FW)
|
|
t_pso_skey: t_pso_skey.m ../nvn/nvn_pso_skey.h ../nvn/nvn_obj.h
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_pso_skey.m -framework Foundation
|
|
t_view_swizzle: t_view_swizzle.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_view_swizzle.m $(MTL_T_SRC) $(FW)
|
|
t_view_levels: t_view_levels.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_view_levels.m $(MTL_T_SRC) $(FW)
|
|
t_linear_readback: t_linear_readback.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_linear_readback.m ../../host/crash.c ../../host/hle_bigstack.c t_host_stubs.c $(filter-out ../nvn/nvn_mtl.m,$(GFX)) $(FW)
|
|
.PHONY: check_t_linear_readback
|
|
check_t_linear_readback: t_linear_readback
|
|
MTL_DEBUG_LAYER=1 ./t_linear_readback
|
|
run: check_t_linear_readback
|
|
t_pfv: t_pfv.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_pfv.m $(MTL_T_SRC) $(FW)
|
|
t_integer_blend: t_integer_blend.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_integer_blend.m $(MTL_T_SRC) $(FW)
|
|
t_primitive_restart: t_primitive_restart.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_primitive_restart.m $(MTL_T_SRC) $(FW)
|
|
t_clear_ds: t_clear_ds.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_clear_ds.m $(MTL_T_SRC) $(FW)
|
|
t_upgrade_alias: t_upgrade_alias.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_upgrade_alias.m $(MTL_T_SRC) $(FW)
|
|
t_stencil_view: t_stencil_view.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_stencil_view.m $(MTL_T_SRC) $(FW)
|
|
# The Vulkan layer (#included) over the whole NVN layer, whose device and present path it uses
|
|
t_vk_desc: t_vk_desc.m ../vk/hle_vk.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -I../../third_party/vulkan-headers/include -fobjc-arc -o $@ t_vk_desc.m $(MTL_T_SRC) ../nvn/nvn_mtl.m $(FW)
|
|
run: t_nvn t_dirty_slots t_dirty_race t_builtin t_vin t_tbuf2d t_deswz_gpu t_pace t_fstep t_refl t_hmap t_cover t_fuse_check t_present_crop t_reorder_chain t_defer_chain t_zskip t_xv t_ub t_vbuf t_geometry t_mip_extent t_rt_range_shape t_rt_range_ro t_rt_range t_rt_depth_ro t_pso_skey t_pso_archive t_pso_pending t_pfv t_view_levels t_view_swizzle t_vk_desc t_integer_blend t_primitive_restart t_clear_ds t_upgrade_alias t_stencil_view
|
|
./t_nvn
|
|
./t_dirty_slots
|
|
./t_dirty_race
|
|
./t_builtin
|
|
./t_vin
|
|
./t_tbuf2d
|
|
./t_deswz_gpu
|
|
./t_pace
|
|
./t_fstep
|
|
./t_refl
|
|
./t_hmap
|
|
./t_cover
|
|
./t_fuse_check
|
|
./t_present_crop
|
|
MTL_DEBUG_LAYER=1 ./t_reorder_chain
|
|
MTL_DEBUG_LAYER=1 ./t_defer_chain
|
|
./t_zskip
|
|
./t_xv
|
|
./t_ub
|
|
MTL_DEBUG_LAYER=1 ./t_vbuf
|
|
MTL_DEBUG_LAYER=1 ./t_geometry
|
|
DM_NVN_VBUF_CACHE=0 MTL_DEBUG_LAYER=1 ./t_vbuf
|
|
MTL_DEBUG_LAYER=1 ./t_mip_extent
|
|
MTL_DEBUG_LAYER=1 ./t_mip_extent --stencil-only
|
|
./t_rt_depth_ro
|
|
./t_rt_range_shape
|
|
./t_rt_range_ro
|
|
DM_NVN_UNWRITTEN_DC=0 MTL_DEBUG_LAYER=1 ./t_rt_range
|
|
MTL_DEBUG_LAYER=1 ./t_rt_range # DontCare on by default: attachment bytes use the closed-form expectation of "one depth-stencil store saved per pass"
|
|
DM_NVN_UNWRITTEN_DC=0 MTL_DEBUG_LAYER=1 ./t_rt_range --disabled
|
|
DM_NVN_UNWRITTEN_DC=0 MTL_DEBUG_LAYER=1 ./t_rt_range --small-depth
|
|
DM_NVN_UNWRITTEN_DC=0 MTL_DEBUG_LAYER=1 ./t_rt_range --sample-attachment --both-flags
|
|
./t_pso_skey
|
|
./t_pso_pending
|
|
MTL_DEBUG_LAYER=1 ./t_pso_archive
|
|
MTL_DEBUG_LAYER=1 ./t_pfv
|
|
MTL_DEBUG_LAYER=1 ./t_view_levels
|
|
MTL_DEBUG_LAYER=1 ./t_view_swizzle
|
|
MTL_DEBUG_LAYER=1 ./t_vk_desc
|
|
MTL_DEBUG_LAYER=1 ./t_integer_blend
|
|
MTL_DEBUG_LAYER=1 ./t_primitive_restart
|
|
MTL_DEBUG_LAYER=1 ./t_clear_ds
|
|
MTL_DEBUG_LAYER=1 ./t_upgrade_alias
|
|
MTL_DEBUG_LAYER=1 ./t_stencil_view
|
|
DM_GAME=$(GAME) python3 test_tbdr_budget.py
|
|
.PHONY: run
|