-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
422 lines (388 loc) · 13.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
cmake_minimum_required(VERSION 3.18)
project(nxdk_pgraph_tests)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_LIST_DIR}/cmake/modules/"
)
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
set(CMAKE_CXX_STANDARD 17)
include(CMakePushCheckState)
set(_CMAKE_PROCESSING_LANGUAGE "CXX")
include(CheckSymbolExists)
include(ExternalProject)
include(FindPkgConfig)
include(NV2A_VSH REQUIRED)
include(NV20_CG REQUIRED)
include(XBEUtils REQUIRED)
find_package(NXDK REQUIRED)
find_package(NXDK_SDL2 REQUIRED)
find_package(NXDK_SDL2_Image REQUIRED)
find_package(Threads REQUIRED)
add_subdirectory(third_party)
set(TARGET nxdk_pgraph_tests)
option(
NO_OPT
"Suppress optimization on core files that are typically optimized regardless of release/debug configuration"
OFF
)
option(
ENABLE_PROGRESS_LOG
"Write the name of each test to a log file on the target."
OFF
)
option(
ENABLE_INTERACTIVE_CRASH_AVOIDANCE
"Attempt to detect crashes and prevent crashing tests from running after the next restart."
OFF
)
option(
DUMP_CONFIG_FILE
"Write a test configuration file template that may be edited to filter the tests that are executed."
OFF
)
option(
DISABLE_AUTORUN
"Prevents the tests from being executed without user input."
OFF
)
option(
AUTORUN_IMMEDIATELY
"Remove the delay for input before starting automated testing."
OFF
)
option(
ENABLE_SHUTDOWN
"Cause the program to shut down the xbox on completion instead of rebooting."
OFF
)
option(
ENABLE_MULTIFRAME_CPU_BLIT_TEST
"Enables the MultiframeCPUBlit test within the Antialiasing tests. This test requires evaluation across multiple frames and thus cannot produce a usable golden artifact for automated validation. This should only be enabled for manual testing purposes."
OFF
)
option(
ENABLE_PGRAPH_REGION_DIFF
"Causes a diff of the nv2a PGRAPH registers to be done between the start and end of each test in order to detect state leakage. Output is logged to XBDM and will be written into the progress log if it is enabled."
OFF
)
set(
RUNTIME_CONFIG_PATH
""
CACHE STRING
"XBOX-path to the location of a configuration file to filter the tests that are executed."
)
set(
FALLBACK_OUTPUT_ROOT_PATH
"e:/"
CACHE STRING
"Path at which test artifacts will be written when executed from read-only media."
)
configure_file(src/configure.h.in src/configure.h)
macro(set_compile_options target)
if (CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(
"${target}"
PRIVATE
-g
-gdwarf-4
-O0
-Wall
-fstandalone-debug
)
target_link_options("${target}" PRIVATE "/debug:full")
else ()
target_compile_options(
"${target}"
PRIVATE
-O3
-fno-strict-aliasing
-Wall
)
target_link_options("${target}" PRIVATE "/debug:none")
endif ()
endmacro()
# Vertex shaders.
generate_nv2a_vshinc_files(
generated_nv2a_vertex_shaders
SOURCES
src/shaders/fog_infinite_fogc_test.vsh
src/shaders/fog_vec4_w.vsh
src/shaders/fog_vec4_w_x.vsh
src/shaders/fog_vec4_w_y.vsh
src/shaders/fog_vec4_w_z_y_x.vsh
src/shaders/fog_vec4_x.vsh
src/shaders/fog_vec4_xw.vsh
src/shaders/fog_vec4_xy.vsh
src/shaders/fog_vec4_xyz.vsh
src/shaders/fog_vec4_x_y_z_w.vsh
src/shaders/fog_vec4_xyzw.vsh
src/shaders/fog_vec4_xz.vsh
src/shaders/fog_vec4_xzw.vsh
src/shaders/fog_vec4_y.vsh
src/shaders/fog_vec4_yw.vsh
src/shaders/fog_vec4_yz.vsh
src/shaders/fog_vec4_yzw.vsh
src/shaders/fog_vec4_z.vsh
src/shaders/fog_vec4_zw.vsh
src/shaders/fog_vec4_unset.vsh
src/shaders/passthrough.vsh
)
generate_pixelshader_inl_files(
generated_fp20_pixel_shaders
SOURCES
src/shaders/textured_pixelshader.ps.cg
src/shaders/untextured_pixelshader.ps.cg
)
generate_vertexshader_inl_files(
generated_vp20_vertex_shaders
SOURCES
src/shaders/attribute_carryover_test.vs.cg
src/shaders/attribute_explicit_setter_tests.vs.cg
src/shaders/mul_col0_by_const0_vertex_shader.vs.cg
src/shaders/precalculated_vertex_shader_2c_texcoords.vs.cg
src/shaders/precalculated_vertex_shader_4c_texcoords.vs.cg
src/shaders/projection_vertex_shader.vs.cg
src/shaders/projection_vertex_shader_no_lighting.vs.cg
src/shaders/projection_vertex_shader_no_lighting_4c_texcoords.vs.cg
)
# Sources that should be optimized regardless of standard debug settings.
add_library(
optimized_sources
EXCLUDE_FROM_ALL
src/dds_image.cpp
src/dds_image.h
src/debug_output.cpp
src/debug_output.h
src/main.cpp
src/menu_item.cpp
src/menu_item.h
src/logger.cpp
src/logger.h
src/pbkit_ext.cpp
src/pbkit_ext.h
src/pgraph_diff_token.cpp
src/pgraph_diff_token.h
src/shaders/orthographic_vertex_shader.cpp
src/shaders/orthographic_vertex_shader.h
src/shaders/perspective_vertex_shader.cpp
src/shaders/perspective_vertex_shader.h
src/shaders/pixel_shader_program.cpp
src/shaders/pixel_shader_program.h
src/shaders/passthrough_vertex_shader.cpp
src/shaders/passthrough_vertex_shader.h
src/shaders/precalculated_vertex_shader.cpp
src/shaders/precalculated_vertex_shader.h
src/shaders/projection_vertex_shader.cpp
src/shaders/projection_vertex_shader.h
src/shaders/vertex_shader_program.cpp
src/shaders/vertex_shader_program.h
src/test_driver.cpp
src/test_driver.h
src/test_host.cpp
src/test_host.h
src/texture_format.cpp
src/texture_format.h
src/texture_generator.cpp
src/texture_generator.h
src/texture_stage.cpp
src/texture_stage.h
src/vertex_buffer.cpp
src/vertex_buffer.h
)
if (NOT NO_OPT)
target_compile_options(
optimized_sources
PRIVATE
-O3
-fno-strict-aliasing
-Wall
)
target_link_options(optimized_sources PRIVATE "/debug:none")
else ()
set_compile_options(optimized_sources)
endif ()
target_include_directories(
optimized_sources
PRIVATE
src
third_party
"${CMAKE_CURRENT_BINARY_DIR}/src"
)
target_link_libraries(
optimized_sources
PUBLIC
generated_fp20_pixel_shaders
generated_vp20_vertex_shaders
generated_nv2a_vertex_shaders
PRIVATE
fpng
printf
swizzle
xbox_math3d
NXDK::NXDK
NXDK::NXDK_CXX
NXDK::SDL2
NXDK::SDL2_Image
)
add_executable(
"${TARGET}"
src/tests/antialiasing_tests.cpp
src/tests/antialiasing_tests.h
src/tests/attribute_carryover_tests.cpp
src/tests/attribute_carryover_tests.h
src/tests/attribute_explicit_setter_tests.cpp
src/tests/attribute_explicit_setter_tests.h
src/tests/attribute_float_tests.cpp
src/tests/attribute_float_tests.h
src/tests/blend_tests.cpp
src/tests/blend_tests.h
src/tests/clear_tests.cpp
src/tests/clear_tests.h
src/tests/color_key_tests.cpp
src/tests/color_key_tests.h
src/tests/color_mask_blend_tests.cpp
src/tests/color_mask_blend_tests.h
src/tests/color_zeta_disable_tests.cpp
src/tests/color_zeta_disable_tests.h
src/tests/color_zeta_overlap_tests.cpp
src/tests/color_zeta_overlap_tests.h
src/tests/combiner_tests.cpp
src/tests/combiner_tests.h
src/tests/depth_format_fixed_function_tests.cpp
src/tests/depth_format_fixed_function_tests.h
src/tests/depth_format_tests.cpp
src/tests/depth_format_tests.h
src/tests/dma_corruption_around_surface_tests.cpp
src/tests/dma_corruption_around_surface_tests.h
src/tests/edge_flag_tests.cpp
src/tests/edge_flag_tests.h
src/tests/fog_tests.cpp
src/tests/fog_tests.h
src/tests/front_face_tests.cpp
src/tests/front_face_tests.h
src/tests/image_blit_tests.cpp
src/tests/image_blit_tests.h
src/tests/inline_array_size_mismatch.cpp
src/tests/inline_array_size_mismatch.h
src/tests/lighting_normal_tests.cpp
src/tests/lighting_normal_tests.h
src/tests/lighting_two_sided_tests.cpp
src/tests/lighting_two_sided_tests.h
src/tests/line_width_tests.cpp
src/tests/line_width_tests.h
src/tests/material_alpha_tests.cpp
src/tests/material_alpha_tests.h
src/tests/material_color_source_tests.cpp
src/tests/material_color_source_tests.h
src/tests/material_color_tests.cpp
src/tests/material_color_tests.h
src/tests/null_surface_tests.cpp
src/tests/null_surface_tests.h
src/tests/overlapping_draw_modes_tests.cpp
src/tests/overlapping_draw_modes_tests.h
src/tests/pvideo_tests.cpp
src/tests/pvideo_tests.h
src/tests/set_vertex_data_tests.cpp
src/tests/set_vertex_data_tests.h
src/tests/shade_model_tests.cpp
src/tests/shade_model_tests.h
src/tests/smoothing_tests.cpp
src/tests/smoothing_tests.h
src/tests/stencil_tests.cpp
src/tests/stencil_tests.h
src/tests/stipple_tests.cpp
src/tests/stipple_tests.h
src/tests/surface_clip_tests.cpp
src/tests/surface_clip_tests.h
src/tests/surface_pitch_tests.cpp
src/tests/surface_pitch_tests.h
src/tests/test_suite.cpp
src/tests/test_suite.h
src/tests/texgen_matrix_tests.cpp
src/tests/texgen_matrix_tests.h
src/tests/texgen_tests.cpp
src/tests/texgen_tests.h
src/tests/texture_border_tests.cpp
src/tests/texture_border_tests.h
src/tests/texture_cpu_update_tests.cpp
src/tests/texture_cpu_update_tests.h
src/tests/texture_cubemap_tests.cpp
src/tests/texture_cubemap_tests.h
src/tests/texture_format_dxt_tests.cpp
src/tests/texture_format_dxt_tests.h
src/tests/texture_format_tests.cpp
src/tests/texture_format_tests.h
src/tests/texture_framebuffer_blit_tests.cpp
src/tests/texture_framebuffer_blit_tests.h
src/tests/texture_matrix_tests.cpp
src/tests/texture_matrix_tests.h
src/tests/texture_render_target_tests.cpp
src/tests/texture_render_target_tests.h
src/tests/texture_render_update_in_place_tests.cpp
src/tests/texture_render_update_in_place_tests.h
src/tests/texture_shadow_comparator_tests.cpp
src/tests/texture_shadow_comparator_tests.h
src/tests/texture_signed_component_tests.cpp
src/tests/texture_signed_component_tests.h
src/tests/three_d_primitive_tests.cpp
src/tests/three_d_primitive_tests.h
src/tests/two_d_line_tests.cpp
src/tests/two_d_line_tests.h
src/tests/vertex_shader_independence_tests.cpp
src/tests/vertex_shader_independence_tests.h
src/tests/vertex_shader_rounding_tests.cpp
src/tests/vertex_shader_rounding_tests.h
src/tests/vertex_shader_swizzle_tests.cpp
src/tests/vertex_shader_swizzle_tests.h
src/tests/viewport_tests.cpp
src/tests/viewport_tests.h
src/tests/volume_texture_tests.cpp
src/tests/volume_texture_tests.h
src/tests/w_param_tests.cpp
src/tests/w_param_tests.h
src/tests/window_clip_tests.cpp
src/tests/window_clip_tests.h
src/tests/z_min_max_control_tests.cpp
src/tests/z_min_max_control_tests.h
src/tests/zero_stride_tests.cpp
src/tests/zero_stride_tests.h
)
# Pull debug info out of the binary into a host-side linked binary.
split_debug("${TARGET}")
set(EXECUTABLE_BINARY "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.exe")
target_include_directories(
"${TARGET}"
PRIVATE
src
third_party
"${CMAKE_CURRENT_BINARY_DIR}/src"
)
set_compile_options("${TARGET}")
target_link_libraries(
"${TARGET}"
fpng
optimized_sources
printf
swizzle
xbox_math3d
NXDK::NXDK
NXDK::NXDK_CXX
NXDK::SDL2
NXDK::SDL2_Image
)
add_xbe(xbe_file "${EXECUTABLE_BINARY}" TITLE "PGRAPH Tests" RESOURCE_DIRS resources)
add_xiso(nxdk_pgraph_tests_xiso xbe_file)
#set(XBDM_GDB_BRIDGE $ENV{XBDM_GDB_BRIDGE})
#set(XBOX $ENV{XBOX})
#if (DEFINED ENV{REMOTE_PATH})
# set(REMOTE_PATH $ENV{REMOTE_PATH})
#else ()
# set(REMOTE_PATH "e:\\\\cmake_pgraph")
#endif ()
#
#add_custom_target(
# deploy_with_xbdm
# COMMAND "${XBDM_GDB_BRIDGE}" "${XBOX}" -- mkdir "${REMOTE_PATH}"
# COMMAND "${XBDM_GDB_BRIDGE}" "${XBOX}" -- putfile "${XBE_STAGING_DIR}" "${REMOTE_PATH}" -f
# DEPENDS "${XBE_OUTPUT_PATH}"
#)