Capture vertex outputs, run geometry shaders as compute, and rasterize compacted primitives through a general NVN pipeline. Rebuild the pinned translator and AI shader chain, add geometry regression coverage, and document supported behavior and remaining limits.
125 lines
7.4 KiB
Makefile
125 lines
7.4 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 lives in the profile folder
|
|
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
|
|
CFLAGS=-O1 -g -Wall -Wno-unused-function -I../nvn/include -I$(dir $(GAME_H)) -I$(GAME_DIR)
|
|
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) $(GAME_DIR)/dmsh_chain.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 $(GAME_DIR)/dmsh_chain.h
|
|
clang -O1 -g -Wall -I$(GAME_DIR) -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_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_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_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_pfv: t_pfv.m $(MTL_T_DEP)
|
|
clang $(CFLAGS) -fobjc-arc -o $@ t_pfv.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_pfv t_view_levels t_view_swizzle t_vk_desc
|
|
./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
|
|
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
|
|
DM_GAME=$(GAME) python3 test_tbdr_budget.py
|
|
.PHONY: run
|