upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 15:51:40 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 15:51:40 +0100
commitdf91c6624b69ee4e6c6eeca20ed68d331ed0e728 (patch)
tree323c88b9df89bf8abaa2b98d10808474ab675dc2 /runtime
parentb40d8039a98f57b26bd05860febbabbe59b97873 (diff)
parent6a6704df1592e1dc4a3215ddf1423a78adb52045 (diff)
Merge main into test/valu-int-misc (#1492)
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py AI-assisted.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt168
-rw-r--r--runtime/README.md11
-rw-r--r--runtime/shims/d3d12_com.cpp20
-rw-r--r--runtime/shims/d3d12_com.h6
-rw-r--r--runtime/shims/d3d12_vulkan_device.cpp328
-rw-r--r--runtime/shims/d3d12_xs_device.cpp188
-rw-r--r--runtime/shims/d3d12_xs_device.h32
-rw-r--r--runtime/shims/dxgi_com.cpp63
-rw-r--r--runtime/shims/file_system.cpp4
-rw-r--r--runtime/shims/gameinput.cpp96
-rw-r--r--runtime/shims/gameinput_abi.h42
-rw-r--r--runtime/shims/library_loader.cpp28
-rw-r--r--runtime/shims/process.cpp40
-rw-r--r--runtime/src/base_reservation.h139
-rw-r--r--runtime/src/main.cpp5
-rw-r--r--runtime/src/pe_loader.cpp8
-rw-r--r--runtime/src/resource_tiling.h25
-rw-r--r--runtime/src/retire_tickets.h7
-rw-r--r--runtime/src/shader_library.h11
-rw-r--r--runtime/src/subgroup_size.h152
-rw-r--r--runtime/src/vulkan_backend.h35
-rw-r--r--runtime/src/vulkan_bindless.h64
-rw-r--r--runtime/src/vulkan_depth24.h13
-rw-r--r--runtime/src/vulkan_present.h60
-rw-r--r--runtime/src/vulkan_replay.h193
-rw-r--r--runtime/src/vulkan_scratch.h13
-rw-r--r--runtime/src/xdxr_build.comp73
-rw-r--r--runtime/src/xdxr_build.h59
-rw-r--r--runtime/src/xdxr_build.inc7391
-rw-r--r--runtime/test/allocator_proxy_test.cpp382
-rw-r--r--runtime/test/bindless_sizing_test.cpp31
-rw-r--r--runtime/test/check_d3d12_trace.py5
-rw-r--r--runtime/test/check_vk_pipeline_cli.cmake33
-rw-r--r--runtime/test/d3d12_clear_test.cpp3
-rw-r--r--runtime/test/d3d12_compute_test.cpp182
-rw-r--r--runtime/test/d3d12_copy_compare.h25
-rw-r--r--runtime/test/d3d12_descriptor_test.cpp163
-rw-r--r--runtime/test/d3d12_draw_test.cpp136
-rw-r--r--runtime/test/d3d12_gcl8_test.cpp9
-rw-r--r--runtime/test/d3d12_m2_textured_test.cpp24
-rw-r--r--runtime/test/d3d12_present_test.cpp32
-rw-r--r--runtime/test/d3d12_queue_wait_test.cpp38
-rw-r--r--runtime/test/d3d12_set0_compute_test.cpp337
-rw-r--r--runtime/test/d3d12_subgroup_test.cpp672
-rw-r--r--runtime/test/d3d12_vulkan_device_test.cpp751
-rw-r--r--runtime/test/d3d12_xdxr_rt_test.cpp90
-rw-r--r--runtime/test/depth24_convert_test.cpp91
-rw-r--r--runtime/test/device_proxy_test.cpp41
-rw-r--r--runtime/test/dxgi_swapchain_test.cpp205
-rw-r--r--runtime/test/file_system_test.cpp11
-rw-r--r--runtime/test/fsr_dispatch_test.cpp4
-rw-r--r--runtime/test/gameinput_probe.cpp5
-rw-r--r--runtime/test/gameinput_test.cpp136
-rw-r--r--runtime/test/glsl/cs_set0_sample.comp77
-rw-r--r--runtime/test/glsl/cs_sg_probe.comp29
-rw-r--r--runtime/test/glsl/cs_user_data.comp14
-rw-r--r--runtime/test/glsl/ps_sg_probe.frag11
-rw-r--r--runtime/test/glsl/vs_sg_fullscreen.vert6
-rw-r--r--runtime/test/process_cmdline_test.cpp70
-rw-r--r--runtime/test/queue_proxy_test.cpp74
-rw-r--r--runtime/test/resource_tiling_test.cpp15
-rw-r--r--runtime/test/root_signature_oracle_test.cpp42
-rw-r--r--runtime/test/shader_library_corpus_test.cpp159
-rw-r--r--runtime/test/shader_library_test.cpp14
-rw-r--r--runtime/test/shaders/build.py4
-rw-r--r--runtime/test/shaders/check.py69
-rw-r--r--runtime/test/shaders/cs_fmt_sint32.asm90
-rw-r--r--runtime/test/shaders/cs_w32_sincos.asm60
-rw-r--r--runtime/test/shaders/ps_f16_pack_mods.asm19
-rw-r--r--runtime/test/shaders/ps_imgatomic.asm44
-rw-r--r--runtime/test/shaders/ps_m2_uoff.asm5
-rw-r--r--runtime/test/shaders/ps_scc_logic32.asm44
-rw-r--r--runtime/test/shaders/ps_scc_logic64.asm49
-rw-r--r--runtime/test/shaders/ps_w64x_readlane.asm27
-rw-r--r--runtime/test/subgroup_size_test.cpp256
-rw-r--r--runtime/test/vk_bc_zero_init_test.cpp388
-rw-r--r--runtime/test/vk_bindless_test.cpp179
-rw-r--r--runtime/test/vk_pipeline_check.cpp44
-rw-r--r--runtime/test/vk_presenter_sync_test.cpp42
-rw-r--r--runtime/test/vk_queue_query_sync_test.cpp351
-rw-r--r--runtime/test/vk_sync_validation_selftest.cpp93
-rw-r--r--runtime/test/vk_test_device.h15
-rw-r--r--runtime/test/vk_xdxr_build_test.cpp121
-rw-r--r--runtime/test/xgameruntime_test.cpp34
-rw-r--r--runtime/test/xs_proxy_mock_test.cpp93
85 files changed, 11419 insertions, 3799 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 6ea698f38..2fb2c2fd4 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -394,10 +394,20 @@ if(BUILD_TESTING)
394 set_target_properties(tiny_game PROPERTIES 394 set_target_properties(tiny_game PROPERTIES
395 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fixtures/game/$<CONFIG>" 395 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fixtures/game/$<CONFIG>"
396 ) 396 )
397 # The same game with no .reloc, at the default EXE base, as RT-22 asks about the real one: it can only run at
398 # 0x140000000, which arm64 Wine on macOS uses for itself (src/base_reservation.h).
399 add_executable(tiny_game_fixed test/fixtures/tiny_game.cpp)
400 target_link_libraries(tiny_game_fixed PRIVATE xgameruntime_stub)
401 target_compile_definitions(tiny_game_fixed PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX _CRT_SECURE_NO_WARNINGS)
402 target_compile_options(tiny_game_fixed PRIVATE /W4 /permissive- /utf-8 /EHsc)
403 target_link_options(tiny_game_fixed PRIVATE /FIXED /DYNAMICBASE:NO /BASE:0x140000000)
404 set_target_properties(tiny_game_fixed PROPERTIES
405 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fixtures/game/$<CONFIG>"
406 )
397 add_executable(tiny_game_exit_code_test test/tiny_game_exit_code_test.cpp) 407 add_executable(tiny_game_exit_code_test test/tiny_game_exit_code_test.cpp)
398 target_compile_definitions(tiny_game_exit_code_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) 408 target_compile_definitions(tiny_game_exit_code_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
399 target_compile_options(tiny_game_exit_code_test PRIVATE /W4 /permissive- /utf-8) 409 target_compile_options(tiny_game_exit_code_test PRIVATE /W4 /permissive- /utf-8)
400 add_dependencies(tiny_game_exit_code_test gta6rt tiny_game) 410 add_dependencies(tiny_game_exit_code_test gta6rt tiny_game tiny_game_fixed)
401 add_test(NAME pe_loader COMMAND pe_loader_test "$<TARGET_FILE:tiny_dll>" "$<TARGET_FILE:tiny_exe>") 411 add_test(NAME pe_loader COMMAND pe_loader_test "$<TARGET_FILE:tiny_dll>" "$<TARGET_FILE:tiny_exe>")
402 412
403 # Synthetic, hand-built images through Loader::load: range checks, wrapping RVAs, import-table termination and 413 # Synthetic, hand-built images through Loader::load: range checks, wrapping RVAs, import-table termination and
@@ -499,6 +509,11 @@ if(BUILD_TESTING)
499 add_test(NAME descriptor_table COMMAND descriptor_table_test) 509 add_test(NAME descriptor_table COMMAND descriptor_table_test)
500 add_executable(shader_library_test test/shader_library_test.cpp) 510 add_executable(shader_library_test test/shader_library_test.cpp)
501 add_test(NAME shader_library COMMAND shader_library_test) 511 add_test(NAME shader_library COMMAND shader_library_test)
512 # Optional: skips unless LEONIDA_SHADERS names a translated work folder (<work>/shaders/spirv).
513 add_executable(shader_library_corpus_test test/shader_library_corpus_test.cpp)
514 add_test(NAME shader_library_corpus COMMAND shader_library_corpus_test)
515 # Reads all 26,503 containers and modules: about 9 minutes from a hard disk.
516 set_tests_properties(shader_library_corpus PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 3600)
502 if(WIN32) 517 if(WIN32)
503 # Optional: skips unless LEONIDA_GAME_DIR and LEONIDA_MOVIE are set. 518 # Optional: skips unless LEONIDA_GAME_DIR and LEONIDA_MOVIE are set.
504 add_executable(bink_decode_test 519 add_executable(bink_decode_test
@@ -595,6 +610,11 @@ if(BUILD_TESTING)
595 add_test(NAME run_tiny_game COMMAND gta6rt --run $<TARGET_FILE:tiny_game> -- hello 42) 610 add_test(NAME run_tiny_game COMMAND gta6rt --run $<TARGET_FILE:tiny_game> -- hello 42)
596 add_test(NAME run_tiny_game_exit_code COMMAND tiny_game_exit_code_test 611 add_test(NAME run_tiny_game_exit_code COMMAND tiny_game_exit_code_test
597 "$<TARGET_FILE:gta6rt>" "$<TARGET_FILE:tiny_game>") 612 "$<TARGET_FILE:gta6rt>" "$<TARGET_FILE:tiny_game>")
613 # Without relocations it can only run at 0x140000000 (base_reservation.h), so passing means it got there; the
614 # game's exact exit code comes back through the relaunch.
615 add_test(NAME run_tiny_game_fixed COMMAND gta6rt --run $<TARGET_FILE:tiny_game_fixed> -- hello 42)
616 add_test(NAME run_tiny_game_fixed_exit_code COMMAND tiny_game_exit_code_test
617 "$<TARGET_FILE:gta6rt>" "$<TARGET_FILE:tiny_game_fixed>")
598 # Two modes at once are refused before anything is mapped (#886). The stand-in game's own arguments are passed, 618 # Two modes at once are refused before anything is mapped (#886). The stand-in game's own arguments are passed,
599 # so a gta6rt that ignored the conflict would run it, print "running" and exit 0. 619 # so a gta6rt that ignored the conflict would run it, print "running" and exit 0.
600 foreach(modes "dry-run;run" "dry-run;init" "init;run") 620 foreach(modes "dry-run;run" "dry-run;init" "init;run")
@@ -677,6 +697,11 @@ if(TARGET Vulkan::Headers)
677 endif() 697 endif()
678 endforeach() 698 endforeach()
679 if(BUILD_TESTING) 699 if(BUILD_TESTING)
700 add_test(NAME vk_pipeline_check_cli COMMAND "${CMAKE_COMMAND}"
701 "-DTOOL=$<TARGET_FILE:vk_pipeline_check>"
702 "-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/vk_pipeline_check_cli_input"
703 "-DRUNNER=${CMAKE_CROSSCOMPILING_EMULATOR}"
704 -P "${CMAKE_CURRENT_SOURCE_DIR}/test/check_vk_pipeline_cli.cmake")
680 add_test(NAME depth24_convert COMMAND depth24_convert_test) 705 add_test(NAME depth24_convert COMMAND depth24_convert_test)
681 set_tests_properties(depth24_convert PROPERTIES SKIP_RETURN_CODE 77) 706 set_tests_properties(depth24_convert PROPERTIES SKIP_RETURN_CODE 77)
682 # The XDXR BVH builder: the GPU writes every case, then tools/xdxr_bvh.py validates and traces them. 707 # The XDXR BVH builder: the GPU writes every case, then tools/xdxr_bvh.py validates and traces them.
@@ -691,6 +716,37 @@ if(TARGET Vulkan::Headers)
691 set_tests_properties(xdxr_build_check PROPERTIES FIXTURES_REQUIRED xdxr_build_cases SKIP_RETURN_CODE 77) 716 set_tests_properties(xdxr_build_check PROPERTIES FIXTURES_REQUIRED xdxr_build_cases SKIP_RETURN_CODE 77)
692 endif() 717 endif()
693 endif() 718 endif()
719 # VulkanQueue/VulkanContext query-state synchronization (remove_query_pool vs commit, cross-queue plan/commit)
720 # and pending Wait() preservation across transient vkQueueSubmit failures.
721 add_executable(vk_queue_query_sync_test test/vk_queue_query_sync_test.cpp)
722 target_link_libraries(vk_queue_query_sync_test PRIVATE Vulkan::Headers ${CMAKE_DL_LIBS})
723 if(WIN32)
724 target_compile_definitions(vk_queue_query_sync_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
725 else()
726 find_package(Threads REQUIRED)
727 target_link_libraries(vk_queue_query_sync_test PRIVATE Threads::Threads)
728 endif()
729 if(MSVC)
730 target_compile_options(vk_queue_query_sync_test PRIVATE /W4 /permissive- /utf-8)
731 endif()
732 if(BUILD_TESTING)
733 add_test(NAME vk_queue_query_sync COMMAND vk_queue_query_sync_test)
734 set_tests_properties(vk_queue_query_sync PROPERTIES SKIP_RETURN_CODE 77)
735 endif()
736 # With LEONIDA_VK_VALIDATION=1: synchronization validation reports a missing barrier (and not a present one), so
737 # the other GPU tests' "0 validation errors" was checked by an active layer. 77 without validation or a device.
738 add_executable(vk_sync_validation_selftest test/vk_sync_validation_selftest.cpp)
739 target_link_libraries(vk_sync_validation_selftest PRIVATE Vulkan::Headers ${CMAKE_DL_LIBS})
740 if(WIN32)
741 target_compile_definitions(vk_sync_validation_selftest PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
742 endif()
743 if(MSVC)
744 target_compile_options(vk_sync_validation_selftest PRIVATE /W4 /permissive- /utf-8)
745 endif()
746 if(BUILD_TESTING)
747 add_test(NAME vk_sync_validation COMMAND vk_sync_validation_selftest)
748 set_tests_properties(vk_sync_validation PROPERTIES SKIP_RETURN_CODE 77)
749 endif()
694 if(NOT Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) 750 if(NOT Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
695 find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE glslangValidator HINTS "$ENV{VULKAN_SDK}/Bin" "$ENV{VULKAN_SDK}/bin") 751 find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE glslangValidator HINTS "$ENV{VULKAN_SDK}/Bin" "$ENV{VULKAN_SDK}/bin")
696 endif() 752 endif()
@@ -722,6 +778,19 @@ if(TARGET Vulkan::Headers)
722 if(BUILD_TESTING) 778 if(BUILD_TESTING)
723 add_test(NAME vk_device_pick COMMAND vk_device_pick_test) 779 add_test(NAME vk_device_pick COMMAND vk_device_pick_test)
724 endif() 780 endif()
781 # Committed BC* texture zero-initialization via vk.zero_buffer or vk.copy_scratch (D3D-220).
782 add_executable(vk_bc_zero_init_test test/vk_bc_zero_init_test.cpp)
783 target_link_libraries(vk_bc_zero_init_test PRIVATE Vulkan::Headers ${CMAKE_DL_LIBS})
784 if(WIN32)
785 target_compile_definitions(vk_bc_zero_init_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
786 endif()
787 if(MSVC)
788 target_compile_options(vk_bc_zero_init_test PRIVATE /W4 /permissive- /utf-8)
789 endif()
790 if(BUILD_TESTING)
791 add_test(NAME vk_bc_zero_init COMMAND vk_bc_zero_init_test)
792 set_tests_properties(vk_bc_zero_init PROPERTIES SKIP_RETURN_CODE 77)
793 endif()
725 # CPU-only: the bindless set's array sizes from synthetic device limits. 794 # CPU-only: the bindless set's array sizes from synthetic device limits.
726 add_executable(bindless_sizing_test test/bindless_sizing_test.cpp) 795 add_executable(bindless_sizing_test test/bindless_sizing_test.cpp)
727 target_link_libraries(bindless_sizing_test PRIVATE Vulkan::Headers) 796 target_link_libraries(bindless_sizing_test PRIVATE Vulkan::Headers)
@@ -820,6 +889,8 @@ if(TARGET Vulkan::Headers)
820 target_compile_options(d3d12_queue_wait_test PRIVATE /W4 /permissive- /utf-8) 889 target_compile_options(d3d12_queue_wait_test PRIVATE /W4 /permissive- /utf-8)
821 add_test(NAME d3d12_queue_wait COMMAND d3d12_queue_wait_test) 890 add_test(NAME d3d12_queue_wait COMMAND d3d12_queue_wait_test)
822 set_tests_properties(d3d12_queue_wait PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 20) 891 set_tests_properties(d3d12_queue_wait PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 20)
892 add_test(NAME d3d12_queue_wait_timeout COMMAND d3d12_queue_wait_test --timeout-control)
893 set_tests_properties(d3d12_queue_wait_timeout PROPERTIES SKIP_RETURN_CODE 77 WILL_FAIL TRUE TIMEOUT 10)
823 894
824 # XDXR acceleration structures through BuildRaytracingAccelerationStructure (docs/d3d12_vulkan.md 4.8): the 895 # XDXR acceleration structures through BuildRaytracingAccelerationStructure (docs/d3d12_vulkan.md 4.8): the
825 # device builds them, tools/xdxr_bvh.py checks them. 896 # device builds them, tools/xdxr_bvh.py checks them.
@@ -928,6 +999,14 @@ if(TARGET Vulkan::Headers)
928 target_compile_options(queue_proxy_test PRIVATE /W4 /permissive- /utf-8) 999 target_compile_options(queue_proxy_test PRIVATE /W4 /permissive- /utf-8)
929 add_test(NAME queue_proxy COMMAND queue_proxy_test) 1000 add_test(NAME queue_proxy COMMAND queue_proxy_test)
930 set_tests_properties(queue_proxy PROPERTIES SKIP_RETURN_CODE 77) 1001 set_tests_properties(queue_proxy PROPERTIES SKIP_RETURN_CODE 77)
1002 # Xbox-ABI command allocator proxies (device slot 9) on the Vulkan device, and the unwrapped PC allocator on the
1003 # host runtime: forwarding, refused tail, guard region, lists and GPU copies on the proxy. 77: no device at all.
1004 add_executable(allocator_proxy_test test/allocator_proxy_test.cpp)
1005 target_link_libraries(allocator_proxy_test PRIVATE gta6rt_d3d12_com d3d12 dxgi)
1006 target_compile_definitions(allocator_proxy_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
1007 target_compile_options(allocator_proxy_test PRIVATE /W4 /permissive- /utf-8)
1008 add_test(NAME allocator_proxy COMMAND allocator_proxy_test)
1009 set_tests_properties(allocator_proxy PROPERTIES SKIP_RETURN_CODE 77)
931 # The countdown behind those event-backed waits, with no GPU: the full unsigned count, no wrap past zero. 1010 # The countdown behind those event-backed waits, with no GPU: the full unsigned count, no wrap past zero.
932 add_executable(d3d12_fence_waiter_test test/d3d12_fence_waiter_test.cpp) 1011 add_executable(d3d12_fence_waiter_test test/d3d12_fence_waiter_test.cpp)
933 target_compile_definitions(d3d12_fence_waiter_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) 1012 target_compile_definitions(d3d12_fence_waiter_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
@@ -1066,7 +1145,7 @@ if(TARGET Vulkan::Headers)
1066 add_custom_command( 1145 add_custom_command(
1067 OUTPUT ${LEONIDA_M15_FILES} 1146 OUTPUT ${LEONIDA_M15_FILES}
1068 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M15_DIR} 1147 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M15_DIR}
1069 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "PATH=${LEONIDA_SPIRV_TOOLS_NATIVE};$ENV{PATH}" 1148 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}"
1070 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1149 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
1071 ${LEONIDA_M15_DIR} vs_m15 ps_m15 1150 ${LEONIDA_M15_DIR} vs_m15 ps_m15
1072 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1151 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
@@ -1094,7 +1173,7 @@ if(TARGET Vulkan::Headers)
1094 add_custom_command( 1173 add_custom_command(
1095 OUTPUT ${LEONIDA_M2_FILES} 1174 OUTPUT ${LEONIDA_M2_FILES}
1096 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M2_DIR} 1175 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M2_DIR}
1097 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "PATH=${LEONIDA_SPIRV_TOOLS_NATIVE};$ENV{PATH}" 1176 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}"
1098 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1177 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
1099 ${LEONIDA_M2_DIR} vs_m2 ps_m2 ps_m2_uoff 1178 ${LEONIDA_M2_DIR} vs_m2 ps_m2 ps_m2_uoff
1100 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1179 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
@@ -1124,7 +1203,7 @@ if(TARGET Vulkan::Headers)
1124 add_custom_command( 1203 add_custom_command(
1125 OUTPUT ${LEONIDA_M3_FILES} 1204 OUTPUT ${LEONIDA_M3_FILES}
1126 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M3_DIR} 1205 COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M3_DIR}
1127 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "PATH=${LEONIDA_SPIRV_TOOLS_NATIVE};$ENV{PATH}" 1206 COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}"
1128 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1207 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
1129 ${LEONIDA_M3_DIR} vs_m3 ps_m3 vs_m2 ps_m3_post 1208 ${LEONIDA_M3_DIR} vs_m3 ps_m3 vs_m2 ps_m3_post
1130 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py 1209 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
@@ -1158,7 +1237,9 @@ if(TARGET Vulkan::Headers)
1158 target_compile_definitions(d3d12_indirect_zero_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) 1237 target_compile_definitions(d3d12_indirect_zero_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
1159 target_compile_options(d3d12_indirect_zero_test PRIVATE /W4 /permissive- /utf-8) 1238 target_compile_options(d3d12_indirect_zero_test PRIVATE /W4 /permissive- /utf-8)
1160 add_test(NAME d3d12_indirect_zero COMMAND d3d12_indirect_zero_test) 1239 add_test(NAME d3d12_indirect_zero COMMAND d3d12_indirect_zero_test)
1240 set_tests_properties(d3d12_indirect_zero PROPERTIES SKIP_RETURN_CODE 77)
1161 set_tests_properties(d3d12_node_mask PROPERTIES SKIP_RETURN_CODE 77) 1241 set_tests_properties(d3d12_node_mask PROPERTIES SKIP_RETURN_CODE 77)
1242 set_tests_properties(d3d12_indirect_zero PROPERTIES SKIP_RETURN_CODE 77)
1162 1243
1163 # CopyResource / CopyTextureRegion between BC and its uncompressed equivalent (and depth <-> colour) against the 1244 # CopyResource / CopyTextureRegion between BC and its uncompressed equivalent (and depth <-> colour) against the
1164 # host runtime and WARP; run explicitly on a Vulkan GPU. 1245 # host runtime and WARP; run explicitly on a Vulkan GPU.
@@ -1280,9 +1361,82 @@ if(TARGET Vulkan::Headers)
1280 target_compile_options(d3d12_draw_test PRIVATE /W4 /permissive- /utf-8) 1361 target_compile_options(d3d12_draw_test PRIVATE /W4 /permissive- /utf-8)
1281 add_test(NAME d3d12_draw COMMAND d3d12_draw_test) 1362 add_test(NAME d3d12_draw COMMAND d3d12_draw_test)
1282 set_tests_properties(d3d12_draw PROPERTIES SKIP_RETURN_CODE 77) 1363 set_tests_properties(d3d12_draw PROPERTIES SKIP_RETURN_CODE 77)
1364 # Set 0 from the compute bind point: a compute PSO whose shader declares set-0 bindings samples through the
1365 # device's bindless set, which nothing but the layer binds.
1366 set(LEONIDA_TEST_CS_SET0_SAMPLE ${CMAKE_CURRENT_BINARY_DIR}/generated/cs_set0_sample.spv)
1367 add_custom_command(
1368 OUTPUT ${LEONIDA_TEST_CS_SET0_SAMPLE}
1369 COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V --target-env vulkan1.3 -o ${LEONIDA_TEST_CS_SET0_SAMPLE}
1370 ${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/cs_set0_sample.comp
1371 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/cs_set0_sample.comp
1372 COMMENT "Compiling the set-0 compute test shader"
1373 VERBATIM)
1374 add_executable(d3d12_set0_compute_test test/d3d12_set0_compute_test.cpp shims/d3d12_xs_device.cpp
1375 ${LEONIDA_TEST_CS_SET0_SAMPLE})
1376 target_link_libraries(d3d12_set0_compute_test PRIVATE gta6rt_d3d12_com)
1377 target_compile_definitions(d3d12_set0_compute_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX
1378 LEONIDA_TEST_CS_SET0_SAMPLE_SPV="${LEONIDA_TEST_CS_SET0_SAMPLE}")
1379 target_compile_options(d3d12_set0_compute_test PRIVATE /W4 /permissive- /utf-8)
1380 add_test(NAME d3d12_set0_compute COMMAND d3d12_set0_compute_test)
1381 set_tests_properties(d3d12_set0_compute PROPERTIES SKIP_RETURN_CODE 77)
1382 else()
1383 message(STATUS "glslangValidator not found: d3d12_compute_test, d3d12_draw_test and d3d12_set0_compute_test are not built")
1384 endif()
1385
1386 # Subgroup size control in PSOs, end to end: runtime/test/shaders/cs_w64x_readlane.asm translated natively and with
1387 # --wave64-emulate, and cs_wqm_w32.asm, built here with tools/rdna2spirv.py through test/shaders/build.py. Needs
1388 # llvm-mc with the AMDGPU target (LLVM_MC in the environment, as for the other shader tests, or llvm-mc on PATH)
1389 # and the Vulkan SDK's spirv tools; without them the test is not built.
1390 if(DEFINED ENV{LLVM_MC})
1391 set(LEONIDA_LLVM_MC "$ENV{LLVM_MC}")
1392 else()
1393 find_program(LEONIDA_LLVM_MC llvm-mc HINTS "C:/msys64/ucrt64/bin")
1394 endif()
1395 if(LEONIDA_LLVM_MC AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
1396 set(LEONIDA_SG_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/subgroup_shaders)
1397 set(LEONIDA_SG_INDEXES "")
1398 foreach(case "w64_native;cs_w64x_readlane;0" "w64_emulated;cs_w64x_readlane;1" "w32_native;cs_wqm_w32;0"
1399 "ps_w64_native;ps_w64x_readlane;0")
1400 list(GET case 0 folder)
1401 list(GET case 1 shader)
1402 list(GET case 2 emulate)
1403 set(index ${LEONIDA_SG_DIR}/${folder}/spirv/index.json)
1404 add_custom_command(
1405 OUTPUT ${index}
1406 COMMAND ${CMAKE_COMMAND} -E env LLVM_MC=${LEONIDA_LLVM_MC} LEONIDA_W64_EMULATE=${emulate}
1407 $<TARGET_FILE:Python3::Interpreter> -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
1408 ${LEONIDA_SG_DIR}/${folder} ${shader}
1409 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py
1410 ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/${shader}.asm
1411 ${CMAKE_CURRENT_SOURCE_DIR}/../tools/rdna2spirv.py
1412 COMMENT "Translating ${shader} for the subgroup size test (${folder})"
1413 VERBATIM)
1414 list(APPEND LEONIDA_SG_INDEXES ${index})
1415 endforeach()
1416 # The probe shaders that store the subgroup size the driver ran them with, and a one-triangle vertex shader.
1417 foreach(source cs_sg_probe.comp ps_sg_probe.frag vs_sg_fullscreen.vert)
1418 set(output ${LEONIDA_SG_DIR}/glsl/${source}.spv)
1419 add_custom_command(
1420 OUTPUT ${output}
1421 COMMAND ${CMAKE_COMMAND} -E make_directory ${LEONIDA_SG_DIR}/glsl
1422 COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V --target-env vulkan1.3 -o ${output}
1423 ${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/${source}
1424 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/${source}
1425 COMMENT "Compiling ${source}"
1426 VERBATIM)
1427 list(APPEND LEONIDA_SG_INDEXES ${output})
1428 endforeach()
1429 add_executable(d3d12_subgroup_test test/d3d12_subgroup_test.cpp shims/d3d12_xs_device.cpp ${LEONIDA_SG_INDEXES})
1430 target_link_libraries(d3d12_subgroup_test PRIVATE gta6rt_d3d12_com)
1431 target_compile_definitions(d3d12_subgroup_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX
1432 LEONIDA_TEST_SUBGROUP_SHADERS="${LEONIDA_SG_DIR}")
1433 target_compile_options(d3d12_subgroup_test PRIVATE /W4 /permissive- /utf-8)
1434 add_test(NAME d3d12_subgroup COMMAND d3d12_subgroup_test)
1435 set_tests_properties(d3d12_subgroup PROPERTIES SKIP_RETURN_CODE 77)
1283 else() 1436 else()
1284 message(STATUS "glslangValidator not found: d3d12_compute_test and d3d12_draw_test are not built") 1437 message(STATUS "llvm-mc (set LLVM_MC) or glslangValidator not found: d3d12_subgroup_test is not built")
1285 endif() 1438 endif()
1439
1286 # The loader can create this device instead of the host's (D3D12XboxCreateDevice, LEONIDA_D3D12=vulkan). 1440 # The loader can create this device instead of the host's (D3D12XboxCreateDevice, LEONIDA_D3D12=vulkan).
1287 if(TARGET gta6rt) 1441 if(TARGET gta6rt)
1288 target_link_libraries(gta6rt PRIVATE gta6rt_d3d12_com) 1442 target_link_libraries(gta6rt PRIVATE gta6rt_d3d12_com)
@@ -1392,6 +1546,10 @@ if(TARGET Vulkan::Headers)
1392 endif() 1546 endif()
1393 add_test(NAME replay_cpu_bench_selftest COMMAND replay_cpu_bench --self-test) 1547 add_test(NAME replay_cpu_bench_selftest COMMAND replay_cpu_bench --self-test)
1394 add_test(NAME vk_descriptor_bench_selftest COMMAND vk_descriptor_bench --self-test) 1548 add_test(NAME vk_descriptor_bench_selftest COMMAND vk_descriptor_bench --self-test)
1549 # The subgroup size a pipeline stage asks for, from synthetic index entries and device properties.
1550 add_executable(subgroup_size_test test/subgroup_size_test.cpp)
1551 target_link_libraries(subgroup_size_test PRIVATE Vulkan::Headers)
1552 add_test(NAME subgroup_size COMMAND subgroup_size_test)
1395 endif() 1553 endif()
1396else() 1554else()
1397 message(STATUS "Vulkan headers not found: GPU test tools, vk_pipeline_check, d3d12_state_map_test and " 1555 message(STATUS "Vulkan headers not found: GPU test tools, vk_pipeline_check, d3d12_state_map_test and "
diff --git a/runtime/README.md b/runtime/README.md
index 85907e335..7060f4368 100644
--- a/runtime/README.md
+++ b/runtime/README.md
@@ -204,6 +204,9 @@ SDK, or `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` to download the pinned Khronos Vulka
204 Vulkan SDK's `spirv-as` and `spirv-val` at build time. 204 Vulkan SDK's `spirv-as` and `spirv-val` at build time.
205- `d3d12_compute_test` — the compute path: root signature, a compute PSO found by its FSSM hash in a 205- `d3d12_compute_test` — the compute path: root signature, a compute PSO found by its FSSM hash in a
206 translator-style index, root arguments through the GPU address arena, and two dispatches. 206 translator-style index, root arguments through the GPU address arena, and two dispatches.
207- `d3d12_set0_compute_test` — set 0 from the compute bind point: a compute PSO whose index entry lists set-0
208 bindings, and four dispatches that sample two SRVs, bytes no view was made for and a clamping sampler through
209 the bindless set the layer binds.
207- `d3d12_present_test` — milestone M0: opens a window and presents 60 cleared frames through the proxy on 210- `d3d12_present_test` — milestone M0: opens a window and presents 60 cleared frames through the proxy on
208 Vulkan, resizes it and presents 10 more, and checks the colour on screen. A driver double then injects an 211 Vulkan, resizes it and presents 10 more, and checks the colour on screen. A driver double then injects an
209 out-of-date and a suboptimal present, a failed semaphore during a swapchain recreation and a failed blit 212 out-of-date and a suboptimal present, a failed semaphore during a swapchain recreation and a failed blit
@@ -232,6 +235,14 @@ The PE-loader and Bink-decode tests that need the retail package are optional: w
232`LEONIDA_GAME_DIR` (and, for Bink, `LEONIDA_MOVIE`) is unset they print `SKIP` and exit 0. They read 235`LEONIDA_GAME_DIR` (and, for Bink, `LEONIDA_MOVIE`) is unset they print `SKIP` and exit 0. They read
233the files in place and never copy or commit game data. 236the files in place and never copy or commit game data.
234 237
238`shader_library_corpus_test` runs the D3D12 layer's shader lookup (`src/shader_library.h`) over a work folder
239that `make_game.py --stages shaders` built from your copy. With `LEONIDA_SHADERS=<work>/shaders/spirv` it takes
240every container in `<work>/shaders/dxbc` (or `LEONIDA_SHADER_DXBC`), inflates its FSSM program and looks it up
241under the stage its DXIL program header names. Each container has to find its own `index.json` entry and a
242readable `.spv`, every entry has to be reached, and in containers with more than one 0x0D payload no earlier
243payload may be the indexed program. Without `LEONIDA_SHADERS` it prints `SKIP` (CTest reports it as skipped).
244It prints counts only; on the 1.0.2.1 corpus all 26,503 containers resolve.
245
235## Current limits 246## Current limits
236 247
237`gta6rt --run <exe> [-- args]` runs an executable's entry point inside the runtime (`shims/process.cpp` gives it its 248`gta6rt --run <exe> [-- args]` runs an executable's entry point inside the runtime (`shims/process.cpp` gives it its
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 6fc3e2c51..581bc0fa9 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -113,8 +113,9 @@ class CommandAllocator final
113 : public Child<CommandAllocator, ID3D12CommandAllocatorStubs, ID3D12Object, ID3D12DeviceChild, ID3D12Pageable, 113 : public Child<CommandAllocator, ID3D12CommandAllocatorStubs, ID3D12Object, ID3D12DeviceChild, ID3D12Pageable,
114 ID3D12CommandAllocator> { 114 ID3D12CommandAllocator> {
115public: 115public:
116 // {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10} 116 // {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10}, public in d3d12_xs_device.h: the device proxy's slot 9 wraps an allocator
117 static constexpr GUID kTag{0x7d0e6b51, 0x34a2, 0x4f0c, {0x9a, 0x61, 0x0c, 0x5b, 0x2e, 0x8f, 0x4a, 0x10}}; 117 // in an Xbox-ABI allocator proxy only when it answers this tag, because from() below resolves such a proxy.
118 static constexpr GUID kTag = d3d12_xs::kLeonidaCommandAllocatorTag;
118 explicit CommandAllocator(D3D12_COMMAND_LIST_TYPE type) : type_(type) {} 119 explicit CommandAllocator(D3D12_COMMAND_LIST_TYPE type) : type_(type) {}
119 // Lists own their recorded commands, so there is nothing to free. As on the PC runtime (D3D-51, measured by 120 // Lists own their recorded commands, so there is nothing to free. As on the PC runtime (D3D-51, measured by
120 // d3d12_vulkan_device_test): E_FAIL while a list is recording into this allocator, and S_OK while its lists are 121 // d3d12_vulkan_device_test): E_FAIL while a list is recording into this allocator, and S_OK while its lists are
@@ -124,7 +125,12 @@ public:
124 // The one list that is recording into this allocator, or null. D3D12 allows one at a time. 125 // The one list that is recording into this allocator, or null. D3D12 allows one at a time.
125 const void* recording() const { return recording_; } 126 const void* recording() const { return recording_; }
126 void set_recording(const void* list) { recording_ = list; } 127 void set_recording(const void* list) { recording_ = list; }
127 static CommandAllocator* from(IUnknown* object) { return Child::from<CommandAllocator>(object); } 128 // An allocator proxy (the title's allocator from device slot 9) stands for the allocator behind it, so every
129 // list method that takes an allocator (CreateCommandList, Reset) resolves it here.
130 static CommandAllocator* from(IUnknown* object) {
131 if (ID3D12CommandAllocator* real = d3d12_xs::allocator_proxy_real_allocator(object)) object = real;
132 return Child::from<CommandAllocator>(object);
133 }
128 134
129private: 135private:
130 D3D12_COMMAND_LIST_TYPE type_; 136 D3D12_COMMAND_LIST_TYPE type_;
@@ -214,10 +220,14 @@ public:
214 bind_root(compute_, signature); 220 bind_root(compute_, signature);
215 } 221 }
216 void STDMETHODCALLTYPE SetGraphicsRootSignature(ID3D12RootSignature* signature) override { 222 void STDMETHODCALLTYPE SetGraphicsRootSignature(ID3D12RootSignature* signature) override {
223 d3d12_trace::record("ID3D12GraphicsCommandList::SetGraphicsRootSignature");
217 bind_root(graphics_, signature); 224 bind_root(graphics_, signature);
218 } 225 }
219 226
220 void STDMETHODCALLTYPE SetPipelineState(ID3D12PipelineState* state) override { set_pipeline(state); } 227 void STDMETHODCALLTYPE SetPipelineState(ID3D12PipelineState* state) override {
228 d3d12_trace::record("ID3D12GraphicsCommandList::SetPipelineState");
229 set_pipeline(state);
230 }
221 231
222 // The bound heaps matter to direct heap indexing, which is still open (section 3.4); tables carry their VAs. 232 // The bound heaps matter to direct heap indexing, which is still open (section 3.4); tables carry their VAs.
223 void STDMETHODCALLTYPE SetDescriptorHeaps(UINT, ID3D12DescriptorHeap* const*) override {} 233 void STDMETHODCALLTYPE SetDescriptorHeaps(UINT, ID3D12DescriptorHeap* const*) override {}
@@ -327,11 +337,13 @@ public:
327 } 337 }
328 338
329 void STDMETHODCALLTYPE DrawInstanced(UINT vertices, UINT instances, UINT first_vertex, UINT first_instance) override { 339 void STDMETHODCALLTYPE DrawInstanced(UINT vertices, UINT instances, UINT first_vertex, UINT first_instance) override {
340 d3d12_trace::record("ID3D12GraphicsCommandList::DrawInstanced");
330 record_draw(false, vertices, instances, first_vertex, 0, first_instance); 341 record_draw(false, vertices, instances, first_vertex, 0, first_instance);
331 } 342 }
332 343
333 void STDMETHODCALLTYPE DrawIndexedInstanced(UINT indices, UINT instances, UINT first_index, INT base_vertex, 344 void STDMETHODCALLTYPE DrawIndexedInstanced(UINT indices, UINT instances, UINT first_index, INT base_vertex,
334 UINT first_instance) override { 345 UINT first_instance) override {
346 d3d12_trace::record("ID3D12GraphicsCommandList::DrawIndexedInstanced");
335 record_draw(true, indices, instances, first_index, base_vertex, first_instance); 347 record_draw(true, indices, instances, first_index, base_vertex, first_instance);
336 } 348 }
337 349
diff --git a/runtime/shims/d3d12_com.h b/runtime/shims/d3d12_com.h
index 51b4d3136..2e1f2d3c5 100644
--- a/runtime/shims/d3d12_com.h
+++ b/runtime/shims/d3d12_com.h
@@ -25,6 +25,7 @@
25#include <vector> 25#include <vector>
26 26
27#include "../src/root_signature.h" 27#include "../src/root_signature.h"
28#include "../src/subgroup_size.h"
28 29
29namespace leonida { 30namespace leonida {
30class VulkanPresenter; 31class VulkanPresenter;
@@ -77,6 +78,9 @@ struct VulkanDeviceInfo {
77 bool separate_depth_stencil_layouts = true; 78 bool separate_depth_stencil_layouts = true;
78 std::uint32_t max_push_constants_size = 0; 79 std::uint32_t max_push_constants_size = 0;
79 bool push_constants_need_fallback = false; 80 bool push_constants_need_fallback = false;
81 // The subgroup sizes the device offers and whether subgroupSizeControl / computeFullSubgroups are enabled on it
82 // (src/subgroup_size.h). Default: nothing, so pipelines request no size.
83 leonida::SubgroupSizeCaps subgroup;
80 // Enabled: runtimeDescriptorArray, the dynamic indexing of sampled- and storage-image arrays, and update after 84 // Enabled: runtimeDescriptorArray, the dynamic indexing of sampled- and storage-image arrays, and update after
81 // bind for sampled images, storage images and storage buffers. The device then keeps the bindless set 0 of 85 // bind for sampled images, storage images and storage buffers. The device then keeps the bindless set 0 of
82 // the translated shaders (docs section 3.4), and texture views and samplers are put in it as they are 86 // the translated shaders (docs section 3.4), and texture views and samplers are put in it as they are
@@ -260,6 +264,8 @@ struct RootArgumentLayout {
260const RootArgumentLayout* root_signature_layout(ID3D12RootSignature* signature); 264const RootArgumentLayout* root_signature_layout(ID3D12RootSignature* signature);
261std::uintptr_t compute_pipeline_id(ID3D12PipelineState* pipeline); 265std::uintptr_t compute_pipeline_id(ID3D12PipelineState* pipeline);
262std::uintptr_t graphics_pipeline_id(ID3D12PipelineState* pipeline); 266std::uintptr_t graphics_pipeline_id(ID3D12PipelineState* pipeline);
267// What each stage of a Vulkan device's PSO asked for (src/subgroup_size.h), in creation order; null for another PSO.
268const std::vector<leonida::SubgroupRequest>* pipeline_subgroup_requests(ID3D12PipelineState* pipeline);
263 269
264// The size of every descriptor slot (GetDescriptorHandleIncrementSize), for handle ranges. 270// The size of every descriptor slot (GetDescriptorHandleIncrementSize), for handle ranges.
265inline constexpr UINT descriptor_size = 32; 271inline constexpr UINT descriptor_size = 32;
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp
index 54662bacb..a8a14a316 100644
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -33,7 +33,6 @@
33#include <iterator> 33#include <iterator>
34#include <map> 34#include <map>
35#include <cstring> 35#include <cstring>
36#include <map>
37#include <memory> 36#include <memory>
38#include <mutex> 37#include <mutex>
39#include <set> 38#include <set>
@@ -67,6 +66,37 @@ void log_once(const char* what, int value) {
67 if (seen.insert({what, value}).second) std::fprintf(stderr, "[rt] d3d12: %s %d\n", what, value); 66 if (seen.insert({what, value}).second) std::fprintf(stderr, "[rt] d3d12: %s %d\n", what, value);
68} 67}
69 68
69// A shader whose subgroup size cannot be had runs at the device's: inexact if it crosses the halves of a wave64 (or,
70// for a wave32 shader on a 64-wide default, reads lanes that are not its own). Logged once per stage with the first
71// shader's name, then again at 10, 100, 1000... of that stage so a whole corpus stays readable.
72void report_subgroup_unavailable(const leonida::ShaderEntry& entry, const leonida::SubgroupRequest& request,
73 const leonida::SubgroupSizeCaps& caps) {
74 static std::mutex mutex;
75 static std::map<std::string, std::pair<std::set<std::string>, unsigned>> seen; // stage -> names, next report
76 std::lock_guard lock(mutex);
77 auto& [names, next_report] = seen[entry.stage];
78 if (!names.insert(entry.name).second) return;
79 if (names.size() == 1) next_report = 10;
80 else if (names.size() != next_report) return;
81 else next_report *= 10;
82 const bool emulable = entry.stage == "cs" || entry.stage == "ms";
83 const std::string so_far =
84 names.size() > 1 ? " (shaders of this stage so far: " + std::to_string(names.size()) + ")" : "";
85 std::fprintf(stderr,
86 "[rt] d3d12: %s (%s) is a %u-wide shader but this device cannot require that subgroup size for the "
87 "stage (device sizes %u..%u, default %u, subgroupSizeControl %s); it runs at the device's size and "
88 "is inexact where lanes of the other half matter%s\n",
89 entry.name.c_str(), entry.stage.c_str(), request.wanted, caps.min_size, caps.max_size,
90 caps.default_size, caps.subgroup_size_control ? "on" : "off",
91 so_far.c_str());
92 if (emulable && request.wanted == 64)
93 std::fprintf(stderr, "[rt] d3d12: translate wave64 %s shaders with --wave64-emulate for this GPU "
94 "(make_game.py --wave64-emulate auto does)\n", entry.stage.c_str());
95 else if (request.wanted == 64)
96 std::fprintf(stderr, "[rt] d3d12: no emulation exists for wave64 %s shaders yet (docs/d3d12_vulkan.md, "
97 "subgroup size)\n", entry.stage.c_str());
98}
99
70struct Format { 100struct Format {
71 VkFormat format = VK_FORMAT_UNDEFINED; 101 VkFormat format = VK_FORMAT_UNDEFINED;
72 VkImageAspectFlags aspects = 0; 102 VkImageAspectFlags aspects = 0;
@@ -131,6 +161,10 @@ Format vulkan_format(DXGI_FORMAT format, bool depth) {
131 // Vulkan 1.3 requires sampling it (formerly VK_EXT_4444_formats). 161 // Vulkan 1.3 requires sampling it (formerly VK_EXT_4444_formats).
132 case DXGI_FORMAT_B4G4R4A4_UNORM: return {VK_FORMAT_A4R4G4B4_UNORM_PACK16, color}; 162 case DXGI_FORMAT_B4G4R4A4_UNORM: return {VK_FORMAT_A4R4G4B4_UNORM_PACK16, color};
133 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return {VK_FORMAT_B8G8R8A8_SRGB, color}; 163 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return {VK_FORMAT_B8G8R8A8_SRGB, color};
164 // The X byte has no channel of its own: the BGRA8 images hold it, and shader views read alpha as 1.
165 case DXGI_FORMAT_B8G8R8X8_TYPELESS: return {VK_FORMAT_B8G8R8A8_UNORM, color, true};
166 case DXGI_FORMAT_B8G8R8X8_UNORM: return {VK_FORMAT_B8G8R8A8_UNORM, color};
167 case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return {VK_FORMAT_B8G8R8A8_SRGB, color};
134 case DXGI_FORMAT_R16G16_TYPELESS: return {VK_FORMAT_R16G16_SFLOAT, color, true}; 168 case DXGI_FORMAT_R16G16_TYPELESS: return {VK_FORMAT_R16G16_SFLOAT, color, true};
135 case DXGI_FORMAT_R16G16_FLOAT: return {VK_FORMAT_R16G16_SFLOAT, color}; 169 case DXGI_FORMAT_R16G16_FLOAT: return {VK_FORMAT_R16G16_SFLOAT, color};
136 case DXGI_FORMAT_R16G16_UINT: return {VK_FORMAT_R16G16_UINT, color}; 170 case DXGI_FORMAT_R16G16_UINT: return {VK_FORMAT_R16G16_UINT, color};
@@ -225,6 +259,13 @@ bool rgb96_refused(const D3D12_RESOURCE_DESC& desc) {
225 D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)); 259 D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL));
226} 260}
227 261
262// B8G8R8X8: the BGRA8 Vulkan formats with the alpha byte unused. Its typeless family is a family of its own, so
263// views never cross between it and B8G8R8A8, although both land on the same VkFormat.
264bool alpha_unused(DXGI_FORMAT format) {
265 return format == DXGI_FORMAT_B8G8R8X8_TYPELESS || format == DXGI_FORMAT_B8G8R8X8_UNORM ||
266 format == DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
267}
268
228// The full mip chain's length for a texture this size. 269// The full mip chain's length for a texture this size.
229UINT16 full_mips(UINT64 width, UINT height, UINT depth) { 270UINT16 full_mips(UINT64 width, UINT height, UINT depth) {
230 UINT16 mips = 0; 271 UINT16 mips = 0;
@@ -241,6 +282,14 @@ bool xr_bias_compatible(const D3D12_RESOURCE_DESC& desc) {
241 return mips == 1; 282 return mips == 1;
242} 283}
243 284
285// The Xbox tiled layout word (slot 76, docs/d3d12_vulkan.md section 4.2) is outside D3D12_TEXTURE_LAYOUT's
286// enumerators, so compare as an integer.
287constexpr UINT kXboxTiledLayout = 0x101;
288
289bool is_tiled_layout(D3D12_TEXTURE_LAYOUT layout) {
290 return layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE || static_cast<UINT>(layout) == kXboxTiledLayout;
291}
292
244// A volume RTV covers W slices of one mip. UINT_MAX extends through the last slice of that mip. 293// A volume RTV covers W slices of one mip. UINT_MAX extends through the last slice of that mip.
245leonida::TargetView volume_rtv(leonida::ResourceId id, const D3D12_RESOURCE_DESC& resource, 294leonida::TargetView volume_rtv(leonida::ResourceId id, const D3D12_RESOURCE_DESC& resource,
246 const D3D12_RENDER_TARGET_VIEW_DESC* view) { 295 const D3D12_RENDER_TARGET_VIEW_DESC* view) {
@@ -284,7 +333,8 @@ struct TextureCreateInfo {
284 info.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; 333 info.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
285 if (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; 334 if (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
286 if (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) info.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; 335 if (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) info.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
287 if (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) { 336 // No B8G8R8X8 view is ever a UAV, so its typeless family needs no storage usage (not every GPU has it for BGRA8).
337 if ((desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) && !alpha_unused(desc.Format)) {
288 info.usage |= VK_IMAGE_USAGE_STORAGE_BIT; 338 info.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
289 if (!volume && info.samples == VK_SAMPLE_COUNT_1_BIT && attachment_usable) 339 if (!volume && info.samples == VK_SAMPLE_COUNT_1_BIT && attachment_usable)
290 info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; 340 info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
@@ -331,6 +381,12 @@ struct DeviceState {
331 // True when VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 lacks native STORAGE_IMAGE but mutable R32_UINT+{R32_UINT,E5B9G9R9} 381 // True when VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 lacks native STORAGE_IMAGE but mutable R32_UINT+{R32_UINT,E5B9G9R9}
332 // is supported, so R9G9B9E5_SHAREDEXP UAV textures are backed by R32_UINT with separate storage/sampled views. 382 // is supported, so R9G9B9E5_SHAREDEXP UAV textures are backed by R32_UINT with separate storage/sampled views.
333 bool r9g9b9e5_uav_emulated = false; 383 bool r9g9b9e5_uav_emulated = false;
384 // D3D-219: VK_EXT_image_view_min_lod may select levels with minLodInteger = floor(minLod), the spec's
385 // "alternative", while D3D12's ResourceMinLODClamp is fractional. Intel's integrated GPUs on Windows do: a 0.75
386 // clamp sampled at LOD 0 with point mip filtering reads mip 0 (UHD 770 101.7092, Arrow Lake Xe-LPG; #1015).
387 // bind_image gives such a driver the clamp rounded to the nearest level, which point mip filtering selects
388 // exactly. LEONIDA_MIN_LOD_INTEGER=1 or 0 forces it either way.
389 bool min_lod_integer = false;
334 390
335 // Cached physical-device no-attachment sample counts for D3D12_OPTIONS19. 391 // Cached physical-device no-attachment sample counts for D3D12_OPTIONS19.
336 UINT no_output_sample_counts = 0; 392 UINT no_output_sample_counts = 0;
@@ -575,6 +631,13 @@ struct DeviceState {
575 log_once("96-bit (R32G32B32) render targets not supported; format", desc.Format); 631 log_once("96-bit (R32G32B32) render targets not supported; format", desc.Format);
576 return {}; 632 return {};
577 } 633 }
634 // The host runtime refuses typed B8G8R8X8 with unordered access (its typeless family is accepted): the
635 // BGRA8 image could take storage writes, but D3D12 has no typed UAV for these formats.
636 if (alpha_unused(desc.Format) && desc.Format != DXGI_FORMAT_B8G8R8X8_TYPELESS &&
637 (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) {
638 log_once("B8G8R8X8 textures cannot allow unordered access; format", desc.Format);
639 return {};
640 }
578 Format format = texture_storage_format(desc.Format, desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL); 641 Format format = texture_storage_format(desc.Format, desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
579 format.d24 = format.format == VK_FORMAT_D24_UNORM_S8_UINT; // native or not: clears are quantised 642 format.d24 = format.format == VK_FORMAT_D24_UNORM_S8_UINT; // native or not: clears are quantised
580 if (format.format == VK_FORMAT_D24_UNORM_S8_UINT && !depth_usable(format.format)) { 643 if (format.format == VK_FORMAT_D24_UNORM_S8_UINT && !depth_usable(format.format)) {
@@ -733,6 +796,9 @@ struct DeviceState {
733 log_once("SRV requires VK_EXT_image_view_min_lod; first mip", int(image.first_mip)); 796 log_once("SRV requires VK_EXT_image_view_min_lod; first mip", int(image.first_mip));
734 return false; 797 return false;
735 } 798 }
799 // A driver that floors the clamp (min_lod_integer) gets the level point mip filtering picks:
800 // nearest(d') = ceil(d' + 0.5) - 1, the spec's preferred rounding. It stays within the mip range.
801 if (min_lod_integer) clamp.minLod = std::ceil(clamp.minLod + 0.5f) - 1.0f;
736 clamp.pNext = view_info.pNext; 802 clamp.pNext = view_info.pNext;
737 view_info.pNext = &clamp; 803 view_info.pNext = &clamp;
738 } 804 }
@@ -1298,6 +1364,10 @@ public:
1298 binding.size = desc_.Width; 1364 binding.size = desc_.Width;
1299 binding.buffer = device_.arena.buffer; 1365 binding.buffer = device_.arena.buffer;
1300 binding.buffer_offset = va_; 1366 binding.buffer_offset = va_;
1367 binding.va = va_;
1368 binding.host_readable = (heap_.Type == D3D12_HEAP_TYPE_READBACK ||
1369 (heap_.Type == D3D12_HEAP_TYPE_CUSTOM &&
1370 heap_.CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK));
1301 device_.context->add_resource(id(), binding); 1371 device_.context->add_resource(id(), binding);
1302 return S_OK; 1372 return S_OK;
1303 } 1373 }
@@ -1403,8 +1473,9 @@ public:
1403 D3D12_RESOURCE_DESC STDMETHODCALLTYPE GetDesc() override { 1473 D3D12_RESOURCE_DESC STDMETHODCALLTYPE GetDesc() override {
1404 D3D12_RESOURCE_DESC desc = desc_; 1474 D3D12_RESOURCE_DESC desc = desc_;
1405 if (!desc.Alignment) { 1475 if (!desc.Alignment) {
1406 desc.Alignment = desc.SampleDesc.Count > 1 ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT 1476 desc.Alignment = (desc.SampleDesc.Count > 1 && !is_tiled_layout(desc.Layout))
1407 : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; 1477 ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT
1478 : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
1408 } 1479 }
1409 return desc; 1480 return desc;
1410 } 1481 }
@@ -1880,6 +1951,7 @@ public:
1880 bool reserved() const { return reserved_; } 1951 bool reserved() const { return reserved_; }
1881 VkDeviceSize offset() const { return offset_; } 1952 VkDeviceSize offset() const { return offset_; }
1882 UINT64 bytes() const { return desc_.SizeInBytes; } 1953 UINT64 bytes() const { return desc_.SizeInBytes; }
1954 UINT64 alignment() const { return desc_.Alignment ? desc_.Alignment : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; }
1883 const D3D12_HEAP_PROPERTIES& properties() const { return desc_.Properties; } 1955 const D3D12_HEAP_PROPERTIES& properties() const { return desc_.Properties; }
1884 D3D12_HEAP_FLAGS flags() const { return desc_.Flags; } 1956 D3D12_HEAP_FLAGS flags() const { return desc_.Flags; }
1885 1957
@@ -1970,9 +2042,22 @@ public:
1970 return false; 2042 return false;
1971 } 2043 }
1972 2044
2045 // Asks for the subgroup size the shader was translated for, where the device allows (src/subgroup_size.h): the
2046 // stage gets VkPipelineShaderStageRequiredSubgroupSizeCreateInfo in `storage` (which must outlive pipeline
2047 // creation) and, for compute, REQUIRE_FULL_SUBGROUPS. A size the device cannot give is reported, not hidden.
2048 void subgroup_size_for(const leonida::ShaderEntry& entry, VkPipelineShaderStageRequiredSubgroupSizeCreateInfo& storage,
2049 VkPipelineShaderStageCreateInfo& stage) {
2050 const leonida::SubgroupRequest request = leonida::decide_subgroup_size(entry, device_.info.subgroup);
2051 if (request.outcome == leonida::SubgroupOutcome::unavailable)
2052 report_subgroup_unavailable(entry, request, device_.info.subgroup);
2053 leonida::apply_subgroup_request(request, storage, stage);
2054 subgroup_requests_.push_back(request);
2055 }
2056
1973 std::uintptr_t id() const { return reinterpret_cast<std::uintptr_t>(static_cast<const ID3D12PipelineState*>(this)); } 2057 std::uintptr_t id() const { return reinterpret_cast<std::uintptr_t>(static_cast<const ID3D12PipelineState*>(this)); }
1974 bool compute() const { return registered_ && !is_graphics_; } 2058 bool compute() const { return registered_ && !is_graphics_; }
1975 bool graphics() const { return registered_ && is_graphics_; } 2059 bool graphics() const { return registered_ && is_graphics_; }
2060 const std::vector<leonida::SubgroupRequest>& subgroup_requests() const { return subgroup_requests_; }
1976 2061
1977 // A VS (+ PS) pipeline for dynamic rendering. Vertex input comes from the input layout matched to the VS's 2062 // A VS (+ PS) pipeline for dynamic rendering. Vertex input comes from the input layout matched to the VS's
1978 // input signature by semantic name and index: location = the element's register, the translator's rule 2063 // input signature by semantic name and index: location = the element's register, the translator's rule
@@ -1997,9 +2082,14 @@ public:
1997 log_once("graphics pipeline stage not supported yet (hull/domain/geometry/stream output):", 0); 2082 log_once("graphics pipeline stage not supported yet (hull/domain/geometry/stream output):", 0);
1998 return E_NOTIMPL; 2083 return E_NOTIMPL;
1999 } 2084 }
2000 if (desc.SampleDesc.Count > 1) { 2085 const UINT samples = desc.SampleDesc.Count;
2001 log_once("multisampled graphics pipelines not supported yet; samples", int(desc.SampleDesc.Count)); 2086 if (!samples || samples > D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT || (samples & (samples - 1))) {
2002 return E_NOTIMPL; 2087 log_once("invalid graphics pipeline sample count:", int(samples));
2088 return E_INVALIDARG;
2089 }
2090 if (desc.SampleDesc.Quality != 0) {
2091 log_once("invalid graphics pipeline sample quality:", int(desc.SampleDesc.Quality));
2092 return E_INVALIDARG;
2003 } 2093 }
2004 const leonida::ShaderLibrary* library = device_.library(); 2094 const leonida::ShaderLibrary* library = device_.library();
2005 if (!library) return E_FAIL; 2095 if (!library) return E_FAIL;
@@ -2014,6 +2104,8 @@ public:
2014 Stage stages[2] = {{"vs", VK_SHADER_STAGE_VERTEX_BIT, desc.VS}, {"ps", VK_SHADER_STAGE_FRAGMENT_BIT, desc.PS}}; 2104 Stage stages[2] = {{"vs", VK_SHADER_STAGE_VERTEX_BIT, desc.VS}, {"ps", VK_SHADER_STAGE_FRAGMENT_BIT, desc.PS}};
2015 bool uses_bindless = false; // a stage declares set-0 bindings: the layout holds the device's set 0 2105 bool uses_bindless = false; // a stage declares set-0 bindings: the layout holds the device's set 0
2016 std::vector<VkPipelineShaderStageCreateInfo> stage_infos; 2106 std::vector<VkPipelineShaderStageCreateInfo> stage_infos;
2107 // Chained from stage_infos, which the recipe keeps for variants built at draw time: so they live in the recipe.
2108 auto& required_sizes = recipe_.required_sizes;
2017 const Stage* code_stage = nullptr; 2109 const Stage* code_stage = nullptr;
2018 for (Stage& stage : stages) { 2110 for (Stage& stage : stages) {
2019 if (!stage.code.pShaderBytecode || !stage.code.BytecodeLength) continue; // no PS: depth only 2111 if (!stage.code.pShaderBytecode || !stage.code.BytecodeLength) continue; // no PS: depth only
@@ -2061,6 +2153,7 @@ public:
2061 info.stage = stage.bit; 2153 info.stage = stage.bit;
2062 info.module = module; 2154 info.module = module;
2063 info.pName = "main"; 2155 info.pName = "main";
2156 subgroup_size_for(*stage.entry, required_sizes[stage_infos.size()], info);
2064 stage_infos.push_back(info); 2157 stage_infos.push_back(info);
2065 } 2158 }
2066 2159
@@ -2145,7 +2238,7 @@ public:
2145 raster.depthClampEnable = r.DepthClipEnable ? VK_FALSE : VK_TRUE; 2238 raster.depthClampEnable = r.DepthClipEnable ? VK_FALSE : VK_TRUE;
2146 2239
2147 VkPipelineMultisampleStateCreateInfo multisample{VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO}; 2240 VkPipelineMultisampleStateCreateInfo multisample{VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO};
2148 multisample.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; 2241 multisample.rasterizationSamples = VkSampleCountFlagBits(samples);
2149 const VkSampleMask sample_mask = desc.SampleMask; 2242 const VkSampleMask sample_mask = desc.SampleMask;
2150 multisample.pSampleMask = &sample_mask; 2243 multisample.pSampleMask = &sample_mask;
2151 multisample.alphaToCoverageEnable = desc.BlendState.AlphaToCoverageEnable; 2244 multisample.alphaToCoverageEnable = desc.BlendState.AlphaToCoverageEnable;
@@ -2231,6 +2324,55 @@ public:
2231 graphics_.depth_format = f.format; 2324 graphics_.depth_format = f.format;
2232 graphics_.depth_aspects = f.aspects; 2325 graphics_.depth_aspects = f.aspects;
2233 } 2326 }
2327 if (samples > 1) {
2328 const auto& dinfo = device_.info;
2329 const bool has_color = std::any_of(graphics_.color_formats.begin(), graphics_.color_formats.end(),
2330 [](VkFormat f) { return f != VK_FORMAT_UNDEFINED; });
2331 const bool has_depth = graphics_.depth_format != VK_FORMAT_UNDEFINED;
2332 if (const auto get_props = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(
2333 dinfo.get_instance_proc ? dinfo.get_instance_proc(dinfo.instance, "vkGetPhysicalDeviceProperties")
2334 : nullptr)) {
2335 VkPhysicalDeviceProperties props{};
2336 get_props(dinfo.physical, &props);
2337 VkSampleCountFlags supported = ~VkSampleCountFlags(0);
2338 if (has_color) supported &= props.limits.framebufferColorSampleCounts;
2339 if (has_depth && (graphics_.depth_aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
2340 supported &= props.limits.framebufferDepthSampleCounts;
2341 if (has_depth && (graphics_.depth_aspects & VK_IMAGE_ASPECT_STENCIL_BIT))
2342 supported &= props.limits.framebufferStencilSampleCounts;
2343 if (!has_color && !has_depth) supported &= props.limits.framebufferNoAttachmentsSampleCounts;
2344 if (!(supported & samples)) {
2345 log_once("multisample count not supported by framebuffer limits; samples", int(samples));
2346 return E_INVALIDARG;
2347 }
2348 }
2349 if ((has_color || has_depth) && !device_.image_format_properties) {
2350 log_once("cannot query per-format multisample support; samples", int(samples));
2351 return E_INVALIDARG;
2352 }
2353 for (const VkFormat fmt : graphics_.color_formats) {
2354 if (fmt == VK_FORMAT_UNDEFINED) continue;
2355 VkImageFormatProperties img_props{};
2356 if (device_.image_format_properties(dinfo.physical, fmt, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
2357 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, 0, &img_props) != VK_SUCCESS ||
2358 !(img_props.sampleCounts & samples)) {
2359 log_once("multisample count not supported by color attachment format; samples", int(samples));
2360 return E_INVALIDARG;
2361 }
2362 }
2363 if (has_depth) {
2364 VkImageFormatProperties img_props{};
2365 if (device_.image_format_properties(dinfo.physical, graphics_.depth_format, VK_IMAGE_TYPE_2D,
2366 VK_IMAGE_TILING_OPTIMAL,
2367 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, 0,
2368 &img_props) != VK_SUCCESS ||
2369 !(img_props.sampleCounts & samples)) {
2370 log_once("multisample count not supported by depth/stencil attachment format; samples",
2371 int(samples));
2372 return E_INVALIDARG;
2373 }
2374 }
2375 }
2234 // Every stage this path accepts reads the user SGPRs, so the range covers the whole stage table, not only the 2376 // Every stage this path accepts reads the user SGPRs, so the range covers the whole stage table, not only the
2235 // stages present. A stage added to the table (geometry, mesh) is covered without touching this. 2377 // stages present. A stage added to the table (geometry, mesh) is covered without touching this.
2236 for (const Stage& stage : stages) graphics_.push_stages |= stage.bit; 2378 for (const Stage& stage : stages) graphics_.push_stages |= stage.bit;
@@ -2308,7 +2450,6 @@ public:
2308 entry->name.c_str()); 2450 entry->name.c_str());
2309 return E_NOTIMPL; 2451 return E_NOTIMPL;
2310 } 2452 }
2311 if (entry->wave64) log_once("wave64 compute shader runs 32-wide (subgroup size control not requested yet)", 0);
2312 const std::vector<std::uint32_t> words = library->spirv(*entry); 2453 const std::vector<std::uint32_t> words = library->spirv(*entry);
2313 if (words.empty()) { 2454 if (words.empty()) {
2314 std::fprintf(stderr, "[rt] d3d12: %s.spv is missing or not SPIR-V\n", entry->name.c_str()); 2455 std::fprintf(stderr, "[rt] d3d12: %s.spv is missing or not SPIR-V\n", entry->name.c_str());
@@ -2336,6 +2477,8 @@ public:
2336 pipeline_info.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT; 2477 pipeline_info.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT;
2337 pipeline_info.stage.module = module_; 2478 pipeline_info.stage.module = module_;
2338 pipeline_info.stage.pName = "main"; 2479 pipeline_info.stage.pName = "main";
2480 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo required_size{};
2481 subgroup_size_for(*entry, required_size, pipeline_info.stage);
2339 pipeline_info.layout = pipeline_.layout; 2482 pipeline_info.layout = pipeline_.layout;
2340 if (vk.vkCreateComputePipelines(dev, VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &pipeline_.pipeline) != 2483 if (vk.vkCreateComputePipelines(dev, VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &pipeline_.pipeline) !=
2341 VK_SUCCESS) 2484 VK_SUCCESS)
@@ -2357,6 +2500,7 @@ private:
2357 // What a graphics pipeline is made from, so variants can be built at draw time. 2500 // What a graphics pipeline is made from, so variants can be built at draw time.
2358 struct Recipe { 2501 struct Recipe {
2359 std::vector<VkPipelineShaderStageCreateInfo> stages; 2502 std::vector<VkPipelineShaderStageCreateInfo> stages;
2503 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo required_sizes[2]{}; // what `stages` chain
2360 std::vector<VkVertexInputAttributeDescription> attributes; 2504 std::vector<VkVertexInputAttributeDescription> attributes;
2361 std::vector<VkVertexInputBindingDescription> bindings; 2505 std::vector<VkVertexInputBindingDescription> bindings;
2362 VkPipelineInputAssemblyStateCreateInfo assembly{}; 2506 VkPipelineInputAssemblyStateCreateInfo assembly{};
@@ -2452,6 +2596,7 @@ private:
2452 VkDeviceSize code_bytes_ = 0; 2596 VkDeviceSize code_bytes_ = 0;
2453 bool registered_ = false; 2597 bool registered_ = false;
2454 bool is_graphics_ = false; 2598 bool is_graphics_ = false;
2599 std::vector<leonida::SubgroupRequest> subgroup_requests_; // one per stage, in creation order
2455}; 2600};
2456 2601
2457// A view of a texture as Create*View describes it, before the resource's own shape is applied. 2602// A view of a texture as Create*View describes it, before the resource's own shape is applied.
@@ -2544,6 +2689,10 @@ bool image_descriptor(const Resource& resource, const TextureView& view, leonida
2544 log_once("incompatible typed A8 view format:", int(view.format)); 2689 log_once("incompatible typed A8 view format:", int(view.format));
2545 return false; 2690 return false;
2546 } 2691 }
2692 if (alpha_unused(view.format) != alpha_unused(desc.Format)) {
2693 log_once("view format from another typeless family (B8G8R8X8 and B8G8R8A8):", int(view.format));
2694 return false;
2695 }
2547 if ((view.format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP) != (desc.Format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP)) { 2696 if ((view.format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP) != (desc.Format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP)) {
2548 log_once("incompatible R9G9B9E5 view format:", int(view.format)); 2697 log_once("incompatible R9G9B9E5 view format:", int(view.format));
2549 return false; 2698 return false;
@@ -2611,9 +2760,11 @@ bool image_descriptor(const Resource& resource, const TextureView& view, leonida
2611 // D3D12's component mapping picks, for each of R, G, B, A, a channel of the format or a constant; the T# 2760 // D3D12's component mapping picks, for each of R, G, B, A, a channel of the format or a constant; the T#
2612 // says the same about the hardware's channels, which the format places. 2761 // says the same about the hardware's channels, which the format places.
2613 // A stencil view's format has its eight bits in G and no R, B or A of its own (0, 0, 1 when read). 2762 // A stencil view's format has its eight bits in G and no R, B or A of its own (0, 0, 1 when read).
2763 // B8G8R8X8 has no alpha: it reads 1.
2614 g::Swizzle channels = g::format_swizzle(view_format); 2764 g::Swizzle channels = g::format_swizzle(view_format);
2615 if (stencil) channels = {g::select_zero, g::select_x, g::select_zero, g::select_one}; 2765 if (stencil) channels = {g::select_zero, g::select_x, g::select_zero, g::select_one};
2616 else if (desc.Format == DXGI_FORMAT_A8_UNORM) channels = {g::select_zero, g::select_zero, g::select_zero, g::select_x}; 2766 else if (desc.Format == DXGI_FORMAT_A8_UNORM) channels = {g::select_zero, g::select_zero, g::select_zero, g::select_x};
2767 else if (alpha_unused(desc.Format)) channels[3] = g::select_one;
2617 for (UINT i = 0; i < 4; ++i) { 2768 for (UINT i = 0; i < 4; ++i) {
2618 const UINT from = D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(i, view.mapping); 2769 const UINT from = D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(i, view.mapping);
2619 if (msaa && from > D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1) { 2770 if (msaa && from > D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1) {
@@ -2895,6 +3046,15 @@ public:
2895 VkPhysicalDeviceProperties properties{}; 3046 VkPhysicalDeviceProperties properties{};
2896 device_properties(info.physical, &properties); 3047 device_properties(info.physical, &properties);
2897 state_.max_sampler_lod_bias = properties.limits.maxSamplerLodBias; 3048 state_.max_sampler_lod_bias = properties.limits.maxSamplerLodBias;
3049 {
3050 constexpr std::uint32_t kIntelVendorId = 0x8086;
3051 state_.min_lod_integer = properties.vendorID == kIntelVendorId &&
3052 properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
3053 char text[4] = {};
3054 size_t length = 0;
3055 if (getenv_s(&length, text, "LEONIDA_MIN_LOD_INTEGER") == 0 && length > 1)
3056 state_.min_lod_integer = text[0] != '0';
3057 }
2898 std::uint32_t family_count = 0; 3058 std::uint32_t family_count = 0;
2899 queue_families(info.physical, &family_count, nullptr); 3059 queue_families(info.physical, &family_count, nullptr);
2900 std::vector<VkQueueFamilyProperties> families(family_count); 3060 std::vector<VkQueueFamilyProperties> families(family_count);
@@ -2939,7 +3099,19 @@ public:
2939 get_properties(state_.info.physical, &properties); 3099 get_properties(state_.info.physical, &properties);
2940 features.ms_samples = {VK_SAMPLE_COUNT_4_BIT, state_.ms_fallback_samples(VK_FORMAT_R32_UINT), 3100 features.ms_samples = {VK_SAMPLE_COUNT_4_BIT, state_.ms_fallback_samples(VK_FORMAT_R32_UINT),
2941 state_.ms_fallback_samples(VK_FORMAT_R32_SINT)}; 3101 state_.ms_fallback_samples(VK_FORMAT_R32_SINT)};
2942 if (!leonida::bindless::size_bindings(features, properties.properties.limits, v11, indexed)) 3102 // Past maxPerSetDescriptors, ask the driver about the grown layout (D3D-219: Intel's Xe-LP reports 6159).
3103 const auto layout_support = reinterpret_cast<PFN_vkGetDescriptorSetLayoutSupport>(
3104 get_device(state_.info.device, "vkGetDescriptorSetLayoutSupport"));
3105 std::function<bool(const leonida::BindlessFeatures&)> layout_supported;
3106 if (layout_support)
3107 layout_supported = [&](const leonida::BindlessFeatures& candidate) {
3108 const leonida::bindless::SetLayout layout(candidate);
3109 VkDescriptorSetLayoutSupport support{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT};
3110 layout_support(state_.info.device, &layout.info, &support);
3111 return support.supported == VK_TRUE;
3112 };
3113 if (!leonida::bindless::size_bindings(features, properties.properties.limits, v11, indexed,
3114 layout_supported))
2943 std::fprintf(stderr, "[rt] d3d12: the device's descriptor limits are below the bindless set's default " 3115 std::fprintf(stderr, "[rt] d3d12: the device's descriptor limits are below the bindless set's default "
2944 "sizes; it holds less\n"); 3116 "sizes; it holds less\n");
2945 } 3117 }
@@ -3358,7 +3530,7 @@ public:
3358 auto& vk = state_.context->vk; 3530 auto& vk = state_.context->vk;
3359 if (desc && state_.context->xdxr_acceleration_structures()) { 3531 if (desc && state_.context->xdxr_acceleration_structures()) {
3360 // XDXR records: the layout depends only on the triangle or instance count (xdxr_build.h), so the sizes 3532 // XDXR records: the layout depends only on the triangle or instance count (xdxr_build.h), so the sizes
3361 // are exact. An update rebuilds the structure, so it needs the same scratch. 3533 // are exact. An update refits (no sort); the build's scratch size covers it.
3362 leonida::BuildAccelerationStructure build{}; 3534 leonida::BuildAccelerationStructure build{};
3363 build.is_tlas = desc->Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL; 3535 build.is_tlas = desc->Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL;
3364 if (build.is_tlas) { 3536 if (build.is_tlas) {
@@ -3521,7 +3693,7 @@ public:
3521 return hand_out(signature, riid, out); 3693 return hand_out(signature, riid, out);
3522 } 3694 }
3523 3695
3524 // PC slot 11; the Xbox ABI reaches it through device slot 62 (the proxy forwards). 3696 // PC slot 11; the Xbox ABI reaches it through device slots 62 and 67 (the proxy forwards).
3525 HRESULT STDMETHODCALLTYPE CreateComputePipelineState(const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, REFIID riid, 3697 HRESULT STDMETHODCALLTYPE CreateComputePipelineState(const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, REFIID riid,
3526 void** out) override { 3698 void** out) override {
3527 if (!out) return E_POINTER; 3699 if (!out) return E_POINTER;
@@ -3707,6 +3879,24 @@ public:
3707 std::size_t(count) * kDescriptorSize); 3879 std::size_t(count) * kDescriptorSize);
3708 } 3880 }
3709 3881
3882 // A constant-buffer view is a 16-byte GFX10 raw buffer V# in the first half of the slot (zeros in the rest).
3883 // A null description, zero address, or zero size leaves the whole slot zeroed (null V#: reads return 0).
3884 void STDMETHODCALLTYPE CreateConstantBufferView(const D3D12_CONSTANT_BUFFER_VIEW_DESC* desc,
3885 D3D12_CPU_DESCRIPTOR_HANDLE destination) override {
3886 d3d12_trace::record("ID3D12Device::CreateConstantBufferView");
3887 if (!destination.ptr) return;
3888 std::memset(reinterpret_cast<void*>(destination.ptr), 0, kDescriptorSize);
3889 if (!desc || !desc->BufferLocation || !desc->SizeInBytes) return;
3890 leonida::gfx10::Buffer buffer{};
3891 buffer.address = desc->BufferLocation;
3892 buffer.stride = 0;
3893 buffer.num_records = desc->SizeInBytes;
3894 buffer.format = leonida::gfx10::format_from_vulkan(VK_FORMAT_R32_UINT);
3895 buffer.oob_select = leonida::gfx10::OobSelect::raw;
3896 const leonida::gfx10::BufferWords words = leonida::gfx10::encode(buffer);
3897 std::memcpy(reinterpret_cast<void*>(destination.ptr), words.data(), sizeof(words));
3898 }
3899
3710 // A shader-resource view of a texture is a T# in the slot (docs section 3.4): the shader loads those eight 3900 // A shader-resource view of a texture is a T# in the slot (docs section 3.4): the shader loads those eight
3711 // dwords through its descriptor table and finds the image by them. A slot left as zeros is a null descriptor: 3901 // dwords through its descriptor table and finds the image by them. A slot left as zeros is a null descriptor:
3712 // nothing is registered for it, so the shader gets the fallback image. Buffer views are not implemented. 3902 // nothing is registered for it, so the shader gets the fallback image. Buffer views are not implemented.
@@ -3844,6 +4034,11 @@ public:
3844 return; 4034 return;
3845 } 4035 }
3846 } 4036 }
4037 // B8G8R8X8 has no typed UAV, so no format of its family gives an unordered-access view.
4038 if (alpha_unused(r->desc().Format) || alpha_unused(view.format)) {
4039 log_once("unordered-access view of a B8G8R8X8 format; format", int(view.format));
4040 return;
4041 }
3847 write_image_descriptor(*r, view, destination, true); 4042 write_image_descriptor(*r, view, destination, true);
3848 } 4043 }
3849 4044
@@ -3984,14 +4179,15 @@ public:
3984 return CreateReservedResource1(desc, D3D12_RESOURCE_STATE_COMMON, nullptr, session, riid, out); 4179 return CreateReservedResource1(desc, D3D12_RESOURCE_STATE_COMMON, nullptr, session, riid, out);
3985 } 4180 }
3986 4181
3987 // Tiling of a reserved resource (src/resource_tiling.h). Anything else, as on the PC runtime, has no tiles: 4182 // Tiling of a reserved resource or a tiled (64KB_UNDEFINED_SWIZZLE) texture (src/resource_tiling.h). Anything
3988 // every output is zero and no subresource tiling is written. 4183 // else, as on the PC runtime, has no tiles: every output is zero and no subresource tiling is written.
3989 void STDMETHODCALLTYPE GetResourceTiling(ID3D12Resource* resource, UINT* total, D3D12_PACKED_MIP_INFO* packed, 4184 void STDMETHODCALLTYPE GetResourceTiling(ID3D12Resource* resource, UINT* total, D3D12_PACKED_MIP_INFO* packed,
3990 D3D12_TILE_SHAPE* shape, UINT* count, UINT first, 4185 D3D12_TILE_SHAPE* shape, UINT* count, UINT first,
3991 D3D12_SUBRESOURCE_TILING* tilings) override { 4186 D3D12_SUBRESOURCE_TILING* tilings) override {
3992 leonida::ResourceTiling tiling; 4187 leonida::ResourceTiling tiling;
3993 Resource* r = Resource::from<Resource>(resource); 4188 Resource* r = Resource::from<Resource>(resource);
3994 const bool ok = r && r->reserved() && resource_tiling(r->GetDesc(), tiling); 4189 const bool ok = r && (r->reserved() || is_tiled_layout(r->GetDesc().Layout)) &&
4190 resource_tiling(r->GetDesc(), tiling);
3995 if (total) *total = ok ? tiling.total_tiles : 0; 4191 if (total) *total = ok ? tiling.total_tiles : 0;
3996 if (packed) 4192 if (packed)
3997 *packed = ok ? D3D12_PACKED_MIP_INFO{UINT8(tiling.standard_mips), UINT8(tiling.packed_mips), 4193 *packed = ok ? D3D12_PACKED_MIP_INFO{UINT8(tiling.standard_mips), UINT8(tiling.packed_mips),
@@ -4148,14 +4344,33 @@ public:
4148 log_once("placed resource offset not 64 KiB aligned:", int(heap_offset)); 4344 log_once("placed resource offset not 64 KiB aligned:", int(heap_offset));
4149 return E_INVALIDARG; 4345 return E_INVALIDARG;
4150 } 4346 }
4347 const bool tiled = is_tiled_layout(desc->Layout);
4348 const bool msaa = desc->SampleDesc.Count > 1;
4151 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { 4349 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) {
4152 if (heap_offset + desc->Width > heap->bytes()) return E_INVALIDARG; 4350 if (desc->Layout != D3D12_TEXTURE_LAYOUT_ROW_MAJOR) return E_INVALIDARG;
4153 } else if (heap_offset >= heap->bytes()) { 4351 if (desc->Width > heap->bytes() || heap_offset > heap->bytes() - desc->Width) return E_INVALIDARG;
4154 return E_INVALIDARG; 4352 } else {
4155 } 4353 if (heap->properties().Type == D3D12_HEAP_TYPE_UPLOAD ||
4156 if (desc->Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE) { 4354 heap->properties().Type == D3D12_HEAP_TYPE_READBACK)
4157 log_once("tiled placed resource not supported yet; dimension", int(desc->Dimension)); 4355 return E_INVALIDARG;
4158 return E_NOTIMPL; 4356 if (tiled || msaa) {
4357 if (tiled && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D &&
4358 desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D)
4359 return E_INVALIDARG;
4360 if (msaa && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) return E_INVALIDARG;
4361 if (msaa && (heap->flags() & D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES)) return E_INVALIDARG;
4362 const D3D12_RESOURCE_ALLOCATION_INFO alloc = allocation(*desc);
4363 if (alloc.SizeInBytes == UINT64_MAX || heap->alignment() < alloc.Alignment ||
4364 heap_offset % alloc.Alignment || alloc.SizeInBytes > heap->bytes() ||
4365 heap_offset > heap->bytes() - alloc.SizeInBytes)
4366 return E_INVALIDARG;
4367 if (tiled && static_cast<UINT>(desc->Layout) == kXboxTiledLayout) {
4368 log_once("placed resource with the Xbox tiled layout, as 64KB_UNDEFINED_SWIZZLE; dimension",
4369 int(desc->Dimension));
4370 }
4371 } else if (heap_offset >= heap->bytes()) {
4372 return E_INVALIDARG;
4373 }
4159 } 4374 }
4160 // Only buffers are addressable, as in D3D12: a placed texture keeps a null VA and its own Vulkan image. 4375 // Only buffers are addressable, as in D3D12: a placed texture keeps a null VA and its own Vulkan image.
4161 const VkDeviceSize placed_va = desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER ? heap->offset() + heap_offset : 0; 4376 const VkDeviceSize placed_va = desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER ? heap->offset() + heap_offset : 0;
@@ -4164,10 +4379,8 @@ public:
4164 HRESULT hr = E_NOTIMPL; 4379 HRESULT hr = E_NOTIMPL;
4165 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { 4380 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) {
4166 hr = resource->create_placed_buffer(); 4381 hr = resource->create_placed_buffer();
4167 } else if (desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) { 4382 } else if (!tiled && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) {
4168 log_once("placed resource dimension not supported:", int(desc->Dimension)); 4383 log_once("placed resource dimension not supported:", int(desc->Dimension));
4169 } else if (desc->SampleDesc.Count > 1) {
4170 log_once("multisampled placed resource not supported; samples", int(desc->SampleDesc.Count));
4171 } else { 4384 } else {
4172 hr = S_OK; 4385 hr = S_OK;
4173 const Format format = state_.texture_format(*desc); 4386 const Format format = state_.texture_format(*desc);
@@ -4693,8 +4906,9 @@ public:
4693 if (optimal & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { 4906 if (optimal & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
4694 s1 |= D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL; 4907 s1 |= D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL;
4695 } 4908 }
4696 if ((optimal & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) || 4909 // B8G8R8X8 has no typed UAV in D3D12 (texture_format refuses it), whatever the BGRA8 image could do.
4697 (buffer & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT)) { 4910 if (!alpha_unused(fs->Format) && ((optimal & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) ||
4911 (buffer & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))) {
4698 s1 |= D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW; 4912 s1 |= D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW;
4699 // A typed UAV texture read is not a storage-image read: the translator reads it through the 4913 // A typed UAV texture read is not a storage-image read: the translator reads it through the
4700 // texture's sampled binding with the T#'s numeric type (rdna2spirv.py image_read_typed), so a 4914 // texture's sampled binding with the T#'s numeric type (rdna2spirv.py image_read_typed), so a
@@ -4933,16 +5147,22 @@ private:
4933 D3D12_RESOURCE_DESC resolved = desc; 5147 D3D12_RESOURCE_DESC resolved = desc;
4934 if (!resolved.MipLevels) resolved.MipLevels = full; 5148 if (!resolved.MipLevels) resolved.MipLevels = full;
4935 if (resolved.MipLevels > full) return kInvalidAllocation; 5149 if (resolved.MipLevels > full) return kInvalidAllocation;
4936 if (samples > 1 && (volume || one_d || resolved.MipLevels != 1 || 5150 const bool depth_stencil = desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
5151 if (samples > 1 && (volume || one_d || resolved.MipLevels != 1 || !(desc.Flags & attachment) ||
5152 (desc.Flags & attachment) == attachment ||
4937 (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS))) 5153 (desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)))
4938 return kInvalidAllocation; 5154 return kInvalidAllocation;
4939 // The PC runtime: simultaneous access only single-sampled and without depth-stencil, and no volume depth. 5155 // The PC runtime: simultaneous access only single-sampled and without depth-stencil, and no volume depth.
4940 const bool depth_stencil = desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
4941 if (((desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS) && (depth_stencil || samples > 1)) || 5156 if (((desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS) && (depth_stencil || samples > 1)) ||
4942 (volume && depth_stencil)) 5157 (volume && depth_stencil))
4943 return kInvalidAllocation; 5158 return kInvalidAllocation;
4944 if (desc.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN) 5159 const bool tiled = is_tiled_layout(desc.Layout);
5160 if (tiled) {
5161 if (one_d || (samples > 1 && samples != 4)) return kInvalidAllocation;
5162 if (desc.Alignment && desc.Alignment != align_64k) return kInvalidAllocation;
5163 } else if (desc.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN) {
4945 log_once("GetResourceAllocationInfo layout as UNKNOWN:", desc.Layout); 5164 log_once("GetResourceAllocationInfo layout as UNKNOWN:", desc.Layout);
5165 }
4946 5166
4947 const Format format = state_.texture_format(desc); 5167 const Format format = state_.texture_format(desc);
4948 if (!format.format) { 5168 if (!format.format) {
@@ -4952,6 +5172,11 @@ private:
4952 VkMemoryRequirements need{}; 5172 VkMemoryRequirements need{};
4953 const TextureCreateInfo create(resolved, format, state_.color_attachment_usable(format.format)); 5173 const TextureCreateInfo create(resolved, format, state_.color_attachment_usable(format.format));
4954 if (!state_.memory_requirements(create.info, need)) return kInvalidAllocation; 5174 if (!state_.memory_requirements(create.info, need)) return kInvalidAllocation;
5175 if (tiled) {
5176 leonida::ResourceTiling tiling;
5177 if (!resource_tiling(resolved, tiling)) return kInvalidAllocation;
5178 return {UINT64(tiling.total_tiles) * leonida::tile_size_in_bytes, align_64k};
5179 }
4955 5180
4956 // D3D12's alignment: 64 KiB, or 4 MiB with MSAA, unless the description asks for a small one (4 KiB, 64 KiB 5181 // D3D12's alignment: 64 KiB, or 4 MiB with MSAA, unless the description asks for a small one (4 KiB, 64 KiB
4957 // with MSAA). 4 KiB needs the top mip of one array slice to fit in 16 tiles of 4 KiB and the resource not to 5182 // with MSAA). 4 KiB needs the top mip of one array slice to fit in 16 tiles of 4 KiB and the resource not to
@@ -4997,12 +5222,10 @@ private:
4997 if (!image_descriptor(resource, view, image)) return; 5222 if (!image_descriptor(resource, view, image)) return;
4998 const leonida::gfx10::ImageWords words = leonida::gfx10::encode(image); 5223 const leonida::gfx10::ImageWords words = leonida::gfx10::encode(image);
4999 const bool registered = state_.bind_image(words, image, resource.image(), resource.format(), 5224 const bool registered = state_.bind_image(words, image, resource.image(), resource.format(),
5000 resource.aspects(), storage, false, 5225 resource.aspects(), storage, resource.has_view_format_list(),
5001 resource.r9g9b9e5_as_r32_uint()); 5226 resource.r9g9b9e5_as_r32_uint());
5002 if (leonida::gfx10::multisampled(image.type) && !registered) return; 5227 if (leonida::gfx10::multisampled(image.type) && !registered) return;
5003 std::memcpy(reinterpret_cast<void*>(destination.ptr), words.data(), sizeof(words)); 5228 std::memcpy(reinterpret_cast<void*>(destination.ptr), words.data(), sizeof(words));
5004 state_.bind_image(words, image, resource.image(), resource.format(), resource.aspects(), storage,
5005 resource.has_view_format_list(), resource.r9g9b9e5_as_r32_uint());
5006 } 5229 }
5007 5230
5008 // Shared by CreateCommittedResource and CreateCommittedResource3. A castable-format list is only meaningful on 5231 // Shared by CreateCommittedResource and CreateCommittedResource3. A castable-format list is only meaningful on
@@ -5131,14 +5354,11 @@ private:
5131 HRESULT create_reserved(const D3D12_RESOURCE_DESC* desc, REFIID riid, void** out) { 5354 HRESULT create_reserved(const D3D12_RESOURCE_DESC* desc, REFIID riid, void** out) {
5132 if (out) *out = nullptr; 5355 if (out) *out = nullptr;
5133 if (!desc) return E_INVALIDARG; 5356 if (!desc) return E_INVALIDARG;
5134 // The Xbox tiled layout word. 0x101 is outside D3D12_TEXTURE_LAYOUT's enumerators, so it can't be a
5135 // constexpr enum value (clang rejects the cast in a constant expression); compare it as an integer.
5136 constexpr UINT xbox_tiled = 0x101;
5137 D3D12_RESOURCE_DESC backing = *desc; 5357 D3D12_RESOURCE_DESC backing = *desc;
5138 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { 5358 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) {
5139 if (desc->Layout != D3D12_TEXTURE_LAYOUT_ROW_MAJOR) return E_INVALIDARG; 5359 if (desc->Layout != D3D12_TEXTURE_LAYOUT_ROW_MAJOR) return E_INVALIDARG;
5140 } else { 5360 } else {
5141 if (static_cast<UINT>(desc->Layout) == xbox_tiled) { 5361 if (static_cast<UINT>(desc->Layout) == kXboxTiledLayout) {
5142 log_once("reserved resource with the Xbox tiled layout, as 64KB_UNDEFINED_SWIZZLE; dimension", 5362 log_once("reserved resource with the Xbox tiled layout, as 64KB_UNDEFINED_SWIZZLE; dimension",
5143 desc->Dimension); 5363 desc->Dimension);
5144 } else if (desc->Layout != D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE) { 5364 } else if (desc->Layout != D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE) {
@@ -5190,6 +5410,7 @@ private:
5190 const leonida::BlockFormat block = leonida::block_format(format.format, format.aspects); 5410 const leonida::BlockFormat block = leonida::block_format(format.format, format.aspects);
5191 tiling.element_bytes = block.bytes; 5411 tiling.element_bytes = block.bytes;
5192 tiling.block = block.block; 5412 tiling.block = block.block;
5413 tiling.samples = desc.SampleDesc.Count;
5193 return leonida::resource_tiling(tiling, out); 5414 return leonida::resource_tiling(tiling, out);
5194 } 5415 }
5195 5416
@@ -5288,6 +5509,11 @@ std::uintptr_t graphics_pipeline_id(ID3D12PipelineState* pipeline) {
5288 return p && p->graphics() ? p->id() : 0; 5509 return p && p->graphics() ? p->id() : 0;
5289} 5510}
5290 5511
5512const std::vector<leonida::SubgroupRequest>* pipeline_subgroup_requests(ID3D12PipelineState* pipeline) {
5513 const PipelineState* p = PipelineState::from<PipelineState>(pipeline);
5514 return p && (p->compute() || p->graphics()) ? &p->subgroup_requests() : nullptr;
5515}
5516
5291VkImage vulkan_image(ID3D12Resource* resource) { 5517VkImage vulkan_image(ID3D12Resource* resource) {
5292 const Resource* r = Resource::from<Resource>(resource); 5518 const Resource* r = Resource::from<Resource>(resource);
5293 return r ? r->image() : VK_NULL_HANDLE; 5519 return r ? r->image() : VK_NULL_HANDLE;
@@ -5509,7 +5735,15 @@ std::unique_ptr<WindowPresenter> create_window_presenter(ID3D12Device* device, H
5509 auto presenter = std::make_unique<leonida::VulkanPresenter>(*d->state().context, info.get_instance_proc, 5735 auto presenter = std::make_unique<leonida::VulkanPresenter>(*d->state().context, info.get_instance_proc,
5510 info.instance, info.physical, info.queue, 5736 info.instance, info.physical, info.queue,
5511 info.queue_family, surface, // owns the surface 5737 info.queue_family, surface, // owns the surface
5512 info.swapchain_maintenance1 && tear_allowed); 5738 info.swapchain_maintenance1 && tear_allowed,
5739 [window]() -> VkExtent2D {
5740 RECT r{};
5741 if (GetClientRect(window, &r)) {
5742 return {static_cast<uint32_t>(r.right - r.left),
5743 static_cast<uint32_t>(r.bottom - r.top)};
5744 }
5745 return {0, 0};
5746 });
5513 if (!presenter->ok()) { 5747 if (!presenter->ok()) {
5514 std::fprintf(stderr, "[rt] d3d12: cannot present to this window from the device's queue family\n"); 5748 std::fprintf(stderr, "[rt] d3d12: cannot present to this window from the device's queue family\n");
5515 return nullptr; 5749 return nullptr;
@@ -5636,6 +5870,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5636 LEONIDA_INSTANCE(vkGetPhysicalDeviceProperties); 5870 LEONIDA_INSTANCE(vkGetPhysicalDeviceProperties);
5637 LEONIDA_INSTANCE(vkGetPhysicalDeviceQueueFamilyProperties); 5871 LEONIDA_INSTANCE(vkGetPhysicalDeviceQueueFamilyProperties);
5638 LEONIDA_INSTANCE(vkGetPhysicalDeviceFeatures2); 5872 LEONIDA_INSTANCE(vkGetPhysicalDeviceFeatures2);
5873 LEONIDA_INSTANCE(vkGetPhysicalDeviceProperties2);
5639 LEONIDA_INSTANCE(vkEnumerateDeviceExtensionProperties); 5874 LEONIDA_INSTANCE(vkEnumerateDeviceExtensionProperties);
5640 LEONIDA_INSTANCE(vkCreateDevice); 5875 LEONIDA_INSTANCE(vkCreateDevice);
5641 LEONIDA_INSTANCE(vkGetDeviceProcAddr); 5876 LEONIDA_INSTANCE(vkGetDeviceProcAddr);
@@ -5653,6 +5888,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5653 bool chosen_bc = false; 5888 bool chosen_bc = false;
5654 VkPhysicalDeviceFeatures chosen_features{}; 5889 VkPhysicalDeviceFeatures chosen_features{};
5655 VkPhysicalDeviceVulkan12Features chosen12{}; 5890 VkPhysicalDeviceVulkan12Features chosen12{};
5891 VkPhysicalDeviceVulkan13Features chosen13{};
5656 bool chosen_draw_params = false; 5892 bool chosen_draw_params = false;
5657 for (VkPhysicalDevice candidate : physicals) { 5893 for (VkPhysicalDevice candidate : physicals) {
5658 VkPhysicalDeviceProperties props{}; 5894 VkPhysicalDeviceProperties props{};
@@ -5681,6 +5917,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5681 chosen_bc = bc; 5917 chosen_bc = bc;
5682 chosen_features = features.features; 5918 chosen_features = features.features;
5683 chosen12 = f12; 5919 chosen12 = f12;
5920 chosen13 = f13;
5684 chosen_draw_params = draw_params; 5921 chosen_draw_params = draw_params;
5685 } 5922 }
5686 break; 5923 break;
@@ -5764,6 +6001,11 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5764 VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, ext_chain}; 6001 VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, ext_chain};
5765 enable13.dynamicRendering = VK_TRUE; 6002 enable13.dynamicRendering = VK_TRUE;
5766 enable13.synchronization2 = VK_TRUE; 6003 enable13.synchronization2 = VK_TRUE;
6004 // Subgroup size control: a pipeline stage asks for the size its shader was translated for (src/subgroup_size.h).
6005 enable13.subgroupSizeControl = chosen13.subgroupSizeControl;
6006 enable13.computeFullSubgroups = chosen13.computeFullSubgroups;
6007 leonida::query_subgroup_size_caps(vkGetPhysicalDeviceProperties2, info.physical, chosen13.subgroupSizeControl,
6008 chosen13.computeFullSubgroups, info.subgroup);
5767 // Translated vertex shaders read BaseVertex / BaseInstance (SPIR-V DrawParameters) to give v0 / v3 the 6009 // Translated vertex shaders read BaseVertex / BaseInstance (SPIR-V DrawParameters) to give v0 / v3 the
5768 // hardware's zero-based vertex and instance ids (docs/design.md, Inputs and outputs). 6010 // hardware's zero-based vertex and instance ids (docs/design.md, Inputs and outputs).
5769 VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13}; 6011 VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13};
@@ -5905,9 +6147,10 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5905 // Switching a vsync swapchain to IMMEDIATE or FIFO_RELAXED per present (PresentX's ImmediateThresholdPercent): 6147 // Switching a vsync swapchain to IMMEDIATE or FIFO_RELAXED per present (PresentX's ImmediateThresholdPercent):
5906 // the KHR extension (promoted from the EXT one, same structures) with the surface extension of the same name 6148 // the KHR extension (promoted from the EXT one, same structures) with the surface extension of the same name
5907 // on the instance, else the EXT one. Only enabled where the instance has the surface half and the GPU the feature. 6149 // on the instance, else the EXT one. Only enabled where the instance has the surface half and the GPU the feature.
6150 const char* swapchain_m1_name = nullptr;
6151#if defined(VK_KHR_swapchain_maintenance1)
5908 VkPhysicalDeviceSwapchainMaintenance1FeaturesKHR swapchain_m1{ 6152 VkPhysicalDeviceSwapchainMaintenance1FeaturesKHR swapchain_m1{
5909 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_KHR}; 6153 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_KHR};
5910 const char* swapchain_m1_name = nullptr;
5911 if (has_swapchain && instance_has_surface) { 6154 if (has_swapchain && instance_has_surface) {
5912 const auto device_has = [&](const char* name) { 6155 const auto device_has = [&](const char* name) {
5913 return std::any_of(extensions.begin(), extensions.end(), 6156 return std::any_of(extensions.begin(), extensions.end(),
@@ -5928,6 +6171,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5928 } 6171 }
5929 } 6172 }
5930 } 6173 }
6174#endif
5931 info.swapchain_maintenance1 = swapchain_m1_name != nullptr; 6175 info.swapchain_maintenance1 = swapchain_m1_name != nullptr;
5932 6176
5933 VkDeviceCreateInfo device_info{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, &enable12}; 6177 VkDeviceCreateInfo device_info{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, &enable12};
@@ -5966,6 +6210,12 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) {
5966 info.push_constants_need_fallback = (info.max_push_constants_size < 144); 6210 info.push_constants_need_fallback = (info.max_push_constants_size < 144);
5967 std::fprintf(stderr, "[rt] d3d12: Vulkan device: %s (maxPushConstantsSize: %u bytes)\n", chosen.deviceName, 6211 std::fprintf(stderr, "[rt] d3d12: Vulkan device: %s (maxPushConstantsSize: %u bytes)\n", chosen.deviceName,
5968 chosen.limits.maxPushConstantsSize); 6212 chosen.limits.maxPushConstantsSize);
6213 std::fprintf(stderr,
6214 "[rt] d3d12: subgroup sizes %u..%u (default %u), requirable in stages 0x%x, subgroupSizeControl %s, "
6215 "computeFullSubgroups %s\n",
6216 info.subgroup.min_size, info.subgroup.max_size, info.subgroup.default_size,
6217 unsigned(info.subgroup.required_stages), info.subgroup.subgroup_size_control ? "on" : "off",
6218 info.subgroup.compute_full_subgroups ? "on" : "off");
5969 if (info.push_constants_need_fallback) { 6219 if (info.push_constants_need_fallback) {
5970 std::fprintf(stderr, 6220 std::fprintf(stderr,
5971 "[rt] d3d12: WARNING: GPU maxPushConstantsSize (%u bytes) is below the 144 bytes required by " 6221 "[rt] d3d12: WARNING: GPU maxPushConstantsSize (%u bytes) is below the 144 bytes required by "
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index 57cd292c7..65a4f3995 100644
--- a/runtime/shims/d3d12_xs_device.cpp
+++ b/runtime/shims/d3d12_xs_device.cpp
@@ -388,18 +388,29 @@ HRESULT create_heap_proxy(ID3D12DescriptorHeap* real, DeviceProxy* device, REFII
388// 388//
389// QueryInterface answers only the interfaces the proxy models (the base chain and its own interface, Fence1 when 389// QueryInterface answers only the interfaces the proxy models (the base chain and its own interface, Fence1 when
390// the real fence has it), like the device and heap proxies, so the COM identity holds and no real object leaks to 390// the real fence has it), like the device and heap proxies, so the COM identity holds and no real object leaks to
391// the title. Leonida's own code reaches the real object through queue_proxy_real_queue / fence_proxy_real_fence. 391// the title. Leonida's own code reaches the real object through queue_proxy_real_queue / fence_proxy_real_fence /
392// allocator_proxy_real_allocator.
393//
394// Command allocators (device slot 9) are the third kind: their public chain is 9 slots (Reset at 8). Slot 9 wraps
395// only an allocator that answers kLeonidaCommandAllocatorTag, because a list takes the title's allocator in
396// CreateCommandList and Reset and only the Vulkan layer's lists resolve a proxy there (CommandAllocator::from);
397// a PC runtime allocator is handed out unchanged until a command-list proxy unwraps it at Reset.
392 398
393enum class ChildKind { queue, fence }; 399enum class ChildKind { queue, fence, allocator };
394 400
395constexpr unsigned kQueueSlots = 128; // the table: 19 public slots plus a refused tail 401constexpr unsigned kQueueSlots = 128; // the table: 19 public slots plus a refused tail
396constexpr unsigned kFenceSlots = 64; // the table: 12 public slots plus a refused tail 402constexpr unsigned kFenceSlots = 64; // the table: 12 public slots plus a refused tail
397constexpr unsigned kQueuePublicSlots = 19; // ID3D12CommandQueue 403constexpr unsigned kQueuePublicSlots = 19; // ID3D12CommandQueue
398constexpr unsigned kFencePublicSlots = 11; // ID3D12Fence 404constexpr unsigned kFencePublicSlots = 11; // ID3D12Fence
399constexpr unsigned kFence1PublicSlots = 12; // ID3D12Fence1 405constexpr unsigned kFence1PublicSlots = 12; // ID3D12Fence1
406constexpr unsigned kAllocatorSlots = 64; // the table: 9 public slots plus a refused tail
407constexpr unsigned kAllocatorPublicSlots = 9; // ID3D12CommandAllocator: the base chain and Reset (slot 8)
400constexpr SIZE_T kTableRegion = 64 * 1024; // one allocation granule: the table page plus 15 never-committed pages 408constexpr SIZE_T kTableRegion = 64 * 1024; // one allocation granule: the table page plus 15 never-committed pages
401static_assert(kQueueSlots > kQueuePublicSlots && kFenceSlots > kFence1PublicSlots, "the tables need a tail"); 409static_assert(kQueueSlots > kQueuePublicSlots && kFenceSlots > kFence1PublicSlots &&
402static_assert(kQueueSlots * sizeof(void*) <= 4096 && kFenceSlots * sizeof(void*) <= 4096, 410 kAllocatorSlots > kAllocatorPublicSlots,
411 "the tables need a tail");
412static_assert(kQueueSlots * sizeof(void*) <= 4096 && kFenceSlots * sizeof(void*) <= 4096 &&
413 kAllocatorSlots * sizeof(void*) <= 4096,
403 "a table must fit in the first page of its reservation"); 414 "a table must fit in the first page of its reservation");
404 415
405constexpr unsigned kQueueSignal = 14, kQueueWait = 15; // (ID3D12Fence*, UINT64) 416constexpr unsigned kQueueSignal = 14, kQueueWait = 15; // (ID3D12Fence*, UINT64)
@@ -415,7 +426,9 @@ struct ChildProxy {
415 426
416template <ChildKind K> 427template <ChildKind K>
417struct ChildStats { 428struct ChildStats {
418 static constexpr unsigned kSlots = K == ChildKind::queue ? kQueueSlots : kFenceSlots; 429 static constexpr unsigned kSlots = K == ChildKind::queue ? kQueueSlots
430 : K == ChildKind::fence ? kFenceSlots
431 : kAllocatorSlots;
419 static inline std::atomic<std::uint64_t> hits[kSlots]; 432 static inline std::atomic<std::uint64_t> hits[kSlots];
420 static inline std::atomic<bool> first[kSlots]; 433 static inline std::atomic<bool> first[kSlots];
421 static inline std::atomic<bool> beyond_warned[kSlots]; 434 static inline std::atomic<bool> beyond_warned[kSlots];
@@ -426,7 +439,7 @@ struct ChildStats {
426 439
427template <ChildKind K> 440template <ChildKind K>
428constexpr const char* child_kind_name() { 441constexpr const char* child_kind_name() {
429 return K == ChildKind::queue ? "queue" : "fence"; 442 return K == ChildKind::queue ? "queue" : K == ChildKind::fence ? "fence" : "allocator";
430} 443}
431 444
432template <ChildKind K> 445template <ChildKind K>
@@ -441,8 +454,10 @@ const char* child_public_name(unsigned slot) {
441 if (slot < 8) return object[slot]; 454 if (slot < 8) return object[slot];
442 if constexpr (K == ChildKind::queue) { 455 if constexpr (K == ChildKind::queue) {
443 if (slot < kQueuePublicSlots) return queue[slot - 8]; 456 if (slot < kQueuePublicSlots) return queue[slot - 8];
444 } else { 457 } else if constexpr (K == ChildKind::fence) {
445 if (slot < kFence1PublicSlots) return fence[slot - 8]; 458 if (slot < kFence1PublicSlots) return fence[slot - 8];
459 } else {
460 if (slot == 8) return "Reset";
446 } 461 }
447 return nullptr; 462 return nullptr;
448} 463}
@@ -454,7 +469,9 @@ template <ChildKind K>
454const char* child_trace_name(unsigned slot) { 469const char* child_trace_name(unsigned slot) {
455 static const auto names = [] { 470 static const auto names = [] {
456 static char storage[ChildStats<K>::kSlots][64]; 471 static char storage[ChildStats<K>::kSlots][64];
457 const char* iface = K == ChildKind::queue ? "XboxID3D12CommandQueue" : "XboxID3D12Fence"; 472 const char* iface = K == ChildKind::queue ? "XboxID3D12CommandQueue"
473 : K == ChildKind::fence ? "XboxID3D12Fence"
474 : "XboxID3D12CommandAllocator";
458 for (unsigned s = 0; s < ChildStats<K>::kSlots; ++s) { 475 for (unsigned s = 0; s < ChildStats<K>::kSlots; ++s) {
459 const char* method = child_public_name<K>(s); 476 const char* method = child_public_name<K>(s);
460 if (method) 477 if (method)
@@ -528,8 +545,10 @@ bool is_child_iid(const IID& iid) {
528 return true; 545 return true;
529 if constexpr (K == ChildKind::queue) { 546 if constexpr (K == ChildKind::queue) {
530 return IsEqualIID(iid, __uuidof(ID3D12CommandQueue)); 547 return IsEqualIID(iid, __uuidof(ID3D12CommandQueue));
531 } else { 548 } else if constexpr (K == ChildKind::fence) {
532 return IsEqualIID(iid, __uuidof(ID3D12Fence)) || IsEqualIID(iid, __uuidof(ID3D12Fence1)); 549 return IsEqualIID(iid, __uuidof(ID3D12Fence)) || IsEqualIID(iid, __uuidof(ID3D12Fence1));
550 } else {
551 return IsEqualIID(iid, __uuidof(ID3D12CommandAllocator));
533 } 552 }
534} 553}
535 554
@@ -608,7 +627,8 @@ IUnknown* proxy_real_object(const void* object) {
608 void* const vtable = *reinterpret_cast<void* const*>(object); 627 void* const vtable = *reinterpret_cast<void* const*>(object);
609 if (vtable == reinterpret_cast<void*>(get_heap_vtable())) return static_cast<const HeapProxy*>(object)->real; 628 if (vtable == reinterpret_cast<void*>(get_heap_vtable())) return static_cast<const HeapProxy*>(object)->real;
610 if (vtable == reinterpret_cast<void*>(get_child_vtable<ChildKind::queue>()) || 629 if (vtable == reinterpret_cast<void*>(get_child_vtable<ChildKind::queue>()) ||
611 vtable == reinterpret_cast<void*>(get_child_vtable<ChildKind::fence>())) 630 vtable == reinterpret_cast<void*>(get_child_vtable<ChildKind::fence>()) ||
631 vtable == reinterpret_cast<void*>(get_child_vtable<ChildKind::allocator>()))
612 return static_cast<const ChildProxy*>(object)->real; 632 return static_cast<const ChildProxy*>(object)->real;
613 return nullptr; 633 return nullptr;
614} 634}
@@ -685,6 +705,7 @@ LONG CALLBACK table_overrun_handler(EXCEPTION_POINTERS* info) {
685 const auto address = static_cast<std::uintptr_t>(record->ExceptionInformation[1]); 705 const auto address = static_cast<std::uintptr_t>(record->ExceptionInformation[1]);
686 report_table_overrun<ChildKind::queue>(address); 706 report_table_overrun<ChildKind::queue>(address);
687 report_table_overrun<ChildKind::fence>(address); 707 report_table_overrun<ChildKind::fence>(address);
708 report_table_overrun<ChildKind::allocator>(address);
688 } 709 }
689 return EXCEPTION_CONTINUE_SEARCH; // diagnostics only: the fault goes on to the title's handlers or the crash 710 return EXCEPTION_CONTINUE_SEARCH; // diagnostics only: the fault goes on to the title's handlers or the crash
690} 711}
@@ -803,8 +824,10 @@ HRESULT wrap_child(IUnknown* created, DeviceProxy* device, const IID* riid, void
803 proxy->real_vtable = *reinterpret_cast<void***>(created); 824 proxy->real_vtable = *reinterpret_cast<void***>(created);
804 if constexpr (K == ChildKind::queue) { 825 if constexpr (K == ChildKind::queue) {
805 proxy->slot_count = kQueuePublicSlots; 826 proxy->slot_count = kQueuePublicSlots;
806 } else { 827 } else if constexpr (K == ChildKind::fence) {
807 proxy->slot_count = supports_iid(created, __uuidof(ID3D12Fence1)) ? kFence1PublicSlots : kFencePublicSlots; 828 proxy->slot_count = supports_iid(created, __uuidof(ID3D12Fence1)) ? kFence1PublicSlots : kFencePublicSlots;
829 } else {
830 proxy->slot_count = kAllocatorPublicSlots;
808 } 831 }
809 proxy->refs.store(1, std::memory_order_relaxed); 832 proxy->refs.store(1, std::memory_order_relaxed);
810 proxy_add_ref(device); // the object keeps its Xbox-ABI device alive for GetDevice 833 proxy_add_ref(device); // the object keeps its Xbox-ABI device alive for GetDevice
@@ -894,6 +917,43 @@ HRESULT proxy_create_fence(DeviceProxy* self, std::uint64_t initial_value, std::
894 return wrap_child<ChildKind::fence>(static_cast<IUnknown*>(created), self, riid, out); 917 return wrap_child<ChildKind::fence>(static_cast<IUnknown*>(created), self, riid, out);
895} 918}
896 919
920// True when `allocator` is one whose consumers resolve allocator proxies: Leonida's own Vulkan-layer allocator,
921// whose lists (CreateCommandList, Reset) find the real allocator through allocator_proxy_real_allocator. A PC
922// runtime allocator does not answer the tag, and its lists would take a proxy for their own allocator.
923bool resolves_allocator_proxies(IUnknown* allocator) {
924 void* found = nullptr;
925 if (FAILED(allocator->QueryInterface(kLeonidaCommandAllocatorTag, &found)) || !found) return false;
926 static_cast<IUnknown*>(found)->Release(); // the implementation pointer starts with its IUnknown chain
927 return true;
928}
929
930// Device slot 9: CreateCommandAllocator(type, riid, out). An allocator proxy where the list side resolves it (see
931// resolves_allocator_proxies); any other allocator goes back unchanged, logged once, so the host runtime's lists
932// never see a proxy. Null output and null IID as slot 8.
933HRESULT proxy_create_command_allocator(DeviceProxy* self, std::uint64_t type, const IID* riid, void** out) {
934 note_slot(9);
935 if (out) *out = nullptr; // as slot 8
936 if (!riid) return E_POINTER;
937 const auto list_type = static_cast<D3D12_COMMAND_LIST_TYPE>(static_cast<std::uint32_t>(type));
938#pragma warning(suppress : 6387) // the caller's null output, on purpose (see slot 8)
939 if (!out) return self->real->CreateCommandAllocator(list_type, *riid, nullptr);
940 void* created = nullptr;
941 const HRESULT hr = self->real->CreateCommandAllocator(list_type, __uuidof(ID3D12CommandAllocator), &created);
942 if (FAILED(hr)) return hr;
943 if (!created) return E_FAIL;
944 auto* allocator = static_cast<IUnknown*>(created);
945 if (!resolves_allocator_proxies(allocator)) {
946 static std::atomic<bool> logged{false};
947 if (!logged.exchange(true, std::memory_order_relaxed))
948 std::fprintf(stderr, "[rt] d3d12_xs: allocators of this device are not wrapped: its command lists "
949 "cannot resolve an allocator proxy\n");
950 const HRESULT asked = allocator->QueryInterface(*riid, out);
951 allocator->Release();
952 return asked;
953 }
954 return wrap_child<ChildKind::allocator>(allocator, self, riid, out);
955}
956
897// Device slot 32: OpenSharedHandle(handle, riid, out). The object is opened as asked; when it is a fence (whatever 957// Device slot 32: OpenSharedHandle(handle, riid, out). The object is opened as asked; when it is a fence (whatever
898// interface was asked for, IUnknown included) the title gets a fence proxy, anything else (heaps, resources) is 958// interface was asked for, IUnknown included) the title gets a fence proxy, anything else (heaps, resources) is
899// returned unchanged. 959// returned unchanged.
@@ -981,6 +1041,61 @@ HRESULT proxy_create_compute_pipeline_state(DeviceProxy* self, const D3D12_COMPU
981 return self->real->CreateComputePipelineState(desc, *riid, out); 1041 return self->real->CreateComputePipelineState(desc, *riid, out);
982} 1042}
983 1043
1044// The Xbox slot 67 creates a compute pipeline from native GPU code: (desc, riid, out), named
1045// DeserializeComputePipelineStateX in amd_fidelityfx_upscaler_xbox.dll's messages (call at RVA 0x56d9). The desc
1046// passes the root signature at +0x00, followed by pointer/size pairs for the shader's FSPX entries (docs/fspx.md):
1047// kind 0 (dispatch state) at +0x08/+0x10, kind 1 at +0x18/+0x20, kind 6 (the RDNA2 program) at +0x28/+0x30, and
1048// kind 7 (records) at +0x38/+0x40. Translates the console description to a standard D3D12_COMPUTE_PIPELINE_STATE_DESC
1049// with CS bytecode pointing at kind 6 and routes it to CreateComputePipelineState on the PC device (slot 11), which
1050// on the Vulkan device resolves through the translator. The PC slot 67 is CreateProtectedResourceSession1.
1051HRESULT proxy_create_compute_pipeline_from_native_code(DeviceProxy* self, const void* desc,
1052 const IID* riid, void** out) {
1053 note_slot(67);
1054 if (!out) return E_POINTER;
1055 *out = nullptr;
1056 if (!desc) return E_INVALIDARG;
1057 if (!riid) return E_POINTER;
1058
1059 // FSPX description layout (docs/fspx.md §How the DLL reads it):
1060 struct XboxNativeComputePipelineStateDesc {
1061 ID3D12RootSignature* root_signature; // +0x00
1062 const void* kind0; // +0x08: dispatch state
1063 std::uint64_t kind0_size; // +0x10: 28 bytes
1064 const void* kind1; // +0x18: unknown
1065 std::uint64_t kind1_size; // +0x20: 20 bytes
1066 const void* kind6; // +0x28: RDNA2 program code
1067 std::uint64_t kind6_size; // +0x30: program size in bytes
1068 const void* kind7; // +0x38: resource/hash records
1069 std::uint64_t kind7_size; // +0x40: records size in bytes
1070 };
1071 const auto* xbox_desc = static_cast<const XboxNativeComputePipelineStateDesc*>(desc);
1072
1073 if (xbox_desc->kind0 || xbox_desc->kind0_size || xbox_desc->kind1 || xbox_desc->kind1_size ||
1074 xbox_desc->kind7 || xbox_desc->kind7_size) {
1075 static std::atomic<bool> logged{false};
1076 if (!logged.exchange(true, std::memory_order_relaxed)) {
1077 std::fprintf(stderr,
1078 "[rt] d3d12_xs: slot 67 FSPX metadata: kind0 0x%llx (%llu B), kind1 0x%llx (%llu B), kind7 0x%llx (%llu B)\n",
1079 static_cast<unsigned long long>(reinterpret_cast<std::uintptr_t>(xbox_desc->kind0)),
1080 static_cast<unsigned long long>(xbox_desc->kind0_size),
1081 static_cast<unsigned long long>(reinterpret_cast<std::uintptr_t>(xbox_desc->kind1)),
1082 static_cast<unsigned long long>(xbox_desc->kind1_size),
1083 static_cast<unsigned long long>(reinterpret_cast<std::uintptr_t>(xbox_desc->kind7)),
1084 static_cast<unsigned long long>(xbox_desc->kind7_size));
1085 }
1086 }
1087
1088 D3D12_COMPUTE_PIPELINE_STATE_DESC pc_desc{};
1089 pc_desc.pRootSignature = xbox_desc->root_signature;
1090 pc_desc.CS.pShaderBytecode = xbox_desc->kind6;
1091 pc_desc.CS.BytecodeLength = static_cast<SIZE_T>(xbox_desc->kind6_size);
1092 pc_desc.NodeMask = 0;
1093 pc_desc.CachedPSO = {nullptr, 0};
1094 pc_desc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
1095
1096 return self->real->CreateComputePipelineState(&pc_desc, *riid, out);
1097}
1098
984HRESULT proxy_create_resource(DeviceProxy* self, const D3D12_HEAP_PROPERTIES* heap_properties, 1099HRESULT proxy_create_resource(DeviceProxy* self, const D3D12_HEAP_PROPERTIES* heap_properties,
985 D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC* xbox_desc, 1100 D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC* xbox_desc,
986 D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE* clear_value, 1101 D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE* clear_value,
@@ -1024,6 +1139,9 @@ std::uint64_t WINAPI proxy_slot(DeviceProxy* self, std::uint64_t a1, std::uint64
1024 } else if constexpr (Slot == 8) { 1139 } else if constexpr (Slot == 8) {
1025 return hr_to_u64(proxy_create_command_queue(self, reinterpret_cast<const D3D12_COMMAND_QUEUE_DESC*>(a1), 1140 return hr_to_u64(proxy_create_command_queue(self, reinterpret_cast<const D3D12_COMMAND_QUEUE_DESC*>(a1),
1026 reinterpret_cast<const IID*>(a2), reinterpret_cast<void**>(a3))); 1141 reinterpret_cast<const IID*>(a2), reinterpret_cast<void**>(a3)));
1142 } else if constexpr (Slot == 9) {
1143 return hr_to_u64(proxy_create_command_allocator(self, a1, reinterpret_cast<const IID*>(a2),
1144 reinterpret_cast<void**>(a3)));
1027 } else if constexpr (Slot == 36) { 1145 } else if constexpr (Slot == 36) {
1028 return hr_to_u64(proxy_create_fence(self, a1, a2, reinterpret_cast<const IID*>(a3), 1146 return hr_to_u64(proxy_create_fence(self, a1, a2, reinterpret_cast<const IID*>(a3),
1029 reinterpret_cast<void**>(a4))); 1147 reinterpret_cast<void**>(a4)));
@@ -1044,18 +1162,9 @@ std::uint64_t WINAPI proxy_slot(DeviceProxy* self, std::uint64_t a1, std::uint64
1044 self, reinterpret_cast<const D3D12_COMPUTE_PIPELINE_STATE_DESC*>(a1), a2, a3, 1162 self, reinterpret_cast<const D3D12_COMPUTE_PIPELINE_STATE_DESC*>(a1), a2, a3,
1045 reinterpret_cast<const IID*>(a4), reinterpret_cast<void**>(a5))); 1163 reinterpret_cast<const IID*>(a4), reinterpret_cast<void**>(a5)));
1046 } else if constexpr (Slot == 67) { 1164 } else if constexpr (Slot == 67) {
1047 // Measured in amd_fidelityfx_upscaler_xbox.dll (call at RVA 0x56d9): (desc, riid, out), named 1165 return hr_to_u64(proxy_create_compute_pipeline_from_native_code(
1048 // DeserializeComputePipelineStateX in the DLL's own messages. The desc is the root signature at +0x00, then 1166 self, reinterpret_cast<const void*>(a1), reinterpret_cast<const IID*>(a2),
1049 // pointer/size pairs for the shader's FSPX entries, with the native RDNA2 program at +0x28 (docs/fspx.md); 1167 reinterpret_cast<void**>(a3)));
1050 // the DLL falls back to slot 62 when it fails. The PC device's slot 67 is CreateProtectedResourceSession1, a
1051 // different method, so it is refused here, not forwarded.
1052 note_slot(67);
1053 static std::atomic<bool> logged{false};
1054 if (!logged.exchange(true, std::memory_order_relaxed))
1055 std::fprintf(stderr,
1056 "[rt] d3d12_xs: device slot 67 (Xbox DeserializeComputePipelineStateX) -> E_NOTIMPL\n");
1057 if (a3) *reinterpret_cast<void**>(a3) = nullptr;
1058 return hr_to_u64(E_NOTIMPL);
1059 } else if constexpr (Slot == 76) { 1168 } else if constexpr (Slot == 76) {
1060 return hr_to_u64(proxy_create_resource( 1169 return hr_to_u64(proxy_create_resource(
1061 self, reinterpret_cast<const D3D12_HEAP_PROPERTIES*>(a1), 1170 self, reinterpret_cast<const D3D12_HEAP_PROPERTIES*>(a1),
@@ -1186,13 +1295,19 @@ ID3D12Device* device_proxy_real_device(const void* device) {
1186} 1295}
1187 1296
1188bool device_slot_overridden(unsigned slot) { 1297bool device_slot_overridden(unsigned slot) {
1189 return slot <= 2 || slot == 8 || slot == 14 || slot == 31 || slot == 32 || slot == 34 || slot == 35 || 1298 return slot <= 2 || slot == 8 || slot == 9 || slot == 14 || slot == 31 || slot == 32 || slot == 34 || slot == 35 ||
1190 slot == 36 || slot == 45 || slot == 46 || slot == 50 || slot == 62 || slot == 67 || 1299 slot == 36 || slot == 45 || slot == 46 || slot == 50 || slot == 62 || slot == 67 ||
1191 slot == 75 || slot == 76; 1300 slot == 75 || slot == 76;
1192} 1301}
1193 1302
1194bool is_queue_proxy(const void* queue) { return is_child_proxy<ChildKind::queue>(queue); } 1303bool is_queue_proxy(const void* queue) { return is_child_proxy<ChildKind::queue>(queue); }
1195bool is_fence_proxy(const void* fence) { return is_child_proxy<ChildKind::fence>(fence); } 1304bool is_fence_proxy(const void* fence) { return is_child_proxy<ChildKind::fence>(fence); }
1305bool is_allocator_proxy(const void* allocator) { return is_child_proxy<ChildKind::allocator>(allocator); }
1306
1307ID3D12CommandAllocator* allocator_proxy_real_allocator(const void* allocator) {
1308 if (!is_allocator_proxy(allocator)) return nullptr;
1309 return reinterpret_cast<ID3D12CommandAllocator*>(static_cast<const ChildProxy*>(allocator)->real);
1310}
1196 1311
1197ID3D12CommandQueue* queue_proxy_real_queue(const void* queue) { 1312ID3D12CommandQueue* queue_proxy_real_queue(const void* queue) {
1198 if (!is_queue_proxy(queue)) return nullptr; 1313 if (!is_queue_proxy(queue)) return nullptr;
@@ -1214,9 +1329,13 @@ unsigned fence_proxy_slot_count(const void* fence) {
1214 1329
1215unsigned queue_proxy_table_size() { return kQueueSlots; } 1330unsigned queue_proxy_table_size() { return kQueueSlots; }
1216unsigned fence_proxy_table_size() { return kFenceSlots; } 1331unsigned fence_proxy_table_size() { return kFenceSlots; }
1332unsigned allocator_proxy_table_size() { return kAllocatorSlots; }
1333unsigned allocator_proxy_slot_count(const void* allocator) {
1334 return is_allocator_proxy(allocator) ? static_cast<const ChildProxy*>(allocator)->slot_count : 0;
1335}
1217 1336
1218unsigned long command_object_proxy_ref_count(const void* object) { 1337unsigned long command_object_proxy_ref_count(const void* object) {
1219 if (!is_queue_proxy(object) && !is_fence_proxy(object)) return 0; 1338 if (!is_queue_proxy(object) && !is_fence_proxy(object) && !is_allocator_proxy(object)) return 0;
1220 return static_cast<const ChildProxy*>(object)->refs.load(std::memory_order_relaxed); 1339 return static_cast<const ChildProxy*>(object)->refs.load(std::memory_order_relaxed);
1221} 1340}
1222 1341
@@ -1251,8 +1370,24 @@ std::uint64_t fence_table_overruns() {
1251bool command_object_tables_guarded() { 1370bool command_object_tables_guarded() {
1252 get_child_vtable<ChildKind::queue>(); 1371 get_child_vtable<ChildKind::queue>();
1253 get_child_vtable<ChildKind::fence>(); 1372 get_child_vtable<ChildKind::fence>();
1373 get_child_vtable<ChildKind::allocator>();
1254 return ChildStats<ChildKind::queue>::table_end.load(std::memory_order_acquire) && 1374 return ChildStats<ChildKind::queue>::table_end.load(std::memory_order_acquire) &&
1255 ChildStats<ChildKind::fence>::table_end.load(std::memory_order_acquire); 1375 ChildStats<ChildKind::fence>::table_end.load(std::memory_order_acquire) &&
1376 ChildStats<ChildKind::allocator>::table_end.load(std::memory_order_acquire);
1377}
1378
1379std::uint64_t allocator_slot_hits(unsigned slot) {
1380 using S = ChildStats<ChildKind::allocator>;
1381 return slot < S::kSlots ? S::hits[slot].load(std::memory_order_relaxed) : 0;
1382}
1383
1384bool allocator_slot_first_call_seen(unsigned slot) {
1385 using S = ChildStats<ChildKind::allocator>;
1386 return slot < S::kSlots && S::first[slot].load(std::memory_order_relaxed);
1387}
1388
1389std::uint64_t allocator_table_overruns() {
1390 return ChildStats<ChildKind::allocator>::overruns.load(std::memory_order_relaxed);
1256} 1391}
1257 1392
1258bool heap_slot_overridden(unsigned slot) { 1393bool heap_slot_overridden(unsigned slot) {
@@ -1292,6 +1427,7 @@ void reset_device_proxy_stats() {
1292 } 1427 }
1293 reset_child_stats<ChildKind::queue>(); 1428 reset_child_stats<ChildKind::queue>();
1294 reset_child_stats<ChildKind::fence>(); 1429 reset_child_stats<ChildKind::fence>();
1430 reset_child_stats<ChildKind::allocator>();
1295} 1431}
1296 1432
1297} // namespace rt::d3d12_xs 1433} // namespace rt::d3d12_xs
diff --git a/runtime/shims/d3d12_xs_device.h b/runtime/shims/d3d12_xs_device.h
index 510560516..12ac5a78f 100644
--- a/runtime/shims/d3d12_xs_device.h
+++ b/runtime/shims/d3d12_xs_device.h
@@ -3,6 +3,9 @@
3// Measured Xbox device deviations used here (vtable indices, x64): 3// Measured Xbox device deviations used here (vtable indices, x64):
4// slot 62 CreateComputePipelineState(desc, w2, w3, iid, out): two words (0 from XboxBvhBuilder, meaning unknown) 4// slot 62 CreateComputePipelineState(desc, w2, w3, iid, out): two words (0 from XboxBvhBuilder, meaning unknown)
5// before the IID. The PC slot 62 is CreateStateObject. 5// before the IID. The PC slot 62 is CreateStateObject.
6// slot 67 CreateComputePipelineState from native code (desc, iid, out): converts the Xbox native-code desc
7// (+0x00 root signature, +0x28 code, +0x30 size) to D3D12_COMPUTE_PIPELINE_STATE_DESC and forwards
8// to PC CreateComputePipelineState (slot 11). The PC slot 67 is CreateProtectedResourceSession1.
6// slot 76 resource creation -> PC CreateCommittedResource (PC slot 27), with the Xbox layout word ignored. 9// slot 76 resource creation -> PC CreateCommittedResource (PC slot 27), with the Xbox layout word ignored.
7// The measured slots 9/10 (GetCPU/GPUDescriptorHandleForHeapStart) are ID3D12DescriptorHeap methods, not device 10// The measured slots 9/10 (GetCPU/GPUDescriptorHandleForHeapStart) are ID3D12DescriptorHeap methods, not device
8// methods: the PC device's 9/10 are CreateCommandAllocator/CreateGraphicsPipelineState and are forwarded unchanged. 11// methods: the PC device's 9/10 are CreateCommandAllocator/CreateGraphicsPipelineState and are forwarded unchanged.
@@ -57,8 +60,9 @@ unsigned device_proxy_slot_count(const void* device);
57ID3D12Device* device_proxy_real_device(const void* device); 60ID3D12Device* device_proxy_real_device(const void* device);
58 61
59// True for slots the proxy handles itself rather than forwarding verbatim: IUnknown (0-2), 8 and 75 (queue 62// True for slots the proxy handles itself rather than forwarding verbatim: IUnknown (0-2), 8 and 75 (queue
60// proxies), 14, 31/34/35/45/46/50 (proxies unwrapped), 32 and 36 (fence proxies), 62, 67 and 76. 63// proxies), 9 (allocator proxies), 14, 31/34/35/45/46/50 (proxies unwrapped), 32 and 36 (fence proxies), 62, 67
61// Slots 9 and 10 are intentionally false; the handle conversion is on the heap proxy. 64// and 76. Slot 10 is intentionally false: the measured 9/10 handle conversion is on the heap proxy, and device
65// slot 9 is CreateCommandAllocator, which the proxy handles for the allocator proxy.
62bool device_slot_overridden(unsigned slot); 66bool device_slot_overridden(unsigned slot);
63 67
64// Queue and fence proxies created by device slots 8/75 and 36. The real_* accessors return the wrapped object 68// Queue and fence proxies created by device slots 8/75 and 36. The real_* accessors return the wrapped object
@@ -72,7 +76,7 @@ unsigned queue_proxy_slot_count(const void* queue);
72unsigned fence_proxy_slot_count(const void* fence); 76unsigned fence_proxy_slot_count(const void* fence);
73unsigned queue_proxy_table_size(); 77unsigned queue_proxy_table_size();
74unsigned fence_proxy_table_size(); 78unsigned fence_proxy_table_size();
75// Live references on a queue or fence proxy (0 for anything else). Test helper. 79// Live references on a queue, fence or allocator proxy (0 for anything else). Test helper.
76unsigned long command_object_proxy_ref_count(const void* object); 80unsigned long command_object_proxy_ref_count(const void* object);
77// Per-slot call counters and first-call flags, shared by all queue proxies and all fence proxies. 81// Per-slot call counters and first-call flags, shared by all queue proxies and all fence proxies.
78std::uint64_t queue_slot_hits(unsigned slot); 82std::uint64_t queue_slot_hits(unsigned slot);
@@ -82,8 +86,28 @@ bool fence_slot_first_call_seen(unsigned slot);
82// Vtable reads past a queue or fence proxy table that faulted in its guard region (counted by the fault logger). 86// Vtable reads past a queue or fence proxy table that faulted in its guard region (counted by the fault logger).
83std::uint64_t queue_table_overruns(); 87std::uint64_t queue_table_overruns();
84std::uint64_t fence_table_overruns(); 88std::uint64_t fence_table_overruns();
85// True when both tables sit in front of their guard region (false only if the reservation failed). 89// True when the queue, fence and allocator tables sit in front of their guard regions (false only if a reservation
90// or the fault logger failed).
86bool command_object_tables_guarded(); 91bool command_object_tables_guarded();
92
93// Command allocator proxies (device slot 9): the public chain (9 slots: the base chain and Reset) is forwarded, a
94// slot past it up to the end of the table (64 slots) is logged and refused with E_NOTIMPL, and a read past the
95// table faults in a guard region, as for queues and fences. The console allocator's extra methods are not
96// measured and not guessed. Slot 9 wraps only an allocator that answers kLeonidaCommandAllocatorTag, Leonida's
97// own Vulkan-layer allocator: its command lists resolve the proxy (CreateCommandList, Reset). A PC runtime
98// allocator goes back unchanged, because the PC runtime's lists would take a proxy for their own allocator; a
99// command-list proxy that unwraps at Reset is what lets the host backend wrap allocators too.
100// {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10}: the Vulkan layer's CommandAllocator answers it with its implementation.
101inline constexpr GUID kLeonidaCommandAllocatorTag{
102 0x7d0e6b51, 0x34a2, 0x4f0c, {0x9a, 0x61, 0x0c, 0x5b, 0x2e, 0x8f, 0x4a, 0x10}};
103bool is_allocator_proxy(const void* allocator);
104// The wrapped allocator (no reference added), or null when `allocator` is not an allocator proxy.
105ID3D12CommandAllocator* allocator_proxy_real_allocator(const void* allocator);
106unsigned allocator_proxy_slot_count(const void* allocator);
107unsigned allocator_proxy_table_size();
108std::uint64_t allocator_slot_hits(unsigned slot);
109bool allocator_slot_first_call_seen(unsigned slot);
110std::uint64_t allocator_table_overruns();
87// Heap slots 0-2, 7 (GetDevice -> device proxy) and 9/10 (handle conversion). 111// Heap slots 0-2, 7 (GetDevice -> device proxy) and 9/10 (handle conversion).
88bool heap_slot_overridden(unsigned slot); 112bool heap_slot_overridden(unsigned slot);
89 113
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index af3b96679..c4a7530c4 100644
--- a/runtime/shims/dxgi_com.cpp
+++ b/runtime/shims/dxgi_com.cpp
@@ -22,6 +22,10 @@ void stub(const char* method) {
22 if (seen.insert(method).second) std::fprintf(stderr, "[rt] dxgi: unimplemented %s\n", method); 22 if (seen.insert(method).second) std::fprintf(stderr, "[rt] dxgi: unimplemented %s\n", method);
23} 23}
24 24
25bool valid_flip_buffer_count(UINT count) {
26 return count >= 2 && count <= DXGI_MAX_SWAP_CHAIN_BUFFERS;
27}
28
25VkFormat dxgi_to_vk_format(DXGI_FORMAT fmt) { 29VkFormat dxgi_to_vk_format(DXGI_FORMAT fmt) {
26 switch (fmt) { 30 switch (fmt) {
27 case DXGI_FORMAT_B8G8R8A8_UNORM: return VK_FORMAT_B8G8R8A8_UNORM; 31 case DXGI_FORMAT_B8G8R8A8_UNORM: return VK_FORMAT_B8G8R8A8_UNORM;
@@ -128,14 +132,13 @@ public:
128 const VkExtent2D size = size_or_client(desc.Width, desc.Height, {256u, 256u}); 132 const VkExtent2D size = size_or_client(desc.Width, desc.Height, {256u, 256u});
129 const std::uint32_t w = size.width; 133 const std::uint32_t w = size.width;
130 const std::uint32_t h = size.height; 134 const std::uint32_t h = size.height;
131 const std::uint32_t count = desc.BufferCount ? desc.BufferCount : 2u;
132 VkFormat vk_fmt = VK_FORMAT_UNDEFINED; 135 VkFormat vk_fmt = VK_FORMAT_UNDEFINED;
133 if (desc.Format != DXGI_FORMAT_UNKNOWN) { 136 if (desc.Format != DXGI_FORMAT_UNKNOWN) {
134 vk_fmt = dxgi_to_vk_format(desc.Format); 137 vk_fmt = dxgi_to_vk_format(desc.Format);
135 if (vk_fmt == VK_FORMAT_UNDEFINED) return false; 138 if (vk_fmt == VK_FORMAT_UNDEFINED) return false;
136 } 139 }
137 const bool allow_tearing = (flags_ & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; 140 const bool allow_tearing = (flags_ & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0;
138 if (!swapchain_.create(hwnd, w, h, vk_fmt, count, allow_tearing)) return false; 141 if (!swapchain_.create(hwnd, w, h, vk_fmt, desc.BufferCount, allow_tearing)) return false;
139 if (flags_ & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) { 142 if (flags_ & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) {
140 // DXGI: waitable swapchains default to maximum frame latency 1. 143 // DXGI: waitable swapchains default to maximum frame latency 1.
141 max_frame_latency_.store(1, std::memory_order_relaxed); 144 max_frame_latency_.store(1, std::memory_order_relaxed);
@@ -234,11 +237,15 @@ public:
234 } 237 }
235 238
236 HRESULT STDMETHODCALLTYPE ResizeBuffers(UINT count, UINT width, UINT height, DXGI_FORMAT fmt, UINT flags) override { 239 HRESULT STDMETHODCALLTYPE ResizeBuffers(UINT count, UINT width, UINT height, DXGI_FORMAT fmt, UINT flags) override {
240 if (count != 0 && !valid_flip_buffer_count(count)) return E_INVALIDARG;
237 VkFormat vk_fmt = VK_FORMAT_UNDEFINED; 241 VkFormat vk_fmt = VK_FORMAT_UNDEFINED;
238 if (fmt != DXGI_FORMAT_UNKNOWN) { 242 if (fmt != DXGI_FORMAT_UNKNOWN) {
239 vk_fmt = dxgi_to_vk_format(fmt); 243 vk_fmt = dxgi_to_vk_format(fmt);
240 if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_UNSUPPORTED; 244 if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_UNSUPPORTED;
241 } 245 }
246 constexpr UINT creation_only_flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT |
247 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
248 if ((flags & creation_only_flags) != (flags_ & creation_only_flags)) return E_INVALIDARG;
242 // DXGI refuses to resize while the app still holds a back buffer reference. 249 // DXGI refuses to resize while the app still holds a back buffer reference.
243 for (auto* bb : buffers_) 250 for (auto* bb : buffers_)
244 if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL; 251 if (bb->held_by_app()) return DXGI_ERROR_INVALID_CALL;
@@ -246,10 +253,10 @@ public:
246 const VkExtent2D size = size_or_client(width, height, swapchain_.extent()); 253 const VkExtent2D size = size_or_client(width, height, swapchain_.extent());
247 const std::uint32_t w = size.width; 254 const std::uint32_t w = size.width;
248 const std::uint32_t h = size.height; 255 const std::uint32_t h = size.height;
249 const UINT waitable_bit = flags_ & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT; 256 const UINT next_flags = flags ? flags : flags_;
250 const UINT next_flags = (flags ? flags : flags_) | waitable_bit;
251 const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; 257 const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0;
252 if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL; 258 if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL;
259 statistics_disjoint_.store(true, std::memory_order_relaxed);
253 flags_ = next_flags; 260 flags_ = next_flags;
254 register_buffers(); 261 register_buffers();
255 std::uint32_t next = 0; 262 std::uint32_t next = 0;
@@ -259,8 +266,11 @@ public:
259 HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC*) override { return S_OK; } 266 HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC*) override { return S_OK; }
260 HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput**) override { return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; } 267 HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput**) override { return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; }
261 HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* stats) override { 268 HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* stats) override {
262 if (!stats) return E_INVALIDARG; 269 if (!stats) return DXGI_ERROR_INVALID_CALL;
263 std::memset(stats, 0, sizeof(*stats)); 270 std::memset(stats, 0, sizeof(*stats));
271 // Native DXGI reports the discontinuity once, on the first valid query after creation or resize.
272 if (statistics_disjoint_.exchange(false, std::memory_order_relaxed))
273 return DXGI_ERROR_FRAME_STATISTICS_DISJOINT;
264 const UINT count = present_count_.load(std::memory_order_relaxed); 274 const UINT count = present_count_.load(std::memory_order_relaxed);
265 stats->PresentCount = count; 275 stats->PresentCount = count;
266 stats->PresentRefreshCount = count; 276 stats->PresentRefreshCount = count;
@@ -425,6 +435,7 @@ private:
425 HANDLE waitable_ = nullptr; 435 HANDLE waitable_ = nullptr;
426 std::vector<BackBufferResource*> buffers_; 436 std::vector<BackBufferResource*> buffers_;
427 std::atomic<UINT> present_count_{0}; 437 std::atomic<UINT> present_count_{0};
438 std::atomic<bool> statistics_disjoint_{true};
428 std::atomic<LONGLONG> last_present_qpc_{0}; 439 std::atomic<LONGLONG> last_present_qpc_{0};
429 std::atomic<UINT> max_frame_latency_{2}; 440 std::atomic<UINT> max_frame_latency_{2};
430 DXGI_RGBA background_color_{0, 0, 0, 0}; 441 DXGI_RGBA background_color_{0, 0, 0, 0};
@@ -777,6 +788,7 @@ public:
777 if (!out) return E_POINTER; 788 if (!out) return E_POINTER;
778 *out = nullptr; 789 *out = nullptr;
779 if (!hwnd || !desc) return E_INVALIDARG; 790 if (!hwnd || !desc) return E_INVALIDARG;
791 if (!valid_flip_buffer_count(desc->BufferCount)) return DXGI_ERROR_INVALID_CALL;
780 auto* sc = new SwapChain(this, device, context_, gipa_, instance_, physical_, gdpa_, queue_, queue_family_); 792 auto* sc = new SwapChain(this, device, context_, gipa_, instance_, physical_, gdpa_, queue_, queue_family_);
781 if (!sc->init(hwnd, *desc)) { 793 if (!sc->init(hwnd, *desc)) {
782 sc->Release(); 794 sc->Release();
@@ -785,16 +797,46 @@ public:
785 *out = static_cast<IDXGISwapChain1*>(sc); 797 *out = static_cast<IDXGISwapChain1*>(sc);
786 return S_OK; 798 return S_OK;
787 } 799 }
788 HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(IUnknown*, IUnknown*, const DXGI_SWAP_CHAIN_DESC1*, 800 HRESULT STDMETHODCALLTYPE CreateSwapChainForCoreWindow(IUnknown* device, IUnknown* window,
789 IDXGIOutput*, IDXGISwapChain1**) override { 801 const DXGI_SWAP_CHAIN_DESC1* desc,
790 return E_NOTIMPL; 802 IDXGIOutput* restrict_to_output,
803 IDXGISwapChain1** out) override {
804 if (!out) return E_POINTER;
805 *out = nullptr;
806 if (!device || !window || !desc) return E_INVALIDARG;
807 // UWP / Game Core Scarlett titles present to an ICoreWindow. Extract the underlying
808 // Win32 HWND via ICoreWindowInterop.
809 static constexpr GUID kIID_ICoreWindowInterop = {
810 0x45D64A29, 0xA63E, 0x4CB6, {0xB4, 0x98, 0x57, 0x81, 0xD2, 0x98, 0xCB, 0x4F}};
811 struct ICoreWindowInterop : public IUnknown {
812 virtual HRESULT STDMETHODCALLTYPE get_WindowHandle(HWND* hwnd) = 0;
813 virtual HRESULT STDMETHODCALLTYPE put_MessageHandled(unsigned char value) = 0;
814 };
815 ICoreWindowInterop* interop = nullptr;
816 if (FAILED(window->QueryInterface(kIID_ICoreWindowInterop, reinterpret_cast<void**>(&interop))) || !interop) {
817 return DXGI_ERROR_INVALID_CALL;
818 }
819 HWND hwnd = nullptr;
820 const HRESULT hr = interop->get_WindowHandle(&hwnd);
821 interop->Release();
822 if (FAILED(hr) || !hwnd) return DXGI_ERROR_INVALID_CALL;
823 return CreateSwapChainForHwnd(device, hwnd, desc, nullptr, restrict_to_output, out);
791 } 824 }
792 HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(HANDLE, LUID*) override { return E_NOTIMPL; } 825 HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(HANDLE, LUID*) override { return E_NOTIMPL; }
793 HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(HWND, UINT, DWORD*) override { return E_NOTIMPL; } 826 HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(HWND, UINT, DWORD*) override { return E_NOTIMPL; }
794 HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(HANDLE, DWORD*) override { return E_NOTIMPL; } 827 HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(HANDLE, DWORD*) override { return E_NOTIMPL; }
795 void STDMETHODCALLTYPE UnregisterStereoStatus(DWORD) override {} 828 void STDMETHODCALLTYPE UnregisterStereoStatus(DWORD) override {}
796 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(HWND, UINT, DWORD*) override { return E_NOTIMPL; } 829 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(HWND hwnd, UINT msg, DWORD* cookie) override {
797 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(HANDLE, DWORD*) override { return E_NOTIMPL; } 830 (void)msg;
831 if (!hwnd || !cookie) return DXGI_ERROR_INVALID_CALL;
832 *cookie = next_occlusion_cookie_.fetch_add(1, std::memory_order_relaxed);
833 return S_OK;
834 }
835 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusEvent(HANDLE event, DWORD* cookie) override {
836 if (!event || !cookie) return DXGI_ERROR_INVALID_CALL;
837 *cookie = next_occlusion_cookie_.fetch_add(1, std::memory_order_relaxed);
838 return S_OK;
839 }
798 void STDMETHODCALLTYPE UnregisterOcclusionStatus(DWORD) override {} 840 void STDMETHODCALLTYPE UnregisterOcclusionStatus(DWORD) override {}
799 HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(IUnknown*, const DXGI_SWAP_CHAIN_DESC1*, IDXGIOutput*, 841 HRESULT STDMETHODCALLTYPE CreateSwapChainForComposition(IUnknown*, const DXGI_SWAP_CHAIN_DESC1*, IDXGIOutput*,
800 IDXGISwapChain1**) override { 842 IDXGISwapChain1**) override {
@@ -880,6 +922,7 @@ private:
880 HWND assoc_hwnd_ = nullptr; 922 HWND assoc_hwnd_ = nullptr;
881 mutable std::once_flag tearing_once_; 923 mutable std::once_flag tearing_once_;
882 bool tearing_supported_ = false; 924 bool tearing_supported_ = false;
925 std::atomic<DWORD> next_occlusion_cookie_{1};
883}; 926};
884 927
885} // namespace 928} // namespace
diff --git a/runtime/shims/file_system.cpp b/runtime/shims/file_system.cpp
index 38c3194fe..f0ae08811 100644
--- a/runtime/shims/file_system.cpp
+++ b/runtime/shims/file_system.cpp
@@ -142,7 +142,9 @@ std::filesystem::path marker(const std::filesystem::path& overlay, const std::ve
142bool deleted(const std::filesystem::path& overlay, const std::vector<std::wstring>& parts) { 142bool deleted(const std::filesystem::path& overlay, const std::vector<std::wstring>& parts) {
143 if (overlay.empty() || parts.empty()) return false; 143 if (overlay.empty() || parts.empty()) return false;
144 std::error_code ec; 144 std::error_code ec;
145 return std::filesystem::exists(marker(overlay, parts), ec); 145 // Only regular files are deletion markers; parent directories inside .gta6rt-deleted/ exist only to hold markers
146 // for nested deleted files and must not hide the corresponding ancestor directories in the package.
147 return std::filesystem::is_regular_file(marker(overlay, parts), ec);
146} 148}
147 149
148Target read_target(const std::wstring& path) { 150Target read_target(const std::wstring& path) {
diff --git a/runtime/shims/gameinput.cpp b/runtime/shims/gameinput.cpp
index 2b55022f4..3b66e2ab9 100644
--- a/runtime/shims/gameinput.cpp
+++ b/runtime/shims/gameinput.cpp
@@ -50,8 +50,9 @@ using namespace gi;
50 50
51namespace { 51namespace {
52 52
53constexpr uint32_t kSupportedKinds = 53constexpr uint32_t kBaseKinds =
54 GameInputKindControllerAxis | GameInputKindControllerButton | GameInputKindGamepad | GameInputKindUiNavigation; 54 GameInputKindControllerAxis | GameInputKindControllerButton | GameInputKindGamepad | GameInputKindUiNavigation;
55constexpr uint32_t kSupportedKinds = kBaseKinds | GameInputKindMotion; // everything a reading may carry
55constexpr uint32_t kAxisCount = 6; // LX, LY, RX, RY, LT, RT 56constexpr uint32_t kAxisCount = 6; // LX, LY, RX, RY, LT, RT
56constexpr uint32_t kButtonCount = SDL_GAMEPAD_BUTTON_COUNT; 57constexpr uint32_t kButtonCount = SDL_GAMEPAD_BUTTON_COUNT;
57constexpr uint32_t kConnectedStatus = GameInputDeviceConnected | GameInputDeviceInputEnabled | GameInputDeviceOutputEnabled; 58constexpr uint32_t kConnectedStatus = GameInputDeviceConnected | GameInputDeviceInputEnabled | GameInputDeviceOutputEnabled;
@@ -61,6 +62,14 @@ constexpr uint64_t kBatteryRefreshUs = 1'000'000;
61constexpr int kDsEffectSize = 47; // the DualSense effects block SDL_SendGamepadEffect forwards (SDL's DS5EffectsState_t) 62constexpr int kDsEffectSize = 47; // the DualSense effects block SDL_SendGamepadEffect forwards (SDL's DS5EffectsState_t)
62constexpr uint64_t kHistoryUs = 500'000; // a reading stays in the history until the one after it is this old 63constexpr uint64_t kHistoryUs = 500'000; // a reading stays in the history until the one after it is this old
63constexpr size_t kHistoryCap = 512; // readings per pad, whatever the poll rate 64constexpr size_t kHistoryCap = 512; // readings per pad, whatever the poll rate
65// Motion. SDL gives accel in m/s^2 (gravity included) and gyro in rad/s; the state the ABI defines carries signed
66// fractions of the maxima motionInfo reports, so a reading stays within -1..1 however hard the pad is shaken. The
67// maxima are this shim's choice: SDL does not expose a sensor range, and 2 g / 2000 deg/s are the ranges a
68// DualSense's accelerometer and gyro can express (VERIFY: against the game and a real pad, docs/gameinput.md).
69constexpr float kMaxAcceleration = 19.6133f; // 2 g in m/s^2
70constexpr float kMaxAngularVelocity = 34.9066f; // 2000 deg/s in rad/s
71constexpr float kMotionSensorRate = 250.0f; // requested sample rate; the device clamps to what it has
72constexpr uint64_t kMotionReadingUs = 8'000; // a motion pad streams readings at ~125 Hz so the history stays sane
64 73
65uint64_t now_us() { 74uint64_t now_us() {
66 static const LARGE_INTEGER freq = [] { LARGE_INTEGER f; QueryPerformanceFrequency(&f); return f; }(); 75 static const LARGE_INTEGER freq = [] { LARGE_INTEGER f; QueryPerformanceFrequency(&f); return f; }();
@@ -133,6 +142,8 @@ struct Snapshot {
133 float axes[kAxisCount] = {}; 142 float axes[kAxisCount] = {};
134 bool buttons[kButtonCount] = {}; 143 bool buttons[kButtonCount] = {};
135 bool guide = false; 144 bool guide = false;
145 GameInputMotionState motion{}; // valid only when has_motion; does not take part in operator==
146 bool has_motion = false;
136 bool operator==(const Snapshot& o) const { // field by field: the padding is not initialised 147 bool operator==(const Snapshot& o) const { // field by field: the padding is not initialised
137 const GameInputGamepadState &a = gamepad, &b = o.gamepad; 148 const GameInputGamepadState &a = gamepad, &b = o.gamepad;
138 return a.buttons == b.buttons && a.leftTrigger == b.leftTrigger && a.rightTrigger == b.rightTrigger && 149 return a.buttons == b.buttons && a.leftTrigger == b.leftTrigger && a.rightTrigger == b.rightTrigger &&
@@ -164,7 +175,9 @@ public:
164 return r; 175 return r;
165 } 176 }
166 177
167 uint32_t STDMETHODCALLTYPE GetInputKind() override { return kSupportedKinds; } 178 uint32_t STDMETHODCALLTYPE GetInputKind() override {
179 return s_.has_motion ? kSupportedKinds : kBaseKinds; // a reading of a pad without sensors carries no motion
180 }
168 uint64_t STDMETHODCALLTYPE GetSequenceNumber(uint32_t) override { return seq_; } 181 uint64_t STDMETHODCALLTYPE GetSequenceNumber(uint32_t) override { return seq_; }
169 uint64_t STDMETHODCALLTYPE GetTimestamp() override { return ts_; } 182 uint64_t STDMETHODCALLTYPE GetTimestamp() override { return ts_; }
170 void STDMETHODCALLTYPE GetDevice(IGameInputDevice** device) override; 183 void STDMETHODCALLTYPE GetDevice(IGameInputDevice** device) override;
@@ -191,7 +204,11 @@ public:
191 bool STDMETHODCALLTYPE GetMouseState(void*) override { return false; } 204 bool STDMETHODCALLTYPE GetMouseState(void*) override { return false; }
192 uint32_t STDMETHODCALLTYPE GetTouchCount() override { return 0; } 205 uint32_t STDMETHODCALLTYPE GetTouchCount() override { return 0; }
193 uint32_t STDMETHODCALLTYPE GetTouchState(uint32_t, void*) override { return 0; } 206 uint32_t STDMETHODCALLTYPE GetTouchState(uint32_t, void*) override { return 0; }
194 bool STDMETHODCALLTYPE GetMotionState(void*) override { return false; } 207 bool STDMETHODCALLTYPE GetMotionState(void* state) override {
208 if (!state || !s_.has_motion) return false;
209 *static_cast<GameInputMotionState*>(state) = s_.motion;
210 return true;
211 }
195 bool STDMETHODCALLTYPE GetArcadeStickState(void*) override { return false; } 212 bool STDMETHODCALLTYPE GetArcadeStickState(void*) override { return false; }
196 bool STDMETHODCALLTYPE GetFlightStickState(void*) override { return false; } 213 bool STDMETHODCALLTYPE GetFlightStickState(void*) override { return false; }
197 bool STDMETHODCALLTYPE GetGamepadState(GameInputGamepadState* state) override { 214 bool STDMETHODCALLTYPE GetGamepadState(GameInputGamepadState* state) override {
@@ -281,6 +298,7 @@ public:
281 GameInputControllerButtonInfo button_info[kButtonCount]{}; 298 GameInputControllerButtonInfo button_info[kButtonCount]{};
282 GameInputGamepadInfo gamepad_info{}; 299 GameInputGamepadInfo gamepad_info{};
283 GameInputUiNavigationInfo ui_info{}; 300 GameInputUiNavigationInfo ui_info{};
301 GameInputMotionInfo motion_info{}; // filled only when the pad has sensors; info.motionInfo points at it
284 std::atomic<uint32_t> status{GameInputDeviceNoStatus}; 302 std::atomic<uint32_t> status{GameInputDeviceNoStatus};
285 std::deque<Reading*> history; // one reference each, oldest first; the newest is the current reading 303 std::deque<Reading*> history; // one reference each, oldest first; the newest is the current reading
286 uint64_t evicted_order = 0; // order of the newest reading dropped from history 304 uint64_t evicted_order = 0; // order of the newest reading dropped from history
@@ -294,9 +312,10 @@ public:
294 SDL_Gamepad* pad = nullptr; 312 SDL_Gamepad* pad = nullptr;
295 SDL_JoystickID id = 0; 313 SDL_JoystickID id = 0;
296 int player = -1; 314 int player = -1;
297 bool is_dualsense = false, has_rumble = false, has_trigger_rumble = false; 315 bool is_dualsense = false, has_rumble = false, has_trigger_rumble = false, has_motion = false;
298 rt::gameinput::OutputState sent{}; 316 rt::gameinput::OutputState sent{};
299 Snapshot last_snap{}; // what the latest reading holds 317 Snapshot last_snap{}; // what the latest reading holds
318 uint64_t last_reading_us = 0; // for the motion cadence: readings stream at ~125 Hz on pads with sensors
300 uint64_t motors_sent_at = 0, triggers_sent_at = 0, battery_at = 0; 319 uint64_t motors_sent_at = 0, triggers_sent_at = 0, battery_at = 0;
301 bool ds_sent_once = false; 320 bool ds_sent_once = false;
302 321
@@ -446,7 +465,10 @@ uint16_t to_u16(float v) { return static_cast<uint16_t>(std::lround(std::clamp(v
446 465
447float axis(SDL_Gamepad* p, SDL_GamepadAxis a) { return std::max(-1.0f, SDL_GetGamepadAxis(p, a) / 32767.0f); } 466float axis(SDL_Gamepad* p, SDL_GamepadAxis a) { return std::max(-1.0f, SDL_GetGamepadAxis(p, a) / 32767.0f); }
448 467
449Snapshot read_pad(SDL_Gamepad* p) { 468float norm(float v, float max) { return std::clamp(v / max, -1.0f, 1.0f); }
469
470Snapshot read_pad(Device* d) {
471 SDL_Gamepad* p = d->pad;
450 Snapshot s; 472 Snapshot s;
451 auto down = [p](SDL_GamepadButton b) { return SDL_GetGamepadButton(p, b); }; 473 auto down = [p](SDL_GamepadButton b) { return SDL_GetGamepadButton(p, b); };
452 struct Map { SDL_GamepadButton sdl; uint32_t gi; }; 474 struct Map { SDL_GamepadButton sdl; uint32_t gi; };
@@ -486,6 +508,31 @@ Snapshot read_pad(SDL_Gamepad* p) {
486 for (uint32_t i = 0; i < kButtonCount; ++i) s.buttons[i] = down(static_cast<SDL_GamepadButton>(i)); 508 for (uint32_t i = 0; i < kButtonCount; ++i) s.buttons[i] = down(static_cast<SDL_GamepadButton>(i));
487 s.guide = down(SDL_GAMEPAD_BUTTON_GUIDE); 509 s.guide = down(SDL_GAMEPAD_BUTTON_GUIDE);
488 510
511 // Motion, normalised against the maxima motionInfo reports (the ABI's fraction convention). Sensors were enabled
512 // when the pad was opened; a pad whose sensor read fails just reports no motion this poll. SDL answers reads
513 // with zeros before the device's first sample arrives, and gravity makes a real accelerometer never read
514 // exactly zero, so all-zero accel means "no sample yet" and the reading carries no motion at all.
515 if (d->has_motion) {
516 float accel[3], gyro[3];
517 if (SDL_GetGamepadSensorData(p, SDL_SENSOR_ACCEL, accel, 3) &&
518 SDL_GetGamepadSensorData(p, SDL_SENSOR_GYRO, gyro, 3) &&
519 (accel[0] != 0.0f || accel[1] != 0.0f || accel[2] != 0.0f)) {
520 s.has_motion = true;
521 s.motion.accelerationX = norm(accel[0], kMaxAcceleration);
522 s.motion.accelerationY = norm(accel[1], kMaxAcceleration);
523 s.motion.accelerationZ = norm(accel[2], kMaxAcceleration);
524 s.motion.angularVelocityX = norm(gyro[0], kMaxAngularVelocity);
525 s.motion.angularVelocityY = norm(gyro[1], kMaxAngularVelocity);
526 s.motion.angularVelocityZ = norm(gyro[2], kMaxAngularVelocity);
527 // SDL's gamepad API has no compass and the shim synthesises no orientation, so those stay zero and
528 // unknown rather than a made-up value.
529 s.motion.accelerometerAccuracy = GameInputMotionAccuracyHigh;
530 s.motion.gyroscopeAccuracy = GameInputMotionAccuracyHigh;
531 s.motion.magnetometerAccuracy = GameInputMotionAccuracyUnknown;
532 s.motion.orientationAccuracy = GameInputMotionAccuracyUnknown;
533 }
534 }
535
489 // UI navigation derived from the gamepad (VERIFY against the console's own mapping). 536 // UI navigation derived from the gamepad (VERIFY against the console's own mapping).
490 const uint32_t b = s.gamepad.buttons; 537 const uint32_t b = s.gamepad.buttons;
491 const float t = 0.5f; 538 const float t = 0.5f;
@@ -544,10 +591,19 @@ void fill_info(Device* d, SDL_Gamepad* p, const AppLocalDeviceId& id) {
544 // filters on the family). 591 // filters on the family).
545 i.deviceFamily = GameInputFamilyXboxOne; 592 i.deviceFamily = GameInputFamilyXboxOne;
546 if (SDL_GetGamepadConnectionState(p) == SDL_JOYSTICK_CONNECTION_WIRELESS) i.capabilities |= GameInputDeviceCapabilityWireless; 593 if (SDL_GetGamepadConnectionState(p) == SDL_JOYSTICK_CONNECTION_WIRELESS) i.capabilities |= GameInputDeviceCapabilityWireless;
547 i.supportedInput = kSupportedKinds; 594 // The per-device kind set: the reading-kind searches take the global kSupportedKinds as the outer bound and this
595 // as the per-device one, so only pads with sensors answer a motion query.
596 i.supportedInput = kBaseKinds;
548 if (d->has_rumble) i.supportedRumbleMotors |= GameInputRumbleLowFrequency | GameInputRumbleHighFrequency; 597 if (d->has_rumble) i.supportedRumbleMotors |= GameInputRumbleLowFrequency | GameInputRumbleHighFrequency;
549 if (d->has_trigger_rumble || (d->is_dualsense && g().config.ds_triggers != rt::gameinput::DsTriggerMode::Off)) 598 if (d->has_trigger_rumble || (d->is_dualsense && g().config.ds_triggers != rt::gameinput::DsTriggerMode::Off))
550 i.supportedRumbleMotors |= GameInputRumbleLeftTrigger | GameInputRumbleRightTrigger; 599 i.supportedRumbleMotors |= GameInputRumbleLeftTrigger | GameInputRumbleRightTrigger;
600 if (d->has_motion) {
601 i.supportedInput |= GameInputKindMotion;
602 // The maxima GetMotionState's fractions divide by. The magnetometer is not available: SDL's gamepad API has
603 // no compass, and maxMagneticFieldStrength 0 says so (Microsoft's GameInputMotionInfo remarks).
604 d->motion_info = {kMaxAcceleration, kMaxAngularVelocity, 0.0f};
605 i.motionInfo = &d->motion_info;
606 }
551 i.controllerAxisCount = kAxisCount; 607 i.controllerAxisCount = kAxisCount;
552 i.controllerButtonCount = kButtonCount; 608 i.controllerButtonCount = kButtonCount;
553 for (uint32_t a = 0; a < kAxisCount; ++a) { 609 for (uint32_t a = 0; a < kAxisCount; ++a) {
@@ -583,6 +639,7 @@ void fill_info(Device* d, SDL_Gamepad* p, const AppLocalDeviceId& id) {
583// the title holds outlive their place here (~Reading only releases the device, which takes no lock). Under g().mu. 639// the title holds outlive their place here (~Reading only releases the device, which takes no lock). Under g().mu.
584Reading* push_reading(Device* d, const Snapshot& snap, uint64_t ts) { 640Reading* push_reading(Device* d, const Snapshot& snap, uint64_t ts) {
585 std::deque<Reading*>& h = d->history; 641 std::deque<Reading*>& h = d->history;
642 d->last_reading_us = ts;
586 h.push_back(new Reading(d, snap, ++d->seq, ts, ++g().last_order)); 643 h.push_back(new Reading(d, snap, ++d->seq, ts, ++g().last_order));
587 while (h.size() > kHistoryCap || (h.size() > 1 && h[1]->GetTimestamp() + kHistoryUs < ts)) { 644 while (h.size() > kHistoryCap || (h.size() > 1 && h[1]->GetTimestamp() + kHistoryUs < ts)) {
588 d->evicted_order = h.front()->order(); 645 d->evicted_order = h.front()->order();
@@ -637,6 +694,13 @@ void open_pad(SDL_JoystickID jid, uint64_t ts) {
637 d->is_dualsense = SDL_GetGamepadType(p) == SDL_GAMEPAD_TYPE_PS5; 694 d->is_dualsense = SDL_GetGamepadType(p) == SDL_GAMEPAD_TYPE_PS5;
638 d->has_rumble = SDL_GetBooleanProperty(props, SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, false); 695 d->has_rumble = SDL_GetBooleanProperty(props, SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, false);
639 d->has_trigger_rumble = SDL_GetBooleanProperty(props, SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN, false); 696 d->has_trigger_rumble = SDL_GetBooleanProperty(props, SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN, false);
697 // Motion needs both sensors; SDL's orientation quaternion is left alone (no title asks for it, and a synthesised
698 // one would lie). Enabling at open: SDL delivers samples only for enabled sensors.
699 d->has_motion = SDL_GamepadHasSensor(p, SDL_SENSOR_GYRO) && SDL_GamepadHasSensor(p, SDL_SENSOR_ACCEL);
700 if (d->has_motion) {
701 SDL_SetGamepadSensorEnabled(p, SDL_SENSOR_GYRO, kMotionSensorRate);
702 SDL_SetGamepadSensorEnabled(p, SDL_SENSOR_ACCEL, kMotionSensorRate);
703 }
640 d->sent = {}; 704 d->sent = {};
641 d->sent.is_dualsense = d->is_dualsense; 705 d->sent.is_dualsense = d->is_dualsense;
642 d->sent.trigger_rumble = d->has_trigger_rumble; 706 d->sent.trigger_rumble = d->has_trigger_rumble;
@@ -662,13 +726,13 @@ void open_pad(SDL_JoystickID jid, uint64_t ts) {
662 d->status = status; 726 d->status = status;
663 s.connected.push_back(d); 727 s.connected.push_back(d);
664 728
665 const Snapshot snap = read_pad(p); 729 const Snapshot snap = read_pad(d);
666 d->last_snap = snap; 730 d->last_snap = snap;
667 push_reading(d, snap, ts); 731 push_reading(d, snap, ts);
668 queue_event({CbType::Device, d, nullptr, ts, status, GameInputDeviceNoStatus, false, 0}); 732 queue_event({CbType::Device, d, nullptr, ts, status, GameInputDeviceNoStatus, false, 0});
669 std::fprintf(stderr, "[rt] gameinput: connected %s (%04x:%04x, player %d%s%s)\n", d->name.c_str(), d->info.vendorId, 733 std::fprintf(stderr, "[rt] gameinput: connected %s (%04x:%04x, player %d%s%s%s)\n", d->name.c_str(),
670 d->info.productId, player + 1, d->is_dualsense ? ", DualSense trigger effects" : "", 734 d->info.vendorId, d->info.productId, player + 1, d->is_dualsense ? ", DualSense trigger effects" : "",
671 d->has_trigger_rumble ? ", trigger rumble" : ""); 735 d->has_trigger_rumble ? ", trigger rumble" : "", d->has_motion ? ", gyro" : "");
672} 736}
673 737
674void close_pad(Device* d, uint64_t ts) { 738void close_pad(Device* d, uint64_t ts) {
@@ -984,11 +1048,15 @@ void poll_once() {
984 connected = s.connected; 1048 connected = s.connected;
985 } 1049 }
986 for (Device* d : connected) { 1050 for (Device* d : connected) {
987 const Snapshot snap = read_pad(d->pad); 1051 const Snapshot snap = read_pad(d);
988 const bool guide_changed = d->last_snap.guide != snap.guide; 1052 const bool guide_changed = d->last_snap.guide != snap.guide;
989 const bool changed = !(d->last_snap == snap); 1053 const bool changed = !(d->last_snap == snap);
990 d->last_snap = snap; 1054 d->last_snap = snap;
991 if (changed) { 1055 // A pad with sensors streams readings at ~125 Hz even when nothing else changes, so motion the title reads
1056 // between its frames is never stuck at the last button event; pads without sensors only read on change, as
1057 // before. push_reading stamps last_reading_us, so the cadence follows the actual history.
1058 const bool motion_tick = snap.has_motion && now - d->last_reading_us >= kMotionReadingUs;
1059 if (changed || motion_tick) {
992 std::lock_guard lock(s.mu); 1060 std::lock_guard lock(s.mu);
993 queue_event({CbType::Reading, d, push_reading(d, snap, now), now, 0, 0, false, 0}); 1061 queue_event({CbType::Reading, d, push_reading(d, snap, now), now, 0, 0, false, 0});
994 } 1062 }
@@ -1121,6 +1189,8 @@ HRESULT find_reading(IGameInputReading* ref, uint32_t kind, IGameInputDevice* de
1121 uint64_t horizon = 0; 1189 uint64_t horizon = 0;
1122 if (device) { 1190 if (device) {
1123 if (as_device(device)->status == GameInputDeviceNoStatus) return GAMEINPUT_E_DEVICE_DISCONNECTED; 1191 if (as_device(device)->status == GameInputDeviceNoStatus) return GAMEINPUT_E_DEVICE_DISCONNECTED;
1192 if (kind != GameInputKindUnknown && !(kind & as_device(device)->info.supportedInput))
1193 return GAMEINPUT_E_READING_NOT_FOUND; // the device does not do this kind (motion on a plain pad)
1124 scope = {as_device(device)}; 1194 scope = {as_device(device)};
1125 } else { 1195 } else {
1126 horizon = r->device()->evicted_order; 1196 horizon = r->device()->evicted_order;
@@ -1165,6 +1235,8 @@ public:
1165 if (device) { 1235 if (device) {
1166 Device* d = as_device(device); 1236 Device* d = as_device(device);
1167 if (d->status == GameInputDeviceNoStatus) return GAMEINPUT_E_DEVICE_DISCONNECTED; 1237 if (d->status == GameInputDeviceNoStatus) return GAMEINPUT_E_DEVICE_DISCONNECTED;
1238 if (kind != GameInputKindUnknown && !(kind & d->info.supportedInput))
1239 return GAMEINPUT_E_READING_NOT_FOUND; // the device does not do this kind (motion on a plain pad)
1168 best = d->latest(); 1240 best = d->latest();
1169 } else { 1241 } else {
1170 for (Device* d : g().connected) // the most recent reading from any gamepad 1242 for (Device* d : g().connected) // the most recent reading from any gamepad
diff --git a/runtime/shims/gameinput_abi.h b/runtime/shims/gameinput_abi.h
index 3ac6380cf..053b00cc9 100644
--- a/runtime/shims/gameinput_abi.h
+++ b/runtime/shims/gameinput_abi.h
@@ -224,6 +224,46 @@ struct GameInputControllerButtonInfo {
224struct GameInputGamepadInfo {}; 224struct GameInputGamepadInfo {};
225struct GameInputUiNavigationInfo {}; 225struct GameInputUiNavigationInfo {};
226 226
227// Motion: layouts from Microsoft's v0 documentation (learn.microsoft.com GameInputMotionInfo / GameInputMotionState /
228// GameInputMotionAccuracy; the GDK public header spells the same members). Accuracy is deprecated only in GameInput
229// v1 and later; v0 still uses it in GameInputMotionState.
230enum GameInputMotionAccuracy : int32_t {
231 GameInputMotionAccuracyUnknown = -1,
232 GameInputMotionAccuracyUnreliable = 0,
233 GameInputMotionAccuracyLow = 1,
234 GameInputMotionAccuracyMedium = 2,
235 GameInputMotionAccuracyHigh = 3,
236};
237
238struct GameInputMotionInfo {
239 float maxAcceleration; // m/s^2; 0 says acceleration input is not available
240 float maxAngularVelocity; // rad/s; 0 says angular-velocity input is not available
241 float maxMagneticFieldStrength; // teslas; 0 says magnetic-field input is not available
242};
243
244// The state GetMotionState writes. Each float is the signed fraction of the GameInputMotionInfo maximum for its
245// sensor (1.0 = full magnitude); orientation is a quaternion. SDL delivers accel in m/s^2 (gravity included) and
246// gyro in rad/s, so the shim divides by the maxima it reports in motionInfo.
247struct GameInputMotionState {
248 float accelerationX;
249 float accelerationY;
250 float accelerationZ;
251 float angularVelocityX;
252 float angularVelocityY;
253 float angularVelocityZ;
254 float magneticFieldX;
255 float magneticFieldY;
256 float magneticFieldZ;
257 float orientationW;
258 float orientationX;
259 float orientationY;
260 float orientationZ;
261 GameInputMotionAccuracy accelerometerAccuracy;
262 GameInputMotionAccuracy gyroscopeAccuracy;
263 GameInputMotionAccuracy magnetometerAccuracy;
264 GameInputMotionAccuracy orientationAccuracy;
265};
266
227struct GameInputDeviceInfo { 267struct GameInputDeviceInfo {
228 uint32_t infoSize; 268 uint32_t infoSize;
229 uint16_t vendorId; 269 uint16_t vendorId;
@@ -280,6 +320,8 @@ static_assert(sizeof(GameInputGamepadState) == 28);
280static_assert(sizeof(GameInputRumbleParams) == 16); 320static_assert(sizeof(GameInputRumbleParams) == 16);
281static_assert(sizeof(GameInputBatteryState) == 20); 321static_assert(sizeof(GameInputBatteryState) == 20);
282static_assert(sizeof(GameInputString) == 16); 322static_assert(sizeof(GameInputString) == 16);
323static_assert(sizeof(GameInputMotionInfo) == 12);
324static_assert(sizeof(GameInputMotionState) == 68);
283static_assert(sizeof(GameInputControllerAxisInfo) == 48); 325static_assert(sizeof(GameInputControllerAxisInfo) == 48);
284static_assert(sizeof(GameInputControllerButtonInfo) == 32); 326static_assert(sizeof(GameInputControllerButtonInfo) == 32);
285static_assert(offsetof(GameInputDeviceInfo, deviceId) == 32); 327static_assert(offsetof(GameInputDeviceInfo, deviceId) == 32);
diff --git a/runtime/shims/library_loader.cpp b/runtime/shims/library_loader.cpp
index 4bcc57704..585c6a299 100644
--- a/runtime/shims/library_loader.cpp
+++ b/runtime/shims/library_loader.cpp
@@ -32,10 +32,16 @@ struct Pseudo {
32 32
33namespace { 33namespace {
34 34
35std::mutex g_mutex; 35// Intentionally immortal: mapped-DLL DLL_PROCESS_DETACH and earlier atexit handlers can call GetProcAddress or
36// FreeLibrary on pseudo-handles during process teardown, after normal statics would have been destroyed.
37std::mutex& loader_mutex() {
38 static auto* m = new std::mutex;
39 return *m;
40}
41
36std::deque<Pseudo>& pseudos() { // a deque never moves its elements, so handed-out handles stay valid 42std::deque<Pseudo>& pseudos() { // a deque never moves its elements, so handed-out handles stay valid
37 static std::deque<Pseudo> d; 43 static auto* d = new std::deque<Pseudo>;
38 return d; 44 return *d;
39} 45}
40 46
41std::string lower_ascii(std::string s) { 47std::string lower_ascii(std::string s) {
@@ -67,7 +73,7 @@ std::string module_name(std::string path) {
67HMODULE owned_handle(const std::string& path) { 73HMODULE owned_handle(const std::string& path) {
68 const std::string dll = module_name(path); 74 const std::string dll = module_name(path);
69 if (dll.empty() || !owns_dll(dll)) return nullptr; 75 if (dll.empty() || !owns_dll(dll)) return nullptr;
70 std::lock_guard lock(g_mutex); 76 std::lock_guard lock(loader_mutex());
71 for (auto& p : pseudos()) 77 for (auto& p : pseudos())
72 if (p.dll == dll) return reinterpret_cast<HMODULE>(&p); 78 if (p.dll == dll) return reinterpret_cast<HMODULE>(&p);
73 pseudos().push_back(Pseudo{}); 79 pseudos().push_back(Pseudo{});
@@ -78,7 +84,7 @@ HMODULE owned_handle(const std::string& path) {
78 84
79// The owned module a handle names, or nullptr for a host module. 85// The owned module a handle names, or nullptr for a host module.
80const Pseudo* pseudo(HMODULE h) { 86const Pseudo* pseudo(HMODULE h) {
81 std::lock_guard lock(g_mutex); 87 std::lock_guard lock(loader_mutex());
82 for (auto& p : pseudos()) 88 for (auto& p : pseudos())
83 if (reinterpret_cast<HMODULE>(&p) == h) return &p; 89 if (reinterpret_cast<HMODULE>(&p) == h) return &p;
84 return nullptr; 90 return nullptr;
@@ -120,14 +126,18 @@ HMODULE WINAPI get_module_handle_w(LPCWSTR name) {
120FARPROC WINAPI get_proc_address(HMODULE module, LPCSTR name) { 126FARPROC WINAPI get_proc_address(HMODULE module, LPCSTR name) {
121 const Pseudo* p = pseudo(module); 127 const Pseudo* p = pseudo(module);
122 if (!p) return GetProcAddress(module, name); 128 if (!p) return GetProcAddress(module, name);
129 if (!name) {
130 SetLastError(ERROR_PROC_NOT_FOUND);
131 return nullptr;
132 }
123 // A value below 0x10000 is an ordinal (IS_INTRESOURCE), as in the real GetProcAddress. 133 // A value below 0x10000 is an ordinal (IS_INTRESOURCE), as in the real GetProcAddress.
124 const std::string what = IS_INTRESOURCE(name) ? "#" + std::to_string(reinterpret_cast<uintptr_t>(name)) : name; 134 const std::string what = IS_INTRESOURCE(name) ? "#" + std::to_string(reinterpret_cast<uintptr_t>(name)) : name;
125 if (void* fn = find(p->dll, what)) return reinterpret_cast<FARPROC>(fn); 135 if (void* fn = find(p->dll, what)) return reinterpret_cast<FARPROC>(fn);
126 { 136 {
127 static std::mutex m; 137 static auto* m = new std::mutex;
128 static std::set<std::string> seen; 138 static auto* seen = new std::set<std::string>;
129 std::lock_guard lock(m); 139 std::lock_guard lock(*m);
130 if (seen.insert(p->dll + "!" + what).second) 140 if (seen->insert(p->dll + "!" + what).second)
131 std::fprintf(stderr, "[rt] loader: GetProcAddress(%s, %s): not served\n", p->dll.c_str(), what.c_str()); 141 std::fprintf(stderr, "[rt] loader: GetProcAddress(%s, %s): not served\n", p->dll.c_str(), what.c_str());
132 } 142 }
133 SetLastError(ERROR_PROC_NOT_FOUND); 143 SetLastError(ERROR_PROC_NOT_FOUND);
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index c0070782f..d3f76a684 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -9,6 +9,10 @@
9// process-wide atexit table also holds gta6rt's own). 9// process-wide atexit table also holds gta6rt's own).
10// Covered CRTs: the Universal CRT (api-ms-win-crt-runtime-l1-1-0.dll / ucrtbase.dll, what MSVC links; ucrtbased.dll in Debug) and 10// Covered CRTs: the Universal CRT (api-ms-win-crt-runtime-l1-1-0.dll / ucrtbase.dll, what MSVC links; ucrtbased.dll in Debug) and
11// msvcrt.dll (MinGW). Calls made inside host DLLs, not through the game's imports, are not seen here. 11// msvcrt.dll (MinGW). Calls made inside host DLLs, not through the game's imports, are not seen here.
12// The loader matches imports by exact DLL name, so GetCommandLineA/W and ExitProcess are served under every name a
13// title can import them by: kernel32.dll (the classic import libraries), kernelbase.dll, and the API sets that the
14// umbrella libraries a GDK title links (OneCore_apiset.lib, mincore.lib) bind them to. The retail package's own DLLs
15// import ExitProcess from api-ms-win-core-processthreads-l1-1-0.dll.
12#include <windows.h> 16#include <windows.h>
13 17
14#include <atomic> 18#include <atomic>
@@ -16,6 +20,7 @@
16#include <cstdlib> 20#include <cstdlib>
17#include <cstring> 21#include <cstring>
18#include <string> 22#include <string>
23#include <type_traits>
19#include <vector> 24#include <vector>
20 25
21#include "process_shim.h" 26#include "process_shim.h"
@@ -107,6 +112,24 @@ wchar_t** __cdecl game_p_wcmdln_storage() {
107 return &p; 112 return &p;
108} 113}
109 114
115// What the UCRT's _get_narrow/_get_wide_winmain_command_line return, and the CRT's WinMain startup passes as
116// lpCmdLine: the command line after the program name and the blanks that follow it. The program name ends at the
117// first character up to ' ' outside quotes, the UCRT's own scan. The comparison is unsigned, so a non-ASCII byte of
118// the narrow line is part of the name; a DBCS trail byte is never '"' or a blank, so it needs no lead-byte step.
119template <typename C>
120C* after_program_name(C* p) {
121 using U = std::make_unsigned_t<C>;
122 bool quoted = false;
123 while (U(*p) > U(' ') || (*p && quoted)) {
124 if (*p == C('"')) quoted = !quoted;
125 ++p;
126 }
127 while (*p && U(*p) <= U(' ')) ++p;
128 return p;
129}
130char* __cdecl game_get_narrow_winmain_command_line() { return after_program_name(g_cmdline.data()); }
131wchar_t* __cdecl game_get_wide_winmain_command_line() { return after_program_name(g_wcmdline.data()); }
132
110// msvcrt.dll: int __getmainargs(int* argc, char*** argv, char*** env, int expand, void* startinfo) 133// msvcrt.dll: int __getmainargs(int* argc, char*** argv, char*** env, int expand, void* startinfo)
111int __cdecl game_getmainargs(int* argc, char*** argv, char*** env, int, void*) { 134int __cdecl game_getmainargs(int* argc, char*** argv, char*** env, int, void*) {
112 *argc = g_argc; 135 *argc = g_argc;
@@ -197,7 +220,13 @@ using namespace rt::process;
197 {dll, "_configure_narrow_argv", reinterpret_cast<void*>(&game_configure_argv)}, \ 220 {dll, "_configure_narrow_argv", reinterpret_cast<void*>(&game_configure_argv)}, \
198 {dll, "_configure_wide_argv", reinterpret_cast<void*>(&game_configure_argv)}, \ 221 {dll, "_configure_wide_argv", reinterpret_cast<void*>(&game_configure_argv)}, \
199 {dll, "__p__acmdln", reinterpret_cast<void*>(&game_p_acmdln_storage)}, \ 222 {dll, "__p__acmdln", reinterpret_cast<void*>(&game_p_acmdln_storage)}, \
200 {dll, "__p__wcmdln", reinterpret_cast<void*>(&game_p_wcmdln_storage)} 223 {dll, "__p__wcmdln", reinterpret_cast<void*>(&game_p_wcmdln_storage)}, \
224 {dll, "_get_narrow_winmain_command_line", reinterpret_cast<void*>(&game_get_narrow_winmain_command_line)}, \
225 {dll, "_get_wide_winmain_command_line", reinterpret_cast<void*>(&game_get_wide_winmain_command_line)}
226#define EXIT_PROCESS(dll) {dll, "ExitProcess", reinterpret_cast<void*>(&game_exit_process)}
227#define COMMAND_LINE(dll) \
228 {dll, "GetCommandLineA", reinterpret_cast<void*>(&game_get_command_line_a)}, \
229 {dll, "GetCommandLineW", reinterpret_cast<void*>(&game_get_command_line_w)}
201} // namespace 230} // namespace
202 231
203SHIM_TABLE(process, 232SHIM_TABLE(process,
@@ -209,7 +238,10 @@ SHIM_TABLE(process,
209 {"msvcrt.dll", "abort", reinterpret_cast<void*>(&game_abort)}, 238 {"msvcrt.dll", "abort", reinterpret_cast<void*>(&game_abort)},
210 {"msvcrt.dll", "__getmainargs", reinterpret_cast<void*>(&game_getmainargs)}, 239 {"msvcrt.dll", "__getmainargs", reinterpret_cast<void*>(&game_getmainargs)},
211 {"msvcrt.dll", "__wgetmainargs", reinterpret_cast<void*>(&game_wgetmainargs)}, 240 {"msvcrt.dll", "__wgetmainargs", reinterpret_cast<void*>(&game_wgetmainargs)},
212 {"kernel32.dll", "ExitProcess", reinterpret_cast<void*>(&game_exit_process)}, 241 EXIT_PROCESS("kernel32.dll"),
213 {"kernel32.dll", "GetCommandLineA", reinterpret_cast<void*>(&game_get_command_line_a)}, 242 EXIT_PROCESS("kernelbase.dll"),
214 {"kernel32.dll", "GetCommandLineW", reinterpret_cast<void*>(&game_get_command_line_w)}, 243 EXIT_PROCESS("api-ms-win-core-processthreads-l1-1-0.dll"),
244 COMMAND_LINE("kernel32.dll"),
245 COMMAND_LINE("kernelbase.dll"),
246 COMMAND_LINE("api-ms-win-core-processenvironment-l1-1-0.dll"),
215); 247);
diff --git a/runtime/src/base_reservation.h b/runtime/src/base_reservation.h
new file mode 100644
index 000000000..76fb530ce
--- /dev/null
+++ b/runtime/src/base_reservation.h
@@ -0,0 +1,139 @@
1#pragma once
2
3// Keeping a relocation-less game image's preferred range free until the loader maps it there.
4//
5// An EXE without a .reloc directory can only run at its ImageBase (0x140000000 by default). Windows and x86-64 Wine
6// leave that range alone, but arm64 Wine on macOS (CrossOver's arm64 bottles, whose x86-64 code runs under FEX) puts
7// its own start-up allocations at 0x100000000 and up, over that range, before gta6rt's first line runs. So gta6rt
8// starts itself again, suspended, reserves [ImageBase, ImageBase + SizeOfImage) in that child before any of its code
9// runs, and resumes it; the child's loader then commits the image inside the reservation (commit_reserved), so
10// nothing else can take the range in between. The child is told by LEONIDA_BASE_RESERVED=<base>:<size> (hex), which
11// also stops it from starting itself again. Measured on CrossOver Preview 20260821 (arm64 bottle, M2 Max): in a
12// suspended child 0x140000000-0x170000000 is free and reservable; macOS maps its own regions above that (the arm64
13// shared region starts at 0x180000000), so a range there can't be had either way.
14//
15// Nothing changes where the range is free at start-up (Windows, x86-64 Wine) or where the image has relocations.
16
17#include <windows.h>
18
19#include <cstdint>
20#include <cstdio>
21#include <cstdlib>
22#include <cwchar>
23#include <filesystem>
24#include <fstream>
25#include <optional>
26#include <string>
27#include <vector>
28
29namespace rt::base_reservation {
30
31inline constexpr wchar_t kVariable[] = L"LEONIDA_BASE_RESERVED";
32
33struct Range {
34 std::uint64_t base = 0;
35 std::uint64_t size = 0;
36};
37
38// The range this process was started with (LEONIDA_BASE_RESERVED), if any.
39inline std::optional<Range> inherited() {
40 wchar_t value[64] = {};
41 const DWORD length = GetEnvironmentVariableW(kVariable, value, 64);
42 if (!length || length >= 64) return std::nullopt;
43 Range r{};
44 if (std::swscanf(value, L"%llx:%llx", reinterpret_cast<unsigned long long*>(&r.base),
45 reinterpret_cast<unsigned long long*>(&r.size)) != 2 ||
46 !r.size)
47 return std::nullopt;
48 return r;
49}
50
51// Commits [base, base + size) for the loader when it lies inside the reservation this process was started with and
52// that reservation is still in place; returns null otherwise (the caller then allocates as usual). The reservation
53// is the allocation, so VirtualFree(base, 0, MEM_RELEASE) frees it as it frees any image.
54inline void* commit_reserved(std::uint64_t base, std::uint64_t size) {
55 const auto r = inherited();
56 if (!r || base != r->base || size > r->size) return nullptr;
57 MEMORY_BASIC_INFORMATION info{};
58 if (!VirtualQuery(reinterpret_cast<void*>(base), &info, sizeof info) || info.State != MEM_RESERVE ||
59 reinterpret_cast<std::uint64_t>(info.AllocationBase) != base)
60 return nullptr;
61 return VirtualAlloc(reinterpret_cast<void*>(base), static_cast<SIZE_T>(size), MEM_COMMIT, PAGE_READWRITE);
62}
63
64// The preferred range of `image` when it has no relocations and that range is not free in this process; nullopt
65// when the image can be mapped as it is (or is not a readable PE32+, which the loader reports itself).
66inline std::optional<Range> needed(const std::filesystem::path& image) {
67 std::ifstream file(image, std::ios::binary);
68 IMAGE_DOS_HEADER dos{};
69 if (!file.read(reinterpret_cast<char*>(&dos), sizeof dos) || dos.e_magic != IMAGE_DOS_SIGNATURE || dos.e_lfanew < 0)
70 return std::nullopt;
71 IMAGE_NT_HEADERS64 nt{};
72 if (!file.seekg(dos.e_lfanew) || !file.read(reinterpret_cast<char*>(&nt), sizeof nt) ||
73 nt.Signature != IMAGE_NT_SIGNATURE || nt.OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC ||
74 !nt.OptionalHeader.SizeOfImage)
75 return std::nullopt;
76 const auto& oh = nt.OptionalHeader;
77 if (oh.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_BASERELOC &&
78 oh.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size)
79 return std::nullopt; // relocatable: the loader moves it if the base is taken
80 const Range r{oh.ImageBase, (static_cast<std::uint64_t>(oh.SizeOfImage) + 0xffff) & ~std::uint64_t{0xffff}};
81 for (std::uint64_t at = r.base; at < r.base + r.size;) {
82 MEMORY_BASIC_INFORMATION info{};
83 if (!VirtualQuery(reinterpret_cast<void*>(at), &info, sizeof info)) return r;
84 if (info.State != MEM_FREE) return r;
85 at = reinterpret_cast<std::uint64_t>(info.BaseAddress) + info.RegionSize;
86 }
87 return std::nullopt;
88}
89
90// Runs this program again with the same command line, suspended, reserves `r` in the new process, resumes it and
91// returns its exit code. On failure prints why and returns 1 (the child, if any, is ended unrun).
92inline int relaunch(const Range& r) {
93 wchar_t self[MAX_PATH * 4] = {};
94 if (!GetModuleFileNameW(nullptr, self, MAX_PATH * 4)) {
95 std::fprintf(stderr, "error: GetModuleFileName failed (%lu)\n", GetLastError());
96 return 1;
97 }
98 wchar_t marker[64];
99 std::swprintf(marker, 64, L"%llx:%llx", static_cast<unsigned long long>(r.base),
100 static_cast<unsigned long long>(r.size));
101 SetEnvironmentVariableW(kVariable, marker); // inherited by the child; this process only waits from here on
102 std::wstring command_line = GetCommandLineW();
103 STARTUPINFOW startup{sizeof startup};
104 startup.dwFlags = STARTF_USESTDHANDLES;
105 startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
106 startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
107 startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
108 for (HANDLE h : {startup.hStdInput, startup.hStdOutput, startup.hStdError})
109 if (h && h != INVALID_HANDLE_VALUE) SetHandleInformation(h, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
110 PROCESS_INFORMATION process{};
111 std::fflush(stdout);
112 std::fflush(stderr);
113 if (!CreateProcessW(self, command_line.data(), nullptr, nullptr, TRUE, CREATE_SUSPENDED, nullptr, nullptr,
114 &startup, &process)) {
115 std::fprintf(stderr, "error: starting gta6rt again to reserve the image range failed (%lu)\n", GetLastError());
116 return 1;
117 }
118 if (!VirtualAllocEx(process.hProcess, reinterpret_cast<void*>(r.base), static_cast<SIZE_T>(r.size), MEM_RESERVE,
119 PAGE_NOACCESS)) {
120 const DWORD error = GetLastError();
121 TerminateProcess(process.hProcess, 1);
122 CloseHandle(process.hThread);
123 CloseHandle(process.hProcess);
124 std::fprintf(stderr,
125 "error: the image has no relocations and its range %#llx-%#llx is taken, also in a new "
126 "process (VirtualAllocEx %lu)\n",
127 static_cast<unsigned long long>(r.base), static_cast<unsigned long long>(r.base + r.size), error);
128 return 1;
129 }
130 ResumeThread(process.hThread);
131 WaitForSingleObject(process.hProcess, INFINITE);
132 DWORD code = 1;
133 GetExitCodeProcess(process.hProcess, &code);
134 CloseHandle(process.hThread);
135 CloseHandle(process.hProcess);
136 return static_cast<int>(code);
137}
138
139} // namespace rt::base_reservation
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index 7d3491653..560f68349 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -23,6 +23,7 @@
23#include <string> 23#include <string>
24#include <vector> 24#include <vector>
25 25
26#include "base_reservation.h"
26#include "pe_loader.h" 27#include "pe_loader.h"
27#include "../shims/d3d12_trace.h" 28#include "../shims/d3d12_trace.h"
28#include "../shims/file_system.h" 29#include "../shims/file_system.h"
@@ -73,6 +74,10 @@ int wmain(int argc, wchar_t** argv) {
73 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point. 74 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point.
74 if (dry_run + init + run != 1) return usage(); 75 if (dry_run + init + run != 1) return usage();
75 if (game_dir.empty()) game_dir = image.parent_path(); 76 if (game_dir.empty()) game_dir = image.parent_path();
77 // An image without relocations whose range this process already uses (arm64 Wine on macOS) runs in a new
78 // process that has the range reserved from the start (base_reservation.h); that process does not do this again.
79 if (!rt::base_reservation::inherited())
80 if (const auto range = rt::base_reservation::needed(image)) return rt::base_reservation::relaunch(*range);
76 // GAME: paths read under --game-dir; whatever a title writes lands in the overlay, never in the package. 81 // GAME: paths read under --game-dir; whatever a title writes lands in the overlay, never in the package.
77 if (overlay_dir.empty()) overlay_dir = game_dir / "overlay"; 82 if (overlay_dir.empty()) overlay_dir = game_dir / "overlay";
78 rt::fs::configure(game_dir, overlay_dir); 83 rt::fs::configure(game_dir, overlay_dir);
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index 1ab9c7801..387051756 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -14,6 +14,7 @@
14#include <vector> 14#include <vector>
15 15
16#include "../shims/shims.h" 16#include "../shims/shims.h"
17#include "base_reservation.h"
17 18
18namespace rt { 19namespace rt {
19 20
@@ -506,8 +507,11 @@ Module& Loader::map_image(const std::filesystem::path& path) {
506 by_name_[lower(m->name)] = m; 507 by_name_[lower(m->name)] = m;
507 order_.push_back(m); 508 order_.push_back(m);
508 509
509 m->base = static_cast<uint8_t*>( 510 // Inside the range gta6rt reserved for this image before the process started (base_reservation.h), else as usual.
510 VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); 511 m->base = static_cast<uint8_t*>(base_reservation::commit_reserved(oh.ImageBase, oh.SizeOfImage));
512 if (!m->base)
513 m->base = static_cast<uint8_t*>(VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage,
514 MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE));
511 if (!m->base) { 515 if (!m->base) {
512 const auto relocs = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); 516 const auto relocs = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC);
513 if (!relocs.Size) 517 if (!relocs.Size)
diff --git a/runtime/src/resource_tiling.h b/runtime/src/resource_tiling.h
index 6bd890ae8..a9d95ae9f 100644
--- a/runtime/src/resource_tiling.h
+++ b/runtime/src/resource_tiling.h
@@ -43,6 +43,7 @@ struct TilingDesc {
43 std::uint32_t mips = 1; 43 std::uint32_t mips = 1;
44 std::uint32_t element_bytes = 0; // bytes per texel, or per block of a block-compressed format 44 std::uint32_t element_bytes = 0; // bytes per texel, or per block of a block-compressed format
45 std::uint32_t block = 1; // texels per block side: 4 for BC1-7 45 std::uint32_t block = 1; // texels per block side: 4 for BC1-7
46 std::uint32_t samples = 1; // 1, or 4 for 2D single-mip MSAA
46}; 47};
47 48
48// D3D12_SUBRESOURCE_TILING: a packed mip has no tiles of its own and starts at packed_tile. 49// D3D12_SUBRESOURCE_TILING: a packed mip has no tiles of its own and starts at packed_tile.
@@ -63,9 +64,22 @@ struct ResourceTiling {
63 std::vector<SubresourceTiling> subresources; // mip + layer * mips 64 std::vector<SubresourceTiling> subresources; // mip + layer * mips
64}; 65};
65 66
66// The standard tile shape in elements (D3D12 "standard swizzle" tile shapes for 64 KiB tiles), or {} for an 67// The standard tile shape in elements (D3D12 "standard swizzle" tile shapes for 64 KiB tiles; 2D 4x MSAA scales the
67// element size that cannot be tiled (3- and 12-byte formats). 68// tile shape down by 4 samples per texel, measured on RTX 5070 Ti and WARP), or {} for an unsupported sample count or
68constexpr TileShape element_tile_shape(bool volume, std::uint32_t element_bytes) { 69// an element size that cannot be tiled (3- and 12-byte formats).
70constexpr TileShape element_tile_shape(bool volume, std::uint32_t element_bytes, std::uint32_t samples = 1) {
71 if (samples == 4) {
72 if (volume) return {};
73 switch (element_bytes) {
74 case 1: return {128, 128, 1};
75 case 2: return {128, 64, 1};
76 case 4: return {64, 64, 1};
77 case 8: return {64, 32, 1};
78 case 16: return {32, 32, 1};
79 default: return {};
80 }
81 }
82 if (samples != 1) return {};
69 switch (element_bytes) { 83 switch (element_bytes) {
70 case 1: return volume ? TileShape{64, 32, 32} : TileShape{256, 256, 1}; 84 case 1: return volume ? TileShape{64, 32, 32} : TileShape{256, 256, 1};
71 case 2: return volume ? TileShape{32, 32, 32} : TileShape{256, 128, 1}; 85 case 2: return volume ? TileShape{32, 32, 32} : TileShape{256, 128, 1};
@@ -103,7 +117,8 @@ inline bool resource_tiling(const TilingDesc& desc, ResourceTiling& out) {
103 return true; 117 return true;
104 } 118 }
105 const bool volume = desc.kind == TiledKind::texture3d; 119 const bool volume = desc.kind == TiledKind::texture3d;
106 const TileShape elements = element_tile_shape(volume, desc.element_bytes); 120 if (desc.samples != 1 && (desc.samples != 4 || volume || desc.mips != 1 || desc.block != 1)) return false;
121 const TileShape elements = element_tile_shape(volume, desc.element_bytes, desc.samples);
107 if (!elements.width || !desc.mips || !desc.block || !desc.width || !desc.height || !desc.depth_or_layers) 122 if (!elements.width || !desc.mips || !desc.block || !desc.width || !desc.height || !desc.depth_or_layers)
108 return false; 123 return false;
109 out.shape = {elements.width * desc.block, elements.height * desc.block, elements.depth}; 124 out.shape = {elements.width * desc.block, elements.height * desc.block, elements.depth};
@@ -124,7 +139,7 @@ inline bool resource_tiling(const TilingDesc& desc, ResourceTiling& out) {
124 ++out.standard_mips; 139 ++out.standard_mips;
125 } else { 140 } else {
126 slice[mip] = {0, 0, 0, packed_tile}; 141 slice[mip] = {0, 0, 0, packed_tile};
127 packed_bytes += up(w, desc.block) * up(h, desc.block) * d * desc.element_bytes; 142 packed_bytes += up(w, desc.block) * up(h, desc.block) * d * desc.element_bytes * desc.samples;
128 ++out.packed_mips; 143 ++out.packed_mips;
129 } 144 }
130 } 145 }
diff --git a/runtime/src/retire_tickets.h b/runtime/src/retire_tickets.h
index 17c3f589e..714cf40a4 100644
--- a/runtime/src/retire_tickets.h
+++ b/runtime/src/retire_tickets.h
@@ -7,7 +7,9 @@ namespace leonida {
7 7
8// Global submission tickets may finish out of order on independent Vulkan queues. Only the 8// Global submission tickets may finish out of order on independent Vulkan queues. Only the
9// contiguous completed prefix is safe for deferred resource destruction. The caller serializes 9// contiguous completed prefix is safe for deferred resource destruction. The caller serializes
10// record(), completed() and queue_idle() with the device submission mutex. 10// record(), completed() and queue_idle() with the device submission mutex. record() must
11// receive strictly increasing global ticket numbers; otherwise a duplicate or backward ticket
12// can make the completed prefix stall or move backward.
11template<class Semaphore> 13template<class Semaphore>
12class RetireTickets { 14class RetireTickets {
13public: 15public:
@@ -26,7 +28,8 @@ public:
26 return completed_; 28 return completed_;
27 } 29 }
28 30
29 // The owning queue has been waited idle and may now destroy its progress semaphore. 31 // Call only after the owning queue's wait-idle succeeded. Merely requesting idle does not
32 // prove its submissions completed and must not advance the retirement prefix.
30 void queue_idle(Semaphore semaphore) { 33 void queue_idle(Semaphore semaphore) {
31 for (Entry& entry : pending_) 34 for (Entry& entry : pending_)
32 if (entry.semaphore == semaphore) entry.idle = true; 35 if (entry.semaphore == semaphore) entry.idle = true;
diff --git a/runtime/src/shader_library.h b/runtime/src/shader_library.h
index 17705a5d1..0f31269a0 100644
--- a/runtime/src/shader_library.h
+++ b/runtime/src/shader_library.h
@@ -532,6 +532,13 @@ struct ShaderEntry {
532 std::array<std::uint32_t, 3> local_size{1, 1, 1}; 532 std::array<std::uint32_t, 3> local_size{1, 1, 1};
533 bool uses_code_base = false; 533 bool uses_code_base = false;
534 bool wave64 = false; 534 bool wave64 = false;
535 // The subgroup size the translator assumed (64 for a wave64 shader, 32 otherwise); 0 when the entry says null,
536 // as one translated with --wave64-emulate does, or has none.
537 std::uint32_t subgroup_size = 0;
538 // "workgroup" for a shader translated with --wave64-emulate: it uses no subgroup operation and is exact on any
539 // subgroup size. Empty for a native translation.
540 std::string wave64_exchange;
541 bool emulated() const { return !wave64_exchange.empty(); }
535 std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed 542 std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed
536 std::vector<std::uint32_t> outputs; // pixel shaders: the render-target locations written 543 std::vector<std::uint32_t> outputs; // pixel shaders: the render-target locations written
537}; 544};
@@ -613,6 +620,10 @@ private:
613 for (std::size_t i = 0; i < l->array.size() && i < 3; ++i) e.local_size[i] = u32(&l->array[i]); 620 for (std::size_t i = 0; i < l->array.size() && i < 3; ++i) e.local_size[i] = u32(&l->array[i]);
614 if (const Json* c = meta.find("uses_code_base"); c && c->kind == Json::Kind::boolean) e.uses_code_base = c->boolean; 621 if (const Json* c = meta.find("uses_code_base"); c && c->kind == Json::Kind::boolean) e.uses_code_base = c->boolean;
615 if (const Json* w = meta.find("wave64"); w && w->kind == Json::Kind::boolean) e.wave64 = w->boolean; 622 if (const Json* w = meta.find("wave64"); w && w->kind == Json::Kind::boolean) e.wave64 = w->boolean;
623 if (const Json* g = meta.find("subgroup_size"); g && g->kind == Json::Kind::number)
624 e.subgroup_size = u32(g);
625 if (const Json* x = meta.find("wave64_exchange"); x && x->kind == Json::Kind::string)
626 e.wave64_exchange = x->string;
616 if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) { 627 if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) {
617 for (const Json& item : s->array) { 628 for (const Json& item : s->array) {
618 SignatureElement element; 629 SignatureElement element;
diff --git a/runtime/src/subgroup_size.h b/runtime/src/subgroup_size.h
new file mode 100644
index 000000000..2df643fdf
--- /dev/null
+++ b/runtime/src/subgroup_size.h
@@ -0,0 +1,152 @@
1#pragma once
2
3// Subgroup size control for pipeline creation (docs/d3d12_vulkan.md, "Subgroup size"). A translated shader assumes
4// one subgroup size: 64 when the game's shader was wave64, 32 otherwise (spirv/index.json `subgroup_size`). A GPU
5// whose default differs runs it inexact (a wave64 shader reads lanes 32-63 of a 32-wide subgroup; a wave32 pixel
6// shader on a 64-wide default reads the other half's lanes), so each stage asks for the size it was translated for
7// where Vulkan allows (VK_EXT_subgroup_size_control, core in 1.3).
8//
9// The decision is a pure function of the shader's index entry and what the device offers, so it is tested without
10// a GPU (subgroup_size_test). It depends only on the Vulkan headers.
11
12#include "shader_library.h"
13
14#include <vulkan/vulkan_core.h>
15
16#include <cstdint>
17#include <string_view>
18
19namespace leonida {
20
21// What the device offers. `subgroup_size_control` and `compute_full_subgroups` say the feature is ENABLED on the
22// device (the validation layers reject the structure and the flag otherwise), not merely supported.
23struct SubgroupSizeCaps {
24 bool subgroup_size_control = false;
25 bool compute_full_subgroups = false;
26 std::uint32_t min_size = 0;
27 std::uint32_t max_size = 0;
28 std::uint32_t default_size = 0; // VkPhysicalDeviceSubgroupProperties::subgroupSize
29 std::uint32_t max_compute_workgroup_subgroups = 0;
30 VkShaderStageFlags required_stages = 0; // requiredSubgroupSizeStages
31};
32
33// Fills the limits of `caps` from vkGetPhysicalDeviceProperties2 and sets the two feature flags from what the
34// caller enables. Returns false when the device reports no subgroup size at all.
35template <class GetProperties2>
36bool query_subgroup_size_caps(GetProperties2 get_properties2, VkPhysicalDevice physical, bool enable_size_control,
37 bool enable_full_subgroups, SubgroupSizeCaps& caps) {
38 VkPhysicalDeviceSubgroupSizeControlProperties control{
39 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES};
40 VkPhysicalDeviceSubgroupProperties subgroup{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES, &control};
41 VkPhysicalDeviceProperties2 properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &subgroup};
42 get_properties2(physical, &properties);
43 caps = {};
44 caps.default_size = subgroup.subgroupSize;
45 caps.min_size = control.minSubgroupSize;
46 caps.max_size = control.maxSubgroupSize;
47 caps.max_compute_workgroup_subgroups = control.maxComputeWorkgroupSubgroups;
48 caps.required_stages = control.requiredSubgroupSizeStages;
49 caps.subgroup_size_control = enable_size_control;
50 caps.compute_full_subgroups = enable_full_subgroups;
51 return caps.default_size != 0;
52}
53
54// The Vulkan stage of an index entry's `stage` ("cs", "ps", ...); 0 for one this layer has no pipeline for.
55inline VkShaderStageFlagBits subgroup_stage_bit(std::string_view stage) {
56 if (stage == "cs") return VK_SHADER_STAGE_COMPUTE_BIT;
57 if (stage == "ps") return VK_SHADER_STAGE_FRAGMENT_BIT;
58 if (stage == "vs") return VK_SHADER_STAGE_VERTEX_BIT;
59 if (stage == "gs") return VK_SHADER_STAGE_GEOMETRY_BIT;
60 if (stage == "ms") return VK_SHADER_STAGE_MESH_BIT_EXT;
61 return VkShaderStageFlagBits(0);
62}
63
64enum class SubgroupOutcome {
65 emulated, // --wave64-emulate: exact on any size, nothing is required
66 required, // the stage asks for `size`
67 device_fixed, // the device has one size and it is the wanted one: nothing to ask for
68 device_default, // cannot be required, but the default size is the wanted one: works, not guaranteed stable
69 unavailable, // the wanted size cannot be had: the shader runs at another size and may be inexact
70 unknown_stage, // no Vulkan stage for this entry
71 unknown_device, // the device sizes were not queried (all zero): nothing is asked for
72};
73
74struct SubgroupRequest {
75 SubgroupOutcome outcome = SubgroupOutcome::unknown_stage;
76 VkShaderStageFlagBits stage = VkShaderStageFlagBits(0);
77 std::uint32_t wanted = 0; // the size the translation assumed
78 std::uint32_t size = 0; // requiredSubgroupSize to chain; 0: chain nothing
79 VkPipelineShaderStageCreateFlags flags = 0; // REQUIRE_FULL_SUBGROUPS, compute only
80};
81
82inline bool subgroup_is_power_of_two(std::uint32_t v) { return v && !(v & (v - 1)); }
83
84// What to ask for one stage of a pipeline made from `entry`.
85// - Emulated (`wave64_exchange` present): nothing.
86// - Otherwise the wanted size is the entry's `subgroup_size`, or 64 for a wave64 entry without one and 32 for the
87// rest. VkPipelineShaderStageRequiredSubgroupSizeCreateInfo is chained when the subgroupSizeControl feature is
88// enabled, the stage is in requiredSubgroupSizeStages, the size is a power of two in [min, max] and, for
89// compute and mesh, the workgroup fits in size * maxComputeWorkgroupSubgroups
90// (VUID-VkPipelineShaderStageCreateInfo-pNext-02755 and -02756,
91// VUID-VkPipelineShaderStageRequiredSubgroupSizeCreateInfo-requiredSubgroupSize-02760..02762).
92// - A compute stage also gets VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT when computeFullSubgroups
93// is enabled and the local size X is a multiple of the size (VUID-VkPipelineShaderStageCreateInfo-flags-02785:
94// the flag needs the feature; -flags-08988: a compute, task or mesh stage; with a required size, -pNext-02757
95// wants X to be a multiple of it).
96// - A device whose one and only subgroup size (min == max) is the wanted one needs nothing (`device_fixed`).
97// - Where the size cannot be required (stage not listed, feature off) but the device default is the wanted size,
98// the shader works as it is (`device_default`): nothing guarantees it, a driver may change its default.
99// Otherwise the outcome is `unavailable`.
100inline SubgroupRequest decide_subgroup_size(const ShaderEntry& entry, const SubgroupSizeCaps& caps) {
101 SubgroupRequest r;
102 r.stage = subgroup_stage_bit(entry.stage);
103 if (!r.stage) return r;
104 if (entry.emulated()) {
105 r.outcome = SubgroupOutcome::emulated;
106 return r;
107 }
108 r.wanted = entry.subgroup_size ? entry.subgroup_size : (entry.wave64 ? 64 : 32);
109 if (!caps.default_size && !caps.max_size) {
110 r.outcome = SubgroupOutcome::unknown_device;
111 return r;
112 }
113
114 const bool compute_like = r.stage == VK_SHADER_STAGE_COMPUTE_BIT || r.stage == VK_SHADER_STAGE_MESH_BIT_EXT;
115 const std::uint64_t invocations =
116 std::uint64_t(entry.local_size[0]) * entry.local_size[1] * entry.local_size[2];
117 const bool fixed = caps.min_size && caps.min_size == caps.max_size && caps.min_size == r.wanted;
118 const bool requirable =
119 caps.subgroup_size_control && (caps.required_stages & r.stage) && subgroup_is_power_of_two(r.wanted) &&
120 r.wanted >= caps.min_size && r.wanted <= caps.max_size &&
121 (!compute_like || invocations <= std::uint64_t(r.wanted) * caps.max_compute_workgroup_subgroups);
122
123 if (fixed) {
124 r.outcome = SubgroupOutcome::device_fixed;
125 } else if (requirable) {
126 r.outcome = SubgroupOutcome::required;
127 r.size = r.wanted;
128 if (r.stage == VK_SHADER_STAGE_COMPUTE_BIT && caps.compute_full_subgroups &&
129 entry.local_size[0] % r.wanted == 0)
130 r.flags |= VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT;
131 } else if (caps.default_size == r.wanted) {
132 r.outcome = SubgroupOutcome::device_default;
133 } else {
134 r.outcome = SubgroupOutcome::unavailable;
135 }
136 return r;
137}
138
139// Puts a request into a stage create-info. `storage` holds the chained structure and must outlive the
140// vkCreate*Pipelines call. Chains in front of whatever pNext already holds.
141inline void apply_subgroup_request(const SubgroupRequest& request,
142 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo& storage,
143 VkPipelineShaderStageCreateInfo& stage) {
144 stage.flags |= request.flags;
145 if (!request.size) return;
146 storage = {VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO};
147 storage.requiredSubgroupSize = request.size;
148 storage.pNext = const_cast<void*>(stage.pNext);
149 stage.pNext = &storage;
150}
151
152} // namespace leonida
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index d4b6b00a7..e577e6af0 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -732,13 +732,16 @@ public:
732 const std::uint64_t base = replay_.heap_base; 732 const std::uint64_t base = replay_.heap_base;
733 XdxrLayout layout; 733 XdxrLayout layout;
734 layout.compute(xdxr_elements(b), b.is_tlas); 734 layout.compute(xdxr_elements(b), b.is_tlas);
735 // PERFORM_UPDATE refits the source (the destination itself when no source is given, as D3D12
736 // allows for an in-place update); a full build otherwise.
737 const std::uint64_t from = b.update ? base + (b.src_va ? b.src_va : b.dst_va) : 0;
735 if (b.is_tlas) { 738 if (b.is_tlas) {
736 xdxr_->record_tlas(cb, layout, b.instances_va ? base + b.instances_va : 0, base + b.dst_va, 739 xdxr_->record_tlas(cb, layout, b.instances_va ? base + b.instances_va : 0, base + b.dst_va,
737 base + b.scratch_va, base); 740 base + b.scratch_va, base, from);
738 } else { 741 } else {
739 std::vector<XdxrTriangles> geometries; 742 std::vector<XdxrTriangles> geometries;
740 xdxr_inputs(b, &geometries, base); 743 xdxr_inputs(b, &geometries, base);
741 xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va); 744 xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va, from);
742 } 745 }
743 }; 746 };
744 } else { 747 } else {
@@ -845,7 +848,10 @@ public:
845 query_pools_[id] = pool; 848 query_pools_[id] = pool;
846 } 849 }
847 void remove_query_pool(QueryHeapId id) { 850 void remove_query_pool(QueryHeapId id) {
851 // Lock hierarchy: resource_mutex_ -> tracker_mutex_. Holding tracker_mutex_ before erasing keeps the
852 // QueryPool node alive until any in-flight execute() that unlocked resource_mutex_ finishes QueryReplay::commit().
848 std::unique_lock lock(resource_mutex_); 853 std::unique_lock lock(resource_mutex_);
854 std::lock_guard tlock(tracker_mutex_);
849 query_pools_.erase(id); 855 query_pools_.erase(id);
850 } 856 }
851 // The heap's d3d12_query_heap type, or ~0u for a heap that is not registered. 857 // The heap's d3d12_query_heap type, or ~0u for a heap that is not registered.
@@ -1024,6 +1030,7 @@ public:
1024 1030
1025 std::uint64_t completed_retire_ticket() { 1031 std::uint64_t completed_retire_ticket() {
1026 std::lock_guard lock(submit_mutex_); 1032 std::lock_guard lock(submit_mutex_);
1033 if (is_device_lost()) return 0;
1027 return retire_tickets_.completed([this](VkSemaphore semaphore, std::uint64_t value) { 1034 return retire_tickets_.completed([this](VkSemaphore semaphore, std::uint64_t value) {
1028 std::uint64_t done = 0; 1035 std::uint64_t done = 0;
1029 return vk.vkGetSemaphoreCounterValue(device_, semaphore, &done) == VK_SUCCESS && done >= value; 1036 return vk.vkGetSemaphoreCounterValue(device_, semaphore, &done) == VK_SUCCESS && done >= value;
@@ -1220,8 +1227,12 @@ public:
1220 if (queue_) { 1227 if (queue_) {
1221 std::lock_guard lock(context_.submit_mutex()); 1228 std::lock_guard lock(context_.submit_mutex());
1222 for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_); 1229 for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_);
1223 vk.vkQueueWaitIdle(queue_); 1230 const VkResult idle_result = vk.vkQueueWaitIdle(queue_);
1224 if (progress_) context_.retire_queue_idle_locked(progress_); 1231 if (idle_result == VK_SUCCESS) {
1232 if (progress_) context_.retire_queue_idle_locked(progress_);
1233 } else {
1234 context_.mark_device_lost();
1235 }
1225 } 1236 }
1226 if (progress_) { 1237 if (progress_) {
1227 std::lock_guard lock(context_.tracker_mutex_); 1238 std::lock_guard lock(context_.tracker_mutex_);
@@ -1342,6 +1353,7 @@ public:
1342 } 1353 }
1343 const auto resolve = [this](ResourceId id) { return context_.resolve(id); }; 1354 const auto resolve = [this](ResourceId id) { return context_.resolve(id); };
1344 std::uint32_t segments = 0, statistics_segments = 0; 1355 std::uint32_t segments = 0, statistics_segments = 0;
1356 bool has_queries = false;
1345 for (std::size_t i = 0; i < lists.size(); ++i) { 1357 for (std::size_t i = 0; i < lists.size(); ++i) {
1346 const auto result = prepare(*lists[i], resolve, replay, prepared[i]); 1358 const auto result = prepare(*lists[i], resolve, replay, prepared[i]);
1347 if (result != ReplayResult::success) return result; 1359 if (result != ReplayResult::success) return result;
@@ -1350,6 +1362,7 @@ public:
1350 return ReplayResult::unsupported; 1362 return ReplayResult::unsupported;
1351 segments += prepared[i].segment_count; 1363 segments += prepared[i].segment_count;
1352 statistics_segments += prepared[i].statistics_segment_count; 1364 statistics_segments += prepared[i].statistics_segment_count;
1365 has_queries = has_queries || !prepared[i].queries.empty();
1353 } 1366 }
1354 const auto segment_pool = [this](VkQueryType type, std::uint32_t count, 1367 const auto segment_pool = [this](VkQueryType type, std::uint32_t count,
1355 std::shared_ptr<OcclusionSegmentPool>& out) { 1368 std::shared_ptr<OcclusionSegmentPool>& out) {
@@ -1371,6 +1384,10 @@ public:
1371 if (statistics_segments && can_resolve_occlusion && 1384 if (statistics_segments && can_resolve_occlusion &&
1372 !segment_pool(VK_QUERY_TYPE_PIPELINE_STATISTICS, statistics_segments, statistics)) 1385 !segment_pool(VK_QUERY_TYPE_PIPELINE_STATISTICS, statistics_segments, statistics))
1373 return ReplayResult::unsupported; 1386 return ReplayResult::unsupported;
1387 // QueryReplay::plan() reads QueryPool::ended / occlusion and QueryReplay::commit() writes them after
1388 // resource_lock is unlocked. Hold tracker_mutex_ across plan -> emit -> submit -> commit so concurrent queues
1389 // see submission-order query state and remove_query_pool() waits until commit finishes.
1390 if (has_queries && !tracker_lock.owns_lock()) tracker_lock.lock();
1374 QueryReplay queries; 1391 QueryReplay queries;
1375 std::uint32_t base = 0, statistics_base = 0; 1392 std::uint32_t base = 0, statistics_base = 0;
1376 for (auto& list : prepared) { 1393 for (auto& list : prepared) {
@@ -1595,10 +1612,12 @@ private:
1595 return false; 1612 return false;
1596 } 1613 }
1597 const bool ok = (res == VK_SUCCESS); 1614 const bool ok = (res == VK_SUCCESS);
1598 waits_.clear(); 1615 if (ok) {
1599 wait_values_.clear(); 1616 waits_.clear();
1600 for (auto& slot : buffers_) 1617 wait_values_.clear();
1601 if (slot.buffer == command_buffer) slot.ticket = ticket; 1618 for (auto& slot : buffers_)
1619 if (slot.buffer == command_buffer) slot.ticket = ticket;
1620 }
1602 return ok; 1621 return ok;
1603 } 1622 }
1604 1623
diff --git a/runtime/src/vulkan_bindless.h b/runtime/src/vulkan_bindless.h
index c599eb7c2..9111f764c 100644
--- a/runtime/src/vulkan_bindless.h
+++ b/runtime/src/vulkan_bindless.h
@@ -47,6 +47,7 @@
47#include <array> 47#include <array>
48#include <cstdint> 48#include <cstdint>
49#include <cstring> 49#include <cstring>
50#include <functional>
50#include <unordered_map> 51#include <unordered_map>
51#include <vector> 52#include <vector>
52 53
@@ -162,6 +163,35 @@ constexpr std::uint32_t r32ui_binding(ImageDimension dimension) {
162 return dimension == ImageDimension::dim_2d ? 4 : dimension == ImageDimension::dim_3d ? 7 : no_binding; 163 return dimension == ImageDimension::dim_2d ? 4 : dimension == ImageDimension::dim_3d ? 7 : no_binding;
163} 164}
164 165
166// Set 0's descriptor set layout at features' counts: what create_layout creates and what size_bindings'
167// layout_supported asks vkGetDescriptorSetLayoutSupport about. It points into itself, so it is not copied.
168struct SetLayout {
169 std::array<VkDescriptorSetLayoutBinding, binding_count> entries{};
170 std::array<VkDescriptorBindingFlags, binding_count> flags{};
171 VkDescriptorSetLayoutBindingFlagsCreateInfo flags_info{
172 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO};
173 VkDescriptorSetLayoutCreateInfo info{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO};
174
175 explicit SetLayout(const BindlessFeatures& features) {
176 std::uint32_t count = 0;
177 for (std::uint32_t b = 0; b < binding_count; ++b) {
178 if (!binding_enabled(b, features)) continue;
179 entries[count] = {b, bindings[b].type, features.counts[b], VK_SHADER_STAGE_ALL, nullptr};
180 flags[count] = (features.update_after_bind ? VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT : 0) |
181 (features.partially_bound ? VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT : 0);
182 ++count;
183 }
184 flags_info.bindingCount = count;
185 flags_info.pBindingFlags = flags.data();
186 info.pNext = &flags_info;
187 info.flags = features.update_after_bind ? VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT : 0;
188 info.bindingCount = count;
189 info.pBindings = entries.data();
190 }
191 SetLayout(const SetLayout&) = delete;
192 SetLayout& operator=(const SetLayout&) = delete;
193};
194
165// What size_bindings() grows to where the device's limits allow. At 32-64 bytes a descriptor the whole set is then 195// What size_bindings() grows to where the device's limits allow. At 32-64 bytes a descriptor the whole set is then
166// 3-6 MiB (93793 descriptors on an RTX 5070). 196// 3-6 MiB (93793 descriptors on an RTX 5070).
167inline constexpr std::uint32_t max_2d_images = 65536; 197inline constexpr std::uint32_t max_2d_images = 65536;
@@ -183,10 +213,14 @@ inline constexpr std::uint32_t growth_headroom = 64;
183// what is sure to work (vkGetDescriptorSetLayoutSupport may allow more), so it never shrinks step 1. 213// what is sure to work (vkGetDescriptorSetLayoutSupport may allow more), so it never shrinks step 1.
184// A storage array holds the smaller of the storage count and its dimension's images: add_image never gives a 214// A storage array holds the smaller of the storage count and its dimension's images: add_image never gives a
185// storage view an index past the sampled array. The other bindings keep their default counts. 215// storage view an index past the sampled array. The other bindings keep their default counts.
216// layout_supported, when given, answers vkGetDescriptorSetLayoutSupport for set 0 at the counts in its argument:
217// step 3 then also grows past maxPerSetDescriptors where the device says the layout works (Intel's Xe-LP reports
218// 6159 and supports the full sizes, D3D-219). It is asked only once the sum is above maxPerSetDescriptors.
186// Sets features.counts; returns false when a count is below its default because the device's limits are. 219// Sets features.counts; returns false when a count is below its default because the device's limits are.
187inline bool size_bindings(BindlessFeatures& features, const VkPhysicalDeviceLimits& limits, 220inline bool size_bindings(BindlessFeatures& features, const VkPhysicalDeviceLimits& limits,
188 const VkPhysicalDeviceVulkan11Properties& v11, 221 const VkPhysicalDeviceVulkan11Properties& v11,
189 const VkPhysicalDeviceVulkan12Properties& v12) { 222 const VkPhysicalDeviceVulkan12Properties& v12,
223 const std::function<bool(const BindlessFeatures&)>& layout_supported = {}) {
190 const bool uab = features.update_after_bind; 224 const bool uab = features.update_after_bind;
191 const std::uint32_t sampled_limit = 225 const std::uint32_t sampled_limit =
192 uab ? std::min(v12.maxPerStageDescriptorUpdateAfterBindSampledImages, 226 uab ? std::min(v12.maxPerStageDescriptorUpdateAfterBindSampledImages,
@@ -233,7 +267,8 @@ inline bool size_bindings(BindlessFeatures& features, const VkPhysicalDeviceLimi
233 const auto within = [&](std::uint64_t n, std::uint32_t limit) { return n + headroom <= limit; }; 267 const auto within = [&](std::uint64_t n, std::uint32_t limit) { return n + headroom <= limit; };
234 const std::uint64_t all = sampled + sampler + stored + buffers; 268 const std::uint64_t all = sampled + sampler + stored + buffers;
235 return within(sampled, sampled_limit) && within(sampler, sampler_limit) && within(stored, storage_limit) && 269 return within(sampled, sampled_limit) && within(sampler, sampler_limit) && within(stored, storage_limit) &&
236 within(sampled + stored + buffers, resource_limit) && all <= pool_limit && all <= set_limit; 270 within(sampled + stored + buffers, resource_limit) && all <= pool_limit &&
271 (all <= set_limit || (layout_supported && layout_supported(features)));
237 }; 272 };
238 // Raises n to the largest value up to `high` that fits; leaves it where it is when none does. 273 // Raises n to the largest value up to `high` that fits; leaves it where it is when none does.
239 const auto grow = [&](std::uint32_t& n, std::uint32_t high, std::uint32_t headroom, std::uint64_t set_limit) { 274 const auto grow = [&](std::uint32_t& n, std::uint32_t high, std::uint32_t headroom, std::uint64_t set_limit) {
@@ -532,27 +567,12 @@ private:
532 } 567 }
533 568
534 bool create_layout() { 569 bool create_layout() {
535 std::array<VkDescriptorSetLayoutBinding, bindless::bindings.size()> entries{}; 570 const bindless::SetLayout layout(features_);
536 std::array<VkDescriptorBindingFlags, bindless::bindings.size()> flags{}; 571 const std::uint32_t count = layout.info.bindingCount;
537 std::array<VkDescriptorPoolSize, bindless::bindings.size()> sizes{}; 572 std::array<VkDescriptorPoolSize, bindless::bindings.size()> sizes{};
538 std::uint32_t count = 0; 573 for (std::uint32_t i = 0; i < count; ++i)
539 for (std::uint32_t b = 0; b < bindless::bindings.size(); ++b) { 574 sizes[i] = {layout.entries[i].descriptorType, layout.entries[i].descriptorCount};
540 if (!bindless::binding_enabled(b, features_)) continue; 575 if (vk_.vkCreateDescriptorSetLayout(device_, &layout.info, nullptr, &layout_) != VK_SUCCESS) return false;
541 entries[count] = {b, bindless::bindings[b].type, features_.counts[b], VK_SHADER_STAGE_ALL, nullptr};
542 flags[count] = (features_.update_after_bind ? VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT : 0) |
543 (features_.partially_bound ? VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT : 0);
544 sizes[count] = {bindless::bindings[b].type, features_.counts[b]};
545 ++count;
546 }
547 VkDescriptorSetLayoutBindingFlagsCreateInfo flags_info{
548 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO};
549 flags_info.bindingCount = count;
550 flags_info.pBindingFlags = flags.data();
551 VkDescriptorSetLayoutCreateInfo layout_info{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, &flags_info};
552 layout_info.flags = features_.update_after_bind ? VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT : 0;
553 layout_info.bindingCount = count;
554 layout_info.pBindings = entries.data();
555 if (vk_.vkCreateDescriptorSetLayout(device_, &layout_info, nullptr, &layout_) != VK_SUCCESS) return false;
556 576
557 VkDescriptorPoolCreateInfo pool_info{VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO}; 577 VkDescriptorPoolCreateInfo pool_info{VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO};
558 pool_info.flags = features_.update_after_bind ? VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT : 0; 578 pool_info.flags = features_.update_after_bind ? VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT : 0;
diff --git a/runtime/src/vulkan_depth24.h b/runtime/src/vulkan_depth24.h
index 1bc9c8ba5..988b79d9f 100644
--- a/runtime/src/vulkan_depth24.h
+++ b/runtime/src/vulkan_depth24.h
@@ -143,11 +143,14 @@ public:
143 // Frees (or keeps for reuse) what finished submissions used. 143 // Frees (or keeps for reuse) what finished submissions used.
144 void collect() { 144 void collect() {
145 for (std::size_t i = 0; i < retired_.size();) { 145 for (std::size_t i = 0; i < retired_.size();) {
146 std::uint64_t done = 0; 146 if (retired_[i].ticket != 0) {
147 vk_.vkGetSemaphoreCounterValue(device_, retired_[i].timeline, &done); 147 std::uint64_t done = 0;
148 if (done < retired_[i].ticket) { 148 if (!retired_[i].timeline ||
149 ++i; 149 vk_.vkGetSemaphoreCounterValue(device_, retired_[i].timeline, &done) != VK_SUCCESS ||
150 continue; 150 done < retired_[i].ticket) {
151 ++i;
152 continue;
153 }
151 } 154 }
152 for (auto& chunk : retired_[i].chunks) { 155 for (auto& chunk : retired_[i].chunks) {
153 chunk.used = 0; 156 chunk.used = 0;
diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h
index 5d59a301f..d9f53baa5 100644
--- a/runtime/src/vulkan_present.h
+++ b/runtime/src/vulkan_present.h
@@ -35,7 +35,6 @@
35#include <cstring> 35#include <cstring>
36#include <functional> 36#include <functional>
37#include <map> 37#include <map>
38#include <optional>
39#include <vector> 38#include <vector>
40 39
41namespace leonida { 40namespace leonida {
@@ -75,9 +74,10 @@ class VulkanPresenter {
75public: 74public:
76 VulkanPresenter(VulkanContext& context, PFN_vkGetInstanceProcAddr get_instance, VkInstance instance, 75 VulkanPresenter(VulkanContext& context, PFN_vkGetInstanceProcAddr get_instance, VkInstance instance,
77 VkPhysicalDevice physical, VkQueue queue, std::uint32_t family, VkSurfaceKHR surface, 76 VkPhysicalDevice physical, VkQueue queue, std::uint32_t family, VkSurfaceKHR surface,
78 bool swapchain_maintenance1 = false) 77 bool swapchain_maintenance1 = false,
78 std::function<VkExtent2D()> extent_fn = nullptr)
79 : context_(context), instance_(instance), physical_(physical), queue_(queue), surface_(surface), 79 : context_(context), instance_(instance), physical_(physical), queue_(queue), surface_(surface),
80 maintenance1_(swapchain_maintenance1) { 80 maintenance1_(swapchain_maintenance1), extent_fn_(std::move(extent_fn)) {
81#define LEONIDA_INSTANCE_FN(name) name##_ = reinterpret_cast<PFN_##name>(get_instance(instance, #name)); 81#define LEONIDA_INSTANCE_FN(name) name##_ = reinterpret_cast<PFN_##name>(get_instance(instance, #name));
82 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceSupportKHR) 82 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceSupportKHR)
83 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) 83 LEONIDA_INSTANCE_FN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
@@ -270,25 +270,34 @@ public:
270 270
271 bool recorded = false; 271 bool recorded = false;
272 std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock); 272 std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock);
273 std::optional<LayoutTracker> next_tracker; 273 bool rollback_source = false;
274 VkImageLayout prev_layout = VK_IMAGE_LAYOUT_UNDEFINED;
274 if (binding) { 275 if (binding) {
275 // Lock hierarchy: resource_mutex_ -> tracker_mutex_ -> submit_mutex_ (vulkan_backend.h). 276 // Lock hierarchy: resource_mutex_ -> tracker_mutex_ -> submit_mutex_ (vulkan_backend.h).
276 // Release resource_mutex_ before vkQueueSubmit while keeping tracker_mutex_ held so layout updates 277 // record() only touches subresource 0 (mip 0, layer 0, color) of `source`, so saving that one layout
277 // commit in submission order and roll back if vkQueueSubmit fails. 278 // rolls back a failed submit in O(1) without copying the entire LayoutTracker map.
278 std::shared_lock resource_lock(context_.resource_mutex_); 279 std::shared_lock resource_lock(context_.resource_mutex_);
279 const ResourceBinding* current = context_.resolve(source); 280 const ResourceBinding* current = context_.resolve(source);
280 if (current && current->image && current->aspects == VK_IMAGE_ASPECT_COLOR_BIT) { 281 if (current && current->image && current->aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
281 tracker_lock.lock(); 282 tracker_lock.lock();
282 next_tracker.emplace(context_.tracker_); 283 rollback_source = context_.tracker_.tracked(source);
283 record(frame.commands, *current, source, image, source_rect, *next_tracker); 284 if (rollback_source) prev_layout = context_.tracker_.layout(source, 0);
285 record(frame.commands, *current, source, image, source_rect);
284 recorded = true; 286 recorded = true;
285 } 287 }
286 } else { 288 } else {
287 record_blank(frame.commands, image); 289 record_blank(frame.commands, image);
288 recorded = true; 290 recorded = true;
289 } 291 }
292 const auto rollback = [&] {
293 if (rollback_source)
294 context_.tracker_.set(source, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, prev_layout);
295 };
290 if (!recorded) return give_back(frame, VK_ERROR_UNKNOWN); // released by another thread since presentable() 296 if (!recorded) return give_back(frame, VK_ERROR_UNKNOWN); // released by another thread since presentable()
291 if (const VkResult reset = vkResetFences_(device, 1, &frame.done); reset != VK_SUCCESS) return stop(reset); 297 if (const VkResult reset = vkResetFences_(device, 1, &frame.done); reset != VK_SUCCESS) {
298 rollback();
299 return stop(reset);
300 }
292 const VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TRANSFER_BIT; 301 const VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
293 VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO}; 302 VkSubmitInfo submit_info{VK_STRUCTURE_TYPE_SUBMIT_INFO};
294 submit_info.waitSemaphoreCount = 1; 303 submit_info.waitSemaphoreCount = 1;
@@ -321,10 +330,12 @@ public:
321 { 330 {
322 std::lock_guard lock(context_.submit_mutex()); 331 std::lock_guard lock(context_.submit_mutex());
323 submitted = vk.vkQueueSubmit(queue_, 1, &submit_info, frame.done); 332 submitted = vk.vkQueueSubmit(queue_, 1, &submit_info, frame.done);
333 if (submitted != VK_SUCCESS) rollback();
334 // Commit/rollback happened before releasing tracker_mutex_ inside submit_mutex(), preserving submission
335 // order without holding tracker_mutex_ across vkQueuePresentKHR.
336 if (tracker_lock.owns_lock()) tracker_lock.unlock();
324 if (submitted == VK_SUCCESS) result = vkQueuePresentKHR_(queue_, &present); 337 if (submitted == VK_SUCCESS) result = vkQueuePresentKHR_(queue_, &present);
325 } 338 }
326 if (submitted == VK_SUCCESS && next_tracker) context_.tracker_ = std::move(*next_tracker);
327 if (tracker_lock.owns_lock()) tracker_lock.unlock();
328 if (submitted != VK_SUCCESS) return give_back(frame, submitted); 339 if (submitted != VK_SUCCESS) return give_back(frame, submitted);
329 ++frame_index_; 340 ++frame_index_;
330 // Only a present the engine took counts (SUBOPTIMAL is shown too). OUT_OF_DATE was not shown: the swapchain 341 // Only a present the engine took counts (SUBOPTIMAL is shown too). OUT_OF_DATE was not shown: the swapchain
@@ -400,7 +411,7 @@ private:
400 } 411 }
401 412
402 void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image, 413 void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image,
403 const PresentRect* source_rect, LayoutTracker& tracker) { 414 const PresentRect* source_rect) {
404 auto& vk = context_.vk; 415 auto& vk = context_.vk;
405 const ReplayFunctions& fn = context_.replay_; 416 const ReplayFunctions& fn = context_.replay_;
406 vk.vkResetCommandBuffer(commands, 0); 417 vk.vkResetCommandBuffer(commands, 0);
@@ -413,8 +424,8 @@ private:
413 // PRESENT is D3D12's common state: GENERAL for an ordinary texture. A never-written back buffer is 424 // PRESENT is D3D12's common state: GENERAL for an ordinary texture. A never-written back buffer is
414 // zero-filled first, as any committed resource is. 425 // zero-filled first, as any committed resource is.
415 const VkImageLayout common = image_layout(binding, VK_IMAGE_LAYOUT_GENERAL); 426 const VkImageLayout common = image_layout(binding, VK_IMAGE_LAYOUT_GENERAL);
416 auto pieces = detail::current(&tracker, source, range, common); 427 auto pieces = detail::current(&context_.tracker_, source, range, common);
417 detail::initialize(fn, commands, binding, source, pieces, common, &tracker); 428 detail::initialize(fn, commands, binding, source, pieces, common, &context_.tracker_);
418 for (const auto& piece : pieces) 429 for (const auto& piece : pieces)
419 detail::image_barrier(fn, commands, binding, piece.range, piece.layout, 430 detail::image_barrier(fn, commands, binding, piece.range, piece.layout,
420 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_MEMORY_WRITE_BIT, 431 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_MEMORY_WRITE_BIT,
@@ -595,7 +606,21 @@ private:
595 tear_mode_ = VK_PRESENT_MODE_MAX_ENUM_KHR; 606 tear_mode_ = VK_PRESENT_MODE_MAX_ENUM_KHR;
596 VkSurfaceCapabilitiesKHR caps{}; 607 VkSurfaceCapabilitiesKHR caps{};
597 if (vkGetPhysicalDeviceSurfaceCapabilitiesKHR_(physical_, surface_, &caps) != VK_SUCCESS) return false; 608 if (vkGetPhysicalDeviceSurfaceCapabilitiesKHR_(physical_, surface_, &caps) != VK_SUCCESS) return false;
598 if (caps.currentExtent.width == 0 || caps.currentExtent.height == 0) { 609 VkExtent2D extent = caps.currentExtent;
610 // When the platform leaves the swapchain extent to the application (0xFFFFFFFF, as on Intel UHD / Win32 WSI),
611 // query the window client area or fall back to the last known extent, and clamp to the surface bounds (D3D-165).
612 if (extent.width == 0xFFFFFFFF || extent.height == 0xFFFFFFFF) {
613 if (extent_fn_) extent = extent_fn_();
614 // ponytail: if no window extent function was supplied, fall back to last extent_ or minImageExtent
615 if (extent.width == 0xFFFFFFFF || extent.height == 0xFFFFFFFF || (extent.width == 0 && extent.height == 0)) {
616 extent = extent_.width && extent_.height ? extent_ : caps.minImageExtent;
617 }
618 if (extent.width && extent.height) {
619 extent.width = std::clamp(extent.width, caps.minImageExtent.width, caps.maxImageExtent.width);
620 extent.height = std::clamp(extent.height, caps.minImageExtent.height, caps.maxImageExtent.height);
621 }
622 }
623 if (extent.width == 0 || extent.height == 0) {
599 release(swapchain_); 624 release(swapchain_);
600 swapchain_ = VK_NULL_HANDLE; 625 swapchain_ = VK_NULL_HANDLE;
601 vsync_ = vsync; 626 vsync_ = vsync;
@@ -659,7 +684,7 @@ private:
659 if (caps.maxImageCount) info.minImageCount = std::min(info.minImageCount, caps.maxImageCount); 684 if (caps.maxImageCount) info.minImageCount = std::min(info.minImageCount, caps.maxImageCount);
660 info.imageFormat = chosen.format; 685 info.imageFormat = chosen.format;
661 info.imageColorSpace = chosen.colorSpace; 686 info.imageColorSpace = chosen.colorSpace;
662 info.imageExtent = caps.currentExtent; 687 info.imageExtent = extent;
663 info.imageArrayLayers = 1; 688 info.imageArrayLayers = 1;
664 info.imageUsage = usage; 689 info.imageUsage = usage;
665 info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; 690 info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
@@ -713,7 +738,7 @@ private:
713 images_ = std::move(images); 738 images_ = std::move(images);
714 ready_ = std::move(ready); 739 ready_ = std::move(ready);
715 format_ = chosen.format; 740 format_ = chosen.format;
716 extent_ = caps.currentExtent; 741 extent_ = extent;
717 if (capture_) { 742 if (capture_) {
718 // A capture that cannot be made fails the recreation with the swapchain in place and stale_ still set. 743 // A capture that cannot be made fails the recreation with the swapchain in place and stale_ still set.
719 const bool four_bytes = format_ == VK_FORMAT_B8G8R8A8_UNORM || format_ == VK_FORMAT_R8G8B8A8_UNORM || 744 const bool four_bytes = format_ == VK_FORMAT_B8G8R8A8_UNORM || format_ == VK_FORMAT_R8G8B8A8_UNORM ||
@@ -812,6 +837,7 @@ private:
812 bool ok_ = false; 837 bool ok_ = false;
813 bool swapchain_srgb_ = false; // the swapchain format follows the source being presented (set once it exists) 838 bool swapchain_srgb_ = false; // the swapchain format follows the source being presented (set once it exists)
814 std::function<bool()> abort_; 839 std::function<bool()> abort_;
840 std::function<VkExtent2D()> extent_fn_;
815 std::map<VkFormat, VkFormatFeatureFlags> features_; 841 std::map<VkFormat, VkFormatFeatureFlags> features_;
816 bool warned_srgb_ = false; 842 bool warned_srgb_ = false;
817 bool capture_ = false; 843 bool capture_ = false;
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h
index 89fe7381d..0b46198a9 100644
--- a/runtime/src/vulkan_replay.h
+++ b/runtime/src/vulkan_replay.h
@@ -1058,20 +1058,180 @@ inline std::vector<LayoutPiece> current(const LayoutTracker* tracker, ResourceId
1058 return out; 1058 return out;
1059} 1059}
1060 1060
1061// Zero-fills a block-compressed image range via vkCmdCopyBufferToImage from either the device's zero page
1062// (`vk.zero_buffer`) or a zeroed transfer-scratch chunk (`vk.copy_scratch` + `vk.fill_buffer`). Vulkan forbids
1063// vkCmdClearColorImage on BC formats, yet D3D12 committed resources start zeroed unless CREATE_NOT_ZEROED is set
1064// (D3D-220).
1065inline bool zero_compressed_image(const ReplayFunctions& vk, VkCommandBuffer command_buffer,
1066 const ResourceBinding& resource, const VkImageSubresourceRange& range,
1067 VkImageLayout dst_layout) {
1068 const BlockFormat fmt = block_format(resource.format, VK_IMAGE_ASPECT_COLOR_BIT);
1069 if (fmt.block <= 1 || !fmt.bytes || !vk.copy_buffer_to_image) return false;
1070 const std::uint32_t mip_begin = range.baseMipLevel;
1071 const std::uint32_t mip_end =
1072 range.levelCount == VK_REMAINING_MIP_LEVELS ? resource.mip_levels
1073 : std::min(resource.mip_levels, mip_begin + range.levelCount);
1074 const std::uint32_t layer_begin = range.baseArrayLayer;
1075 const std::uint32_t layer_end =
1076 range.layerCount == VK_REMAINING_ARRAY_LAYERS ? resource.array_layers
1077 : std::min(resource.array_layers, layer_begin + range.layerCount);
1078 if (mip_begin >= mip_end || layer_begin >= layer_end) return true;
1079
1080 constexpr VkDeviceSize kMaxChunk = 64u * 1024u;
1081 const std::uint32_t layer_count = layer_end - layer_begin;
1082 VkDeviceSize needed = 0;
1083 for (std::uint32_t mip = mip_begin; mip < mip_end; ++mip) {
1084 const VkExtent2D ext = mip_extent(resource, mip);
1085 const std::uint64_t bx = (std::uint64_t(ext.width) + fmt.block - 1) / fmt.block;
1086 const std::uint64_t by = (std::uint64_t(ext.height) + fmt.block - 1) / fmt.block;
1087 const std::uint64_t mip_d = std::max(1u, resource.depth >> mip);
1088 const std::uint64_t slice_bytes = bx * by * fmt.bytes;
1089 if (slice_bytes >= kMaxChunk || mip_d > kMaxChunk / slice_bytes ||
1090 layer_count > kMaxChunk / (slice_bytes * mip_d)) {
1091 needed = kMaxChunk;
1092 break;
1093 }
1094 needed = std::max<VkDeviceSize>(needed, slice_bytes * mip_d * layer_count);
1095 }
1096 if (!needed) return true;
1097
1098 VkBuffer zero_buf = VK_NULL_HANDLE;
1099 VkDeviceSize zero_off = 0;
1100 VkDeviceSize zero_cap = 0;
1101 if (vk.zero_buffer && vk.zero_size >= fmt.bytes) {
1102 const VkDeviceSize align = fmt.bytes;
1103 const VkDeviceSize pad = (align - (vk.zero_offset % align)) % align;
1104 if (vk.zero_size >= pad + fmt.bytes) {
1105 zero_buf = vk.zero_buffer;
1106 zero_off = vk.zero_offset + pad;
1107 zero_cap = vk.zero_size - pad;
1108 }
1109 }
1110 if (!zero_buf && vk.copy_scratch && vk.fill_buffer) {
1111 // Round up to a multiple of fmt.bytes (8 or 16, always a multiple of 4 for vkCmdFillBuffer).
1112 const VkDeviceSize fill_bytes = ((needed + fmt.bytes - 1) / fmt.bytes) * fmt.bytes;
1113 VkBuffer scratch = VK_NULL_HANDLE;
1114 VkDeviceSize offset = 0;
1115 if (vk.copy_scratch(fill_bytes, scratch, offset)) {
1116 const VkDeviceSize align = fmt.bytes;
1117 const VkDeviceSize pad = (align - (offset % align)) % align;
1118 if (fill_bytes >= pad + fmt.bytes) {
1119 vk.fill_buffer(command_buffer, scratch, offset + pad, fill_bytes - pad, 0);
1120 memory_barrier(vk, command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
1121 VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
1122 zero_buf = scratch;
1123 zero_off = offset + pad;
1124 zero_cap = fill_bytes - pad;
1125 }
1126 }
1127 }
1128 if (!zero_buf || zero_cap < fmt.bytes) return false;
1129
1130 std::vector<VkBufferImageCopy> regions;
1131 for (std::uint32_t mip = mip_begin; mip < mip_end; ++mip) {
1132 const VkExtent2D ext = mip_extent(resource, mip);
1133 const std::uint32_t mip_d = std::max(1u, resource.depth >> mip);
1134 const std::uint64_t bx_total = (std::uint64_t(ext.width) + fmt.block - 1) / fmt.block;
1135 const std::uint64_t by_total = (std::uint64_t(ext.height) + fmt.block - 1) / fmt.block;
1136 const std::uint64_t slice_bytes = bx_total * by_total * fmt.bytes;
1137 if (slice_bytes && slice_bytes <= zero_cap && mip_d <= zero_cap / slice_bytes &&
1138 layer_count <= zero_cap / (slice_bytes * mip_d)) {
1139 VkBufferImageCopy r{};
1140 r.bufferOffset = zero_off;
1141 r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, mip, layer_begin, layer_count};
1142 r.imageExtent = {ext.width, ext.height, mip_d};
1143 regions.push_back(r);
1144 continue;
1145 }
1146 const std::uint64_t row_bytes = bx_total * fmt.bytes;
1147 for (std::uint32_t layer = layer_begin; layer < layer_end; ++layer) {
1148 if (slice_bytes <= zero_cap) {
1149 const std::uint32_t slices_per_copy =
1150 std::max<std::uint32_t>(1u, std::uint32_t(std::min<std::uint64_t>(mip_d, zero_cap / slice_bytes)));
1151 for (std::uint32_t z = 0; z < mip_d; z += slices_per_copy) {
1152 VkBufferImageCopy r{};
1153 r.bufferOffset = zero_off;
1154 r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, mip, layer, 1};
1155 r.imageOffset = {0, 0, std::int32_t(z)};
1156 r.imageExtent = {ext.width, ext.height, std::min(slices_per_copy, mip_d - z)};
1157 regions.push_back(r);
1158 }
1159 } else if (row_bytes <= zero_cap) {
1160 const std::uint32_t rows_per_copy =
1161 std::max<std::uint32_t>(1u, std::uint32_t(std::min<std::uint64_t>(by_total, zero_cap / row_bytes)));
1162 for (std::uint32_t z = 0; z < mip_d; ++z) {
1163 for (std::uint64_t y_blk = 0; y_blk < by_total; y_blk += rows_per_copy) {
1164 const std::uint32_t oy = std::uint32_t(y_blk * fmt.block);
1165 const std::uint32_t eh = std::min<std::uint32_t>(rows_per_copy * fmt.block, ext.height - oy);
1166 VkBufferImageCopy r{};
1167 r.bufferOffset = zero_off;
1168 r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, mip, layer, 1};
1169 r.imageOffset = {0, std::int32_t(oy), std::int32_t(z)};
1170 r.imageExtent = {ext.width, eh, 1};
1171 regions.push_back(r);
1172 }
1173 }
1174 } else {
1175 const std::uint32_t cols_per_copy =
1176 std::max<std::uint32_t>(1u, std::uint32_t(std::min<std::uint64_t>(bx_total, zero_cap / fmt.bytes)));
1177 for (std::uint32_t z = 0; z < mip_d; ++z) {
1178 for (std::uint64_t y_blk = 0; y_blk < by_total; ++y_blk) {
1179 const std::uint32_t oy = std::uint32_t(y_blk * fmt.block);
1180 const std::uint32_t eh = std::min<std::uint32_t>(fmt.block, ext.height - oy);
1181 for (std::uint64_t x_blk = 0; x_blk < bx_total; x_blk += cols_per_copy) {
1182 const std::uint32_t ox = std::uint32_t(x_blk * fmt.block);
1183 const std::uint32_t ew =
1184 std::min<std::uint32_t>(cols_per_copy * fmt.block, ext.width - ox);
1185 VkBufferImageCopy r{};
1186 r.bufferOffset = zero_off;
1187 r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, mip, layer, 1};
1188 r.imageOffset = {std::int32_t(ox), std::int32_t(oy), std::int32_t(z)};
1189 r.imageExtent = {ew, eh, 1};
1190 regions.push_back(r);
1191 }
1192 }
1193 }
1194 }
1195 }
1196 }
1197 if (!regions.empty())
1198 vk.copy_buffer_to_image(command_buffer, zero_buf, resource.image, dst_layout,
1199 std::uint32_t(regions.size()), regions.data());
1200 return true;
1201}
1202
1061// Images registered with the tracker in UNDEFINED have never been used. D3D12 committed resources start zeroed, 1203// Images registered with the tracker in UNDEFINED have never been used. D3D12 committed resources start zeroed,
1062// so each such piece is cleared to zero (colour 0, depth 0, stencil 0) and moved to `layout`, the layout the 1204// so each such piece is zero-filled (clear for uncompressed images, zero-buffer copy for block-compressed formats
1063// operation about to run expects, before that operation; with not_zeroed, or a block-compressed format (which 1205// when a zero page or transfer scratch is available) and moved to `layout`, the layout the operation about to run
1064// Vulkan cannot clear), it is only moved. The tracker records it. 1206// expects; with not_zeroed, it is only moved. The tracker records it.
1065inline void initialize(const ReplayFunctions& vk, VkCommandBuffer command_buffer, const ResourceBinding& resource, 1207inline void initialize(const ReplayFunctions& vk, VkCommandBuffer command_buffer, const ResourceBinding& resource,
1066 ResourceId id, std::vector<LayoutPiece>& pieces, VkImageLayout layout, LayoutTracker* tracker) { 1208 ResourceId id, std::vector<LayoutPiece>& pieces, VkImageLayout layout, LayoutTracker* tracker) {
1067 constexpr VkAccessFlags any_memory = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; 1209 constexpr VkAccessFlags any_memory = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
1068 for (auto& piece : pieces) { 1210 for (auto& piece : pieces) {
1069 if (piece.layout != VK_IMAGE_LAYOUT_UNDEFINED) continue; 1211 if (piece.layout != VK_IMAGE_LAYOUT_UNDEFINED) continue;
1070 // Vulkan cannot clear block-compressed images; those start undefined (applications upload them first). 1212 const BlockFormat fmt = block_format(resource.format, VK_IMAGE_ASPECT_COLOR_BIT);
1071 const bool compressed = block_format(resource.format, VK_IMAGE_ASPECT_COLOR_BIT).block > 1; 1213 const bool compressed = fmt.block > 1;
1072 if (resource.not_zeroed || compressed) { 1214 if (resource.not_zeroed) {
1073 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, layout, 0, 1215 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, layout, 0,
1074 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, any_memory, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT); 1216 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, any_memory, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
1217 } else if (compressed) {
1218 const bool can_zero =
1219 vk.copy_buffer_to_image &&
1220 ((vk.zero_buffer && vk.zero_size >= fmt.bytes) || (vk.copy_scratch && vk.fill_buffer));
1221 if (can_zero) {
1222 const VkImageLayout dst = image_layout(resource, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
1223 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, dst, 0,
1224 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
1225 VK_PIPELINE_STAGE_TRANSFER_BIT);
1226 const bool zeroed = zero_compressed_image(vk, command_buffer, resource, piece.range, dst);
1227 image_barrier(vk, command_buffer, resource, piece.range, dst, layout,
1228 zeroed ? VK_ACCESS_TRANSFER_WRITE_BIT : 0,
1229 zeroed ? VK_PIPELINE_STAGE_TRANSFER_BIT : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, any_memory,
1230 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
1231 } else {
1232 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, layout, 0,
1233 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, any_memory, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
1234 }
1075 } else { 1235 } else {
1076 const VkImageLayout dst = image_layout(resource, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); 1236 const VkImageLayout dst = image_layout(resource, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
1077 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, dst, 0, 1237 image_barrier(vk, command_buffer, resource, piece.range, VK_IMAGE_LAYOUT_UNDEFINED, dst, 0,
@@ -2007,8 +2167,15 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun
2007 // A depth plane footprint of a D24 texture stored as D32: words of 24-bit UNORM, floats in the image. 2167 // A depth plane footprint of a D24 texture stored as D32: words of 24-bit UNORM, floats in the image.
2008 const bool upload = texture_copy->src.footprint; 2168 const bool upload = texture_copy->src.footprint;
2009 const ResourceBinding& image = upload ? p.binding : p.source; 2169 const ResourceBinding& image = upload ? p.binding : p.source;
2010 if (result == ReplayResult::success && image.depth24_as_float && !p.buffer_image_copies.empty() && 2170 const bool depth24_footprint = result == ReplayResult::success && image.depth24_as_float &&
2011 p.buffer_image_copies[0].imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) { 2171 !p.buffer_image_copies.empty() &&
2172 p.buffer_image_copies[0].imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT;
2173 const bool rgb96_footprint = result == ReplayResult::success && image.rgb96 &&
2174 !p.buffer_image_copies.empty();
2175 // These footprint conversions emit compute dispatches in emit(). Refuse them before allocating their
2176 // conversion scratch/descriptors because an active statistics query would include their CSInvocations.
2177 if (statistics_active && (depth24_footprint || rgb96_footprint)) return ReplayResult::unsupported;
2178 if (depth24_footprint) {
2012 const VkBufferImageCopy& region = p.buffer_image_copies[0]; 2179 const VkBufferImageCopy& region = p.buffer_image_copies[0];
2013 const ResourceBinding& buffer = upload ? p.source : p.binding; 2180 const ResourceBinding& buffer = upload ? p.source : p.binding;
2014 Depth24Job& job = p.depth24; 2181 Depth24Job& job = p.depth24;
@@ -2023,7 +2190,7 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun
2023 job.app_slice_words = job.app_row_words * (region.bufferImageHeight ? region.bufferImageHeight : job.height); 2190 job.app_slice_words = job.app_row_words * (region.bufferImageHeight ? region.bufferImageHeight : job.height);
2024 if (!vk.depth24_prepare || !vk.depth24_run || !vk.depth24_prepare(job, p.depth24_parts)) return ReplayResult::unsupported; 2191 if (!vk.depth24_prepare || !vk.depth24_run || !vk.depth24_prepare(job, p.depth24_parts)) return ReplayResult::unsupported;
2025 p.has_depth24 = true; 2192 p.has_depth24 = true;
2026 } else if (result == ReplayResult::success && image.rgb96 && !p.buffer_image_copies.empty()) { 2193 } else if (rgb96_footprint) {
2027 // A footprint of a 96-bit texture: 12-byte texels, 16 in the image. The same pass and scratch. 2194 // A footprint of a 96-bit texture: 12-byte texels, 16 in the image. The same pass and scratch.
2028 const VkBufferImageCopy& region = p.buffer_image_copies[0]; 2195 const VkBufferImageCopy& region = p.buffer_image_copies[0];
2029 const ResourceBinding& buffer = upload ? p.source : p.binding; 2196 const ResourceBinding& buffer = upload ? p.source : p.binding;
@@ -2041,9 +2208,6 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun
2041 if (!vk.depth24_prepare || !vk.depth24_run || !vk.depth24_prepare(job, p.depth24_parts)) return ReplayResult::unsupported; 2208 if (!vk.depth24_prepare || !vk.depth24_run || !vk.depth24_prepare(job, p.depth24_parts)) return ReplayResult::unsupported;
2042 p.has_depth24 = true; 2209 p.has_depth24 = true;
2043 } 2210 }
2044 // These footprint conversions emit compute dispatches in emit(). Until pipeline-statistics
2045 // segmentation can bracket arbitrary helper dispatches, don't let them inflate CSInvocations.
2046 if (p.has_depth24 && statistics_active) return ReplayResult::unsupported;
2047 } else { 2211 } else {
2048 result = detail::prepare_resource_copy(p); 2212 result = detail::prepare_resource_copy(p);
2049 } 2213 }
@@ -2955,8 +3119,9 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c
2955 } 3119 }
2956 } 3120 }
2957 } 3121 }
2958 } else if (const auto* build = std::get_if<BuildAccelerationStructure>(&command); build && vk.xdxr_record) { 3122 } else if (const auto* xdxr_build = std::get_if<BuildAccelerationStructure>(&command);
2959 vk.xdxr_record(command_buffer, *build); 3123 xdxr_build && vk.xdxr_record) {
3124 vk.xdxr_record(command_buffer, *xdxr_build);
2960 } else if (const auto* build = std::get_if<BuildAccelerationStructure>(&command)) { 3125 } else if (const auto* build = std::get_if<BuildAccelerationStructure>(&command)) {
2961 // The build's addresses are console VAs into the GPU address arena (heap_base is its device address). 3126 // The build's addresses are console VAs into the GPU address arena (heap_base is its device address).
2962 // A null VA (no index buffer, no transform) stays null: heap_base + 0 would name the arena's zero page. 3127 // A null VA (no index buffer, no transform) stays null: heap_base + 0 would name the arena's zero page.
diff --git a/runtime/src/vulkan_scratch.h b/runtime/src/vulkan_scratch.h
index fe29d1a5c..4a8a59ddd 100644
--- a/runtime/src/vulkan_scratch.h
+++ b/runtime/src/vulkan_scratch.h
@@ -94,11 +94,14 @@ public:
94 // Keeps for reuse (or frees) the chunks of finished submissions. 94 // Keeps for reuse (or frees) the chunks of finished submissions.
95 void collect() { 95 void collect() {
96 for (std::size_t i = 0; i < retired_.size();) { 96 for (std::size_t i = 0; i < retired_.size();) {
97 std::uint64_t done = 0; 97 if (retired_[i].ticket != 0) {
98 if (retired_[i].timeline) vk_.vkGetSemaphoreCounterValue(device_, retired_[i].timeline, &done); 98 std::uint64_t done = 0;
99 if (done < retired_[i].ticket) { 99 if (!retired_[i].timeline ||
100 ++i; 100 vk_.vkGetSemaphoreCounterValue(device_, retired_[i].timeline, &done) != VK_SUCCESS ||
101 continue; 101 done < retired_[i].ticket) {
102 ++i;
103 continue;
104 }
102 } 105 }
103 for (auto& chunk : retired_[i].chunks) { 106 for (auto& chunk : retired_[i].chunks) {
104 chunk.used = 0; 107 chunk.used = 0;
diff --git a/runtime/src/xdxr_build.comp b/runtime/src/xdxr_build.comp
index 7b5b9d034..d5bbe8253 100644
--- a/runtime/src/xdxr_build.comp
+++ b/runtime/src/xdxr_build.comp
@@ -13,8 +13,16 @@
13// MODE_RADIX_* a stable LSD radix sort of the keys with their element indices: 8 passes of 4-bit digits, each 13// MODE_RADIX_* a stable LSD radix sort of the keys with their element indices: 8 passes of 4-bit digits, each
14// a count per tile of RADIX_TILE elements, one exclusive scan, and a scatter (24 dispatches in all, 14// a count per tile of RADIX_TILE elements, one exclusive scan, and a scatter (24 dispatches in all,
15// whatever the count; shared memory only, no subgroup operations) 15// whatever the count; shared memory only, no subgroup operations)
16// MODE_SMALL_SORT up to SMALL_SORT_MAX keys: one workgroup sorts them in shared memory (bitonic, ties by element
17// index, so the order is the stable one), in one dispatch instead of the radix sort's 24, whose
18// fixed latency dominated small builds
16// MODE_LEVEL one thread per BOX32 node of one level: four consecutive entries of the level below 19// MODE_LEVEL one thread per BOX32 node of one level: four consecutive entries of the level below
17// MODE_HEADER one thread: the 64-byte header 20// MODE_HEADER one thread: the 64-byte header
21// An update (D3D12 PERFORM_UPDATE: same topology, new positions or transforms) refits instead: MODE_COPY copies the
22// source structure to the destination when they differ, MODE_TRIANGLES / MODE_INSTANCES rewrite the elements at their
23// slots, MODE_LEVEL with arg2 = 1 recomputes each node's boxes from the children it already points to (the tree's
24// grouping is kept, so there is no Morton pass and no sort), and MODE_HEADER rewrites the bounds.
25// MODE_COPY one thread per word: count words from src0 to dst
18// The tree groups four consecutive children per node in Morton order, level by level, so its shape depends only on 26// The tree groups four consecutive children per node in Morton order, level by level, so its shape depends only on
19// the element count and the layout (xdxr_build.h XdxrLayout) is known when the command is recorded. 27// the element count and the layout (xdxr_build.h XdxrLayout) is known when the command is recorded.
20// 28//
@@ -31,9 +39,11 @@ layout(local_size_x = 64) in;
31layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words { uint w[]; }; 39layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words { uint w[]; };
32 40
33const uint MODE_INIT = 0u, MODE_TRIANGLES = 1u, MODE_INSTANCES = 2u, MODE_MORTON = 3u, MODE_LEVEL = 5u, 41const uint MODE_INIT = 0u, MODE_TRIANGLES = 1u, MODE_INSTANCES = 2u, MODE_MORTON = 3u, MODE_LEVEL = 5u,
34 MODE_HEADER = 6u, MODE_RADIX_COUNT = 7u, MODE_RADIX_SCAN = 8u, MODE_RADIX_SCATTER = 9u; 42 MODE_HEADER = 6u, MODE_RADIX_COUNT = 7u, MODE_RADIX_SCAN = 8u, MODE_RADIX_SCATTER = 9u,
43 MODE_SMALL_SORT = 10u, MODE_COPY = 11u;
44const uint SMALL_SORT_MAX = 1024u; // xdxr_build.h XdxrLayout::small_sort_max
35const uint RADIX_BITS = 4u, RADIX_BINS = 16u, RADIX_PASSES = 8u; 45const uint RADIX_BITS = 4u, RADIX_BINS = 16u, RADIX_PASSES = 8u;
36const uint RADIX_TILE = 2048u; // elements per workgroup in count and scatter: 32 chunks of 64 46const uint RADIX_TILE = 256u; // elements per workgroup in count and scatter: 4 chunks of 64
37const uint INVALID = 0xffffffffu; 47const uint INVALID = 0xffffffffu;
38const uint TRI0 = 0u, BOX32 = 5u, INSTANCE = 6u; 48const uint TRI0 = 0u, BOX32 = 5u, INSTANCE = 6u;
39const uint REMAP_IDENTITY = 0x09u; 49const uint REMAP_IDENTITY = 0x09u;
@@ -53,7 +63,7 @@ layout(push_constant) uniform Push {
53 uint arg0; // triangles: vertex stride; level: entries in the level below 63 uint arg0; // triangles: vertex stride; level: entries in the level below
54 uint arg1; // triangles: 0 = R32G32B32_FLOAT, 1 = R32G32_FLOAT; level: first node of the level below, 64 uint arg1; // triangles: 0 = R32G32B32_FLOAT, 1 = R32G32_FLOAT; level: first node of the level below,
55 // or INVALID when the level below is the elements 65 // or INVALID when the level below is the elements
56 uint arg2; // triangles: index type (0 none, 1 u16, 2 u32); level: 1 for the root level 66 uint arg2; // triangles: index type (0 none, 1 u16, 2 u32); level: 1 = refit the existing node
57 uint geometry; // triangles: geometry index << 8 | D3D12_RAYTRACING_GEOMETRY_FLAGS 67 uint geometry; // triangles: geometry index << 8 | D3D12_RAYTRACING_GEOMETRY_FLAGS
58 uint elements; // element count N 68 uint elements; // element count N
59 uint sort_size; // N: the keys sorted (one per element) 69 uint sort_size; // N: the keys sorted (one per element)
@@ -254,6 +264,41 @@ void morton(uint i) {
254 store(pc.scratch, keys_off() + 4u * i, key); 264 store(pc.scratch, keys_off() + 4u * i, key);
255 store(pc.scratch, vals_off() + 4u * i, i); 265 store(pc.scratch, vals_off() + 4u * i, i);
256} 266}
267// ---- MODE_SMALL_SORT ----
268// 8 KiB, with the radix arrays below about 12.5 KiB: under the 16 KiB every Vulkan device must allow.
269shared uint small_keys[SMALL_SORT_MAX];
270shared uint small_vals[SMALL_SORT_MAX];
271
272void small_sort(uint t) {
273 uint n = pc.sort_size, p = 1u;
274 while (p < n) p <<= 1;
275 for (uint i = t; i < p; i += 64u) {
276 small_keys[i] = i < n ? load(pc.scratch, keys_off() + 4u * i) : INVALID;
277 small_vals[i] = i < n ? load(pc.scratch, vals_off() + 4u * i) : INVALID;
278 }
279 barrier();
280 for (uint k = 2u; k <= p; k <<= 1) {
281 for (uint j = k >> 1; j > 0u; j >>= 1) {
282 for (uint i = t; i < p; i += 64u) {
283 uint l = i ^ j;
284 if (l > i) {
285 uint ki = small_keys[i], kl = small_keys[l], vi = small_vals[i], vl = small_vals[l];
286 bool greater = ki > kl || (ki == kl && vi > vl);
287 if (greater == ((i & k) == 0u)) {
288 small_keys[i] = kl; small_keys[l] = ki;
289 small_vals[i] = vl; small_vals[l] = vi;
290 }
291 }
292 }
293 barrier();
294 }
295 }
296 for (uint i = t; i < n; i += 64u) {
297 store(pc.scratch, keys_off() + 4u * i, small_keys[i]);
298 store(pc.scratch, vals_off() + 4u * i, small_vals[i]);
299 }
300}
301
257// ---- MODE_RADIX_* ---- 302// ---- MODE_RADIX_* ----
258shared uint radix_hist[RADIX_BINS]; 303shared uint radix_hist[RADIX_BINS];
259shared uint radix_rank[RADIX_BINS][64]; 304shared uint radix_rank[RADIX_BINS][64];
@@ -341,7 +386,22 @@ void build_node(uint n) {
341 uint entry = 4u * n + c; 386 uint entry = 4u * n + c;
342 uint child = INVALID; 387 uint child = INVALID;
343 vec3 lo = vec3(uintBitsToFloat(0x7f800000u)), hi = -lo; // min > max: the box test misses it 388 vec3 lo = vec3(uintBitsToFloat(0x7f800000u)), hi = -lo; // min > max: the box test misses it
344 if (entry < pc.arg0) { 389 if (pc.arg2 == 1u) {
390 // refit: the child this node already has; its new box is in scratch (an element's from MODE_TRIANGLES /
391 // MODE_INSTANCES, a node's from the level below)
392 child = load(pc.dst, o + 4u * c);
393 if (child != INVALID) {
394 uint at = ptr_unit(child) * 64u;
395 if ((child & 7u) == BOX32) {
396 load_box(pc.elements + (at - pc.nodes_off) / 128u, lo, hi);
397 } else {
398 uint e = (at - pc.elements_off) / element_size();
399 load_box(e, lo, hi);
400 if (pc.tlas != 0u) store(pc.dst, pc.elements_off + 128u * e + 116u, me);
401 }
402 if (!box_empty(lo, hi)) { ulo = min(ulo, lo); uhi = max(uhi, hi); }
403 }
404 } else if (entry < pc.arg0) {
345 if (pc.arg1 == INVALID) { 405 if (pc.arg1 == INVALID) {
346 uint e = load(pc.scratch, vals_off() + 4u * entry); 406 uint e = load(pc.scratch, vals_off() + 4u * entry);
347 child = element_ptr(e); 407 child = element_ptr(e);
@@ -389,12 +449,15 @@ void main() {
389 if (pc.mode == MODE_RADIX_COUNT) { radix_count(gl_WorkGroupID.x, gl_LocalInvocationID.x); return; } 449 if (pc.mode == MODE_RADIX_COUNT) { radix_count(gl_WorkGroupID.x, gl_LocalInvocationID.x); return; }
390 if (pc.mode == MODE_RADIX_SCAN) { radix_scan(gl_LocalInvocationID.x); return; } 450 if (pc.mode == MODE_RADIX_SCAN) { radix_scan(gl_LocalInvocationID.x); return; }
391 if (pc.mode == MODE_RADIX_SCATTER) { radix_scatter(gl_WorkGroupID.x, gl_LocalInvocationID.x); return; } 451 if (pc.mode == MODE_RADIX_SCATTER) { radix_scatter(gl_WorkGroupID.x, gl_LocalInvocationID.x); return; }
452 if (pc.mode == MODE_SMALL_SORT) { small_sort(gl_LocalInvocationID.x); return; }
392 if (pc.mode == MODE_HEADER) { 453 if (pc.mode == MODE_HEADER) {
393 if (i == 0u) build_header(); 454 if (i == 0u) build_header();
394 return; 455 return;
395 } 456 }
396 if (i >= pc.count) return; 457 if (i >= pc.count) return;
397 if (pc.mode == MODE_INIT) { 458 if (pc.mode == MODE_COPY) {
459 store(pc.dst, 4u * i, load(pc.src0, 4u * i));
460 } else if (pc.mode == MODE_INIT) {
398 store(pc.dst, pc.parents_off + 4u * i, INVALID); 461 store(pc.dst, pc.parents_off + 4u * i, INVALID);
399 if (i < 3u) { store(pc.scratch, 4u * i, INVALID); store(pc.scratch, 12u + 4u * i, 0u); } 462 if (i < 3u) { store(pc.scratch, 4u * i, INVALID); store(pc.scratch, 12u + 4u * i, 0u); }
400 } else if (pc.mode == MODE_TRIANGLES) { 463 } else if (pc.mode == MODE_TRIANGLES) {
diff --git a/runtime/src/xdxr_build.h b/runtime/src/xdxr_build.h
index 32ee111cb..64fe97a83 100644
--- a/runtime/src/xdxr_build.h
+++ b/runtime/src/xdxr_build.h
@@ -41,9 +41,10 @@ struct XdxrLayout {
41 std::uint32_t size = 0; // result data size in bytes, a multiple of 64 41 std::uint32_t size = 0; // result data size in bytes, a multiple of 64
42 std::uint32_t parent_entries = 0; // one per 64-byte unit from elements_off on 42 std::uint32_t parent_entries = 0; // one per 64-byte unit from elements_off on
43 std::uint32_t sort_size = 0; // keys the radix sort orders: one per element 43 std::uint32_t sort_size = 0; // keys the radix sort orders: one per element
44 static constexpr std::uint32_t radix_tile = 2048; // xdxr_build.comp RADIX_TILE 44 static constexpr std::uint32_t radix_tile = 256; // xdxr_build.comp RADIX_TILE
45 static constexpr std::uint32_t radix_bins = 16; 45 static constexpr std::uint32_t radix_bins = 16;
46 static constexpr std::uint32_t radix_passes = 8; 46 static constexpr std::uint32_t radix_passes = 8;
47 static constexpr std::uint32_t small_sort_max = 1024; // xdxr_build.comp SMALL_SORT_MAX: one-workgroup sort
47 std::uint64_t scratch = 0; // scratch bytes 48 std::uint64_t scratch = 0; // scratch bytes
48 49
49 // False when the count would overflow the 32-bit offsets of the format. 50 // False when the count would overflow the 32-bit offsets of the format.
@@ -108,11 +109,16 @@ public:
108 109
109 // Records a bottom-level build into `dst` (layout.size bytes) using `scratch` (layout.scratch bytes). `layout` 110 // Records a bottom-level build into `dst` (layout.size bytes) using `scratch` (layout.scratch bytes). `layout`
110 // must come from compute() with the sum of the geometries' triangle counts. 111 // must come from compute() with the sum of the geometries' triangle counts.
112 //
113 // With `update_from` set, an update (D3D12 PERFORM_UPDATE) instead: the structure at `update_from` (the
114 // destination itself, or another one, which is copied first) was built from the same topology, and is refitted
115 // to the new positions. Its tree is kept and only its boxes change, which is valid for any motion and costs no
116 // sort, though a refitted tree traverses more slowly as the geometry moves away from where it was built.
111 bool record_blas(VkCommandBuffer cb, const XdxrLayout& layout, const std::vector<XdxrTriangles>& geometries, 117 bool record_blas(VkCommandBuffer cb, const XdxrLayout& layout, const std::vector<XdxrTriangles>& geometries,
112 std::uint64_t dst, std::uint64_t scratch) { 118 std::uint64_t dst, std::uint64_t scratch, std::uint64_t update_from = 0) {
113 if (!loaded_ || layout.tlas) return false; 119 if (!loaded_ || layout.tlas) return false;
114 Push p = base(layout, dst, scratch); 120 Push p = base(layout, dst, scratch);
115 begin(cb, layout, p); 121 if (update_from) refit_begin(cb, layout, p, update_from); else begin(cb, layout, p);
116 std::uint32_t first = 0; 122 std::uint32_t first = 0;
117 for (std::size_t g = 0; g < geometries.size(); ++g) { 123 for (std::size_t g = 0; g < geometries.size(); ++g) {
118 const auto& geo = geometries[g]; 124 const auto& geo = geometries[g];
@@ -132,17 +138,18 @@ public:
132 first += geo.triangle_count; 138 first += geo.triangle_count;
133 } 139 }
134 if (first != layout.elements) return false; 140 if (first != layout.elements) return false;
135 finish(cb, layout, p); 141 if (update_from) refit_finish(cb, layout, p); else finish(cb, layout, p);
136 return true; 142 return true;
137 } 143 }
138 144
139 // Records a top-level build from `count` D3D12_RAYTRACING_INSTANCE_DESCs at `instances`. 145 // Records a top-level build from `count` D3D12_RAYTRACING_INSTANCE_DESCs at `instances`.
146 // `update_from`: as for record_blas; the instances may move, and name other BLASes.
140 bool record_tlas(VkCommandBuffer cb, const XdxrLayout& layout, std::uint64_t instances, std::uint64_t dst, 147 bool record_tlas(VkCommandBuffer cb, const XdxrLayout& layout, std::uint64_t instances, std::uint64_t dst,
141 std::uint64_t scratch, std::uint64_t bias = 0) { 148 std::uint64_t scratch, std::uint64_t bias = 0, std::uint64_t update_from = 0) {
142 if (!loaded_ || !layout.tlas) return false; 149 if (!loaded_ || !layout.tlas) return false;
143 Push p = base(layout, dst, scratch); 150 Push p = base(layout, dst, scratch);
144 p.bias = split(bias); 151 p.bias = split(bias);
145 begin(cb, layout, p); 152 if (update_from) refit_begin(cb, layout, p, update_from); else begin(cb, layout, p);
146 if (layout.elements) { 153 if (layout.elements) {
147 Push t = p; 154 Push t = p;
148 t.mode = mode_instances; 155 t.mode = mode_instances;
@@ -150,14 +157,14 @@ public:
150 t.src0 = split(instances); 157 t.src0 = split(instances);
151 dispatch(cb, t, t.count); 158 dispatch(cb, t, t.count);
152 } 159 }
153 finish(cb, layout, p); 160 if (update_from) refit_finish(cb, layout, p); else finish(cb, layout, p);
154 return true; 161 return true;
155 } 162 }
156 163
157private: 164private:
158 enum : std::uint32_t { 165 enum : std::uint32_t {
159 mode_init = 0, mode_triangles = 1, mode_instances = 2, mode_morton = 3, mode_level = 5, mode_header = 6, 166 mode_init = 0, mode_triangles = 1, mode_instances = 2, mode_morton = 3, mode_level = 5, mode_header = 6,
160 mode_radix_count = 7, mode_radix_scan = 8, mode_radix_scatter = 9 167 mode_radix_count = 7, mode_radix_scan = 8, mode_radix_scatter = 9, mode_small_sort = 10, mode_copy = 11
161 }; 168 };
162 struct Addr { std::uint32_t lo = 0, hi = 0; }; 169 struct Addr { std::uint32_t lo = 0, hi = 0; };
163 struct Push { // xdxr_build.comp `Push`, std430 push-constant layout 170 struct Push { // xdxr_build.comp `Push`, std430 push-constant layout
@@ -191,6 +198,36 @@ private:
191 dispatch(cb, init, init.count); 198 dispatch(cb, init, init.count);
192 } 199 }
193 200
201 // An update: the source's tree is copied unless it is the destination. Its parent table stays as it is, so there
202 // is no MODE_INIT.
203 void refit_begin(VkCommandBuffer cb, const XdxrLayout& l, const Push& p, std::uint64_t source) {
204 vk_.vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_);
205 const std::uint64_t dst = std::uint64_t(p.dst.hi) << 32 | p.dst.lo;
206 if (source == dst) return;
207 Push c = p;
208 c.mode = mode_copy;
209 c.count = l.size / 4;
210 c.src0 = split(source);
211 dispatch(cb, c, c.count);
212 }
213
214 // Boxes bottom-up through the existing nodes, then the header (its bounds change; nothing else does).
215 void refit_finish(VkCommandBuffer cb, const XdxrLayout& l, const Push& p) {
216 for (std::size_t level = 0; level < l.level_counts.size(); ++level) {
217 Push n = p;
218 n.mode = mode_level;
219 n.count = l.level_counts[level];
220 n.first = l.level_first[level];
221 n.arg2 = 1; // refit: read each node's children from the node
222 dispatch(cb, n, n.count);
223 }
224 Push h = p;
225 h.mode = mode_header;
226 h.count = 1;
227 h.first = l.root();
228 dispatch(cb, h, 1, false);
229 }
230
194 void finish(VkCommandBuffer cb, const XdxrLayout& l, const Push& p) { 231 void finish(VkCommandBuffer cb, const XdxrLayout& l, const Push& p) {
195 Push m = p; 232 Push m = p;
196 m.mode = mode_morton; 233 m.mode = mode_morton;
@@ -198,7 +235,11 @@ private:
198 dispatch(cb, m, m.count); 235 dispatch(cb, m, m.count);
199 // stable LSD radix sort, 4 bits a pass; an even pass count leaves the result where the keys started 236 // stable LSD radix sort, 4 bits a pass; an even pass count leaves the result where the keys started
200 static_assert(XdxrLayout::radix_passes % 2 == 0, "the sorted keys must end in the first buffer"); 237 static_assert(XdxrLayout::radix_passes % 2 == 0, "the sorted keys must end in the first buffer");
201 if (l.sort_size > 1) { 238 if (l.sort_size > 1 && l.sort_size <= XdxrLayout::small_sort_max) {
239 Push s = p;
240 s.mode = mode_small_sort;
241 dispatch(cb, s, 64); // one workgroup, shared memory
242 } else if (l.sort_size > 1) {
202 for (std::uint32_t pass = 0; pass < XdxrLayout::radix_passes; ++pass) { 243 for (std::uint32_t pass = 0; pass < XdxrLayout::radix_passes; ++pass) {
203 Push s = p; 244 Push s = p;
204 s.first = pass; 245 s.first = pass;
diff --git a/runtime/src/xdxr_build.inc b/runtime/src/xdxr_build.inc
index 8a43b04cd..71ce37fbb 100644
--- a/runtime/src/xdxr_build.inc
+++ b/runtime/src/xdxr_build.inc
@@ -1,3441 +1,3990 @@
1{0x07230203,0x00010500,0x000d000b,0x00002b73, 1{0x07230203,0x00010500,0x000d000b,0x000031a8,
20x00000000,0x00020011,0x00000001,0x00020011, 20x00000000,0x00020011,0x00000001,0x00020011,
30x000014e3,0x0006000b,0x00000001,0x4c534c47, 30x000014e3,0x0006000b,0x00000001,0x4c534c47,
40x6474732e,0x3035342e,0x00000000,0x0003000e, 40x6474732e,0x3035342e,0x00000000,0x0003000e,
50x000014e4,0x00000001,0x000d000f,0x00000005, 50x000014e4,0x00000001,0x000f000f,0x00000005,
60x00000004,0x6e69616d,0x00000000,0x000000f9, 60x00000004,0x6e69616d,0x00000000,0x000000fc,
70x000006d4,0x00000740,0x00000789,0x000007e2, 70x000006af,0x000006c4,0x000007a3,0x0000080d,
80x000009e6,0x000009f0,0x000009f1,0x00060010, 80x00000856,0x000008af,0x00000b0e,0x00000b17,
90x00000004,0x00000011,0x00000040,0x00000001, 90x00000b18,0x00060010,0x00000004,0x00000011,
100x00000001,0x00040047,0x00000015,0x00000006, 100x00000040,0x00000001,0x00000001,0x00040047,
110x00000004,0x00030047,0x00000016,0x00000002, 110x00000015,0x00000006,0x00000004,0x00030047,
120x00050048,0x00000016,0x00000000,0x00000023, 120x00000016,0x00000002,0x00050048,0x00000016,
130x00000000,0x00030047,0x000000f7,0x00000002, 130x00000000,0x00000023,0x00000000,0x00030047,
140x00050048,0x000000f7,0x00000000,0x00000023, 140x000000fa,0x00000002,0x00050048,0x000000fa,
150x00000000,0x00050048,0x000000f7,0x00000001, 150x00000000,0x00000023,0x00000000,0x00050048,
160x00000023,0x00000008,0x00050048,0x000000f7, 160x000000fa,0x00000001,0x00000023,0x00000008,
170x00000002,0x00000023,0x00000010,0x00050048, 170x00050048,0x000000fa,0x00000002,0x00000023,
180x000000f7,0x00000003,0x00000023,0x00000018, 180x00000010,0x00050048,0x000000fa,0x00000003,
190x00050048,0x000000f7,0x00000004,0x00000023, 190x00000023,0x00000018,0x00050048,0x000000fa,
200x00000020,0x00050048,0x000000f7,0x00000005, 200x00000004,0x00000023,0x00000020,0x00050048,
210x00000023,0x00000028,0x00050048,0x000000f7, 210x000000fa,0x00000005,0x00000023,0x00000028,
220x00000006,0x00000023,0x00000030,0x00050048, 220x00050048,0x000000fa,0x00000006,0x00000023,
230x000000f7,0x00000007,0x00000023,0x00000034, 230x00000030,0x00050048,0x000000fa,0x00000007,
240x00050048,0x000000f7,0x00000008,0x00000023, 240x00000023,0x00000034,0x00050048,0x000000fa,
250x00000038,0x00050048,0x000000f7,0x00000009, 250x00000008,0x00000023,0x00000038,0x00050048,
260x00000023,0x0000003c,0x00050048,0x000000f7, 260x000000fa,0x00000009,0x00000023,0x0000003c,
270x0000000a,0x00000023,0x00000040,0x00050048, 270x00050048,0x000000fa,0x0000000a,0x00000023,
280x000000f7,0x0000000b,0x00000023,0x00000044, 280x00000040,0x00050048,0x000000fa,0x0000000b,
290x00050048,0x000000f7,0x0000000c,0x00000023, 290x00000023,0x00000044,0x00050048,0x000000fa,
300x00000048,0x00050048,0x000000f7,0x0000000d, 300x0000000c,0x00000023,0x00000048,0x00050048,
310x00000023,0x0000004c,0x00050048,0x000000f7, 310x000000fa,0x0000000d,0x00000023,0x0000004c,
320x0000000e,0x00000023,0x00000050,0x00050048, 320x00050048,0x000000fa,0x0000000e,0x00000023,
330x000000f7,0x0000000f,0x00000023,0x00000054, 330x00000050,0x00050048,0x000000fa,0x0000000f,
340x00050048,0x000000f7,0x00000010,0x00000023, 340x00000023,0x00000054,0x00050048,0x000000fa,
350x00000058,0x00050048,0x000000f7,0x00000011, 350x00000010,0x00000023,0x00000058,0x00050048,
360x00000023,0x0000005c,0x00050048,0x000000f7, 360x000000fa,0x00000011,0x00000023,0x0000005c,
370x00000012,0x00000023,0x00000060,0x00050048, 370x00050048,0x000000fa,0x00000012,0x00000023,
380x000000f7,0x00000013,0x00000023,0x00000064, 380x00000060,0x00050048,0x000000fa,0x00000013,
390x00040047,0x000009e6,0x0000000b,0x0000001c, 390x00000023,0x00000064,0x00040047,0x00000b0e,
400x00040047,0x000009f0,0x0000000b,0x0000001a, 400x0000000b,0x0000001c,0x00040047,0x00000b17,
410x00040047,0x000009f1,0x0000000b,0x0000001b, 410x0000000b,0x0000001a,0x00040047,0x00000b18,
420x00040047,0x00000a6c,0x0000000b,0x00000019, 420x0000000b,0x0000001b,0x00040047,0x00000bb4,
430x00020013,0x00000002,0x00030021,0x00000003, 430x0000000b,0x00000019,0x00020013,0x00000002,
440x00000002,0x00040015,0x00000006,0x00000020, 440x00030021,0x00000003,0x00000002,0x00040015,
450x00000000,0x00040017,0x00000007,0x00000006, 450x00000006,0x00000020,0x00000000,0x00040017,
460x00000002,0x00040020,0x00000009,0x00000007, 460x00000007,0x00000006,0x00000002,0x00040020,
470x00000006,0x00030027,0x00000014,0x000014e5, 470x00000009,0x00000007,0x00000006,0x00030027,
480x0003001d,0x00000015,0x00000006,0x0003001e, 480x00000014,0x000014e5,0x0003001d,0x00000015,
490x00000016,0x00000015,0x00040020,0x00000014, 490x00000006,0x0003001e,0x00000016,0x00000015,
500x000014e5,0x00000016,0x00030016,0x00000027, 500x00040020,0x00000014,0x000014e5,0x00000016,
510x00000020,0x00040020,0x00000028,0x00000007, 510x00030016,0x00000027,0x00000020,0x00040020,
520x00000027,0x00020014,0x0000002f,0x00040017, 520x00000028,0x00000007,0x00000027,0x00020014,
530x0000004b,0x00000027,0x00000003,0x00040020, 530x0000002f,0x00040017,0x0000004b,0x00000027,
540x0000004c,0x00000007,0x0000004b,0x0004002b, 540x00000003,0x00040020,0x0000004c,0x00000007,
550x00000006,0x000000a3,0x00000000,0x0004001e, 550x0000004b,0x0004002b,0x00000006,0x000000a6,
560x000000a8,0x00000006,0x00000006,0x0004002b, 560x00000000,0x0004001e,0x000000ab,0x00000006,
570x00000006,0x000000ad,0x00000001,0x00040015, 570x00000006,0x0004002b,0x00000006,0x000000b0,
580x000000d6,0x00000020,0x00000001,0x0004002b, 580x00000001,0x00040015,0x000000d9,0x00000020,
590x000000d6,0x000000d7,0x00000000,0x00040020, 590x00000001,0x0004002b,0x000000d9,0x000000da,
600x000000d8,0x000014e5,0x00000006,0x0016001e, 600x00000000,0x00040020,0x000000db,0x000014e5,
610x000000f7,0x00000007,0x00000007,0x00000007, 610x00000006,0x0016001e,0x000000fa,0x00000007,
620x00000007,0x00000007,0x00000007,0x00000006, 620x00000007,0x00000007,0x00000007,0x00000007,
630x00000007,0x00000006,0x00000006,0x00000006,
630x00000006,0x00000006,0x00000006,0x00000006, 640x00000006,0x00000006,0x00000006,0x00000006,
640x00000006,0x00000006,0x00000006,0x00000006, 650x00000006,0x00000006,0x00000006,0x00000006,
650x00000006,0x00000006,0x00000006,0x00000006, 660x00000006,0x00000006,0x00000006,0x00040020,
660x00000006,0x00040020,0x000000f8,0x00000009, 670x000000fb,0x00000009,0x000000fa,0x0004003b,
670x000000f7,0x0004003b,0x000000f8,0x000000f9, 680x000000fb,0x000000fc,0x00000009,0x0004002b,
680x00000009,0x0004002b,0x000000d6,0x000000fa, 690x000000d9,0x000000fd,0x0000000e,0x00040020,
690x0000000e,0x00040020,0x000000fb,0x00000009, 700x000000fe,0x00000009,0x00000006,0x0004002b,
700x00000006,0x0004002b,0x00000006,0x000000fe, 710x00000006,0x00000101,0x00000100,0x0004002b,
710x00000800,0x0004002b,0x00000006,0x00000104, 720x00000006,0x00000107,0x00000040,0x0004002b,
720x00000040,0x0004002b,0x00000006,0x00000107, 730x00000006,0x0000010a,0x00000004,0x0004002b,
730x00000004,0x0004002b,0x00000006,0x0000010e, 740x00000006,0x00000111,0x00000008,0x0004002b,
740x00000008,0x0004002b,0x00000006,0x00000115, 750x00000006,0x00000118,0x0000000c,0x0004002b,
750x0000000c,0x0004002b,0x00000006,0x0000011c, 760x00000006,0x0000011f,0x00000010,0x0004002b,
760x00000010,0x0004002b,0x00000006,0x0000012d, 770x00000006,0x00000130,0x80000000,0x0004002b,
770x80000000,0x0004002b,0x00000006,0x00000142, 780x00000006,0x00000145,0x7fffffff,0x0004002b,
780x7fffffff,0x0004002b,0x00000006,0x0000014d, 790x00000006,0x00000150,0x00000018,0x0004002b,
790x00000018,0x0004002b,0x000000d6,0x00000151, 800x000000d9,0x00000154,0x00000001,0x00040020,
800x00000001,0x00040020,0x00000153,0x00000009, 810x00000156,0x00000009,0x00000007,0x0004002b,
810x00000007,0x0004002b,0x00000006,0x0000016d, 820x00000006,0x00000170,0x00000002,0x0004002b,
820x00000002,0x0004002b,0x00000006,0x00000186, 830x00000006,0x00000189,0x00000014,0x0004002b,
830x00000014,0x0004002b,0x00000027,0x000001ea, 840x00000027,0x000001ed,0x3f000000,0x0004002b,
840x3f000000,0x0004002b,0x000000d6,0x00000202, 850x000000d9,0x00000205,0x00000002,0x0004002b,
850x00000002,0x0004002b,0x000000d6,0x0000020a, 860x000000d9,0x0000020d,0x00000003,0x0004002b,
860x00000003,0x0004002b,0x000000d6,0x00000212, 870x000000d9,0x00000215,0x00000004,0x0004002b,
870x00000004,0x0004002b,0x000000d6,0x0000021a, 880x000000d9,0x0000021d,0x00000005,0x0004002b,
880x00000005,0x0004002b,0x000000d6,0x00000221, 890x000000d9,0x00000224,0x00000013,0x0004002b,
890x00000013,0x0004002b,0x00000006,0x00000225, 900x00000006,0x00000228,0x00000080,0x0004002b,
900x00000080,0x0004002b,0x000000d6,0x00000229, 910x000000d9,0x0000022c,0x0000000f,0x0004002b,
910x0000000f,0x0004002b,0x000000d6,0x00000230, 920x000000d9,0x00000233,0x00000006,0x0004002b,
920x00000006,0x0004002b,0x00000006,0x00000236, 930x00000006,0x00000239,0x00000006,0x0004002b,
930x00000006,0x0004002b,0x000000d6,0x0000023b, 940x000000d9,0x0000023e,0x00000010,0x0004002b,
940x00000010,0x0004002b,0x00000006,0x00000243, 950x00000006,0x00000246,0x00000005,0x0004002b,
950x00000005,0x0004002b,0x000000d6,0x0000024d, 960x000000d9,0x00000250,0x00000009,0x0004002b,
960x00000009,0x0004002b,0x000000d6,0x00000263, 970x000000d9,0x00000266,0x0000000a,0x0004002b,
970x0000000a,0x0004002b,0x00000027,0x0000026a, 980x00000027,0x0000026d,0x00000000,0x0004002b,
980x00000000,0x0004002b,0x000000d6,0x00000278, 990x000000d9,0x0000027b,0x0000000b,0x0004002b,
990x0000000b,0x0004002b,0x00000006,0x000002a0, 1000x00000006,0x000002a3,0x0000ffff,0x0004002b,
1000x0000ffff,0x0004002b,0x00000006,0x000002b4, 1010x00000006,0x000002b7,0x00000003,0x00040017,
1010x00000003,0x00040017,0x000002b9,0x00000027, 1020x000002bc,0x00000027,0x00000004,0x0004001c,
1020x00000004,0x0004001c,0x000002f3,0x0000004b, 1030x000002f6,0x0000004b,0x000002b7,0x00040020,
1030x000002b4,0x00040020,0x000002f4,0x00000007, 1040x000002f7,0x00000007,0x000002f6,0x0004002b,
1040x000002f3,0x0004002b,0x000000d6,0x00000305, 1050x000000d9,0x00000308,0x00000008,0x0004002b,
1050x00000008,0x0004002b,0x00000006,0x00000344, 1060x00000006,0x00000347,0x00000024,0x0004002b,
1060x00000024,0x0004002b,0x00000006,0x0000034f, 1070x00000006,0x00000352,0x00000028,0x0004002b,
1070x00000028,0x0004002b,0x00000006,0x0000035a, 1080x00000006,0x0000035d,0x0000002c,0x0004002b,
1080x0000002c,0x0004002b,0x00000006,0x00000365, 1090x00000006,0x00000368,0x00000030,0x0004002b,
1090x00000030,0x0004002b,0x000000d6,0x00000367, 1100x000000d9,0x0000036a,0x0000000c,0x0004002b,
1100x0000000c,0x0004002b,0x00000006,0x00000371, 1110x00000006,0x00000374,0x00000034,0x0004002b,
1110x00000034,0x0004002b,0x00000006,0x0000037b, 1120x00000006,0x0000037e,0x00000038,0x0004002b,
1120x00000038,0x0004002b,0x00000006,0x0000037d, 1130x00000006,0x00000380,0xffffffff,0x0004002b,
1130xffffffff,0x0004002b,0x00000006,0x00000385, 1140x00000006,0x00000388,0x0000003c,0x0004002b,
1140x0000003c,0x0004002b,0x00000006,0x00000387, 1150x00000006,0x0000038a,0x00000009,0x00040017,
1150x00000009,0x00040017,0x00000392,0x0000002f, 1160x00000395,0x0000002f,0x00000003,0x0004001c,
1160x00000003,0x0004001c,0x000003d6,0x00000027, 1170x000003d9,0x00000027,0x00000118,0x00040020,
1170x00000115,0x00040020,0x000003d7,0x00000007, 1180x000003da,0x00000007,0x000003d9,0x0004002b,
1180x000003d6,0x0004002b,0x00000006,0x00000460, 1190x00000006,0x00000463,0x0000001c,0x0004002b,
1190x0000001c,0x0004002b,0x00000006,0x00000466, 1200x00000006,0x00000469,0x00000020,0x0004002b,
1200x00000020,0x0004002b,0x000000d6,0x0000047b, 1210x000000d9,0x0000047e,0x00000018,0x0004002b,
1210x00000018,0x0004002b,0x000000d6,0x000004d5, 1220x000000d9,0x000004d8,0x00000007,0x0004002b,
1220x00000007,0x0004002b,0x00000027,0x000004f9, 1230x00000027,0x000004fc,0x3f800000,0x0004002b,
1230x3f800000,0x0004002b,0x00000006,0x0000052e, 1240x00000006,0x00000531,0x3fffffff,0x00040018,
1240x3fffffff,0x00040018,0x00000548,0x0000004b, 1250x0000054b,0x0000004b,0x00000003,0x00040020,
1250x00000003,0x00040020,0x00000549,0x00000007, 1260x0000054c,0x00000007,0x0000054b,0x0006002c,
1260x00000548,0x0006002c,0x0000004b,0x0000056d, 1270x0000004b,0x00000570,0x0000026d,0x0000026d,
1270x0000026a,0x0000026a,0x0000026a,0x0006002c, 1280x0000026d,0x0006002c,0x0000054b,0x00000571,
1280x00000548,0x0000056e,0x0000056d,0x0000056d, 1290x00000570,0x00000570,0x00000570,0x0004002b,
1290x0000056d,0x0004002b,0x00000006,0x00000594, 1300x00000006,0x00000597,0x00000044,0x0004002b,
1300x00000044,0x0004002b,0x00000006,0x000005a3, 1310x00000006,0x000005a6,0x00000048,0x0004002b,
1310x00000048,0x0004002b,0x00000006,0x000005b2, 1320x00000006,0x000005b5,0x0000004c,0x0004002b,
1320x0000004c,0x0004002b,0x00000006,0x000005c3, 1330x00000006,0x000005c6,0x00000070,0x0004002b,
1330x00000070,0x0004002b,0x00000006,0x000005cd, 1340x00000006,0x000005d0,0x00000074,0x0004002b,
1340x00000074,0x0004002b,0x00000006,0x000005d6, 1350x00000006,0x000005d9,0x00000078,0x0004002b,
1350x00000078,0x0004002b,0x00000006,0x000005df, 1360x00000006,0x000005e2,0x0000007c,0x0004002b,
1360x0000007c,0x0004002b,0x00000006,0x000005fb, 1370x00000006,0x000005fe,0x000003ff,0x0004002b,
1370x000003ff,0x0004002b,0x00000006,0x00000602, 1380x00000006,0x00000605,0x030000ff,0x0004002b,
1380x030000ff,0x0004002b,0x00000006,0x00000608, 1390x00000006,0x0000060b,0x0300f00f,0x0004002b,
1390x0300f00f,0x0004002b,0x00000006,0x0000060e, 1400x00000006,0x00000611,0x030c30c3,0x0004002b,
1400x030c30c3,0x0004002b,0x00000006,0x00000614, 1410x00000006,0x00000617,0x09249249,0x0004002b,
1410x09249249,0x0004002b,0x00000027,0x00000657, 1420x00000027,0x0000065a,0x0da24260,0x0006002c,
1420x0da24260,0x0006002c,0x0000004b,0x00000658, 1430x0000004b,0x0000065b,0x0000065a,0x0000065a,
1430x00000657,0x00000657,0x00000657,0x00040017, 1440x0000065a,0x00040017,0x0000065d,0x00000006,
1440x0000065a,0x00000006,0x00000003,0x0004002b, 1450x00000003,0x0004002b,0x00000027,0x0000066b,
1450x00000027,0x00000668,0x447fc000,0x0004002b, 1460x447fc000,0x0004002b,0x00000006,0x000006ac,
1460x00000006,0x000006ca,0x0000000f,0x0004001c, 1470x00000400,0x0004001c,0x000006ad,0x00000006,
1470x000006d2,0x00000006,0x0000011c,0x00040020, 1480x000006ac,0x00040020,0x000006ae,0x00000004,
1480x000006d3,0x00000004,0x000006d2,0x0004003b, 1490x000006ad,0x0004003b,0x000006ae,0x000006af,
1490x000006d3,0x000006d4,0x00000004,0x00040020, 1500x00000004,0x00040020,0x000006c2,0x00000004,
1500x000006d6,0x00000004,0x00000006,0x0004002b, 1510x00000006,0x0004003b,0x000006ae,0x000006c4,
1510x00000006,0x000006d8,0x00000108,0x0004002b, 1520x00000004,0x0004002b,0x00000006,0x000006da,
1520x00000006,0x00000717,0x0000003f,0x0004001c, 1530x00000108,0x0004002b,0x00000006,0x00000799,
1530x0000073e,0x00000006,0x00000104,0x00040020, 1540x0000000f,0x0004001c,0x000007a1,0x00000006,
1540x0000073f,0x00000004,0x0000073e,0x0004003b, 1550x0000011f,0x00040020,0x000007a2,0x00000004,
1550x0000073f,0x00000740,0x00000004,0x0004003b, 1560x000007a1,0x0004003b,0x000007a2,0x000007a3,
1560x000006d3,0x00000789,0x00000004,0x0004001c, 1570x00000004,0x0004002b,0x00000006,0x000007e4,
1570x000007e0,0x0000073e,0x0000011c,0x00040020, 1580x0000003f,0x0004001c,0x0000080b,0x00000006,
1580x000007e1,0x00000004,0x000007e0,0x0004003b, 1590x00000107,0x00040020,0x0000080c,0x00000004,
1590x000007e1,0x000007e2,0x00000004,0x00040020, 1600x0000080b,0x0004003b,0x0000080c,0x0000080d,
1600x000007fe,0x00000007,0x000006d2,0x0004002b, 1610x00000004,0x0004003b,0x000007a2,0x00000856,
1610x000000d6,0x00000850,0x0000003f,0x0004002b, 1620x00000004,0x0004001c,0x000008ad,0x0000080b,
1620x000000d6,0x000008bc,0x0000000d,0x0004002b, 1630x0000011f,0x00040020,0x000008ae,0x00000004,
1630x000000d6,0x000008c7,0x00000011,0x0004002b, 1640x000008ad,0x0004003b,0x000008ae,0x000008af,
1640x000000d6,0x0000096f,0x00000012,0x00040020, 1650x00000004,0x00040020,0x000008cb,0x00000007,
1650x000009e5,0x00000001,0x0000065a,0x0004003b, 1660x000007a1,0x0004002b,0x000000d9,0x0000091d,
1660x000009e5,0x000009e6,0x00000001,0x00040020, 1670x0000003f,0x0004002b,0x00000006,0x00000967,
1670x000009e7,0x00000001,0x00000006,0x0004002b, 1680x00000007,0x0004002b,0x000000d9,0x0000096c,
1680x00000006,0x000009ec,0x00000007,0x0004003b, 1690x0000000d,0x0004002b,0x000000d9,0x000009ef,
1690x000009e5,0x000009f0,0x00000001,0x0004003b, 1700x00000011,0x0004002b,0x000000d9,0x00000a97,
1700x000009e5,0x000009f1,0x00000001,0x0006002c, 1710x00000012,0x00040020,0x00000b0d,0x00000001,
1710x0000065a,0x00000a6c,0x00000104,0x000000ad, 1720x0000065d,0x0004003b,0x00000b0d,0x00000b0e,
1720x000000ad,0x0006002c,0x0000004b,0x00002b61, 1730x00000001,0x00040020,0x00000b0f,0x00000001,
1730x000004f9,0x000004f9,0x000004f9,0x0004002b, 1740x00000006,0x0004003b,0x00000b0d,0x00000b17,
1740x00000027,0x00002b63,0x7f800000,0x0006002c, 1750x00000001,0x0004003b,0x00000b0d,0x00000b18,
1750x0000004b,0x00002b64,0x00002b63,0x00002b63, 1760x00000001,0x0004002b,0x00000006,0x00000b3a,
1760x00002b63,0x0004002b,0x00000027,0x00002b65, 1770x0000000a,0x0004002b,0x00000006,0x00000b57,
1770xff800000,0x0006002c,0x0000004b,0x00002b66, 1780x0000000b,0x0006002c,0x0000065d,0x00000bb4,
1780x00002b65,0x00002b65,0x00002b65,0x0004002b, 1790x00000107,0x000000b0,0x000000b0,0x0006002c,
1790x00000006,0x00002b67,0x000007ff,0x00050036, 1800x0000004b,0x00003196,0x000004fc,0x000004fc,
1800x00000002,0x00000004,0x00000000,0x00000003, 1810x000004fc,0x0004002b,0x00000027,0x00003198,
1810x000200f8,0x00000005,0x0004003b,0x000003d7, 1820x7f800000,0x0006002c,0x0000004b,0x00003199,
1820x00001884,0x00000007,0x0004003b,0x00000549, 1830x00003198,0x00003198,0x00003198,0x0004002b,
1830x000018c5,0x00000007,0x0004003b,0x0000004c, 1840x00000027,0x0000319a,0xff800000,0x0006002c,
1840x000018c8,0x00000007,0x0004003b,0x0000004c, 1850x0000004b,0x0000319b,0x0000319a,0x0000319a,
1850x00001424,0x00000007,0x0004003b,0x000002f4, 1860x0000319a,0x0004002b,0x00000006,0x0000319c,
1860x00001239,0x00000007,0x0004003b,0x000007fe, 1870x000000ff,0x00050036,0x00000002,0x00000004,
1870x00000c2a,0x00000007,0x000300f7,0x00000a6e, 1880x00000000,0x00000003,0x000200f8,0x00000005,
1880x00000000,0x000300fb,0x000000a3,0x00000a6f, 1890x0004003b,0x000003da,0x00001b65,0x00000007,
1890x000200f8,0x00000a6f,0x00050041,0x000009e7, 1900x0004003b,0x0000054c,0x00001ba6,0x00000007,
1900x000009e8,0x000009e6,0x000000a3,0x0004003d, 1910x0004003b,0x0000004c,0x00001ba9,0x00000007,
1910x00000006,0x000009e9,0x000009e8,0x00050041, 1920x0004003b,0x0000004c,0x00001705,0x00000007,
1920x000000fb,0x000009ea,0x000000f9,0x00000230, 1930x0004003b,0x000002f7,0x0000151a,0x00000007,
1930x0004003d,0x00000006,0x000009eb,0x000009ea, 1940x0004003b,0x000008cb,0x00000d72,0x00000007,
1940x000500aa,0x0000002f,0x000009ed,0x000009eb, 1950x000300f7,0x00000bb6,0x00000000,0x000300fb,
1950x000009ec,0x000300f7,0x000009ef,0x00000000, 1960x000000a6,0x00000bb7,0x000200f8,0x00000bb7,
1960x000400fa,0x000009ed,0x000009ee,0x000009ef, 1970x00050041,0x00000b0f,0x00000b10,0x00000b0e,
1970x000200f8,0x000009ee,0x00050041,0x000009e7, 1980x000000a6,0x0004003d,0x00000006,0x00000b11,
1980x000009f3,0x000009f0,0x000000a3,0x0004003d, 1990x00000b10,0x00050041,0x000000fe,0x00000b12,
1990x00000006,0x000009f4,0x000009f3,0x00050041, 2000x000000fc,0x00000233,0x0004003d,0x00000006,
2000x000009e7,0x000009f6,0x000009f1,0x000000a3, 2010x00000b13,0x00000b12,0x000500aa,0x0000002f,
2010x0004003d,0x00000006,0x000009f7,0x000009f6, 2020x00000b14,0x00000b13,0x00000967,0x000300f7,
2020x000500b0,0x0000002f,0x00000a8b,0x000009f7, 2030x00000b16,0x00000000,0x000400fa,0x00000b14,
2030x0000011c,0x000300f7,0x00000a8f,0x00000000, 2040x00000b15,0x00000b16,0x000200f8,0x00000b15,
2040x000400fa,0x00000a8b,0x00000a8c,0x00000a8f, 2050x00050041,0x00000b0f,0x00000b1a,0x00000b17,
2050x000200f8,0x00000a8c,0x00050041,0x000006d6, 2060x000000a6,0x0004003d,0x00000006,0x00000b1b,
2060x00000a8e,0x000006d4,0x000009f7,0x0003003e, 2070x00000b1a,0x00050041,0x00000b0f,0x00000b1d,
2070x00000a8e,0x000000a3,0x000200f9,0x00000a8f, 2080x00000b18,0x000000a6,0x0004003d,0x00000006,
2080x000200f8,0x00000a8f,0x000400e0,0x0000016d, 2090x00000b1e,0x00000b1d,0x000500b0,0x0000002f,
2090x0000016d,0x000006d8,0x00050084,0x00000006, 2100x00000bd3,0x00000b1e,0x0000011f,0x000300f7,
2100x00000a91,0x000009f4,0x000000fe,0x00050080, 2110x00000bd7,0x00000000,0x000400fa,0x00000bd3,
2110x00000006,0x00000a93,0x00000a91,0x000000fe, 2120x00000bd4,0x00000bd7,0x000200f8,0x00000bd4,
2120x00050041,0x000000fb,0x00000a94,0x000000f9, 2130x00050041,0x000006c2,0x00000bd6,0x000007a3,
2130x000000fa,0x0004003d,0x00000006,0x00000a95, 2140x00000b1e,0x0003003e,0x00000bd6,0x000000a6,
2140x00000a94,0x0007000c,0x00000006,0x00000a96, 2150x000200f9,0x00000bd7,0x000200f8,0x00000bd7,
2150x00000001,0x00000026,0x00000a93,0x00000a95, 2160x000400e0,0x00000170,0x00000170,0x000006da,
2160x00050080,0x00000006,0x00000a99,0x00000a91, 2170x00050084,0x00000006,0x00000bd9,0x00000b1b,
2170x000009f7,0x000200f9,0x00000a9a,0x000200f8, 2180x00000101,0x00050080,0x00000006,0x00000bdb,
2180x00000a9a,0x000700f5,0x00000006,0x00002b52, 2190x00000bd9,0x00000101,0x00050041,0x000000fe,
2190x00000a99,0x00000a8f,0x00000aac,0x00000aaa, 2200x00000bdc,0x000000fc,0x000000fd,0x0004003d,
2200x000500b0,0x0000002f,0x00000a9e,0x00002b52, 2210x00000006,0x00000bdd,0x00000bdc,0x0007000c,
2210x00000a96,0x000400f6,0x00000aad,0x00000aaa, 2220x00000006,0x00000bde,0x00000001,0x00000026,
2220x00000000,0x000400fa,0x00000a9e,0x00000a9f, 2230x00000bdb,0x00000bdd,0x00050080,0x00000006,
2230x00000aad,0x000200f8,0x00000a9f,0x00050041, 2240x00000be1,0x00000bd9,0x00000b1e,0x000200f9,
2240x000000fb,0x00000ac3,0x000000f9,0x00000305, 2250x00000be2,0x000200f8,0x00000be2,0x000700f5,
2250x0004003d,0x00000006,0x00000ac4,0x00000ac3, 2260x00000006,0x00003177,0x00000be1,0x00000bd7,
2260x000500c7,0x00000006,0x00000ac5,0x00000ac4, 2270x00000bf4,0x00000bf2,0x000500b0,0x0000002f,
2270x000000ad,0x000500aa,0x0000002f,0x00000ac6, 2280x00000be6,0x00003177,0x00000bde,0x000400f6,
2280x00000ac5,0x000000a3,0x000300f7,0x00000acb, 2290x00000bf5,0x00000bf2,0x00000000,0x000400fa,
2290x00000000,0x000400fa,0x00000ac6,0x00000ac7, 2300x00000be6,0x00000be7,0x00000bf5,0x000200f8,
2300x00000ac9,0x000200f8,0x00000ac7,0x000200f9, 2310x00000be7,0x00050041,0x000000fe,0x00000c0b,
2310x00000acb,0x000200f8,0x00000ac9,0x00050084, 2320x000000fc,0x00000308,0x0004003d,0x00000006,
2320x00000006,0x00000ad3,0x0000010e,0x00000a95, 2330x00000c0c,0x00000c0b,0x000500c7,0x00000006,
2330x00050080,0x00000006,0x00000ad4,0x00000104, 2340x00000c0d,0x00000c0c,0x000000b0,0x000500aa,
2340x00000ad3,0x000200f9,0x00000acb,0x000200f8, 2350x0000002f,0x00000c0e,0x00000c0d,0x000000a6,
2350x00000acb,0x000700f5,0x00000006,0x00002b53, 2360x000300f7,0x00000c13,0x00000000,0x000400fa,
2360x00000104,0x00000ac7,0x00000ad4,0x00000ac9, 2370x00000c0e,0x00000c0f,0x00000c11,0x000200f8,
2370x00050084,0x00000006,0x00000aa2,0x00000107, 2380x00000c0f,0x000200f9,0x00000c13,0x000200f8,
2380x00002b52,0x00050080,0x00000006,0x00000aa3, 2390x00000c11,0x00050084,0x00000006,0x00000c1b,
2390x00002b53,0x00000aa2,0x00050041,0x00000153, 2400x00000111,0x00000bdd,0x00050080,0x00000006,
2400x00000aa4,0x000000f9,0x00000151,0x0004003d, 2410x00000c1c,0x00000107,0x00000c1b,0x000200f9,
2410x00000007,0x00000aa5,0x00000aa4,0x00050051, 2420x00000c13,0x000200f8,0x00000c13,0x000700f5,
2420x00000006,0x00000aeb,0x00000aa5,0x00000000, 2430x00000006,0x00003178,0x00000107,0x00000c0f,
2430x00050095,0x000000a8,0x00000aed,0x00000aeb, 2440x00000c1c,0x00000c11,0x00050084,0x00000006,
2440x00000aa3,0x00050051,0x00000006,0x00000aee, 2450x00000bea,0x0000010a,0x00003177,0x00050080,
2450x00000aed,0x00000001,0x00050051,0x00000006, 2460x00000006,0x00000beb,0x00003178,0x00000bea,
2460x00000aef,0x00000aed,0x00000000,0x00050051, 2470x00050041,0x00000156,0x00000bec,0x000000fc,
2470x00000006,0x00000af2,0x00000aa5,0x00000001, 2480x00000154,0x0004003d,0x00000007,0x00000bed,
2480x00050080,0x00000006,0x00000af4,0x00000af2, 2490x00000bec,0x00050051,0x00000006,0x00000c33,
2490x00000aee,0x00050050,0x00000007,0x00000af5, 2500x00000bed,0x00000000,0x00050095,0x000000ab,
2500x00000aef,0x00000af4,0x0004007c,0x00000014, 2510x00000c35,0x00000c33,0x00000beb,0x00050051,
2510x00000ae5,0x00000af5,0x00060041,0x000000d8, 2520x00000006,0x00000c36,0x00000c35,0x00000001,
2520x00000adc,0x00000ae5,0x000000d7,0x000000d7, 2530x00050051,0x00000006,0x00000c37,0x00000c35,
2530x0006003d,0x00000006,0x00000add,0x00000adc, 2540x00000000,0x00050051,0x00000006,0x00000c3a,
2550x00000bed,0x00000001,0x00050080,0x00000006,
2560x00000c3c,0x00000c3a,0x00000c36,0x00050050,
2570x00000007,0x00000c3d,0x00000c37,0x00000c3c,
2580x0004007c,0x00000014,0x00000c2d,0x00000c3d,
2590x00060041,0x000000db,0x00000c24,0x00000c2d,
2600x000000da,0x000000da,0x0006003d,0x00000006,
2610x00000c25,0x00000c24,0x00000002,0x00000004,
2620x00050084,0x00000006,0x00000c43,0x0000010a,
2630x00000c0c,0x000500c2,0x00000006,0x00000c44,
2640x00000c25,0x00000c43,0x000500c7,0x00000006,
2650x00000c45,0x00000c44,0x00000799,0x00050041,
2660x000006c2,0x00000bf0,0x000007a3,0x00000c45,
2670x000700ea,0x00000006,0x00000bf1,0x00000bf0,
2680x000000b0,0x000000a6,0x000000b0,0x000200f9,
2690x00000bf2,0x000200f8,0x00000bf2,0x00050080,
2700x00000006,0x00000bf4,0x00003177,0x00000107,
2710x000200f9,0x00000be2,0x000200f8,0x00000bf5,
2720x000400e0,0x00000170,0x00000170,0x000006da,
2730x000300f7,0x00000c07,0x00000000,0x000400fa,
2740x00000bd3,0x00000bf8,0x00000c07,0x000200f8,
2750x00000bf8,0x00050084,0x00000006,0x00000c4a,
2760x0000011f,0x00000bdd,0x00050080,0x00000006,
2770x00000c4b,0x00000107,0x00000c4a,0x00050080,
2780x00000006,0x00000c51,0x00000bdd,0x0000319c,
2790x00050086,0x00000006,0x00000c52,0x00000c51,
2800x00000101,0x00050084,0x00000006,0x00000bfc,
2810x00000b1e,0x00000c52,0x00050080,0x00000006,
2820x00000bfe,0x00000bfc,0x00000b1b,0x00050084,
2830x00000006,0x00000bff,0x0000010a,0x00000bfe,
2840x00050080,0x00000006,0x00000c00,0x00000c4b,
2850x00000bff,0x00050041,0x00000156,0x00000c02,
2860x000000fc,0x00000154,0x0004003d,0x00000007,
2870x00000c03,0x00000c02,0x00050041,0x000006c2,
2880x00000c04,0x000007a3,0x00000b1e,0x0004003d,
2890x00000006,0x00000c05,0x00000c04,0x00050051,
2900x00000006,0x00000c68,0x00000c03,0x00000000,
2910x00050095,0x000000ab,0x00000c6a,0x00000c68,
2920x00000c00,0x00050051,0x00000006,0x00000c6b,
2930x00000c6a,0x00000001,0x00050051,0x00000006,
2940x00000c6c,0x00000c6a,0x00000000,0x00050051,
2950x00000006,0x00000c6f,0x00000c03,0x00000001,
2960x00050080,0x00000006,0x00000c71,0x00000c6f,
2970x00000c6b,0x00050050,0x00000007,0x00000c72,
2980x00000c6c,0x00000c71,0x0004007c,0x00000014,
2990x00000c62,0x00000c72,0x00060041,0x000000db,
3000x00000c5a,0x00000c62,0x000000da,0x000000da,
3010x0005003e,0x00000c5a,0x00000c05,0x00000002,
3020x00000004,0x000200f9,0x00000c07,0x000200f8,
3030x00000c07,0x000200f9,0x00000bb6,0x000200f8,
3040x00000b16,0x000500aa,0x0000002f,0x00000b23,
3050x00000b13,0x00000111,0x000300f7,0x00000b25,
3060x00000000,0x000400fa,0x00000b23,0x00000b24,
3070x00000b25,0x000200f8,0x00000b24,0x00050041,
3080x00000b0f,0x00000b27,0x00000b18,0x000000a6,
3090x0004003d,0x00000006,0x00000b28,0x00000b27,
3100x00050041,0x000000fe,0x00000ce5,0x000000fc,
3110x000000fd,0x0004003d,0x00000006,0x00000ce6,
3120x00000ce5,0x00050080,0x00000006,0x00000ce8,
3130x00000ce6,0x0000319c,0x00050086,0x00000006,
3140x00000ce9,0x00000ce8,0x00000101,0x00050084,
3150x00000006,0x00000c88,0x0000011f,0x00000ce9,
3160x00050080,0x00000006,0x00000c8a,0x00000c88,
3170x000007e4,0x00050086,0x00000006,0x00000c8b,
3180x00000c8a,0x00000107,0x00050084,0x00000006,
3190x00000c8e,0x00000b28,0x00000c8b,0x0007000c,
3200x00000006,0x00000c90,0x00000001,0x00000026,
3210x00000c8e,0x00000c88,0x00050080,0x00000006,
3220x00000c93,0x00000c90,0x00000c8b,0x0007000c,
3230x00000006,0x00000c95,0x00000001,0x00000026,
3240x00000c93,0x00000c88,0x000200f9,0x00000c97,
3250x000200f8,0x00000c97,0x000700f5,0x00000006,
3260x00003172,0x000000a6,0x00000b24,0x00000ca5,
3270x00000c9c,0x000700f5,0x00000006,0x00003171,
3280x00000c90,0x00000b24,0x00000ca8,0x00000c9c,
3290x000500b0,0x0000002f,0x00000c9b,0x00003171,
3300x00000c95,0x000400f6,0x00000ca9,0x00000c9c,
3310x00000000,0x000400fa,0x00000c9b,0x00000c9c,
3320x00000ca9,0x000200f8,0x00000c9c,0x00050084,
3330x00000006,0x00000cee,0x0000011f,0x00000ce6,
3340x00050080,0x00000006,0x00000cef,0x00000107,
3350x00000cee,0x00050084,0x00000006,0x00000c9f,
3360x0000010a,0x00003171,0x00050080,0x00000006,
3370x00000ca0,0x00000cef,0x00000c9f,0x00050041,
3380x00000156,0x00000ca1,0x000000fc,0x00000154,
3390x0004003d,0x00000007,0x00000ca2,0x00000ca1,
3400x00050051,0x00000006,0x00000d06,0x00000ca2,
3410x00000000,0x00050095,0x000000ab,0x00000d08,
3420x00000d06,0x00000ca0,0x00050051,0x00000006,
3430x00000d09,0x00000d08,0x00000001,0x00050051,
3440x00000006,0x00000d0a,0x00000d08,0x00000000,
3450x00050051,0x00000006,0x00000d0d,0x00000ca2,
3460x00000001,0x00050080,0x00000006,0x00000d0f,
3470x00000d0d,0x00000d09,0x00050050,0x00000007,
3480x00000d10,0x00000d0a,0x00000d0f,0x0004007c,
3490x00000014,0x00000d00,0x00000d10,0x00060041,
3500x000000db,0x00000cf7,0x00000d00,0x000000da,
3510x000000da,0x0006003d,0x00000006,0x00000cf8,
3520x00000cf7,0x00000002,0x00000004,0x00050080,
3530x00000006,0x00000ca5,0x00003172,0x00000cf8,
3540x00050080,0x00000006,0x00000ca8,0x00003171,
3550x00000154,0x000200f9,0x00000c97,0x000200f8,
3560x00000ca9,0x00050041,0x000006c2,0x00000cac,
3570x0000080d,0x00000b28,0x0003003e,0x00000cac,
3580x00003172,0x000400e0,0x00000170,0x00000170,
3590x000006da,0x000500aa,0x0000002f,0x00000cae,
3600x00000b28,0x000000a6,0x000300f7,0x00000cc2,
3610x00000000,0x000400fa,0x00000cae,0x00000caf,
3620x00000cc2,0x000200f8,0x00000caf,0x000200f9,
3630x00000cb0,0x000200f8,0x00000cb0,0x000700f5,
3640x00000006,0x00003176,0x000000a6,0x00000caf,
3650x00000cbd,0x00000cb4,0x000700f5,0x00000006,
3660x00003173,0x000000a6,0x00000caf,0x00000cc0,
3670x00000cb4,0x000500b0,0x0000002f,0x00000cb3,
3680x00003173,0x00000107,0x000400f6,0x00000cc1,
3690x00000cb4,0x00000000,0x000400fa,0x00000cb3,
3700x00000cb4,0x00000cc1,0x000200f8,0x00000cb4,
3710x00050041,0x000006c2,0x00000cb6,0x0000080d,
3720x00003173,0x0004003d,0x00000006,0x00000cb7,
3730x00000cb6,0x0003003e,0x00000cb6,0x00003176,
3740x00050080,0x00000006,0x00000cbd,0x00003176,
3750x00000cb7,0x00050080,0x00000006,0x00000cc0,
3760x00003173,0x00000154,0x000200f9,0x00000cb0,
3770x000200f8,0x00000cc1,0x000200f9,0x00000cc2,
3780x000200f8,0x00000cc2,0x000400e0,0x00000170,
3790x00000170,0x000006da,0x0004003d,0x00000006,
3800x00000cc5,0x00000cac,0x000200f9,0x00000cc7,
3810x000200f8,0x00000cc7,0x000700f5,0x00000006,
3820x00003175,0x00000cc5,0x00000cc2,0x00000cde,
3830x00000ccc,0x000700f5,0x00000006,0x00003174,
3840x00000c90,0x00000cc2,0x00000ce1,0x00000ccc,
3850x000500b0,0x0000002f,0x00000ccb,0x00003174,
3860x00000c95,0x000400f6,0x00000ce2,0x00000ccc,
3870x00000000,0x000400fa,0x00000ccb,0x00000ccc,
3880x00000ce2,0x000200f8,0x00000ccc,0x00050084,
3890x00000006,0x00000d15,0x0000011f,0x00000ce6,
3900x00050080,0x00000006,0x00000d16,0x00000107,
3910x00000d15,0x00050084,0x00000006,0x00000ccf,
3920x0000010a,0x00003174,0x00050080,0x00000006,
3930x00000cd0,0x00000d16,0x00000ccf,0x00050041,
3940x00000156,0x00000cd1,0x000000fc,0x00000154,
3950x0004003d,0x00000007,0x00000cd2,0x00000cd1,
3960x00050051,0x00000006,0x00000d2d,0x00000cd2,
3970x00000000,0x00050095,0x000000ab,0x00000d2f,
3980x00000d2d,0x00000cd0,0x00050051,0x00000006,
3990x00000d30,0x00000d2f,0x00000001,0x00050051,
4000x00000006,0x00000d31,0x00000d2f,0x00000000,
4010x00050051,0x00000006,0x00000d34,0x00000cd2,
4020x00000001,0x00050080,0x00000006,0x00000d36,
4030x00000d34,0x00000d30,0x00050050,0x00000007,
4040x00000d37,0x00000d31,0x00000d36,0x0004007c,
4050x00000014,0x00000d27,0x00000d37,0x00060041,
4060x000000db,0x00000d1e,0x00000d27,0x000000da,
4070x000000da,0x0006003d,0x00000006,0x00000d1f,
4080x00000d1e,0x00000002,0x00000004,0x0005003e,
4090x00000d1e,0x00003175,0x00000002,0x00000004,
4100x00050080,0x00000006,0x00000cde,0x00003175,
4110x00000d1f,0x00050080,0x00000006,0x00000ce1,
4120x00003174,0x00000154,0x000200f9,0x00000cc7,
4130x000200f8,0x00000ce2,0x000200f9,0x00000bb6,
4140x000200f8,0x00000b25,0x000500aa,0x0000002f,
4150x00000b2d,0x00000b13,0x0000038a,0x000300f7,
4160x00000b2f,0x00000000,0x000400fa,0x00000b2d,
4170x00000b2e,0x00000b2f,0x000200f8,0x00000b2e,
4180x00050041,0x00000b0f,0x00000b31,0x00000b17,
4190x000000a6,0x0004003d,0x00000006,0x00000b32,
4200x00000b31,0x00050041,0x00000b0f,0x00000b34,
4210x00000b18,0x000000a6,0x0004003d,0x00000006,
4220x00000b35,0x00000b34,0x000500b0,0x0000002f,
4230x00000d7e,0x00000b35,0x0000011f,0x000300f7,
4240x00000d8d,0x00000000,0x000400fa,0x00000d7e,
4250x00000d7f,0x00000d8d,0x000200f8,0x00000d7f,
4260x00050041,0x000000fe,0x00000e2f,0x000000fc,
4270x000000fd,0x0004003d,0x00000006,0x00000e30,
4280x00000e2f,0x00050084,0x00000006,0x00000e31,
4290x0000011f,0x00000e30,0x00050080,0x00000006,
4300x00000e32,0x00000107,0x00000e31,0x00050080,
4310x00000006,0x00000e38,0x00000e30,0x0000319c,
4320x00050086,0x00000006,0x00000e39,0x00000e38,
4330x00000101,0x00050084,0x00000006,0x00000d84,
4340x00000b35,0x00000e39,0x00050080,0x00000006,
4350x00000d86,0x00000d84,0x00000b32,0x00050084,
4360x00000006,0x00000d87,0x0000010a,0x00000d86,
4370x00050080,0x00000006,0x00000d88,0x00000e32,
4380x00000d87,0x00050041,0x00000156,0x00000d89,
4390x000000fc,0x00000154,0x0004003d,0x00000007,
4400x00000d8a,0x00000d89,0x00050051,0x00000006,
4410x00000e50,0x00000d8a,0x00000000,0x00050095,
4420x000000ab,0x00000e52,0x00000e50,0x00000d88,
4430x00050051,0x00000006,0x00000e53,0x00000e52,
4440x00000001,0x00050051,0x00000006,0x00000e54,
4450x00000e52,0x00000000,0x00050051,0x00000006,
4460x00000e57,0x00000d8a,0x00000001,0x00050080,
4470x00000006,0x00000e59,0x00000e57,0x00000e53,
4480x00050050,0x00000007,0x00000e5a,0x00000e54,
4490x00000e59,0x0004007c,0x00000014,0x00000e4a,
4500x00000e5a,0x00060041,0x000000db,0x00000e41,
4510x00000e4a,0x000000da,0x000000da,0x0006003d,
4520x00000006,0x00000e42,0x00000e41,0x00000002,
4530x00000004,0x00050041,0x000006c2,0x00000d8c,
4540x00000856,0x00000b35,0x0003003e,0x00000d8c,
4550x00000e42,0x000200f9,0x00000d8d,0x000200f8,
4560x00000d8d,0x00050084,0x00000006,0x00000d8f,
4570x00000b32,0x00000101,0x00050080,0x00000006,
4580x00000d91,0x00000d8f,0x00000101,0x00050041,
4590x000000fe,0x00000d92,0x000000fc,0x000000fd,
4600x0004003d,0x00000006,0x00000d93,0x00000d92,
4610x0007000c,0x00000006,0x00000d94,0x00000001,
4620x00000026,0x00000d91,0x00000d93,0x000200f9,
4630x00000d96,0x000200f8,0x00000d96,0x000700f5,
4640x00000006,0x00003158,0x00000d8f,0x00000d8d,
4650x00000e2b,0x00000e29,0x000500b0,0x0000002f,
4660x00000d9a,0x00003158,0x00000d94,0x000400f6,
4670x00000e2c,0x00000e29,0x00000000,0x000400fa,
4680x00000d9a,0x00000d9b,0x00000e2c,0x000200f8,
4690x00000d9b,0x00050080,0x00000006,0x00000d9e,
4700x00003158,0x00000b35,0x000500b0,0x0000002f,
4710x00000da1,0x00000d9e,0x00000d94,0x000300f7,
4720x00000dac,0x00000000,0x000400fa,0x00000da1,
4730x00000da3,0x00000dab,0x000200f8,0x00000da3,
4740x00050041,0x000000fe,0x00000e5e,0x000000fc,
4750x00000308,0x0004003d,0x00000006,0x00000e5f,
4760x00000e5e,0x000500c7,0x00000006,0x00000e60,
4770x00000e5f,0x000000b0,0x000500aa,0x0000002f,
4780x00000e61,0x00000e60,0x000000a6,0x000300f7,
4790x00000e66,0x00000000,0x000400fa,0x00000e61,
4800x00000e62,0x00000e64,0x000200f8,0x00000e62,
4810x000200f9,0x00000e66,0x000200f8,0x00000e64,
4820x00050084,0x00000006,0x00000e6e,0x00000111,
4830x00000d93,0x00050080,0x00000006,0x00000e6f,
4840x00000107,0x00000e6e,0x000200f9,0x00000e66,
4850x000200f8,0x00000e66,0x000700f5,0x00000006,
4860x00003159,0x00000107,0x00000e62,0x00000e6f,
4870x00000e64,0x00050084,0x00000006,0x00000da6,
4880x0000010a,0x00000d9e,0x00050080,0x00000006,
4890x00000da7,0x00003159,0x00000da6,0x00050041,
4900x00000156,0x00000da8,0x000000fc,0x00000154,
4910x0004003d,0x00000007,0x00000da9,0x00000da8,
4920x00050051,0x00000006,0x00000e86,0x00000da9,
4930x00000000,0x00050095,0x000000ab,0x00000e88,
4940x00000e86,0x00000da7,0x00050051,0x00000006,
4950x00000e89,0x00000e88,0x00000001,0x00050051,
4960x00000006,0x00000e8a,0x00000e88,0x00000000,
4970x00050051,0x00000006,0x00000e8d,0x00000da9,
4980x00000001,0x00050080,0x00000006,0x00000e8f,
4990x00000e8d,0x00000e89,0x00050050,0x00000007,
5000x00000e90,0x00000e8a,0x00000e8f,0x0004007c,
5010x00000014,0x00000e80,0x00000e90,0x00060041,
5020x000000db,0x00000e77,0x00000e80,0x000000da,
5030x000000da,0x0006003d,0x00000006,0x00000e78,
5040x00000e77,0x00000002,0x00000004,0x000200f9,
5050x00000dac,0x000200f8,0x00000dab,0x000200f9,
5060x00000dac,0x000200f8,0x00000dac,0x000700f5,
5070x00000006,0x0000315a,0x00000e78,0x00000e66,
5080x000000a6,0x00000dab,0x000300f7,0x00000db8,
5090x00000000,0x000400fa,0x00000da1,0x00000daf,
5100x00000db7,0x000200f8,0x00000daf,0x00050041,
5110x000000fe,0x00000e94,0x000000fc,0x00000308,
5120x0004003d,0x00000006,0x00000e95,0x00000e94,
5130x000500c7,0x00000006,0x00000e96,0x00000e95,
5140x000000b0,0x000500aa,0x0000002f,0x00000e97,
5150x00000e96,0x000000a6,0x000300f7,0x00000e9c,
5160x00000000,0x000400fa,0x00000e97,0x00000e98,
5170x00000e9a,0x000200f8,0x00000e98,0x00050084,
5180x00000006,0x00000ea2,0x0000010a,0x00000d93,
5190x00050080,0x00000006,0x00000ea3,0x00000107,
5200x00000ea2,0x000200f9,0x00000e9c,0x000200f8,
5210x00000e9a,0x00050084,0x00000006,0x00000ea8,
5220x00000118,0x00000d93,0x00050080,0x00000006,
5230x00000ea9,0x00000107,0x00000ea8,0x000200f9,
5240x00000e9c,0x000200f8,0x00000e9c,0x000700f5,
5250x00000006,0x0000315b,0x00000ea3,0x00000e98,
5260x00000ea9,0x00000e9a,0x00050084,0x00000006,
5270x00000db2,0x0000010a,0x00000d9e,0x00050080,
5280x00000006,0x00000db3,0x0000315b,0x00000db2,
5290x00050041,0x00000156,0x00000db4,0x000000fc,
5300x00000154,0x0004003d,0x00000007,0x00000db5,
5310x00000db4,0x00050051,0x00000006,0x00000ec0,
5320x00000db5,0x00000000,0x00050095,0x000000ab,
5330x00000ec2,0x00000ec0,0x00000db3,0x00050051,
5340x00000006,0x00000ec3,0x00000ec2,0x00000001,
5350x00050051,0x00000006,0x00000ec4,0x00000ec2,
5360x00000000,0x00050051,0x00000006,0x00000ec7,
5370x00000db5,0x00000001,0x00050080,0x00000006,
5380x00000ec9,0x00000ec7,0x00000ec3,0x00050050,
5390x00000007,0x00000eca,0x00000ec4,0x00000ec9,
5400x0004007c,0x00000014,0x00000eba,0x00000eca,
5410x00060041,0x000000db,0x00000eb1,0x00000eba,
5420x000000da,0x000000da,0x0006003d,0x00000006,
5430x00000eb2,0x00000eb1,0x00000002,0x00000004,
5440x000200f9,0x00000db8,0x000200f8,0x00000db7,
5450x000200f9,0x00000db8,0x000200f8,0x00000db8,
5460x000700f5,0x00000006,0x0000315c,0x00000eb2,
5470x00000e9c,0x000000a6,0x00000db7,0x00050041,
5480x000000fe,0x00000ece,0x000000fc,0x00000308,
5490x0004003d,0x00000006,0x00000ecf,0x00000ece,
5500x00050084,0x00000006,0x00000ed0,0x0000010a,
5510x00000ecf,0x000500c2,0x00000006,0x00000ed1,
5520x0000315a,0x00000ed0,0x000500c7,0x00000006,
5530x00000ed2,0x00000ed1,0x00000799,0x000200f9,
5540x00000dbc,0x000200f8,0x00000dbc,0x000700f5,
5550x00000006,0x0000315d,0x000000a6,0x00000db8,
5560x00000dcc,0x00000dc0,0x000500b0,0x0000002f,
5570x00000dbf,0x0000315d,0x0000011f,0x000400f6,
5580x00000dcd,0x00000dc0,0x00000000,0x000400fa,
5590x00000dbf,0x00000dc0,0x00000dcd,0x000200f8,
5600x00000dc0,0x000500aa,0x0000002f,0x00000dc6,
5610x0000315d,0x00000ed2,0x000500a7,0x0000002f,
5620x00000dc7,0x00000da1,0x00000dc6,0x000600a9,
5630x00000006,0x00000dc8,0x00000dc7,0x000000b0,
5640x000000a6,0x00060041,0x000006c2,0x00000dc9,
5650x000008af,0x0000315d,0x00000b35,0x0003003e,
5660x00000dc9,0x00000dc8,0x00050080,0x00000006,
5670x00000dcc,0x0000315d,0x00000154,0x000200f9,
5680x00000dbc,0x000200f8,0x00000dcd,0x000400e0,
5690x00000170,0x00000170,0x000006da,0x000200f9,
5700x00000dce,0x000200f8,0x00000dce,0x000700f5,
5710x00000006,0x0000315e,0x000000b0,0x00000dcd,
5720x00000dff,0x00000dfd,0x000500b0,0x0000002f,
5730x00000dd1,0x0000315e,0x00000107,0x000400f6,
5740x00000e00,0x00000dfd,0x00000000,0x000400fa,
5750x00000dd1,0x00000dd2,0x00000e00,0x000200f8,
5760x00000dd2,0x000200f9,0x00000dd3,0x000200f8,
5770x00000dd3,0x000700f5,0x00000006,0x0000316b,
5780x000000a6,0x00000dd2,0x00000de9,0x00000de7,
5790x000500b0,0x0000002f,0x00000dd6,0x0000316b,
5800x0000011f,0x000400f6,0x00000dea,0x00000de7,
5810x00000000,0x000400fa,0x00000dd6,0x00000dd7,
5820x00000dea,0x000200f8,0x00000dd7,0x000500ae,
5830x0000002f,0x00000ddb,0x00000b35,0x0000315e,
5840x000300f7,0x00000de4,0x00000000,0x000400fa,
5850x00000ddb,0x00000ddc,0x00000de3,0x000200f8,
5860x00000ddc,0x00050082,0x00000006,0x00000de0,
5870x00000b35,0x0000315e,0x00060041,0x000006c2,
5880x00000de1,0x000008af,0x0000316b,0x00000de0,
5890x0004003d,0x00000006,0x00000de2,0x00000de1,
5900x000200f9,0x00000de4,0x000200f8,0x00000de3,
5910x000200f9,0x00000de4,0x000200f8,0x00000de4,
5920x000700f5,0x00000006,0x0000316f,0x00000de2,
5930x00000ddc,0x000000a6,0x00000de3,0x00050041,
5940x00000009,0x00000de6,0x00000d72,0x0000316b,
5950x0003003e,0x00000de6,0x0000316f,0x000200f9,
5960x00000de7,0x000200f8,0x00000de7,0x00050080,
5970x00000006,0x00000de9,0x0000316b,0x00000154,
5980x000200f9,0x00000dd3,0x000200f8,0x00000dea,
5990x000400e0,0x00000170,0x00000170,0x000006da,
6000x000200f9,0x00000deb,0x000200f8,0x00000deb,
6010x000700f5,0x00000006,0x0000316c,0x000000a6,
6020x00000dea,0x00000dfb,0x00000def,0x000500b0,
6030x0000002f,0x00000dee,0x0000316c,0x0000011f,
6040x000400f6,0x00000dfc,0x00000def,0x00000000,
6050x000400fa,0x00000dee,0x00000def,0x00000dfc,
6060x000200f8,0x00000def,0x00050041,0x00000009,
6070x00000df3,0x00000d72,0x0000316c,0x0004003d,
6080x00000006,0x00000df4,0x00000df3,0x00060041,
6090x000006c2,0x00000df5,0x000008af,0x0000316c,
6100x00000b35,0x0004003d,0x00000006,0x00000df6,
6110x00000df5,0x00050080,0x00000006,0x00000df7,
6120x00000df6,0x00000df4,0x0003003e,0x00000df5,
6130x00000df7,0x00050080,0x00000006,0x00000dfb,
6140x0000316c,0x00000154,0x000200f9,0x00000deb,
6150x000200f8,0x00000dfc,0x000400e0,0x00000170,
6160x00000170,0x000006da,0x000200f9,0x00000dfd,
6170x000200f8,0x00000dfd,0x000500c4,0x00000006,
6180x00000dff,0x0000315e,0x00000154,0x000200f9,
6190x00000dce,0x000200f8,0x00000e00,0x000300f7,
6200x00000e1c,0x00000000,0x000400fa,0x00000da1,
6210x00000e02,0x00000e1c,0x000200f8,0x00000e02,
6220x00050041,0x000006c2,0x00000e04,0x00000856,
6230x00000ed2,0x0004003d,0x00000006,0x00000e05,
6240x00000e04,0x00060041,0x000006c2,0x00000e08,
6250x000008af,0x00000ed2,0x00000b35,0x0004003d,
6260x00000006,0x00000e09,0x00000e08,0x00050080,
6270x00000006,0x00000e0a,0x00000e05,0x00000e09,
6280x00050082,0x00000006,0x00000e0b,0x00000e0a,
6290x000000b0,0x000500c7,0x00000006,0x00000ed8,
6300x00000ecf,0x000000b0,0x000500aa,0x0000002f,
6310x00000ed9,0x00000ed8,0x000000a6,0x000300f7,
6320x00000ede,0x00000000,0x000400fa,0x00000ed9,
6330x00000eda,0x00000edc,0x000200f8,0x00000eda,
6340x00050084,0x00000006,0x00000ee4,0x00000111,
6350x00000d93,0x00050080,0x00000006,0x00000ee5,
6360x00000107,0x00000ee4,0x000200f9,0x00000ede,
6370x000200f8,0x00000edc,0x000200f9,0x00000ede,
6380x000200f8,0x00000ede,0x000700f5,0x00000006,
6390x0000315f,0x00000ee5,0x00000eda,0x00000107,
6400x00000edc,0x00050084,0x00000006,0x00000e0e,
6410x0000010a,0x00000e0b,0x00050080,0x00000006,
6420x00000e0f,0x0000315f,0x00000e0e,0x00050041,
6430x00000156,0x00000e10,0x000000fc,0x00000154,
6440x0004003d,0x00000007,0x00000e11,0x00000e10,
6450x00050051,0x00000006,0x00000efd,0x00000e11,
6460x00000000,0x00050095,0x000000ab,0x00000eff,
6470x00000efd,0x00000e0f,0x00050051,0x00000006,
6480x00000f00,0x00000eff,0x00000001,0x00050051,
6490x00000006,0x00000f01,0x00000eff,0x00000000,
6500x00050051,0x00000006,0x00000f04,0x00000e11,
6510x00000001,0x00050080,0x00000006,0x00000f06,
6520x00000f04,0x00000f00,0x00050050,0x00000007,
6530x00000f07,0x00000f01,0x00000f06,0x0004007c,
6540x00000014,0x00000ef7,0x00000f07,0x00060041,
6550x000000db,0x00000eef,0x00000ef7,0x000000da,
6560x000000da,0x0005003e,0x00000eef,0x0000315a,
6570x00000002,0x00000004,0x000300f7,0x00000f13,
6580x00000000,0x000400fa,0x00000ed9,0x00000f0f,
6590x00000f11,0x000200f8,0x00000f0f,0x00050084,
6600x00000006,0x00000f19,0x00000118,0x00000d93,
6610x00050080,0x00000006,0x00000f1a,0x00000107,
6620x00000f19,0x000200f9,0x00000f13,0x000200f8,
6630x00000f11,0x00050084,0x00000006,0x00000f1f,
6640x0000010a,0x00000d93,0x00050080,0x00000006,
6650x00000f20,0x00000107,0x00000f1f,0x000200f9,
6660x00000f13,0x000200f8,0x00000f13,0x000700f5,
6670x00000006,0x00003160,0x00000f1a,0x00000f0f,
6680x00000f20,0x00000f11,0x00050080,0x00000006,
6690x00000e17,0x00003160,0x00000e0e,0x00050095,
6700x000000ab,0x00000f38,0x00000efd,0x00000e17,
6710x00050051,0x00000006,0x00000f39,0x00000f38,
6720x00000001,0x00050051,0x00000006,0x00000f3a,
6730x00000f38,0x00000000,0x00050080,0x00000006,
6740x00000f3f,0x00000f04,0x00000f39,0x00050050,
6750x00000007,0x00000f40,0x00000f3a,0x00000f3f,
6760x0004007c,0x00000014,0x00000f30,0x00000f40,
6770x00060041,0x000000db,0x00000f28,0x00000f30,
6780x000000da,0x000000da,0x0005003e,0x00000f28,
6790x0000315c,0x00000002,0x00000004,0x000200f9,
6800x00000e1c,0x000200f8,0x00000e1c,0x000400e0,
6810x00000170,0x00000170,0x000006da,0x000300f7,
6820x00000e28,0x00000000,0x000400fa,0x00000d7e,
6830x00000e1f,0x00000e28,0x000200f8,0x00000e1f,
6840x00060041,0x000006c2,0x00000e22,0x000008af,
6850x00000b35,0x0000091d,0x0004003d,0x00000006,
6860x00000e23,0x00000e22,0x00050041,0x000006c2,
6870x00000e24,0x00000856,0x00000b35,0x0004003d,
6880x00000006,0x00000e25,0x00000e24,0x00050080,
6890x00000006,0x00000e26,0x00000e25,0x00000e23,
6900x0003003e,0x00000e24,0x00000e26,0x000200f9,
6910x00000e28,0x000200f8,0x00000e28,0x000400e0,
6920x00000170,0x00000170,0x000006da,0x000200f9,
6930x00000e29,0x000200f8,0x00000e29,0x00050080,
6940x00000006,0x00000e2b,0x00003158,0x00000107,
6950x000200f9,0x00000d96,0x000200f8,0x00000e2c,
6960x000200f9,0x00000bb6,0x000200f8,0x00000b2f,
6970x000500aa,0x0000002f,0x00000b3b,0x00000b13,
6980x00000b3a,0x000300f7,0x00000b3d,0x00000000,
6990x000400fa,0x00000b3b,0x00000b3c,0x00000b3d,
7000x000200f8,0x00000b3c,0x00050041,0x00000b0f,
7010x00000b3f,0x00000b18,0x000000a6,0x0004003d,
7020x00000006,0x00000b40,0x00000b3f,0x00050041,
7030x000000fe,0x00000f5b,0x000000fc,0x000000fd,
7040x0004003d,0x00000006,0x00000f5c,0x00000f5b,
7050x000200f9,0x00000f5d,0x000200f8,0x00000f5d,
7060x000700f5,0x00000006,0x00003143,0x000000b0,
7070x00000b3c,0x00000f64,0x00000f62,0x000500b0,
7080x0000002f,0x00000f61,0x00003143,0x00000f5c,
7090x000400f6,0x00000f66,0x00000f62,0x00000000,
7100x000400fa,0x00000f61,0x00000f62,0x00000f66,
7110x000200f8,0x00000f62,0x000500c4,0x00000006,
7120x00000f64,0x00003143,0x00000154,0x000200f9,
7130x00000f5d,0x000200f8,0x00000f66,0x000200f9,
7140x00000f68,0x000200f8,0x00000f68,0x000700f5,
7150x00000006,0x00003144,0x00000b40,0x00000f66,
7160x00000f90,0x00000f8e,0x000500b0,0x0000002f,
7170x00000f6c,0x00003144,0x00003143,0x000400f6,
7180x00000f91,0x00000f8e,0x00000000,0x000400fa,
7190x00000f6c,0x00000f6d,0x00000f91,0x000200f8,
7200x00000f6d,0x000500b0,0x0000002f,0x00000f71,
7210x00003144,0x00000f5c,0x000300f7,0x00000f7b,
7220x00000000,0x000400fa,0x00000f71,0x00000f72,
7230x00000f7a,0x000200f8,0x00000f72,0x00050084,
7240x00000006,0x00000f75,0x0000010a,0x00003144,
7250x00050080,0x00000006,0x00000f76,0x00000107,
7260x00000f75,0x00050041,0x00000156,0x00000f77,
7270x000000fc,0x00000154,0x0004003d,0x00000007,
7280x00000f78,0x00000f77,0x00050051,0x00000006,
7290x0000101f,0x00000f78,0x00000000,0x00050095,
7300x000000ab,0x00001021,0x0000101f,0x00000f76,
7310x00050051,0x00000006,0x00001022,0x00001021,
7320x00000001,0x00050051,0x00000006,0x00001023,
7330x00001021,0x00000000,0x00050051,0x00000006,
7340x00001026,0x00000f78,0x00000001,0x00050080,
7350x00000006,0x00001028,0x00001026,0x00001022,
7360x00050050,0x00000007,0x00001029,0x00001023,
7370x00001028,0x0004007c,0x00000014,0x00001019,
7380x00001029,0x00060041,0x000000db,0x00001010,
7390x00001019,0x000000da,0x000000da,0x0006003d,
7400x00000006,0x00001011,0x00001010,0x00000002,
7410x00000004,0x000200f9,0x00000f7b,0x000200f8,
7420x00000f7a,0x000200f9,0x00000f7b,0x000200f8,
7430x00000f7b,0x000700f5,0x00000006,0x00003154,
7440x00001011,0x00000f72,0x00000380,0x00000f7a,
7450x00050041,0x000006c2,0x00000f7d,0x000006af,
7460x00003144,0x0003003e,0x00000f7d,0x00003154,
7470x000300f7,0x00000f8b,0x00000000,0x000400fa,
7480x00000f71,0x00000f82,0x00000f8a,0x000200f8,
7490x00000f82,0x00050084,0x00000006,0x0000102e,
7500x0000010a,0x00000f5c,0x00050080,0x00000006,
7510x0000102f,0x00000107,0x0000102e,0x00050084,
7520x00000006,0x00000f85,0x0000010a,0x00003144,
7530x00050080,0x00000006,0x00000f86,0x0000102f,
7540x00000f85,0x00050041,0x00000156,0x00000f87,
7550x000000fc,0x00000154,0x0004003d,0x00000007,
7560x00000f88,0x00000f87,0x00050051,0x00000006,
7570x00001046,0x00000f88,0x00000000,0x00050095,
7580x000000ab,0x00001048,0x00001046,0x00000f86,
7590x00050051,0x00000006,0x00001049,0x00001048,
7600x00000001,0x00050051,0x00000006,0x0000104a,
7610x00001048,0x00000000,0x00050051,0x00000006,
7620x0000104d,0x00000f88,0x00000001,0x00050080,
7630x00000006,0x0000104f,0x0000104d,0x00001049,
7640x00050050,0x00000007,0x00001050,0x0000104a,
7650x0000104f,0x0004007c,0x00000014,0x00001040,
7660x00001050,0x00060041,0x000000db,0x00001037,
7670x00001040,0x000000da,0x000000da,0x0006003d,
7680x00000006,0x00001038,0x00001037,0x00000002,
7690x00000004,0x000200f9,0x00000f8b,0x000200f8,
7700x00000f8a,0x000200f9,0x00000f8b,0x000200f8,
7710x00000f8b,0x000700f5,0x00000006,0x00003156,
7720x00001038,0x00000f82,0x00000380,0x00000f8a,
7730x00050041,0x000006c2,0x00000f8d,0x000006c4,
7740x00003144,0x0003003e,0x00000f8d,0x00003156,
7750x000200f9,0x00000f8e,0x000200f8,0x00000f8e,
7760x00050080,0x00000006,0x00000f90,0x00003144,
7770x00000107,0x000200f9,0x00000f68,0x000200f8,
7780x00000f91,0x000400e0,0x00000170,0x00000170,
7790x000006da,0x000200f9,0x00000f92,0x000200f8,
7800x00000f92,0x000700f5,0x00000006,0x00003146,
7810x00000170,0x00000f91,0x00000fe6,0x00000fe4,
7820x000500b2,0x0000002f,0x00000f96,0x00003146,
7830x00003143,0x000400f6,0x00000fe7,0x00000fe4,
7840x00000000,0x000400fa,0x00000f96,0x00000f97,
7850x00000fe7,0x000200f8,0x00000f97,0x000500c2,
7860x00000006,0x00000f99,0x00003146,0x00000154,
7870x000200f9,0x00000f9a,0x000200f8,0x00000f9a,
7880x000700f5,0x00000006,0x00003149,0x00000f99,
7890x00000f97,0x00000fe2,0x00000fe0,0x000500ac,
7900x0000002f,0x00000f9d,0x00003149,0x000000a6,
7910x000400f6,0x00000fe3,0x00000fe0,0x00000000,
7920x000400fa,0x00000f9d,0x00000f9e,0x00000fe3,
7930x000200f8,0x00000f9e,0x000200f9,0x00000fa0,
7940x000200f8,0x00000fa0,0x000700f5,0x00000006,
7950x0000314b,0x00000b40,0x00000f9e,0x00000fde,
7960x00000fdc,0x000500b0,0x0000002f,0x00000fa4,
7970x0000314b,0x00003143,0x000400f6,0x00000fdf,
7980x00000fdc,0x00000000,0x000400fa,0x00000fa4,
7990x00000fa5,0x00000fdf,0x000200f8,0x00000fa5,
8000x000500c6,0x00000006,0x00000fa8,0x0000314b,
8010x00003149,0x000500ac,0x0000002f,0x00000fab,
8020x00000fa8,0x0000314b,0x000300f7,0x00000fdb,
8030x00000000,0x000400fa,0x00000fab,0x00000fac,
8040x00000fdb,0x000200f8,0x00000fac,0x00050041,
8050x000006c2,0x00000fae,0x000006af,0x0000314b,
8060x0004003d,0x00000006,0x00000faf,0x00000fae,
8070x00050041,0x000006c2,0x00000fb1,0x000006af,
8080x00000fa8,0x0004003d,0x00000006,0x00000fb2,
8090x00000fb1,0x00050041,0x000006c2,0x00000fb4,
8100x000006c4,0x0000314b,0x0004003d,0x00000006,
8110x00000fb5,0x00000fb4,0x00050041,0x000006c2,
8120x00000fb7,0x000006c4,0x00000fa8,0x0004003d,
8130x00000006,0x00000fb8,0x00000fb7,0x000500ac,
8140x0000002f,0x00000fbb,0x00000faf,0x00000fb2,
8150x000400a8,0x0000002f,0x00000fbc,0x00000fbb,
8160x000300f7,0x00000fc5,0x00000000,0x000400fa,
8170x00000fbc,0x00000fbd,0x00000fc5,0x000200f8,
8180x00000fbd,0x000500aa,0x0000002f,0x00000fc0,
8190x00000faf,0x00000fb2,0x000500ac,0x0000002f,
8200x00000fc3,0x00000fb5,0x00000fb8,0x000500a7,
8210x0000002f,0x00000fc4,0x00000fc0,0x00000fc3,
8220x000200f9,0x00000fc5,0x000200f8,0x00000fc5,
8230x000700f5,0x0000002f,0x00000fc6,0x00000fbb,
8240x00000fac,0x00000fc4,0x00000fbd,0x000500c7,
8250x00000006,0x00000fca,0x0000314b,0x00003146,
8260x000500aa,0x0000002f,0x00000fcb,0x00000fca,
8270x000000a6,0x000500a4,0x0000002f,0x00000fcc,
8280x00000fc6,0x00000fcb,0x000300f7,0x00000fda,
8290x00000000,0x000400fa,0x00000fcc,0x00000fcd,
8300x00000fda,0x000200f8,0x00000fcd,0x0003003e,
8310x00000fae,0x00000fb2,0x0003003e,0x00000fb1,
8320x00000faf,0x0003003e,0x00000fb4,0x00000fb8,
8330x0003003e,0x00000fb7,0x00000fb5,0x000200f9,
8340x00000fda,0x000200f8,0x00000fda,0x000200f9,
8350x00000fdb,0x000200f8,0x00000fdb,0x000200f9,
8360x00000fdc,0x000200f8,0x00000fdc,0x00050080,
8370x00000006,0x00000fde,0x0000314b,0x00000107,
8380x000200f9,0x00000fa0,0x000200f8,0x00000fdf,
8390x000400e0,0x00000170,0x00000170,0x000006da,
8400x000200f9,0x00000fe0,0x000200f8,0x00000fe0,
8410x000500c2,0x00000006,0x00000fe2,0x00003149,
8420x00000154,0x000200f9,0x00000f9a,0x000200f8,
8430x00000fe3,0x000200f9,0x00000fe4,0x000200f8,
8440x00000fe4,0x000500c4,0x00000006,0x00000fe6,
8450x00003146,0x00000154,0x000200f9,0x00000f92,
8460x000200f8,0x00000fe7,0x000200f9,0x00000fe9,
8470x000200f8,0x00000fe9,0x000700f5,0x00000006,
8480x00003148,0x00000b40,0x00000fe7,0x00001005,
8490x00000fee,0x000500b0,0x0000002f,0x00000fed,
8500x00003148,0x00000f5c,0x000400f6,0x00001006,
8510x00000fee,0x00000000,0x000400fa,0x00000fed,
8520x00000fee,0x00001006,0x000200f8,0x00000fee,
8530x00050084,0x00000006,0x00000ff1,0x0000010a,
8540x00003148,0x00050080,0x00000006,0x00000ff2,
8550x00000107,0x00000ff1,0x00050041,0x00000156,
8560x00000ff4,0x000000fc,0x00000154,0x0004003d,
8570x00000007,0x00000ff5,0x00000ff4,0x00050041,
8580x000006c2,0x00000ff6,0x000006af,0x00003148,
8590x0004003d,0x00000006,0x00000ff7,0x00000ff6,
8600x00050051,0x00000006,0x00001068,0x00000ff5,
8610x00000000,0x00050095,0x000000ab,0x0000106a,
8620x00001068,0x00000ff2,0x00050051,0x00000006,
8630x0000106b,0x0000106a,0x00000001,0x00050051,
8640x00000006,0x0000106c,0x0000106a,0x00000000,
8650x00050051,0x00000006,0x0000106f,0x00000ff5,
8660x00000001,0x00050080,0x00000006,0x00001071,
8670x0000106f,0x0000106b,0x00050050,0x00000007,
8680x00001072,0x0000106c,0x00001071,0x0004007c,
8690x00000014,0x00001062,0x00001072,0x00060041,
8700x000000db,0x0000105a,0x00001062,0x000000da,
8710x000000da,0x0005003e,0x0000105a,0x00000ff7,
2540x00000002,0x00000004,0x00050084,0x00000006, 8720x00000002,0x00000004,0x00050084,0x00000006,
2550x00000afb,0x00000107,0x00000ac4,0x000500c2, 8730x00001077,0x0000010a,0x00000f5c,0x00050080,
2560x00000006,0x00000afc,0x00000add,0x00000afb, 8740x00000006,0x00001078,0x00000107,0x00001077,
2570x000500c7,0x00000006,0x00000afd,0x00000afc, 8750x00050080,0x00000006,0x00000ffc,0x00001078,
2580x000006ca,0x00050041,0x000006d6,0x00000aa8, 8760x00000ff1,0x00050041,0x000006c2,0x00001000,
2590x000006d4,0x00000afd,0x000700ea,0x00000006, 8770x000006c4,0x00003148,0x0004003d,0x00000006,
2600x00000aa9,0x00000aa8,0x000000ad,0x000000a3, 8780x00001001,0x00001000,0x00050095,0x000000ab,
2610x000000ad,0x000200f9,0x00000aaa,0x000200f8, 8790x00001090,0x00001068,0x00000ffc,0x00050051,
2620x00000aaa,0x00050080,0x00000006,0x00000aac, 8800x00000006,0x00001091,0x00001090,0x00000001,
2630x00002b52,0x00000104,0x000200f9,0x00000a9a, 8810x00050051,0x00000006,0x00001092,0x00001090,
2640x000200f8,0x00000aad,0x000400e0,0x0000016d, 8820x00000000,0x00050080,0x00000006,0x00001097,
2650x0000016d,0x000006d8,0x000300f7,0x00000abf, 8830x0000106f,0x00001091,0x00050050,0x00000007,
2660x00000000,0x000400fa,0x00000a8b,0x00000ab0, 8840x00001098,0x00001092,0x00001097,0x0004007c,
2670x00000abf,0x000200f8,0x00000ab0,0x00050084, 8850x00000014,0x00001088,0x00001098,0x00060041,
2680x00000006,0x00000b02,0x0000011c,0x00000a95, 8860x000000db,0x00001080,0x00001088,0x000000da,
2690x00050080,0x00000006,0x00000b03,0x00000104, 8870x000000da,0x0005003e,0x00001080,0x00001001,
2700x00000b02,0x00050080,0x00000006,0x00000b09,
2710x00000a95,0x00002b67,0x00050086,0x00000006,
2720x00000b0a,0x00000b09,0x000000fe,0x00050084,
2730x00000006,0x00000ab4,0x000009f7,0x00000b0a,
2740x00050080,0x00000006,0x00000ab6,0x00000ab4,
2750x000009f4,0x00050084,0x00000006,0x00000ab7,
2760x00000107,0x00000ab6,0x00050080,0x00000006,
2770x00000ab8,0x00000b03,0x00000ab7,0x00050041,
2780x00000153,0x00000aba,0x000000f9,0x00000151,
2790x0004003d,0x00000007,0x00000abb,0x00000aba,
2800x00050041,0x000006d6,0x00000abc,0x000006d4,
2810x000009f7,0x0004003d,0x00000006,0x00000abd,
2820x00000abc,0x00050051,0x00000006,0x00000b20,
2830x00000abb,0x00000000,0x00050095,0x000000a8,
2840x00000b22,0x00000b20,0x00000ab8,0x00050051,
2850x00000006,0x00000b23,0x00000b22,0x00000001,
2860x00050051,0x00000006,0x00000b24,0x00000b22,
2870x00000000,0x00050051,0x00000006,0x00000b27,
2880x00000abb,0x00000001,0x00050080,0x00000006,
2890x00000b29,0x00000b27,0x00000b23,0x00050050,
2900x00000007,0x00000b2a,0x00000b24,0x00000b29,
2910x0004007c,0x00000014,0x00000b1a,0x00000b2a,
2920x00060041,0x000000d8,0x00000b12,0x00000b1a,
2930x000000d7,0x000000d7,0x0005003e,0x00000b12,
2940x00000abd,0x00000002,0x00000004,0x000200f9,
2950x00000abf,0x000200f8,0x00000abf,0x000200f9,
2960x00000a6e,0x000200f8,0x000009ef,0x000500aa,
2970x0000002f,0x000009fc,0x000009eb,0x0000010e,
2980x000300f7,0x000009fe,0x00000000,0x000400fa,
2990x000009fc,0x000009fd,0x000009fe,0x000200f8,
3000x000009fd,0x00050041,0x000009e7,0x00000a00,
3010x000009f1,0x000000a3,0x0004003d,0x00000006,
3020x00000a01,0x00000a00,0x00050041,0x000000fb,
3030x00000b9d,0x000000f9,0x000000fa,0x0004003d,
3040x00000006,0x00000b9e,0x00000b9d,0x00050080,
3050x00000006,0x00000ba0,0x00000b9e,0x00002b67,
3060x00050086,0x00000006,0x00000ba1,0x00000ba0,
3070x000000fe,0x00050084,0x00000006,0x00000b40,
3080x0000011c,0x00000ba1,0x00050080,0x00000006,
3090x00000b42,0x00000b40,0x00000717,0x00050086,
3100x00000006,0x00000b43,0x00000b42,0x00000104,
3110x00050084,0x00000006,0x00000b46,0x00000a01,
3120x00000b43,0x0007000c,0x00000006,0x00000b48,
3130x00000001,0x00000026,0x00000b46,0x00000b40,
3140x00050080,0x00000006,0x00000b4b,0x00000b48,
3150x00000b43,0x0007000c,0x00000006,0x00000b4d,
3160x00000001,0x00000026,0x00000b4b,0x00000b40,
3170x000200f9,0x00000b4f,0x000200f8,0x00000b4f,
3180x000700f5,0x00000006,0x00002b4d,0x000000a3,
3190x000009fd,0x00000b5d,0x00000b54,0x000700f5,
3200x00000006,0x00002b4c,0x00000b48,0x000009fd,
3210x00000b60,0x00000b54,0x000500b0,0x0000002f,
3220x00000b53,0x00002b4c,0x00000b4d,0x000400f6,
3230x00000b61,0x00000b54,0x00000000,0x000400fa,
3240x00000b53,0x00000b54,0x00000b61,0x000200f8,
3250x00000b54,0x00050084,0x00000006,0x00000ba6,
3260x0000011c,0x00000b9e,0x00050080,0x00000006,
3270x00000ba7,0x00000104,0x00000ba6,0x00050084,
3280x00000006,0x00000b57,0x00000107,0x00002b4c,
3290x00050080,0x00000006,0x00000b58,0x00000ba7,
3300x00000b57,0x00050041,0x00000153,0x00000b59,
3310x000000f9,0x00000151,0x0004003d,0x00000007,
3320x00000b5a,0x00000b59,0x00050051,0x00000006,
3330x00000bbe,0x00000b5a,0x00000000,0x00050095,
3340x000000a8,0x00000bc0,0x00000bbe,0x00000b58,
3350x00050051,0x00000006,0x00000bc1,0x00000bc0,
3360x00000001,0x00050051,0x00000006,0x00000bc2,
3370x00000bc0,0x00000000,0x00050051,0x00000006,
3380x00000bc5,0x00000b5a,0x00000001,0x00050080,
3390x00000006,0x00000bc7,0x00000bc5,0x00000bc1,
3400x00050050,0x00000007,0x00000bc8,0x00000bc2,
3410x00000bc7,0x0004007c,0x00000014,0x00000bb8,
3420x00000bc8,0x00060041,0x000000d8,0x00000baf,
3430x00000bb8,0x000000d7,0x000000d7,0x0006003d,
3440x00000006,0x00000bb0,0x00000baf,0x00000002,
3450x00000004,0x00050080,0x00000006,0x00000b5d,
3460x00002b4d,0x00000bb0,0x00050080,0x00000006,
3470x00000b60,0x00002b4c,0x00000151,0x000200f9,
3480x00000b4f,0x000200f8,0x00000b61,0x00050041,
3490x000006d6,0x00000b64,0x00000740,0x00000a01,
3500x0003003e,0x00000b64,0x00002b4d,0x000400e0,
3510x0000016d,0x0000016d,0x000006d8,0x000500aa,
3520x0000002f,0x00000b66,0x00000a01,0x000000a3,
3530x000300f7,0x00000b7a,0x00000000,0x000400fa,
3540x00000b66,0x00000b67,0x00000b7a,0x000200f8,
3550x00000b67,0x000200f9,0x00000b68,0x000200f8,
3560x00000b68,0x000700f5,0x00000006,0x00002b51,
3570x000000a3,0x00000b67,0x00000b75,0x00000b6c,
3580x000700f5,0x00000006,0x00002b4e,0x000000a3,
3590x00000b67,0x00000b78,0x00000b6c,0x000500b0,
3600x0000002f,0x00000b6b,0x00002b4e,0x00000104,
3610x000400f6,0x00000b79,0x00000b6c,0x00000000,
3620x000400fa,0x00000b6b,0x00000b6c,0x00000b79,
3630x000200f8,0x00000b6c,0x00050041,0x000006d6,
3640x00000b6e,0x00000740,0x00002b4e,0x0004003d,
3650x00000006,0x00000b6f,0x00000b6e,0x0003003e,
3660x00000b6e,0x00002b51,0x00050080,0x00000006,
3670x00000b75,0x00002b51,0x00000b6f,0x00050080,
3680x00000006,0x00000b78,0x00002b4e,0x00000151,
3690x000200f9,0x00000b68,0x000200f8,0x00000b79,
3700x000200f9,0x00000b7a,0x000200f8,0x00000b7a,
3710x000400e0,0x0000016d,0x0000016d,0x000006d8,
3720x0004003d,0x00000006,0x00000b7d,0x00000b64,
3730x000200f9,0x00000b7f,0x000200f8,0x00000b7f,
3740x000700f5,0x00000006,0x00002b50,0x00000b7d,
3750x00000b7a,0x00000b96,0x00000b84,0x000700f5,
3760x00000006,0x00002b4f,0x00000b48,0x00000b7a,
3770x00000b99,0x00000b84,0x000500b0,0x0000002f,
3780x00000b83,0x00002b4f,0x00000b4d,0x000400f6,
3790x00000b9a,0x00000b84,0x00000000,0x000400fa,
3800x00000b83,0x00000b84,0x00000b9a,0x000200f8,
3810x00000b84,0x00050084,0x00000006,0x00000bcd,
3820x0000011c,0x00000b9e,0x00050080,0x00000006,
3830x00000bce,0x00000104,0x00000bcd,0x00050084,
3840x00000006,0x00000b87,0x00000107,0x00002b4f,
3850x00050080,0x00000006,0x00000b88,0x00000bce,
3860x00000b87,0x00050041,0x00000153,0x00000b89,
3870x000000f9,0x00000151,0x0004003d,0x00000007,
3880x00000b8a,0x00000b89,0x00050051,0x00000006,
3890x00000be5,0x00000b8a,0x00000000,0x00050095,
3900x000000a8,0x00000be7,0x00000be5,0x00000b88,
3910x00050051,0x00000006,0x00000be8,0x00000be7,
3920x00000001,0x00050051,0x00000006,0x00000be9,
3930x00000be7,0x00000000,0x00050051,0x00000006,
3940x00000bec,0x00000b8a,0x00000001,0x00050080,
3950x00000006,0x00000bee,0x00000bec,0x00000be8,
3960x00050050,0x00000007,0x00000bef,0x00000be9,
3970x00000bee,0x0004007c,0x00000014,0x00000bdf,
3980x00000bef,0x00060041,0x000000d8,0x00000bd6,
3990x00000bdf,0x000000d7,0x000000d7,0x0006003d,
4000x00000006,0x00000bd7,0x00000bd6,0x00000002,
4010x00000004,0x0005003e,0x00000bd6,0x00002b50,
4020x00000002,0x00000004,0x00050080,0x00000006,
4030x00000b96,0x00002b50,0x00000bd7,0x00050080,
4040x00000006,0x00000b99,0x00002b4f,0x00000151,
4050x000200f9,0x00000b7f,0x000200f8,0x00000b9a,
4060x000200f9,0x00000a6e,0x000200f8,0x000009fe,
4070x000500aa,0x0000002f,0x00000a06,0x000009eb,
4080x00000387,0x000300f7,0x00000a08,0x00000000,
4090x000400fa,0x00000a06,0x00000a07,0x00000a08,
4100x000200f8,0x00000a07,0x00050041,0x000009e7,
4110x00000a0a,0x000009f0,0x000000a3,0x0004003d,
4120x00000006,0x00000a0b,0x00000a0a,0x00050041,
4130x000009e7,0x00000a0d,0x000009f1,0x000000a3,
4140x0004003d,0x00000006,0x00000a0e,0x00000a0d,
4150x000500b0,0x0000002f,0x00000c36,0x00000a0e,
4160x0000011c,0x000300f7,0x00000c45,0x00000000,
4170x000400fa,0x00000c36,0x00000c37,0x00000c45,
4180x000200f8,0x00000c37,0x00050041,0x000000fb,
4190x00000ce7,0x000000f9,0x000000fa,0x0004003d,
4200x00000006,0x00000ce8,0x00000ce7,0x00050084,
4210x00000006,0x00000ce9,0x0000011c,0x00000ce8,
4220x00050080,0x00000006,0x00000cea,0x00000104,
4230x00000ce9,0x00050080,0x00000006,0x00000cf0,
4240x00000ce8,0x00002b67,0x00050086,0x00000006,
4250x00000cf1,0x00000cf0,0x000000fe,0x00050084,
4260x00000006,0x00000c3c,0x00000a0e,0x00000cf1,
4270x00050080,0x00000006,0x00000c3e,0x00000c3c,
4280x00000a0b,0x00050084,0x00000006,0x00000c3f,
4290x00000107,0x00000c3e,0x00050080,0x00000006,
4300x00000c40,0x00000cea,0x00000c3f,0x00050041,
4310x00000153,0x00000c41,0x000000f9,0x00000151,
4320x0004003d,0x00000007,0x00000c42,0x00000c41,
4330x00050051,0x00000006,0x00000d08,0x00000c42,
4340x00000000,0x00050095,0x000000a8,0x00000d0a,
4350x00000d08,0x00000c40,0x00050051,0x00000006,
4360x00000d0b,0x00000d0a,0x00000001,0x00050051,
4370x00000006,0x00000d0c,0x00000d0a,0x00000000,
4380x00050051,0x00000006,0x00000d0f,0x00000c42,
4390x00000001,0x00050080,0x00000006,0x00000d11,
4400x00000d0f,0x00000d0b,0x00050050,0x00000007,
4410x00000d12,0x00000d0c,0x00000d11,0x0004007c,
4420x00000014,0x00000d02,0x00000d12,0x00060041,
4430x000000d8,0x00000cf9,0x00000d02,0x000000d7,
4440x000000d7,0x0006003d,0x00000006,0x00000cfa,
4450x00000cf9,0x00000002,0x00000004,0x00050041,
4460x000006d6,0x00000c44,0x00000789,0x00000a0e,
4470x0003003e,0x00000c44,0x00000cfa,0x000200f9,
4480x00000c45,0x000200f8,0x00000c45,0x00050084,
4490x00000006,0x00000c47,0x00000a0b,0x000000fe,
4500x00050080,0x00000006,0x00000c49,0x00000c47,
4510x000000fe,0x00050041,0x000000fb,0x00000c4a,
4520x000000f9,0x000000fa,0x0004003d,0x00000006,
4530x00000c4b,0x00000c4a,0x0007000c,0x00000006,
4540x00000c4c,0x00000001,0x00000026,0x00000c49,
4550x00000c4b,0x000200f9,0x00000c4e,0x000200f8,
4560x00000c4e,0x000700f5,0x00000006,0x00002b33,
4570x00000c47,0x00000c45,0x00000ce3,0x00000ce1,
4580x000500b0,0x0000002f,0x00000c52,0x00002b33,
4590x00000c4c,0x000400f6,0x00000ce4,0x00000ce1,
4600x00000000,0x000400fa,0x00000c52,0x00000c53,
4610x00000ce4,0x000200f8,0x00000c53,0x00050080,
4620x00000006,0x00000c56,0x00002b33,0x00000a0e,
4630x000500b0,0x0000002f,0x00000c59,0x00000c56,
4640x00000c4c,0x000300f7,0x00000c64,0x00000000,
4650x000400fa,0x00000c59,0x00000c5b,0x00000c63,
4660x000200f8,0x00000c5b,0x00050041,0x000000fb,
4670x00000d16,0x000000f9,0x00000305,0x0004003d,
4680x00000006,0x00000d17,0x00000d16,0x000500c7,
4690x00000006,0x00000d18,0x00000d17,0x000000ad,
4700x000500aa,0x0000002f,0x00000d19,0x00000d18,
4710x000000a3,0x000300f7,0x00000d1e,0x00000000,
4720x000400fa,0x00000d19,0x00000d1a,0x00000d1c,
4730x000200f8,0x00000d1a,0x000200f9,0x00000d1e,
4740x000200f8,0x00000d1c,0x00050084,0x00000006,
4750x00000d26,0x0000010e,0x00000c4b,0x00050080,
4760x00000006,0x00000d27,0x00000104,0x00000d26,
4770x000200f9,0x00000d1e,0x000200f8,0x00000d1e,
4780x000700f5,0x00000006,0x00002b34,0x00000104,
4790x00000d1a,0x00000d27,0x00000d1c,0x00050084,
4800x00000006,0x00000c5e,0x00000107,0x00000c56,
4810x00050080,0x00000006,0x00000c5f,0x00002b34,
4820x00000c5e,0x00050041,0x00000153,0x00000c60,
4830x000000f9,0x00000151,0x0004003d,0x00000007,
4840x00000c61,0x00000c60,0x00050051,0x00000006,
4850x00000d3e,0x00000c61,0x00000000,0x00050095,
4860x000000a8,0x00000d40,0x00000d3e,0x00000c5f,
4870x00050051,0x00000006,0x00000d41,0x00000d40,
4880x00000001,0x00050051,0x00000006,0x00000d42,
4890x00000d40,0x00000000,0x00050051,0x00000006,
4900x00000d45,0x00000c61,0x00000001,0x00050080,
4910x00000006,0x00000d47,0x00000d45,0x00000d41,
4920x00050050,0x00000007,0x00000d48,0x00000d42,
4930x00000d47,0x0004007c,0x00000014,0x00000d38,
4940x00000d48,0x00060041,0x000000d8,0x00000d2f,
4950x00000d38,0x000000d7,0x000000d7,0x0006003d,
4960x00000006,0x00000d30,0x00000d2f,0x00000002,
4970x00000004,0x000200f9,0x00000c64,0x000200f8,
4980x00000c63,0x000200f9,0x00000c64,0x000200f8,
4990x00000c64,0x000700f5,0x00000006,0x00002b35,
5000x00000d30,0x00000d1e,0x000000a3,0x00000c63,
5010x000300f7,0x00000c70,0x00000000,0x000400fa,
5020x00000c59,0x00000c67,0x00000c6f,0x000200f8,
5030x00000c67,0x00050041,0x000000fb,0x00000d4c,
5040x000000f9,0x00000305,0x0004003d,0x00000006,
5050x00000d4d,0x00000d4c,0x000500c7,0x00000006,
5060x00000d4e,0x00000d4d,0x000000ad,0x000500aa,
5070x0000002f,0x00000d4f,0x00000d4e,0x000000a3,
5080x000300f7,0x00000d54,0x00000000,0x000400fa,
5090x00000d4f,0x00000d50,0x00000d52,0x000200f8,
5100x00000d50,0x00050084,0x00000006,0x00000d5a,
5110x00000107,0x00000c4b,0x00050080,0x00000006,
5120x00000d5b,0x00000104,0x00000d5a,0x000200f9,
5130x00000d54,0x000200f8,0x00000d52,0x00050084,
5140x00000006,0x00000d60,0x00000115,0x00000c4b,
5150x00050080,0x00000006,0x00000d61,0x00000104,
5160x00000d60,0x000200f9,0x00000d54,0x000200f8,
5170x00000d54,0x000700f5,0x00000006,0x00002b36,
5180x00000d5b,0x00000d50,0x00000d61,0x00000d52,
5190x00050084,0x00000006,0x00000c6a,0x00000107,
5200x00000c56,0x00050080,0x00000006,0x00000c6b,
5210x00002b36,0x00000c6a,0x00050041,0x00000153,
5220x00000c6c,0x000000f9,0x00000151,0x0004003d,
5230x00000007,0x00000c6d,0x00000c6c,0x00050051,
5240x00000006,0x00000d78,0x00000c6d,0x00000000,
5250x00050095,0x000000a8,0x00000d7a,0x00000d78,
5260x00000c6b,0x00050051,0x00000006,0x00000d7b,
5270x00000d7a,0x00000001,0x00050051,0x00000006,
5280x00000d7c,0x00000d7a,0x00000000,0x00050051,
5290x00000006,0x00000d7f,0x00000c6d,0x00000001,
5300x00050080,0x00000006,0x00000d81,0x00000d7f,
5310x00000d7b,0x00050050,0x00000007,0x00000d82,
5320x00000d7c,0x00000d81,0x0004007c,0x00000014,
5330x00000d72,0x00000d82,0x00060041,0x000000d8,
5340x00000d69,0x00000d72,0x000000d7,0x000000d7,
5350x0006003d,0x00000006,0x00000d6a,0x00000d69,
5360x00000002,0x00000004,0x000200f9,0x00000c70,
5370x000200f8,0x00000c6f,0x000200f9,0x00000c70,
5380x000200f8,0x00000c70,0x000700f5,0x00000006,
5390x00002b37,0x00000d6a,0x00000d54,0x000000a3,
5400x00000c6f,0x00050041,0x000000fb,0x00000d86,
5410x000000f9,0x00000305,0x0004003d,0x00000006,
5420x00000d87,0x00000d86,0x00050084,0x00000006,
5430x00000d88,0x00000107,0x00000d87,0x000500c2,
5440x00000006,0x00000d89,0x00002b35,0x00000d88,
5450x000500c7,0x00000006,0x00000d8a,0x00000d89,
5460x000006ca,0x000200f9,0x00000c74,0x000200f8,
5470x00000c74,0x000700f5,0x00000006,0x00002b38,
5480x000000a3,0x00000c70,0x00000c84,0x00000c78,
5490x000500b0,0x0000002f,0x00000c77,0x00002b38,
5500x0000011c,0x000400f6,0x00000c85,0x00000c78,
5510x00000000,0x000400fa,0x00000c77,0x00000c78,
5520x00000c85,0x000200f8,0x00000c78,0x000500aa,
5530x0000002f,0x00000c7e,0x00002b38,0x00000d8a,
5540x000500a7,0x0000002f,0x00000c7f,0x00000c59,
5550x00000c7e,0x000600a9,0x00000006,0x00000c80,
5560x00000c7f,0x000000ad,0x000000a3,0x00060041,
5570x000006d6,0x00000c81,0x000007e2,0x00002b38,
5580x00000a0e,0x0003003e,0x00000c81,0x00000c80,
5590x00050080,0x00000006,0x00000c84,0x00002b38,
5600x00000151,0x000200f9,0x00000c74,0x000200f8,
5610x00000c85,0x000400e0,0x0000016d,0x0000016d,
5620x000006d8,0x000200f9,0x00000c86,0x000200f8,
5630x00000c86,0x000700f5,0x00000006,0x00002b39,
5640x000000ad,0x00000c85,0x00000cb7,0x00000cb5,
5650x000500b0,0x0000002f,0x00000c89,0x00002b39,
5660x00000104,0x000400f6,0x00000cb8,0x00000cb5,
5670x00000000,0x000400fa,0x00000c89,0x00000c8a,
5680x00000cb8,0x000200f8,0x00000c8a,0x000200f9,
5690x00000c8b,0x000200f8,0x00000c8b,0x000700f5,
5700x00000006,0x00002b46,0x000000a3,0x00000c8a,
5710x00000ca1,0x00000c9f,0x000500b0,0x0000002f,
5720x00000c8e,0x00002b46,0x0000011c,0x000400f6,
5730x00000ca2,0x00000c9f,0x00000000,0x000400fa,
5740x00000c8e,0x00000c8f,0x00000ca2,0x000200f8,
5750x00000c8f,0x000500ae,0x0000002f,0x00000c93,
5760x00000a0e,0x00002b39,0x000300f7,0x00000c9c,
5770x00000000,0x000400fa,0x00000c93,0x00000c94,
5780x00000c9b,0x000200f8,0x00000c94,0x00050082,
5790x00000006,0x00000c98,0x00000a0e,0x00002b39,
5800x00060041,0x000006d6,0x00000c99,0x000007e2,
5810x00002b46,0x00000c98,0x0004003d,0x00000006,
5820x00000c9a,0x00000c99,0x000200f9,0x00000c9c,
5830x000200f8,0x00000c9b,0x000200f9,0x00000c9c,
5840x000200f8,0x00000c9c,0x000700f5,0x00000006,
5850x00002b4a,0x00000c9a,0x00000c94,0x000000a3,
5860x00000c9b,0x00050041,0x00000009,0x00000c9e,
5870x00000c2a,0x00002b46,0x0003003e,0x00000c9e,
5880x00002b4a,0x000200f9,0x00000c9f,0x000200f8,
5890x00000c9f,0x00050080,0x00000006,0x00000ca1,
5900x00002b46,0x00000151,0x000200f9,0x00000c8b,
5910x000200f8,0x00000ca2,0x000400e0,0x0000016d,
5920x0000016d,0x000006d8,0x000200f9,0x00000ca3,
5930x000200f8,0x00000ca3,0x000700f5,0x00000006,
5940x00002b47,0x000000a3,0x00000ca2,0x00000cb3,
5950x00000ca7,0x000500b0,0x0000002f,0x00000ca6,
5960x00002b47,0x0000011c,0x000400f6,0x00000cb4,
5970x00000ca7,0x00000000,0x000400fa,0x00000ca6,
5980x00000ca7,0x00000cb4,0x000200f8,0x00000ca7,
5990x00050041,0x00000009,0x00000cab,0x00000c2a,
6000x00002b47,0x0004003d,0x00000006,0x00000cac,
6010x00000cab,0x00060041,0x000006d6,0x00000cad,
6020x000007e2,0x00002b47,0x00000a0e,0x0004003d,
6030x00000006,0x00000cae,0x00000cad,0x00050080,
6040x00000006,0x00000caf,0x00000cae,0x00000cac,
6050x0003003e,0x00000cad,0x00000caf,0x00050080,
6060x00000006,0x00000cb3,0x00002b47,0x00000151,
6070x000200f9,0x00000ca3,0x000200f8,0x00000cb4,
6080x000400e0,0x0000016d,0x0000016d,0x000006d8,
6090x000200f9,0x00000cb5,0x000200f8,0x00000cb5,
6100x000500c4,0x00000006,0x00000cb7,0x00002b39,
6110x00000151,0x000200f9,0x00000c86,0x000200f8,
6120x00000cb8,0x000300f7,0x00000cd4,0x00000000,
6130x000400fa,0x00000c59,0x00000cba,0x00000cd4,
6140x000200f8,0x00000cba,0x00050041,0x000006d6,
6150x00000cbc,0x00000789,0x00000d8a,0x0004003d,
6160x00000006,0x00000cbd,0x00000cbc,0x00060041,
6170x000006d6,0x00000cc0,0x000007e2,0x00000d8a,
6180x00000a0e,0x0004003d,0x00000006,0x00000cc1,
6190x00000cc0,0x00050080,0x00000006,0x00000cc2,
6200x00000cbd,0x00000cc1,0x00050082,0x00000006,
6210x00000cc3,0x00000cc2,0x000000ad,0x000500c7,
6220x00000006,0x00000d90,0x00000d87,0x000000ad,
6230x000500aa,0x0000002f,0x00000d91,0x00000d90,
6240x000000a3,0x000300f7,0x00000d96,0x00000000,
6250x000400fa,0x00000d91,0x00000d92,0x00000d94,
6260x000200f8,0x00000d92,0x00050084,0x00000006,
6270x00000d9c,0x0000010e,0x00000c4b,0x00050080,
6280x00000006,0x00000d9d,0x00000104,0x00000d9c,
6290x000200f9,0x00000d96,0x000200f8,0x00000d94,
6300x000200f9,0x00000d96,0x000200f8,0x00000d96,
6310x000700f5,0x00000006,0x00002b3a,0x00000d9d,
6320x00000d92,0x00000104,0x00000d94,0x00050084,
6330x00000006,0x00000cc6,0x00000107,0x00000cc3,
6340x00050080,0x00000006,0x00000cc7,0x00002b3a,
6350x00000cc6,0x00050041,0x00000153,0x00000cc8,
6360x000000f9,0x00000151,0x0004003d,0x00000007,
6370x00000cc9,0x00000cc8,0x00050051,0x00000006,
6380x00000db5,0x00000cc9,0x00000000,0x00050095,
6390x000000a8,0x00000db7,0x00000db5,0x00000cc7,
6400x00050051,0x00000006,0x00000db8,0x00000db7,
6410x00000001,0x00050051,0x00000006,0x00000db9,
6420x00000db7,0x00000000,0x00050051,0x00000006,
6430x00000dbc,0x00000cc9,0x00000001,0x00050080,
6440x00000006,0x00000dbe,0x00000dbc,0x00000db8,
6450x00050050,0x00000007,0x00000dbf,0x00000db9,
6460x00000dbe,0x0004007c,0x00000014,0x00000daf,
6470x00000dbf,0x00060041,0x000000d8,0x00000da7,
6480x00000daf,0x000000d7,0x000000d7,0x0005003e,
6490x00000da7,0x00002b35,0x00000002,0x00000004,
6500x000300f7,0x00000dcb,0x00000000,0x000400fa,
6510x00000d91,0x00000dc7,0x00000dc9,0x000200f8,
6520x00000dc7,0x00050084,0x00000006,0x00000dd1,
6530x00000115,0x00000c4b,0x00050080,0x00000006,
6540x00000dd2,0x00000104,0x00000dd1,0x000200f9,
6550x00000dcb,0x000200f8,0x00000dc9,0x00050084,
6560x00000006,0x00000dd7,0x00000107,0x00000c4b,
6570x00050080,0x00000006,0x00000dd8,0x00000104,
6580x00000dd7,0x000200f9,0x00000dcb,0x000200f8,
6590x00000dcb,0x000700f5,0x00000006,0x00002b3b,
6600x00000dd2,0x00000dc7,0x00000dd8,0x00000dc9,
6610x00050080,0x00000006,0x00000ccf,0x00002b3b,
6620x00000cc6,0x00050095,0x000000a8,0x00000df0,
6630x00000db5,0x00000ccf,0x00050051,0x00000006,
6640x00000df1,0x00000df0,0x00000001,0x00050051,
6650x00000006,0x00000df2,0x00000df0,0x00000000,
6660x00050080,0x00000006,0x00000df7,0x00000dbc,
6670x00000df1,0x00050050,0x00000007,0x00000df8,
6680x00000df2,0x00000df7,0x0004007c,0x00000014,
6690x00000de8,0x00000df8,0x00060041,0x000000d8,
6700x00000de0,0x00000de8,0x000000d7,0x000000d7,
6710x0005003e,0x00000de0,0x00002b37,0x00000002,
6720x00000004,0x000200f9,0x00000cd4,0x000200f8,
6730x00000cd4,0x000400e0,0x0000016d,0x0000016d,
6740x000006d8,0x000300f7,0x00000ce0,0x00000000,
6750x000400fa,0x00000c36,0x00000cd7,0x00000ce0,
6760x000200f8,0x00000cd7,0x00060041,0x000006d6,
6770x00000cda,0x000007e2,0x00000a0e,0x00000850,
6780x0004003d,0x00000006,0x00000cdb,0x00000cda,
6790x00050041,0x000006d6,0x00000cdc,0x00000789,
6800x00000a0e,0x0004003d,0x00000006,0x00000cdd,
6810x00000cdc,0x00050080,0x00000006,0x00000cde,
6820x00000cdd,0x00000cdb,0x0003003e,0x00000cdc,
6830x00000cde,0x000200f9,0x00000ce0,0x000200f8,
6840x00000ce0,0x000400e0,0x0000016d,0x0000016d,
6850x000006d8,0x000200f9,0x00000ce1,0x000200f8,
6860x00000ce1,0x00050080,0x00000006,0x00000ce3,
6870x00002b33,0x00000104,0x000200f9,0x00000c4e,
6880x000200f8,0x00000ce4,0x000200f9,0x00000a6e,
6890x000200f8,0x00000a08,0x000500aa,0x0000002f,
6900x00000a13,0x000009eb,0x00000236,0x000300f7,
6910x00000a15,0x00000000,0x000400fa,0x00000a13,
6920x00000a14,0x00000a15,0x000200f8,0x00000a14,
6930x000500aa,0x0000002f,0x00000a17,0x000009e9,
6940x000000a3,0x000300f7,0x00000a19,0x00000000,
6950x000400fa,0x00000a17,0x00000a18,0x00000a19,
6960x000200f8,0x00000a18,0x00050041,0x000000fb,
6970x00000e31,0x000000f9,0x00000305,0x0004003d,
6980x00000006,0x00000e32,0x00000e31,0x00050041,
6990x000000fb,0x00000e33,0x000000f9,0x000008bc,
7000x0004003d,0x00000006,0x00000e34,0x00000e33,
7010x00050080,0x00000006,0x00000e36,0x00000e34,
7020x00000e32,0x00050041,0x000000fb,0x00000ec7,
7030x000000f9,0x000000fa,0x0004003d,0x00000006,
7040x00000ec8,0x00000ec7,0x00050084,0x00000006,
7050x00000ec9,0x0000011c,0x00000ec8,0x00050080,
7060x00000006,0x00000eca,0x00000104,0x00000ec9,
7070x00050080,0x00000006,0x00000ed0,0x00000ec8,
7080x00002b67,0x00050086,0x00000006,0x00000ed1,
7090x00000ed0,0x000000fe,0x00050084,0x00000006,
7100x00000ec3,0x00000104,0x00000ed1,0x00050080,
7110x00000006,0x00000ec4,0x00000eca,0x00000ec3,
7120x00050084,0x00000006,0x00000e98,0x0000014d,
7130x00000e36,0x00050080,0x00000006,0x00000e99,
7140x00000ec4,0x00000e98,0x00050041,0x00000153,
7150x00000e9a,0x000000f9,0x00000151,0x0004003d,
7160x00000007,0x00000e9b,0x00000e9a,0x00050051,
7170x00000006,0x00000ee8,0x00000e9b,0x00000000,
7180x00050095,0x000000a8,0x00000eea,0x00000ee8,
7190x00000e99,0x00050051,0x00000006,0x00000eeb,
7200x00000eea,0x00000001,0x00050051,0x00000006,
7210x00000eec,0x00000eea,0x00000000,0x00050051,
7220x00000006,0x00000eef,0x00000e9b,0x00000001,
7230x00050080,0x00000006,0x00000ef1,0x00000eef,
7240x00000eeb,0x00050050,0x00000007,0x00000ef2,
7250x00000eec,0x00000ef1,0x0004007c,0x00000014,
7260x00000ee2,0x00000ef2,0x00060041,0x000000d8,
7270x00000ed9,0x00000ee2,0x000000d7,0x000000d7,
7280x0006003d,0x00000006,0x00000eda,0x00000ed9,
7290x00000002,0x00000004,0x00050080,0x00000006,
7300x00000ea0,0x00000e99,0x00000107,0x00050095,
7310x000000a8,0x00000f0b,0x00000ee8,0x00000ea0,
7320x00050051,0x00000006,0x00000f0c,0x00000f0b,
7330x00000001,0x00050051,0x00000006,0x00000f0d,
7340x00000f0b,0x00000000,0x00050080,0x00000006,
7350x00000f12,0x00000eef,0x00000f0c,0x00050050,
7360x00000007,0x00000f13,0x00000f0d,0x00000f12,
7370x0004007c,0x00000014,0x00000f03,0x00000f13,
7380x00060041,0x000000d8,0x00000efa,0x00000f03,
7390x000000d7,0x000000d7,0x0006003d,0x00000006,
7400x00000efb,0x00000efa,0x00000002,0x00000004,
7410x00050080,0x00000006,0x00000ea6,0x00000e99,
7420x0000010e,0x00050095,0x000000a8,0x00000f2c,
7430x00000ee8,0x00000ea6,0x00050051,0x00000006,
7440x00000f2d,0x00000f2c,0x00000001,0x00050051,
7450x00000006,0x00000f2e,0x00000f2c,0x00000000,
7460x00050080,0x00000006,0x00000f33,0x00000eef,
7470x00000f2d,0x00050050,0x00000007,0x00000f34,
7480x00000f2e,0x00000f33,0x0004007c,0x00000014,
7490x00000f24,0x00000f34,0x00060041,0x000000d8,
7500x00000f1b,0x00000f24,0x000000d7,0x000000d7,
7510x0006003d,0x00000006,0x00000f1c,0x00000f1b,
7520x00000002,0x00000004,0x00050080,0x00000006,
7530x00000ead,0x00000e99,0x00000115,0x00050095,
7540x000000a8,0x00000f4d,0x00000ee8,0x00000ead,
7550x00050051,0x00000006,0x00000f4e,0x00000f4d,
7560x00000001,0x00050051,0x00000006,0x00000f4f,
7570x00000f4d,0x00000000,0x00050080,0x00000006,
7580x00000f54,0x00000eef,0x00000f4e,0x00050050,
7590x00000007,0x00000f55,0x00000f4f,0x00000f54,
7600x0004007c,0x00000014,0x00000f45,0x00000f55,
7610x00060041,0x000000d8,0x00000f3c,0x00000f45,
7620x000000d7,0x000000d7,0x0006003d,0x00000006,
7630x00000f3d,0x00000f3c,0x00000002,0x00000004,
7640x00050080,0x00000006,0x00000eb3,0x00000e99,
7650x0000011c,0x00050095,0x000000a8,0x00000f6e,
7660x00000ee8,0x00000eb3,0x00050051,0x00000006,
7670x00000f6f,0x00000f6e,0x00000001,0x00050051,
7680x00000006,0x00000f70,0x00000f6e,0x00000000,
7690x00050080,0x00000006,0x00000f75,0x00000eef,
7700x00000f6f,0x00050050,0x00000007,0x00000f76,
7710x00000f70,0x00000f75,0x0004007c,0x00000014,
7720x00000f66,0x00000f76,0x00060041,0x000000d8,
7730x00000f5d,0x00000f66,0x000000d7,0x000000d7,
7740x0006003d,0x00000006,0x00000f5e,0x00000f5d,
7750x00000002,0x00000004,0x00050080,0x00000006,
7760x00000eb9,0x00000e99,0x00000186,0x00050095,
7770x000000a8,0x00000f8f,0x00000ee8,0x00000eb9,
7780x00050051,0x00000006,0x00000f90,0x00000f8f,
7790x00000001,0x00050051,0x00000006,0x00000f91,
7800x00000f8f,0x00000000,0x00050080,0x00000006,
7810x00000f96,0x00000eef,0x00000f90,0x00050050,
7820x00000007,0x00000f97,0x00000f91,0x00000f96,
7830x0004007c,0x00000014,0x00000f87,0x00000f97,
7840x00060041,0x000000d8,0x00000f7e,0x00000f87,
7850x000000d7,0x000000d7,0x0006003d,0x00000006,
7860x00000f7f,0x00000f7e,0x00000002,0x00000004,
7870x00050041,0x000000fb,0x00000e3a,0x000000f9,
7880x00000221,0x0004003d,0x00000006,0x00000e3b,
7890x00000e3a,0x000500ab,0x0000002f,0x00000e3c,
7900x00000e3b,0x000000a3,0x000600a9,0x00000006,
7910x00000e3d,0x00000e3c,0x000000a3,0x0000012d,
7920x000500c5,0x00000006,0x00000e3e,0x00000e3d,
7930x00000236,0x00050041,0x00000153,0x00000e3f,
7940x000000f9,0x000000d7,0x0004003d,0x00000007,
7950x00000e40,0x00000e3f,0x00050051,0x00000006,
7960x00000fad,0x00000e40,0x00000000,0x00050095,
7970x000000a8,0x00000faf,0x00000fad,0x000000a3,
7980x00050051,0x00000006,0x00000fb0,0x00000faf,
7990x00000001,0x00050051,0x00000006,0x00000fb1,
8000x00000faf,0x00000000,0x00050051,0x00000006,
8010x00000fb4,0x00000e40,0x00000001,0x00050080,
8020x00000006,0x00000fb6,0x00000fb4,0x00000fb0,
8030x00050050,0x00000007,0x00000fb7,0x00000fb1,
8040x00000fb6,0x0004007c,0x00000014,0x00000fa7,
8050x00000fb7,0x00060041,0x000000d8,0x00000f9f,
8060x00000fa7,0x000000d7,0x000000d7,0x0005003e,
8070x00000f9f,0x00000e3e,0x00000002,0x00000004,
8080x00050041,0x000000fb,0x00000e42,0x000000f9,
8090x0000096f,0x0004003d,0x00000006,0x00000e43,
8100x00000e42,0x00050086,0x00000006,0x00000e44,
8110x00000e43,0x00000104,0x00050095,0x000000a8,
8120x00000fcf,0x00000fad,0x00000107,0x00050051,
8130x00000006,0x00000fd0,0x00000fcf,0x00000001,
8140x00050051,0x00000006,0x00000fd1,0x00000fcf,
8150x00000000,0x00050080,0x00000006,0x00000fd6,
8160x00000fb4,0x00000fd0,0x00050050,0x00000007,
8170x00000fd7,0x00000fd1,0x00000fd6,0x0004007c,
8180x00000014,0x00000fc7,0x00000fd7,0x00060041,
8190x000000d8,0x00000fbf,0x00000fc7,0x000000d7,
8200x000000d7,0x0005003e,0x00000fbf,0x00000e44,
8210x00000002,0x00000004,0x00050095,0x000000a8,
8220x00000fef,0x00000fad,0x0000010e,0x00050051,
8230x00000006,0x00000ff0,0x00000fef,0x00000001,
8240x00050051,0x00000006,0x00000ff1,0x00000fef,
8250x00000000,0x00050080,0x00000006,0x00000ff6,
8260x00000fb4,0x00000ff0,0x00050050,0x00000007,
8270x00000ff7,0x00000ff1,0x00000ff6,0x0004007c,
8280x00000014,0x00000fe7,0x00000ff7,0x00060041,
8290x000000d8,0x00000fdf,0x00000fe7,0x000000d7,
8300x000000d7,0x0005003e,0x00000fdf,0x000000a3,
8310x00000002,0x00000004,0x00050095,0x000000a8,
8320x0000100f,0x00000fad,0x00000115,0x00050051,
8330x00000006,0x00001010,0x0000100f,0x00000001,
8340x00050051,0x00000006,0x00001011,0x0000100f,
8350x00000000,0x00050080,0x00000006,0x00001016,
8360x00000fb4,0x00001010,0x00050050,0x00000007,
8370x00001017,0x00001011,0x00001016,0x0004007c,
8380x00000014,0x00001007,0x00001017,0x00060041,
8390x000000d8,0x00000fff,0x00001007,0x000000d7,
8400x000000d7,0x0005003e,0x00000fff,0x00000e34,
8410x00000002,0x00000004,0x00050095,0x000000a8,
8420x00001038,0x00000fad,0x0000011c,0x00050051,
8430x00000006,0x00001039,0x00001038,0x00000001,
8440x00050051,0x00000006,0x0000103a,0x00001038,
8450x00000000,0x00050080,0x00000006,0x0000103f,
8460x00000fb4,0x00001039,0x00050050,0x00000007,
8470x00001040,0x0000103a,0x0000103f,0x0004007c,
8480x00000014,0x00001030,0x00001040,0x00060041,
8490x000000d8,0x00001028,0x00001030,0x000000d7,
8500x000000d7,0x0005003e,0x00001028,0x00000eda,
8510x00000002,0x00000004,0x00050095,0x000000a8,
8520x00001061,0x00000fad,0x00000186,0x00050051,
8530x00000006,0x00001062,0x00001061,0x00000001,
8540x00050051,0x00000006,0x00001063,0x00001061,
8550x00000000,0x00050080,0x00000006,0x00001068,
8560x00000fb4,0x00001062,0x00050050,0x00000007,
8570x00001069,0x00001063,0x00001068,0x0004007c,
8580x00000014,0x00001059,0x00001069,0x00060041,
8590x000000d8,0x00001051,0x00001059,0x000000d7,
8600x000000d7,0x0005003e,0x00001051,0x00000efb,
8610x00000002,0x00000004,0x00050095,0x000000a8,
8620x0000108a,0x00000fad,0x0000014d,0x00050051,
8630x00000006,0x0000108b,0x0000108a,0x00000001,
8640x00050051,0x00000006,0x0000108c,0x0000108a,
8650x00000000,0x00050080,0x00000006,0x00001091,
8660x00000fb4,0x0000108b,0x00050050,0x00000007,
8670x00001092,0x0000108c,0x00001091,0x0004007c,
8680x00000014,0x00001082,0x00001092,0x00060041,
8690x000000d8,0x0000107a,0x00001082,0x000000d7,
8700x000000d7,0x0005003e,0x0000107a,0x00000f1c,
8710x00000002,0x00000004,0x00050095,0x000000a8,
8720x000010b3,0x00000fad,0x00000460,0x00050051,
8730x00000006,0x000010b4,0x000010b3,0x00000001,
8740x00050051,0x00000006,0x000010b5,0x000010b3,
8750x00000000,0x00050080,0x00000006,0x000010ba,
8760x00000fb4,0x000010b4,0x00050050,0x00000007,
8770x000010bb,0x000010b5,0x000010ba,0x0004007c,
8780x00000014,0x000010ab,0x000010bb,0x00060041,
8790x000000d8,0x000010a3,0x000010ab,0x000000d7,
8800x000000d7,0x0005003e,0x000010a3,0x00000f3d,
8810x00000002,0x00000004,0x00050095,0x000000a8,
8820x000010dc,0x00000fad,0x00000466,0x00050051,
8830x00000006,0x000010dd,0x000010dc,0x00000001,
8840x00050051,0x00000006,0x000010de,0x000010dc,
8850x00000000,0x00050080,0x00000006,0x000010e3,
8860x00000fb4,0x000010dd,0x00050050,0x00000007,
8870x000010e4,0x000010de,0x000010e3,0x0004007c,
8880x00000014,0x000010d4,0x000010e4,0x00060041,
8890x000000d8,0x000010cc,0x000010d4,0x000000d7,
8900x000000d7,0x0005003e,0x000010cc,0x00000f5e,
8910x00000002,0x00000004,0x00050095,0x000000a8,
8920x00001105,0x00000fad,0x00000344,0x00050051,
8930x00000006,0x00001106,0x00001105,0x00000001,
8940x00050051,0x00000006,0x00001107,0x00001105,
8950x00000000,0x00050080,0x00000006,0x0000110c,
8960x00000fb4,0x00001106,0x00050050,0x00000007,
8970x0000110d,0x00001107,0x0000110c,0x0004007c,
8980x00000014,0x000010fd,0x0000110d,0x00060041,
8990x000000d8,0x000010f5,0x000010fd,0x000000d7,
9000x000000d7,0x0005003e,0x000010f5,0x00000f7f,
9010x00000002,0x00000004,0x00050041,0x000000fb,
9020x00000e70,0x000000f9,0x0000023b,0x0004003d,
9030x00000006,0x00000e71,0x00000e70,0x00050095,
9040x000000a8,0x00001125,0x00000fad,0x0000034f,
9050x00050051,0x00000006,0x00001126,0x00001125,
9060x00000001,0x00050051,0x00000006,0x00001127,
9070x00001125,0x00000000,0x00050080,0x00000006,
9080x0000112c,0x00000fb4,0x00001126,0x00050050,
9090x00000007,0x0000112d,0x00001127,0x0000112c,
9100x0004007c,0x00000014,0x0000111d,0x0000112d,
9110x00060041,0x000000d8,0x00001115,0x0000111d,
9120x000000d7,0x000000d7,0x0005003e,0x00001115,
9130x00000e71,0x00000002,0x00000004,0x00050095,
9140x000000a8,0x00001145,0x00000fad,0x0000035a,
9150x00050051,0x00000006,0x00001146,0x00001145,
9160x00000001,0x00050051,0x00000006,0x00001147,
9170x00001145,0x00000000,0x00050080,0x00000006,
9180x0000114c,0x00000fb4,0x00001146,0x00050050,
9190x00000007,0x0000114d,0x00001147,0x0000114c,
9200x0004007c,0x00000014,0x0000113d,0x0000114d,
9210x00060041,0x000000d8,0x00001135,0x0000113d,
9220x000000d7,0x000000d7,0x0005003e,0x00001135,
9230x000000a3,0x00000002,0x00000004,0x00050084,
9240x00000006,0x00001153,0x00000e32,0x00000225,
9250x00050080,0x00000006,0x00001154,0x00000e71,
9260x00001153,0x000500c2,0x00000006,0x00001155,
9270x00001154,0x00000230,0x000500c4,0x00000006,
9280x00001156,0x00001155,0x0000020a,0x000500c5,
9290x00000006,0x00001157,0x00001156,0x00000243,
9300x00050095,0x000000a8,0x0000116f,0x00000fad,
9310x00000365,0x00050051,0x00000006,0x00001170,
9320x0000116f,0x00000001,0x00050051,0x00000006,
9330x00001171,0x0000116f,0x00000000,0x00050080,
9340x00000006,0x00001176,0x00000fb4,0x00001170,
9350x00050050,0x00000007,0x00001177,0x00001171,
9360x00001176,0x0004007c,0x00000014,0x00001167,
9370x00001177,0x00060041,0x000000d8,0x0000115f,
9380x00001167,0x000000d7,0x000000d7,0x0005003e,
9390x0000115f,0x00001157,0x00000002,0x00000004,
9400x00050041,0x000000fb,0x00000e7d,0x000000f9,
9410x00000229,0x0004003d,0x00000006,0x00000e7e,
9420x00000e7d,0x00050095,0x000000a8,0x0000118f,
9430x00000fad,0x00000371,0x00050051,0x00000006,
9440x00001190,0x0000118f,0x00000001,0x00050051,
9450x00000006,0x00001191,0x0000118f,0x00000000,
9460x00050080,0x00000006,0x00001196,0x00000fb4,
9470x00001190,0x00050050,0x00000007,0x00001197,
9480x00001191,0x00001196,0x0004007c,0x00000014,
9490x00001187,0x00001197,0x00060041,0x000000d8,
9500x0000117f,0x00001187,0x000000d7,0x000000d7,
9510x0005003e,0x0000117f,0x00000e7e,0x00000002,
9520x00000004,0x00050041,0x000000fb,0x00000e82,
9530x000000f9,0x000008c7,0x0004003d,0x00000006,
9540x00000e83,0x00000e82,0x00050095,0x000000a8,
9550x000011af,0x00000fad,0x0000037b,0x00050051,
9560x00000006,0x000011b0,0x000011af,0x00000001,
9570x00050051,0x00000006,0x000011b1,0x000011af,
9580x00000000,0x00050080,0x00000006,0x000011b6,
9590x00000fb4,0x000011b0,0x00050050,0x00000007,
9600x000011b7,0x000011b1,0x000011b6,0x0004007c,
9610x00000014,0x000011a7,0x000011b7,0x00060041,
9620x000000d8,0x0000119f,0x000011a7,0x000000d7,
9630x000000d7,0x0005003e,0x0000119f,0x00000e83,
9640x00000002,0x00000004,0x00050095,0x000000a8,
9650x000011cf,0x00000fad,0x00000385,0x00050051,
9660x00000006,0x000011d0,0x000011cf,0x00000001,
9670x00050051,0x00000006,0x000011d1,0x000011cf,
9680x00000000,0x00050080,0x00000006,0x000011d6,
9690x00000fb4,0x000011d0,0x00050050,0x00000007,
9700x000011d7,0x000011d1,0x000011d6,0x0004007c,
9710x00000014,0x000011c7,0x000011d7,0x00060041,
9720x000000d8,0x000011bf,0x000011c7,0x000000d7,
9730x000000d7,0x0005003e,0x000011bf,0x000000a3,
9740x00000002,0x00000004,0x000200f9,0x00000a19,
9750x000200f8,0x00000a19,0x000200f9,0x00000a6e,
9760x000200f8,0x00000a15,0x00050041,0x000000fb,
9770x00000a1d,0x000000f9,0x000004d5,0x0004003d,
9780x00000006,0x00000a1e,0x00000a1d,0x000500ae,
9790x0000002f,0x00000a1f,0x000009e9,0x00000a1e,
9800x000300f7,0x00000a21,0x00000000,0x000400fa,
9810x00000a1f,0x00000a20,0x00000a21,0x000200f8,
9820x00000a20,0x000200f9,0x00000a6e,0x000200f8,
9830x00000a21,0x000500aa,0x0000002f,0x00000a25,
9840x000009eb,0x000000a3,0x000300f7,0x00000a27,
9850x00000000,0x000400fa,0x00000a25,0x00000a26,
9860x00000a48,0x000200f8,0x00000a26,0x00050041,
9870x000000fb,0x00000a28,0x000000f9,0x000008c7,
9880x0004003d,0x00000006,0x00000a29,0x00000a28,
9890x00050084,0x00000006,0x00000a2b,0x00000107,
9900x000009e9,0x00050080,0x00000006,0x00000a2c,
9910x00000a29,0x00000a2b,0x00050041,0x00000153,
9920x00000a2e,0x000000f9,0x000000d7,0x0004003d,
9930x00000007,0x00000a2f,0x00000a2e,0x00050051,
9940x00000006,0x000011ed,0x00000a2f,0x00000000,
9950x00050095,0x000000a8,0x000011ef,0x000011ed,
9960x00000a2c,0x00050051,0x00000006,0x000011f0,
9970x000011ef,0x00000001,0x00050051,0x00000006,
9980x000011f1,0x000011ef,0x00000000,0x00050051,
9990x00000006,0x000011f4,0x00000a2f,0x00000001,
10000x00050080,0x00000006,0x000011f6,0x000011f4,
10010x000011f0,0x00050050,0x00000007,0x000011f7,
10020x000011f1,0x000011f6,0x0004007c,0x00000014,
10030x000011e7,0x000011f7,0x00060041,0x000000d8,
10040x000011df,0x000011e7,0x000000d7,0x000000d7,
10050x0005003e,0x000011df,0x0000037d,0x00000002,
10060x00000004,0x000500b0,0x0000002f,0x00000a34,
10070x000009e9,0x000002b4,0x000300f7,0x00000a36,
10080x00000000,0x000400fa,0x00000a34,0x00000a35,
10090x00000a36,0x000200f8,0x00000a35,0x00050041,
10100x00000153,0x00000a3a,0x000000f9,0x00000151,
10110x0004003d,0x00000007,0x00000a3b,0x00000a3a,
10120x00050051,0x00000006,0x0000120d,0x00000a3b,
10130x00000000,0x00050095,0x000000a8,0x0000120f,
10140x0000120d,0x00000a2b,0x00050051,0x00000006,
10150x00001210,0x0000120f,0x00000001,0x00050051,
10160x00000006,0x00001211,0x0000120f,0x00000000,
10170x00050051,0x00000006,0x00001214,0x00000a3b,
10180x00000001,0x00050080,0x00000006,0x00001216,
10190x00001214,0x00001210,0x00050050,0x00000007,
10200x00001217,0x00001211,0x00001216,0x0004007c,
10210x00000014,0x00001207,0x00001217,0x00060041,
10220x000000d8,0x000011ff,0x00001207,0x000000d7,
10230x000000d7,0x0005003e,0x000011ff,0x0000037d,
10240x00000002,0x00000004,0x00050080,0x00000006,
10250x00000a41,0x00000115,0x00000a2b,0x00050095,
10260x000000a8,0x0000122f,0x0000120d,0x00000a41,
10270x00050051,0x00000006,0x00001230,0x0000122f,
10280x00000001,0x00050051,0x00000006,0x00001231,
10290x0000122f,0x00000000,0x00050080,0x00000006,
10300x00001236,0x00001214,0x00001230,0x00050050,
10310x00000007,0x00001237,0x00001231,0x00001236,
10320x0004007c,0x00000014,0x00001227,0x00001237,
10330x00060041,0x000000d8,0x0000121f,0x00001227,
10340x000000d7,0x000000d7,0x0005003e,0x0000121f,
10350x000000a3,0x00000002,0x00000004,0x000200f9,
10360x00000a36,0x000200f8,0x00000a36,0x000200f9,
10370x00000a27,0x000200f8,0x00000a48,0x000500aa,
10380x0000002f,0x00000a4b,0x000009eb,0x000000ad,
10390x000300f7,0x00000a4d,0x00000000,0x000400fa,
10400x00000a4b,0x00000a4c,0x00000a51,0x000200f8,
10410x00000a4c,0x000200f9,0x00001267,0x000200f8,
10420x00001267,0x000700f5,0x00000006,0x00002b1e,
10430x000000a3,0x00000a4c,0x00001277,0x00001275,
10440x000500b0,0x0000002f,0x0000126a,0x00002b1e,
10450x000002b4,0x000400f6,0x00001278,0x00001275,
10460x00000000,0x000400fa,0x0000126a,0x0000126b,
10470x00001278,0x000200f8,0x0000126b,0x00050084,
10480x00000006,0x0000126e,0x000002b4,0x000009e9,
10490x00050080,0x00000006,0x00001270,0x0000126e,
10500x00002b1e,0x000300f7,0x00001335,0x00000000,
10510x000300fb,0x000000a3,0x00001313,0x000200f8,
10520x00001313,0x00050041,0x000000fb,0x00001314,
10530x000000f9,0x00000278,0x0004003d,0x00000006,
10540x00001315,0x00001314,0x000500aa,0x0000002f,
10550x00001316,0x00001315,0x000000a3,0x000300f7,
10560x00001319,0x00000000,0x000400fa,0x00001316,
10570x00001317,0x00001319,0x000200f8,0x00001317,
10580x000200f9,0x00001335,0x000200f8,0x00001319,
10590x000500aa,0x0000002f,0x0000131c,0x00001315,
10600x0000016d,0x000300f7,0x00001323,0x00000000,
10610x000400fa,0x0000131c,0x0000131d,0x00001323,
10620x000200f8,0x0000131d,0x00050084,0x00000006,
10630x0000131f,0x00000107,0x00001270,0x00050041,
10640x00000153,0x00001320,0x000000f9,0x0000020a,
10650x0004003d,0x00000007,0x00001321,0x00001320,
10660x00050051,0x00000006,0x0000134d,0x00001321,
10670x00000000,0x00050095,0x000000a8,0x0000134f,
10680x0000134d,0x0000131f,0x00050051,0x00000006,
10690x00001350,0x0000134f,0x00000001,0x00050051,
10700x00000006,0x00001351,0x0000134f,0x00000000,
10710x00050051,0x00000006,0x00001354,0x00001321,
10720x00000001,0x00050080,0x00000006,0x00001356,
10730x00001354,0x00001350,0x00050050,0x00000007,
10740x00001357,0x00001351,0x00001356,0x0004007c,
10750x00000014,0x00001347,0x00001357,0x00060041,
10760x000000d8,0x0000133e,0x00001347,0x000000d7,
10770x000000d7,0x0006003d,0x00000006,0x0000133f,
10780x0000133e,0x00000002,0x00000004,0x000200f9,
10790x00001335,0x000200f8,0x00001323,0x000500c2,
10800x00000006,0x00001325,0x00001270,0x00000151,
10810x00050084,0x00000006,0x00001326,0x00000107,
10820x00001325,0x00050041,0x00000153,0x00001327,
10830x000000f9,0x0000020a,0x0004003d,0x00000007,
10840x00001328,0x00001327,0x00050051,0x00000006,
10850x0000136e,0x00001328,0x00000000,0x00050095,
10860x000000a8,0x00001370,0x0000136e,0x00001326,
10870x00050051,0x00000006,0x00001371,0x00001370,
10880x00000001,0x00050051,0x00000006,0x00001372,
10890x00001370,0x00000000,0x00050051,0x00000006,
10900x00001375,0x00001328,0x00000001,0x00050080,
10910x00000006,0x00001377,0x00001375,0x00001371,
10920x00050050,0x00000007,0x00001378,0x00001372,
10930x00001377,0x0004007c,0x00000014,0x00001368,
10940x00001378,0x00060041,0x000000d8,0x0000135f,
10950x00001368,0x000000d7,0x000000d7,0x0006003d,
10960x00000006,0x00001360,0x0000135f,0x00000002,
10970x00000004,0x000500c7,0x00000006,0x0000132b,
10980x00001270,0x000000ad,0x000500ab,0x0000002f,
10990x0000132c,0x0000132b,0x000000a3,0x000300f7,
11000x00001333,0x00000000,0x000400fa,0x0000132c,
11010x0000132d,0x00001330,0x000200f8,0x0000132d,
11020x000500c2,0x00000006,0x0000132f,0x00001360,
11030x0000023b,0x000200f9,0x00001333,0x000200f8,
11040x00001330,0x000500c7,0x00000006,0x00001332,
11050x00001360,0x000002a0,0x000200f9,0x00001333,
11060x000200f8,0x00001333,0x000700f5,0x00000006,
11070x00002b28,0x0000132f,0x0000132d,0x00001332,
11080x00001330,0x000200f9,0x00001335,0x000200f8,
11090x00001335,0x000900f5,0x00000006,0x00002b29,
11100x00001270,0x00001317,0x0000133f,0x0000131d,
11110x00002b28,0x00001333,0x00050041,0x000000fb,
11120x00001389,0x000000f9,0x0000024d,0x0004003d,
11130x00000006,0x0000138a,0x00001389,0x00050084,
11140x00000006,0x0000138b,0x00002b29,0x0000138a,
11150x00050041,0x00000153,0x0000138c,0x000000f9,
11160x00000202,0x0004003d,0x00000007,0x0000138d,
11170x0000138c,0x00050051,0x00000006,0x000013a8,
11180x0000138d,0x00000000,0x00050095,0x000000a8,
11190x000013aa,0x000013a8,0x0000138b,0x00050051,
11200x00000006,0x000013ab,0x000013aa,0x00000001,
11210x00050051,0x00000006,0x000013ac,0x000013aa,
11220x00000000,0x00050051,0x00000006,0x000013af,
11230x0000138d,0x00000001,0x00050080,0x00000006,
11240x000013b1,0x000013af,0x000013ab,0x00050095,
11250x000000a8,0x000013cb,0x000013ac,0x000000a3,
11260x00050051,0x00000006,0x000013cc,0x000013cb,
11270x00000001,0x00050051,0x00000006,0x000013cd,
11280x000013cb,0x00000000,0x00050080,0x00000006,
11290x000013d2,0x000013b1,0x000013cc,0x00050050,
11300x00000007,0x000013d3,0x000013cd,0x000013d2,
11310x0004007c,0x00000014,0x000013c3,0x000013d3,
11320x00060041,0x000000d8,0x000013ba,0x000013c3,
11330x000000d7,0x000000d7,0x0006003d,0x00000006,
11340x000013bb,0x000013ba,0x00000002,0x00000004,
11350x0004007c,0x00000027,0x00001391,0x000013bb,
11360x00050095,0x000000a8,0x000013ec,0x000013ac,
11370x00000107,0x00050051,0x00000006,0x000013ed,
11380x000013ec,0x00000001,0x00050051,0x00000006,
11390x000013ee,0x000013ec,0x00000000,0x00050080,
11400x00000006,0x000013f3,0x000013b1,0x000013ed,
11410x00050050,0x00000007,0x000013f4,0x000013ee,
11420x000013f3,0x0004007c,0x00000014,0x000013e4,
11430x000013f4,0x00060041,0x000000d8,0x000013db,
11440x000013e4,0x000000d7,0x000000d7,0x0006003d,
11450x00000006,0x000013dc,0x000013db,0x00000002,
11460x00000004,0x0004007c,0x00000027,0x00001394,
11470x000013dc,0x00050041,0x000000fb,0x00001395,
11480x000000f9,0x00000263,0x0004003d,0x00000006,
11490x00001396,0x00001395,0x000500aa,0x0000002f,
11500x00001397,0x00001396,0x000000ad,0x000300f7,
11510x0000139d,0x00000000,0x000400fa,0x00001397,
11520x00001398,0x00001399,0x000200f8,0x00001398,
11530x000200f9,0x0000139d,0x000200f8,0x00001399,
11540x00050095,0x000000a8,0x0000140d,0x000013ac,
11550x0000010e,0x00050051,0x00000006,0x0000140e,
11560x0000140d,0x00000001,0x00050051,0x00000006,
11570x0000140f,0x0000140d,0x00000000,0x00050080,
11580x00000006,0x00001414,0x000013b1,0x0000140e,
11590x00050050,0x00000007,0x00001415,0x0000140f,
11600x00001414,0x0004007c,0x00000014,0x00001405,
11610x00001415,0x00060041,0x000000d8,0x000013fc,
11620x00001405,0x000000d7,0x000000d7,0x0006003d,
11630x00000006,0x000013fd,0x000013fc,0x00000002,
11640x00000004,0x0004007c,0x00000027,0x0000139c,
11650x000013fd,0x000200f9,0x0000139d,0x000200f8,
11660x0000139d,0x000700f5,0x00000027,0x00002b2a,
11670x0000026a,0x00001398,0x0000139c,0x00001399,
11680x00060050,0x0000004b,0x000013a2,0x00001391,
11690x00001394,0x00002b2a,0x000300f7,0x0000145b,
11700x00000000,0x000300fb,0x000000a3,0x00001427,
11710x000200f8,0x00001427,0x00050041,0x00000153,
11720x00001428,0x000000f9,0x00000212,0x0004003d,
11730x00000007,0x00001429,0x00001428,0x00050051,
11740x00000006,0x00001460,0x00001429,0x00000000,
11750x000500aa,0x0000002f,0x00001461,0x00001460,
11760x000000a3,0x000300f7,0x00001466,0x00000000,
11770x000400fa,0x00001461,0x00001462,0x00001466,
11780x000200f8,0x00001462,0x00050051,0x00000006,
11790x00001464,0x00001429,0x00000001,0x000500aa,
11800x0000002f,0x00001465,0x00001464,0x000000a3,
11810x000200f9,0x00001466,0x000200f8,0x00001466,
11820x000700f5,0x0000002f,0x00001467,0x00001461,
11830x00001427,0x00001465,0x00001462,0x000300f7,
11840x0000142d,0x00000000,0x000400fa,0x00001467,
11850x0000142b,0x0000142d,0x000200f8,0x0000142b,
11860x000200f9,0x0000145b,0x000200f8,0x0000142d,
11870x000200f9,0x0000142e,0x000200f8,0x0000142e,
11880x000700f5,0x00000006,0x00002b2b,0x000000a3,
11890x0000142d,0x00001458,0x00001432,0x000500b0,
11900x0000002f,0x00001431,0x00002b2b,0x000002b4,
11910x000400f6,0x00001459,0x00001432,0x00000000,
11920x000400fa,0x00001431,0x00001432,0x00001459,
11930x000200f8,0x00001432,0x00050084,0x00000006,
11940x00001434,0x0000011c,0x00002b2b,0x00050095,
11950x000000a8,0x00001480,0x00001460,0x00001434,
11960x00050051,0x00000006,0x00001481,0x00001480,
11970x00000001,0x00050051,0x00000006,0x00001482,
11980x00001480,0x00000000,0x00050051,0x00000006,
11990x00001485,0x00001429,0x00000001,0x00050080,
12000x00000006,0x00001487,0x00001485,0x00001481,
12010x00050050,0x00000007,0x00001488,0x00001482,
12020x00001487,0x0004007c,0x00000014,0x00001478,
12030x00001488,0x00060041,0x000000d8,0x0000146f,
12040x00001478,0x000000d7,0x000000d7,0x0006003d,
12050x00000006,0x00001470,0x0000146f,0x00000002,
12060x00000004,0x0004007c,0x00000027,0x00001439,
12070x00001470,0x00050080,0x00000006,0x0000143b,
12080x00001434,0x00000107,0x00050095,0x000000a8,
12090x000014a1,0x00001460,0x0000143b,0x00050051,
12100x00000006,0x000014a2,0x000014a1,0x00000001,
12110x00050051,0x00000006,0x000014a3,0x000014a1,
12120x00000000,0x00050080,0x00000006,0x000014a8,
12130x00001485,0x000014a2,0x00050050,0x00000007,
12140x000014a9,0x000014a3,0x000014a8,0x0004007c,
12150x00000014,0x00001499,0x000014a9,0x00060041,
12160x000000d8,0x00001490,0x00001499,0x000000d7,
12170x000000d7,0x0006003d,0x00000006,0x00001491,
12180x00001490,0x00000002,0x00000004,0x0004007c,
12190x00000027,0x0000143f,0x00001491,0x00050080,
12200x00000006,0x00001441,0x00001434,0x0000010e,
12210x00050095,0x000000a8,0x000014c2,0x00001460,
12220x00001441,0x00050051,0x00000006,0x000014c3,
12230x000014c2,0x00000001,0x00050051,0x00000006,
12240x000014c4,0x000014c2,0x00000000,0x00050080,
12250x00000006,0x000014c9,0x00001485,0x000014c3,
12260x00050050,0x00000007,0x000014ca,0x000014c4,
12270x000014c9,0x0004007c,0x00000014,0x000014ba,
12280x000014ca,0x00060041,0x000000d8,0x000014b1,
12290x000014ba,0x000000d7,0x000000d7,0x0006003d,
12300x00000006,0x000014b2,0x000014b1,0x00000002,
12310x00000004,0x0004007c,0x00000027,0x00001445,
12320x000014b2,0x00050080,0x00000006,0x00001447,
12330x00001434,0x00000115,0x00050095,0x000000a8,
12340x000014e3,0x00001460,0x00001447,0x00050051,
12350x00000006,0x000014e4,0x000014e3,0x00000001,
12360x00050051,0x00000006,0x000014e5,0x000014e3,
12370x00000000,0x00050080,0x00000006,0x000014ea,
12380x00001485,0x000014e4,0x00050050,0x00000007,
12390x000014eb,0x000014e5,0x000014ea,0x0004007c,
12400x00000014,0x000014db,0x000014eb,0x00060041,
12410x000000d8,0x000014d2,0x000014db,0x000000d7,
12420x000000d7,0x0006003d,0x00000006,0x000014d3,
12430x000014d2,0x00000002,0x00000004,0x0004007c,
12440x00000027,0x0000144b,0x000014d3,0x00070050,
12450x000002b9,0x0000144c,0x00001439,0x0000143f,
12460x00001445,0x0000144b,0x0008004f,0x0000004b,
12470x0000144f,0x0000144c,0x0000144c,0x00000000,
12480x00000001,0x00000002,0x00050094,0x00000027,
12490x00001451,0x0000144f,0x000013a2,0x00050081,
12500x00000027,0x00001454,0x00001451,0x0000144b,
12510x00050041,0x00000028,0x00001455,0x00001424,
12520x00002b2b,0x0003003e,0x00001455,0x00001454,
12530x00050080,0x00000006,0x00001458,0x00002b2b,
12540x00000151,0x000200f9,0x0000142e,0x000200f8,
12550x00001459,0x0004003d,0x0000004b,0x0000145a,
12560x00001424,0x000200f9,0x0000145b,0x000200f8,
12570x0000145b,0x000700f5,0x0000004b,0x00002b2c,
12580x000013a2,0x0000142b,0x0000145a,0x00001459,
12590x00050041,0x0000004c,0x00001274,0x00001239,
12600x00002b1e,0x0003003e,0x00001274,0x00002b2c,
12610x000200f9,0x00001275,0x000200f8,0x00001275,
12620x00050080,0x00000006,0x00001277,0x00002b1e,
12630x00000151,0x000200f9,0x00001267,0x000200f8,
12640x00001278,0x00050041,0x000000fb,0x00001279,
12650x000000f9,0x00000305,0x0004003d,0x00000006,
12660x0000127a,0x00001279,0x00050080,0x00000006,
12670x0000127c,0x0000127a,0x000009e9,0x00050041,
12680x000000fb,0x0000127d,0x000000f9,0x00000229,
12690x0004003d,0x00000006,0x0000127e,0x0000127d,
12700x00050084,0x00000006,0x00001280,0x00000104,
12710x0000127c,0x00050080,0x00000006,0x00001281,
12720x0000127e,0x00001280,0x000200f9,0x00001282,
12730x000200f8,0x00001282,0x000700f5,0x00000006,
12740x00002b1f,0x000000a3,0x00001278,0x000012a9,
12750x00001286,0x000500b0,0x0000002f,0x00001285,
12760x00002b1f,0x000002b4,0x000400f6,0x000012aa,
12770x00001286,0x00000000,0x000400fa,0x00001285,
12780x00001286,0x000012aa,0x000200f8,0x00001286,
12790x00050084,0x00000006,0x00001289,0x00000115,
12800x00002b1f,0x00050080,0x00000006,0x0000128a,
12810x00001281,0x00001289,0x00050041,0x00000153,
12820x0000128c,0x000000f9,0x000000d7,0x0004003d,
12830x00000007,0x0000128d,0x0000128c,0x00060041,
12840x00000028,0x0000128e,0x00001239,0x00002b1f,
12850x000000a3,0x0004003d,0x00000027,0x0000128f,
12860x0000128e,0x0004007c,0x00000006,0x000014f1,
12870x0000128f,0x00050051,0x00000006,0x0000150a,
12880x0000128d,0x00000000,0x00050095,0x000000a8,
12890x0000150c,0x0000150a,0x0000128a,0x00050051,
12900x00000006,0x0000150d,0x0000150c,0x00000001,
12910x00050051,0x00000006,0x0000150e,0x0000150c,
12920x00000000,0x00050051,0x00000006,0x00001511,
12930x0000128d,0x00000001,0x00050080,0x00000006,
12940x00001513,0x00001511,0x0000150d,0x00050050,
12950x00000007,0x00001514,0x0000150e,0x00001513,
12960x0004007c,0x00000014,0x00001504,0x00001514,
12970x00060041,0x000000d8,0x000014fc,0x00001504,
12980x000000d7,0x000000d7,0x0005003e,0x000014fc,
12990x000014f1,0x00000002,0x00000004,0x00050080,
13000x00000006,0x00001295,0x0000128a,0x00000107,
13010x00060041,0x00000028,0x00001299,0x00001239,
13020x00002b1f,0x000000ad,0x0004003d,0x00000027,
13030x0000129a,0x00001299,0x0004007c,0x00000006,
13040x0000151a,0x0000129a,0x00050095,0x000000a8,
13050x00001535,0x0000150a,0x00001295,0x00050051,
13060x00000006,0x00001536,0x00001535,0x00000001,
13070x00050051,0x00000006,0x00001537,0x00001535,
13080x00000000,0x00050080,0x00000006,0x0000153c,
13090x00001511,0x00001536,0x00050050,0x00000007,
13100x0000153d,0x00001537,0x0000153c,0x0004007c,
13110x00000014,0x0000152d,0x0000153d,0x00060041,
13120x000000d8,0x00001525,0x0000152d,0x000000d7,
13130x000000d7,0x0005003e,0x00001525,0x0000151a,
13140x00000002,0x00000004,0x00050080,0x00000006,
13150x000012a0,0x0000128a,0x0000010e,0x00060041,
13160x00000028,0x000012a4,0x00001239,0x00002b1f,
13170x0000016d,0x0004003d,0x00000027,0x000012a5,
13180x000012a4,0x0004007c,0x00000006,0x00001543,
13190x000012a5,0x00050095,0x000000a8,0x0000155e,
13200x0000150a,0x000012a0,0x00050051,0x00000006,
13210x0000155f,0x0000155e,0x00000001,0x00050051,
13220x00000006,0x00001560,0x0000155e,0x00000000,
13230x00050080,0x00000006,0x00001565,0x00001511,
13240x0000155f,0x00050050,0x00000007,0x00001566,
13250x00001560,0x00001565,0x0004007c,0x00000014,
13260x00001556,0x00001566,0x00060041,0x000000d8,
13270x0000154e,0x00001556,0x000000d7,0x000000d7,
13280x0005003e,0x0000154e,0x00001543,0x00000002,
13290x00000004,0x00050080,0x00000006,0x000012a9,
13300x00002b1f,0x00000151,0x000200f9,0x00001282,
13310x000200f8,0x000012aa,0x00050080,0x00000006,
13320x000012ac,0x00001281,0x00000344,0x00050041,
13330x00000153,0x000012ad,0x000000f9,0x000000d7,
13340x0004003d,0x00000007,0x000012ae,0x000012ad,
13350x00060041,0x00000028,0x000012af,0x00001239,
13360x00000202,0x000000a3,0x0004003d,0x00000027,
13370x000012b0,0x000012af,0x0004007c,0x00000006,
13380x0000156c,0x000012b0,0x00050051,0x00000006,
13390x00001585,0x000012ae,0x00000000,0x00050095,
13400x000000a8,0x00001587,0x00001585,0x000012ac,
13410x00050051,0x00000006,0x00001588,0x00001587,
13420x00000001,0x00050051,0x00000006,0x00001589,
13430x00001587,0x00000000,0x00050051,0x00000006,
13440x0000158c,0x000012ae,0x00000001,0x00050080,
13450x00000006,0x0000158e,0x0000158c,0x00001588,
13460x00050050,0x00000007,0x0000158f,0x00001589,
13470x0000158e,0x0004007c,0x00000014,0x0000157f,
13480x0000158f,0x00060041,0x000000d8,0x00001577,
13490x0000157f,0x000000d7,0x000000d7,0x0005003e,
13500x00001577,0x0000156c,0x00000002,0x00000004,
13510x00050080,0x00000006,0x000012b3,0x00001281,
13520x0000034f,0x00060041,0x00000028,0x000012b6,
13530x00001239,0x00000202,0x000000ad,0x0004003d,
13540x00000027,0x000012b7,0x000012b6,0x0004007c,
13550x00000006,0x00001595,0x000012b7,0x00050095,
13560x000000a8,0x000015b0,0x00001585,0x000012b3,
13570x00050051,0x00000006,0x000015b1,0x000015b0,
13580x00000001,0x00050051,0x00000006,0x000015b2,
13590x000015b0,0x00000000,0x00050080,0x00000006,
13600x000015b7,0x0000158c,0x000015b1,0x00050050,
13610x00000007,0x000015b8,0x000015b2,0x000015b7,
13620x0004007c,0x00000014,0x000015a8,0x000015b8,
13630x00060041,0x000000d8,0x000015a0,0x000015a8,
13640x000000d7,0x000000d7,0x0005003e,0x000015a0,
13650x00001595,0x00000002,0x00000004,0x00050080,
13660x00000006,0x000012ba,0x00001281,0x0000035a,
13670x00060041,0x00000028,0x000012bd,0x00001239,
13680x00000202,0x0000016d,0x0004003d,0x00000027,
13690x000012be,0x000012bd,0x0004007c,0x00000006,
13700x000015be,0x000012be,0x00050095,0x000000a8,
13710x000015d9,0x00001585,0x000012ba,0x00050051,
13720x00000006,0x000015da,0x000015d9,0x00000001,
13730x00050051,0x00000006,0x000015db,0x000015d9,
13740x00000000,0x00050080,0x00000006,0x000015e0,
13750x0000158c,0x000015da,0x00050050,0x00000007,
13760x000015e1,0x000015db,0x000015e0,0x0004007c,
13770x00000014,0x000015d1,0x000015e1,0x00060041,
13780x000000d8,0x000015c9,0x000015d1,0x000000d7,
13790x000000d7,0x0005003e,0x000015c9,0x000015be,
13800x00000002,0x00000004,0x00050080,0x00000006,
13810x000012c1,0x00001281,0x00000365,0x00050041,
13820x000000fb,0x000012c4,0x000000f9,0x00000367,
13830x0004003d,0x00000006,0x000012c5,0x000012c4,
13840x00050095,0x000000a8,0x000015f9,0x00001585,
13850x000012c1,0x00050051,0x00000006,0x000015fa,
13860x000015f9,0x00000001,0x00050051,0x00000006,
13870x000015fb,0x000015f9,0x00000000,0x00050080,
13880x00000006,0x00001600,0x0000158c,0x000015fa,
13890x00050050,0x00000007,0x00001601,0x000015fb,
13900x00001600,0x0004007c,0x00000014,0x000015f1,
13910x00001601,0x00060041,0x000000d8,0x000015e9,
13920x000015f1,0x000000d7,0x000000d7,0x0005003e,
13930x000015e9,0x000012c5,0x00000002,0x00000004,
13940x00050080,0x00000006,0x000012c8,0x00001281,
13950x00000371,0x00050095,0x000000a8,0x00001619,
13960x00001585,0x000012c8,0x00050051,0x00000006,
13970x0000161a,0x00001619,0x00000001,0x00050051,
13980x00000006,0x0000161b,0x00001619,0x00000000,
13990x00050080,0x00000006,0x00001620,0x0000158c,
14000x0000161a,0x00050050,0x00000007,0x00001621,
14010x0000161b,0x00001620,0x0004007c,0x00000014,
14020x00001611,0x00001621,0x00060041,0x000000d8,
14030x00001609,0x00001611,0x000000d7,0x000000d7,
14040x0005003e,0x00001609,0x000009e9,0x00000002,
14050x00000004,0x00050080,0x00000006,0x000012ce,
14060x00001281,0x0000037b,0x00050095,0x000000a8,
14070x00001639,0x00001585,0x000012ce,0x00050051,
14080x00000006,0x0000163a,0x00001639,0x00000001,
14090x00050051,0x00000006,0x0000163b,0x00001639,
14100x00000000,0x00050080,0x00000006,0x00001640,
14110x0000158c,0x0000163a,0x00050050,0x00000007,
14120x00001641,0x0000163b,0x00001640,0x0004007c,
14130x00000014,0x00001631,0x00001641,0x00060041,
14140x000000d8,0x00001629,0x00001631,0x000000d7,
14150x000000d7,0x0005003e,0x00001629,0x0000037d,
14160x00000002,0x00000004,0x00050080,0x00000006,
14170x000012d3,0x00001281,0x00000385,0x00050095,
14180x000000a8,0x00001659,0x00001585,0x000012d3,
14190x00050051,0x00000006,0x0000165a,0x00001659,
14200x00000001,0x00050051,0x00000006,0x0000165b,
14210x00001659,0x00000000,0x00050080,0x00000006,
14220x00001660,0x0000158c,0x0000165a,0x00050050,
14230x00000007,0x00001661,0x0000165b,0x00001660,
14240x0004007c,0x00000014,0x00001651,0x00001661,
14250x00060041,0x000000d8,0x00001649,0x00001651,
14260x000000d7,0x000000d7,0x0005003e,0x00001649,
14270x00000387,0x00000002,0x00000004,0x00050041,
14280x0000004c,0x000012d7,0x00001239,0x000000d7,
14290x0004003d,0x0000004b,0x000012d8,0x000012d7,
14300x0004009c,0x00000392,0x000012d9,0x000012d8,
14310x0004009a,0x0000002f,0x000012da,0x000012d9,
14320x000400a8,0x0000002f,0x000012db,0x000012da,
14330x000300f7,0x000012e1,0x00000000,0x000400fa,
14340x000012db,0x000012dc,0x000012e1,0x000200f8,
14350x000012dc,0x00050041,0x0000004c,0x000012dd,
14360x00001239,0x00000151,0x0004003d,0x0000004b,
14370x000012de,0x000012dd,0x0004009c,0x00000392,
14380x000012df,0x000012de,0x0004009a,0x0000002f,
14390x000012e0,0x000012df,0x000200f9,0x000012e1,
14400x000200f8,0x000012e1,0x000700f5,0x0000002f,
14410x000012e2,0x000012da,0x000012aa,0x000012e0,
14420x000012dc,0x000400a8,0x0000002f,0x000012e3,
14430x000012e2,0x000300f7,0x000012e9,0x00000000,
14440x000400fa,0x000012e3,0x000012e4,0x000012e9,
14450x000200f8,0x000012e4,0x00050041,0x0000004c,
14460x000012e5,0x00001239,0x00000202,0x0004003d,
14470x0000004b,0x000012e6,0x000012e5,0x0004009c,
14480x00000392,0x000012e7,0x000012e6,0x0004009a,
14490x0000002f,0x000012e8,0x000012e7,0x000200f9,
14500x000012e9,0x000200f8,0x000012e9,0x000700f5,
14510x0000002f,0x000012ea,0x000012e2,0x000012e1,
14520x000012e8,0x000012e4,0x0004003d,0x0000004b,
14530x000012ec,0x000012d7,0x00050041,0x0000004c,
14540x000012ed,0x00001239,0x00000151,0x0004003d,
14550x0000004b,0x000012ee,0x000012ed,0x0007000c,
14560x0000004b,0x000012ef,0x00000001,0x00000025,
14570x000012ec,0x000012ee,0x00050041,0x0000004c,
14580x000012f0,0x00001239,0x00000202,0x0004003d,
14590x0000004b,0x000012f1,0x000012f0,0x0007000c,
14600x0000004b,0x000012f2,0x00000001,0x00000025,
14610x000012ef,0x000012f1,0x0004003d,0x0000004b,
14620x000012f4,0x000012d7,0x0004003d,0x0000004b,
14630x000012f6,0x000012ed,0x0007000c,0x0000004b,
14640x000012f7,0x00000001,0x00000028,0x000012f4,
14650x000012f6,0x0004003d,0x0000004b,0x000012f9,
14660x000012f0,0x0007000c,0x0000004b,0x000012fa,
14670x00000001,0x00000028,0x000012f7,0x000012f9,
14680x00060050,0x00000392,0x00002b68,0x000012ea,
14690x000012ea,0x000012ea,0x000600a9,0x0000004b,
14700x00002b69,0x00002b68,0x00002b66,0x000012fa,
14710x000600a9,0x0000004b,0x00002b6b,0x00002b68,
14720x00002b64,0x000012f2,0x00050041,0x000000fb,
14730x000016ab,0x000000f9,0x000000fa,0x0004003d,
14740x00000006,0x000016ac,0x000016ab,0x00050084,
14750x00000006,0x000016ad,0x0000011c,0x000016ac,
14760x00050080,0x00000006,0x000016ae,0x00000104,
14770x000016ad,0x00050080,0x00000006,0x000016b4,
14780x000016ac,0x00002b67,0x00050086,0x00000006,
14790x000016b5,0x000016b4,0x000000fe,0x00050084,
14800x00000006,0x000016a7,0x00000104,0x000016b5,
14810x00050080,0x00000006,0x000016a8,0x000016ae,
14820x000016a7,0x00050084,0x00000006,0x00001678,
14830x0000014d,0x0000127c,0x00050080,0x00000006,
14840x00001679,0x000016a8,0x00001678,0x00050041,
14850x00000153,0x0000167a,0x000000f9,0x00000151,
14860x0004003d,0x00000007,0x0000167b,0x0000167a,
14870x00050051,0x00000027,0x0000167e,0x00002b6b,
14880x00000000,0x0004007c,0x00000006,0x000016bb,
14890x0000167e,0x00050051,0x00000006,0x000016d4,
14900x0000167b,0x00000000,0x00050095,0x000000a8,
14910x000016d6,0x000016d4,0x00001679,0x00050051,
14920x00000006,0x000016d7,0x000016d6,0x00000001,
14930x00050051,0x00000006,0x000016d8,0x000016d6,
14940x00000000,0x00050051,0x00000006,0x000016db,
14950x0000167b,0x00000001,0x00050080,0x00000006,
14960x000016dd,0x000016db,0x000016d7,0x00050050,
14970x00000007,0x000016de,0x000016d8,0x000016dd,
14980x0004007c,0x00000014,0x000016ce,0x000016de,
14990x00060041,0x000000d8,0x000016c6,0x000016ce,
15000x000000d7,0x000000d7,0x0005003e,0x000016c6,
15010x000016bb,0x00000002,0x00000004,0x00050080,
15020x00000006,0x00001681,0x00001679,0x00000107,
15030x00050051,0x00000027,0x00001685,0x00002b6b,
15040x00000001,0x0004007c,0x00000006,0x000016e4,
15050x00001685,0x00050095,0x000000a8,0x000016ff,
15060x000016d4,0x00001681,0x00050051,0x00000006,
15070x00001700,0x000016ff,0x00000001,0x00050051,
15080x00000006,0x00001701,0x000016ff,0x00000000,
15090x00050080,0x00000006,0x00001706,0x000016db,
15100x00001700,0x00050050,0x00000007,0x00001707,
15110x00001701,0x00001706,0x0004007c,0x00000014,
15120x000016f7,0x00001707,0x00060041,0x000000d8,
15130x000016ef,0x000016f7,0x000000d7,0x000000d7,
15140x0005003e,0x000016ef,0x000016e4,0x00000002,
15150x00000004,0x00050080,0x00000006,0x00001688,
15160x00001679,0x0000010e,0x00050051,0x00000027,
15170x0000168c,0x00002b6b,0x00000002,0x0004007c,
15180x00000006,0x0000170d,0x0000168c,0x00050095,
15190x000000a8,0x00001728,0x000016d4,0x00001688,
15200x00050051,0x00000006,0x00001729,0x00001728,
15210x00000001,0x00050051,0x00000006,0x0000172a,
15220x00001728,0x00000000,0x00050080,0x00000006,
15230x0000172f,0x000016db,0x00001729,0x00050050,
15240x00000007,0x00001730,0x0000172a,0x0000172f,
15250x0004007c,0x00000014,0x00001720,0x00001730,
15260x00060041,0x000000d8,0x00001718,0x00001720,
15270x000000d7,0x000000d7,0x0005003e,0x00001718,
15280x0000170d,0x00000002,0x00000004,0x00050080,
15290x00000006,0x0000168f,0x00001679,0x00000115,
15300x00050051,0x00000027,0x00001693,0x00002b69,
15310x00000000,0x0004007c,0x00000006,0x00001736,
15320x00001693,0x00050095,0x000000a8,0x00001751,
15330x000016d4,0x0000168f,0x00050051,0x00000006,
15340x00001752,0x00001751,0x00000001,0x00050051,
15350x00000006,0x00001753,0x00001751,0x00000000,
15360x00050080,0x00000006,0x00001758,0x000016db,
15370x00001752,0x00050050,0x00000007,0x00001759,
15380x00001753,0x00001758,0x0004007c,0x00000014,
15390x00001749,0x00001759,0x00060041,0x000000d8,
15400x00001741,0x00001749,0x000000d7,0x000000d7,
15410x0005003e,0x00001741,0x00001736,0x00000002,
15420x00000004,0x00050080,0x00000006,0x00001696,
15430x00001679,0x0000011c,0x00050051,0x00000027,
15440x0000169a,0x00002b69,0x00000001,0x0004007c,
15450x00000006,0x0000175f,0x0000169a,0x00050095,
15460x000000a8,0x0000177a,0x000016d4,0x00001696,
15470x00050051,0x00000006,0x0000177b,0x0000177a,
15480x00000001,0x00050051,0x00000006,0x0000177c,
15490x0000177a,0x00000000,0x00050080,0x00000006,
15500x00001781,0x000016db,0x0000177b,0x00050050,
15510x00000007,0x00001782,0x0000177c,0x00001781,
15520x0004007c,0x00000014,0x00001772,0x00001782,
15530x00060041,0x000000d8,0x0000176a,0x00001772,
15540x000000d7,0x000000d7,0x0005003e,0x0000176a,
15550x0000175f,0x00000002,0x00000004,0x00050080,
15560x00000006,0x0000169d,0x00001679,0x00000186,
15570x00050051,0x00000027,0x000016a1,0x00002b69,
15580x00000002,0x0004007c,0x00000006,0x00001788,
15590x000016a1,0x00050095,0x000000a8,0x000017a3,
15600x000016d4,0x0000169d,0x00050051,0x00000006,
15610x000017a4,0x000017a3,0x00000001,0x00050051,
15620x00000006,0x000017a5,0x000017a3,0x00000000,
15630x00050080,0x00000006,0x000017aa,0x000016db,
15640x000017a4,0x00050050,0x00000007,0x000017ab,
15650x000017a5,0x000017aa,0x0004007c,0x00000014,
15660x0000179b,0x000017ab,0x00060041,0x000000d8,
15670x00001793,0x0000179b,0x000000d7,0x000000d7,
15680x0005003e,0x00001793,0x00001788,0x00000002,
15690x00000004,0x000300f7,0x000017eb,0x00000000,
15700x000300fb,0x000000a3,0x000017ba,0x000200f8,
15710x000017ba,0x000500bc,0x0000002f,0x000017f2,
15720x0000167e,0x00001693,0x000300f7,0x000017f9,
15730x00000000,0x000400fa,0x000017f2,0x000017f3,
15740x000017f9,0x000200f8,0x000017f3,0x000500bc,
15750x0000002f,0x000017f8,0x00001685,0x0000169a,
15760x000200f9,0x000017f9,0x000200f8,0x000017f9,
15770x000700f5,0x0000002f,0x000017fa,0x000017f2,
15780x000017ba,0x000017f8,0x000017f3,0x000300f7,
15790x00001801,0x00000000,0x000400fa,0x000017fa,
15800x000017fb,0x00001801,0x000200f8,0x000017fb,
15810x000500bc,0x0000002f,0x00001800,0x0000168c,
15820x000016a1,0x000200f9,0x00001801,0x000200f8,
15830x00001801,0x000700f5,0x0000002f,0x00001802,
15840x000017fa,0x000017f9,0x00001800,0x000017fb,
15850x000400a8,0x0000002f,0x00001803,0x00001802,
15860x000300f7,0x000017bf,0x00000000,0x000400fa,
15870x00001803,0x000017be,0x000017bf,0x000200f8,
15880x000017be,0x000200f9,0x000017eb,0x000200f8,
15890x000017bf,0x00050081,0x0000004b,0x000017c2,
15900x00002b6b,0x00002b69,0x0005008e,0x0000004b,
15910x000017c3,0x000017c2,0x000001ea,0x00050095,
15920x000000a8,0x00001813,0x000016d4,0x000000a3,
15930x00050051,0x00000006,0x00001814,0x00001813,
15940x00000001,0x00050051,0x00000006,0x00001815,
15950x00001813,0x00000000,0x00050080,0x00000006,
15960x0000181a,0x000016db,0x00001814,0x00050050,
15970x00000007,0x0000181b,0x00001815,0x0000181a,
15980x0004007c,0x00000014,0x0000180b,0x0000181b,
15990x00060041,0x000000d8,0x000017c8,0x0000180b,
16000x000000d7,0x000000d7,0x00050051,0x00000027,
16010x000017ca,0x000017c3,0x00000000,0x0004007c,
16020x00000006,0x00001821,0x000017ca,0x000500c7,
16030x00000006,0x00001823,0x00001821,0x0000012d,
16040x000500ab,0x0000002f,0x00001824,0x00001823,
16050x000000a3,0x000300f7,0x0000182b,0x00000000,
16060x000400fa,0x00001824,0x00001825,0x00001828,
16070x000200f8,0x00001825,0x000400c8,0x00000006,
16080x00001827,0x00001821,0x000200f9,0x0000182b,
16090x000200f8,0x00001828,0x000500c5,0x00000006,
16100x0000182a,0x00001821,0x0000012d,0x000200f9,
16110x0000182b,0x000200f8,0x0000182b,0x000700f5,
16120x00000006,0x00002b22,0x00001827,0x00001825,
16130x0000182a,0x00001828,0x000700ed,0x00000006,
16140x000017cc,0x000017c8,0x000000ad,0x000000a3,
16150x00002b22,0x00060041,0x000000d8,0x000017ce,
16160x0000180b,0x000000d7,0x00000151,0x00050051,
16170x00000027,0x000017d0,0x000017c3,0x00000001,
16180x0004007c,0x00000006,0x00001832,0x000017d0,
16190x000500c7,0x00000006,0x00001834,0x00001832,
16200x0000012d,0x000500ab,0x0000002f,0x00001835,
16210x00001834,0x000000a3,0x000300f7,0x0000183c,
16220x00000000,0x000400fa,0x00001835,0x00001836,
16230x00001839,0x000200f8,0x00001836,0x000400c8,
16240x00000006,0x00001838,0x00001832,0x000200f9,
16250x0000183c,0x000200f8,0x00001839,0x000500c5,
16260x00000006,0x0000183b,0x00001832,0x0000012d,
16270x000200f9,0x0000183c,0x000200f8,0x0000183c,
16280x000700f5,0x00000006,0x00002b23,0x00001838,
16290x00001836,0x0000183b,0x00001839,0x000700ed,
16300x00000006,0x000017d2,0x000017ce,0x000000ad,
16310x000000a3,0x00002b23,0x00060041,0x000000d8,
16320x000017d4,0x0000180b,0x000000d7,0x00000202,
16330x00050051,0x00000027,0x000017d6,0x000017c3,
16340x00000002,0x0004007c,0x00000006,0x00001843,
16350x000017d6,0x000500c7,0x00000006,0x00001845,
16360x00001843,0x0000012d,0x000500ab,0x0000002f,
16370x00001846,0x00001845,0x000000a3,0x000300f7,
16380x0000184d,0x00000000,0x000400fa,0x00001846,
16390x00001847,0x0000184a,0x000200f8,0x00001847,
16400x000400c8,0x00000006,0x00001849,0x00001843,
16410x000200f9,0x0000184d,0x000200f8,0x0000184a,
16420x000500c5,0x00000006,0x0000184c,0x00001843,
16430x0000012d,0x000200f9,0x0000184d,0x000200f8,
16440x0000184d,0x000700f5,0x00000006,0x00002b24,
16450x00001849,0x00001847,0x0000184c,0x0000184a,
16460x000700ed,0x00000006,0x000017d8,0x000017d4,
16470x000000ad,0x000000a3,0x00002b24,0x00060041,
16480x000000d8,0x000017da,0x0000180b,0x000000d7,
16490x0000020a,0x000300f7,0x0000185e,0x00000000,
16500x000400fa,0x00001824,0x00001858,0x0000185b,
16510x000200f8,0x00001858,0x000400c8,0x00000006,
16520x0000185a,0x00001821,0x000200f9,0x0000185e,
16530x000200f8,0x0000185b,0x000500c5,0x00000006,
16540x0000185d,0x00001821,0x0000012d,0x000200f9,
16550x0000185e,0x000200f8,0x0000185e,0x000700f5,
16560x00000006,0x00002b25,0x0000185a,0x00001858,
16570x0000185d,0x0000185b,0x000700ef,0x00000006,
16580x000017de,0x000017da,0x000000ad,0x000000a3,
16590x00002b25,0x00060041,0x000000d8,0x000017e0,
16600x0000180b,0x000000d7,0x00000212,0x000300f7,
16610x0000186f,0x00000000,0x000400fa,0x00001835,
16620x00001869,0x0000186c,0x000200f8,0x00001869,
16630x000400c8,0x00000006,0x0000186b,0x00001832,
16640x000200f9,0x0000186f,0x000200f8,0x0000186c,
16650x000500c5,0x00000006,0x0000186e,0x00001832,
16660x0000012d,0x000200f9,0x0000186f,0x000200f8,
16670x0000186f,0x000700f5,0x00000006,0x00002b26,
16680x0000186b,0x00001869,0x0000186e,0x0000186c,
16690x000700ef,0x00000006,0x000017e4,0x000017e0,
16700x000000ad,0x000000a3,0x00002b26,0x00060041,
16710x000000d8,0x000017e6,0x0000180b,0x000000d7,
16720x0000021a,0x000300f7,0x00001880,0x00000000,
16730x000400fa,0x00001846,0x0000187a,0x0000187d,
16740x000200f8,0x0000187a,0x000400c8,0x00000006,
16750x0000187c,0x00001843,0x000200f9,0x00001880,
16760x000200f8,0x0000187d,0x000500c5,0x00000006,
16770x0000187f,0x00001843,0x0000012d,0x000200f9,
16780x00001880,0x000200f8,0x00001880,0x000700f5,
16790x00000006,0x00002b27,0x0000187c,0x0000187a,
16800x0000187f,0x0000187d,0x000700ef,0x00000006,
16810x000017ea,0x000017e6,0x000000ad,0x000000a3,
16820x00002b27,0x000200f9,0x000017eb,0x000200f8,
16830x000017eb,0x000200f9,0x00000a4d,0x000200f8,
16840x00000a51,0x000500aa,0x0000002f,0x00000a54,
16850x000009eb,0x0000016d,0x000300f7,0x00000a56,
16860x00000000,0x000400fa,0x00000a54,0x00000a55,
16870x00000a5a,0x000200f8,0x00000a55,0x00050084,
16880x00000006,0x000018e9,0x00000104,0x000009e9,
16890x000200f9,0x000018ea,0x000200f8,0x000018ea,
16900x000700f5,0x00000006,0x00002ad4,0x000000a3,
16910x00000a55,0x000018fb,0x000018ee,0x000500b0,
16920x0000002f,0x000018ed,0x00002ad4,0x00000115,
16930x000400f6,0x000018fc,0x000018ee,0x00000000,
16940x000400fa,0x000018ed,0x000018ee,0x000018fc,
16950x000200f8,0x000018ee,0x00050084,0x00000006,
16960x000018f2,0x00000107,0x00002ad4,0x00050080,
16970x00000006,0x000018f3,0x000018e9,0x000018f2,
16980x00050041,0x00000153,0x000018f4,0x000000f9,
16990x00000202,0x0004003d,0x00000007,0x000018f5,
17000x000018f4,0x00050051,0x00000006,0x00001ab6,
17010x000018f5,0x00000000,0x00050095,0x000000a8,
17020x00001ab8,0x00001ab6,0x000018f3,0x00050051,
17030x00000006,0x00001ab9,0x00001ab8,0x00000001,
17040x00050051,0x00000006,0x00001aba,0x00001ab8,
17050x00000000,0x00050051,0x00000006,0x00001abd,
17060x000018f5,0x00000001,0x00050080,0x00000006,
17070x00001abf,0x00001abd,0x00001ab9,0x00050050,
17080x00000007,0x00001ac0,0x00001aba,0x00001abf,
17090x0004007c,0x00000014,0x00001ab0,0x00001ac0,
17100x00060041,0x000000d8,0x00001aa7,0x00001ab0,
17110x000000d7,0x000000d7,0x0006003d,0x00000006,
17120x00001aa8,0x00001aa7,0x00000002,0x00000004,
17130x0004007c,0x00000027,0x000018f7,0x00001aa8,
17140x00050041,0x00000028,0x000018f8,0x00001884,
17150x00002ad4,0x0003003e,0x000018f8,0x000018f7,
17160x00050080,0x00000006,0x000018fb,0x00002ad4,
17170x00000151,0x000200f9,0x000018ea,0x000200f8,
17180x000018fc,0x00050080,0x00000006,0x000018fe,
17190x000018e9,0x00000365,0x00050041,0x00000153,
17200x000018ff,0x000000f9,0x00000202,0x0004003d,
17210x00000007,0x00001900,0x000018ff,0x00050051,
17220x00000006,0x00001ad7,0x00001900,0x00000000,
17230x00050095,0x000000a8,0x00001ad9,0x00001ad7,
17240x000018fe,0x00050051,0x00000006,0x00001ada,
17250x00001ad9,0x00000001,0x00050051,0x00000006,
17260x00001adb,0x00001ad9,0x00000000,0x00050051,
17270x00000006,0x00001ade,0x00001900,0x00000001,
17280x00050080,0x00000006,0x00001ae0,0x00001ade,
17290x00001ada,0x00050050,0x00000007,0x00001ae1,
17300x00001adb,0x00001ae0,0x0004007c,0x00000014,
17310x00001ad1,0x00001ae1,0x00060041,0x000000d8,
17320x00001ac8,0x00001ad1,0x000000d7,0x000000d7,
17330x0006003d,0x00000006,0x00001ac9,0x00001ac8,
17340x00000002,0x00000004,0x00050080,0x00000006, 8880x00000002,0x00000004,0x00050080,0x00000006,
17350x00001903,0x000018e9,0x00000371,0x00050095, 8890x00001005,0x00003148,0x00000107,0x000200f9,
17360x000000a8,0x00001afa,0x00001ad7,0x00001903, 8900x00000fe9,0x000200f8,0x00001006,0x000200f9,
17370x00050051,0x00000006,0x00001afb,0x00001afa, 8910x00000bb6,0x000200f8,0x00000b3d,0x000500aa,
17380x00000001,0x00050051,0x00000006,0x00001afc, 8920x0000002f,0x00000b45,0x00000b13,0x00000239,
17390x00001afa,0x00000000,0x00050080,0x00000006, 8930x000300f7,0x00000b47,0x00000000,0x000400fa,
17400x00001b01,0x00001ade,0x00001afb,0x00050050, 8940x00000b45,0x00000b46,0x00000b47,0x000200f8,
17410x00000007,0x00001b02,0x00001afc,0x00001b01, 8950x00000b46,0x000500aa,0x0000002f,0x00000b49,
17420x0004007c,0x00000014,0x00001af2,0x00001b02, 8960x00000b11,0x000000a6,0x000300f7,0x00000b4b,
17430x00060041,0x000000d8,0x00001ae9,0x00001af2, 8970x00000000,0x000400fa,0x00000b49,0x00000b4a,
17440x000000d7,0x000000d7,0x0006003d,0x00000006, 8980x00000b4b,0x000200f8,0x00000b4a,0x00050041,
17450x00001aea,0x00001ae9,0x00000002,0x00000004, 8990x000000fe,0x000010d1,0x000000fc,0x00000308,
17460x00050080,0x00000006,0x00001908,0x000018e9, 9000x0004003d,0x00000006,0x000010d2,0x000010d1,
17470x0000037b,0x00050095,0x000000a8,0x00001b1b, 9010x00050041,0x000000fe,0x000010d3,0x000000fc,
17480x00001ad7,0x00001908,0x00050051,0x00000006, 9020x0000096c,0x0004003d,0x00000006,0x000010d4,
17490x00001b1c,0x00001b1b,0x00000001,0x00050051, 9030x000010d3,0x00050080,0x00000006,0x000010d6,
17500x00000006,0x00001b1d,0x00001b1b,0x00000000, 9040x000010d4,0x000010d2,0x00050041,0x000000fe,
17510x00050080,0x00000006,0x00001b22,0x00001ade, 9050x00001167,0x000000fc,0x000000fd,0x0004003d,
17520x00001b1c,0x00050050,0x00000007,0x00001b23, 9060x00000006,0x00001168,0x00001167,0x00050084,
17530x00001b1d,0x00001b22,0x0004007c,0x00000014, 9070x00000006,0x00001169,0x0000011f,0x00001168,
17540x00001b13,0x00001b23,0x00060041,0x000000d8, 9080x00050080,0x00000006,0x0000116a,0x00000107,
17550x00001b0a,0x00001b13,0x000000d7,0x000000d7, 9090x00001169,0x00050080,0x00000006,0x00001170,
17560x0006003d,0x00000006,0x00001b0b,0x00001b0a, 9100x00001168,0x0000319c,0x00050086,0x00000006,
17570x00000002,0x00000004,0x00050080,0x00000006, 9110x00001171,0x00001170,0x00000101,0x00050084,
17580x0000190d,0x000018e9,0x00000385,0x00050095, 9120x00000006,0x00001163,0x00000107,0x00001171,
17590x000000a8,0x00001b3c,0x00001ad7,0x0000190d, 9130x00050080,0x00000006,0x00001164,0x0000116a,
17600x00050051,0x00000006,0x00001b3d,0x00001b3c, 9140x00001163,0x00050084,0x00000006,0x00001138,
17610x00000001,0x00050051,0x00000006,0x00001b3e, 9150x00000150,0x000010d6,0x00050080,0x00000006,
17620x00001b3c,0x00000000,0x00050080,0x00000006, 9160x00001139,0x00001164,0x00001138,0x00050041,
17630x00001b43,0x00001ade,0x00001b3d,0x00050050, 9170x00000156,0x0000113a,0x000000fc,0x00000154,
17640x00000007,0x00001b44,0x00001b3e,0x00001b43, 9180x0004003d,0x00000007,0x0000113b,0x0000113a,
17650x0004007c,0x00000014,0x00001b34,0x00001b44, 9190x00050051,0x00000006,0x00001188,0x0000113b,
17660x00060041,0x000000d8,0x00001b2b,0x00001b34, 9200x00000000,0x00050095,0x000000ab,0x0000118a,
17670x000000d7,0x000000d7,0x0006003d,0x00000006, 9210x00001188,0x00001139,0x00050051,0x00000006,
17680x00001b2c,0x00001b2b,0x00000002,0x00000004, 9220x0000118b,0x0000118a,0x00000001,0x00050051,
17690x00050041,0x000000fb,0x00001912,0x000000f9, 9230x00000006,0x0000118c,0x0000118a,0x00000000,
17700x00000229,0x0004003d,0x00000006,0x00001913, 9240x00050051,0x00000006,0x0000118f,0x0000113b,
17710x00001912,0x00050084,0x00000006,0x00001915, 9250x00000001,0x00050080,0x00000006,0x00001191,
17720x00000225,0x000009e9,0x00050080,0x00000006, 9260x0000118f,0x0000118b,0x00050050,0x00000007,
17730x00001916,0x00001913,0x00001915,0x000200f9, 9270x00001192,0x0000118c,0x00001191,0x0004007c,
17740x00001917,0x000200f8,0x00001917,0x000700f5, 9280x00000014,0x00001182,0x00001192,0x00060041,
17750x00000006,0x00002ad5,0x000000a3,0x000018fc, 9290x000000db,0x00001179,0x00001182,0x000000da,
17760x00001928,0x0000191b,0x000500b0,0x0000002f, 9300x000000da,0x0006003d,0x00000006,0x0000117a,
17770x0000191a,0x00002ad5,0x00000115,0x000400f6, 9310x00001179,0x00000002,0x00000004,0x00050080,
17780x00001929,0x0000191b,0x00000000,0x000400fa, 9320x00000006,0x00001140,0x00001139,0x0000010a,
17790x0000191a,0x0000191b,0x00001929,0x000200f8, 9330x00050095,0x000000ab,0x000011ab,0x00001188,
17800x0000191b,0x00050084,0x00000006,0x0000191e, 9340x00001140,0x00050051,0x00000006,0x000011ac,
17810x00000107,0x00002ad5,0x00050080,0x00000006, 9350x000011ab,0x00000001,0x00050051,0x00000006,
17820x0000191f,0x00001916,0x0000191e,0x00050041, 9360x000011ad,0x000011ab,0x00000000,0x00050080,
17830x00000153,0x00001921,0x000000f9,0x000000d7, 9370x00000006,0x000011b2,0x0000118f,0x000011ac,
17840x0004003d,0x00000007,0x00001922,0x00001921, 9380x00050050,0x00000007,0x000011b3,0x000011ad,
17850x00050041,0x00000028,0x00001923,0x00001884, 9390x000011b2,0x0004007c,0x00000014,0x000011a3,
17860x00002ad5,0x0004003d,0x00000027,0x00001924, 9400x000011b3,0x00060041,0x000000db,0x0000119a,
17870x00001923,0x0004007c,0x00000006,0x00001b4a, 9410x000011a3,0x000000da,0x000000da,0x0006003d,
17880x00001924,0x00050051,0x00000006,0x00001b63, 9420x00000006,0x0000119b,0x0000119a,0x00000002,
17890x00001922,0x00000000,0x00050095,0x000000a8, 9430x00000004,0x00050080,0x00000006,0x00001146,
17900x00001b65,0x00001b63,0x0000191f,0x00050051, 9440x00001139,0x00000111,0x00050095,0x000000ab,
17910x00000006,0x00001b66,0x00001b65,0x00000001, 9450x000011cc,0x00001188,0x00001146,0x00050051,
17920x00050051,0x00000006,0x00001b67,0x00001b65, 9460x00000006,0x000011cd,0x000011cc,0x00000001,
17930x00000000,0x00050051,0x00000006,0x00001b6a, 9470x00050051,0x00000006,0x000011ce,0x000011cc,
17940x00001922,0x00000001,0x00050080,0x00000006, 9480x00000000,0x00050080,0x00000006,0x000011d3,
17950x00001b6c,0x00001b6a,0x00001b66,0x00050050, 9490x0000118f,0x000011cd,0x00050050,0x00000007,
17960x00000007,0x00001b6d,0x00001b67,0x00001b6c, 9500x000011d4,0x000011ce,0x000011d3,0x0004007c,
17970x0004007c,0x00000014,0x00001b5d,0x00001b6d, 9510x00000014,0x000011c4,0x000011d4,0x00060041,
17980x00060041,0x000000d8,0x00001b55,0x00001b5d, 9520x000000db,0x000011bb,0x000011c4,0x000000da,
17990x000000d7,0x000000d7,0x0005003e,0x00001b55, 9530x000000da,0x0006003d,0x00000006,0x000011bc,
18000x00001b4a,0x00000002,0x00000004,0x00050080, 9540x000011bb,0x00000002,0x00000004,0x00050080,
18010x00000006,0x00001928,0x00002ad5,0x00000151, 9550x00000006,0x0000114d,0x00001139,0x00000118,
18020x000200f9,0x00001917,0x000200f8,0x00001929, 9560x00050095,0x000000ab,0x000011ed,0x00001188,
18030x00050080,0x00000006,0x0000192b,0x00001916, 9570x0000114d,0x00050051,0x00000006,0x000011ee,
18040x00000365,0x00050041,0x00000153,0x0000192c, 9580x000011ed,0x00000001,0x00050051,0x00000006,
18050x000000f9,0x000000d7,0x0004003d,0x00000007, 9590x000011ef,0x000011ed,0x00000000,0x00050080,
18060x0000192d,0x0000192c,0x00050051,0x00000006, 9600x00000006,0x000011f4,0x0000118f,0x000011ee,
18070x00001b83,0x0000192d,0x00000000,0x00050095, 9610x00050050,0x00000007,0x000011f5,0x000011ef,
18080x000000a8,0x00001b85,0x00001b83,0x0000192b, 9620x000011f4,0x0004007c,0x00000014,0x000011e5,
18090x00050051,0x00000006,0x00001b86,0x00001b85, 9630x000011f5,0x00060041,0x000000db,0x000011dc,
18100x00000001,0x00050051,0x00000006,0x00001b87, 9640x000011e5,0x000000da,0x000000da,0x0006003d,
18110x00001b85,0x00000000,0x00050051,0x00000006, 9650x00000006,0x000011dd,0x000011dc,0x00000002,
18120x00001b8a,0x0000192d,0x00000001,0x00050080, 9660x00000004,0x00050080,0x00000006,0x00001153,
18130x00000006,0x00001b8c,0x00001b8a,0x00001b86, 9670x00001139,0x0000011f,0x00050095,0x000000ab,
18140x00050050,0x00000007,0x00001b8d,0x00001b87, 9680x0000120e,0x00001188,0x00001153,0x00050051,
18150x00001b8c,0x0004007c,0x00000014,0x00001b7d, 9690x00000006,0x0000120f,0x0000120e,0x00000001,
18160x00001b8d,0x00060041,0x000000d8,0x00001b75, 9700x00050051,0x00000006,0x00001210,0x0000120e,
18170x00001b7d,0x000000d7,0x000000d7,0x0005003e, 9710x00000000,0x00050080,0x00000006,0x00001215,
18180x00001b75,0x00001ac9,0x00000002,0x00000004, 9720x0000118f,0x0000120f,0x00050050,0x00000007,
18190x00050080,0x00000006,0x00001931,0x00001916, 9730x00001216,0x00001210,0x00001215,0x0004007c,
18200x00000371,0x00050095,0x000000a8,0x00001ba5, 9740x00000014,0x00001206,0x00001216,0x00060041,
18210x00001b83,0x00001931,0x00050051,0x00000006, 9750x000000db,0x000011fd,0x00001206,0x000000da,
18220x00001ba6,0x00001ba5,0x00000001,0x00050051, 9760x000000da,0x0006003d,0x00000006,0x000011fe,
18230x00000006,0x00001ba7,0x00001ba5,0x00000000, 9770x000011fd,0x00000002,0x00000004,0x00050080,
18240x00050080,0x00000006,0x00001bac,0x00001b8a, 9780x00000006,0x00001159,0x00001139,0x00000189,
18250x00001ba6,0x00050050,0x00000007,0x00001bad, 9790x00050095,0x000000ab,0x0000122f,0x00001188,
18260x00001ba7,0x00001bac,0x0004007c,0x00000014, 9800x00001159,0x00050051,0x00000006,0x00001230,
18270x00001b9d,0x00001bad,0x00060041,0x000000d8, 9810x0000122f,0x00000001,0x00050051,0x00000006,
18280x00001b95,0x00001b9d,0x000000d7,0x000000d7, 9820x00001231,0x0000122f,0x00000000,0x00050080,
18290x0005003e,0x00001b95,0x00001aea,0x00000002, 9830x00000006,0x00001236,0x0000118f,0x00001230,
18300x00000004,0x000500aa,0x0000002f,0x00001bb2, 9840x00050050,0x00000007,0x00001237,0x00001231,
18310x00001b0b,0x000000a3,0x000300f7,0x00001bb7, 9850x00001236,0x0004007c,0x00000014,0x00001227,
18320x00000000,0x000400fa,0x00001bb2,0x00001bb3, 9860x00001237,0x00060041,0x000000db,0x0000121e,
18330x00001bb7,0x000200f8,0x00001bb3,0x000500aa, 9870x00001227,0x000000da,0x000000da,0x0006003d,
18340x0000002f,0x00001bb6,0x00001b2c,0x000000a3, 9880x00000006,0x0000121f,0x0000121e,0x00000002,
18350x000200f9,0x00001bb7,0x000200f8,0x00001bb7, 9890x00000004,0x00050041,0x000000fe,0x000010da,
18360x000700f5,0x0000002f,0x00001bb8,0x00001bb2, 9900x000000fc,0x00000224,0x0004003d,0x00000006,
18370x00001929,0x00001bb6,0x00001bb3,0x000400a8, 9910x000010db,0x000010da,0x000500ab,0x0000002f,
18380x0000002f,0x0000193c,0x00001bb8,0x000300f7, 9920x000010dc,0x000010db,0x000000a6,0x000600a9,
18390x000019d2,0x00000000,0x000400fa,0x0000193c, 9930x00000006,0x000010dd,0x000010dc,0x000000a6,
18400x0000193d,0x000019d2,0x000200f8,0x0000193d, 9940x00000130,0x000500c5,0x00000006,0x000010de,
18410x00050041,0x00000153,0x0000193f,0x000000f9, 9950x000010dd,0x00000239,0x00050041,0x00000156,
18420x0000021a,0x0004003d,0x00000007,0x00001940, 9960x000010df,0x000000fc,0x000000da,0x0004003d,
18430x0000193f,0x00050051,0x00000006,0x00001bc0, 9970x00000007,0x000010e0,0x000010df,0x00050051,
18440x00001940,0x00000000,0x00050095,0x000000a8, 9980x00000006,0x0000124d,0x000010e0,0x00000000,
18450x00001bc1,0x00001b0b,0x00001bc0,0x00050051, 9990x00050095,0x000000ab,0x0000124f,0x0000124d,
18460x00000006,0x00001bc2,0x00001bc1,0x00000001, 10000x000000a6,0x00050051,0x00000006,0x00001250,
18470x00050051,0x00000006,0x00001bc3,0x00001bc1, 10010x0000124f,0x00000001,0x00050051,0x00000006,
18480x00000000,0x00050051,0x00000006,0x00001bc8, 10020x00001251,0x0000124f,0x00000000,0x00050051,
18490x00001940,0x00000001,0x00050080,0x00000006, 10030x00000006,0x00001254,0x000010e0,0x00000001,
18500x00001bc9,0x00001b2c,0x00001bc8,0x00050080, 10040x00050080,0x00000006,0x00001256,0x00001254,
18510x00000006,0x00001bcb,0x00001bc9,0x00001bc2, 10050x00001250,0x00050050,0x00000007,0x00001257,
18520x00050095,0x000000a8,0x00001be5,0x00001bc3, 10060x00001251,0x00001256,0x0004007c,0x00000014,
18530x00000365,0x00050051,0x00000006,0x00001be6, 10070x00001247,0x00001257,0x00060041,0x000000db,
18540x00001be5,0x00000001,0x00050051,0x00000006, 10080x0000123f,0x00001247,0x000000da,0x000000da,
18550x00001be7,0x00001be5,0x00000000,0x00050080, 10090x0005003e,0x0000123f,0x000010de,0x00000002,
18560x00000006,0x00001bec,0x00001bcb,0x00001be6, 10100x00000004,0x00050041,0x000000fe,0x000010e2,
18570x00050050,0x00000007,0x00001bed,0x00001be7, 10110x000000fc,0x00000a97,0x0004003d,0x00000006,
18580x00001bec,0x0004007c,0x00000014,0x00001bdd, 10120x000010e3,0x000010e2,0x00050086,0x00000006,
18590x00001bed,0x00060041,0x000000d8,0x00001bd4, 10130x000010e4,0x000010e3,0x00000107,0x00050095,
18600x00001bdd,0x000000d7,0x000000d7,0x0006003d, 10140x000000ab,0x0000126f,0x0000124d,0x0000010a,
18610x00000006,0x00001bd5,0x00001bd4,0x00000002, 10150x00050051,0x00000006,0x00001270,0x0000126f,
18620x00000004,0x00050095,0x000000a8,0x00001c06, 10160x00000001,0x00050051,0x00000006,0x00001271,
18630x00001bc3,0x0000011c,0x00050051,0x00000006, 10170x0000126f,0x00000000,0x00050080,0x00000006,
18640x00001c07,0x00001c06,0x00000001,0x00050051, 10180x00001276,0x00001254,0x00001270,0x00050050,
18650x00000006,0x00001c08,0x00001c06,0x00000000, 10190x00000007,0x00001277,0x00001271,0x00001276,
18660x00050080,0x00000006,0x00001c0d,0x00001bcb, 10200x0004007c,0x00000014,0x00001267,0x00001277,
18670x00001c07,0x00050050,0x00000007,0x00001c0e, 10210x00060041,0x000000db,0x0000125f,0x00001267,
18680x00001c08,0x00001c0d,0x0004007c,0x00000014, 10220x000000da,0x000000da,0x0005003e,0x0000125f,
18690x00001bfe,0x00001c0e,0x00060041,0x000000d8, 10230x000010e4,0x00000002,0x00000004,0x00050095,
18700x00001bf5,0x00001bfe,0x000000d7,0x000000d7, 10240x000000ab,0x0000128f,0x0000124d,0x00000111,
18710x0006003d,0x00000006,0x00001bf6,0x00001bf5, 10250x00050051,0x00000006,0x00001290,0x0000128f,
10260x00000001,0x00050051,0x00000006,0x00001291,
10270x0000128f,0x00000000,0x00050080,0x00000006,
10280x00001296,0x00001254,0x00001290,0x00050050,
10290x00000007,0x00001297,0x00001291,0x00001296,
10300x0004007c,0x00000014,0x00001287,0x00001297,
10310x00060041,0x000000db,0x0000127f,0x00001287,
10320x000000da,0x000000da,0x0005003e,0x0000127f,
10330x000000a6,0x00000002,0x00000004,0x00050095,
10340x000000ab,0x000012af,0x0000124d,0x00000118,
10350x00050051,0x00000006,0x000012b0,0x000012af,
10360x00000001,0x00050051,0x00000006,0x000012b1,
10370x000012af,0x00000000,0x00050080,0x00000006,
10380x000012b6,0x00001254,0x000012b0,0x00050050,
10390x00000007,0x000012b7,0x000012b1,0x000012b6,
10400x0004007c,0x00000014,0x000012a7,0x000012b7,
10410x00060041,0x000000db,0x0000129f,0x000012a7,
10420x000000da,0x000000da,0x0005003e,0x0000129f,
10430x000010d4,0x00000002,0x00000004,0x00050095,
10440x000000ab,0x000012d8,0x0000124d,0x0000011f,
10450x00050051,0x00000006,0x000012d9,0x000012d8,
10460x00000001,0x00050051,0x00000006,0x000012da,
10470x000012d8,0x00000000,0x00050080,0x00000006,
10480x000012df,0x00001254,0x000012d9,0x00050050,
10490x00000007,0x000012e0,0x000012da,0x000012df,
10500x0004007c,0x00000014,0x000012d0,0x000012e0,
10510x00060041,0x000000db,0x000012c8,0x000012d0,
10520x000000da,0x000000da,0x0005003e,0x000012c8,
10530x0000117a,0x00000002,0x00000004,0x00050095,
10540x000000ab,0x00001301,0x0000124d,0x00000189,
10550x00050051,0x00000006,0x00001302,0x00001301,
10560x00000001,0x00050051,0x00000006,0x00001303,
10570x00001301,0x00000000,0x00050080,0x00000006,
10580x00001308,0x00001254,0x00001302,0x00050050,
10590x00000007,0x00001309,0x00001303,0x00001308,
10600x0004007c,0x00000014,0x000012f9,0x00001309,
10610x00060041,0x000000db,0x000012f1,0x000012f9,
10620x000000da,0x000000da,0x0005003e,0x000012f1,
10630x0000119b,0x00000002,0x00000004,0x00050095,
10640x000000ab,0x0000132a,0x0000124d,0x00000150,
10650x00050051,0x00000006,0x0000132b,0x0000132a,
10660x00000001,0x00050051,0x00000006,0x0000132c,
10670x0000132a,0x00000000,0x00050080,0x00000006,
10680x00001331,0x00001254,0x0000132b,0x00050050,
10690x00000007,0x00001332,0x0000132c,0x00001331,
10700x0004007c,0x00000014,0x00001322,0x00001332,
10710x00060041,0x000000db,0x0000131a,0x00001322,
10720x000000da,0x000000da,0x0005003e,0x0000131a,
10730x000011bc,0x00000002,0x00000004,0x00050095,
10740x000000ab,0x00001353,0x0000124d,0x00000463,
10750x00050051,0x00000006,0x00001354,0x00001353,
10760x00000001,0x00050051,0x00000006,0x00001355,
10770x00001353,0x00000000,0x00050080,0x00000006,
10780x0000135a,0x00001254,0x00001354,0x00050050,
10790x00000007,0x0000135b,0x00001355,0x0000135a,
10800x0004007c,0x00000014,0x0000134b,0x0000135b,
10810x00060041,0x000000db,0x00001343,0x0000134b,
10820x000000da,0x000000da,0x0005003e,0x00001343,
10830x000011dd,0x00000002,0x00000004,0x00050095,
10840x000000ab,0x0000137c,0x0000124d,0x00000469,
10850x00050051,0x00000006,0x0000137d,0x0000137c,
10860x00000001,0x00050051,0x00000006,0x0000137e,
10870x0000137c,0x00000000,0x00050080,0x00000006,
10880x00001383,0x00001254,0x0000137d,0x00050050,
10890x00000007,0x00001384,0x0000137e,0x00001383,
10900x0004007c,0x00000014,0x00001374,0x00001384,
10910x00060041,0x000000db,0x0000136c,0x00001374,
10920x000000da,0x000000da,0x0005003e,0x0000136c,
10930x000011fe,0x00000002,0x00000004,0x00050095,
10940x000000ab,0x000013a5,0x0000124d,0x00000347,
10950x00050051,0x00000006,0x000013a6,0x000013a5,
10960x00000001,0x00050051,0x00000006,0x000013a7,
10970x000013a5,0x00000000,0x00050080,0x00000006,
10980x000013ac,0x00001254,0x000013a6,0x00050050,
10990x00000007,0x000013ad,0x000013a7,0x000013ac,
11000x0004007c,0x00000014,0x0000139d,0x000013ad,
11010x00060041,0x000000db,0x00001395,0x0000139d,
11020x000000da,0x000000da,0x0005003e,0x00001395,
11030x0000121f,0x00000002,0x00000004,0x00050041,
11040x000000fe,0x00001110,0x000000fc,0x0000023e,
11050x0004003d,0x00000006,0x00001111,0x00001110,
11060x00050095,0x000000ab,0x000013c5,0x0000124d,
11070x00000352,0x00050051,0x00000006,0x000013c6,
11080x000013c5,0x00000001,0x00050051,0x00000006,
11090x000013c7,0x000013c5,0x00000000,0x00050080,
11100x00000006,0x000013cc,0x00001254,0x000013c6,
11110x00050050,0x00000007,0x000013cd,0x000013c7,
11120x000013cc,0x0004007c,0x00000014,0x000013bd,
11130x000013cd,0x00060041,0x000000db,0x000013b5,
11140x000013bd,0x000000da,0x000000da,0x0005003e,
11150x000013b5,0x00001111,0x00000002,0x00000004,
11160x00050095,0x000000ab,0x000013e5,0x0000124d,
11170x0000035d,0x00050051,0x00000006,0x000013e6,
11180x000013e5,0x00000001,0x00050051,0x00000006,
11190x000013e7,0x000013e5,0x00000000,0x00050080,
11200x00000006,0x000013ec,0x00001254,0x000013e6,
11210x00050050,0x00000007,0x000013ed,0x000013e7,
11220x000013ec,0x0004007c,0x00000014,0x000013dd,
11230x000013ed,0x00060041,0x000000db,0x000013d5,
11240x000013dd,0x000000da,0x000000da,0x0005003e,
11250x000013d5,0x000000a6,0x00000002,0x00000004,
11260x00050084,0x00000006,0x000013f3,0x000010d2,
11270x00000228,0x00050080,0x00000006,0x000013f4,
11280x00001111,0x000013f3,0x000500c2,0x00000006,
11290x000013f5,0x000013f4,0x00000233,0x000500c4,
11300x00000006,0x000013f6,0x000013f5,0x0000020d,
11310x000500c5,0x00000006,0x000013f7,0x000013f6,
11320x00000246,0x00050095,0x000000ab,0x0000140f,
11330x0000124d,0x00000368,0x00050051,0x00000006,
11340x00001410,0x0000140f,0x00000001,0x00050051,
11350x00000006,0x00001411,0x0000140f,0x00000000,
11360x00050080,0x00000006,0x00001416,0x00001254,
11370x00001410,0x00050050,0x00000007,0x00001417,
11380x00001411,0x00001416,0x0004007c,0x00000014,
11390x00001407,0x00001417,0x00060041,0x000000db,
11400x000013ff,0x00001407,0x000000da,0x000000da,
11410x0005003e,0x000013ff,0x000013f7,0x00000002,
11420x00000004,0x00050041,0x000000fe,0x0000111d,
11430x000000fc,0x0000022c,0x0004003d,0x00000006,
11440x0000111e,0x0000111d,0x00050095,0x000000ab,
11450x0000142f,0x0000124d,0x00000374,0x00050051,
11460x00000006,0x00001430,0x0000142f,0x00000001,
11470x00050051,0x00000006,0x00001431,0x0000142f,
11480x00000000,0x00050080,0x00000006,0x00001436,
11490x00001254,0x00001430,0x00050050,0x00000007,
11500x00001437,0x00001431,0x00001436,0x0004007c,
11510x00000014,0x00001427,0x00001437,0x00060041,
11520x000000db,0x0000141f,0x00001427,0x000000da,
11530x000000da,0x0005003e,0x0000141f,0x0000111e,
11540x00000002,0x00000004,0x00050041,0x000000fe,
11550x00001122,0x000000fc,0x000009ef,0x0004003d,
11560x00000006,0x00001123,0x00001122,0x00050095,
11570x000000ab,0x0000144f,0x0000124d,0x0000037e,
11580x00050051,0x00000006,0x00001450,0x0000144f,
11590x00000001,0x00050051,0x00000006,0x00001451,
11600x0000144f,0x00000000,0x00050080,0x00000006,
11610x00001456,0x00001254,0x00001450,0x00050050,
11620x00000007,0x00001457,0x00001451,0x00001456,
11630x0004007c,0x00000014,0x00001447,0x00001457,
11640x00060041,0x000000db,0x0000143f,0x00001447,
11650x000000da,0x000000da,0x0005003e,0x0000143f,
11660x00001123,0x00000002,0x00000004,0x00050095,
11670x000000ab,0x0000146f,0x0000124d,0x00000388,
11680x00050051,0x00000006,0x00001470,0x0000146f,
11690x00000001,0x00050051,0x00000006,0x00001471,
11700x0000146f,0x00000000,0x00050080,0x00000006,
11710x00001476,0x00001254,0x00001470,0x00050050,
11720x00000007,0x00001477,0x00001471,0x00001476,
11730x0004007c,0x00000014,0x00001467,0x00001477,
11740x00060041,0x000000db,0x0000145f,0x00001467,
11750x000000da,0x000000da,0x0005003e,0x0000145f,
11760x000000a6,0x00000002,0x00000004,0x000200f9,
11770x00000b4b,0x000200f8,0x00000b4b,0x000200f9,
11780x00000bb6,0x000200f8,0x00000b47,0x00050041,
11790x000000fe,0x00000b4f,0x000000fc,0x000004d8,
11800x0004003d,0x00000006,0x00000b50,0x00000b4f,
11810x000500ae,0x0000002f,0x00000b51,0x00000b11,
11820x00000b50,0x000300f7,0x00000b53,0x00000000,
11830x000400fa,0x00000b51,0x00000b52,0x00000b53,
11840x000200f8,0x00000b52,0x000200f9,0x00000bb6,
11850x000200f8,0x00000b53,0x000500aa,0x0000002f,
11860x00000b58,0x00000b13,0x00000b57,0x000300f7,
11870x00000b5a,0x00000000,0x000400fa,0x00000b58,
11880x00000b59,0x00000b6a,0x000200f8,0x00000b59,
11890x00050084,0x00000006,0x00000b5c,0x0000010a,
11900x00000b11,0x00050041,0x00000156,0x00000b60,
11910x000000fc,0x00000205,0x0004003d,0x00000007,
11920x00000b61,0x00000b60,0x00050051,0x00000006,
11930x0000148e,0x00000b61,0x00000000,0x00050095,
11940x000000ab,0x00001490,0x0000148e,0x00000b5c,
11950x00050051,0x00000006,0x00001491,0x00001490,
11960x00000001,0x00050051,0x00000006,0x00001492,
11970x00001490,0x00000000,0x00050051,0x00000006,
11980x00001495,0x00000b61,0x00000001,0x00050080,
11990x00000006,0x00001497,0x00001495,0x00001491,
12000x00050050,0x00000007,0x00001498,0x00001492,
12010x00001497,0x0004007c,0x00000014,0x00001488,
12020x00001498,0x00060041,0x000000db,0x0000147f,
12030x00001488,0x000000da,0x000000da,0x0006003d,
12040x00000006,0x00001480,0x0000147f,0x00000002,
12050x00000004,0x00050041,0x00000156,0x00000b65,
12060x000000fc,0x000000da,0x0004003d,0x00000007,
12070x00000b66,0x00000b65,0x00050051,0x00000006,
12080x000014ae,0x00000b66,0x00000000,0x00050095,
12090x000000ab,0x000014b0,0x000014ae,0x00000b5c,
12100x00050051,0x00000006,0x000014b1,0x000014b0,
12110x00000001,0x00050051,0x00000006,0x000014b2,
12120x000014b0,0x00000000,0x00050051,0x00000006,
12130x000014b5,0x00000b66,0x00000001,0x00050080,
12140x00000006,0x000014b7,0x000014b5,0x000014b1,
12150x00050050,0x00000007,0x000014b8,0x000014b2,
12160x000014b7,0x0004007c,0x00000014,0x000014a8,
12170x000014b8,0x00060041,0x000000db,0x000014a0,
12180x000014a8,0x000000da,0x000000da,0x0005003e,
12190x000014a0,0x00001480,0x00000002,0x00000004,
12200x000200f9,0x00000b5a,0x000200f8,0x00000b6a,
12210x000500aa,0x0000002f,0x00000b6d,0x00000b13,
12220x000000a6,0x000300f7,0x00000b6f,0x00000000,
12230x000400fa,0x00000b6d,0x00000b6e,0x00000b90,
12240x000200f8,0x00000b6e,0x00050041,0x000000fe,
12250x00000b70,0x000000fc,0x000009ef,0x0004003d,
12260x00000006,0x00000b71,0x00000b70,0x00050084,
12270x00000006,0x00000b73,0x0000010a,0x00000b11,
12280x00050080,0x00000006,0x00000b74,0x00000b71,
12290x00000b73,0x00050041,0x00000156,0x00000b76,
12300x000000fc,0x000000da,0x0004003d,0x00000007,
12310x00000b77,0x00000b76,0x00050051,0x00000006,
12320x000014ce,0x00000b77,0x00000000,0x00050095,
12330x000000ab,0x000014d0,0x000014ce,0x00000b74,
12340x00050051,0x00000006,0x000014d1,0x000014d0,
12350x00000001,0x00050051,0x00000006,0x000014d2,
12360x000014d0,0x00000000,0x00050051,0x00000006,
12370x000014d5,0x00000b77,0x00000001,0x00050080,
12380x00000006,0x000014d7,0x000014d5,0x000014d1,
12390x00050050,0x00000007,0x000014d8,0x000014d2,
12400x000014d7,0x0004007c,0x00000014,0x000014c8,
12410x000014d8,0x00060041,0x000000db,0x000014c0,
12420x000014c8,0x000000da,0x000000da,0x0005003e,
12430x000014c0,0x00000380,0x00000002,0x00000004,
12440x000500b0,0x0000002f,0x00000b7c,0x00000b11,
12450x000002b7,0x000300f7,0x00000b7e,0x00000000,
12460x000400fa,0x00000b7c,0x00000b7d,0x00000b7e,
12470x000200f8,0x00000b7d,0x00050041,0x00000156,
12480x00000b82,0x000000fc,0x00000154,0x0004003d,
12490x00000007,0x00000b83,0x00000b82,0x00050051,
12500x00000006,0x000014ee,0x00000b83,0x00000000,
12510x00050095,0x000000ab,0x000014f0,0x000014ee,
12520x00000b73,0x00050051,0x00000006,0x000014f1,
12530x000014f0,0x00000001,0x00050051,0x00000006,
12540x000014f2,0x000014f0,0x00000000,0x00050051,
12550x00000006,0x000014f5,0x00000b83,0x00000001,
12560x00050080,0x00000006,0x000014f7,0x000014f5,
12570x000014f1,0x00050050,0x00000007,0x000014f8,
12580x000014f2,0x000014f7,0x0004007c,0x00000014,
12590x000014e8,0x000014f8,0x00060041,0x000000db,
12600x000014e0,0x000014e8,0x000000da,0x000000da,
12610x0005003e,0x000014e0,0x00000380,0x00000002,
12620x00000004,0x00050080,0x00000006,0x00000b89,
12630x00000118,0x00000b73,0x00050095,0x000000ab,
12640x00001510,0x000014ee,0x00000b89,0x00050051,
12650x00000006,0x00001511,0x00001510,0x00000001,
12660x00050051,0x00000006,0x00001512,0x00001510,
12670x00000000,0x00050080,0x00000006,0x00001517,
12680x000014f5,0x00001511,0x00050050,0x00000007,
12690x00001518,0x00001512,0x00001517,0x0004007c,
12700x00000014,0x00001508,0x00001518,0x00060041,
12710x000000db,0x00001500,0x00001508,0x000000da,
12720x000000da,0x0005003e,0x00001500,0x000000a6,
12730x00000002,0x00000004,0x000200f9,0x00000b7e,
12740x000200f8,0x00000b7e,0x000200f9,0x00000b6f,
12750x000200f8,0x00000b90,0x000500aa,0x0000002f,
12760x00000b93,0x00000b13,0x000000b0,0x000300f7,
12770x00000b95,0x00000000,0x000400fa,0x00000b93,
12780x00000b94,0x00000b99,0x000200f8,0x00000b94,
12790x000200f9,0x00001548,0x000200f8,0x00001548,
12800x000700f5,0x00000006,0x0000312e,0x000000a6,
12810x00000b94,0x00001558,0x00001556,0x000500b0,
12820x0000002f,0x0000154b,0x0000312e,0x000002b7,
12830x000400f6,0x00001559,0x00001556,0x00000000,
12840x000400fa,0x0000154b,0x0000154c,0x00001559,
12850x000200f8,0x0000154c,0x00050084,0x00000006,
12860x0000154f,0x000002b7,0x00000b11,0x00050080,
12870x00000006,0x00001551,0x0000154f,0x0000312e,
12880x000300f7,0x00001616,0x00000000,0x000300fb,
12890x000000a6,0x000015f4,0x000200f8,0x000015f4,
12900x00050041,0x000000fe,0x000015f5,0x000000fc,
12910x0000027b,0x0004003d,0x00000006,0x000015f6,
12920x000015f5,0x000500aa,0x0000002f,0x000015f7,
12930x000015f6,0x000000a6,0x000300f7,0x000015fa,
12940x00000000,0x000400fa,0x000015f7,0x000015f8,
12950x000015fa,0x000200f8,0x000015f8,0x000200f9,
12960x00001616,0x000200f8,0x000015fa,0x000500aa,
12970x0000002f,0x000015fd,0x000015f6,0x00000170,
12980x000300f7,0x00001604,0x00000000,0x000400fa,
12990x000015fd,0x000015fe,0x00001604,0x000200f8,
13000x000015fe,0x00050084,0x00000006,0x00001600,
13010x0000010a,0x00001551,0x00050041,0x00000156,
13020x00001601,0x000000fc,0x0000020d,0x0004003d,
13030x00000007,0x00001602,0x00001601,0x00050051,
13040x00000006,0x0000162e,0x00001602,0x00000000,
13050x00050095,0x000000ab,0x00001630,0x0000162e,
13060x00001600,0x00050051,0x00000006,0x00001631,
13070x00001630,0x00000001,0x00050051,0x00000006,
13080x00001632,0x00001630,0x00000000,0x00050051,
13090x00000006,0x00001635,0x00001602,0x00000001,
13100x00050080,0x00000006,0x00001637,0x00001635,
13110x00001631,0x00050050,0x00000007,0x00001638,
13120x00001632,0x00001637,0x0004007c,0x00000014,
13130x00001628,0x00001638,0x00060041,0x000000db,
13140x0000161f,0x00001628,0x000000da,0x000000da,
13150x0006003d,0x00000006,0x00001620,0x0000161f,
13160x00000002,0x00000004,0x000200f9,0x00001616,
13170x000200f8,0x00001604,0x000500c2,0x00000006,
13180x00001606,0x00001551,0x00000154,0x00050084,
13190x00000006,0x00001607,0x0000010a,0x00001606,
13200x00050041,0x00000156,0x00001608,0x000000fc,
13210x0000020d,0x0004003d,0x00000007,0x00001609,
13220x00001608,0x00050051,0x00000006,0x0000164f,
13230x00001609,0x00000000,0x00050095,0x000000ab,
13240x00001651,0x0000164f,0x00001607,0x00050051,
13250x00000006,0x00001652,0x00001651,0x00000001,
13260x00050051,0x00000006,0x00001653,0x00001651,
13270x00000000,0x00050051,0x00000006,0x00001656,
13280x00001609,0x00000001,0x00050080,0x00000006,
13290x00001658,0x00001656,0x00001652,0x00050050,
13300x00000007,0x00001659,0x00001653,0x00001658,
13310x0004007c,0x00000014,0x00001649,0x00001659,
13320x00060041,0x000000db,0x00001640,0x00001649,
13330x000000da,0x000000da,0x0006003d,0x00000006,
13340x00001641,0x00001640,0x00000002,0x00000004,
13350x000500c7,0x00000006,0x0000160c,0x00001551,
13360x000000b0,0x000500ab,0x0000002f,0x0000160d,
13370x0000160c,0x000000a6,0x000300f7,0x00001614,
13380x00000000,0x000400fa,0x0000160d,0x0000160e,
13390x00001611,0x000200f8,0x0000160e,0x000500c2,
13400x00000006,0x00001610,0x00001641,0x0000023e,
13410x000200f9,0x00001614,0x000200f8,0x00001611,
13420x000500c7,0x00000006,0x00001613,0x00001641,
13430x000002a3,0x000200f9,0x00001614,0x000200f8,
13440x00001614,0x000700f5,0x00000006,0x00003138,
13450x00001610,0x0000160e,0x00001613,0x00001611,
13460x000200f9,0x00001616,0x000200f8,0x00001616,
13470x000900f5,0x00000006,0x00003139,0x00001551,
13480x000015f8,0x00001620,0x000015fe,0x00003138,
13490x00001614,0x00050041,0x000000fe,0x0000166a,
13500x000000fc,0x00000250,0x0004003d,0x00000006,
13510x0000166b,0x0000166a,0x00050084,0x00000006,
13520x0000166c,0x00003139,0x0000166b,0x00050041,
13530x00000156,0x0000166d,0x000000fc,0x00000205,
13540x0004003d,0x00000007,0x0000166e,0x0000166d,
13550x00050051,0x00000006,0x00001689,0x0000166e,
13560x00000000,0x00050095,0x000000ab,0x0000168b,
13570x00001689,0x0000166c,0x00050051,0x00000006,
13580x0000168c,0x0000168b,0x00000001,0x00050051,
13590x00000006,0x0000168d,0x0000168b,0x00000000,
13600x00050051,0x00000006,0x00001690,0x0000166e,
13610x00000001,0x00050080,0x00000006,0x00001692,
13620x00001690,0x0000168c,0x00050095,0x000000ab,
13630x000016ac,0x0000168d,0x000000a6,0x00050051,
13640x00000006,0x000016ad,0x000016ac,0x00000001,
13650x00050051,0x00000006,0x000016ae,0x000016ac,
13660x00000000,0x00050080,0x00000006,0x000016b3,
13670x00001692,0x000016ad,0x00050050,0x00000007,
13680x000016b4,0x000016ae,0x000016b3,0x0004007c,
13690x00000014,0x000016a4,0x000016b4,0x00060041,
13700x000000db,0x0000169b,0x000016a4,0x000000da,
13710x000000da,0x0006003d,0x00000006,0x0000169c,
13720x0000169b,0x00000002,0x00000004,0x0004007c,
13730x00000027,0x00001672,0x0000169c,0x00050095,
13740x000000ab,0x000016cd,0x0000168d,0x0000010a,
13750x00050051,0x00000006,0x000016ce,0x000016cd,
13760x00000001,0x00050051,0x00000006,0x000016cf,
13770x000016cd,0x00000000,0x00050080,0x00000006,
13780x000016d4,0x00001692,0x000016ce,0x00050050,
13790x00000007,0x000016d5,0x000016cf,0x000016d4,
13800x0004007c,0x00000014,0x000016c5,0x000016d5,
13810x00060041,0x000000db,0x000016bc,0x000016c5,
13820x000000da,0x000000da,0x0006003d,0x00000006,
13830x000016bd,0x000016bc,0x00000002,0x00000004,
13840x0004007c,0x00000027,0x00001675,0x000016bd,
13850x00050041,0x000000fe,0x00001676,0x000000fc,
13860x00000266,0x0004003d,0x00000006,0x00001677,
13870x00001676,0x000500aa,0x0000002f,0x00001678,
13880x00001677,0x000000b0,0x000300f7,0x0000167e,
13890x00000000,0x000400fa,0x00001678,0x00001679,
13900x0000167a,0x000200f8,0x00001679,0x000200f9,
13910x0000167e,0x000200f8,0x0000167a,0x00050095,
13920x000000ab,0x000016ee,0x0000168d,0x00000111,
13930x00050051,0x00000006,0x000016ef,0x000016ee,
13940x00000001,0x00050051,0x00000006,0x000016f0,
13950x000016ee,0x00000000,0x00050080,0x00000006,
13960x000016f5,0x00001692,0x000016ef,0x00050050,
13970x00000007,0x000016f6,0x000016f0,0x000016f5,
13980x0004007c,0x00000014,0x000016e6,0x000016f6,
13990x00060041,0x000000db,0x000016dd,0x000016e6,
14000x000000da,0x000000da,0x0006003d,0x00000006,
14010x000016de,0x000016dd,0x00000002,0x00000004,
14020x0004007c,0x00000027,0x0000167d,0x000016de,
14030x000200f9,0x0000167e,0x000200f8,0x0000167e,
14040x000700f5,0x00000027,0x0000313a,0x0000026d,
14050x00001679,0x0000167d,0x0000167a,0x00060050,
14060x0000004b,0x00001683,0x00001672,0x00001675,
14070x0000313a,0x000300f7,0x0000173c,0x00000000,
14080x000300fb,0x000000a6,0x00001708,0x000200f8,
14090x00001708,0x00050041,0x00000156,0x00001709,
14100x000000fc,0x00000215,0x0004003d,0x00000007,
14110x0000170a,0x00001709,0x00050051,0x00000006,
14120x00001741,0x0000170a,0x00000000,0x000500aa,
14130x0000002f,0x00001742,0x00001741,0x000000a6,
14140x000300f7,0x00001747,0x00000000,0x000400fa,
14150x00001742,0x00001743,0x00001747,0x000200f8,
14160x00001743,0x00050051,0x00000006,0x00001745,
14170x0000170a,0x00000001,0x000500aa,0x0000002f,
14180x00001746,0x00001745,0x000000a6,0x000200f9,
14190x00001747,0x000200f8,0x00001747,0x000700f5,
14200x0000002f,0x00001748,0x00001742,0x00001708,
14210x00001746,0x00001743,0x000300f7,0x0000170e,
14220x00000000,0x000400fa,0x00001748,0x0000170c,
14230x0000170e,0x000200f8,0x0000170c,0x000200f9,
14240x0000173c,0x000200f8,0x0000170e,0x000200f9,
14250x0000170f,0x000200f8,0x0000170f,0x000700f5,
14260x00000006,0x0000313b,0x000000a6,0x0000170e,
14270x00001739,0x00001713,0x000500b0,0x0000002f,
14280x00001712,0x0000313b,0x000002b7,0x000400f6,
14290x0000173a,0x00001713,0x00000000,0x000400fa,
14300x00001712,0x00001713,0x0000173a,0x000200f8,
14310x00001713,0x00050084,0x00000006,0x00001715,
14320x0000011f,0x0000313b,0x00050095,0x000000ab,
14330x00001761,0x00001741,0x00001715,0x00050051,
14340x00000006,0x00001762,0x00001761,0x00000001,
14350x00050051,0x00000006,0x00001763,0x00001761,
14360x00000000,0x00050051,0x00000006,0x00001766,
14370x0000170a,0x00000001,0x00050080,0x00000006,
14380x00001768,0x00001766,0x00001762,0x00050050,
14390x00000007,0x00001769,0x00001763,0x00001768,
14400x0004007c,0x00000014,0x00001759,0x00001769,
14410x00060041,0x000000db,0x00001750,0x00001759,
14420x000000da,0x000000da,0x0006003d,0x00000006,
14430x00001751,0x00001750,0x00000002,0x00000004,
14440x0004007c,0x00000027,0x0000171a,0x00001751,
14450x00050080,0x00000006,0x0000171c,0x00001715,
14460x0000010a,0x00050095,0x000000ab,0x00001782,
14470x00001741,0x0000171c,0x00050051,0x00000006,
14480x00001783,0x00001782,0x00000001,0x00050051,
14490x00000006,0x00001784,0x00001782,0x00000000,
14500x00050080,0x00000006,0x00001789,0x00001766,
14510x00001783,0x00050050,0x00000007,0x0000178a,
14520x00001784,0x00001789,0x0004007c,0x00000014,
14530x0000177a,0x0000178a,0x00060041,0x000000db,
14540x00001771,0x0000177a,0x000000da,0x000000da,
14550x0006003d,0x00000006,0x00001772,0x00001771,
18720x00000002,0x00000004,0x0004007c,0x00000027, 14560x00000002,0x00000004,0x0004007c,0x00000027,
18730x00001946,0x00001bf6,0x00050095,0x000000a8, 14570x00001720,0x00001772,0x00050080,0x00000006,
18740x00001c27,0x00001bc3,0x00000186,0x00050051, 14580x00001722,0x00001715,0x00000111,0x00050095,
18750x00000006,0x00001c28,0x00001c27,0x00000001, 14590x000000ab,0x000017a3,0x00001741,0x00001722,
18760x00050051,0x00000006,0x00001c29,0x00001c27, 14600x00050051,0x00000006,0x000017a4,0x000017a3,
18770x00000000,0x00050080,0x00000006,0x00001c2e, 14610x00000001,0x00050051,0x00000006,0x000017a5,
18780x00001bcb,0x00001c28,0x00050050,0x00000007, 14620x000017a3,0x00000000,0x00050080,0x00000006,
18790x00001c2f,0x00001c29,0x00001c2e,0x0004007c, 14630x000017aa,0x00001766,0x000017a4,0x00050050,
18800x00000014,0x00001c1f,0x00001c2f,0x00060041, 14640x00000007,0x000017ab,0x000017a5,0x000017aa,
18810x000000d8,0x00001c16,0x00001c1f,0x000000d7, 14650x0004007c,0x00000014,0x0000179b,0x000017ab,
18820x000000d7,0x0006003d,0x00000006,0x00001c17, 14660x00060041,0x000000db,0x00001792,0x0000179b,
18830x00001c16,0x00000002,0x00000004,0x0004007c, 14670x000000da,0x000000da,0x0006003d,0x00000006,
18840x00000027,0x00001949,0x00001c17,0x00050095, 14680x00001793,0x00001792,0x00000002,0x00000004,
18850x000000a8,0x00001c48,0x00001bc3,0x0000014d, 14690x0004007c,0x00000027,0x00001726,0x00001793,
18860x00050051,0x00000006,0x00001c49,0x00001c48, 14700x00050080,0x00000006,0x00001728,0x00001715,
18870x00000001,0x00050051,0x00000006,0x00001c4a, 14710x00000118,0x00050095,0x000000ab,0x000017c4,
18880x00001c48,0x00000000,0x00050080,0x00000006, 14720x00001741,0x00001728,0x00050051,0x00000006,
18890x00001c4f,0x00001bcb,0x00001c49,0x00050050, 14730x000017c5,0x000017c4,0x00000001,0x00050051,
18900x00000007,0x00001c50,0x00001c4a,0x00001c4f, 14740x00000006,0x000017c6,0x000017c4,0x00000000,
18910x0004007c,0x00000014,0x00001c40,0x00001c50, 14750x00050080,0x00000006,0x000017cb,0x00001766,
18920x00060041,0x000000d8,0x00001c37,0x00001c40, 14760x000017c5,0x00050050,0x00000007,0x000017cc,
18930x000000d7,0x000000d7,0x0006003d,0x00000006, 14770x000017c6,0x000017cb,0x0004007c,0x00000014,
18940x00001c38,0x00001c37,0x00000002,0x00000004, 14780x000017bc,0x000017cc,0x00060041,0x000000db,
18950x0004007c,0x00000027,0x0000194c,0x00001c38, 14790x000017b3,0x000017bc,0x000000da,0x000000da,
18960x00050095,0x000000a8,0x00001c69,0x00001bc3, 14800x0006003d,0x00000006,0x000017b4,0x000017b3,
18970x00000460,0x00050051,0x00000006,0x00001c6a,
18980x00001c69,0x00000001,0x00050051,0x00000006,
18990x00001c6b,0x00001c69,0x00000000,0x00050080,
19000x00000006,0x00001c70,0x00001bcb,0x00001c6a,
19010x00050050,0x00000007,0x00001c71,0x00001c6b,
19020x00001c70,0x0004007c,0x00000014,0x00001c61,
19030x00001c71,0x00060041,0x000000d8,0x00001c58,
19040x00001c61,0x000000d7,0x000000d7,0x0006003d,
19050x00000006,0x00001c59,0x00001c58,0x00000002,
19060x00000004,0x0004007c,0x00000027,0x00001950,
19070x00001c59,0x00050095,0x000000a8,0x00001c8a,
19080x00001bc3,0x00000466,0x00050051,0x00000006,
19090x00001c8b,0x00001c8a,0x00000001,0x00050051,
19100x00000006,0x00001c8c,0x00001c8a,0x00000000,
19110x00050080,0x00000006,0x00001c91,0x00001bcb,
19120x00001c8b,0x00050050,0x00000007,0x00001c92,
19130x00001c8c,0x00001c91,0x0004007c,0x00000014,
19140x00001c82,0x00001c92,0x00060041,0x000000d8,
19150x00001c79,0x00001c82,0x000000d7,0x000000d7,
19160x0006003d,0x00000006,0x00001c7a,0x00001c79,
19170x00000002,0x00000004,0x0004007c,0x00000027, 14810x00000002,0x00000004,0x0004007c,0x00000027,
19180x00001953,0x00001c7a,0x00050095,0x000000a8, 14820x0000172c,0x000017b4,0x00070050,0x000002bc,
19190x00001cab,0x00001bc3,0x00000344,0x00050051, 14830x0000172d,0x0000171a,0x00001720,0x00001726,
19200x00000006,0x00001cac,0x00001cab,0x00000001, 14840x0000172c,0x0008004f,0x0000004b,0x00001730,
19210x00050051,0x00000006,0x00001cad,0x00001cab, 14850x0000172d,0x0000172d,0x00000000,0x00000001,
19220x00000000,0x00050080,0x00000006,0x00001cb2, 14860x00000002,0x00050094,0x00000027,0x00001732,
19230x00001bcb,0x00001cac,0x00050050,0x00000007, 14870x00001730,0x00001683,0x00050081,0x00000027,
19240x00001cb3,0x00001cad,0x00001cb2,0x0004007c, 14880x00001735,0x00001732,0x0000172c,0x00050041,
19250x00000014,0x00001ca3,0x00001cb3,0x00060041, 14890x00000028,0x00001736,0x00001705,0x0000313b,
19260x000000d8,0x00001c9a,0x00001ca3,0x000000d7, 14900x0003003e,0x00001736,0x00001735,0x00050080,
19270x000000d7,0x0006003d,0x00000006,0x00001c9b, 14910x00000006,0x00001739,0x0000313b,0x00000154,
19280x00001c9a,0x00000002,0x00000004,0x0004007c, 14920x000200f9,0x0000170f,0x000200f8,0x0000173a,
19290x00000027,0x00001956,0x00001c9b,0x000500bc, 14930x0004003d,0x0000004b,0x0000173b,0x00001705,
19300x0000002f,0x00001cba,0x00001946,0x00001950, 14940x000200f9,0x0000173c,0x000200f8,0x0000173c,
19310x000300f7,0x00001cc1,0x00000000,0x000400fa, 14950x000700f5,0x0000004b,0x0000313c,0x00001683,
19320x00001cba,0x00001cbb,0x00001cc1,0x000200f8, 14960x0000170c,0x0000173b,0x0000173a,0x00050041,
19330x00001cbb,0x000500bc,0x0000002f,0x00001cc0, 14970x0000004c,0x00001555,0x0000151a,0x0000312e,
19340x00001949,0x00001953,0x000200f9,0x00001cc1, 14980x0003003e,0x00001555,0x0000313c,0x000200f9,
19350x000200f8,0x00001cc1,0x000700f5,0x0000002f, 14990x00001556,0x000200f8,0x00001556,0x00050080,
19360x00001cc2,0x00001cba,0x0000193d,0x00001cc0, 15000x00000006,0x00001558,0x0000312e,0x00000154,
19370x00001cbb,0x000300f7,0x00001cc9,0x00000000, 15010x000200f9,0x00001548,0x000200f8,0x00001559,
19380x000400fa,0x00001cc2,0x00001cc3,0x00001cc9, 15020x00050041,0x000000fe,0x0000155a,0x000000fc,
19390x000200f8,0x00001cc3,0x000500bc,0x0000002f, 15030x00000308,0x0004003d,0x00000006,0x0000155b,
19400x00001cc8,0x0000194c,0x00001956,0x000200f9, 15040x0000155a,0x00050080,0x00000006,0x0000155d,
19410x00001cc9,0x000200f8,0x00001cc9,0x000700f5, 15050x0000155b,0x00000b11,0x00050041,0x000000fe,
19420x0000002f,0x00001cca,0x00001cc2,0x00001cc1, 15060x0000155e,0x000000fc,0x0000022c,0x0004003d,
19430x00001cc8,0x00001cc3,0x000300f7,0x00001960, 15070x00000006,0x0000155f,0x0000155e,0x00050084,
19440x00000000,0x000400fa,0x00001cca,0x0000195c, 15080x00000006,0x00001561,0x00000107,0x0000155d,
19450x00001960,0x000200f8,0x0000195c,0x000500c2, 15090x00050080,0x00000006,0x00001562,0x0000155f,
19460x00000006,0x0000195e,0x00001ac9,0x0000047b, 15100x00001561,0x000200f9,0x00001563,0x000200f8,
19470x000500ab,0x0000002f,0x0000195f,0x0000195e, 15110x00001563,0x000700f5,0x00000006,0x0000312f,
19480x000000a3,0x000200f9,0x00001960,0x000200f8, 15120x000000a6,0x00001559,0x0000158a,0x00001567,
19490x00001960,0x000700f5,0x0000002f,0x00001961, 15130x000500b0,0x0000002f,0x00001566,0x0000312f,
19500x00001cca,0x00001cc9,0x0000195f,0x0000195c, 15140x000002b7,0x000400f6,0x0000158b,0x00001567,
19510x000300f7,0x000019d1,0x00000000,0x000400fa, 15150x00000000,0x000400fa,0x00001566,0x00001567,
19520x00001961,0x00001962,0x000019d1,0x000200f8, 15160x0000158b,0x000200f8,0x00001567,0x00050084,
19530x00001962,0x000200f9,0x00001963,0x000200f8, 15170x00000006,0x0000156a,0x00000118,0x0000312f,
19540x00001963,0x000700f5,0x0000004b,0x00002b0b, 15180x00050080,0x00000006,0x0000156b,0x00001562,
19550x00002b66,0x00001962,0x000019cc,0x00001967, 15190x0000156a,0x00050041,0x00000156,0x0000156d,
19560x000700f5,0x0000004b,0x00002af9,0x00002b64, 15200x000000fc,0x000000da,0x0004003d,0x00000007,
19570x00001962,0x000019c9,0x00001967,0x000700f5, 15210x0000156e,0x0000156d,0x00060041,0x00000028,
19580x00000006,0x00002ad6,0x000000a3,0x00001962, 15220x0000156f,0x0000151a,0x0000312f,0x000000a6,
19590x000019cf,0x00001967,0x000500b0,0x0000002f, 15230x0004003d,0x00000027,0x00001570,0x0000156f,
19600x00001966,0x00002ad6,0x0000010e,0x000400f6, 15240x0004007c,0x00000006,0x000017d2,0x00001570,
19610x000019d0,0x00001967,0x00000000,0x000400fa, 15250x00050051,0x00000006,0x000017eb,0x0000156e,
19620x00001966,0x00001967,0x000019d0,0x000200f8, 15260x00000000,0x00050095,0x000000ab,0x000017ed,
19630x00001967,0x000500c7,0x00000006,0x00001969, 15270x000017eb,0x0000156b,0x00050051,0x00000006,
19640x00002ad6,0x000000ad,0x000500ab,0x0000002f, 15280x000017ee,0x000017ed,0x00000001,0x00050051,
19650x0000196a,0x00001969,0x000000a3,0x000600a9, 15290x00000006,0x000017ef,0x000017ed,0x00000000,
19660x00000027,0x00002b6c,0x0000196a,0x00001950, 15300x00050051,0x00000006,0x000017f2,0x0000156e,
19670x00001946,0x000500c7,0x00000006,0x00001974, 15310x00000001,0x00050080,0x00000006,0x000017f4,
19680x00002ad6,0x0000016d,0x000500ab,0x0000002f, 15320x000017f2,0x000017ee,0x00050050,0x00000007,
19690x00001975,0x00001974,0x000000a3,0x000600a9, 15330x000017f5,0x000017ef,0x000017f4,0x0004007c,
19700x00000027,0x00002b6d,0x00001975,0x00001953, 15340x00000014,0x000017e5,0x000017f5,0x00060041,
19710x00001949,0x000500c7,0x00000006,0x0000197f, 15350x000000db,0x000017dd,0x000017e5,0x000000da,
19720x00002ad6,0x00000107,0x000500ab,0x0000002f, 15360x000000da,0x0005003e,0x000017dd,0x000017d2,
19730x00001980,0x0000197f,0x000000a3,0x000600a9,
19740x00000027,0x00002b6e,0x00001980,0x00001956,
19750x0000194c,0x00050041,0x00000028,0x0000198a,
19760x00001884,0x000000d7,0x0004003d,0x00000027,
19770x0000198b,0x0000198a,0x00050085,0x00000027,
19780x0000198e,0x0000198b,0x00002b6c,0x00050041,
19790x00000028,0x0000198f,0x00001884,0x00000151,
19800x0004003d,0x00000027,0x00001990,0x0000198f,
19810x00050085,0x00000027,0x00001993,0x00001990,
19820x00002b6d,0x00050081,0x00000027,0x00001994,
19830x0000198e,0x00001993,0x00050041,0x00000028,
19840x00001995,0x00001884,0x00000202,0x0004003d,
19850x00000027,0x00001996,0x00001995,0x00050085,
19860x00000027,0x00001999,0x00001996,0x00002b6e,
19870x00050081,0x00000027,0x0000199a,0x00001994,
19880x00001999,0x00050041,0x00000028,0x0000199b,
19890x00001884,0x0000020a,0x0004003d,0x00000027,
19900x0000199c,0x0000199b,0x00050081,0x00000027,
19910x0000199d,0x0000199a,0x0000199c,0x00050041,
19920x00000028,0x0000199e,0x00001884,0x00000212,
19930x0004003d,0x00000027,0x0000199f,0x0000199e,
19940x00050085,0x00000027,0x000019a2,0x0000199f,
19950x00002b6c,0x00050041,0x00000028,0x000019a3,
19960x00001884,0x0000021a,0x0004003d,0x00000027,
19970x000019a4,0x000019a3,0x00050085,0x00000027,
19980x000019a7,0x000019a4,0x00002b6d,0x00050081,
19990x00000027,0x000019a8,0x000019a2,0x000019a7,
20000x00050041,0x00000028,0x000019a9,0x00001884,
20010x00000230,0x0004003d,0x00000027,0x000019aa,
20020x000019a9,0x00050085,0x00000027,0x000019ad,
20030x000019aa,0x00002b6e,0x00050081,0x00000027,
20040x000019ae,0x000019a8,0x000019ad,0x00050041,
20050x00000028,0x000019af,0x00001884,0x000004d5,
20060x0004003d,0x00000027,0x000019b0,0x000019af,
20070x00050081,0x00000027,0x000019b1,0x000019ae,
20080x000019b0,0x00050041,0x00000028,0x000019b2,
20090x00001884,0x00000305,0x0004003d,0x00000027,
20100x000019b3,0x000019b2,0x00050085,0x00000027,
20110x000019b6,0x000019b3,0x00002b6c,0x00050041,
20120x00000028,0x000019b7,0x00001884,0x0000024d,
20130x0004003d,0x00000027,0x000019b8,0x000019b7,
20140x00050085,0x00000027,0x000019bb,0x000019b8,
20150x00002b6d,0x00050081,0x00000027,0x000019bc,
20160x000019b6,0x000019bb,0x00050041,0x00000028,
20170x000019bd,0x00001884,0x00000263,0x0004003d,
20180x00000027,0x000019be,0x000019bd,0x00050085,
20190x00000027,0x000019c1,0x000019be,0x00002b6e,
20200x00050081,0x00000027,0x000019c2,0x000019bc,
20210x000019c1,0x00050041,0x00000028,0x000019c3,
20220x00001884,0x00000278,0x0004003d,0x00000027,
20230x000019c4,0x000019c3,0x00050081,0x00000027,
20240x000019c5,0x000019c2,0x000019c4,0x00060050,
20250x0000004b,0x000019c6,0x0000199d,0x000019b1,
20260x000019c5,0x0007000c,0x0000004b,0x000019c9,
20270x00000001,0x00000025,0x00002af9,0x000019c6,
20280x0007000c,0x0000004b,0x000019cc,0x00000001,
20290x00000028,0x00002b0b,0x000019c6,0x00050080,
20300x00000006,0x000019cf,0x00002ad6,0x00000151,
20310x000200f9,0x00001963,0x000200f8,0x000019d0,
20320x000200f9,0x000019d1,0x000200f8,0x000019d1,
20330x000700f5,0x0000004b,0x00002b07,0x00002b66,
20340x00001960,0x00002b0b,0x000019d0,0x000700f5,
20350x0000004b,0x00002af5,0x00002b64,0x00001960,
20360x00002af9,0x000019d0,0x000200f9,0x000019d2,
20370x000200f8,0x000019d2,0x000700f5,0x0000004b,
20380x00002b05,0x00002b66,0x00001bb7,0x00002b07,
20390x000019d1,0x000700f5,0x0000004b,0x00002af3,
20400x00002b64,0x00001bb7,0x00002af5,0x000019d1,
20410x000700f5,0x00000006,0x00002adf,0x0000037d,
20420x00001bb7,0x00001bd5,0x000019d1,0x00050041,
20430x00000028,0x000019d3,0x00001884,0x000000d7,
20440x0004003d,0x00000027,0x000019d4,0x000019d3,
20450x000500b4,0x0000002f,0x000019d5,0x000019d4,
20460x000004f9,0x000300f7,0x000019da,0x00000000,
20470x000400fa,0x000019d5,0x000019d6,0x000019da,
20480x000200f8,0x000019d6,0x00050041,0x00000028,
20490x000019d7,0x00001884,0x00000151,0x0004003d,
20500x00000027,0x000019d8,0x000019d7,0x000500b4,
20510x0000002f,0x000019d9,0x000019d8,0x0000026a,
20520x000200f9,0x000019da,0x000200f8,0x000019da,
20530x000700f5,0x0000002f,0x000019db,0x000019d5,
20540x000019d2,0x000019d9,0x000019d6,0x000300f7,
20550x000019e0,0x00000000,0x000400fa,0x000019db,
20560x000019dc,0x000019e0,0x000200f8,0x000019dc,
20570x00050041,0x00000028,0x000019dd,0x00001884,
20580x00000202,0x0004003d,0x00000027,0x000019de,
20590x000019dd,0x000500b4,0x0000002f,0x000019df,
20600x000019de,0x0000026a,0x000200f9,0x000019e0,
20610x000200f8,0x000019e0,0x000700f5,0x0000002f,
20620x000019e1,0x000019db,0x000019da,0x000019df,
20630x000019dc,0x000300f7,0x000019e6,0x00000000,
20640x000400fa,0x000019e1,0x000019e2,0x000019e6,
20650x000200f8,0x000019e2,0x00050041,0x00000028,
20660x000019e3,0x00001884,0x00000212,0x0004003d,
20670x00000027,0x000019e4,0x000019e3,0x000500b4,
20680x0000002f,0x000019e5,0x000019e4,0x0000026a,
20690x000200f9,0x000019e6,0x000200f8,0x000019e6,
20700x000700f5,0x0000002f,0x000019e7,0x000019e1,
20710x000019e0,0x000019e5,0x000019e2,0x000300f7,
20720x000019ec,0x00000000,0x000400fa,0x000019e7,
20730x000019e8,0x000019ec,0x000200f8,0x000019e8,
20740x00050041,0x00000028,0x000019e9,0x00001884,
20750x0000021a,0x0004003d,0x00000027,0x000019ea,
20760x000019e9,0x000500b4,0x0000002f,0x000019eb,
20770x000019ea,0x000004f9,0x000200f9,0x000019ec,
20780x000200f8,0x000019ec,0x000700f5,0x0000002f,
20790x000019ed,0x000019e7,0x000019e6,0x000019eb,
20800x000019e8,0x000300f7,0x000019f2,0x00000000,
20810x000400fa,0x000019ed,0x000019ee,0x000019f2,
20820x000200f8,0x000019ee,0x00050041,0x00000028,
20830x000019ef,0x00001884,0x00000230,0x0004003d,
20840x00000027,0x000019f0,0x000019ef,0x000500b4,
20850x0000002f,0x000019f1,0x000019f0,0x0000026a,
20860x000200f9,0x000019f2,0x000200f8,0x000019f2,
20870x000700f5,0x0000002f,0x000019f3,0x000019ed,
20880x000019ec,0x000019f1,0x000019ee,0x000300f7,
20890x000019f8,0x00000000,0x000400fa,0x000019f3,
20900x000019f4,0x000019f8,0x000200f8,0x000019f4,
20910x00050041,0x00000028,0x000019f5,0x00001884,
20920x00000305,0x0004003d,0x00000027,0x000019f6,
20930x000019f5,0x000500b4,0x0000002f,0x000019f7,
20940x000019f6,0x0000026a,0x000200f9,0x000019f8,
20950x000200f8,0x000019f8,0x000700f5,0x0000002f,
20960x000019f9,0x000019f3,0x000019f2,0x000019f7,
20970x000019f4,0x000300f7,0x000019fe,0x00000000,
20980x000400fa,0x000019f9,0x000019fa,0x000019fe,
20990x000200f8,0x000019fa,0x00050041,0x00000028,
21000x000019fb,0x00001884,0x0000024d,0x0004003d,
21010x00000027,0x000019fc,0x000019fb,0x000500b4,
21020x0000002f,0x000019fd,0x000019fc,0x0000026a,
21030x000200f9,0x000019fe,0x000200f8,0x000019fe,
21040x000700f5,0x0000002f,0x000019ff,0x000019f9,
21050x000019f8,0x000019fd,0x000019fa,0x000300f7,
21060x00001a04,0x00000000,0x000400fa,0x000019ff,
21070x00001a00,0x00001a04,0x000200f8,0x00001a00,
21080x00050041,0x00000028,0x00001a01,0x00001884,
21090x00000263,0x0004003d,0x00000027,0x00001a02,
21100x00001a01,0x000500b4,0x0000002f,0x00001a03,
21110x00001a02,0x000004f9,0x000200f9,0x00001a04,
21120x000200f8,0x00001a04,0x000700f5,0x0000002f,
21130x00001a05,0x000019ff,0x000019fe,0x00001a03,
21140x00001a00,0x00050080,0x00000006,0x00001a07,
21150x00001916,0x0000037b,0x000500c7,0x00000006,
21160x00001a09,0x00002adf,0x0000052e,0x000600a9,
21170x00000006,0x00001a0b,0x00001a05,0x0000012d,
21180x000000a3,0x000500c5,0x00000006,0x00001a0c,
21190x00001a09,0x00001a0b,0x00050095,0x000000a8,
21200x00001ce3,0x00001b83,0x00001a07,0x00050051,
21210x00000006,0x00001ce4,0x00001ce3,0x00000001,
21220x00050051,0x00000006,0x00001ce5,0x00001ce3,
21230x00000000,0x00050080,0x00000006,0x00001cea,
21240x00001b8a,0x00001ce4,0x00050050,0x00000007,
21250x00001ceb,0x00001ce5,0x00001cea,0x0004007c,
21260x00000014,0x00001cdb,0x00001ceb,0x00060041,
21270x000000d8,0x00001cd3,0x00001cdb,0x000000d7,
21280x000000d7,0x0005003e,0x00001cd3,0x00001a0c,
21290x00000002,0x00000004,0x00050080,0x00000006, 15370x00000002,0x00000004,0x00050080,0x00000006,
21300x00001a11,0x00001916,0x00000385,0x000500c2, 15380x00001576,0x0000156b,0x0000010a,0x00060041,
21310x00000006,0x00001a14,0x00001b0b,0x00000305, 15390x00000028,0x0000157a,0x0000151a,0x0000312f,
21320x000500c4,0x00000006,0x00001a17,0x00001b2c, 15400x000000b0,0x0004003d,0x00000027,0x0000157b,
21330x0000047b,0x000500c5,0x00000006,0x00001a18, 15410x0000157a,0x0004007c,0x00000006,0x000017fb,
21340x00001a14,0x00001a17,0x00050095,0x000000a8, 15420x0000157b,0x00050095,0x000000ab,0x00001816,
21350x00001d03,0x00001b83,0x00001a11,0x00050051, 15430x000017eb,0x00001576,0x00050051,0x00000006,
21360x00000006,0x00001d04,0x00001d03,0x00000001, 15440x00001817,0x00001816,0x00000001,0x00050051,
21370x00050051,0x00000006,0x00001d05,0x00001d03, 15450x00000006,0x00001818,0x00001816,0x00000000,
21380x00000000,0x00050080,0x00000006,0x00001d0a, 15460x00050080,0x00000006,0x0000181d,0x000017f2,
21390x00001b8a,0x00001d04,0x00050050,0x00000007, 15470x00001817,0x00050050,0x00000007,0x0000181e,
21400x00001d0b,0x00001d05,0x00001d0a,0x0004007c, 15480x00001818,0x0000181d,0x0004007c,0x00000014,
21410x00000014,0x00001cfb,0x00001d0b,0x00060041, 15490x0000180e,0x0000181e,0x00060041,0x000000db,
21420x000000d8,0x00001cf3,0x00001cfb,0x000000d7, 15500x00001806,0x0000180e,0x000000da,0x000000da,
21430x000000d7,0x0005003e,0x00001cf3,0x00001a18, 15510x0005003e,0x00001806,0x000017fb,0x00000002,
21440x00000002,0x00000004,0x0004003d,0x00000027, 15520x00000004,0x00050080,0x00000006,0x00001581,
21450x00001a1d,0x000019d3,0x00050041,0x00000028, 15530x0000156b,0x00000111,0x00060041,0x00000028,
21460x00001a1e,0x00001884,0x00000212,0x0004003d, 15540x00001585,0x0000151a,0x0000312f,0x00000170,
21470x00000027,0x00001a1f,0x00001a1e,0x00050041, 15550x0004003d,0x00000027,0x00001586,0x00001585,
21480x00000028,0x00001a20,0x00001884,0x00000305, 15560x0004007c,0x00000006,0x00001824,0x00001586,
21490x0004003d,0x00000027,0x00001a21,0x00001a20, 15570x00050095,0x000000ab,0x0000183f,0x000017eb,
21500x00050041,0x00000028,0x00001a22,0x00001884, 15580x00001581,0x00050051,0x00000006,0x00001840,
21510x00000151,0x0004003d,0x00000027,0x00001a23, 15590x0000183f,0x00000001,0x00050051,0x00000006,
21520x00001a22,0x00050041,0x00000028,0x00001a24, 15600x00001841,0x0000183f,0x00000000,0x00050080,
21530x00001884,0x0000021a,0x0004003d,0x00000027, 15610x00000006,0x00001846,0x000017f2,0x00001840,
21540x00001a25,0x00001a24,0x00050041,0x00000028, 15620x00050050,0x00000007,0x00001847,0x00001841,
21550x00001a26,0x00001884,0x0000024d,0x0004003d, 15630x00001846,0x0004007c,0x00000014,0x00001837,
21560x00000027,0x00001a27,0x00001a26,0x00050041, 15640x00001847,0x00060041,0x000000db,0x0000182f,
21570x00000028,0x00001a28,0x00001884,0x00000202, 15650x00001837,0x000000da,0x000000da,0x0005003e,
21580x0004003d,0x00000027,0x00001a29,0x00001a28, 15660x0000182f,0x00001824,0x00000002,0x00000004,
21590x00050041,0x00000028,0x00001a2a,0x00001884, 15670x00050080,0x00000006,0x0000158a,0x0000312f,
21600x00000230,0x0004003d,0x00000027,0x00001a2b, 15680x00000154,0x000200f9,0x00001563,0x000200f8,
21610x00001a2a,0x00050041,0x00000028,0x00001a2c, 15690x0000158b,0x00050080,0x00000006,0x0000158d,
21620x00001884,0x00000263,0x0004003d,0x00000027, 15700x00001562,0x00000347,0x00050041,0x00000156,
21630x00001a2d,0x00001a2c,0x00060050,0x0000004b, 15710x0000158e,0x000000fc,0x000000da,0x0004003d,
21640x00001a2e,0x00001a1d,0x00001a1f,0x00001a21, 15720x00000007,0x0000158f,0x0000158e,0x00060041,
21650x00060050,0x0000004b,0x00001a2f,0x00001a23, 15730x00000028,0x00001590,0x0000151a,0x00000205,
21660x00001a25,0x00001a27,0x00060050,0x0000004b, 15740x000000a6,0x0004003d,0x00000027,0x00001591,
21670x00001a30,0x00001a29,0x00001a2b,0x00001a2d, 15750x00001590,0x0004007c,0x00000006,0x0000184d,
21680x00060050,0x00000548,0x00001a31,0x00001a2e, 15760x00001591,0x00050051,0x00000006,0x00001866,
21690x00001a2f,0x00001a30,0x0006000c,0x00000027, 15770x0000158f,0x00000000,0x00050095,0x000000ab,
21700x00001a33,0x00000001,0x00000021,0x00001a31, 15780x00001868,0x00001866,0x0000158d,0x00050051,
21710x000500b7,0x0000002f,0x00001a35,0x00001a33, 15790x00000006,0x00001869,0x00001868,0x00000001,
21720x0000026a,0x000300f7,0x00001a3a,0x00000000, 15800x00050051,0x00000006,0x0000186a,0x00001868,
21730x000400fa,0x00001a35,0x00001a36,0x00001a39, 15810x00000000,0x00050051,0x00000006,0x0000186d,
21740x000200f8,0x00001a36,0x0006000c,0x00000548, 15820x0000158f,0x00000001,0x00050080,0x00000006,
21750x00001a38,0x00000001,0x00000022,0x00001a31, 15830x0000186f,0x0000186d,0x00001869,0x00050050,
21760x000200f9,0x00001a3a,0x000200f8,0x00001a39, 15840x00000007,0x00001870,0x0000186a,0x0000186f,
21770x000200f9,0x00001a3a,0x000200f8,0x00001a3a, 15850x0004007c,0x00000014,0x00001860,0x00001870,
21780x000700f5,0x00000548,0x00002ae6,0x00001a38, 15860x00060041,0x000000db,0x00001858,0x00001860,
21790x00001a36,0x0000056e,0x00001a39,0x0003003e, 15870x000000da,0x000000da,0x0005003e,0x00001858,
21800x000018c5,0x00002ae6,0x00050041,0x00000028, 15880x0000184d,0x00000002,0x00000004,0x00050080,
21810x00001a3c,0x00001884,0x0000020a,0x0004003d, 15890x00000006,0x00001594,0x00001562,0x00000352,
21820x00000027,0x00001a3d,0x00001a3c,0x00050041, 15900x00060041,0x00000028,0x00001597,0x0000151a,
21830x00000028,0x00001a3e,0x00001884,0x000004d5, 15910x00000205,0x000000b0,0x0004003d,0x00000027,
21840x0004003d,0x00000027,0x00001a3f,0x00001a3e, 15920x00001598,0x00001597,0x0004007c,0x00000006,
21850x00050041,0x00000028,0x00001a40,0x00001884, 15930x00001876,0x00001598,0x00050095,0x000000ab,
21860x00000278,0x0004003d,0x00000027,0x00001a41, 15940x00001891,0x00001866,0x00001594,0x00050051,
21870x00001a40,0x00060050,0x0000004b,0x00001a42, 15950x00000006,0x00001892,0x00001891,0x00000001,
21880x00001a3d,0x00001a3f,0x00001a41,0x00050091, 15960x00050051,0x00000006,0x00001893,0x00001891,
21890x0000004b,0x00001a45,0x00002ae6,0x00001a42, 15970x00000000,0x00050080,0x00000006,0x00001898,
21900x0004007f,0x0000004b,0x00001a46,0x00001a45, 15980x0000186d,0x00001892,0x00050050,0x00000007,
21910x0003003e,0x000018c8,0x00001a46,0x000200f9, 15990x00001899,0x00001893,0x00001898,0x0004007c,
21920x00001a47,0x000200f8,0x00001a47,0x000700f5, 16000x00000014,0x00001889,0x00001899,0x00060041,
21930x00000006,0x00002ae7,0x000000a3,0x00001a3a, 16010x000000db,0x00001881,0x00001889,0x000000da,
21940x00001a7a,0x00001a4b,0x000500b0,0x0000002f, 16020x000000da,0x0005003e,0x00001881,0x00001876,
21950x00001a4a,0x00002ae7,0x000002b4,0x000400f6,
21960x00001a7b,0x00001a4b,0x00000000,0x000400fa,
21970x00001a4a,0x00001a4b,0x00001a7b,0x000200f8,
21980x00001a4b,0x00050080,0x00000006,0x00001a4d,
21990x00001916,0x00000104,0x00050084,0x00000006,
22000x00001a4f,0x0000011c,0x00002ae7,0x00050080,
22010x00000006,0x00001a50,0x00001a4d,0x00001a4f,
22020x00060041,0x00000028,0x00001a54,0x000018c5,
22030x000000d7,0x00002ae7,0x0004003d,0x00000027,
22040x00001a55,0x00001a54,0x0004007c,0x00000006,
22050x00001d11,0x00001a55,0x00050095,0x000000a8,
22060x00001d2c,0x00001b83,0x00001a50,0x00050051,
22070x00000006,0x00001d2d,0x00001d2c,0x00000001,
22080x00050051,0x00000006,0x00001d2e,0x00001d2c,
22090x00000000,0x00050080,0x00000006,0x00001d33,
22100x00001b8a,0x00001d2d,0x00050050,0x00000007,
22110x00001d34,0x00001d2e,0x00001d33,0x0004007c,
22120x00000014,0x00001d24,0x00001d34,0x00060041,
22130x000000d8,0x00001d1c,0x00001d24,0x000000d7,
22140x000000d7,0x0005003e,0x00001d1c,0x00001d11,
22150x00000002,0x00000004,0x00050080,0x00000006, 16030x00000002,0x00000004,0x00050080,0x00000006,
22160x00001a58,0x00001916,0x00000594,0x00050080, 16040x0000159b,0x00001562,0x0000035d,0x00060041,
22170x00000006,0x00001a5b,0x00001a58,0x00001a4f, 16050x00000028,0x0000159e,0x0000151a,0x00000205,
22180x00060041,0x00000028,0x00001a5f,0x000018c5, 16060x00000170,0x0004003d,0x00000027,0x0000159f,
22190x00000151,0x00002ae7,0x0004003d,0x00000027, 16070x0000159e,0x0004007c,0x00000006,0x0000189f,
22200x00001a60,0x00001a5f,0x0004007c,0x00000006, 16080x0000159f,0x00050095,0x000000ab,0x000018ba,
22210x00001d3a,0x00001a60,0x00050095,0x000000a8, 16090x00001866,0x0000159b,0x00050051,0x00000006,
22220x00001d55,0x00001b83,0x00001a5b,0x00050051, 16100x000018bb,0x000018ba,0x00000001,0x00050051,
22230x00000006,0x00001d56,0x00001d55,0x00000001, 16110x00000006,0x000018bc,0x000018ba,0x00000000,
22240x00050051,0x00000006,0x00001d57,0x00001d55, 16120x00050080,0x00000006,0x000018c1,0x0000186d,
22250x00000000,0x00050080,0x00000006,0x00001d5c, 16130x000018bb,0x00050050,0x00000007,0x000018c2,
22260x00001b8a,0x00001d56,0x00050050,0x00000007, 16140x000018bc,0x000018c1,0x0004007c,0x00000014,
22270x00001d5d,0x00001d57,0x00001d5c,0x0004007c, 16150x000018b2,0x000018c2,0x00060041,0x000000db,
22280x00000014,0x00001d4d,0x00001d5d,0x00060041, 16160x000018aa,0x000018b2,0x000000da,0x000000da,
22290x000000d8,0x00001d45,0x00001d4d,0x000000d7, 16170x0005003e,0x000018aa,0x0000189f,0x00000002,
22300x000000d7,0x0005003e,0x00001d45,0x00001d3a, 16180x00000004,0x00050080,0x00000006,0x000015a2,
16190x00001562,0x00000368,0x00050041,0x000000fe,
16200x000015a5,0x000000fc,0x0000036a,0x0004003d,
16210x00000006,0x000015a6,0x000015a5,0x00050095,
16220x000000ab,0x000018da,0x00001866,0x000015a2,
16230x00050051,0x00000006,0x000018db,0x000018da,
16240x00000001,0x00050051,0x00000006,0x000018dc,
16250x000018da,0x00000000,0x00050080,0x00000006,
16260x000018e1,0x0000186d,0x000018db,0x00050050,
16270x00000007,0x000018e2,0x000018dc,0x000018e1,
16280x0004007c,0x00000014,0x000018d2,0x000018e2,
16290x00060041,0x000000db,0x000018ca,0x000018d2,
16300x000000da,0x000000da,0x0005003e,0x000018ca,
16310x000015a6,0x00000002,0x00000004,0x00050080,
16320x00000006,0x000015a9,0x00001562,0x00000374,
16330x00050095,0x000000ab,0x000018fa,0x00001866,
16340x000015a9,0x00050051,0x00000006,0x000018fb,
16350x000018fa,0x00000001,0x00050051,0x00000006,
16360x000018fc,0x000018fa,0x00000000,0x00050080,
16370x00000006,0x00001901,0x0000186d,0x000018fb,
16380x00050050,0x00000007,0x00001902,0x000018fc,
16390x00001901,0x0004007c,0x00000014,0x000018f2,
16400x00001902,0x00060041,0x000000db,0x000018ea,
16410x000018f2,0x000000da,0x000000da,0x0005003e,
16420x000018ea,0x00000b11,0x00000002,0x00000004,
16430x00050080,0x00000006,0x000015af,0x00001562,
16440x0000037e,0x00050095,0x000000ab,0x0000191a,
16450x00001866,0x000015af,0x00050051,0x00000006,
16460x0000191b,0x0000191a,0x00000001,0x00050051,
16470x00000006,0x0000191c,0x0000191a,0x00000000,
16480x00050080,0x00000006,0x00001921,0x0000186d,
16490x0000191b,0x00050050,0x00000007,0x00001922,
16500x0000191c,0x00001921,0x0004007c,0x00000014,
16510x00001912,0x00001922,0x00060041,0x000000db,
16520x0000190a,0x00001912,0x000000da,0x000000da,
16530x0005003e,0x0000190a,0x00000380,0x00000002,
16540x00000004,0x00050080,0x00000006,0x000015b4,
16550x00001562,0x00000388,0x00050095,0x000000ab,
16560x0000193a,0x00001866,0x000015b4,0x00050051,
16570x00000006,0x0000193b,0x0000193a,0x00000001,
16580x00050051,0x00000006,0x0000193c,0x0000193a,
16590x00000000,0x00050080,0x00000006,0x00001941,
16600x0000186d,0x0000193b,0x00050050,0x00000007,
16610x00001942,0x0000193c,0x00001941,0x0004007c,
16620x00000014,0x00001932,0x00001942,0x00060041,
16630x000000db,0x0000192a,0x00001932,0x000000da,
16640x000000da,0x0005003e,0x0000192a,0x0000038a,
16650x00000002,0x00000004,0x00050041,0x0000004c,
16660x000015b8,0x0000151a,0x000000da,0x0004003d,
16670x0000004b,0x000015b9,0x000015b8,0x0004009c,
16680x00000395,0x000015ba,0x000015b9,0x0004009a,
16690x0000002f,0x000015bb,0x000015ba,0x000400a8,
16700x0000002f,0x000015bc,0x000015bb,0x000300f7,
16710x000015c2,0x00000000,0x000400fa,0x000015bc,
16720x000015bd,0x000015c2,0x000200f8,0x000015bd,
16730x00050041,0x0000004c,0x000015be,0x0000151a,
16740x00000154,0x0004003d,0x0000004b,0x000015bf,
16750x000015be,0x0004009c,0x00000395,0x000015c0,
16760x000015bf,0x0004009a,0x0000002f,0x000015c1,
16770x000015c0,0x000200f9,0x000015c2,0x000200f8,
16780x000015c2,0x000700f5,0x0000002f,0x000015c3,
16790x000015bb,0x0000158b,0x000015c1,0x000015bd,
16800x000400a8,0x0000002f,0x000015c4,0x000015c3,
16810x000300f7,0x000015ca,0x00000000,0x000400fa,
16820x000015c4,0x000015c5,0x000015ca,0x000200f8,
16830x000015c5,0x00050041,0x0000004c,0x000015c6,
16840x0000151a,0x00000205,0x0004003d,0x0000004b,
16850x000015c7,0x000015c6,0x0004009c,0x00000395,
16860x000015c8,0x000015c7,0x0004009a,0x0000002f,
16870x000015c9,0x000015c8,0x000200f9,0x000015ca,
16880x000200f8,0x000015ca,0x000700f5,0x0000002f,
16890x000015cb,0x000015c3,0x000015c2,0x000015c9,
16900x000015c5,0x0004003d,0x0000004b,0x000015cd,
16910x000015b8,0x00050041,0x0000004c,0x000015ce,
16920x0000151a,0x00000154,0x0004003d,0x0000004b,
16930x000015cf,0x000015ce,0x0007000c,0x0000004b,
16940x000015d0,0x00000001,0x00000025,0x000015cd,
16950x000015cf,0x00050041,0x0000004c,0x000015d1,
16960x0000151a,0x00000205,0x0004003d,0x0000004b,
16970x000015d2,0x000015d1,0x0007000c,0x0000004b,
16980x000015d3,0x00000001,0x00000025,0x000015d0,
16990x000015d2,0x0004003d,0x0000004b,0x000015d5,
17000x000015b8,0x0004003d,0x0000004b,0x000015d7,
17010x000015ce,0x0007000c,0x0000004b,0x000015d8,
17020x00000001,0x00000028,0x000015d5,0x000015d7,
17030x0004003d,0x0000004b,0x000015da,0x000015d1,
17040x0007000c,0x0000004b,0x000015db,0x00000001,
17050x00000028,0x000015d8,0x000015da,0x00060050,
17060x00000395,0x0000319d,0x000015cb,0x000015cb,
17070x000015cb,0x000600a9,0x0000004b,0x0000319e,
17080x0000319d,0x0000319b,0x000015db,0x000600a9,
17090x0000004b,0x000031a0,0x0000319d,0x00003199,
17100x000015d3,0x00050041,0x000000fe,0x0000198c,
17110x000000fc,0x000000fd,0x0004003d,0x00000006,
17120x0000198d,0x0000198c,0x00050084,0x00000006,
17130x0000198e,0x0000011f,0x0000198d,0x00050080,
17140x00000006,0x0000198f,0x00000107,0x0000198e,
17150x00050080,0x00000006,0x00001995,0x0000198d,
17160x0000319c,0x00050086,0x00000006,0x00001996,
17170x00001995,0x00000101,0x00050084,0x00000006,
17180x00001988,0x00000107,0x00001996,0x00050080,
17190x00000006,0x00001989,0x0000198f,0x00001988,
17200x00050084,0x00000006,0x00001959,0x00000150,
17210x0000155d,0x00050080,0x00000006,0x0000195a,
17220x00001989,0x00001959,0x00050041,0x00000156,
17230x0000195b,0x000000fc,0x00000154,0x0004003d,
17240x00000007,0x0000195c,0x0000195b,0x00050051,
17250x00000027,0x0000195f,0x000031a0,0x00000000,
17260x0004007c,0x00000006,0x0000199c,0x0000195f,
17270x00050051,0x00000006,0x000019b5,0x0000195c,
17280x00000000,0x00050095,0x000000ab,0x000019b7,
17290x000019b5,0x0000195a,0x00050051,0x00000006,
17300x000019b8,0x000019b7,0x00000001,0x00050051,
17310x00000006,0x000019b9,0x000019b7,0x00000000,
17320x00050051,0x00000006,0x000019bc,0x0000195c,
17330x00000001,0x00050080,0x00000006,0x000019be,
17340x000019bc,0x000019b8,0x00050050,0x00000007,
17350x000019bf,0x000019b9,0x000019be,0x0004007c,
17360x00000014,0x000019af,0x000019bf,0x00060041,
17370x000000db,0x000019a7,0x000019af,0x000000da,
17380x000000da,0x0005003e,0x000019a7,0x0000199c,
22310x00000002,0x00000004,0x00050080,0x00000006, 17390x00000002,0x00000004,0x00050080,0x00000006,
22320x00001a63,0x00001916,0x000005a3,0x00050080, 17400x00001962,0x0000195a,0x0000010a,0x00050051,
22330x00000006,0x00001a66,0x00001a63,0x00001a4f, 17410x00000027,0x00001966,0x000031a0,0x00000001,
22340x00060041,0x00000028,0x00001a6a,0x000018c5, 17420x0004007c,0x00000006,0x000019c5,0x00001966,
22350x00000202,0x00002ae7,0x0004003d,0x00000027, 17430x00050095,0x000000ab,0x000019e0,0x000019b5,
22360x00001a6b,0x00001a6a,0x0004007c,0x00000006, 17440x00001962,0x00050051,0x00000006,0x000019e1,
22370x00001d63,0x00001a6b,0x00050095,0x000000a8, 17450x000019e0,0x00000001,0x00050051,0x00000006,
22380x00001d7e,0x00001b83,0x00001a66,0x00050051, 17460x000019e2,0x000019e0,0x00000000,0x00050080,
22390x00000006,0x00001d7f,0x00001d7e,0x00000001, 17470x00000006,0x000019e7,0x000019bc,0x000019e1,
22400x00050051,0x00000006,0x00001d80,0x00001d7e, 17480x00050050,0x00000007,0x000019e8,0x000019e2,
22410x00000000,0x00050080,0x00000006,0x00001d85, 17490x000019e7,0x0004007c,0x00000014,0x000019d8,
22420x00001b8a,0x00001d7f,0x00050050,0x00000007, 17500x000019e8,0x00060041,0x000000db,0x000019d0,
22430x00001d86,0x00001d80,0x00001d85,0x0004007c, 17510x000019d8,0x000000da,0x000000da,0x0005003e,
22440x00000014,0x00001d76,0x00001d86,0x00060041, 17520x000019d0,0x000019c5,0x00000002,0x00000004,
22450x000000d8,0x00001d6e,0x00001d76,0x000000d7, 17530x00050080,0x00000006,0x00001969,0x0000195a,
22460x000000d7,0x0005003e,0x00001d6e,0x00001d63, 17540x00000111,0x00050051,0x00000027,0x0000196d,
17550x000031a0,0x00000002,0x0004007c,0x00000006,
17560x000019ee,0x0000196d,0x00050095,0x000000ab,
17570x00001a09,0x000019b5,0x00001969,0x00050051,
17580x00000006,0x00001a0a,0x00001a09,0x00000001,
17590x00050051,0x00000006,0x00001a0b,0x00001a09,
17600x00000000,0x00050080,0x00000006,0x00001a10,
17610x000019bc,0x00001a0a,0x00050050,0x00000007,
17620x00001a11,0x00001a0b,0x00001a10,0x0004007c,
17630x00000014,0x00001a01,0x00001a11,0x00060041,
17640x000000db,0x000019f9,0x00001a01,0x000000da,
17650x000000da,0x0005003e,0x000019f9,0x000019ee,
22470x00000002,0x00000004,0x00050080,0x00000006, 17660x00000002,0x00000004,0x00050080,0x00000006,
22480x00001a6e,0x00001916,0x000005b2,0x00050080, 17670x00001970,0x0000195a,0x00000118,0x00050051,
22490x00000006,0x00001a71,0x00001a6e,0x00001a4f, 17680x00000027,0x00001974,0x0000319e,0x00000000,
22500x00050041,0x00000028,0x00001a75,0x000018c8, 17690x0004007c,0x00000006,0x00001a17,0x00001974,
22510x00002ae7,0x0004003d,0x00000027,0x00001a76, 17700x00050095,0x000000ab,0x00001a32,0x000019b5,
22520x00001a75,0x0004007c,0x00000006,0x00001d8c, 17710x00001970,0x00050051,0x00000006,0x00001a33,
22530x00001a76,0x00050095,0x000000a8,0x00001da7, 17720x00001a32,0x00000001,0x00050051,0x00000006,
22540x00001b83,0x00001a71,0x00050051,0x00000006, 17730x00001a34,0x00001a32,0x00000000,0x00050080,
22550x00001da8,0x00001da7,0x00000001,0x00050051, 17740x00000006,0x00001a39,0x000019bc,0x00001a33,
22560x00000006,0x00001da9,0x00001da7,0x00000000, 17750x00050050,0x00000007,0x00001a3a,0x00001a34,
22570x00050080,0x00000006,0x00001dae,0x00001b8a, 17760x00001a39,0x0004007c,0x00000014,0x00001a2a,
22580x00001da8,0x00050050,0x00000007,0x00001daf, 17770x00001a3a,0x00060041,0x000000db,0x00001a22,
22590x00001da9,0x00001dae,0x0004007c,0x00000014, 17780x00001a2a,0x000000da,0x000000da,0x0005003e,
22600x00001d9f,0x00001daf,0x00060041,0x000000d8, 17790x00001a22,0x00001a17,0x00000002,0x00000004,
22610x00001d97,0x00001d9f,0x000000d7,0x000000d7, 17800x00050080,0x00000006,0x00001977,0x0000195a,
22620x0005003e,0x00001d97,0x00001d8c,0x00000002, 17810x0000011f,0x00050051,0x00000027,0x0000197b,
22630x00000004,0x00050080,0x00000006,0x00001a7a, 17820x0000319e,0x00000001,0x0004007c,0x00000006,
22640x00002ae7,0x00000151,0x000200f9,0x00001a47, 17830x00001a40,0x0000197b,0x00050095,0x000000ab,
22650x000200f8,0x00001a7b,0x00050080,0x00000006, 17840x00001a5b,0x000019b5,0x00001977,0x00050051,
22660x00001a7d,0x00001916,0x000005c3,0x00050095, 17850x00000006,0x00001a5c,0x00001a5b,0x00000001,
22670x000000a8,0x00001dc7,0x00001b83,0x00001a7d, 17860x00050051,0x00000006,0x00001a5d,0x00001a5b,
22680x00050051,0x00000006,0x00001dc8,0x00001dc7, 17870x00000000,0x00050080,0x00000006,0x00001a62,
22690x00000001,0x00050051,0x00000006,0x00001dc9, 17880x000019bc,0x00001a5c,0x00050050,0x00000007,
22700x00001dc7,0x00000000,0x00050080,0x00000006, 17890x00001a63,0x00001a5d,0x00001a62,0x0004007c,
22710x00001dce,0x00001b8a,0x00001dc8,0x00050050, 17900x00000014,0x00001a53,0x00001a63,0x00060041,
22720x00000007,0x00001dcf,0x00001dc9,0x00001dce, 17910x000000db,0x00001a4b,0x00001a53,0x000000da,
22730x0004007c,0x00000014,0x00001dbf,0x00001dcf, 17920x000000da,0x0005003e,0x00001a4b,0x00001a40,
22740x00060041,0x000000d8,0x00001db7,0x00001dbf,
22750x000000d7,0x000000d7,0x0005003e,0x00001db7,
22760x000009e9,0x00000002,0x00000004,0x00050080,
22770x00000006,0x00001a83,0x00001916,0x000005cd,
22780x00050095,0x000000a8,0x00001de7,0x00001b83,
22790x00001a83,0x00050051,0x00000006,0x00001de8,
22800x00001de7,0x00000001,0x00050051,0x00000006,
22810x00001de9,0x00001de7,0x00000000,0x00050080,
22820x00000006,0x00001dee,0x00001b8a,0x00001de8,
22830x00050050,0x00000007,0x00001def,0x00001de9,
22840x00001dee,0x0004007c,0x00000014,0x00001ddf,
22850x00001def,0x00060041,0x000000d8,0x00001dd7,
22860x00001ddf,0x000000d7,0x000000d7,0x0005003e,
22870x00001dd7,0x0000037d,0x00000002,0x00000004,
22880x00050080,0x00000006,0x00001a88,0x00001916,
22890x000005d6,0x00050095,0x000000a8,0x00001e07,
22900x00001b83,0x00001a88,0x00050051,0x00000006,
22910x00001e08,0x00001e07,0x00000001,0x00050051,
22920x00000006,0x00001e09,0x00001e07,0x00000000,
22930x00050080,0x00000006,0x00001e0e,0x00001b8a,
22940x00001e08,0x00050050,0x00000007,0x00001e0f,
22950x00001e09,0x00001e0e,0x0004007c,0x00000014,
22960x00001dff,0x00001e0f,0x00060041,0x000000d8,
22970x00001df7,0x00001dff,0x000000d7,0x000000d7,
22980x0005003e,0x00001df7,0x000000a3,0x00000002,
22990x00000004,0x00050080,0x00000006,0x00001a8d,
23000x00001916,0x000005df,0x00050095,0x000000a8,
23010x00001e27,0x00001b83,0x00001a8d,0x00050051,
23020x00000006,0x00001e28,0x00001e27,0x00000001,
23030x00050051,0x00000006,0x00001e29,0x00001e27,
23040x00000000,0x00050080,0x00000006,0x00001e2e,
23050x00001b8a,0x00001e28,0x00050050,0x00000007,
23060x00001e2f,0x00001e29,0x00001e2e,0x0004007c,
23070x00000014,0x00001e1f,0x00001e2f,0x00060041,
23080x000000d8,0x00001e17,0x00001e1f,0x000000d7,
23090x000000d7,0x0005003e,0x00001e17,0x000000a3,
23100x00000002,0x00000004,0x000500b4,0x0000002f,
23110x00001a92,0x00001a33,0x0000026a,0x00060050,
23120x00000392,0x00002b6f,0x00001a92,0x00001a92,
23130x00001a92,0x000600a9,0x0000004b,0x00002b70,
23140x00002b6f,0x00002b66,0x00002b05,0x000600a9,
23150x0000004b,0x00002b72,0x00002b6f,0x00002b64,
23160x00002af3,0x00050041,0x000000fb,0x00001e79,
23170x000000f9,0x000000fa,0x0004003d,0x00000006,
23180x00001e7a,0x00001e79,0x00050084,0x00000006,
23190x00001e7b,0x0000011c,0x00001e7a,0x00050080,
23200x00000006,0x00001e7c,0x00000104,0x00001e7b,
23210x00050080,0x00000006,0x00001e82,0x00001e7a,
23220x00002b67,0x00050086,0x00000006,0x00001e83,
23230x00001e82,0x000000fe,0x00050084,0x00000006,
23240x00001e75,0x00000104,0x00001e83,0x00050080,
23250x00000006,0x00001e76,0x00001e7c,0x00001e75,
23260x00050084,0x00000006,0x00001e46,0x0000014d,
23270x000009e9,0x00050080,0x00000006,0x00001e47,
23280x00001e76,0x00001e46,0x00050041,0x00000153,
23290x00001e48,0x000000f9,0x00000151,0x0004003d,
23300x00000007,0x00001e49,0x00001e48,0x00050051,
23310x00000027,0x00001e4c,0x00002b72,0x00000000,
23320x0004007c,0x00000006,0x00001e89,0x00001e4c,
23330x00050051,0x00000006,0x00001ea2,0x00001e49,
23340x00000000,0x00050095,0x000000a8,0x00001ea4,
23350x00001ea2,0x00001e47,0x00050051,0x00000006,
23360x00001ea5,0x00001ea4,0x00000001,0x00050051,
23370x00000006,0x00001ea6,0x00001ea4,0x00000000,
23380x00050051,0x00000006,0x00001ea9,0x00001e49,
23390x00000001,0x00050080,0x00000006,0x00001eab,
23400x00001ea9,0x00001ea5,0x00050050,0x00000007,
23410x00001eac,0x00001ea6,0x00001eab,0x0004007c,
23420x00000014,0x00001e9c,0x00001eac,0x00060041,
23430x000000d8,0x00001e94,0x00001e9c,0x000000d7,
23440x000000d7,0x0005003e,0x00001e94,0x00001e89,
23450x00000002,0x00000004,0x00050080,0x00000006, 17930x00000002,0x00000004,0x00050080,0x00000006,
23460x00001e4f,0x00001e47,0x00000107,0x00050051, 17940x0000197e,0x0000195a,0x00000189,0x00050051,
23470x00000027,0x00001e53,0x00002b72,0x00000001, 17950x00000027,0x00001982,0x0000319e,0x00000002,
23480x0004007c,0x00000006,0x00001eb2,0x00001e53, 17960x0004007c,0x00000006,0x00001a69,0x00001982,
23490x00050095,0x000000a8,0x00001ecd,0x00001ea2, 17970x00050095,0x000000ab,0x00001a84,0x000019b5,
23500x00001e4f,0x00050051,0x00000006,0x00001ece, 17980x0000197e,0x00050051,0x00000006,0x00001a85,
23510x00001ecd,0x00000001,0x00050051,0x00000006, 17990x00001a84,0x00000001,0x00050051,0x00000006,
23520x00001ecf,0x00001ecd,0x00000000,0x00050080, 18000x00001a86,0x00001a84,0x00000000,0x00050080,
23530x00000006,0x00001ed4,0x00001ea9,0x00001ece, 18010x00000006,0x00001a8b,0x000019bc,0x00001a85,
23540x00050050,0x00000007,0x00001ed5,0x00001ecf, 18020x00050050,0x00000007,0x00001a8c,0x00001a86,
23550x00001ed4,0x0004007c,0x00000014,0x00001ec5, 18030x00001a8b,0x0004007c,0x00000014,0x00001a7c,
23560x00001ed5,0x00060041,0x000000d8,0x00001ebd, 18040x00001a8c,0x00060041,0x000000db,0x00001a74,
23570x00001ec5,0x000000d7,0x000000d7,0x0005003e, 18050x00001a7c,0x000000da,0x000000da,0x0005003e,
23580x00001ebd,0x00001eb2,0x00000002,0x00000004, 18060x00001a74,0x00001a69,0x00000002,0x00000004,
23590x00050080,0x00000006,0x00001e56,0x00001e47, 18070x000300f7,0x00001acc,0x00000000,0x000300fb,
23600x0000010e,0x00050051,0x00000027,0x00001e5a, 18080x000000a6,0x00001a9b,0x000200f8,0x00001a9b,
23610x00002b72,0x00000002,0x0004007c,0x00000006, 18090x000500bc,0x0000002f,0x00001ad3,0x0000195f,
23620x00001edb,0x00001e5a,0x00050095,0x000000a8, 18100x00001974,0x000300f7,0x00001ada,0x00000000,
23630x00001ef6,0x00001ea2,0x00001e56,0x00050051, 18110x000400fa,0x00001ad3,0x00001ad4,0x00001ada,
23640x00000006,0x00001ef7,0x00001ef6,0x00000001, 18120x000200f8,0x00001ad4,0x000500bc,0x0000002f,
23650x00050051,0x00000006,0x00001ef8,0x00001ef6, 18130x00001ad9,0x00001966,0x0000197b,0x000200f9,
23660x00000000,0x00050080,0x00000006,0x00001efd, 18140x00001ada,0x000200f8,0x00001ada,0x000700f5,
23670x00001ea9,0x00001ef7,0x00050050,0x00000007, 18150x0000002f,0x00001adb,0x00001ad3,0x00001a9b,
23680x00001efe,0x00001ef8,0x00001efd,0x0004007c, 18160x00001ad9,0x00001ad4,0x000300f7,0x00001ae2,
23690x00000014,0x00001eee,0x00001efe,0x00060041, 18170x00000000,0x000400fa,0x00001adb,0x00001adc,
23700x000000d8,0x00001ee6,0x00001eee,0x000000d7, 18180x00001ae2,0x000200f8,0x00001adc,0x000500bc,
23710x000000d7,0x0005003e,0x00001ee6,0x00001edb, 18190x0000002f,0x00001ae1,0x0000196d,0x00001982,
18200x000200f9,0x00001ae2,0x000200f8,0x00001ae2,
18210x000700f5,0x0000002f,0x00001ae3,0x00001adb,
18220x00001ada,0x00001ae1,0x00001adc,0x000400a8,
18230x0000002f,0x00001ae4,0x00001ae3,0x000300f7,
18240x00001aa0,0x00000000,0x000400fa,0x00001ae4,
18250x00001a9f,0x00001aa0,0x000200f8,0x00001a9f,
18260x000200f9,0x00001acc,0x000200f8,0x00001aa0,
18270x00050081,0x0000004b,0x00001aa3,0x000031a0,
18280x0000319e,0x0005008e,0x0000004b,0x00001aa4,
18290x00001aa3,0x000001ed,0x00050095,0x000000ab,
18300x00001af4,0x000019b5,0x000000a6,0x00050051,
18310x00000006,0x00001af5,0x00001af4,0x00000001,
18320x00050051,0x00000006,0x00001af6,0x00001af4,
18330x00000000,0x00050080,0x00000006,0x00001afb,
18340x000019bc,0x00001af5,0x00050050,0x00000007,
18350x00001afc,0x00001af6,0x00001afb,0x0004007c,
18360x00000014,0x00001aec,0x00001afc,0x00060041,
18370x000000db,0x00001aa9,0x00001aec,0x000000da,
18380x000000da,0x00050051,0x00000027,0x00001aab,
18390x00001aa4,0x00000000,0x0004007c,0x00000006,
18400x00001b02,0x00001aab,0x000500c7,0x00000006,
18410x00001b04,0x00001b02,0x00000130,0x000500ab,
18420x0000002f,0x00001b05,0x00001b04,0x000000a6,
18430x000300f7,0x00001b0c,0x00000000,0x000400fa,
18440x00001b05,0x00001b06,0x00001b09,0x000200f8,
18450x00001b06,0x000400c8,0x00000006,0x00001b08,
18460x00001b02,0x000200f9,0x00001b0c,0x000200f8,
18470x00001b09,0x000500c5,0x00000006,0x00001b0b,
18480x00001b02,0x00000130,0x000200f9,0x00001b0c,
18490x000200f8,0x00001b0c,0x000700f5,0x00000006,
18500x00003132,0x00001b08,0x00001b06,0x00001b0b,
18510x00001b09,0x000700ed,0x00000006,0x00001aad,
18520x00001aa9,0x000000b0,0x000000a6,0x00003132,
18530x00060041,0x000000db,0x00001aaf,0x00001aec,
18540x000000da,0x00000154,0x00050051,0x00000027,
18550x00001ab1,0x00001aa4,0x00000001,0x0004007c,
18560x00000006,0x00001b13,0x00001ab1,0x000500c7,
18570x00000006,0x00001b15,0x00001b13,0x00000130,
18580x000500ab,0x0000002f,0x00001b16,0x00001b15,
18590x000000a6,0x000300f7,0x00001b1d,0x00000000,
18600x000400fa,0x00001b16,0x00001b17,0x00001b1a,
18610x000200f8,0x00001b17,0x000400c8,0x00000006,
18620x00001b19,0x00001b13,0x000200f9,0x00001b1d,
18630x000200f8,0x00001b1a,0x000500c5,0x00000006,
18640x00001b1c,0x00001b13,0x00000130,0x000200f9,
18650x00001b1d,0x000200f8,0x00001b1d,0x000700f5,
18660x00000006,0x00003133,0x00001b19,0x00001b17,
18670x00001b1c,0x00001b1a,0x000700ed,0x00000006,
18680x00001ab3,0x00001aaf,0x000000b0,0x000000a6,
18690x00003133,0x00060041,0x000000db,0x00001ab5,
18700x00001aec,0x000000da,0x00000205,0x00050051,
18710x00000027,0x00001ab7,0x00001aa4,0x00000002,
18720x0004007c,0x00000006,0x00001b24,0x00001ab7,
18730x000500c7,0x00000006,0x00001b26,0x00001b24,
18740x00000130,0x000500ab,0x0000002f,0x00001b27,
18750x00001b26,0x000000a6,0x000300f7,0x00001b2e,
18760x00000000,0x000400fa,0x00001b27,0x00001b28,
18770x00001b2b,0x000200f8,0x00001b28,0x000400c8,
18780x00000006,0x00001b2a,0x00001b24,0x000200f9,
18790x00001b2e,0x000200f8,0x00001b2b,0x000500c5,
18800x00000006,0x00001b2d,0x00001b24,0x00000130,
18810x000200f9,0x00001b2e,0x000200f8,0x00001b2e,
18820x000700f5,0x00000006,0x00003134,0x00001b2a,
18830x00001b28,0x00001b2d,0x00001b2b,0x000700ed,
18840x00000006,0x00001ab9,0x00001ab5,0x000000b0,
18850x000000a6,0x00003134,0x00060041,0x000000db,
18860x00001abb,0x00001aec,0x000000da,0x0000020d,
18870x000300f7,0x00001b3f,0x00000000,0x000400fa,
18880x00001b05,0x00001b39,0x00001b3c,0x000200f8,
18890x00001b39,0x000400c8,0x00000006,0x00001b3b,
18900x00001b02,0x000200f9,0x00001b3f,0x000200f8,
18910x00001b3c,0x000500c5,0x00000006,0x00001b3e,
18920x00001b02,0x00000130,0x000200f9,0x00001b3f,
18930x000200f8,0x00001b3f,0x000700f5,0x00000006,
18940x00003135,0x00001b3b,0x00001b39,0x00001b3e,
18950x00001b3c,0x000700ef,0x00000006,0x00001abf,
18960x00001abb,0x000000b0,0x000000a6,0x00003135,
18970x00060041,0x000000db,0x00001ac1,0x00001aec,
18980x000000da,0x00000215,0x000300f7,0x00001b50,
18990x00000000,0x000400fa,0x00001b16,0x00001b4a,
19000x00001b4d,0x000200f8,0x00001b4a,0x000400c8,
19010x00000006,0x00001b4c,0x00001b13,0x000200f9,
19020x00001b50,0x000200f8,0x00001b4d,0x000500c5,
19030x00000006,0x00001b4f,0x00001b13,0x00000130,
19040x000200f9,0x00001b50,0x000200f8,0x00001b50,
19050x000700f5,0x00000006,0x00003136,0x00001b4c,
19060x00001b4a,0x00001b4f,0x00001b4d,0x000700ef,
19070x00000006,0x00001ac5,0x00001ac1,0x000000b0,
19080x000000a6,0x00003136,0x00060041,0x000000db,
19090x00001ac7,0x00001aec,0x000000da,0x0000021d,
19100x000300f7,0x00001b61,0x00000000,0x000400fa,
19110x00001b27,0x00001b5b,0x00001b5e,0x000200f8,
19120x00001b5b,0x000400c8,0x00000006,0x00001b5d,
19130x00001b24,0x000200f9,0x00001b61,0x000200f8,
19140x00001b5e,0x000500c5,0x00000006,0x00001b60,
19150x00001b24,0x00000130,0x000200f9,0x00001b61,
19160x000200f8,0x00001b61,0x000700f5,0x00000006,
19170x00003137,0x00001b5d,0x00001b5b,0x00001b60,
19180x00001b5e,0x000700ef,0x00000006,0x00001acb,
19190x00001ac7,0x000000b0,0x000000a6,0x00003137,
19200x000200f9,0x00001acc,0x000200f8,0x00001acc,
19210x000200f9,0x00000b95,0x000200f8,0x00000b99,
19220x000500aa,0x0000002f,0x00000b9c,0x00000b13,
19230x00000170,0x000300f7,0x00000b9e,0x00000000,
19240x000400fa,0x00000b9c,0x00000b9d,0x00000ba2,
19250x000200f8,0x00000b9d,0x00050084,0x00000006,
19260x00001bca,0x00000107,0x00000b11,0x000200f9,
19270x00001bcb,0x000200f8,0x00001bcb,0x000700f5,
19280x00000006,0x000030e4,0x000000a6,0x00000b9d,
19290x00001bdc,0x00001bcf,0x000500b0,0x0000002f,
19300x00001bce,0x000030e4,0x00000118,0x000400f6,
19310x00001bdd,0x00001bcf,0x00000000,0x000400fa,
19320x00001bce,0x00001bcf,0x00001bdd,0x000200f8,
19330x00001bcf,0x00050084,0x00000006,0x00001bd3,
19340x0000010a,0x000030e4,0x00050080,0x00000006,
19350x00001bd4,0x00001bca,0x00001bd3,0x00050041,
19360x00000156,0x00001bd5,0x000000fc,0x00000205,
19370x0004003d,0x00000007,0x00001bd6,0x00001bd5,
19380x00050051,0x00000006,0x00001d97,0x00001bd6,
19390x00000000,0x00050095,0x000000ab,0x00001d99,
19400x00001d97,0x00001bd4,0x00050051,0x00000006,
19410x00001d9a,0x00001d99,0x00000001,0x00050051,
19420x00000006,0x00001d9b,0x00001d99,0x00000000,
19430x00050051,0x00000006,0x00001d9e,0x00001bd6,
19440x00000001,0x00050080,0x00000006,0x00001da0,
19450x00001d9e,0x00001d9a,0x00050050,0x00000007,
19460x00001da1,0x00001d9b,0x00001da0,0x0004007c,
19470x00000014,0x00001d91,0x00001da1,0x00060041,
19480x000000db,0x00001d88,0x00001d91,0x000000da,
19490x000000da,0x0006003d,0x00000006,0x00001d89,
19500x00001d88,0x00000002,0x00000004,0x0004007c,
19510x00000027,0x00001bd8,0x00001d89,0x00050041,
19520x00000028,0x00001bd9,0x00001b65,0x000030e4,
19530x0003003e,0x00001bd9,0x00001bd8,0x00050080,
19540x00000006,0x00001bdc,0x000030e4,0x00000154,
19550x000200f9,0x00001bcb,0x000200f8,0x00001bdd,
19560x00050080,0x00000006,0x00001bdf,0x00001bca,
19570x00000368,0x00050041,0x00000156,0x00001be0,
19580x000000fc,0x00000205,0x0004003d,0x00000007,
19590x00001be1,0x00001be0,0x00050051,0x00000006,
19600x00001db8,0x00001be1,0x00000000,0x00050095,
19610x000000ab,0x00001dba,0x00001db8,0x00001bdf,
19620x00050051,0x00000006,0x00001dbb,0x00001dba,
19630x00000001,0x00050051,0x00000006,0x00001dbc,
19640x00001dba,0x00000000,0x00050051,0x00000006,
19650x00001dbf,0x00001be1,0x00000001,0x00050080,
19660x00000006,0x00001dc1,0x00001dbf,0x00001dbb,
19670x00050050,0x00000007,0x00001dc2,0x00001dbc,
19680x00001dc1,0x0004007c,0x00000014,0x00001db2,
19690x00001dc2,0x00060041,0x000000db,0x00001da9,
19700x00001db2,0x000000da,0x000000da,0x0006003d,
19710x00000006,0x00001daa,0x00001da9,0x00000002,
19720x00000004,0x00050080,0x00000006,0x00001be4,
19730x00001bca,0x00000374,0x00050095,0x000000ab,
19740x00001ddb,0x00001db8,0x00001be4,0x00050051,
19750x00000006,0x00001ddc,0x00001ddb,0x00000001,
19760x00050051,0x00000006,0x00001ddd,0x00001ddb,
19770x00000000,0x00050080,0x00000006,0x00001de2,
19780x00001dbf,0x00001ddc,0x00050050,0x00000007,
19790x00001de3,0x00001ddd,0x00001de2,0x0004007c,
19800x00000014,0x00001dd3,0x00001de3,0x00060041,
19810x000000db,0x00001dca,0x00001dd3,0x000000da,
19820x000000da,0x0006003d,0x00000006,0x00001dcb,
19830x00001dca,0x00000002,0x00000004,0x00050080,
19840x00000006,0x00001be9,0x00001bca,0x0000037e,
19850x00050095,0x000000ab,0x00001dfc,0x00001db8,
19860x00001be9,0x00050051,0x00000006,0x00001dfd,
19870x00001dfc,0x00000001,0x00050051,0x00000006,
19880x00001dfe,0x00001dfc,0x00000000,0x00050080,
19890x00000006,0x00001e03,0x00001dbf,0x00001dfd,
19900x00050050,0x00000007,0x00001e04,0x00001dfe,
19910x00001e03,0x0004007c,0x00000014,0x00001df4,
19920x00001e04,0x00060041,0x000000db,0x00001deb,
19930x00001df4,0x000000da,0x000000da,0x0006003d,
19940x00000006,0x00001dec,0x00001deb,0x00000002,
19950x00000004,0x00050080,0x00000006,0x00001bee,
19960x00001bca,0x00000388,0x00050095,0x000000ab,
19970x00001e1d,0x00001db8,0x00001bee,0x00050051,
19980x00000006,0x00001e1e,0x00001e1d,0x00000001,
19990x00050051,0x00000006,0x00001e1f,0x00001e1d,
20000x00000000,0x00050080,0x00000006,0x00001e24,
20010x00001dbf,0x00001e1e,0x00050050,0x00000007,
20020x00001e25,0x00001e1f,0x00001e24,0x0004007c,
20030x00000014,0x00001e15,0x00001e25,0x00060041,
20040x000000db,0x00001e0c,0x00001e15,0x000000da,
20050x000000da,0x0006003d,0x00000006,0x00001e0d,
20060x00001e0c,0x00000002,0x00000004,0x00050041,
20070x000000fe,0x00001bf3,0x000000fc,0x0000022c,
20080x0004003d,0x00000006,0x00001bf4,0x00001bf3,
20090x00050084,0x00000006,0x00001bf6,0x00000228,
20100x00000b11,0x00050080,0x00000006,0x00001bf7,
20110x00001bf4,0x00001bf6,0x000200f9,0x00001bf8,
20120x000200f8,0x00001bf8,0x000700f5,0x00000006,
20130x000030e5,0x000000a6,0x00001bdd,0x00001c09,
20140x00001bfc,0x000500b0,0x0000002f,0x00001bfb,
20150x000030e5,0x00000118,0x000400f6,0x00001c0a,
20160x00001bfc,0x00000000,0x000400fa,0x00001bfb,
20170x00001bfc,0x00001c0a,0x000200f8,0x00001bfc,
20180x00050084,0x00000006,0x00001bff,0x0000010a,
20190x000030e5,0x00050080,0x00000006,0x00001c00,
20200x00001bf7,0x00001bff,0x00050041,0x00000156,
20210x00001c02,0x000000fc,0x000000da,0x0004003d,
20220x00000007,0x00001c03,0x00001c02,0x00050041,
20230x00000028,0x00001c04,0x00001b65,0x000030e5,
20240x0004003d,0x00000027,0x00001c05,0x00001c04,
20250x0004007c,0x00000006,0x00001e2b,0x00001c05,
20260x00050051,0x00000006,0x00001e44,0x00001c03,
20270x00000000,0x00050095,0x000000ab,0x00001e46,
20280x00001e44,0x00001c00,0x00050051,0x00000006,
20290x00001e47,0x00001e46,0x00000001,0x00050051,
20300x00000006,0x00001e48,0x00001e46,0x00000000,
20310x00050051,0x00000006,0x00001e4b,0x00001c03,
20320x00000001,0x00050080,0x00000006,0x00001e4d,
20330x00001e4b,0x00001e47,0x00050050,0x00000007,
20340x00001e4e,0x00001e48,0x00001e4d,0x0004007c,
20350x00000014,0x00001e3e,0x00001e4e,0x00060041,
20360x000000db,0x00001e36,0x00001e3e,0x000000da,
20370x000000da,0x0005003e,0x00001e36,0x00001e2b,
23720x00000002,0x00000004,0x00050080,0x00000006, 20380x00000002,0x00000004,0x00050080,0x00000006,
23730x00001e5d,0x00001e47,0x00000115,0x00050051, 20390x00001c09,0x000030e5,0x00000154,0x000200f9,
23740x00000027,0x00001e61,0x00002b70,0x00000000, 20400x00001bf8,0x000200f8,0x00001c0a,0x00050080,
23750x0004007c,0x00000006,0x00001f04,0x00001e61, 20410x00000006,0x00001c0c,0x00001bf7,0x00000368,
23760x00050095,0x000000a8,0x00001f1f,0x00001ea2, 20420x00050041,0x00000156,0x00001c0d,0x000000fc,
23770x00001e5d,0x00050051,0x00000006,0x00001f20, 20430x000000da,0x0004003d,0x00000007,0x00001c0e,
23780x00001f1f,0x00000001,0x00050051,0x00000006, 20440x00001c0d,0x00050051,0x00000006,0x00001e64,
23790x00001f21,0x00001f1f,0x00000000,0x00050080, 20450x00001c0e,0x00000000,0x00050095,0x000000ab,
23800x00000006,0x00001f26,0x00001ea9,0x00001f20, 20460x00001e66,0x00001e64,0x00001c0c,0x00050051,
23810x00050050,0x00000007,0x00001f27,0x00001f21, 20470x00000006,0x00001e67,0x00001e66,0x00000001,
23820x00001f26,0x0004007c,0x00000014,0x00001f17, 20480x00050051,0x00000006,0x00001e68,0x00001e66,
23830x00001f27,0x00060041,0x000000d8,0x00001f0f, 20490x00000000,0x00050051,0x00000006,0x00001e6b,
23840x00001f17,0x000000d7,0x000000d7,0x0005003e, 20500x00001c0e,0x00000001,0x00050080,0x00000006,
23850x00001f0f,0x00001f04,0x00000002,0x00000004, 20510x00001e6d,0x00001e6b,0x00001e67,0x00050050,
23860x00050080,0x00000006,0x00001e64,0x00001e47, 20520x00000007,0x00001e6e,0x00001e68,0x00001e6d,
23870x0000011c,0x00050051,0x00000027,0x00001e68, 20530x0004007c,0x00000014,0x00001e5e,0x00001e6e,
23880x00002b70,0x00000001,0x0004007c,0x00000006, 20540x00060041,0x000000db,0x00001e56,0x00001e5e,
23890x00001f2d,0x00001e68,0x00050095,0x000000a8, 20550x000000da,0x000000da,0x0005003e,0x00001e56,
23900x00001f48,0x00001ea2,0x00001e64,0x00050051, 20560x00001daa,0x00000002,0x00000004,0x00050080,
23910x00000006,0x00001f49,0x00001f48,0x00000001, 20570x00000006,0x00001c12,0x00001bf7,0x00000374,
23920x00050051,0x00000006,0x00001f4a,0x00001f48, 20580x00050095,0x000000ab,0x00001e86,0x00001e64,
23930x00000000,0x00050080,0x00000006,0x00001f4f, 20590x00001c12,0x00050051,0x00000006,0x00001e87,
23940x00001ea9,0x00001f49,0x00050050,0x00000007, 20600x00001e86,0x00000001,0x00050051,0x00000006,
23950x00001f50,0x00001f4a,0x00001f4f,0x0004007c, 20610x00001e88,0x00001e86,0x00000000,0x00050080,
23960x00000014,0x00001f40,0x00001f50,0x00060041, 20620x00000006,0x00001e8d,0x00001e6b,0x00001e87,
23970x000000d8,0x00001f38,0x00001f40,0x000000d7, 20630x00050050,0x00000007,0x00001e8e,0x00001e88,
23980x000000d7,0x0005003e,0x00001f38,0x00001f2d, 20640x00001e8d,0x0004007c,0x00000014,0x00001e7e,
20650x00001e8e,0x00060041,0x000000db,0x00001e76,
20660x00001e7e,0x000000da,0x000000da,0x0005003e,
20670x00001e76,0x00001dcb,0x00000002,0x00000004,
20680x000500aa,0x0000002f,0x00001e93,0x00001dec,
20690x000000a6,0x000300f7,0x00001e98,0x00000000,
20700x000400fa,0x00001e93,0x00001e94,0x00001e98,
20710x000200f8,0x00001e94,0x000500aa,0x0000002f,
20720x00001e97,0x00001e0d,0x000000a6,0x000200f9,
20730x00001e98,0x000200f8,0x00001e98,0x000700f5,
20740x0000002f,0x00001e99,0x00001e93,0x00001c0a,
20750x00001e97,0x00001e94,0x000400a8,0x0000002f,
20760x00001c1d,0x00001e99,0x000300f7,0x00001cb3,
20770x00000000,0x000400fa,0x00001c1d,0x00001c1e,
20780x00001cb3,0x000200f8,0x00001c1e,0x00050041,
20790x00000156,0x00001c20,0x000000fc,0x0000021d,
20800x0004003d,0x00000007,0x00001c21,0x00001c20,
20810x00050051,0x00000006,0x00001ea1,0x00001c21,
20820x00000000,0x00050095,0x000000ab,0x00001ea2,
20830x00001dec,0x00001ea1,0x00050051,0x00000006,
20840x00001ea3,0x00001ea2,0x00000001,0x00050051,
20850x00000006,0x00001ea4,0x00001ea2,0x00000000,
20860x00050051,0x00000006,0x00001ea9,0x00001c21,
20870x00000001,0x00050080,0x00000006,0x00001eaa,
20880x00001e0d,0x00001ea9,0x00050080,0x00000006,
20890x00001eac,0x00001eaa,0x00001ea3,0x00050095,
20900x000000ab,0x00001ec6,0x00001ea4,0x00000368,
20910x00050051,0x00000006,0x00001ec7,0x00001ec6,
20920x00000001,0x00050051,0x00000006,0x00001ec8,
20930x00001ec6,0x00000000,0x00050080,0x00000006,
20940x00001ecd,0x00001eac,0x00001ec7,0x00050050,
20950x00000007,0x00001ece,0x00001ec8,0x00001ecd,
20960x0004007c,0x00000014,0x00001ebe,0x00001ece,
20970x00060041,0x000000db,0x00001eb5,0x00001ebe,
20980x000000da,0x000000da,0x0006003d,0x00000006,
20990x00001eb6,0x00001eb5,0x00000002,0x00000004,
21000x00050095,0x000000ab,0x00001ee7,0x00001ea4,
21010x0000011f,0x00050051,0x00000006,0x00001ee8,
21020x00001ee7,0x00000001,0x00050051,0x00000006,
21030x00001ee9,0x00001ee7,0x00000000,0x00050080,
21040x00000006,0x00001eee,0x00001eac,0x00001ee8,
21050x00050050,0x00000007,0x00001eef,0x00001ee9,
21060x00001eee,0x0004007c,0x00000014,0x00001edf,
21070x00001eef,0x00060041,0x000000db,0x00001ed6,
21080x00001edf,0x000000da,0x000000da,0x0006003d,
21090x00000006,0x00001ed7,0x00001ed6,0x00000002,
21100x00000004,0x0004007c,0x00000027,0x00001c27,
21110x00001ed7,0x00050095,0x000000ab,0x00001f08,
21120x00001ea4,0x00000189,0x00050051,0x00000006,
21130x00001f09,0x00001f08,0x00000001,0x00050051,
21140x00000006,0x00001f0a,0x00001f08,0x00000000,
21150x00050080,0x00000006,0x00001f0f,0x00001eac,
21160x00001f09,0x00050050,0x00000007,0x00001f10,
21170x00001f0a,0x00001f0f,0x0004007c,0x00000014,
21180x00001f00,0x00001f10,0x00060041,0x000000db,
21190x00001ef7,0x00001f00,0x000000da,0x000000da,
21200x0006003d,0x00000006,0x00001ef8,0x00001ef7,
21210x00000002,0x00000004,0x0004007c,0x00000027,
21220x00001c2a,0x00001ef8,0x00050095,0x000000ab,
21230x00001f29,0x00001ea4,0x00000150,0x00050051,
21240x00000006,0x00001f2a,0x00001f29,0x00000001,
21250x00050051,0x00000006,0x00001f2b,0x00001f29,
21260x00000000,0x00050080,0x00000006,0x00001f30,
21270x00001eac,0x00001f2a,0x00050050,0x00000007,
21280x00001f31,0x00001f2b,0x00001f30,0x0004007c,
21290x00000014,0x00001f21,0x00001f31,0x00060041,
21300x000000db,0x00001f18,0x00001f21,0x000000da,
21310x000000da,0x0006003d,0x00000006,0x00001f19,
21320x00001f18,0x00000002,0x00000004,0x0004007c,
21330x00000027,0x00001c2d,0x00001f19,0x00050095,
21340x000000ab,0x00001f4a,0x00001ea4,0x00000463,
21350x00050051,0x00000006,0x00001f4b,0x00001f4a,
21360x00000001,0x00050051,0x00000006,0x00001f4c,
21370x00001f4a,0x00000000,0x00050080,0x00000006,
21380x00001f51,0x00001eac,0x00001f4b,0x00050050,
21390x00000007,0x00001f52,0x00001f4c,0x00001f51,
21400x0004007c,0x00000014,0x00001f42,0x00001f52,
21410x00060041,0x000000db,0x00001f39,0x00001f42,
21420x000000da,0x000000da,0x0006003d,0x00000006,
21430x00001f3a,0x00001f39,0x00000002,0x00000004,
21440x0004007c,0x00000027,0x00001c31,0x00001f3a,
21450x00050095,0x000000ab,0x00001f6b,0x00001ea4,
21460x00000469,0x00050051,0x00000006,0x00001f6c,
21470x00001f6b,0x00000001,0x00050051,0x00000006,
21480x00001f6d,0x00001f6b,0x00000000,0x00050080,
21490x00000006,0x00001f72,0x00001eac,0x00001f6c,
21500x00050050,0x00000007,0x00001f73,0x00001f6d,
21510x00001f72,0x0004007c,0x00000014,0x00001f63,
21520x00001f73,0x00060041,0x000000db,0x00001f5a,
21530x00001f63,0x000000da,0x000000da,0x0006003d,
21540x00000006,0x00001f5b,0x00001f5a,0x00000002,
21550x00000004,0x0004007c,0x00000027,0x00001c34,
21560x00001f5b,0x00050095,0x000000ab,0x00001f8c,
21570x00001ea4,0x00000347,0x00050051,0x00000006,
21580x00001f8d,0x00001f8c,0x00000001,0x00050051,
21590x00000006,0x00001f8e,0x00001f8c,0x00000000,
21600x00050080,0x00000006,0x00001f93,0x00001eac,
21610x00001f8d,0x00050050,0x00000007,0x00001f94,
21620x00001f8e,0x00001f93,0x0004007c,0x00000014,
21630x00001f84,0x00001f94,0x00060041,0x000000db,
21640x00001f7b,0x00001f84,0x000000da,0x000000da,
21650x0006003d,0x00000006,0x00001f7c,0x00001f7b,
21660x00000002,0x00000004,0x0004007c,0x00000027,
21670x00001c37,0x00001f7c,0x000500bc,0x0000002f,
21680x00001f9b,0x00001c27,0x00001c31,0x000300f7,
21690x00001fa2,0x00000000,0x000400fa,0x00001f9b,
21700x00001f9c,0x00001fa2,0x000200f8,0x00001f9c,
21710x000500bc,0x0000002f,0x00001fa1,0x00001c2a,
21720x00001c34,0x000200f9,0x00001fa2,0x000200f8,
21730x00001fa2,0x000700f5,0x0000002f,0x00001fa3,
21740x00001f9b,0x00001c1e,0x00001fa1,0x00001f9c,
21750x000300f7,0x00001faa,0x00000000,0x000400fa,
21760x00001fa3,0x00001fa4,0x00001faa,0x000200f8,
21770x00001fa4,0x000500bc,0x0000002f,0x00001fa9,
21780x00001c2d,0x00001c37,0x000200f9,0x00001faa,
21790x000200f8,0x00001faa,0x000700f5,0x0000002f,
21800x00001fab,0x00001fa3,0x00001fa2,0x00001fa9,
21810x00001fa4,0x000300f7,0x00001c41,0x00000000,
21820x000400fa,0x00001fab,0x00001c3d,0x00001c41,
21830x000200f8,0x00001c3d,0x000500c2,0x00000006,
21840x00001c3f,0x00001daa,0x0000047e,0x000500ab,
21850x0000002f,0x00001c40,0x00001c3f,0x000000a6,
21860x000200f9,0x00001c41,0x000200f8,0x00001c41,
21870x000700f5,0x0000002f,0x00001c42,0x00001fab,
21880x00001faa,0x00001c40,0x00001c3d,0x000300f7,
21890x00001cb2,0x00000000,0x000400fa,0x00001c42,
21900x00001c43,0x00001cb2,0x000200f8,0x00001c43,
21910x000200f9,0x00001c44,0x000200f8,0x00001c44,
21920x000700f5,0x0000004b,0x0000311b,0x0000319b,
21930x00001c43,0x00001cad,0x00001c48,0x000700f5,
21940x0000004b,0x00003109,0x00003199,0x00001c43,
21950x00001caa,0x00001c48,0x000700f5,0x00000006,
21960x000030e6,0x000000a6,0x00001c43,0x00001cb0,
21970x00001c48,0x000500b0,0x0000002f,0x00001c47,
21980x000030e6,0x00000111,0x000400f6,0x00001cb1,
21990x00001c48,0x00000000,0x000400fa,0x00001c47,
22000x00001c48,0x00001cb1,0x000200f8,0x00001c48,
22010x000500c7,0x00000006,0x00001c4a,0x000030e6,
22020x000000b0,0x000500ab,0x0000002f,0x00001c4b,
22030x00001c4a,0x000000a6,0x000600a9,0x00000027,
22040x000031a1,0x00001c4b,0x00001c31,0x00001c27,
22050x000500c7,0x00000006,0x00001c55,0x000030e6,
22060x00000170,0x000500ab,0x0000002f,0x00001c56,
22070x00001c55,0x000000a6,0x000600a9,0x00000027,
22080x000031a2,0x00001c56,0x00001c34,0x00001c2a,
22090x000500c7,0x00000006,0x00001c60,0x000030e6,
22100x0000010a,0x000500ab,0x0000002f,0x00001c61,
22110x00001c60,0x000000a6,0x000600a9,0x00000027,
22120x000031a3,0x00001c61,0x00001c37,0x00001c2d,
22130x00050041,0x00000028,0x00001c6b,0x00001b65,
22140x000000da,0x0004003d,0x00000027,0x00001c6c,
22150x00001c6b,0x00050085,0x00000027,0x00001c6f,
22160x00001c6c,0x000031a1,0x00050041,0x00000028,
22170x00001c70,0x00001b65,0x00000154,0x0004003d,
22180x00000027,0x00001c71,0x00001c70,0x00050085,
22190x00000027,0x00001c74,0x00001c71,0x000031a2,
22200x00050081,0x00000027,0x00001c75,0x00001c6f,
22210x00001c74,0x00050041,0x00000028,0x00001c76,
22220x00001b65,0x00000205,0x0004003d,0x00000027,
22230x00001c77,0x00001c76,0x00050085,0x00000027,
22240x00001c7a,0x00001c77,0x000031a3,0x00050081,
22250x00000027,0x00001c7b,0x00001c75,0x00001c7a,
22260x00050041,0x00000028,0x00001c7c,0x00001b65,
22270x0000020d,0x0004003d,0x00000027,0x00001c7d,
22280x00001c7c,0x00050081,0x00000027,0x00001c7e,
22290x00001c7b,0x00001c7d,0x00050041,0x00000028,
22300x00001c7f,0x00001b65,0x00000215,0x0004003d,
22310x00000027,0x00001c80,0x00001c7f,0x00050085,
22320x00000027,0x00001c83,0x00001c80,0x000031a1,
22330x00050041,0x00000028,0x00001c84,0x00001b65,
22340x0000021d,0x0004003d,0x00000027,0x00001c85,
22350x00001c84,0x00050085,0x00000027,0x00001c88,
22360x00001c85,0x000031a2,0x00050081,0x00000027,
22370x00001c89,0x00001c83,0x00001c88,0x00050041,
22380x00000028,0x00001c8a,0x00001b65,0x00000233,
22390x0004003d,0x00000027,0x00001c8b,0x00001c8a,
22400x00050085,0x00000027,0x00001c8e,0x00001c8b,
22410x000031a3,0x00050081,0x00000027,0x00001c8f,
22420x00001c89,0x00001c8e,0x00050041,0x00000028,
22430x00001c90,0x00001b65,0x000004d8,0x0004003d,
22440x00000027,0x00001c91,0x00001c90,0x00050081,
22450x00000027,0x00001c92,0x00001c8f,0x00001c91,
22460x00050041,0x00000028,0x00001c93,0x00001b65,
22470x00000308,0x0004003d,0x00000027,0x00001c94,
22480x00001c93,0x00050085,0x00000027,0x00001c97,
22490x00001c94,0x000031a1,0x00050041,0x00000028,
22500x00001c98,0x00001b65,0x00000250,0x0004003d,
22510x00000027,0x00001c99,0x00001c98,0x00050085,
22520x00000027,0x00001c9c,0x00001c99,0x000031a2,
22530x00050081,0x00000027,0x00001c9d,0x00001c97,
22540x00001c9c,0x00050041,0x00000028,0x00001c9e,
22550x00001b65,0x00000266,0x0004003d,0x00000027,
22560x00001c9f,0x00001c9e,0x00050085,0x00000027,
22570x00001ca2,0x00001c9f,0x000031a3,0x00050081,
22580x00000027,0x00001ca3,0x00001c9d,0x00001ca2,
22590x00050041,0x00000028,0x00001ca4,0x00001b65,
22600x0000027b,0x0004003d,0x00000027,0x00001ca5,
22610x00001ca4,0x00050081,0x00000027,0x00001ca6,
22620x00001ca3,0x00001ca5,0x00060050,0x0000004b,
22630x00001ca7,0x00001c7e,0x00001c92,0x00001ca6,
22640x0007000c,0x0000004b,0x00001caa,0x00000001,
22650x00000025,0x00003109,0x00001ca7,0x0007000c,
22660x0000004b,0x00001cad,0x00000001,0x00000028,
22670x0000311b,0x00001ca7,0x00050080,0x00000006,
22680x00001cb0,0x000030e6,0x00000154,0x000200f9,
22690x00001c44,0x000200f8,0x00001cb1,0x000200f9,
22700x00001cb2,0x000200f8,0x00001cb2,0x000700f5,
22710x0000004b,0x00003117,0x0000319b,0x00001c41,
22720x0000311b,0x00001cb1,0x000700f5,0x0000004b,
22730x00003105,0x00003199,0x00001c41,0x00003109,
22740x00001cb1,0x000200f9,0x00001cb3,0x000200f8,
22750x00001cb3,0x000700f5,0x0000004b,0x00003115,
22760x0000319b,0x00001e98,0x00003117,0x00001cb2,
22770x000700f5,0x0000004b,0x00003103,0x00003199,
22780x00001e98,0x00003105,0x00001cb2,0x000700f5,
22790x00000006,0x000030ef,0x00000380,0x00001e98,
22800x00001eb6,0x00001cb2,0x00050041,0x00000028,
22810x00001cb4,0x00001b65,0x000000da,0x0004003d,
22820x00000027,0x00001cb5,0x00001cb4,0x000500b4,
22830x0000002f,0x00001cb6,0x00001cb5,0x000004fc,
22840x000300f7,0x00001cbb,0x00000000,0x000400fa,
22850x00001cb6,0x00001cb7,0x00001cbb,0x000200f8,
22860x00001cb7,0x00050041,0x00000028,0x00001cb8,
22870x00001b65,0x00000154,0x0004003d,0x00000027,
22880x00001cb9,0x00001cb8,0x000500b4,0x0000002f,
22890x00001cba,0x00001cb9,0x0000026d,0x000200f9,
22900x00001cbb,0x000200f8,0x00001cbb,0x000700f5,
22910x0000002f,0x00001cbc,0x00001cb6,0x00001cb3,
22920x00001cba,0x00001cb7,0x000300f7,0x00001cc1,
22930x00000000,0x000400fa,0x00001cbc,0x00001cbd,
22940x00001cc1,0x000200f8,0x00001cbd,0x00050041,
22950x00000028,0x00001cbe,0x00001b65,0x00000205,
22960x0004003d,0x00000027,0x00001cbf,0x00001cbe,
22970x000500b4,0x0000002f,0x00001cc0,0x00001cbf,
22980x0000026d,0x000200f9,0x00001cc1,0x000200f8,
22990x00001cc1,0x000700f5,0x0000002f,0x00001cc2,
23000x00001cbc,0x00001cbb,0x00001cc0,0x00001cbd,
23010x000300f7,0x00001cc7,0x00000000,0x000400fa,
23020x00001cc2,0x00001cc3,0x00001cc7,0x000200f8,
23030x00001cc3,0x00050041,0x00000028,0x00001cc4,
23040x00001b65,0x00000215,0x0004003d,0x00000027,
23050x00001cc5,0x00001cc4,0x000500b4,0x0000002f,
23060x00001cc6,0x00001cc5,0x0000026d,0x000200f9,
23070x00001cc7,0x000200f8,0x00001cc7,0x000700f5,
23080x0000002f,0x00001cc8,0x00001cc2,0x00001cc1,
23090x00001cc6,0x00001cc3,0x000300f7,0x00001ccd,
23100x00000000,0x000400fa,0x00001cc8,0x00001cc9,
23110x00001ccd,0x000200f8,0x00001cc9,0x00050041,
23120x00000028,0x00001cca,0x00001b65,0x0000021d,
23130x0004003d,0x00000027,0x00001ccb,0x00001cca,
23140x000500b4,0x0000002f,0x00001ccc,0x00001ccb,
23150x000004fc,0x000200f9,0x00001ccd,0x000200f8,
23160x00001ccd,0x000700f5,0x0000002f,0x00001cce,
23170x00001cc8,0x00001cc7,0x00001ccc,0x00001cc9,
23180x000300f7,0x00001cd3,0x00000000,0x000400fa,
23190x00001cce,0x00001ccf,0x00001cd3,0x000200f8,
23200x00001ccf,0x00050041,0x00000028,0x00001cd0,
23210x00001b65,0x00000233,0x0004003d,0x00000027,
23220x00001cd1,0x00001cd0,0x000500b4,0x0000002f,
23230x00001cd2,0x00001cd1,0x0000026d,0x000200f9,
23240x00001cd3,0x000200f8,0x00001cd3,0x000700f5,
23250x0000002f,0x00001cd4,0x00001cce,0x00001ccd,
23260x00001cd2,0x00001ccf,0x000300f7,0x00001cd9,
23270x00000000,0x000400fa,0x00001cd4,0x00001cd5,
23280x00001cd9,0x000200f8,0x00001cd5,0x00050041,
23290x00000028,0x00001cd6,0x00001b65,0x00000308,
23300x0004003d,0x00000027,0x00001cd7,0x00001cd6,
23310x000500b4,0x0000002f,0x00001cd8,0x00001cd7,
23320x0000026d,0x000200f9,0x00001cd9,0x000200f8,
23330x00001cd9,0x000700f5,0x0000002f,0x00001cda,
23340x00001cd4,0x00001cd3,0x00001cd8,0x00001cd5,
23350x000300f7,0x00001cdf,0x00000000,0x000400fa,
23360x00001cda,0x00001cdb,0x00001cdf,0x000200f8,
23370x00001cdb,0x00050041,0x00000028,0x00001cdc,
23380x00001b65,0x00000250,0x0004003d,0x00000027,
23390x00001cdd,0x00001cdc,0x000500b4,0x0000002f,
23400x00001cde,0x00001cdd,0x0000026d,0x000200f9,
23410x00001cdf,0x000200f8,0x00001cdf,0x000700f5,
23420x0000002f,0x00001ce0,0x00001cda,0x00001cd9,
23430x00001cde,0x00001cdb,0x000300f7,0x00001ce5,
23440x00000000,0x000400fa,0x00001ce0,0x00001ce1,
23450x00001ce5,0x000200f8,0x00001ce1,0x00050041,
23460x00000028,0x00001ce2,0x00001b65,0x00000266,
23470x0004003d,0x00000027,0x00001ce3,0x00001ce2,
23480x000500b4,0x0000002f,0x00001ce4,0x00001ce3,
23490x000004fc,0x000200f9,0x00001ce5,0x000200f8,
23500x00001ce5,0x000700f5,0x0000002f,0x00001ce6,
23510x00001ce0,0x00001cdf,0x00001ce4,0x00001ce1,
23520x00050080,0x00000006,0x00001ce8,0x00001bf7,
23530x0000037e,0x000500c7,0x00000006,0x00001cea,
23540x000030ef,0x00000531,0x000600a9,0x00000006,
23550x00001cec,0x00001ce6,0x00000130,0x000000a6,
23560x000500c5,0x00000006,0x00001ced,0x00001cea,
23570x00001cec,0x00050095,0x000000ab,0x00001fc4,
23580x00001e64,0x00001ce8,0x00050051,0x00000006,
23590x00001fc5,0x00001fc4,0x00000001,0x00050051,
23600x00000006,0x00001fc6,0x00001fc4,0x00000000,
23610x00050080,0x00000006,0x00001fcb,0x00001e6b,
23620x00001fc5,0x00050050,0x00000007,0x00001fcc,
23630x00001fc6,0x00001fcb,0x0004007c,0x00000014,
23640x00001fbc,0x00001fcc,0x00060041,0x000000db,
23650x00001fb4,0x00001fbc,0x000000da,0x000000da,
23660x0005003e,0x00001fb4,0x00001ced,0x00000002,
23670x00000004,0x00050080,0x00000006,0x00001cf2,
23680x00001bf7,0x00000388,0x000500c2,0x00000006,
23690x00001cf5,0x00001dec,0x00000308,0x000500c4,
23700x00000006,0x00001cf8,0x00001e0d,0x0000047e,
23710x000500c5,0x00000006,0x00001cf9,0x00001cf5,
23720x00001cf8,0x00050095,0x000000ab,0x00001fe4,
23730x00001e64,0x00001cf2,0x00050051,0x00000006,
23740x00001fe5,0x00001fe4,0x00000001,0x00050051,
23750x00000006,0x00001fe6,0x00001fe4,0x00000000,
23760x00050080,0x00000006,0x00001feb,0x00001e6b,
23770x00001fe5,0x00050050,0x00000007,0x00001fec,
23780x00001fe6,0x00001feb,0x0004007c,0x00000014,
23790x00001fdc,0x00001fec,0x00060041,0x000000db,
23800x00001fd4,0x00001fdc,0x000000da,0x000000da,
23810x0005003e,0x00001fd4,0x00001cf9,0x00000002,
23820x00000004,0x0004003d,0x00000027,0x00001cfe,
23830x00001cb4,0x00050041,0x00000028,0x00001cff,
23840x00001b65,0x00000215,0x0004003d,0x00000027,
23850x00001d00,0x00001cff,0x00050041,0x00000028,
23860x00001d01,0x00001b65,0x00000308,0x0004003d,
23870x00000027,0x00001d02,0x00001d01,0x00050041,
23880x00000028,0x00001d03,0x00001b65,0x00000154,
23890x0004003d,0x00000027,0x00001d04,0x00001d03,
23900x00050041,0x00000028,0x00001d05,0x00001b65,
23910x0000021d,0x0004003d,0x00000027,0x00001d06,
23920x00001d05,0x00050041,0x00000028,0x00001d07,
23930x00001b65,0x00000250,0x0004003d,0x00000027,
23940x00001d08,0x00001d07,0x00050041,0x00000028,
23950x00001d09,0x00001b65,0x00000205,0x0004003d,
23960x00000027,0x00001d0a,0x00001d09,0x00050041,
23970x00000028,0x00001d0b,0x00001b65,0x00000233,
23980x0004003d,0x00000027,0x00001d0c,0x00001d0b,
23990x00050041,0x00000028,0x00001d0d,0x00001b65,
24000x00000266,0x0004003d,0x00000027,0x00001d0e,
24010x00001d0d,0x00060050,0x0000004b,0x00001d0f,
24020x00001cfe,0x00001d00,0x00001d02,0x00060050,
24030x0000004b,0x00001d10,0x00001d04,0x00001d06,
24040x00001d08,0x00060050,0x0000004b,0x00001d11,
24050x00001d0a,0x00001d0c,0x00001d0e,0x00060050,
24060x0000054b,0x00001d12,0x00001d0f,0x00001d10,
24070x00001d11,0x0006000c,0x00000027,0x00001d14,
24080x00000001,0x00000021,0x00001d12,0x000500b7,
24090x0000002f,0x00001d16,0x00001d14,0x0000026d,
24100x000300f7,0x00001d1b,0x00000000,0x000400fa,
24110x00001d16,0x00001d17,0x00001d1a,0x000200f8,
24120x00001d17,0x0006000c,0x0000054b,0x00001d19,
24130x00000001,0x00000022,0x00001d12,0x000200f9,
24140x00001d1b,0x000200f8,0x00001d1a,0x000200f9,
24150x00001d1b,0x000200f8,0x00001d1b,0x000700f5,
24160x0000054b,0x000030f6,0x00001d19,0x00001d17,
24170x00000571,0x00001d1a,0x0003003e,0x00001ba6,
24180x000030f6,0x00050041,0x00000028,0x00001d1d,
24190x00001b65,0x0000020d,0x0004003d,0x00000027,
24200x00001d1e,0x00001d1d,0x00050041,0x00000028,
24210x00001d1f,0x00001b65,0x000004d8,0x0004003d,
24220x00000027,0x00001d20,0x00001d1f,0x00050041,
24230x00000028,0x00001d21,0x00001b65,0x0000027b,
24240x0004003d,0x00000027,0x00001d22,0x00001d21,
24250x00060050,0x0000004b,0x00001d23,0x00001d1e,
24260x00001d20,0x00001d22,0x00050091,0x0000004b,
24270x00001d26,0x000030f6,0x00001d23,0x0004007f,
24280x0000004b,0x00001d27,0x00001d26,0x0003003e,
24290x00001ba9,0x00001d27,0x000200f9,0x00001d28,
24300x000200f8,0x00001d28,0x000700f5,0x00000006,
24310x000030f7,0x000000a6,0x00001d1b,0x00001d5b,
24320x00001d2c,0x000500b0,0x0000002f,0x00001d2b,
24330x000030f7,0x000002b7,0x000400f6,0x00001d5c,
24340x00001d2c,0x00000000,0x000400fa,0x00001d2b,
24350x00001d2c,0x00001d5c,0x000200f8,0x00001d2c,
24360x00050080,0x00000006,0x00001d2e,0x00001bf7,
24370x00000107,0x00050084,0x00000006,0x00001d30,
24380x0000011f,0x000030f7,0x00050080,0x00000006,
24390x00001d31,0x00001d2e,0x00001d30,0x00060041,
24400x00000028,0x00001d35,0x00001ba6,0x000000da,
24410x000030f7,0x0004003d,0x00000027,0x00001d36,
24420x00001d35,0x0004007c,0x00000006,0x00001ff2,
24430x00001d36,0x00050095,0x000000ab,0x0000200d,
24440x00001e64,0x00001d31,0x00050051,0x00000006,
24450x0000200e,0x0000200d,0x00000001,0x00050051,
24460x00000006,0x0000200f,0x0000200d,0x00000000,
24470x00050080,0x00000006,0x00002014,0x00001e6b,
24480x0000200e,0x00050050,0x00000007,0x00002015,
24490x0000200f,0x00002014,0x0004007c,0x00000014,
24500x00002005,0x00002015,0x00060041,0x000000db,
24510x00001ffd,0x00002005,0x000000da,0x000000da,
24520x0005003e,0x00001ffd,0x00001ff2,0x00000002,
24530x00000004,0x00050080,0x00000006,0x00001d39,
24540x00001bf7,0x00000597,0x00050080,0x00000006,
24550x00001d3c,0x00001d39,0x00001d30,0x00060041,
24560x00000028,0x00001d40,0x00001ba6,0x00000154,
24570x000030f7,0x0004003d,0x00000027,0x00001d41,
24580x00001d40,0x0004007c,0x00000006,0x0000201b,
24590x00001d41,0x00050095,0x000000ab,0x00002036,
24600x00001e64,0x00001d3c,0x00050051,0x00000006,
24610x00002037,0x00002036,0x00000001,0x00050051,
24620x00000006,0x00002038,0x00002036,0x00000000,
24630x00050080,0x00000006,0x0000203d,0x00001e6b,
24640x00002037,0x00050050,0x00000007,0x0000203e,
24650x00002038,0x0000203d,0x0004007c,0x00000014,
24660x0000202e,0x0000203e,0x00060041,0x000000db,
24670x00002026,0x0000202e,0x000000da,0x000000da,
24680x0005003e,0x00002026,0x0000201b,0x00000002,
24690x00000004,0x00050080,0x00000006,0x00001d44,
24700x00001bf7,0x000005a6,0x00050080,0x00000006,
24710x00001d47,0x00001d44,0x00001d30,0x00060041,
24720x00000028,0x00001d4b,0x00001ba6,0x00000205,
24730x000030f7,0x0004003d,0x00000027,0x00001d4c,
24740x00001d4b,0x0004007c,0x00000006,0x00002044,
24750x00001d4c,0x00050095,0x000000ab,0x0000205f,
24760x00001e64,0x00001d47,0x00050051,0x00000006,
24770x00002060,0x0000205f,0x00000001,0x00050051,
24780x00000006,0x00002061,0x0000205f,0x00000000,
24790x00050080,0x00000006,0x00002066,0x00001e6b,
24800x00002060,0x00050050,0x00000007,0x00002067,
24810x00002061,0x00002066,0x0004007c,0x00000014,
24820x00002057,0x00002067,0x00060041,0x000000db,
24830x0000204f,0x00002057,0x000000da,0x000000da,
24840x0005003e,0x0000204f,0x00002044,0x00000002,
24850x00000004,0x00050080,0x00000006,0x00001d4f,
24860x00001bf7,0x000005b5,0x00050080,0x00000006,
24870x00001d52,0x00001d4f,0x00001d30,0x00050041,
24880x00000028,0x00001d56,0x00001ba9,0x000030f7,
24890x0004003d,0x00000027,0x00001d57,0x00001d56,
24900x0004007c,0x00000006,0x0000206d,0x00001d57,
24910x00050095,0x000000ab,0x00002088,0x00001e64,
24920x00001d52,0x00050051,0x00000006,0x00002089,
24930x00002088,0x00000001,0x00050051,0x00000006,
24940x0000208a,0x00002088,0x00000000,0x00050080,
24950x00000006,0x0000208f,0x00001e6b,0x00002089,
24960x00050050,0x00000007,0x00002090,0x0000208a,
24970x0000208f,0x0004007c,0x00000014,0x00002080,
24980x00002090,0x00060041,0x000000db,0x00002078,
24990x00002080,0x000000da,0x000000da,0x0005003e,
25000x00002078,0x0000206d,0x00000002,0x00000004,
25010x00050080,0x00000006,0x00001d5b,0x000030f7,
25020x00000154,0x000200f9,0x00001d28,0x000200f8,
25030x00001d5c,0x00050080,0x00000006,0x00001d5e,
25040x00001bf7,0x000005c6,0x00050095,0x000000ab,
25050x000020a8,0x00001e64,0x00001d5e,0x00050051,
25060x00000006,0x000020a9,0x000020a8,0x00000001,
25070x00050051,0x00000006,0x000020aa,0x000020a8,
25080x00000000,0x00050080,0x00000006,0x000020af,
25090x00001e6b,0x000020a9,0x00050050,0x00000007,
25100x000020b0,0x000020aa,0x000020af,0x0004007c,
25110x00000014,0x000020a0,0x000020b0,0x00060041,
25120x000000db,0x00002098,0x000020a0,0x000000da,
25130x000000da,0x0005003e,0x00002098,0x00000b11,
23990x00000002,0x00000004,0x00050080,0x00000006, 25140x00000002,0x00000004,0x00050080,0x00000006,
24000x00001e6b,0x00001e47,0x00000186,0x00050051, 25150x00001d64,0x00001bf7,0x000005d0,0x00050095,
24010x00000027,0x00001e6f,0x00002b70,0x00000002, 25160x000000ab,0x000020c8,0x00001e64,0x00001d64,
24020x0004007c,0x00000006,0x00001f56,0x00001e6f, 25170x00050051,0x00000006,0x000020c9,0x000020c8,
24030x00050095,0x000000a8,0x00001f71,0x00001ea2, 25180x00000001,0x00050051,0x00000006,0x000020ca,
24040x00001e6b,0x00050051,0x00000006,0x00001f72, 25190x000020c8,0x00000000,0x00050080,0x00000006,
24050x00001f71,0x00000001,0x00050051,0x00000006, 25200x000020cf,0x00001e6b,0x000020c9,0x00050050,
24060x00001f73,0x00001f71,0x00000000,0x00050080, 25210x00000007,0x000020d0,0x000020ca,0x000020cf,
24070x00000006,0x00001f78,0x00001ea9,0x00001f72, 25220x0004007c,0x00000014,0x000020c0,0x000020d0,
24080x00050050,0x00000007,0x00001f79,0x00001f73, 25230x00060041,0x000000db,0x000020b8,0x000020c0,
24090x00001f78,0x0004007c,0x00000014,0x00001f69, 25240x000000da,0x000000da,0x0005003e,0x000020b8,
24100x00001f79,0x00060041,0x000000d8,0x00001f61, 25250x00000380,0x00000002,0x00000004,0x00050080,
24110x00001f69,0x000000d7,0x000000d7,0x0005003e, 25260x00000006,0x00001d69,0x00001bf7,0x000005d9,
24120x00001f61,0x00001f56,0x00000002,0x00000004, 25270x00050095,0x000000ab,0x000020e8,0x00001e64,
24130x000300f7,0x00001fb9,0x00000000,0x000300fb, 25280x00001d69,0x00050051,0x00000006,0x000020e9,
24140x000000a3,0x00001f88,0x000200f8,0x00001f88, 25290x000020e8,0x00000001,0x00050051,0x00000006,
24150x000500bc,0x0000002f,0x00001fc0,0x00001e4c, 25300x000020ea,0x000020e8,0x00000000,0x00050080,
24160x00001e61,0x000300f7,0x00001fc7,0x00000000, 25310x00000006,0x000020ef,0x00001e6b,0x000020e9,
24170x000400fa,0x00001fc0,0x00001fc1,0x00001fc7, 25320x00050050,0x00000007,0x000020f0,0x000020ea,
24180x000200f8,0x00001fc1,0x000500bc,0x0000002f, 25330x000020ef,0x0004007c,0x00000014,0x000020e0,
24190x00001fc6,0x00001e53,0x00001e68,0x000200f9, 25340x000020f0,0x00060041,0x000000db,0x000020d8,
24200x00001fc7,0x000200f8,0x00001fc7,0x000700f5, 25350x000020e0,0x000000da,0x000000da,0x0005003e,
24210x0000002f,0x00001fc8,0x00001fc0,0x00001f88, 25360x000020d8,0x000000a6,0x00000002,0x00000004,
24220x00001fc6,0x00001fc1,0x000300f7,0x00001fcf, 25370x00050080,0x00000006,0x00001d6e,0x00001bf7,
24230x00000000,0x000400fa,0x00001fc8,0x00001fc9, 25380x000005e2,0x00050095,0x000000ab,0x00002108,
24240x00001fcf,0x000200f8,0x00001fc9,0x000500bc, 25390x00001e64,0x00001d6e,0x00050051,0x00000006,
24250x0000002f,0x00001fce,0x00001e5a,0x00001e6f, 25400x00002109,0x00002108,0x00000001,0x00050051,
24260x000200f9,0x00001fcf,0x000200f8,0x00001fcf, 25410x00000006,0x0000210a,0x00002108,0x00000000,
24270x000700f5,0x0000002f,0x00001fd0,0x00001fc8, 25420x00050080,0x00000006,0x0000210f,0x00001e6b,
24280x00001fc7,0x00001fce,0x00001fc9,0x000400a8, 25430x00002109,0x00050050,0x00000007,0x00002110,
24290x0000002f,0x00001fd1,0x00001fd0,0x000300f7, 25440x0000210a,0x0000210f,0x0004007c,0x00000014,
24300x00001f8d,0x00000000,0x000400fa,0x00001fd1, 25450x00002100,0x00002110,0x00060041,0x000000db,
24310x00001f8c,0x00001f8d,0x000200f8,0x00001f8c, 25460x000020f8,0x00002100,0x000000da,0x000000da,
24320x000200f9,0x00001fb9,0x000200f8,0x00001f8d, 25470x0005003e,0x000020f8,0x000000a6,0x00000002,
24330x00050081,0x0000004b,0x00001f90,0x00002b72, 25480x00000004,0x000500b4,0x0000002f,0x00001d73,
24340x00002b70,0x0005008e,0x0000004b,0x00001f91, 25490x00001d14,0x0000026d,0x00060050,0x00000395,
24350x00001f90,0x000001ea,0x00050095,0x000000a8, 25500x000031a4,0x00001d73,0x00001d73,0x00001d73,
24360x00001fe1,0x00001ea2,0x000000a3,0x00050051, 25510x000600a9,0x0000004b,0x000031a5,0x000031a4,
24370x00000006,0x00001fe2,0x00001fe1,0x00000001, 25520x0000319b,0x00003115,0x000600a9,0x0000004b,
24380x00050051,0x00000006,0x00001fe3,0x00001fe1, 25530x000031a7,0x000031a4,0x00003199,0x00003103,
24390x00000000,0x00050080,0x00000006,0x00001fe8, 25540x00050041,0x000000fe,0x0000215a,0x000000fc,
24400x00001ea9,0x00001fe2,0x00050050,0x00000007, 25550x000000fd,0x0004003d,0x00000006,0x0000215b,
24410x00001fe9,0x00001fe3,0x00001fe8,0x0004007c, 25560x0000215a,0x00050084,0x00000006,0x0000215c,
24420x00000014,0x00001fd9,0x00001fe9,0x00060041, 25570x0000011f,0x0000215b,0x00050080,0x00000006,
24430x000000d8,0x00001f96,0x00001fd9,0x000000d7, 25580x0000215d,0x00000107,0x0000215c,0x00050080,
24440x000000d7,0x00050051,0x00000027,0x00001f98, 25590x00000006,0x00002163,0x0000215b,0x0000319c,
24450x00001f91,0x00000000,0x0004007c,0x00000006, 25600x00050086,0x00000006,0x00002164,0x00002163,
24460x00001fef,0x00001f98,0x000500c7,0x00000006, 25610x00000101,0x00050084,0x00000006,0x00002156,
24470x00001ff1,0x00001fef,0x0000012d,0x000500ab, 25620x00000107,0x00002164,0x00050080,0x00000006,
24480x0000002f,0x00001ff2,0x00001ff1,0x000000a3, 25630x00002157,0x0000215d,0x00002156,0x00050084,
24490x000300f7,0x00001ff9,0x00000000,0x000400fa, 25640x00000006,0x00002127,0x00000150,0x00000b11,
24500x00001ff2,0x00001ff3,0x00001ff6,0x000200f8, 25650x00050080,0x00000006,0x00002128,0x00002157,
24510x00001ff3,0x000400c8,0x00000006,0x00001ff5, 25660x00002127,0x00050041,0x00000156,0x00002129,
24520x00001fef,0x000200f9,0x00001ff9,0x000200f8, 25670x000000fc,0x00000154,0x0004003d,0x00000007,
24530x00001ff6,0x000500c5,0x00000006,0x00001ff8, 25680x0000212a,0x00002129,0x00050051,0x00000027,
24540x00001fef,0x0000012d,0x000200f9,0x00001ff9, 25690x0000212d,0x000031a7,0x00000000,0x0004007c,
24550x000200f8,0x00001ff9,0x000700f5,0x00000006, 25700x00000006,0x0000216a,0x0000212d,0x00050051,
24560x00002b0c,0x00001ff5,0x00001ff3,0x00001ff8, 25710x00000006,0x00002183,0x0000212a,0x00000000,
24570x00001ff6,0x000700ed,0x00000006,0x00001f9a, 25720x00050095,0x000000ab,0x00002185,0x00002183,
24580x00001f96,0x000000ad,0x000000a3,0x00002b0c, 25730x00002128,0x00050051,0x00000006,0x00002186,
24590x00060041,0x000000d8,0x00001f9c,0x00001fd9, 25740x00002185,0x00000001,0x00050051,0x00000006,
24600x000000d7,0x00000151,0x00050051,0x00000027, 25750x00002187,0x00002185,0x00000000,0x00050051,
24610x00001f9e,0x00001f91,0x00000001,0x0004007c, 25760x00000006,0x0000218a,0x0000212a,0x00000001,
24620x00000006,0x00002000,0x00001f9e,0x000500c7, 25770x00050080,0x00000006,0x0000218c,0x0000218a,
24630x00000006,0x00002002,0x00002000,0x0000012d, 25780x00002186,0x00050050,0x00000007,0x0000218d,
24640x000500ab,0x0000002f,0x00002003,0x00002002, 25790x00002187,0x0000218c,0x0004007c,0x00000014,
24650x000000a3,0x000300f7,0x0000200a,0x00000000, 25800x0000217d,0x0000218d,0x00060041,0x000000db,
24660x000400fa,0x00002003,0x00002004,0x00002007, 25810x00002175,0x0000217d,0x000000da,0x000000da,
24670x000200f8,0x00002004,0x000400c8,0x00000006, 25820x0005003e,0x00002175,0x0000216a,0x00000002,
24680x00002006,0x00002000,0x000200f9,0x0000200a, 25830x00000004,0x00050080,0x00000006,0x00002130,
24690x000200f8,0x00002007,0x000500c5,0x00000006, 25840x00002128,0x0000010a,0x00050051,0x00000027,
24700x00002009,0x00002000,0x0000012d,0x000200f9, 25850x00002134,0x000031a7,0x00000001,0x0004007c,
24710x0000200a,0x000200f8,0x0000200a,0x000700f5, 25860x00000006,0x00002193,0x00002134,0x00050095,
24720x00000006,0x00002b0d,0x00002006,0x00002004, 25870x000000ab,0x000021ae,0x00002183,0x00002130,
24730x00002009,0x00002007,0x000700ed,0x00000006, 25880x00050051,0x00000006,0x000021af,0x000021ae,
24740x00001fa0,0x00001f9c,0x000000ad,0x000000a3, 25890x00000001,0x00050051,0x00000006,0x000021b0,
24750x00002b0d,0x00060041,0x000000d8,0x00001fa2, 25900x000021ae,0x00000000,0x00050080,0x00000006,
24760x00001fd9,0x000000d7,0x00000202,0x00050051, 25910x000021b5,0x0000218a,0x000021af,0x00050050,
24770x00000027,0x00001fa4,0x00001f91,0x00000002, 25920x00000007,0x000021b6,0x000021b0,0x000021b5,
24780x0004007c,0x00000006,0x00002011,0x00001fa4, 25930x0004007c,0x00000014,0x000021a6,0x000021b6,
24790x000500c7,0x00000006,0x00002013,0x00002011, 25940x00060041,0x000000db,0x0000219e,0x000021a6,
24800x0000012d,0x000500ab,0x0000002f,0x00002014, 25950x000000da,0x000000da,0x0005003e,0x0000219e,
24810x00002013,0x000000a3,0x000300f7,0x0000201b, 25960x00002193,0x00000002,0x00000004,0x00050080,
24820x00000000,0x000400fa,0x00002014,0x00002015, 25970x00000006,0x00002137,0x00002128,0x00000111,
24830x00002018,0x000200f8,0x00002015,0x000400c8, 25980x00050051,0x00000027,0x0000213b,0x000031a7,
24840x00000006,0x00002017,0x00002011,0x000200f9, 25990x00000002,0x0004007c,0x00000006,0x000021bc,
24850x0000201b,0x000200f8,0x00002018,0x000500c5, 26000x0000213b,0x00050095,0x000000ab,0x000021d7,
24860x00000006,0x0000201a,0x00002011,0x0000012d, 26010x00002183,0x00002137,0x00050051,0x00000006,
24870x000200f9,0x0000201b,0x000200f8,0x0000201b, 26020x000021d8,0x000021d7,0x00000001,0x00050051,
24880x000700f5,0x00000006,0x00002b0e,0x00002017, 26030x00000006,0x000021d9,0x000021d7,0x00000000,
24890x00002015,0x0000201a,0x00002018,0x000700ed, 26040x00050080,0x00000006,0x000021de,0x0000218a,
24900x00000006,0x00001fa6,0x00001fa2,0x000000ad, 26050x000021d8,0x00050050,0x00000007,0x000021df,
24910x000000a3,0x00002b0e,0x00060041,0x000000d8, 26060x000021d9,0x000021de,0x0004007c,0x00000014,
24920x00001fa8,0x00001fd9,0x000000d7,0x0000020a, 26070x000021cf,0x000021df,0x00060041,0x000000db,
24930x000300f7,0x0000202c,0x00000000,0x000400fa, 26080x000021c7,0x000021cf,0x000000da,0x000000da,
24940x00001ff2,0x00002026,0x00002029,0x000200f8, 26090x0005003e,0x000021c7,0x000021bc,0x00000002,
24950x00002026,0x000400c8,0x00000006,0x00002028, 26100x00000004,0x00050080,0x00000006,0x0000213e,
24960x00001fef,0x000200f9,0x0000202c,0x000200f8, 26110x00002128,0x00000118,0x00050051,0x00000027,
24970x00002029,0x000500c5,0x00000006,0x0000202b, 26120x00002142,0x000031a5,0x00000000,0x0004007c,
24980x00001fef,0x0000012d,0x000200f9,0x0000202c, 26130x00000006,0x000021e5,0x00002142,0x00050095,
24990x000200f8,0x0000202c,0x000700f5,0x00000006, 26140x000000ab,0x00002200,0x00002183,0x0000213e,
25000x00002b0f,0x00002028,0x00002026,0x0000202b, 26150x00050051,0x00000006,0x00002201,0x00002200,
25010x00002029,0x000700ef,0x00000006,0x00001fac, 26160x00000001,0x00050051,0x00000006,0x00002202,
25020x00001fa8,0x000000ad,0x000000a3,0x00002b0f, 26170x00002200,0x00000000,0x00050080,0x00000006,
25030x00060041,0x000000d8,0x00001fae,0x00001fd9, 26180x00002207,0x0000218a,0x00002201,0x00050050,
25040x000000d7,0x00000212,0x000300f7,0x0000203d, 26190x00000007,0x00002208,0x00002202,0x00002207,
25050x00000000,0x000400fa,0x00002003,0x00002037, 26200x0004007c,0x00000014,0x000021f8,0x00002208,
25060x0000203a,0x000200f8,0x00002037,0x000400c8, 26210x00060041,0x000000db,0x000021f0,0x000021f8,
25070x00000006,0x00002039,0x00002000,0x000200f9, 26220x000000da,0x000000da,0x0005003e,0x000021f0,
25080x0000203d,0x000200f8,0x0000203a,0x000500c5, 26230x000021e5,0x00000002,0x00000004,0x00050080,
25090x00000006,0x0000203c,0x00002000,0x0000012d, 26240x00000006,0x00002145,0x00002128,0x0000011f,
25100x000200f9,0x0000203d,0x000200f8,0x0000203d, 26250x00050051,0x00000027,0x00002149,0x000031a5,
25110x000700f5,0x00000006,0x00002b10,0x00002039, 26260x00000001,0x0004007c,0x00000006,0x0000220e,
25120x00002037,0x0000203c,0x0000203a,0x000700ef, 26270x00002149,0x00050095,0x000000ab,0x00002229,
25130x00000006,0x00001fb2,0x00001fae,0x000000ad, 26280x00002183,0x00002145,0x00050051,0x00000006,
25140x000000a3,0x00002b10,0x00060041,0x000000d8, 26290x0000222a,0x00002229,0x00000001,0x00050051,
25150x00001fb4,0x00001fd9,0x000000d7,0x0000021a, 26300x00000006,0x0000222b,0x00002229,0x00000000,
25160x000300f7,0x0000204e,0x00000000,0x000400fa, 26310x00050080,0x00000006,0x00002230,0x0000218a,
25170x00002014,0x00002048,0x0000204b,0x000200f8, 26320x0000222a,0x00050050,0x00000007,0x00002231,
25180x00002048,0x000400c8,0x00000006,0x0000204a, 26330x0000222b,0x00002230,0x0004007c,0x00000014,
25190x00002011,0x000200f9,0x0000204e,0x000200f8, 26340x00002221,0x00002231,0x00060041,0x000000db,
25200x0000204b,0x000500c5,0x00000006,0x0000204d, 26350x00002219,0x00002221,0x000000da,0x000000da,
25210x00002011,0x0000012d,0x000200f9,0x0000204e, 26360x0005003e,0x00002219,0x0000220e,0x00000002,
25220x000200f8,0x0000204e,0x000700f5,0x00000006, 26370x00000004,0x00050080,0x00000006,0x0000214c,
25230x00002b11,0x0000204a,0x00002048,0x0000204d, 26380x00002128,0x00000189,0x00050051,0x00000027,
25240x0000204b,0x000700ef,0x00000006,0x00001fb8, 26390x00002150,0x000031a5,0x00000002,0x0004007c,
25250x00001fb4,0x000000ad,0x000000a3,0x00002b11, 26400x00000006,0x00002237,0x00002150,0x00050095,
25260x000200f9,0x00001fb9,0x000200f8,0x00001fb9, 26410x000000ab,0x00002252,0x00002183,0x0000214c,
25270x000200f9,0x00000a56,0x000200f8,0x00000a5a, 26420x00050051,0x00000006,0x00002253,0x00002252,
25280x000500aa,0x0000002f,0x00000a5d,0x000009eb, 26430x00000001,0x00050051,0x00000006,0x00002254,
25290x000002b4,0x000300f7,0x00000a5f,0x00000000, 26440x00002252,0x00000000,0x00050080,0x00000006,
25300x000400fa,0x00000a5d,0x00000a5e,0x00000a63, 26450x00002259,0x0000218a,0x00002253,0x00050050,
25310x000200f8,0x00000a5e,0x00050041,0x000000fb, 26460x00000007,0x0000225a,0x00002254,0x00002259,
25320x00002103,0x000000f9,0x000000fa,0x0004003d, 26470x0004007c,0x00000014,0x0000224a,0x0000225a,
25330x00000006,0x00002104,0x00002103,0x00050084, 26480x00060041,0x000000db,0x00002242,0x0000224a,
25340x00000006,0x00002105,0x0000011c,0x00002104, 26490x000000da,0x000000da,0x0005003e,0x00002242,
25350x00050080,0x00000006,0x00002106,0x00000104, 26500x00002237,0x00000002,0x00000004,0x000300f7,
25360x00002105,0x00050080,0x00000006,0x0000210c, 26510x0000229a,0x00000000,0x000300fb,0x000000a6,
25370x00002104,0x00002b67,0x00050086,0x00000006, 26520x00002269,0x000200f8,0x00002269,0x000500bc,
25380x0000210d,0x0000210c,0x000000fe,0x00050084, 26530x0000002f,0x000022a1,0x0000212d,0x00002142,
25390x00000006,0x000020ff,0x00000104,0x0000210d, 26540x000300f7,0x000022a8,0x00000000,0x000400fa,
25400x00050080,0x00000006,0x00002100,0x00002106, 26550x000022a1,0x000022a2,0x000022a8,0x000200f8,
25410x000020ff,0x00050084,0x00000006,0x000020d4, 26560x000022a2,0x000500bc,0x0000002f,0x000022a7,
25420x0000014d,0x000009e9,0x00050080,0x00000006, 26570x00002134,0x00002149,0x000200f9,0x000022a8,
25430x000020d5,0x00002100,0x000020d4,0x00050041, 26580x000200f8,0x000022a8,0x000700f5,0x0000002f,
25440x00000153,0x000020d6,0x000000f9,0x00000151, 26590x000022a9,0x000022a1,0x00002269,0x000022a7,
25450x0004003d,0x00000007,0x000020d7,0x000020d6, 26600x000022a2,0x000300f7,0x000022b0,0x00000000,
25460x00050051,0x00000006,0x00002124,0x000020d7, 26610x000400fa,0x000022a9,0x000022aa,0x000022b0,
25470x00000000,0x00050095,0x000000a8,0x00002126, 26620x000200f8,0x000022aa,0x000500bc,0x0000002f,
25480x00002124,0x000020d5,0x00050051,0x00000006, 26630x000022af,0x0000213b,0x00002150,0x000200f9,
25490x00002127,0x00002126,0x00000001,0x00050051, 26640x000022b0,0x000200f8,0x000022b0,0x000700f5,
25500x00000006,0x00002128,0x00002126,0x00000000, 26650x0000002f,0x000022b1,0x000022a9,0x000022a8,
25510x00050051,0x00000006,0x0000212b,0x000020d7, 26660x000022af,0x000022aa,0x000400a8,0x0000002f,
25520x00000001,0x00050080,0x00000006,0x0000212d, 26670x000022b2,0x000022b1,0x000300f7,0x0000226e,
25530x0000212b,0x00002127,0x00050050,0x00000007, 26680x00000000,0x000400fa,0x000022b2,0x0000226d,
25540x0000212e,0x00002128,0x0000212d,0x0004007c, 26690x0000226e,0x000200f8,0x0000226d,0x000200f9,
25550x00000014,0x0000211e,0x0000212e,0x00060041, 26700x0000229a,0x000200f8,0x0000226e,0x00050081,
25560x000000d8,0x00002115,0x0000211e,0x000000d7, 26710x0000004b,0x00002271,0x000031a7,0x000031a5,
25570x000000d7,0x0006003d,0x00000006,0x00002116, 26720x0005008e,0x0000004b,0x00002272,0x00002271,
25580x00002115,0x00000002,0x00000004,0x0004007c, 26730x000001ed,0x00050095,0x000000ab,0x000022c2,
25590x00000027,0x000020da,0x00002116,0x00050080, 26740x00002183,0x000000a6,0x00050051,0x00000006,
25600x00000006,0x000020dc,0x000020d5,0x00000107, 26750x000022c3,0x000022c2,0x00000001,0x00050051,
25610x00050095,0x000000a8,0x00002147,0x00002124, 26760x00000006,0x000022c4,0x000022c2,0x00000000,
25620x000020dc,0x00050051,0x00000006,0x00002148, 26770x00050080,0x00000006,0x000022c9,0x0000218a,
25630x00002147,0x00000001,0x00050051,0x00000006, 26780x000022c3,0x00050050,0x00000007,0x000022ca,
25640x00002149,0x00002147,0x00000000,0x00050080, 26790x000022c4,0x000022c9,0x0004007c,0x00000014,
25650x00000006,0x0000214e,0x0000212b,0x00002148, 26800x000022ba,0x000022ca,0x00060041,0x000000db,
25660x00050050,0x00000007,0x0000214f,0x00002149, 26810x00002277,0x000022ba,0x000000da,0x000000da,
25670x0000214e,0x0004007c,0x00000014,0x0000213f, 26820x00050051,0x00000027,0x00002279,0x00002272,
25680x0000214f,0x00060041,0x000000d8,0x00002136, 26830x00000000,0x0004007c,0x00000006,0x000022d0,
25690x0000213f,0x000000d7,0x000000d7,0x0006003d, 26840x00002279,0x000500c7,0x00000006,0x000022d2,
25700x00000006,0x00002137,0x00002136,0x00000002, 26850x000022d0,0x00000130,0x000500ab,0x0000002f,
25710x00000004,0x0004007c,0x00000027,0x000020e0, 26860x000022d3,0x000022d2,0x000000a6,0x000300f7,
25720x00002137,0x00050080,0x00000006,0x000020e2, 26870x000022da,0x00000000,0x000400fa,0x000022d3,
25730x000020d5,0x0000010e,0x00050095,0x000000a8, 26880x000022d4,0x000022d7,0x000200f8,0x000022d4,
25740x00002168,0x00002124,0x000020e2,0x00050051, 26890x000400c8,0x00000006,0x000022d6,0x000022d0,
25750x00000006,0x00002169,0x00002168,0x00000001, 26900x000200f9,0x000022da,0x000200f8,0x000022d7,
25760x00050051,0x00000006,0x0000216a,0x00002168, 26910x000500c5,0x00000006,0x000022d9,0x000022d0,
25770x00000000,0x00050080,0x00000006,0x0000216f, 26920x00000130,0x000200f9,0x000022da,0x000200f8,
25780x0000212b,0x00002169,0x00050050,0x00000007, 26930x000022da,0x000700f5,0x00000006,0x0000311c,
25790x00002170,0x0000216a,0x0000216f,0x0004007c, 26940x000022d6,0x000022d4,0x000022d9,0x000022d7,
25800x00000014,0x00002160,0x00002170,0x00060041, 26950x000700ed,0x00000006,0x0000227b,0x00002277,
25810x000000d8,0x00002157,0x00002160,0x000000d7, 26960x000000b0,0x000000a6,0x0000311c,0x00060041,
25820x000000d7,0x0006003d,0x00000006,0x00002158, 26970x000000db,0x0000227d,0x000022ba,0x000000da,
25830x00002157,0x00000002,0x00000004,0x0004007c, 26980x00000154,0x00050051,0x00000027,0x0000227f,
25840x00000027,0x000020e6,0x00002158,0x00060050, 26990x00002272,0x00000001,0x0004007c,0x00000006,
25850x0000004b,0x000020e7,0x000020da,0x000020e0, 27000x000022e1,0x0000227f,0x000500c7,0x00000006,
25860x000020e6,0x00050080,0x00000006,0x000020e9, 27010x000022e3,0x000022e1,0x00000130,0x000500ab,
25870x000020d5,0x00000115,0x00050095,0x000000a8, 27020x0000002f,0x000022e4,0x000022e3,0x000000a6,
25880x00002189,0x00002124,0x000020e9,0x00050051, 27030x000300f7,0x000022eb,0x00000000,0x000400fa,
25890x00000006,0x0000218a,0x00002189,0x00000001, 27040x000022e4,0x000022e5,0x000022e8,0x000200f8,
25900x00050051,0x00000006,0x0000218b,0x00002189, 27050x000022e5,0x000400c8,0x00000006,0x000022e7,
25910x00000000,0x00050080,0x00000006,0x00002190, 27060x000022e1,0x000200f9,0x000022eb,0x000200f8,
25920x0000212b,0x0000218a,0x00050050,0x00000007, 27070x000022e8,0x000500c5,0x00000006,0x000022ea,
25930x00002191,0x0000218b,0x00002190,0x0004007c, 27080x000022e1,0x00000130,0x000200f9,0x000022eb,
25940x00000014,0x00002181,0x00002191,0x00060041, 27090x000200f8,0x000022eb,0x000700f5,0x00000006,
25950x000000d8,0x00002178,0x00002181,0x000000d7, 27100x0000311d,0x000022e7,0x000022e5,0x000022ea,
25960x000000d7,0x0006003d,0x00000006,0x00002179, 27110x000022e8,0x000700ed,0x00000006,0x00002281,
25970x00002178,0x00000002,0x00000004,0x0004007c, 27120x0000227d,0x000000b0,0x000000a6,0x0000311d,
25980x00000027,0x000020ed,0x00002179,0x00050080, 27130x00060041,0x000000db,0x00002283,0x000022ba,
25990x00000006,0x000020ef,0x000020d5,0x0000011c, 27140x000000da,0x00000205,0x00050051,0x00000027,
26000x00050095,0x000000a8,0x000021aa,0x00002124, 27150x00002285,0x00002272,0x00000002,0x0004007c,
26010x000020ef,0x00050051,0x00000006,0x000021ab, 27160x00000006,0x000022f2,0x00002285,0x000500c7,
26020x000021aa,0x00000001,0x00050051,0x00000006, 27170x00000006,0x000022f4,0x000022f2,0x00000130,
26030x000021ac,0x000021aa,0x00000000,0x00050080, 27180x000500ab,0x0000002f,0x000022f5,0x000022f4,
26040x00000006,0x000021b1,0x0000212b,0x000021ab, 27190x000000a6,0x000300f7,0x000022fc,0x00000000,
26050x00050050,0x00000007,0x000021b2,0x000021ac, 27200x000400fa,0x000022f5,0x000022f6,0x000022f9,
26060x000021b1,0x0004007c,0x00000014,0x000021a2, 27210x000200f8,0x000022f6,0x000400c8,0x00000006,
26070x000021b2,0x00060041,0x000000d8,0x00002199, 27220x000022f8,0x000022f2,0x000200f9,0x000022fc,
26080x000021a2,0x000000d7,0x000000d7,0x0006003d, 27230x000200f8,0x000022f9,0x000500c5,0x00000006,
26090x00000006,0x0000219a,0x00002199,0x00000002, 27240x000022fb,0x000022f2,0x00000130,0x000200f9,
26100x00000004,0x0004007c,0x00000027,0x000020f3, 27250x000022fc,0x000200f8,0x000022fc,0x000700f5,
26110x0000219a,0x00050080,0x00000006,0x000020f5, 27260x00000006,0x0000311e,0x000022f8,0x000022f6,
26120x000020d5,0x00000186,0x00050095,0x000000a8, 27270x000022fb,0x000022f9,0x000700ed,0x00000006,
26130x000021cb,0x00002124,0x000020f5,0x00050051, 27280x00002287,0x00002283,0x000000b0,0x000000a6,
26140x00000006,0x000021cc,0x000021cb,0x00000001, 27290x0000311e,0x00060041,0x000000db,0x00002289,
26150x00050051,0x00000006,0x000021cd,0x000021cb, 27300x000022ba,0x000000da,0x0000020d,0x000300f7,
26160x00000000,0x00050080,0x00000006,0x000021d2, 27310x0000230d,0x00000000,0x000400fa,0x000022d3,
26170x0000212b,0x000021cc,0x00050050,0x00000007, 27320x00002307,0x0000230a,0x000200f8,0x00002307,
26180x000021d3,0x000021cd,0x000021d2,0x0004007c, 27330x000400c8,0x00000006,0x00002309,0x000022d0,
26190x00000014,0x000021c3,0x000021d3,0x00060041, 27340x000200f9,0x0000230d,0x000200f8,0x0000230a,
26200x000000d8,0x000021ba,0x000021c3,0x000000d7, 27350x000500c5,0x00000006,0x0000230c,0x000022d0,
26210x000000d7,0x0006003d,0x00000006,0x000021bb, 27360x00000130,0x000200f9,0x0000230d,0x000200f8,
26220x000021ba,0x00000002,0x00000004,0x0004007c, 27370x0000230d,0x000700f5,0x00000006,0x0000311f,
26230x00000027,0x000020f9,0x000021bb,0x00060050, 27380x00002309,0x00002307,0x0000230c,0x0000230a,
26240x0000004b,0x000020fa,0x000020ed,0x000020f3, 27390x000700ef,0x00000006,0x0000228d,0x00002289,
26250x000020f9,0x000500bc,0x0000002f,0x000021da, 27400x000000b0,0x000000a6,0x0000311f,0x00060041,
26260x000020da,0x000020ed,0x000300f7,0x000021e1, 27410x000000db,0x0000228f,0x000022ba,0x000000da,
26270x00000000,0x000400fa,0x000021da,0x000021db, 27420x00000215,0x000300f7,0x0000231e,0x00000000,
26280x000021e1,0x000200f8,0x000021db,0x000500bc, 27430x000400fa,0x000022e4,0x00002318,0x0000231b,
26290x0000002f,0x000021e0,0x000020e0,0x000020f3, 27440x000200f8,0x00002318,0x000400c8,0x00000006,
26300x000200f9,0x000021e1,0x000200f8,0x000021e1, 27450x0000231a,0x000022e1,0x000200f9,0x0000231e,
26310x000700f5,0x0000002f,0x000021e2,0x000021da, 27460x000200f8,0x0000231b,0x000500c5,0x00000006,
26320x00000a5e,0x000021e0,0x000021db,0x000300f7, 27470x0000231d,0x000022e1,0x00000130,0x000200f9,
26330x000021e9,0x00000000,0x000400fa,0x000021e2, 27480x0000231e,0x000200f8,0x0000231e,0x000700f5,
26340x000021e3,0x000021e9,0x000200f8,0x000021e3, 27490x00000006,0x00003120,0x0000231a,0x00002318,
26350x000500bc,0x0000002f,0x000021e8,0x000020e6, 27500x0000231d,0x0000231b,0x000700ef,0x00000006,
26360x000020f9,0x000200f9,0x000021e9,0x000200f8, 27510x00002293,0x0000228f,0x000000b0,0x000000a6,
26370x000021e9,0x000700f5,0x0000002f,0x000021ea, 27520x00003120,0x00060041,0x000000db,0x00002295,
26380x000021e2,0x000021e1,0x000021e8,0x000021e3, 27530x000022ba,0x000000da,0x0000021d,0x000300f7,
26390x000300f7,0x000020b3,0x00000000,0x000400fa, 27540x0000232f,0x00000000,0x000400fa,0x000022f5,
26400x000021ea,0x00002077,0x000020b3,0x000200f8, 27550x00002329,0x0000232c,0x000200f8,0x00002329,
26410x00002077,0x00050095,0x000000a8,0x000021fb, 27560x000400c8,0x00000006,0x0000232b,0x000022f2,
26420x00002124,0x000000a3,0x00050051,0x00000006, 27570x000200f9,0x0000232f,0x000200f8,0x0000232c,
26430x000021fc,0x000021fb,0x00000001,0x00050051, 27580x000500c5,0x00000006,0x0000232e,0x000022f2,
26440x00000006,0x000021fd,0x000021fb,0x00000000, 27590x00000130,0x000200f9,0x0000232f,0x000200f8,
26450x00050080,0x00000006,0x00002202,0x0000212b, 27600x0000232f,0x000700f5,0x00000006,0x00003121,
26460x000021fc,0x00050050,0x00000007,0x00002203, 27610x0000232b,0x00002329,0x0000232e,0x0000232c,
26470x000021fd,0x00002202,0x0004007c,0x00000014, 27620x000700ef,0x00000006,0x00002299,0x00002295,
26480x000021f3,0x00002203,0x00060041,0x000000d8, 27630x000000b0,0x000000a6,0x00003121,0x000200f9,
26490x0000207c,0x000021f3,0x000000d7,0x000000d7, 27640x0000229a,0x000200f8,0x0000229a,0x000200f9,
26500x0006003d,0x00000006,0x0000207d,0x0000207c, 27650x00000b9e,0x000200f8,0x00000ba2,0x000500aa,
27660x0000002f,0x00000ba5,0x00000b13,0x000002b7,
27670x000300f7,0x00000ba7,0x00000000,0x000400fa,
27680x00000ba5,0x00000ba6,0x00000bab,0x000200f8,
27690x00000ba6,0x00050041,0x000000fe,0x000023e4,
27700x000000fc,0x000000fd,0x0004003d,0x00000006,
27710x000023e5,0x000023e4,0x00050084,0x00000006,
27720x000023e6,0x0000011f,0x000023e5,0x00050080,
27730x00000006,0x000023e7,0x00000107,0x000023e6,
27740x00050080,0x00000006,0x000023ed,0x000023e5,
27750x0000319c,0x00050086,0x00000006,0x000023ee,
27760x000023ed,0x00000101,0x00050084,0x00000006,
27770x000023e0,0x00000107,0x000023ee,0x00050080,
27780x00000006,0x000023e1,0x000023e7,0x000023e0,
27790x00050084,0x00000006,0x000023b5,0x00000150,
27800x00000b11,0x00050080,0x00000006,0x000023b6,
27810x000023e1,0x000023b5,0x00050041,0x00000156,
27820x000023b7,0x000000fc,0x00000154,0x0004003d,
27830x00000007,0x000023b8,0x000023b7,0x00050051,
27840x00000006,0x00002405,0x000023b8,0x00000000,
27850x00050095,0x000000ab,0x00002407,0x00002405,
27860x000023b6,0x00050051,0x00000006,0x00002408,
27870x00002407,0x00000001,0x00050051,0x00000006,
27880x00002409,0x00002407,0x00000000,0x00050051,
27890x00000006,0x0000240c,0x000023b8,0x00000001,
27900x00050080,0x00000006,0x0000240e,0x0000240c,
27910x00002408,0x00050050,0x00000007,0x0000240f,
27920x00002409,0x0000240e,0x0004007c,0x00000014,
27930x000023ff,0x0000240f,0x00060041,0x000000db,
27940x000023f6,0x000023ff,0x000000da,0x000000da,
27950x0006003d,0x00000006,0x000023f7,0x000023f6,
27960x00000002,0x00000004,0x0004007c,0x00000027,
27970x000023bb,0x000023f7,0x00050080,0x00000006,
27980x000023bd,0x000023b6,0x0000010a,0x00050095,
27990x000000ab,0x00002428,0x00002405,0x000023bd,
28000x00050051,0x00000006,0x00002429,0x00002428,
28010x00000001,0x00050051,0x00000006,0x0000242a,
28020x00002428,0x00000000,0x00050080,0x00000006,
28030x0000242f,0x0000240c,0x00002429,0x00050050,
28040x00000007,0x00002430,0x0000242a,0x0000242f,
28050x0004007c,0x00000014,0x00002420,0x00002430,
28060x00060041,0x000000db,0x00002417,0x00002420,
28070x000000da,0x000000da,0x0006003d,0x00000006,
28080x00002418,0x00002417,0x00000002,0x00000004,
28090x0004007c,0x00000027,0x000023c1,0x00002418,
28100x00050080,0x00000006,0x000023c3,0x000023b6,
28110x00000111,0x00050095,0x000000ab,0x00002449,
28120x00002405,0x000023c3,0x00050051,0x00000006,
28130x0000244a,0x00002449,0x00000001,0x00050051,
28140x00000006,0x0000244b,0x00002449,0x00000000,
28150x00050080,0x00000006,0x00002450,0x0000240c,
28160x0000244a,0x00050050,0x00000007,0x00002451,
28170x0000244b,0x00002450,0x0004007c,0x00000014,
28180x00002441,0x00002451,0x00060041,0x000000db,
28190x00002438,0x00002441,0x000000da,0x000000da,
28200x0006003d,0x00000006,0x00002439,0x00002438,
28210x00000002,0x00000004,0x0004007c,0x00000027,
28220x000023c7,0x00002439,0x00060050,0x0000004b,
28230x000023c8,0x000023bb,0x000023c1,0x000023c7,
28240x00050080,0x00000006,0x000023ca,0x000023b6,
28250x00000118,0x00050095,0x000000ab,0x0000246a,
28260x00002405,0x000023ca,0x00050051,0x00000006,
28270x0000246b,0x0000246a,0x00000001,0x00050051,
28280x00000006,0x0000246c,0x0000246a,0x00000000,
28290x00050080,0x00000006,0x00002471,0x0000240c,
28300x0000246b,0x00050050,0x00000007,0x00002472,
28310x0000246c,0x00002471,0x0004007c,0x00000014,
28320x00002462,0x00002472,0x00060041,0x000000db,
28330x00002459,0x00002462,0x000000da,0x000000da,
28340x0006003d,0x00000006,0x0000245a,0x00002459,
28350x00000002,0x00000004,0x0004007c,0x00000027,
28360x000023ce,0x0000245a,0x00050080,0x00000006,
28370x000023d0,0x000023b6,0x0000011f,0x00050095,
28380x000000ab,0x0000248b,0x00002405,0x000023d0,
28390x00050051,0x00000006,0x0000248c,0x0000248b,
28400x00000001,0x00050051,0x00000006,0x0000248d,
28410x0000248b,0x00000000,0x00050080,0x00000006,
28420x00002492,0x0000240c,0x0000248c,0x00050050,
28430x00000007,0x00002493,0x0000248d,0x00002492,
28440x0004007c,0x00000014,0x00002483,0x00002493,
28450x00060041,0x000000db,0x0000247a,0x00002483,
28460x000000da,0x000000da,0x0006003d,0x00000006,
28470x0000247b,0x0000247a,0x00000002,0x00000004,
28480x0004007c,0x00000027,0x000023d4,0x0000247b,
28490x00050080,0x00000006,0x000023d6,0x000023b6,
28500x00000189,0x00050095,0x000000ab,0x000024ac,
28510x00002405,0x000023d6,0x00050051,0x00000006,
28520x000024ad,0x000024ac,0x00000001,0x00050051,
28530x00000006,0x000024ae,0x000024ac,0x00000000,
28540x00050080,0x00000006,0x000024b3,0x0000240c,
28550x000024ad,0x00050050,0x00000007,0x000024b4,
28560x000024ae,0x000024b3,0x0004007c,0x00000014,
28570x000024a4,0x000024b4,0x00060041,0x000000db,
28580x0000249b,0x000024a4,0x000000da,0x000000da,
28590x0006003d,0x00000006,0x0000249c,0x0000249b,
28600x00000002,0x00000004,0x0004007c,0x00000027,
28610x000023da,0x0000249c,0x00060050,0x0000004b,
28620x000023db,0x000023ce,0x000023d4,0x000023da,
28630x000500bc,0x0000002f,0x000024bb,0x000023bb,
28640x000023ce,0x000300f7,0x000024c2,0x00000000,
28650x000400fa,0x000024bb,0x000024bc,0x000024c2,
28660x000200f8,0x000024bc,0x000500bc,0x0000002f,
28670x000024c1,0x000023c1,0x000023d4,0x000200f9,
28680x000024c2,0x000200f8,0x000024c2,0x000700f5,
28690x0000002f,0x000024c3,0x000024bb,0x00000ba6,
28700x000024c1,0x000024bc,0x000300f7,0x000024ca,
28710x00000000,0x000400fa,0x000024c3,0x000024c4,
28720x000024ca,0x000200f8,0x000024c4,0x000500bc,
28730x0000002f,0x000024c9,0x000023c7,0x000023da,
28740x000200f9,0x000024ca,0x000200f8,0x000024ca,
28750x000700f5,0x0000002f,0x000024cb,0x000024c3,
28760x000024c2,0x000024c9,0x000024c4,0x000300f7,
28770x00002394,0x00000000,0x000400fa,0x000024cb,
28780x00002358,0x00002394,0x000200f8,0x00002358,
28790x00050095,0x000000ab,0x000024dc,0x00002405,
28800x000000a6,0x00050051,0x00000006,0x000024dd,
28810x000024dc,0x00000001,0x00050051,0x00000006,
28820x000024de,0x000024dc,0x00000000,0x00050080,
28830x00000006,0x000024e3,0x0000240c,0x000024dd,
28840x00050050,0x00000007,0x000024e4,0x000024de,
28850x000024e3,0x0004007c,0x00000014,0x000024d4,
28860x000024e4,0x00060041,0x000000db,0x0000235d,
28870x000024d4,0x000000da,0x000000da,0x0006003d,
28880x00000006,0x0000235e,0x0000235d,0x00000002,
28890x00000004,0x000500c7,0x00000006,0x000024e9,
28900x0000235e,0x00000130,0x000500ab,0x0000002f,
28910x000024ea,0x000024e9,0x000000a6,0x000300f7,
28920x000024f1,0x00000000,0x000400fa,0x000024ea,
28930x000024eb,0x000024ee,0x000200f8,0x000024eb,
28940x000500c7,0x00000006,0x000024ed,0x0000235e,
28950x00000145,0x000200f9,0x000024f1,0x000200f8,
28960x000024ee,0x000400c8,0x00000006,0x000024f0,
28970x0000235e,0x000200f9,0x000024f1,0x000200f8,
28980x000024f1,0x000700f5,0x00000006,0x000030db,
28990x000024ed,0x000024eb,0x000024f0,0x000024ee,
29000x0004007c,0x00000027,0x000024f3,0x000030db,
29010x00060041,0x000000db,0x00002361,0x000024d4,
29020x000000da,0x00000154,0x0006003d,0x00000006,
29030x00002362,0x00002361,0x00000002,0x00000004,
29040x000500c7,0x00000006,0x000024f8,0x00002362,
29050x00000130,0x000500ab,0x0000002f,0x000024f9,
29060x000024f8,0x000000a6,0x000300f7,0x00002500,
29070x00000000,0x000400fa,0x000024f9,0x000024fa,
29080x000024fd,0x000200f8,0x000024fa,0x000500c7,
29090x00000006,0x000024fc,0x00002362,0x00000145,
29100x000200f9,0x00002500,0x000200f8,0x000024fd,
29110x000400c8,0x00000006,0x000024ff,0x00002362,
29120x000200f9,0x00002500,0x000200f8,0x00002500,
29130x000700f5,0x00000006,0x000030dc,0x000024fc,
29140x000024fa,0x000024ff,0x000024fd,0x0004007c,
29150x00000027,0x00002502,0x000030dc,0x00060041,
29160x000000db,0x00002365,0x000024d4,0x000000da,
29170x00000205,0x0006003d,0x00000006,0x00002366,
29180x00002365,0x00000002,0x00000004,0x000500c7,
29190x00000006,0x00002507,0x00002366,0x00000130,
29200x000500ab,0x0000002f,0x00002508,0x00002507,
29210x000000a6,0x000300f7,0x0000250f,0x00000000,
29220x000400fa,0x00002508,0x00002509,0x0000250c,
29230x000200f8,0x00002509,0x000500c7,0x00000006,
29240x0000250b,0x00002366,0x00000145,0x000200f9,
29250x0000250f,0x000200f8,0x0000250c,0x000400c8,
29260x00000006,0x0000250e,0x00002366,0x000200f9,
29270x0000250f,0x000200f8,0x0000250f,0x000700f5,
29280x00000006,0x000030dd,0x0000250b,0x00002509,
29290x0000250e,0x0000250c,0x0004007c,0x00000027,
29300x00002511,0x000030dd,0x00060050,0x0000004b,
29310x00002368,0x000024f3,0x00002502,0x00002511,
29320x00060041,0x000000db,0x0000236a,0x000024d4,
29330x000000da,0x0000020d,0x0006003d,0x00000006,
29340x0000236b,0x0000236a,0x00000002,0x00000004,
29350x000500c7,0x00000006,0x00002516,0x0000236b,
29360x00000130,0x000500ab,0x0000002f,0x00002517,
29370x00002516,0x000000a6,0x000300f7,0x0000251e,
29380x00000000,0x000400fa,0x00002517,0x00002518,
29390x0000251b,0x000200f8,0x00002518,0x000500c7,
29400x00000006,0x0000251a,0x0000236b,0x00000145,
29410x000200f9,0x0000251e,0x000200f8,0x0000251b,
29420x000400c8,0x00000006,0x0000251d,0x0000236b,
29430x000200f9,0x0000251e,0x000200f8,0x0000251e,
29440x000700f5,0x00000006,0x000030de,0x0000251a,
29450x00002518,0x0000251d,0x0000251b,0x0004007c,
29460x00000027,0x00002520,0x000030de,0x00060041,
29470x000000db,0x0000236e,0x000024d4,0x000000da,
29480x00000215,0x0006003d,0x00000006,0x0000236f,
29490x0000236e,0x00000002,0x00000004,0x000500c7,
29500x00000006,0x00002525,0x0000236f,0x00000130,
29510x000500ab,0x0000002f,0x00002526,0x00002525,
29520x000000a6,0x000300f7,0x0000252d,0x00000000,
29530x000400fa,0x00002526,0x00002527,0x0000252a,
29540x000200f8,0x00002527,0x000500c7,0x00000006,
29550x00002529,0x0000236f,0x00000145,0x000200f9,
29560x0000252d,0x000200f8,0x0000252a,0x000400c8,
29570x00000006,0x0000252c,0x0000236f,0x000200f9,
29580x0000252d,0x000200f8,0x0000252d,0x000700f5,
29590x00000006,0x000030df,0x00002529,0x00002527,
29600x0000252c,0x0000252a,0x0004007c,0x00000027,
29610x0000252f,0x000030df,0x00060041,0x000000db,
29620x00002372,0x000024d4,0x000000da,0x0000021d,
29630x0006003d,0x00000006,0x00002373,0x00002372,
26510x00000002,0x00000004,0x000500c7,0x00000006, 29640x00000002,0x00000004,0x000500c7,0x00000006,
26520x00002208,0x0000207d,0x0000012d,0x000500ab, 29650x00002534,0x00002373,0x00000130,0x000500ab,
26530x0000002f,0x00002209,0x00002208,0x000000a3, 29660x0000002f,0x00002535,0x00002534,0x000000a6,
26540x000300f7,0x00002210,0x00000000,0x000400fa, 29670x000300f7,0x0000253c,0x00000000,0x000400fa,
26550x00002209,0x0000220a,0x0000220d,0x000200f8, 29680x00002535,0x00002536,0x00002539,0x000200f8,
26560x0000220a,0x000500c7,0x00000006,0x0000220c, 29690x00002536,0x000500c7,0x00000006,0x00002538,
26570x0000207d,0x00000142,0x000200f9,0x00002210, 29700x00002373,0x00000145,0x000200f9,0x0000253c,
26580x000200f8,0x0000220d,0x000400c8,0x00000006, 29710x000200f8,0x00002539,0x000400c8,0x00000006,
26590x0000220f,0x0000207d,0x000200f9,0x00002210, 29720x0000253b,0x00002373,0x000200f9,0x0000253c,
26600x000200f8,0x00002210,0x000700f5,0x00000006, 29730x000200f8,0x0000253c,0x000700f5,0x00000006,
26610x00002acb,0x0000220c,0x0000220a,0x0000220f, 29740x000030e0,0x00002538,0x00002536,0x0000253b,
26620x0000220d,0x0004007c,0x00000027,0x00002212, 29750x00002539,0x0004007c,0x00000027,0x0000253e,
26630x00002acb,0x00060041,0x000000d8,0x00002080, 29760x000030e0,0x00060050,0x0000004b,0x00002375,
26640x000021f3,0x000000d7,0x00000151,0x0006003d, 29770x00002520,0x0000252f,0x0000253e,0x00050083,
26650x00000006,0x00002081,0x00002080,0x00000002, 29780x0000004b,0x00002378,0x00002375,0x00002368,
26660x00000004,0x000500c7,0x00000006,0x00002217, 29790x0007000c,0x0000004b,0x00002379,0x00000001,
26670x00002081,0x0000012d,0x000500ab,0x0000002f, 29800x00000028,0x00002378,0x0000065b,0x00050081,
26680x00002218,0x00002217,0x000000a3,0x000300f7, 29810x0000004b,0x0000237c,0x000023c8,0x000023db,
26690x0000221f,0x00000000,0x000400fa,0x00002218, 29820x0005008e,0x0000004b,0x0000237d,0x0000237c,
26700x00002219,0x0000221c,0x000200f8,0x00002219, 29830x000001ed,0x00050083,0x0000004b,0x0000237f,
26710x000500c7,0x00000006,0x0000221b,0x00002081, 29840x0000237d,0x00002368,0x00050088,0x0000004b,
26720x00000142,0x000200f9,0x0000221f,0x000200f8, 29850x00002381,0x0000237f,0x00002379,0x0008000c,
26730x0000221c,0x000400c8,0x00000006,0x0000221e, 29860x0000004b,0x00002384,0x00000001,0x0000002b,
26740x00002081,0x000200f9,0x0000221f,0x000200f8, 29870x00002381,0x00000570,0x00003196,0x0005008e,
26750x0000221f,0x000700f5,0x00000006,0x00002acc, 29880x0000004b,0x00002385,0x00002384,0x0000066b,
26760x0000221b,0x00002219,0x0000221e,0x0000221c, 29890x0004006d,0x0000065d,0x00002386,0x00002385,
26770x0004007c,0x00000027,0x00002221,0x00002acc, 29900x00050051,0x00000006,0x00002388,0x00002386,
26780x00060041,0x000000d8,0x00002084,0x000021f3, 29910x00000000,0x000500c7,0x00000006,0x00002542,
26790x000000d7,0x00000202,0x0006003d,0x00000006, 29920x00002388,0x000005fe,0x000500c4,0x00000006,
26800x00002085,0x00002084,0x00000002,0x00000004, 29930x00002545,0x00002542,0x0000023e,0x000500c5,
26810x000500c7,0x00000006,0x00002226,0x00002085, 29940x00000006,0x00002546,0x00002542,0x00002545,
26820x0000012d,0x000500ab,0x0000002f,0x00002227, 29950x000500c7,0x00000006,0x00002547,0x00002546,
26830x00002226,0x000000a3,0x000300f7,0x0000222e, 29960x00000605,0x000500c4,0x00000006,0x0000254a,
26840x00000000,0x000400fa,0x00002227,0x00002228, 29970x00002547,0x00000308,0x000500c5,0x00000006,
26850x0000222b,0x000200f8,0x00002228,0x000500c7, 29980x0000254b,0x00002547,0x0000254a,0x000500c7,
26860x00000006,0x0000222a,0x00002085,0x00000142, 29990x00000006,0x0000254c,0x0000254b,0x0000060b,
26870x000200f9,0x0000222e,0x000200f8,0x0000222b, 30000x000500c4,0x00000006,0x0000254f,0x0000254c,
26880x000400c8,0x00000006,0x0000222d,0x00002085, 30010x00000215,0x000500c5,0x00000006,0x00002550,
26890x000200f9,0x0000222e,0x000200f8,0x0000222e, 30020x0000254c,0x0000254f,0x000500c7,0x00000006,
26900x000700f5,0x00000006,0x00002acd,0x0000222a, 30030x00002551,0x00002550,0x00000611,0x000500c4,
26910x00002228,0x0000222d,0x0000222b,0x0004007c, 30040x00000006,0x00002554,0x00002551,0x00000205,
26920x00000027,0x00002230,0x00002acd,0x00060050, 30050x000500c5,0x00000006,0x00002555,0x00002551,
26930x0000004b,0x00002087,0x00002212,0x00002221, 30060x00002554,0x000500c7,0x00000006,0x00002556,
26940x00002230,0x00060041,0x000000d8,0x00002089, 30070x00002555,0x00000617,0x000500c4,0x00000006,
26950x000021f3,0x000000d7,0x0000020a,0x0006003d, 30080x0000238a,0x00002556,0x00000205,0x00050051,
26960x00000006,0x0000208a,0x00002089,0x00000002, 30090x00000006,0x0000238c,0x00002386,0x00000001,
26970x00000004,0x000500c7,0x00000006,0x00002235, 30100x000500c7,0x00000006,0x0000255b,0x0000238c,
26980x0000208a,0x0000012d,0x000500ab,0x0000002f, 30110x000005fe,0x000500c4,0x00000006,0x0000255e,
26990x00002236,0x00002235,0x000000a3,0x000300f7, 30120x0000255b,0x0000023e,0x000500c5,0x00000006,
27000x0000223d,0x00000000,0x000400fa,0x00002236, 30130x0000255f,0x0000255b,0x0000255e,0x000500c7,
27010x00002237,0x0000223a,0x000200f8,0x00002237, 30140x00000006,0x00002560,0x0000255f,0x00000605,
27020x000500c7,0x00000006,0x00002239,0x0000208a, 30150x000500c4,0x00000006,0x00002563,0x00002560,
27030x00000142,0x000200f9,0x0000223d,0x000200f8, 30160x00000308,0x000500c5,0x00000006,0x00002564,
27040x0000223a,0x000400c8,0x00000006,0x0000223c, 30170x00002560,0x00002563,0x000500c7,0x00000006,
27050x0000208a,0x000200f9,0x0000223d,0x000200f8, 30180x00002565,0x00002564,0x0000060b,0x000500c4,
27060x0000223d,0x000700f5,0x00000006,0x00002ace, 30190x00000006,0x00002568,0x00002565,0x00000215,
27070x00002239,0x00002237,0x0000223c,0x0000223a, 30200x000500c5,0x00000006,0x00002569,0x00002565,
27080x0004007c,0x00000027,0x0000223f,0x00002ace, 30210x00002568,0x000500c7,0x00000006,0x0000256a,
27090x00060041,0x000000d8,0x0000208d,0x000021f3, 30220x00002569,0x00000611,0x000500c4,0x00000006,
27100x000000d7,0x00000212,0x0006003d,0x00000006, 30230x0000256d,0x0000256a,0x00000205,0x000500c5,
27110x0000208e,0x0000208d,0x00000002,0x00000004, 30240x00000006,0x0000256e,0x0000256a,0x0000256d,
27120x000500c7,0x00000006,0x00002244,0x0000208e, 30250x000500c7,0x00000006,0x0000256f,0x0000256e,
27130x0000012d,0x000500ab,0x0000002f,0x00002245, 30260x00000617,0x000500c4,0x00000006,0x0000238e,
27140x00002244,0x000000a3,0x000300f7,0x0000224c, 30270x0000256f,0x00000154,0x000500c5,0x00000006,
27150x00000000,0x000400fa,0x00002245,0x00002246, 30280x0000238f,0x0000238a,0x0000238e,0x00050051,
27160x00002249,0x000200f8,0x00002246,0x000500c7, 30290x00000006,0x00002391,0x00002386,0x00000002,
27170x00000006,0x00002248,0x0000208e,0x00000142, 30300x000500c7,0x00000006,0x00002574,0x00002391,
27180x000200f9,0x0000224c,0x000200f8,0x00002249, 30310x000005fe,0x000500c4,0x00000006,0x00002577,
27190x000400c8,0x00000006,0x0000224b,0x0000208e, 30320x00002574,0x0000023e,0x000500c5,0x00000006,
27200x000200f9,0x0000224c,0x000200f8,0x0000224c, 30330x00002578,0x00002574,0x00002577,0x000500c7,
27210x000700f5,0x00000006,0x00002acf,0x00002248, 30340x00000006,0x00002579,0x00002578,0x00000605,
27220x00002246,0x0000224b,0x00002249,0x0004007c, 30350x000500c4,0x00000006,0x0000257c,0x00002579,
27230x00000027,0x0000224e,0x00002acf,0x00060041, 30360x00000308,0x000500c5,0x00000006,0x0000257d,
27240x000000d8,0x00002091,0x000021f3,0x000000d7, 30370x00002579,0x0000257c,0x000500c7,0x00000006,
27250x0000021a,0x0006003d,0x00000006,0x00002092, 30380x0000257e,0x0000257d,0x0000060b,0x000500c4,
27260x00002091,0x00000002,0x00000004,0x000500c7, 30390x00000006,0x00002581,0x0000257e,0x00000215,
27270x00000006,0x00002253,0x00002092,0x0000012d, 30400x000500c5,0x00000006,0x00002582,0x0000257e,
27280x000500ab,0x0000002f,0x00002254,0x00002253, 30410x00002581,0x000500c7,0x00000006,0x00002583,
27290x000000a3,0x000300f7,0x0000225b,0x00000000, 30420x00002582,0x00000611,0x000500c4,0x00000006,
27300x000400fa,0x00002254,0x00002255,0x00002258, 30430x00002586,0x00002583,0x00000205,0x000500c5,
27310x000200f8,0x00002255,0x000500c7,0x00000006, 30440x00000006,0x00002587,0x00002583,0x00002586,
27320x00002257,0x00002092,0x00000142,0x000200f9, 30450x000500c7,0x00000006,0x00002588,0x00002587,
27330x0000225b,0x000200f8,0x00002258,0x000400c8, 30460x00000617,0x000500c5,0x00000006,0x00002393,
27340x00000006,0x0000225a,0x00002092,0x000200f9, 30470x0000238f,0x00002588,0x000200f9,0x00002394,
27350x0000225b,0x000200f8,0x0000225b,0x000700f5, 30480x000200f8,0x00002394,0x000700f5,0x00000006,
27360x00000006,0x00002ad0,0x00002257,0x00002255, 30490x000030e1,0x00000531,0x000024ca,0x00002393,
27370x0000225a,0x00002258,0x0004007c,0x00000027, 30500x0000253c,0x00050084,0x00000006,0x00002397,
27380x0000225d,0x00002ad0,0x00060050,0x0000004b, 30510x0000010a,0x00000b11,0x00050080,0x00000006,
27390x00002094,0x0000223f,0x0000224e,0x0000225d, 30520x00002398,0x00000107,0x00002397,0x00050095,
27400x00050083,0x0000004b,0x00002097,0x00002094, 30530x000000ab,0x000025a3,0x00002405,0x00002398,
27410x00002087,0x0007000c,0x0000004b,0x00002098, 30540x00050051,0x00000006,0x000025a4,0x000025a3,
27420x00000001,0x00000028,0x00002097,0x00000658, 30550x00000001,0x00050051,0x00000006,0x000025a5,
27430x00050081,0x0000004b,0x0000209b,0x000020e7, 30560x000025a3,0x00000000,0x00050080,0x00000006,
27440x000020fa,0x0005008e,0x0000004b,0x0000209c, 30570x000025aa,0x0000240c,0x000025a4,0x00050050,
27450x0000209b,0x000001ea,0x00050083,0x0000004b, 30580x00000007,0x000025ab,0x000025a5,0x000025aa,
27460x0000209e,0x0000209c,0x00002087,0x00050088, 30590x0004007c,0x00000014,0x0000259b,0x000025ab,
27470x0000004b,0x000020a0,0x0000209e,0x00002098, 30600x00060041,0x000000db,0x00002593,0x0000259b,
27480x0008000c,0x0000004b,0x000020a3,0x00000001, 30610x000000da,0x000000da,0x0005003e,0x00002593,
27490x0000002b,0x000020a0,0x0000056d,0x00002b61, 30620x000030e1,0x00000002,0x00000004,0x00050084,
27500x0005008e,0x0000004b,0x000020a4,0x000020a3, 30630x00000006,0x000025b0,0x0000010a,0x000023e5,
27510x00000668,0x0004006d,0x0000065a,0x000020a5, 30640x00050080,0x00000006,0x000025b1,0x00000107,
27520x000020a4,0x00050051,0x00000006,0x000020a7, 30650x000025b0,0x00050080,0x00000006,0x000023a0,
27530x000020a5,0x00000000,0x000500c7,0x00000006, 30660x000025b1,0x00002397,0x00050095,0x000000ab,
27540x00002261,0x000020a7,0x000005fb,0x000500c4, 30670x000025c9,0x00002405,0x000023a0,0x00050051,
27550x00000006,0x00002264,0x00002261,0x0000023b, 30680x00000006,0x000025ca,0x000025c9,0x00000001,
27560x000500c5,0x00000006,0x00002265,0x00002261, 30690x00050051,0x00000006,0x000025cb,0x000025c9,
27570x00002264,0x000500c7,0x00000006,0x00002266, 30700x00000000,0x00050080,0x00000006,0x000025d0,
27580x00002265,0x00000602,0x000500c4,0x00000006, 30710x0000240c,0x000025ca,0x00050050,0x00000007,
27590x00002269,0x00002266,0x00000305,0x000500c5, 30720x000025d1,0x000025cb,0x000025d0,0x0004007c,
27600x00000006,0x0000226a,0x00002266,0x00002269, 30730x00000014,0x000025c1,0x000025d1,0x00060041,
27610x000500c7,0x00000006,0x0000226b,0x0000226a, 30740x000000db,0x000025b9,0x000025c1,0x000000da,
27620x00000608,0x000500c4,0x00000006,0x0000226e, 30750x000000da,0x0005003e,0x000025b9,0x00000b11,
27630x0000226b,0x00000212,0x000500c5,0x00000006, 30760x00000002,0x00000004,0x000200f9,0x00000ba7,
27640x0000226f,0x0000226b,0x0000226e,0x000500c7, 30770x000200f8,0x00000bab,0x000500aa,0x0000002f,
27650x00000006,0x00002270,0x0000226f,0x0000060e, 30780x00000bae,0x00000b13,0x00000246,0x000300f7,
27660x000500c4,0x00000006,0x00002273,0x00002270, 30790x00000bb0,0x00000000,0x000400fa,0x00000bae,
27670x00000202,0x000500c5,0x00000006,0x00002274, 30800x00000baf,0x00000bb0,0x000200f8,0x00000baf,
27680x00002270,0x00002273,0x000500c7,0x00000006, 30810x00050041,0x000000fe,0x00002620,0x000000fc,
27690x00002275,0x00002274,0x00000614,0x000500c4, 30820x00000308,0x0004003d,0x00000006,0x00002621,
27700x00000006,0x000020a9,0x00002275,0x00000202, 30830x00002620,0x00050080,0x00000006,0x00002623,
27710x00050051,0x00000006,0x000020ab,0x000020a5, 30840x00002621,0x00000b11,0x00050041,0x000000fe,
27720x00000001,0x000500c7,0x00000006,0x0000227a, 30850x00002729,0x000000fc,0x0000023e,0x0004003d,
27730x000020ab,0x000005fb,0x000500c4,0x00000006, 30860x00000006,0x0000272a,0x00002729,0x00050084,
27740x0000227d,0x0000227a,0x0000023b,0x000500c5, 30870x00000006,0x0000272c,0x00002623,0x00000228,
27750x00000006,0x0000227e,0x0000227a,0x0000227d, 30880x00050080,0x00000006,0x0000272d,0x0000272a,
27760x000500c7,0x00000006,0x0000227f,0x0000227e, 30890x0000272c,0x000500c2,0x00000006,0x0000272e,
27770x00000602,0x000500c4,0x00000006,0x00002282, 30900x0000272d,0x00000233,0x000500c4,0x00000006,
27780x0000227f,0x00000305,0x000500c5,0x00000006, 30910x0000272f,0x0000272e,0x0000020d,0x000500c5,
27790x00002283,0x0000227f,0x00002282,0x000500c7, 30920x00000006,0x00002730,0x0000272f,0x00000246,
27800x00000006,0x00002284,0x00002283,0x00000608, 30930x000200f9,0x0000262f,0x000200f8,0x0000262f,
27810x000500c4,0x00000006,0x00002287,0x00002284, 30940x000700f5,0x0000004b,0x00003096,0x0000319b,
27820x00000212,0x000500c5,0x00000006,0x00002288, 30950x00000baf,0x0000317f,0x0000270b,0x000700f5,
27830x00002284,0x00002287,0x000500c7,0x00000006, 30960x0000004b,0x00003094,0x00003199,0x00000baf,
27840x00002289,0x00002288,0x0000060e,0x000500c4, 30970x0000317a,0x0000270b,0x000700f5,0x00000006,
27850x00000006,0x0000228c,0x00002289,0x00000202, 30980x00003091,0x000000a6,0x00000baf,0x0000270d,
27860x000500c5,0x00000006,0x0000228d,0x00002289, 30990x0000270b,0x000500b0,0x0000002f,0x00002632,
27870x0000228c,0x000500c7,0x00000006,0x0000228e, 31000x00003091,0x0000010a,0x000400f6,0x0000270e,
27880x0000228d,0x00000614,0x000500c4,0x00000006, 31010x0000270b,0x00000000,0x000400fa,0x00002632,
27890x000020ad,0x0000228e,0x00000151,0x000500c5, 31020x00002633,0x0000270e,0x000200f8,0x00002633,
27900x00000006,0x000020ae,0x000020a9,0x000020ad, 31030x00050084,0x00000006,0x00002635,0x0000010a,
27910x00050051,0x00000006,0x000020b0,0x000020a5, 31040x00000b11,0x00050080,0x00000006,0x00002637,
27920x00000002,0x000500c7,0x00000006,0x00002293, 31050x00002635,0x00003091,0x00050041,0x000000fe,
27930x000020b0,0x000005fb,0x000500c4,0x00000006, 31060x0000263c,0x000000fc,0x0000027b,0x0004003d,
27940x00002296,0x00002293,0x0000023b,0x000500c5, 31070x00000006,0x0000263d,0x0000263c,0x000500aa,
27950x00000006,0x00002297,0x00002293,0x00002296, 31080x0000002f,0x0000263e,0x0000263d,0x000000b0,
27960x000500c7,0x00000006,0x00002298,0x00002297, 31090x000300f7,0x000026d4,0x00000000,0x000400fa,
27970x00000602,0x000500c4,0x00000006,0x0000229b, 31100x0000263e,0x0000263f,0x00002684,0x000200f8,
27980x00002298,0x00000305,0x000500c5,0x00000006, 31110x0000263f,0x00050084,0x00000006,0x00002642,
27990x0000229c,0x00002298,0x0000229b,0x000500c7, 31120x0000010a,0x00003091,0x00050080,0x00000006,
28000x00000006,0x0000229d,0x0000229c,0x00000608, 31130x00002643,0x0000272d,0x00002642,0x00050041,
28010x000500c4,0x00000006,0x000022a0,0x0000229d, 31140x00000156,0x00002644,0x000000fc,0x000000da,
28020x00000212,0x000500c5,0x00000006,0x000022a1, 31150x0004003d,0x00000007,0x00002645,0x00002644,
28030x0000229d,0x000022a0,0x000500c7,0x00000006, 31160x00050051,0x00000006,0x00002747,0x00002645,
28040x000022a2,0x000022a1,0x0000060e,0x000500c4, 31170x00000000,0x00050095,0x000000ab,0x00002749,
28050x00000006,0x000022a5,0x000022a2,0x00000202, 31180x00002747,0x00002643,0x00050051,0x00000006,
28060x000500c5,0x00000006,0x000022a6,0x000022a2, 31190x0000274a,0x00002749,0x00000001,0x00050051,
28070x000022a5,0x000500c7,0x00000006,0x000022a7, 31200x00000006,0x0000274b,0x00002749,0x00000000,
28080x000022a6,0x00000614,0x000500c5,0x00000006, 31210x00050051,0x00000006,0x0000274e,0x00002645,
28090x000020b2,0x000020ae,0x000022a7,0x000200f9, 31220x00000001,0x00050080,0x00000006,0x00002750,
28100x000020b3,0x000200f8,0x000020b3,0x000700f5, 31230x0000274e,0x0000274a,0x00050050,0x00000007,
28110x00000006,0x00002ad1,0x0000052e,0x000021e9, 31240x00002751,0x0000274b,0x00002750,0x0004007c,
28120x000020b2,0x0000225b,0x00050084,0x00000006, 31250x00000014,0x00002741,0x00002751,0x00060041,
28130x000020b6,0x00000107,0x000009e9,0x00050080, 31260x000000db,0x00002738,0x00002741,0x000000da,
28140x00000006,0x000020b7,0x00000104,0x000020b6, 31270x000000da,0x0006003d,0x00000006,0x00002739,
28150x00050095,0x000000a8,0x000022c2,0x00002124, 31280x00002738,0x00000002,0x00000004,0x000500ab,
28160x000020b7,0x00050051,0x00000006,0x000022c3, 31290x0000002f,0x00002648,0x00002739,0x00000380,
28170x000022c2,0x00000001,0x00050051,0x00000006, 31300x000300f7,0x00002683,0x00000000,0x000400fa,
28180x000022c4,0x000022c2,0x00000000,0x00050080, 31310x00002648,0x00002649,0x00002683,0x000200f8,
28190x00000006,0x000022c9,0x0000212b,0x000022c3, 31320x00002649,0x000500c2,0x00000006,0x00002755,
28200x00050050,0x00000007,0x000022ca,0x000022c4, 31330x00002739,0x0000020d,0x00050084,0x00000006,
28210x000022c9,0x0004007c,0x00000014,0x000022ba, 31340x0000264c,0x00002755,0x00000107,0x000500c7,
28220x000022ca,0x00060041,0x000000d8,0x000022b2, 31350x00000006,0x0000264e,0x00002739,0x00000967,
28230x000022ba,0x000000d7,0x000000d7,0x0005003e, 31360x000500aa,0x0000002f,0x0000264f,0x0000264e,
28240x000022b2,0x00002ad1,0x00000002,0x00000004, 31370x00000246,0x000300f7,0x00002676,0x00000000,
28250x00050084,0x00000006,0x000022cf,0x00000107, 31380x000400fa,0x0000264f,0x00002650,0x0000265c,
28260x00002104,0x00050080,0x00000006,0x000022d0, 31390x000200f8,0x00002650,0x00050041,0x000000fe,
28270x00000104,0x000022cf,0x00050080,0x00000006, 31400x00002651,0x000000fc,0x0000096c,0x0004003d,
28280x000020bf,0x000022d0,0x000020b6,0x00050095, 31410x00000006,0x00002652,0x00002651,0x00050082,
28290x000000a8,0x000022e8,0x00002124,0x000020bf, 31420x00000006,0x00002656,0x0000264c,0x0000272a,
28300x00050051,0x00000006,0x000022e9,0x000022e8, 31430x00050086,0x00000006,0x00002657,0x00002656,
28310x00000001,0x00050051,0x00000006,0x000022ea, 31440x00000228,0x00050080,0x00000006,0x00002658,
28320x000022e8,0x00000000,0x00050080,0x00000006, 31450x00002652,0x00002657,0x00050041,0x000000fe,
28330x000022ef,0x0000212b,0x000022e9,0x00050050, 31460x00002795,0x000000fc,0x000000fd,0x0004003d,
28340x00000007,0x000022f0,0x000022ea,0x000022ef, 31470x00000006,0x00002796,0x00002795,0x00050084,
28350x0004007c,0x00000014,0x000022e0,0x000022f0, 31480x00000006,0x00002797,0x0000011f,0x00002796,
28360x00060041,0x000000d8,0x000022d8,0x000022e0, 31490x00050080,0x00000006,0x00002798,0x00000107,
28370x000000d7,0x000000d7,0x0005003e,0x000022d8, 31500x00002797,0x00050080,0x00000006,0x0000279e,
28380x000009e9,0x00000002,0x00000004,0x000200f9, 31510x00002796,0x0000319c,0x00050086,0x00000006,
28390x00000a5f,0x000200f8,0x00000a63,0x000500aa, 31520x0000279f,0x0000279e,0x00000101,0x00050084,
28400x0000002f,0x00000a66,0x000009eb,0x00000243, 31530x00000006,0x00002791,0x00000107,0x0000279f,
28410x000300f7,0x00000a68,0x00000000,0x000400fa, 31540x00050080,0x00000006,0x00002792,0x00002798,
28420x00000a66,0x00000a67,0x00000a68,0x000200f8, 31550x00002791,0x00050084,0x00000006,0x00002766,
28430x00000a67,0x00050041,0x000000fb,0x0000232f, 31560x00000150,0x00002658,0x00050080,0x00000006,
28440x000000f9,0x00000305,0x0004003d,0x00000006, 31570x00002767,0x00002792,0x00002766,0x00050041,
28450x00002330,0x0000232f,0x00050080,0x00000006, 31580x00000156,0x00002768,0x000000fc,0x00000154,
28460x00002332,0x00002330,0x000009e9,0x00050041, 31590x0004003d,0x00000007,0x00002769,0x00002768,
28470x000000fb,0x000023ee,0x000000f9,0x0000023b, 31600x00050051,0x00000006,0x000027b6,0x00002769,
28480x0004003d,0x00000006,0x000023ef,0x000023ee, 31610x00000000,0x00050095,0x000000ab,0x000027b8,
28490x00050084,0x00000006,0x000023f1,0x00002332, 31620x000027b6,0x00002767,0x00050051,0x00000006,
28500x00000225,0x00050080,0x00000006,0x000023f2, 31630x000027b9,0x000027b8,0x00000001,0x00050051,
28510x000023ef,0x000023f1,0x000500c2,0x00000006, 31640x00000006,0x000027ba,0x000027b8,0x00000000,
28520x000023f3,0x000023f2,0x00000230,0x000500c4, 31650x00050051,0x00000006,0x000027bd,0x00002769,
28530x00000006,0x000023f4,0x000023f3,0x0000020a, 31660x00000001,0x00050080,0x00000006,0x000027bf,
28540x000500c5,0x00000006,0x000023f5,0x000023f4, 31670x000027bd,0x000027b9,0x00050050,0x00000007,
28550x00000243,0x000200f9,0x0000233e,0x000200f8, 31680x000027c0,0x000027ba,0x000027bf,0x0004007c,
28560x0000233e,0x000700f5,0x0000004b,0x00002aaa, 31690x00000014,0x000027b0,0x000027c0,0x00060041,
28570x00002b66,0x00000a67,0x00002b57,0x000023d0, 31700x000000db,0x000027a7,0x000027b0,0x000000da,
28580x000700f5,0x0000004b,0x00002aa8,0x00002b64, 31710x000000da,0x0006003d,0x00000006,0x000027a8,
28590x00000a67,0x00002b55,0x000023d0,0x000700f5, 31720x000027a7,0x00000002,0x00000004,0x0004007c,
28600x00000006,0x00002aa5,0x000000a3,0x00000a67, 31730x00000027,0x0000276c,0x000027a8,0x00050080,
28610x000023d2,0x000023d0,0x000500b0,0x0000002f, 31740x00000006,0x0000276e,0x00002767,0x0000010a,
28620x00002341,0x00002aa5,0x00000107,0x000400f6, 31750x00050095,0x000000ab,0x000027d9,0x000027b6,
28630x000023d3,0x000023d0,0x00000000,0x000400fa, 31760x0000276e,0x00050051,0x00000006,0x000027da,
28640x00002341,0x00002342,0x000023d3,0x000200f8, 31770x000027d9,0x00000001,0x00050051,0x00000006,
28650x00002342,0x00050084,0x00000006,0x00002344, 31780x000027db,0x000027d9,0x00000000,0x00050080,
28660x00000107,0x000009e9,0x00050080,0x00000006, 31790x00000006,0x000027e0,0x000027bd,0x000027da,
28670x00002346,0x00002344,0x00002aa5,0x00050041, 31800x00050050,0x00000007,0x000027e1,0x000027db,
28680x000000fb,0x0000234c,0x000000f9,0x0000024d, 31810x000027e0,0x0004007c,0x00000014,0x000027d1,
28690x0004003d,0x00000006,0x0000234d,0x0000234c, 31820x000027e1,0x00060041,0x000000db,0x000027c8,
28700x000500b0,0x0000002f,0x0000234e,0x00002346, 31830x000027d1,0x000000da,0x000000da,0x0006003d,
28710x0000234d,0x000300f7,0x00002399,0x00000000, 31840x00000006,0x000027c9,0x000027c8,0x00000002,
28720x000400fa,0x0000234e,0x0000234f,0x00002399, 31850x00000004,0x0004007c,0x00000027,0x00002772,
28730x000200f8,0x0000234f,0x00050041,0x000000fb, 31860x000027c9,0x00050080,0x00000006,0x00002774,
28740x00002350,0x000000f9,0x00000263,0x0004003d, 31870x00002767,0x00000111,0x00050095,0x000000ab,
28750x00000006,0x00002351,0x00002350,0x000500aa, 31880x000027fa,0x000027b6,0x00002774,0x00050051,
28760x0000002f,0x00002352,0x00002351,0x0000037d, 31890x00000006,0x000027fb,0x000027fa,0x00000001,
28770x000300f7,0x0000237e,0x00000000,0x000400fa, 31900x00050051,0x00000006,0x000027fc,0x000027fa,
28780x00002352,0x00002353,0x00002370,0x000200f8, 31910x00000000,0x00050080,0x00000006,0x00002801,
28790x00002353,0x00050041,0x000000fb,0x000023f8, 31920x000027bd,0x000027fb,0x00050050,0x00000007,
28800x000000f9,0x000000fa,0x0004003d,0x00000006, 31930x00002802,0x000027fc,0x00002801,0x0004007c,
28810x000023f9,0x000023f8,0x00050084,0x00000006, 31940x00000014,0x000027f2,0x00002802,0x00060041,
28820x000023fa,0x00000107,0x000023f9,0x00050080, 31950x000000db,0x000027e9,0x000027f2,0x000000da,
28830x00000006,0x000023fb,0x00000104,0x000023fa, 31960x000000da,0x0006003d,0x00000006,0x000027ea,
28840x00050084,0x00000006,0x00002356,0x00000107, 31970x000027e9,0x00000002,0x00000004,0x0004007c,
28850x00002346,0x00050080,0x00000006,0x00002357, 31980x00000027,0x00002778,0x000027ea,0x00060050,
28860x000023fb,0x00002356,0x00050041,0x00000153, 31990x0000004b,0x00002779,0x0000276c,0x00002772,
28870x00002358,0x000000f9,0x00000151,0x0004003d, 32000x00002778,0x00050080,0x00000006,0x0000277b,
28880x00000007,0x00002359,0x00002358,0x00050051, 32010x00002767,0x00000118,0x00050095,0x000000ab,
28890x00000006,0x00002412,0x00002359,0x00000000, 32020x0000281b,0x000027b6,0x0000277b,0x00050051,
28900x00050095,0x000000a8,0x00002414,0x00002412, 32030x00000006,0x0000281c,0x0000281b,0x00000001,
28910x00002357,0x00050051,0x00000006,0x00002415, 32040x00050051,0x00000006,0x0000281d,0x0000281b,
28920x00002414,0x00000001,0x00050051,0x00000006, 32050x00000000,0x00050080,0x00000006,0x00002822,
28930x00002416,0x00002414,0x00000000,0x00050051, 32060x000027bd,0x0000281c,0x00050050,0x00000007,
28940x00000006,0x00002419,0x00002359,0x00000001, 32070x00002823,0x0000281d,0x00002822,0x0004007c,
28950x00050080,0x00000006,0x0000241b,0x00002419, 32080x00000014,0x00002813,0x00002823,0x00060041,
28960x00002415,0x00050050,0x00000007,0x0000241c, 32090x000000db,0x0000280a,0x00002813,0x000000da,
28970x00002416,0x0000241b,0x0004007c,0x00000014, 32100x000000da,0x0006003d,0x00000006,0x0000280b,
28980x0000240c,0x0000241c,0x00060041,0x000000d8, 32110x0000280a,0x00000002,0x00000004,0x0004007c,
28990x00002403,0x0000240c,0x000000d7,0x000000d7, 32120x00000027,0x0000277f,0x0000280b,0x00050080,
29000x0006003d,0x00000006,0x00002404,0x00002403, 32130x00000006,0x00002781,0x00002767,0x0000011f,
29010x00000002,0x00000004,0x00050041,0x000000fb, 32140x00050095,0x000000ab,0x0000283c,0x000027b6,
29020x0000241f,0x000000f9,0x00000229,0x0004003d, 32150x00002781,0x00050051,0x00000006,0x0000283d,
29030x00000006,0x00002420,0x0000241f,0x00050041, 32160x0000283c,0x00000001,0x00050051,0x00000006,
29040x000000fb,0x0000242e,0x000000f9,0x00000221, 32170x0000283e,0x0000283c,0x00000000,0x00050080,
29050x0004003d,0x00000006,0x0000242f,0x0000242e, 32180x00000006,0x00002843,0x000027bd,0x0000283d,
29060x000500ab,0x0000002f,0x00002430,0x0000242f, 32190x00050050,0x00000007,0x00002844,0x0000283e,
29070x000000a3,0x000600a9,0x00000006,0x00002431, 32200x00002843,0x0004007c,0x00000014,0x00002834,
29080x00002430,0x00000225,0x00000104,0x00050084, 32210x00002844,0x00060041,0x000000db,0x0000282b,
29090x00000006,0x00002423,0x00002404,0x00002431, 32220x00002834,0x000000da,0x000000da,0x0006003d,
29100x00050080,0x00000006,0x00002424,0x00002420, 32230x00000006,0x0000282c,0x0000282b,0x00000002,
29110x00002423,0x000500c2,0x00000006,0x00002425, 32240x00000004,0x0004007c,0x00000027,0x00002785,
29120x00002424,0x00000230,0x000500c4,0x00000006, 32250x0000282c,0x00050080,0x00000006,0x00002787,
29130x00002426,0x00002425,0x0000020a,0x000600a9, 32260x00002767,0x00000189,0x00050095,0x000000ab,
29140x00000006,0x0000242a,0x00002430,0x00000236, 32270x0000285d,0x000027b6,0x00002787,0x00050051,
29150x000000a3,0x000500c5,0x00000006,0x0000242b, 32280x00000006,0x0000285e,0x0000285d,0x00000001,
29160x00002426,0x0000242a,0x00050084,0x00000006, 32290x00050051,0x00000006,0x0000285f,0x0000285d,
29170x00002473,0x0000011c,0x000023f9,0x00050080, 32300x00000000,0x00050080,0x00000006,0x00002864,
29180x00000006,0x00002474,0x00000104,0x00002473, 32310x000027bd,0x0000285e,0x00050050,0x00000007,
29190x00050080,0x00000006,0x0000247a,0x000023f9, 32320x00002865,0x0000285f,0x00002864,0x0004007c,
29200x00002b67,0x00050086,0x00000006,0x0000247b, 32330x00000014,0x00002855,0x00002865,0x00060041,
29210x0000247a,0x000000fe,0x00050084,0x00000006, 32340x000000db,0x0000284c,0x00002855,0x000000da,
29220x0000246d,0x00000104,0x0000247b,0x00050080, 32350x000000da,0x0006003d,0x00000006,0x0000284d,
29230x00000006,0x0000246e,0x00002474,0x0000246d, 32360x0000284c,0x00000002,0x00000004,0x0004007c,
29240x00050084,0x00000006,0x00002442,0x0000014d, 32370x00000027,0x0000278b,0x0000284d,0x00060050,
29250x00002404,0x00050080,0x00000006,0x00002443, 32380x0000004b,0x0000278c,0x0000277f,0x00002785,
29260x0000246e,0x00002442,0x00050095,0x000000a8, 32390x0000278b,0x000200f9,0x00002676,0x000200f8,
29270x00002494,0x00002412,0x00002443,0x00050051, 32400x0000265c,0x00050041,0x000000fe,0x0000265e,
29280x00000006,0x00002495,0x00002494,0x00000001, 32410x000000fc,0x0000022c,0x0004003d,0x00000006,
29290x00050051,0x00000006,0x00002496,0x00002494, 32420x0000265f,0x0000265e,0x00050082,0x00000006,
29300x00000000,0x00050080,0x00000006,0x0000249b, 32430x00002660,0x0000264c,0x0000265f,0x00050041,
29310x00002419,0x00002495,0x00050050,0x00000007, 32440x000000fe,0x00002868,0x000000fc,0x00000224,
29320x0000249c,0x00002496,0x0000249b,0x0004007c, 32450x0004003d,0x00000006,0x00002869,0x00002868,
29330x00000014,0x0000248c,0x0000249c,0x00060041, 32460x000500ab,0x0000002f,0x0000286a,0x00002869,
29340x000000d8,0x00002483,0x0000248c,0x000000d7, 32470x000000a6,0x000600a9,0x00000006,0x0000286b,
29350x000000d7,0x0006003d,0x00000006,0x00002484, 32480x0000286a,0x00000228,0x00000107,0x00050086,
29360x00002483,0x00000002,0x00000004,0x0004007c, 32490x00000006,0x00002662,0x00002660,0x0000286b,
29370x00000027,0x00002448,0x00002484,0x00050080, 32500x00050041,0x000000fe,0x000028ab,0x000000fc,
29380x00000006,0x0000244a,0x00002443,0x00000107, 32510x000000fd,0x0004003d,0x00000006,0x000028ac,
29390x00050095,0x000000a8,0x000024b5,0x00002412, 32520x000028ab,0x00050084,0x00000006,0x000028ad,
29400x0000244a,0x00050051,0x00000006,0x000024b6, 32530x0000011f,0x000028ac,0x00050080,0x00000006,
29410x000024b5,0x00000001,0x00050051,0x00000006, 32540x000028ae,0x00000107,0x000028ad,0x00050080,
29420x000024b7,0x000024b5,0x00000000,0x00050080, 32550x00000006,0x000028b4,0x000028ac,0x0000319c,
29430x00000006,0x000024bc,0x00002419,0x000024b6, 32560x00050086,0x00000006,0x000028b5,0x000028b4,
29440x00050050,0x00000007,0x000024bd,0x000024b7, 32570x00000101,0x00050084,0x00000006,0x000028a7,
29450x000024bc,0x0004007c,0x00000014,0x000024ad, 32580x00000107,0x000028b5,0x00050080,0x00000006,
29460x000024bd,0x00060041,0x000000d8,0x000024a4, 32590x000028a8,0x000028ae,0x000028a7,0x00050084,
29470x000024ad,0x000000d7,0x000000d7,0x0006003d, 32600x00000006,0x0000287c,0x00000150,0x00002662,
29480x00000006,0x000024a5,0x000024a4,0x00000002, 32610x00050080,0x00000006,0x0000287d,0x000028a8,
29490x00000004,0x0004007c,0x00000027,0x0000244e, 32620x0000287c,0x00050041,0x00000156,0x0000287e,
29500x000024a5,0x00050080,0x00000006,0x00002450, 32630x000000fc,0x00000154,0x0004003d,0x00000007,
29510x00002443,0x0000010e,0x00050095,0x000000a8, 32640x0000287f,0x0000287e,0x00050051,0x00000006,
29520x000024d6,0x00002412,0x00002450,0x00050051, 32650x000028cc,0x0000287f,0x00000000,0x00050095,
29530x00000006,0x000024d7,0x000024d6,0x00000001, 32660x000000ab,0x000028ce,0x000028cc,0x0000287d,
29540x00050051,0x00000006,0x000024d8,0x000024d6, 32670x00050051,0x00000006,0x000028cf,0x000028ce,
29550x00000000,0x00050080,0x00000006,0x000024dd, 32680x00000001,0x00050051,0x00000006,0x000028d0,
29560x00002419,0x000024d7,0x00050050,0x00000007, 32690x000028ce,0x00000000,0x00050051,0x00000006,
29570x000024de,0x000024d8,0x000024dd,0x0004007c, 32700x000028d3,0x0000287f,0x00000001,0x00050080,
29580x00000014,0x000024ce,0x000024de,0x00060041, 32710x00000006,0x000028d5,0x000028d3,0x000028cf,
29590x000000d8,0x000024c5,0x000024ce,0x000000d7, 32720x00050050,0x00000007,0x000028d6,0x000028d0,
29600x000000d7,0x0006003d,0x00000006,0x000024c6, 32730x000028d5,0x0004007c,0x00000014,0x000028c6,
29610x000024c5,0x00000002,0x00000004,0x0004007c, 32740x000028d6,0x00060041,0x000000db,0x000028bd,
29620x00000027,0x00002454,0x000024c6,0x00060050, 32750x000028c6,0x000000da,0x000000da,0x0006003d,
29630x0000004b,0x00002455,0x00002448,0x0000244e, 32760x00000006,0x000028be,0x000028bd,0x00000002,
29640x00002454,0x00050080,0x00000006,0x00002457, 32770x00000004,0x0004007c,0x00000027,0x00002882,
29650x00002443,0x00000115,0x00050095,0x000000a8, 32780x000028be,0x00050080,0x00000006,0x00002884,
29660x000024f7,0x00002412,0x00002457,0x00050051, 32790x0000287d,0x0000010a,0x00050095,0x000000ab,
29670x00000006,0x000024f8,0x000024f7,0x00000001, 32800x000028ef,0x000028cc,0x00002884,0x00050051,
29680x00050051,0x00000006,0x000024f9,0x000024f7, 32810x00000006,0x000028f0,0x000028ef,0x00000001,
29690x00000000,0x00050080,0x00000006,0x000024fe, 32820x00050051,0x00000006,0x000028f1,0x000028ef,
29700x00002419,0x000024f8,0x00050050,0x00000007, 32830x00000000,0x00050080,0x00000006,0x000028f6,
29710x000024ff,0x000024f9,0x000024fe,0x0004007c, 32840x000028d3,0x000028f0,0x00050050,0x00000007,
29720x00000014,0x000024ef,0x000024ff,0x00060041, 32850x000028f7,0x000028f1,0x000028f6,0x0004007c,
29730x000000d8,0x000024e6,0x000024ef,0x000000d7, 32860x00000014,0x000028e7,0x000028f7,0x00060041,
29740x000000d7,0x0006003d,0x00000006,0x000024e7, 32870x000000db,0x000028de,0x000028e7,0x000000da,
29750x000024e6,0x00000002,0x00000004,0x0004007c, 32880x000000da,0x0006003d,0x00000006,0x000028df,
29760x00000027,0x0000245b,0x000024e7,0x00050080, 32890x000028de,0x00000002,0x00000004,0x0004007c,
29770x00000006,0x0000245d,0x00002443,0x0000011c, 32900x00000027,0x00002888,0x000028df,0x00050080,
29780x00050095,0x000000a8,0x00002518,0x00002412, 32910x00000006,0x0000288a,0x0000287d,0x00000111,
29790x0000245d,0x00050051,0x00000006,0x00002519, 32920x00050095,0x000000ab,0x00002910,0x000028cc,
29800x00002518,0x00000001,0x00050051,0x00000006, 32930x0000288a,0x00050051,0x00000006,0x00002911,
29810x0000251a,0x00002518,0x00000000,0x00050080, 32940x00002910,0x00000001,0x00050051,0x00000006,
29820x00000006,0x0000251f,0x00002419,0x00002519, 32950x00002912,0x00002910,0x00000000,0x00050080,
29830x00050050,0x00000007,0x00002520,0x0000251a, 32960x00000006,0x00002917,0x000028d3,0x00002911,
29840x0000251f,0x0004007c,0x00000014,0x00002510, 32970x00050050,0x00000007,0x00002918,0x00002912,
29850x00002520,0x00060041,0x000000d8,0x00002507, 32980x00002917,0x0004007c,0x00000014,0x00002908,
29860x00002510,0x000000d7,0x000000d7,0x0006003d, 32990x00002918,0x00060041,0x000000db,0x000028ff,
29870x00000006,0x00002508,0x00002507,0x00000002, 33000x00002908,0x000000da,0x000000da,0x0006003d,
29880x00000004,0x0004007c,0x00000027,0x00002461, 33010x00000006,0x00002900,0x000028ff,0x00000002,
29890x00002508,0x00050080,0x00000006,0x00002463, 33020x00000004,0x0004007c,0x00000027,0x0000288e,
29900x00002443,0x00000186,0x00050095,0x000000a8, 33030x00002900,0x00060050,0x0000004b,0x0000288f,
29910x00002539,0x00002412,0x00002463,0x00050051, 33040x00002882,0x00002888,0x0000288e,0x00050080,
29920x00000006,0x0000253a,0x00002539,0x00000001, 33050x00000006,0x00002891,0x0000287d,0x00000118,
29930x00050051,0x00000006,0x0000253b,0x00002539, 33060x00050095,0x000000ab,0x00002931,0x000028cc,
29940x00000000,0x00050080,0x00000006,0x00002540, 33070x00002891,0x00050051,0x00000006,0x00002932,
29950x00002419,0x0000253a,0x00050050,0x00000007, 33080x00002931,0x00000001,0x00050051,0x00000006,
29960x00002541,0x0000253b,0x00002540,0x0004007c, 33090x00002933,0x00002931,0x00000000,0x00050080,
29970x00000014,0x00002531,0x00002541,0x00060041, 33100x00000006,0x00002938,0x000028d3,0x00002932,
29980x000000d8,0x00002528,0x00002531,0x000000d7, 33110x00050050,0x00000007,0x00002939,0x00002933,
29990x000000d7,0x0006003d,0x00000006,0x00002529, 33120x00002938,0x0004007c,0x00000014,0x00002929,
30000x00002528,0x00000002,0x00000004,0x0004007c, 33130x00002939,0x00060041,0x000000db,0x00002920,
30010x00000027,0x00002467,0x00002529,0x00060050, 33140x00002929,0x000000da,0x000000da,0x0006003d,
30020x0000004b,0x00002468,0x0000245b,0x00002461, 33150x00000006,0x00002921,0x00002920,0x00000002,
30030x00002467,0x000300f7,0x0000236f,0x00000000, 33160x00000004,0x0004007c,0x00000027,0x00002895,
30040x000400fa,0x00002430,0x00002364,0x0000236f, 33170x00002921,0x00050080,0x00000006,0x00002897,
30050x000200f8,0x00002364,0x00050084,0x00000006, 33180x0000287d,0x0000011f,0x00050095,0x000000ab,
30060x00002368,0x00000225,0x00002404,0x00050080, 33190x00002952,0x000028cc,0x00002897,0x00050051,
30070x00000006,0x00002369,0x00002420,0x00002368, 33200x00000006,0x00002953,0x00002952,0x00000001,
30080x00050080,0x00000006,0x0000236a,0x00002369, 33210x00050051,0x00000006,0x00002954,0x00002952,
30090x000005cd,0x00050041,0x00000153,0x0000236b, 33220x00000000,0x00050080,0x00000006,0x00002959,
30100x000000f9,0x000000d7,0x0004003d,0x00000007, 33230x000028d3,0x00002953,0x00050050,0x00000007,
30110x0000236c,0x0000236b,0x00050051,0x00000006, 33240x0000295a,0x00002954,0x00002959,0x0004007c,
30120x00002557,0x0000236c,0x00000000,0x00050095, 33250x00000014,0x0000294a,0x0000295a,0x00060041,
30130x000000a8,0x00002559,0x00002557,0x0000236a, 33260x000000db,0x00002941,0x0000294a,0x000000da,
30140x00050051,0x00000006,0x0000255a,0x00002559, 33270x000000da,0x0006003d,0x00000006,0x00002942,
30150x00000001,0x00050051,0x00000006,0x0000255b, 33280x00002941,0x00000002,0x00000004,0x0004007c,
30160x00002559,0x00000000,0x00050051,0x00000006, 33290x00000027,0x0000289b,0x00002942,0x00050080,
30170x0000255e,0x0000236c,0x00000001,0x00050080, 33300x00000006,0x0000289d,0x0000287d,0x00000189,
30180x00000006,0x00002560,0x0000255e,0x0000255a, 33310x00050095,0x000000ab,0x00002973,0x000028cc,
30190x00050050,0x00000007,0x00002561,0x0000255b, 33320x0000289d,0x00050051,0x00000006,0x00002974,
30200x00002560,0x0004007c,0x00000014,0x00002551, 33330x00002973,0x00000001,0x00050051,0x00000006,
30210x00002561,0x00060041,0x000000d8,0x00002549, 33340x00002975,0x00002973,0x00000000,0x00050080,
30220x00002551,0x000000d7,0x000000d7,0x0005003e, 33350x00000006,0x0000297a,0x000028d3,0x00002974,
30230x00002549,0x000023f5,0x00000002,0x00000004, 33360x00050050,0x00000007,0x0000297b,0x00002975,
30240x000200f9,0x0000236f,0x000200f8,0x0000236f, 33370x0000297a,0x0004007c,0x00000014,0x0000296b,
30250x000200f9,0x0000237e,0x000200f8,0x00002370, 33380x0000297b,0x00060041,0x000000db,0x00002962,
30260x00050080,0x00000006,0x00002374,0x00002351, 33390x0000296b,0x000000da,0x000000da,0x0006003d,
30270x00002346,0x00050084,0x00000006,0x00002567, 33400x00000006,0x00002963,0x00002962,0x00000002,
30280x00002374,0x00000225,0x00050080,0x00000006, 33410x00000004,0x0004007c,0x00000027,0x000028a1,
30290x00002568,0x000023ef,0x00002567,0x000500c2, 33420x00002963,0x00060050,0x0000004b,0x000028a2,
30300x00000006,0x00002569,0x00002568,0x00000230, 33430x00002895,0x0000289b,0x000028a1,0x000300f7,
30310x000500c4,0x00000006,0x0000256a,0x00002569, 33440x00002675,0x00000000,0x000400fa,0x0000286a,
30320x0000020a,0x000500c5,0x00000006,0x0000256b, 33450x0000266a,0x00002675,0x000200f8,0x0000266a,
30330x0000256a,0x00000243,0x00050041,0x000000fb, 33460x00050084,0x00000006,0x0000266e,0x00000228,
30340x00002377,0x000000f9,0x000008bc,0x0004003d, 33470x00002662,0x00050080,0x00000006,0x0000266f,
30350x00000006,0x00002378,0x00002377,0x00050080, 33480x0000265f,0x0000266e,0x00050080,0x00000006,
30360x00000006,0x0000237a,0x00002378,0x00002374, 33490x00002670,0x0000266f,0x000005d0,0x00050095,
30370x00050041,0x000000fb,0x000025ab,0x000000f9, 33500x000000ab,0x00002993,0x00002747,0x00002670,
30380x000000fa,0x0004003d,0x00000006,0x000025ac, 33510x00050051,0x00000006,0x00002994,0x00002993,
30390x000025ab,0x00050084,0x00000006,0x000025ad, 33520x00000001,0x00050051,0x00000006,0x00002995,
30400x0000011c,0x000025ac,0x00050080,0x00000006, 33530x00002993,0x00000000,0x00050080,0x00000006,
30410x000025ae,0x00000104,0x000025ad,0x00050080, 33540x0000299a,0x0000274e,0x00002994,0x00050050,
30420x00000006,0x000025b4,0x000025ac,0x00002b67, 33550x00000007,0x0000299b,0x00002995,0x0000299a,
30430x00050086,0x00000006,0x000025b5,0x000025b4, 33560x0004007c,0x00000014,0x0000298b,0x0000299b,
30440x000000fe,0x00050084,0x00000006,0x000025a7, 33570x00060041,0x000000db,0x00002983,0x0000298b,
30450x00000104,0x000025b5,0x00050080,0x00000006, 33580x000000da,0x000000da,0x0005003e,0x00002983,
30460x000025a8,0x000025ae,0x000025a7,0x00050084, 33590x00002730,0x00000002,0x00000004,0x000200f9,
30470x00000006,0x0000257c,0x0000014d,0x0000237a, 33600x00002675,0x000200f8,0x00002675,0x000200f9,
30480x00050080,0x00000006,0x0000257d,0x000025a8, 33610x00002676,0x000200f8,0x00002676,0x000700f5,
30490x0000257c,0x00050041,0x00000153,0x0000257e, 33620x0000004b,0x000030ab,0x0000278c,0x00002650,
30500x000000f9,0x00000151,0x0004003d,0x00000007, 33630x000028a2,0x00002675,0x000700f5,0x0000004b,
30510x0000257f,0x0000257e,0x00050051,0x00000006, 33640x000030a9,0x00002779,0x00002650,0x0000288f,
30520x000025cc,0x0000257f,0x00000000,0x00050095, 33650x00002675,0x00050051,0x00000027,0x0000299f,
30530x000000a8,0x000025ce,0x000025cc,0x0000257d, 33660x000030a9,0x00000000,0x00050051,0x00000027,
30540x00050051,0x00000006,0x000025cf,0x000025ce, 33670x000029a1,0x000030ab,0x00000000,0x000500bc,
30550x00000001,0x00050051,0x00000006,0x000025d0, 33680x0000002f,0x000029a2,0x0000299f,0x000029a1,
30560x000025ce,0x00000000,0x00050051,0x00000006, 33690x000300f7,0x000029a9,0x00000000,0x000400fa,
30570x000025d3,0x0000257f,0x00000001,0x00050080, 33700x000029a2,0x000029a3,0x000029a9,0x000200f8,
30580x00000006,0x000025d5,0x000025d3,0x000025cf, 33710x000029a3,0x00050051,0x00000027,0x000029a5,
30590x00050050,0x00000007,0x000025d6,0x000025d0, 33720x000030a9,0x00000001,0x00050051,0x00000027,
30600x000025d5,0x0004007c,0x00000014,0x000025c6, 33730x000029a7,0x000030ab,0x00000001,0x000500bc,
30610x000025d6,0x00060041,0x000000d8,0x000025bd, 33740x0000002f,0x000029a8,0x000029a5,0x000029a7,
30620x000025c6,0x000000d7,0x000000d7,0x0006003d, 33750x000200f9,0x000029a9,0x000200f8,0x000029a9,
30630x00000006,0x000025be,0x000025bd,0x00000002, 33760x000700f5,0x0000002f,0x000029aa,0x000029a2,
30640x00000004,0x0004007c,0x00000027,0x00002582, 33770x00002676,0x000029a8,0x000029a3,0x000300f7,
30650x000025be,0x00050080,0x00000006,0x00002584, 33780x000029b1,0x00000000,0x000400fa,0x000029aa,
30660x0000257d,0x00000107,0x00050095,0x000000a8, 33790x000029ab,0x000029b1,0x000200f8,0x000029ab,
30670x000025ef,0x000025cc,0x00002584,0x00050051, 33800x00050051,0x00000027,0x000029ad,0x000030a9,
30680x00000006,0x000025f0,0x000025ef,0x00000001, 33810x00000002,0x00050051,0x00000027,0x000029af,
30690x00050051,0x00000006,0x000025f1,0x000025ef, 33820x000030ab,0x00000002,0x000500bc,0x0000002f,
30700x00000000,0x00050080,0x00000006,0x000025f6, 33830x000029b0,0x000029ad,0x000029af,0x000200f9,
30710x000025d3,0x000025f0,0x00050050,0x00000007, 33840x000029b1,0x000200f8,0x000029b1,0x000700f5,
30720x000025f7,0x000025f1,0x000025f6,0x0004007c, 33850x0000002f,0x000029b2,0x000029aa,0x000029a9,
30730x00000014,0x000025e7,0x000025f7,0x00060041, 33860x000029b0,0x000029ab,0x000300f7,0x00002682,
30740x000000d8,0x000025de,0x000025e7,0x000000d7, 33870x00000000,0x000400fa,0x000029b2,0x0000267b,
30750x000000d7,0x0006003d,0x00000006,0x000025df, 33880x00002682,0x000200f8,0x0000267b,0x0007000c,
30760x000025de,0x00000002,0x00000004,0x0004007c, 33890x0000004b,0x0000267e,0x00000001,0x00000025,
30770x00000027,0x00002588,0x000025df,0x00050080, 33900x00003094,0x000030a9,0x0007000c,0x0000004b,
30780x00000006,0x0000258a,0x0000257d,0x0000010e, 33910x00002681,0x00000001,0x00000028,0x00003096,
30790x00050095,0x000000a8,0x00002610,0x000025cc, 33920x000030ab,0x000200f9,0x00002682,0x000200f8,
30800x0000258a,0x00050051,0x00000006,0x00002611, 33930x00002682,0x000700f5,0x0000004b,0x00003181,
30810x00002610,0x00000001,0x00050051,0x00000006, 33940x00003096,0x000029b1,0x00002681,0x0000267b,
30820x00002612,0x00002610,0x00000000,0x00050080, 33950x000700f5,0x0000004b,0x0000317c,0x00003094,
30830x00000006,0x00002617,0x000025d3,0x00002611, 33960x000029b1,0x0000267e,0x0000267b,0x000200f9,
30840x00050050,0x00000007,0x00002618,0x00002612, 33970x00002683,0x000200f8,0x00002683,0x000700f5,
30850x00002617,0x0004007c,0x00000014,0x00002608, 33980x0000004b,0x00003180,0x00003096,0x0000263f,
30860x00002618,0x00060041,0x000000d8,0x000025ff, 33990x00003181,0x00002682,0x000700f5,0x0000004b,
30870x00002608,0x000000d7,0x000000d7,0x0006003d, 34000x0000317b,0x00003094,0x0000263f,0x0000317c,
30880x00000006,0x00002600,0x000025ff,0x00000002, 34010x00002682,0x000700f5,0x0000004b,0x000030d7,
30890x00000004,0x0004007c,0x00000027,0x0000258e, 34020x0000319b,0x0000263f,0x000030ab,0x00002682,
30900x00002600,0x00060050,0x0000004b,0x0000258f, 34030x000700f5,0x0000004b,0x000030d2,0x00003199,
30910x00002582,0x00002588,0x0000258e,0x00050080, 34040x0000263f,0x000030a9,0x00002682,0x000200f9,
30920x00000006,0x00002591,0x0000257d,0x00000115, 34050x000026d4,0x000200f8,0x00002684,0x00050041,
30930x00050095,0x000000a8,0x00002631,0x000025cc, 34060x000000fe,0x00002686,0x000000fc,0x00000250,
30940x00002591,0x00050051,0x00000006,0x00002632, 34070x0004003d,0x00000006,0x00002687,0x00002686,
30950x00002631,0x00000001,0x00050051,0x00000006, 34080x000500b0,0x0000002f,0x00002688,0x00002637,
30960x00002633,0x00002631,0x00000000,0x00050080, 34090x00002687,0x000300f7,0x000026d3,0x00000000,
30970x00000006,0x00002638,0x000025d3,0x00002632, 34100x000400fa,0x00002688,0x00002689,0x000026d3,
30980x00050050,0x00000007,0x00002639,0x00002633, 34110x000200f8,0x00002689,0x00050041,0x000000fe,
30990x00002638,0x0004007c,0x00000014,0x00002629, 34120x0000268a,0x000000fc,0x00000266,0x0004003d,
31000x00002639,0x00060041,0x000000d8,0x00002620, 34130x00000006,0x0000268b,0x0000268a,0x000500aa,
31010x00002629,0x000000d7,0x000000d7,0x0006003d, 34140x0000002f,0x0000268c,0x0000268b,0x00000380,
31020x00000006,0x00002621,0x00002620,0x00000002, 34150x000300f7,0x000026b8,0x00000000,0x000400fa,
31030x00000004,0x0004007c,0x00000027,0x00002595, 34160x0000268c,0x0000268d,0x000026aa,0x000200f8,
31040x00002621,0x00050080,0x00000006,0x00002597, 34170x0000268d,0x00050041,0x000000fe,0x000029b6,
31050x0000257d,0x0000011c,0x00050095,0x000000a8, 34180x000000fc,0x000000fd,0x0004003d,0x00000006,
31060x00002652,0x000025cc,0x00002597,0x00050051, 34190x000029b7,0x000029b6,0x00050084,0x00000006,
31070x00000006,0x00002653,0x00002652,0x00000001, 34200x000029b8,0x0000010a,0x000029b7,0x00050080,
31080x00050051,0x00000006,0x00002654,0x00002652, 34210x00000006,0x000029b9,0x00000107,0x000029b8,
31090x00000000,0x00050080,0x00000006,0x00002659, 34220x00050084,0x00000006,0x00002690,0x0000010a,
31100x000025d3,0x00002653,0x00050050,0x00000007, 34230x00002637,0x00050080,0x00000006,0x00002691,
31110x0000265a,0x00002654,0x00002659,0x0004007c, 34240x000029b9,0x00002690,0x00050041,0x00000156,
31120x00000014,0x0000264a,0x0000265a,0x00060041, 34250x00002692,0x000000fc,0x00000154,0x0004003d,
31130x000000d8,0x00002641,0x0000264a,0x000000d7, 34260x00000007,0x00002693,0x00002692,0x00050051,
31140x000000d7,0x0006003d,0x00000006,0x00002642, 34270x00000006,0x000029d0,0x00002693,0x00000000,
31150x00002641,0x00000002,0x00000004,0x0004007c, 34280x00050095,0x000000ab,0x000029d2,0x000029d0,
31160x00000027,0x0000259b,0x00002642,0x00050080, 34290x00002691,0x00050051,0x00000006,0x000029d3,
31170x00000006,0x0000259d,0x0000257d,0x00000186, 34300x000029d2,0x00000001,0x00050051,0x00000006,
31180x00050095,0x000000a8,0x00002673,0x000025cc, 34310x000029d4,0x000029d2,0x00000000,0x00050051,
31190x0000259d,0x00050051,0x00000006,0x00002674, 34320x00000006,0x000029d7,0x00002693,0x00000001,
31200x00002673,0x00000001,0x00050051,0x00000006, 34330x00050080,0x00000006,0x000029d9,0x000029d7,
31210x00002675,0x00002673,0x00000000,0x00050080, 34340x000029d3,0x00050050,0x00000007,0x000029da,
31220x00000006,0x0000267a,0x000025d3,0x00002674, 34350x000029d4,0x000029d9,0x0004007c,0x00000014,
31230x00050050,0x00000007,0x0000267b,0x00002675, 34360x000029ca,0x000029da,0x00060041,0x000000db,
31240x0000267a,0x0004007c,0x00000014,0x0000266b, 34370x000029c1,0x000029ca,0x000000da,0x000000da,
31250x0000267b,0x00060041,0x000000d8,0x00002662, 34380x0006003d,0x00000006,0x000029c2,0x000029c1,
31260x0000266b,0x000000d7,0x000000d7,0x0006003d, 34390x00000002,0x00000004,0x00050041,0x000000fe,
31270x00000006,0x00002663,0x00002662,0x00000002, 34400x000029dd,0x000000fc,0x0000022c,0x0004003d,
31280x00000004,0x0004007c,0x00000027,0x000025a1, 34410x00000006,0x000029de,0x000029dd,0x00050041,
31290x00002663,0x00060050,0x0000004b,0x000025a2, 34420x000000fe,0x000029ec,0x000000fc,0x00000224,
31300x00002595,0x0000259b,0x000025a1,0x000200f9, 34430x0004003d,0x00000006,0x000029ed,0x000029ec,
31310x0000237e,0x000200f8,0x0000237e,0x000700f5, 34440x000500ab,0x0000002f,0x000029ee,0x000029ed,
31320x0000004b,0x00002aaf,0x00002468,0x0000236f, 34450x000000a6,0x000600a9,0x00000006,0x000029ef,
31330x000025a2,0x00002370,0x000700f5,0x0000004b, 34460x000029ee,0x00000228,0x00000107,0x00050084,
31340x00002aad,0x00002455,0x0000236f,0x0000258f, 34470x00000006,0x000029e1,0x000029c2,0x000029ef,
31350x00002370,0x000700f5,0x00000006,0x00002aab, 34480x00050080,0x00000006,0x000029e2,0x000029de,
31360x0000242b,0x0000236f,0x0000256b,0x00002370, 34490x000029e1,0x000500c2,0x00000006,0x000029e3,
31370x00050041,0x000000fb,0x0000237f,0x000000f9, 34500x000029e2,0x00000233,0x000500c4,0x00000006,
31380x000008c7,0x0004003d,0x00000006,0x00002380, 34510x000029e4,0x000029e3,0x0000020d,0x000600a9,
31390x0000237f,0x000500c2,0x00000006,0x0000267f, 34520x00000006,0x000029e8,0x000029ee,0x00000239,
31400x00002aab,0x0000020a,0x00050041,0x000000fb, 34530x000000a6,0x000500c5,0x00000006,0x000029e9,
31410x00002383,0x000000f9,0x00000229,0x0004003d, 34540x000029e4,0x000029e8,0x00050084,0x00000006,
31420x00000006,0x00002384,0x00002383,0x00050086, 34550x00002a31,0x0000011f,0x000029b7,0x00050080,
31430x00000006,0x00002385,0x00002384,0x00000104, 34560x00000006,0x00002a32,0x00000107,0x00002a31,
31440x00050082,0x00000006,0x00002386,0x0000267f, 34570x00050080,0x00000006,0x00002a38,0x000029b7,
31450x00002385,0x00050084,0x00000006,0x00002387, 34580x0000319c,0x00050086,0x00000006,0x00002a39,
31460x00000107,0x00002386,0x00050080,0x00000006, 34590x00002a38,0x00000101,0x00050084,0x00000006,
31470x00002388,0x00002380,0x00002387,0x00050041, 34600x00002a2b,0x00000107,0x00002a39,0x00050080,
31480x00000153,0x00002389,0x000000f9,0x000000d7, 34610x00000006,0x00002a2c,0x00002a32,0x00002a2b,
31490x0004003d,0x00000007,0x0000238a,0x00002389, 34620x00050084,0x00000006,0x00002a00,0x00000150,
31500x00050051,0x00000006,0x00002695,0x0000238a, 34630x000029c2,0x00050080,0x00000006,0x00002a01,
31510x00000000,0x00050095,0x000000a8,0x00002697, 34640x00002a2c,0x00002a00,0x00050095,0x000000ab,
31520x00002695,0x00002388,0x00050051,0x00000006, 34650x00002a52,0x000029d0,0x00002a01,0x00050051,
31530x00002698,0x00002697,0x00000001,0x00050051, 34660x00000006,0x00002a53,0x00002a52,0x00000001,
31540x00000006,0x00002699,0x00002697,0x00000000, 34670x00050051,0x00000006,0x00002a54,0x00002a52,
31550x00050051,0x00000006,0x0000269c,0x0000238a, 34680x00000000,0x00050080,0x00000006,0x00002a59,
31560x00000001,0x00050080,0x00000006,0x0000269e, 34690x000029d7,0x00002a53,0x00050050,0x00000007,
31570x0000269c,0x00002698,0x00050050,0x00000007, 34700x00002a5a,0x00002a54,0x00002a59,0x0004007c,
31580x0000269f,0x00002699,0x0000269e,0x0004007c, 34710x00000014,0x00002a4a,0x00002a5a,0x00060041,
31590x00000014,0x0000268f,0x0000269f,0x00060041, 34720x000000db,0x00002a41,0x00002a4a,0x000000da,
31600x000000d8,0x00002687,0x0000268f,0x000000d7, 34730x000000da,0x0006003d,0x00000006,0x00002a42,
31610x000000d7,0x0005003e,0x00002687,0x000023f5, 34740x00002a41,0x00000002,0x00000004,0x0004007c,
34750x00000027,0x00002a06,0x00002a42,0x00050080,
34760x00000006,0x00002a08,0x00002a01,0x0000010a,
34770x00050095,0x000000ab,0x00002a73,0x000029d0,
34780x00002a08,0x00050051,0x00000006,0x00002a74,
34790x00002a73,0x00000001,0x00050051,0x00000006,
34800x00002a75,0x00002a73,0x00000000,0x00050080,
34810x00000006,0x00002a7a,0x000029d7,0x00002a74,
34820x00050050,0x00000007,0x00002a7b,0x00002a75,
34830x00002a7a,0x0004007c,0x00000014,0x00002a6b,
34840x00002a7b,0x00060041,0x000000db,0x00002a62,
34850x00002a6b,0x000000da,0x000000da,0x0006003d,
34860x00000006,0x00002a63,0x00002a62,0x00000002,
34870x00000004,0x0004007c,0x00000027,0x00002a0c,
34880x00002a63,0x00050080,0x00000006,0x00002a0e,
34890x00002a01,0x00000111,0x00050095,0x000000ab,
34900x00002a94,0x000029d0,0x00002a0e,0x00050051,
34910x00000006,0x00002a95,0x00002a94,0x00000001,
34920x00050051,0x00000006,0x00002a96,0x00002a94,
34930x00000000,0x00050080,0x00000006,0x00002a9b,
34940x000029d7,0x00002a95,0x00050050,0x00000007,
34950x00002a9c,0x00002a96,0x00002a9b,0x0004007c,
34960x00000014,0x00002a8c,0x00002a9c,0x00060041,
34970x000000db,0x00002a83,0x00002a8c,0x000000da,
34980x000000da,0x0006003d,0x00000006,0x00002a84,
34990x00002a83,0x00000002,0x00000004,0x0004007c,
35000x00000027,0x00002a12,0x00002a84,0x00060050,
35010x0000004b,0x00002a13,0x00002a06,0x00002a0c,
35020x00002a12,0x00050080,0x00000006,0x00002a15,
35030x00002a01,0x00000118,0x00050095,0x000000ab,
35040x00002ab5,0x000029d0,0x00002a15,0x00050051,
35050x00000006,0x00002ab6,0x00002ab5,0x00000001,
35060x00050051,0x00000006,0x00002ab7,0x00002ab5,
35070x00000000,0x00050080,0x00000006,0x00002abc,
35080x000029d7,0x00002ab6,0x00050050,0x00000007,
35090x00002abd,0x00002ab7,0x00002abc,0x0004007c,
35100x00000014,0x00002aad,0x00002abd,0x00060041,
35110x000000db,0x00002aa4,0x00002aad,0x000000da,
35120x000000da,0x0006003d,0x00000006,0x00002aa5,
35130x00002aa4,0x00000002,0x00000004,0x0004007c,
35140x00000027,0x00002a19,0x00002aa5,0x00050080,
35150x00000006,0x00002a1b,0x00002a01,0x0000011f,
35160x00050095,0x000000ab,0x00002ad6,0x000029d0,
35170x00002a1b,0x00050051,0x00000006,0x00002ad7,
35180x00002ad6,0x00000001,0x00050051,0x00000006,
35190x00002ad8,0x00002ad6,0x00000000,0x00050080,
35200x00000006,0x00002add,0x000029d7,0x00002ad7,
35210x00050050,0x00000007,0x00002ade,0x00002ad8,
35220x00002add,0x0004007c,0x00000014,0x00002ace,
35230x00002ade,0x00060041,0x000000db,0x00002ac5,
35240x00002ace,0x000000da,0x000000da,0x0006003d,
35250x00000006,0x00002ac6,0x00002ac5,0x00000002,
35260x00000004,0x0004007c,0x00000027,0x00002a1f,
35270x00002ac6,0x00050080,0x00000006,0x00002a21,
35280x00002a01,0x00000189,0x00050095,0x000000ab,
35290x00002af7,0x000029d0,0x00002a21,0x00050051,
35300x00000006,0x00002af8,0x00002af7,0x00000001,
35310x00050051,0x00000006,0x00002af9,0x00002af7,
35320x00000000,0x00050080,0x00000006,0x00002afe,
35330x000029d7,0x00002af8,0x00050050,0x00000007,
35340x00002aff,0x00002af9,0x00002afe,0x0004007c,
35350x00000014,0x00002aef,0x00002aff,0x00060041,
35360x000000db,0x00002ae6,0x00002aef,0x000000da,
35370x000000da,0x0006003d,0x00000006,0x00002ae7,
35380x00002ae6,0x00000002,0x00000004,0x0004007c,
35390x00000027,0x00002a25,0x00002ae7,0x00060050,
35400x0000004b,0x00002a26,0x00002a19,0x00002a1f,
35410x00002a25,0x000300f7,0x000026a9,0x00000000,
35420x000400fa,0x000029ee,0x0000269e,0x000026a9,
35430x000200f8,0x0000269e,0x00050084,0x00000006,
35440x000026a2,0x00000228,0x000029c2,0x00050080,
35450x00000006,0x000026a3,0x000029de,0x000026a2,
35460x00050080,0x00000006,0x000026a4,0x000026a3,
35470x000005d0,0x00050041,0x00000156,0x000026a5,
35480x000000fc,0x000000da,0x0004003d,0x00000007,
35490x000026a6,0x000026a5,0x00050051,0x00000006,
35500x00002b15,0x000026a6,0x00000000,0x00050095,
35510x000000ab,0x00002b17,0x00002b15,0x000026a4,
35520x00050051,0x00000006,0x00002b18,0x00002b17,
35530x00000001,0x00050051,0x00000006,0x00002b19,
35540x00002b17,0x00000000,0x00050051,0x00000006,
35550x00002b1c,0x000026a6,0x00000001,0x00050080,
35560x00000006,0x00002b1e,0x00002b1c,0x00002b18,
35570x00050050,0x00000007,0x00002b1f,0x00002b19,
35580x00002b1e,0x0004007c,0x00000014,0x00002b0f,
35590x00002b1f,0x00060041,0x000000db,0x00002b07,
35600x00002b0f,0x000000da,0x000000da,0x0005003e,
35610x00002b07,0x00002730,0x00000002,0x00000004,
35620x000200f9,0x000026a9,0x000200f8,0x000026a9,
35630x000200f9,0x000026b8,0x000200f8,0x000026aa,
35640x00050080,0x00000006,0x000026ae,0x0000268b,
35650x00002637,0x00050084,0x00000006,0x00002b25,
35660x000026ae,0x00000228,0x00050080,0x00000006,
35670x00002b26,0x0000272a,0x00002b25,0x000500c2,
35680x00000006,0x00002b27,0x00002b26,0x00000233,
35690x000500c4,0x00000006,0x00002b28,0x00002b27,
35700x0000020d,0x000500c5,0x00000006,0x00002b29,
35710x00002b28,0x00000246,0x00050041,0x000000fe,
35720x000026b1,0x000000fc,0x0000096c,0x0004003d,
35730x00000006,0x000026b2,0x000026b1,0x00050080,
35740x00000006,0x000026b4,0x000026b2,0x000026ae,
35750x00050041,0x000000fe,0x00002b69,0x000000fc,
35760x000000fd,0x0004003d,0x00000006,0x00002b6a,
35770x00002b69,0x00050084,0x00000006,0x00002b6b,
35780x0000011f,0x00002b6a,0x00050080,0x00000006,
35790x00002b6c,0x00000107,0x00002b6b,0x00050080,
35800x00000006,0x00002b72,0x00002b6a,0x0000319c,
35810x00050086,0x00000006,0x00002b73,0x00002b72,
35820x00000101,0x00050084,0x00000006,0x00002b65,
35830x00000107,0x00002b73,0x00050080,0x00000006,
35840x00002b66,0x00002b6c,0x00002b65,0x00050084,
35850x00000006,0x00002b3a,0x00000150,0x000026b4,
35860x00050080,0x00000006,0x00002b3b,0x00002b66,
35870x00002b3a,0x00050041,0x00000156,0x00002b3c,
35880x000000fc,0x00000154,0x0004003d,0x00000007,
35890x00002b3d,0x00002b3c,0x00050051,0x00000006,
35900x00002b8a,0x00002b3d,0x00000000,0x00050095,
35910x000000ab,0x00002b8c,0x00002b8a,0x00002b3b,
35920x00050051,0x00000006,0x00002b8d,0x00002b8c,
35930x00000001,0x00050051,0x00000006,0x00002b8e,
35940x00002b8c,0x00000000,0x00050051,0x00000006,
35950x00002b91,0x00002b3d,0x00000001,0x00050080,
35960x00000006,0x00002b93,0x00002b91,0x00002b8d,
35970x00050050,0x00000007,0x00002b94,0x00002b8e,
35980x00002b93,0x0004007c,0x00000014,0x00002b84,
35990x00002b94,0x00060041,0x000000db,0x00002b7b,
36000x00002b84,0x000000da,0x000000da,0x0006003d,
36010x00000006,0x00002b7c,0x00002b7b,0x00000002,
36020x00000004,0x0004007c,0x00000027,0x00002b40,
36030x00002b7c,0x00050080,0x00000006,0x00002b42,
36040x00002b3b,0x0000010a,0x00050095,0x000000ab,
36050x00002bad,0x00002b8a,0x00002b42,0x00050051,
36060x00000006,0x00002bae,0x00002bad,0x00000001,
36070x00050051,0x00000006,0x00002baf,0x00002bad,
36080x00000000,0x00050080,0x00000006,0x00002bb4,
36090x00002b91,0x00002bae,0x00050050,0x00000007,
36100x00002bb5,0x00002baf,0x00002bb4,0x0004007c,
36110x00000014,0x00002ba5,0x00002bb5,0x00060041,
36120x000000db,0x00002b9c,0x00002ba5,0x000000da,
36130x000000da,0x0006003d,0x00000006,0x00002b9d,
36140x00002b9c,0x00000002,0x00000004,0x0004007c,
36150x00000027,0x00002b46,0x00002b9d,0x00050080,
36160x00000006,0x00002b48,0x00002b3b,0x00000111,
36170x00050095,0x000000ab,0x00002bce,0x00002b8a,
36180x00002b48,0x00050051,0x00000006,0x00002bcf,
36190x00002bce,0x00000001,0x00050051,0x00000006,
36200x00002bd0,0x00002bce,0x00000000,0x00050080,
36210x00000006,0x00002bd5,0x00002b91,0x00002bcf,
36220x00050050,0x00000007,0x00002bd6,0x00002bd0,
36230x00002bd5,0x0004007c,0x00000014,0x00002bc6,
36240x00002bd6,0x00060041,0x000000db,0x00002bbd,
36250x00002bc6,0x000000da,0x000000da,0x0006003d,
36260x00000006,0x00002bbe,0x00002bbd,0x00000002,
36270x00000004,0x0004007c,0x00000027,0x00002b4c,
36280x00002bbe,0x00060050,0x0000004b,0x00002b4d,
36290x00002b40,0x00002b46,0x00002b4c,0x00050080,
36300x00000006,0x00002b4f,0x00002b3b,0x00000118,
36310x00050095,0x000000ab,0x00002bef,0x00002b8a,
36320x00002b4f,0x00050051,0x00000006,0x00002bf0,
36330x00002bef,0x00000001,0x00050051,0x00000006,
36340x00002bf1,0x00002bef,0x00000000,0x00050080,
36350x00000006,0x00002bf6,0x00002b91,0x00002bf0,
36360x00050050,0x00000007,0x00002bf7,0x00002bf1,
36370x00002bf6,0x0004007c,0x00000014,0x00002be7,
36380x00002bf7,0x00060041,0x000000db,0x00002bde,
36390x00002be7,0x000000da,0x000000da,0x0006003d,
36400x00000006,0x00002bdf,0x00002bde,0x00000002,
36410x00000004,0x0004007c,0x00000027,0x00002b53,
36420x00002bdf,0x00050080,0x00000006,0x00002b55,
36430x00002b3b,0x0000011f,0x00050095,0x000000ab,
36440x00002c10,0x00002b8a,0x00002b55,0x00050051,
36450x00000006,0x00002c11,0x00002c10,0x00000001,
36460x00050051,0x00000006,0x00002c12,0x00002c10,
36470x00000000,0x00050080,0x00000006,0x00002c17,
36480x00002b91,0x00002c11,0x00050050,0x00000007,
36490x00002c18,0x00002c12,0x00002c17,0x0004007c,
36500x00000014,0x00002c08,0x00002c18,0x00060041,
36510x000000db,0x00002bff,0x00002c08,0x000000da,
36520x000000da,0x0006003d,0x00000006,0x00002c00,
36530x00002bff,0x00000002,0x00000004,0x0004007c,
36540x00000027,0x00002b59,0x00002c00,0x00050080,
36550x00000006,0x00002b5b,0x00002b3b,0x00000189,
36560x00050095,0x000000ab,0x00002c31,0x00002b8a,
36570x00002b5b,0x00050051,0x00000006,0x00002c32,
36580x00002c31,0x00000001,0x00050051,0x00000006,
36590x00002c33,0x00002c31,0x00000000,0x00050080,
36600x00000006,0x00002c38,0x00002b91,0x00002c32,
36610x00050050,0x00000007,0x00002c39,0x00002c33,
36620x00002c38,0x0004007c,0x00000014,0x00002c29,
36630x00002c39,0x00060041,0x000000db,0x00002c20,
36640x00002c29,0x000000da,0x000000da,0x0006003d,
36650x00000006,0x00002c21,0x00002c20,0x00000002,
36660x00000004,0x0004007c,0x00000027,0x00002b5f,
36670x00002c21,0x00060050,0x0000004b,0x00002b60,
36680x00002b53,0x00002b59,0x00002b5f,0x000200f9,
36690x000026b8,0x000200f8,0x000026b8,0x000700f5,
36700x0000004b,0x0000309b,0x00002a26,0x000026a9,
36710x00002b60,0x000026aa,0x000700f5,0x0000004b,
36720x00003099,0x00002a13,0x000026a9,0x00002b4d,
36730x000026aa,0x000700f5,0x00000006,0x00003097,
36740x000029e9,0x000026a9,0x00002b29,0x000026aa,
36750x00050041,0x000000fe,0x000026b9,0x000000fc,
36760x000009ef,0x0004003d,0x00000006,0x000026ba,
36770x000026b9,0x000500c2,0x00000006,0x00002c3d,
36780x00003097,0x0000020d,0x00050041,0x000000fe,
36790x000026bd,0x000000fc,0x0000022c,0x0004003d,
36800x00000006,0x000026be,0x000026bd,0x00050086,
36810x00000006,0x000026bf,0x000026be,0x00000107,
36820x00050082,0x00000006,0x000026c0,0x00002c3d,
36830x000026bf,0x00050084,0x00000006,0x000026c1,
36840x0000010a,0x000026c0,0x00050080,0x00000006,
36850x000026c2,0x000026ba,0x000026c1,0x00050041,
36860x00000156,0x000026c3,0x000000fc,0x000000da,
36870x0004003d,0x00000007,0x000026c4,0x000026c3,
36880x00050051,0x00000006,0x00002c53,0x000026c4,
36890x00000000,0x00050095,0x000000ab,0x00002c55,
36900x00002c53,0x000026c2,0x00050051,0x00000006,
36910x00002c56,0x00002c55,0x00000001,0x00050051,
36920x00000006,0x00002c57,0x00002c55,0x00000000,
36930x00050051,0x00000006,0x00002c5a,0x000026c4,
36940x00000001,0x00050080,0x00000006,0x00002c5c,
36950x00002c5a,0x00002c56,0x00050050,0x00000007,
36960x00002c5d,0x00002c57,0x00002c5c,0x0004007c,
36970x00000014,0x00002c4d,0x00002c5d,0x00060041,
36980x000000db,0x00002c45,0x00002c4d,0x000000da,
36990x000000da,0x0005003e,0x00002c45,0x00002730,
31620x00000002,0x00000004,0x00050051,0x00000027, 37000x00000002,0x00000004,0x00050051,0x00000027,
31630x000026a3,0x00002aad,0x00000000,0x00050051, 37010x00002c61,0x00003099,0x00000000,0x00050051,
31640x00000027,0x000026a5,0x00002aaf,0x00000000, 37020x00000027,0x00002c63,0x0000309b,0x00000000,
31650x000500bc,0x0000002f,0x000026a6,0x000026a3, 37030x000500bc,0x0000002f,0x00002c64,0x00002c61,
31660x000026a5,0x000300f7,0x000026ad,0x00000000, 37040x00002c63,0x000300f7,0x00002c6b,0x00000000,
31670x000400fa,0x000026a6,0x000026a7,0x000026ad, 37050x000400fa,0x00002c64,0x00002c65,0x00002c6b,
31680x000200f8,0x000026a7,0x00050051,0x00000027, 37060x000200f8,0x00002c65,0x00050051,0x00000027,
31690x000026a9,0x00002aad,0x00000001,0x00050051, 37070x00002c67,0x00003099,0x00000001,0x00050051,
31700x00000027,0x000026ab,0x00002aaf,0x00000001, 37080x00000027,0x00002c69,0x0000309b,0x00000001,
31710x000500bc,0x0000002f,0x000026ac,0x000026a9, 37090x000500bc,0x0000002f,0x00002c6a,0x00002c67,
31720x000026ab,0x000200f9,0x000026ad,0x000200f8, 37100x00002c69,0x000200f9,0x00002c6b,0x000200f8,
31730x000026ad,0x000700f5,0x0000002f,0x000026ae, 37110x00002c6b,0x000700f5,0x0000002f,0x00002c6c,
31740x000026a6,0x0000237e,0x000026ac,0x000026a7, 37120x00002c64,0x000026b8,0x00002c6a,0x00002c65,
31750x000300f7,0x000026b5,0x00000000,0x000400fa, 37130x000300f7,0x00002c73,0x00000000,0x000400fa,
31760x000026ae,0x000026af,0x000026b5,0x000200f8, 37140x00002c6c,0x00002c6d,0x00002c73,0x000200f8,
31770x000026af,0x00050051,0x00000027,0x000026b1, 37150x00002c6d,0x00050051,0x00000027,0x00002c6f,
31780x00002aad,0x00000002,0x00050051,0x00000027, 37160x00003099,0x00000002,0x00050051,0x00000027,
31790x000026b3,0x00002aaf,0x00000002,0x000500bc, 37170x00002c71,0x0000309b,0x00000002,0x000500bc,
31800x0000002f,0x000026b4,0x000026b1,0x000026b3, 37180x0000002f,0x00002c72,0x00002c6f,0x00002c71,
31810x000200f9,0x000026b5,0x000200f8,0x000026b5, 37190x000200f9,0x00002c73,0x000200f8,0x00002c73,
31820x000700f5,0x0000002f,0x000026b6,0x000026ae, 37200x000700f5,0x0000002f,0x00002c74,0x00002c6c,
31830x000026ad,0x000026b4,0x000026af,0x000300f7, 37210x00002c6b,0x00002c72,0x00002c6d,0x000300f7,
31840x00002398,0x00000000,0x000400fa,0x000026b6, 37220x000026d2,0x00000000,0x000400fa,0x00002c74,
31850x00002391,0x00002398,0x000200f8,0x00002391, 37230x000026cb,0x000026d2,0x000200f8,0x000026cb,
31860x0007000c,0x0000004b,0x00002394,0x00000001, 37240x0007000c,0x0000004b,0x000026ce,0x00000001,
31870x00000025,0x00002aa8,0x00002aad,0x0007000c, 37250x00000025,0x00003094,0x00003099,0x0007000c,
31880x0000004b,0x00002397,0x00000001,0x00000028, 37260x0000004b,0x000026d1,0x00000001,0x00000028,
31890x00002aaa,0x00002aaf,0x000200f9,0x00002398, 37270x00003096,0x0000309b,0x000200f9,0x000026d2,
31900x000200f8,0x00002398,0x000700f5,0x0000004b, 37280x000200f8,0x000026d2,0x000700f5,0x0000004b,
31910x00002b58,0x00002aaa,0x000026b5,0x00002397, 37290x00003183,0x00003096,0x00002c73,0x000026d1,
31920x00002391,0x000700f5,0x0000004b,0x00002b56, 37300x000026cb,0x000700f5,0x0000004b,0x0000317e,
31930x00002aa8,0x000026b5,0x00002394,0x00002391, 37310x00003094,0x00002c73,0x000026ce,0x000026cb,
31940x000200f9,0x00002399,0x000200f8,0x00002399, 37320x000200f9,0x000026d3,0x000200f8,0x000026d3,
31950x000700f5,0x0000004b,0x00002b57,0x00002aaa, 37330x000700f5,0x0000004b,0x00003182,0x00003096,
31960x00002342,0x00002b58,0x00002398,0x000700f5, 37340x00002684,0x00003183,0x000026d2,0x000700f5,
31970x0000004b,0x00002b55,0x00002aa8,0x00002342, 37350x0000004b,0x0000317d,0x00003094,0x00002684,
31980x00002b56,0x00002398,0x000700f5,0x0000004b, 37360x0000317e,0x000026d2,0x000700f5,0x0000004b,
31990x00002ac9,0x00002b66,0x00002342,0x00002aaf, 37370x000030d9,0x0000319b,0x00002684,0x0000309b,
32000x00002398,0x000700f5,0x0000004b,0x00002ac7, 37380x000026d2,0x000700f5,0x0000004b,0x000030d4,
32010x00002b64,0x00002342,0x00002aad,0x00002398, 37390x00003199,0x00002684,0x00003099,0x000026d2,
32020x000700f5,0x00000006,0x00002ac3,0x0000037d, 37400x000700f5,0x00000006,0x000030cd,0x00000380,
32030x00002342,0x00002aab,0x00002398,0x00050084, 37410x00002684,0x00003097,0x000026d2,0x000200f9,
32040x00000006,0x0000239c,0x00000107,0x00002aa5, 37420x000026d4,0x000200f8,0x000026d4,0x000700f5,
32050x00050080,0x00000006,0x0000239d,0x000023f2, 37430x0000004b,0x0000317f,0x00003180,0x00002683,
32060x0000239c,0x00050041,0x00000153,0x0000239e, 37440x00003182,0x000026d3,0x000700f5,0x0000004b,
32070x000000f9,0x000000d7,0x0004003d,0x00000007, 37450x0000317a,0x0000317b,0x00002683,0x0000317d,
32080x0000239f,0x0000239e,0x00050051,0x00000006, 37460x000026d3,0x000700f5,0x0000004b,0x000030d6,
32090x000026cd,0x0000239f,0x00000000,0x00050095, 37470x000030d7,0x00002683,0x000030d9,0x000026d3,
32100x000000a8,0x000026cf,0x000026cd,0x0000239d, 37480x000700f5,0x0000004b,0x000030d1,0x000030d2,
32110x00050051,0x00000006,0x000026d0,0x000026cf, 37490x00002683,0x000030d4,0x000026d3,0x000700f5,
32120x00000001,0x00050051,0x00000006,0x000026d1, 37500x00000006,0x000030c6,0x00002739,0x00002683,
32130x000026cf,0x00000000,0x00050051,0x00000006, 37510x000030cd,0x000026d3,0x00050084,0x00000006,
32140x000026d4,0x0000239f,0x00000001,0x00050080, 37520x000026d7,0x0000010a,0x00003091,0x00050080,
32150x00000006,0x000026d6,0x000026d4,0x000026d0, 37530x00000006,0x000026d8,0x0000272d,0x000026d7,
32160x00050050,0x00000007,0x000026d7,0x000026d1, 37540x00050041,0x00000156,0x000026d9,0x000000fc,
32170x000026d6,0x0004007c,0x00000014,0x000026c7, 37550x000000da,0x0004003d,0x00000007,0x000026da,
32180x000026d7,0x00060041,0x000000d8,0x000026bf, 37560x000026d9,0x00050051,0x00000006,0x00002c8b,
32190x000026c7,0x000000d7,0x000000d7,0x0005003e, 37570x000026da,0x00000000,0x00050095,0x000000ab,
32200x000026bf,0x00002ac3,0x00000002,0x00000004, 37580x00002c8d,0x00002c8b,0x000026d8,0x00050051,
32210x00050080,0x00000006,0x000023a3,0x000023f2, 37590x00000006,0x00002c8e,0x00002c8d,0x00000001,
32220x0000011c,0x00050084,0x00000006,0x000023a5, 37600x00050051,0x00000006,0x00002c8f,0x00002c8d,
32230x0000014d,0x00002aa5,0x00050080,0x00000006, 37610x00000000,0x00050051,0x00000006,0x00002c92,
32240x000023a6,0x000023a3,0x000023a5,0x00050051, 37620x000026da,0x00000001,0x00050080,0x00000006,
32250x00000027,0x000023ab,0x00002ac7,0x00000000, 37630x00002c94,0x00002c92,0x00002c8e,0x00050050,
32260x0004007c,0x00000006,0x000026dd,0x000023ab, 37640x00000007,0x00002c95,0x00002c8f,0x00002c94,
32270x00050095,0x000000a8,0x000026f8,0x000026cd, 37650x0004007c,0x00000014,0x00002c85,0x00002c95,
32280x000023a6,0x00050051,0x00000006,0x000026f9, 37660x00060041,0x000000db,0x00002c7d,0x00002c85,
32290x000026f8,0x00000001,0x00050051,0x00000006, 37670x000000da,0x000000da,0x0005003e,0x00002c7d,
32300x000026fa,0x000026f8,0x00000000,0x00050080, 37680x000030c6,0x00000002,0x00000004,0x00050080,
32310x00000006,0x000026ff,0x000026d4,0x000026f9, 37690x00000006,0x000026de,0x0000272d,0x0000011f,
32320x00050050,0x00000007,0x00002700,0x000026fa, 37700x00050084,0x00000006,0x000026e0,0x00000150,
32330x000026ff,0x0004007c,0x00000014,0x000026f0, 37710x00003091,0x00050080,0x00000006,0x000026e1,
32340x00002700,0x00060041,0x000000d8,0x000026e8, 37720x000026de,0x000026e0,0x00050051,0x00000027,
32350x000026f0,0x000000d7,0x000000d7,0x0005003e, 37730x000026e6,0x000030d1,0x00000000,0x0004007c,
32360x000026e8,0x000026dd,0x00000002,0x00000004, 37740x00000006,0x00002c9b,0x000026e6,0x00050095,
32370x00050080,0x00000006,0x000023ae,0x000023a6, 37750x000000ab,0x00002cb6,0x00002c8b,0x000026e1,
32380x00000107,0x00050051,0x00000027,0x000023b2, 37760x00050051,0x00000006,0x00002cb7,0x00002cb6,
32390x00002ac7,0x00000001,0x0004007c,0x00000006, 37770x00000001,0x00050051,0x00000006,0x00002cb8,
32400x00002706,0x000023b2,0x00050095,0x000000a8, 37780x00002cb6,0x00000000,0x00050080,0x00000006,
32410x00002721,0x000026cd,0x000023ae,0x00050051, 37790x00002cbd,0x00002c92,0x00002cb7,0x00050050,
32420x00000006,0x00002722,0x00002721,0x00000001, 37800x00000007,0x00002cbe,0x00002cb8,0x00002cbd,
32430x00050051,0x00000006,0x00002723,0x00002721, 37810x0004007c,0x00000014,0x00002cae,0x00002cbe,
32440x00000000,0x00050080,0x00000006,0x00002728, 37820x00060041,0x000000db,0x00002ca6,0x00002cae,
32450x000026d4,0x00002722,0x00050050,0x00000007, 37830x000000da,0x000000da,0x0005003e,0x00002ca6,
32460x00002729,0x00002723,0x00002728,0x0004007c, 37840x00002c9b,0x00000002,0x00000004,0x00050080,
32470x00000014,0x00002719,0x00002729,0x00060041, 37850x00000006,0x000026e9,0x000026e1,0x0000010a,
32480x000000d8,0x00002711,0x00002719,0x000000d7, 37860x00050051,0x00000027,0x000026ed,0x000030d1,
32490x000000d7,0x0005003e,0x00002711,0x00002706, 37870x00000001,0x0004007c,0x00000006,0x00002cc4,
37880x000026ed,0x00050095,0x000000ab,0x00002cdf,
37890x00002c8b,0x000026e9,0x00050051,0x00000006,
37900x00002ce0,0x00002cdf,0x00000001,0x00050051,
37910x00000006,0x00002ce1,0x00002cdf,0x00000000,
37920x00050080,0x00000006,0x00002ce6,0x00002c92,
37930x00002ce0,0x00050050,0x00000007,0x00002ce7,
37940x00002ce1,0x00002ce6,0x0004007c,0x00000014,
37950x00002cd7,0x00002ce7,0x00060041,0x000000db,
37960x00002ccf,0x00002cd7,0x000000da,0x000000da,
37970x0005003e,0x00002ccf,0x00002cc4,0x00000002,
37980x00000004,0x00050080,0x00000006,0x000026f0,
37990x000026e1,0x00000111,0x00050051,0x00000027,
38000x000026f4,0x000030d1,0x00000002,0x0004007c,
38010x00000006,0x00002ced,0x000026f4,0x00050095,
38020x000000ab,0x00002d08,0x00002c8b,0x000026f0,
38030x00050051,0x00000006,0x00002d09,0x00002d08,
38040x00000001,0x00050051,0x00000006,0x00002d0a,
38050x00002d08,0x00000000,0x00050080,0x00000006,
38060x00002d0f,0x00002c92,0x00002d09,0x00050050,
38070x00000007,0x00002d10,0x00002d0a,0x00002d0f,
38080x0004007c,0x00000014,0x00002d00,0x00002d10,
38090x00060041,0x000000db,0x00002cf8,0x00002d00,
38100x000000da,0x000000da,0x0005003e,0x00002cf8,
38110x00002ced,0x00000002,0x00000004,0x00050080,
38120x00000006,0x000026f7,0x000026e1,0x00000118,
38130x00050051,0x00000027,0x000026fb,0x000030d6,
38140x00000000,0x0004007c,0x00000006,0x00002d16,
38150x000026fb,0x00050095,0x000000ab,0x00002d31,
38160x00002c8b,0x000026f7,0x00050051,0x00000006,
38170x00002d32,0x00002d31,0x00000001,0x00050051,
38180x00000006,0x00002d33,0x00002d31,0x00000000,
38190x00050080,0x00000006,0x00002d38,0x00002c92,
38200x00002d32,0x00050050,0x00000007,0x00002d39,
38210x00002d33,0x00002d38,0x0004007c,0x00000014,
38220x00002d29,0x00002d39,0x00060041,0x000000db,
38230x00002d21,0x00002d29,0x000000da,0x000000da,
38240x0005003e,0x00002d21,0x00002d16,0x00000002,
38250x00000004,0x00050080,0x00000006,0x000026fe,
38260x000026e1,0x0000011f,0x00050051,0x00000027,
38270x00002702,0x000030d6,0x00000001,0x0004007c,
38280x00000006,0x00002d3f,0x00002702,0x00050095,
38290x000000ab,0x00002d5a,0x00002c8b,0x000026fe,
38300x00050051,0x00000006,0x00002d5b,0x00002d5a,
38310x00000001,0x00050051,0x00000006,0x00002d5c,
38320x00002d5a,0x00000000,0x00050080,0x00000006,
38330x00002d61,0x00002c92,0x00002d5b,0x00050050,
38340x00000007,0x00002d62,0x00002d5c,0x00002d61,
38350x0004007c,0x00000014,0x00002d52,0x00002d62,
38360x00060041,0x000000db,0x00002d4a,0x00002d52,
38370x000000da,0x000000da,0x0005003e,0x00002d4a,
38380x00002d3f,0x00000002,0x00000004,0x00050080,
38390x00000006,0x00002705,0x000026e1,0x00000189,
38400x00050051,0x00000027,0x00002709,0x000030d6,
38410x00000002,0x0004007c,0x00000006,0x00002d68,
38420x00002709,0x00050095,0x000000ab,0x00002d83,
38430x00002c8b,0x00002705,0x00050051,0x00000006,
38440x00002d84,0x00002d83,0x00000001,0x00050051,
38450x00000006,0x00002d85,0x00002d83,0x00000000,
38460x00050080,0x00000006,0x00002d8a,0x00002c92,
38470x00002d84,0x00050050,0x00000007,0x00002d8b,
38480x00002d85,0x00002d8a,0x0004007c,0x00000014,
38490x00002d7b,0x00002d8b,0x00060041,0x000000db,
38500x00002d73,0x00002d7b,0x000000da,0x000000da,
38510x0005003e,0x00002d73,0x00002d68,0x00000002,
38520x00000004,0x000200f9,0x0000270b,0x000200f8,
38530x0000270b,0x00050080,0x00000006,0x0000270d,
38540x00003091,0x00000154,0x000200f9,0x0000262f,
38550x000200f8,0x0000270e,0x000200f9,0x0000270f,
38560x000200f8,0x0000270f,0x000700f5,0x00000006,
38570x00003092,0x000000a6,0x0000270e,0x0000271e,
38580x00002713,0x000500b0,0x0000002f,0x00002712,
38590x00003092,0x0000010a,0x000400f6,0x0000271f,
38600x00002713,0x00000000,0x000400fa,0x00002712,
38610x00002713,0x0000271f,0x000200f8,0x00002713,
38620x00050080,0x00000006,0x00002715,0x0000272d,
38630x000005c6,0x00050084,0x00000006,0x00002717,
38640x0000010a,0x00003092,0x00050080,0x00000006,
38650x00002718,0x00002715,0x00002717,0x00050041,
38660x00000156,0x00002719,0x000000fc,0x000000da,
38670x0004003d,0x00000007,0x0000271a,0x00002719,
38680x00050051,0x00000006,0x00002da1,0x0000271a,
38690x00000000,0x00050095,0x000000ab,0x00002da3,
38700x00002da1,0x00002718,0x00050051,0x00000006,
38710x00002da4,0x00002da3,0x00000001,0x00050051,
38720x00000006,0x00002da5,0x00002da3,0x00000000,
38730x00050051,0x00000006,0x00002da8,0x0000271a,
38740x00000001,0x00050080,0x00000006,0x00002daa,
38750x00002da8,0x00002da4,0x00050050,0x00000007,
38760x00002dab,0x00002da5,0x00002daa,0x0004007c,
38770x00000014,0x00002d9b,0x00002dab,0x00060041,
38780x000000db,0x00002d93,0x00002d9b,0x000000da,
38790x000000da,0x0005003e,0x00002d93,0x000000a6,
38800x00000002,0x00000004,0x00050080,0x00000006,
38810x0000271e,0x00003092,0x00000154,0x000200f9,
38820x0000270f,0x000200f8,0x0000271f,0x00050041,
38830x000000fe,0x00002720,0x000000fc,0x0000096c,
38840x0004003d,0x00000006,0x00002721,0x00002720,
38850x00050080,0x00000006,0x00002723,0x00002721,
38860x00002623,0x00050041,0x000000fe,0x00002df5,
38870x000000fc,0x000000fd,0x0004003d,0x00000006,
38880x00002df6,0x00002df5,0x00050084,0x00000006,
38890x00002df7,0x0000011f,0x00002df6,0x00050080,
38900x00000006,0x00002df8,0x00000107,0x00002df7,
38910x00050080,0x00000006,0x00002dfe,0x00002df6,
38920x0000319c,0x00050086,0x00000006,0x00002dff,
38930x00002dfe,0x00000101,0x00050084,0x00000006,
38940x00002df1,0x00000107,0x00002dff,0x00050080,
38950x00000006,0x00002df2,0x00002df8,0x00002df1,
38960x00050084,0x00000006,0x00002dc2,0x00000150,
38970x00002723,0x00050080,0x00000006,0x00002dc3,
38980x00002df2,0x00002dc2,0x00050041,0x00000156,
38990x00002dc4,0x000000fc,0x00000154,0x0004003d,
39000x00000007,0x00002dc5,0x00002dc4,0x00050051,
39010x00000027,0x00002dc8,0x00003094,0x00000000,
39020x0004007c,0x00000006,0x00002e05,0x00002dc8,
39030x00050051,0x00000006,0x00002e1e,0x00002dc5,
39040x00000000,0x00050095,0x000000ab,0x00002e20,
39050x00002e1e,0x00002dc3,0x00050051,0x00000006,
39060x00002e21,0x00002e20,0x00000001,0x00050051,
39070x00000006,0x00002e22,0x00002e20,0x00000000,
39080x00050051,0x00000006,0x00002e25,0x00002dc5,
39090x00000001,0x00050080,0x00000006,0x00002e27,
39100x00002e25,0x00002e21,0x00050050,0x00000007,
39110x00002e28,0x00002e22,0x00002e27,0x0004007c,
39120x00000014,0x00002e18,0x00002e28,0x00060041,
39130x000000db,0x00002e10,0x00002e18,0x000000da,
39140x000000da,0x0005003e,0x00002e10,0x00002e05,
39150x00000002,0x00000004,0x00050080,0x00000006,
39160x00002dcb,0x00002dc3,0x0000010a,0x00050051,
39170x00000027,0x00002dcf,0x00003094,0x00000001,
39180x0004007c,0x00000006,0x00002e2e,0x00002dcf,
39190x00050095,0x000000ab,0x00002e49,0x00002e1e,
39200x00002dcb,0x00050051,0x00000006,0x00002e4a,
39210x00002e49,0x00000001,0x00050051,0x00000006,
39220x00002e4b,0x00002e49,0x00000000,0x00050080,
39230x00000006,0x00002e50,0x00002e25,0x00002e4a,
39240x00050050,0x00000007,0x00002e51,0x00002e4b,
39250x00002e50,0x0004007c,0x00000014,0x00002e41,
39260x00002e51,0x00060041,0x000000db,0x00002e39,
39270x00002e41,0x000000da,0x000000da,0x0005003e,
39280x00002e39,0x00002e2e,0x00000002,0x00000004,
39290x00050080,0x00000006,0x00002dd2,0x00002dc3,
39300x00000111,0x00050051,0x00000027,0x00002dd6,
39310x00003094,0x00000002,0x0004007c,0x00000006,
39320x00002e57,0x00002dd6,0x00050095,0x000000ab,
39330x00002e72,0x00002e1e,0x00002dd2,0x00050051,
39340x00000006,0x00002e73,0x00002e72,0x00000001,
39350x00050051,0x00000006,0x00002e74,0x00002e72,
39360x00000000,0x00050080,0x00000006,0x00002e79,
39370x00002e25,0x00002e73,0x00050050,0x00000007,
39380x00002e7a,0x00002e74,0x00002e79,0x0004007c,
39390x00000014,0x00002e6a,0x00002e7a,0x00060041,
39400x000000db,0x00002e62,0x00002e6a,0x000000da,
39410x000000da,0x0005003e,0x00002e62,0x00002e57,
32500x00000002,0x00000004,0x00050080,0x00000006, 39420x00000002,0x00000004,0x00050080,0x00000006,
32510x000023b5,0x000023a6,0x0000010e,0x00050051, 39430x00002dd9,0x00002dc3,0x00000118,0x00050051,
32520x00000027,0x000023b9,0x00002ac7,0x00000002, 39440x00000027,0x00002ddd,0x00003096,0x00000000,
32530x0004007c,0x00000006,0x0000272f,0x000023b9, 39450x0004007c,0x00000006,0x00002e80,0x00002ddd,
32540x00050095,0x000000a8,0x0000274a,0x000026cd, 39460x00050095,0x000000ab,0x00002e9b,0x00002e1e,
32550x000023b5,0x00050051,0x00000006,0x0000274b, 39470x00002dd9,0x00050051,0x00000006,0x00002e9c,
32560x0000274a,0x00000001,0x00050051,0x00000006, 39480x00002e9b,0x00000001,0x00050051,0x00000006,
32570x0000274c,0x0000274a,0x00000000,0x00050080, 39490x00002e9d,0x00002e9b,0x00000000,0x00050080,
32580x00000006,0x00002751,0x000026d4,0x0000274b, 39500x00000006,0x00002ea2,0x00002e25,0x00002e9c,
32590x00050050,0x00000007,0x00002752,0x0000274c, 39510x00050050,0x00000007,0x00002ea3,0x00002e9d,
32600x00002751,0x0004007c,0x00000014,0x00002742, 39520x00002ea2,0x0004007c,0x00000014,0x00002e93,
32610x00002752,0x00060041,0x000000d8,0x0000273a, 39530x00002ea3,0x00060041,0x000000db,0x00002e8b,
32620x00002742,0x000000d7,0x000000d7,0x0005003e, 39540x00002e93,0x000000da,0x000000da,0x0005003e,
32630x0000273a,0x0000272f,0x00000002,0x00000004, 39550x00002e8b,0x00002e80,0x00000002,0x00000004,
32640x00050080,0x00000006,0x000023bc,0x000023a6, 39560x00050080,0x00000006,0x00002de0,0x00002dc3,
32650x00000115,0x00050051,0x00000027,0x000023c0, 39570x0000011f,0x00050051,0x00000027,0x00002de4,
32660x00002ac9,0x00000000,0x0004007c,0x00000006, 39580x00003096,0x00000001,0x0004007c,0x00000006,
32670x00002758,0x000023c0,0x00050095,0x000000a8, 39590x00002ea9,0x00002de4,0x00050095,0x000000ab,
32680x00002773,0x000026cd,0x000023bc,0x00050051, 39600x00002ec4,0x00002e1e,0x00002de0,0x00050051,
32690x00000006,0x00002774,0x00002773,0x00000001, 39610x00000006,0x00002ec5,0x00002ec4,0x00000001,
32700x00050051,0x00000006,0x00002775,0x00002773, 39620x00050051,0x00000006,0x00002ec6,0x00002ec4,
32710x00000000,0x00050080,0x00000006,0x0000277a, 39630x00000000,0x00050080,0x00000006,0x00002ecb,
32720x000026d4,0x00002774,0x00050050,0x00000007, 39640x00002e25,0x00002ec5,0x00050050,0x00000007,
32730x0000277b,0x00002775,0x0000277a,0x0004007c, 39650x00002ecc,0x00002ec6,0x00002ecb,0x0004007c,
32740x00000014,0x0000276b,0x0000277b,0x00060041, 39660x00000014,0x00002ebc,0x00002ecc,0x00060041,
32750x000000d8,0x00002763,0x0000276b,0x000000d7, 39670x000000db,0x00002eb4,0x00002ebc,0x000000da,
32760x000000d7,0x0005003e,0x00002763,0x00002758, 39680x000000da,0x0005003e,0x00002eb4,0x00002ea9,
32770x00000002,0x00000004,0x00050080,0x00000006, 39690x00000002,0x00000004,0x00050080,0x00000006,
32780x000023c3,0x000023a6,0x0000011c,0x00050051, 39700x00002de7,0x00002dc3,0x00000189,0x00050051,
32790x00000027,0x000023c7,0x00002ac9,0x00000001, 39710x00000027,0x00002deb,0x00003096,0x00000002,
32800x0004007c,0x00000006,0x00002781,0x000023c7, 39720x0004007c,0x00000006,0x00002ed2,0x00002deb,
32810x00050095,0x000000a8,0x0000279c,0x000026cd, 39730x00050095,0x000000ab,0x00002eed,0x00002e1e,
32820x000023c3,0x00050051,0x00000006,0x0000279d, 39740x00002de7,0x00050051,0x00000006,0x00002eee,
32830x0000279c,0x00000001,0x00050051,0x00000006, 39750x00002eed,0x00000001,0x00050051,0x00000006,
32840x0000279e,0x0000279c,0x00000000,0x00050080, 39760x00002eef,0x00002eed,0x00000000,0x00050080,
32850x00000006,0x000027a3,0x000026d4,0x0000279d, 39770x00000006,0x00002ef4,0x00002e25,0x00002eee,
32860x00050050,0x00000007,0x000027a4,0x0000279e, 39780x00050050,0x00000007,0x00002ef5,0x00002eef,
32870x000027a3,0x0004007c,0x00000014,0x00002794, 39790x00002ef4,0x0004007c,0x00000014,0x00002ee5,
32880x000027a4,0x00060041,0x000000d8,0x0000278c, 39800x00002ef5,0x00060041,0x000000db,0x00002edd,
32890x00002794,0x000000d7,0x000000d7,0x0005003e, 39810x00002ee5,0x000000da,0x000000da,0x0005003e,
32900x0000278c,0x00002781,0x00000002,0x00000004, 39820x00002edd,0x00002ed2,0x00000002,0x00000004,
32910x00050080,0x00000006,0x000023ca,0x000023a6, 39830x000200f9,0x00000bb0,0x000200f8,0x00000bb0,
32920x00000186,0x00050051,0x00000027,0x000023ce, 39840x000200f9,0x00000ba7,0x000200f8,0x00000ba7,
32930x00002ac9,0x00000002,0x0004007c,0x00000006, 39850x000200f9,0x00000b9e,0x000200f8,0x00000b9e,
32940x000027aa,0x000023ce,0x00050095,0x000000a8, 39860x000200f9,0x00000b95,0x000200f8,0x00000b95,
32950x000027c5,0x000026cd,0x000023ca,0x00050051, 39870x000200f9,0x00000b6f,0x000200f8,0x00000b6f,
32960x00000006,0x000027c6,0x000027c5,0x00000001, 39880x000200f9,0x00000b5a,0x000200f8,0x00000b5a,
32970x00050051,0x00000006,0x000027c7,0x000027c5, 39890x000200f9,0x00000bb6,0x000200f8,0x00000bb6,
32980x00000000,0x00050080,0x00000006,0x000027cc, 39900x000100fd,0x00010038}
32990x000026d4,0x000027c6,0x00050050,0x00000007,
33000x000027cd,0x000027c7,0x000027cc,0x0004007c,
33010x00000014,0x000027bd,0x000027cd,0x00060041,
33020x000000d8,0x000027b5,0x000027bd,0x000000d7,
33030x000000d7,0x0005003e,0x000027b5,0x000027aa,
33040x00000002,0x00000004,0x000200f9,0x000023d0,
33050x000200f8,0x000023d0,0x00050080,0x00000006,
33060x000023d2,0x00002aa5,0x00000151,0x000200f9,
33070x0000233e,0x000200f8,0x000023d3,0x000200f9,
33080x000023d4,0x000200f8,0x000023d4,0x000700f5,
33090x00000006,0x00002aa6,0x000000a3,0x000023d3,
33100x000023e3,0x000023d8,0x000500b0,0x0000002f,
33110x000023d7,0x00002aa6,0x00000107,0x000400f6,
33120x000023e4,0x000023d8,0x00000000,0x000400fa,
33130x000023d7,0x000023d8,0x000023e4,0x000200f8,
33140x000023d8,0x00050080,0x00000006,0x000023da,
33150x000023f2,0x000005c3,0x00050084,0x00000006,
33160x000023dc,0x00000107,0x00002aa6,0x00050080,
33170x00000006,0x000023dd,0x000023da,0x000023dc,
33180x00050041,0x00000153,0x000023de,0x000000f9,
33190x000000d7,0x0004003d,0x00000007,0x000023df,
33200x000023de,0x00050051,0x00000006,0x000027e3,
33210x000023df,0x00000000,0x00050095,0x000000a8,
33220x000027e5,0x000027e3,0x000023dd,0x00050051,
33230x00000006,0x000027e6,0x000027e5,0x00000001,
33240x00050051,0x00000006,0x000027e7,0x000027e5,
33250x00000000,0x00050051,0x00000006,0x000027ea,
33260x000023df,0x00000001,0x00050080,0x00000006,
33270x000027ec,0x000027ea,0x000027e6,0x00050050,
33280x00000007,0x000027ed,0x000027e7,0x000027ec,
33290x0004007c,0x00000014,0x000027dd,0x000027ed,
33300x00060041,0x000000d8,0x000027d5,0x000027dd,
33310x000000d7,0x000000d7,0x0005003e,0x000027d5,
33320x000000a3,0x00000002,0x00000004,0x00050080,
33330x00000006,0x000023e3,0x00002aa6,0x00000151,
33340x000200f9,0x000023d4,0x000200f8,0x000023e4,
33350x00050041,0x000000fb,0x000023e5,0x000000f9,
33360x000008bc,0x0004003d,0x00000006,0x000023e6,
33370x000023e5,0x00050080,0x00000006,0x000023e8,
33380x000023e6,0x00002332,0x00050041,0x000000fb,
33390x00002837,0x000000f9,0x000000fa,0x0004003d,
33400x00000006,0x00002838,0x00002837,0x00050084,
33410x00000006,0x00002839,0x0000011c,0x00002838,
33420x00050080,0x00000006,0x0000283a,0x00000104,
33430x00002839,0x00050080,0x00000006,0x00002840,
33440x00002838,0x00002b67,0x00050086,0x00000006,
33450x00002841,0x00002840,0x000000fe,0x00050084,
33460x00000006,0x00002833,0x00000104,0x00002841,
33470x00050080,0x00000006,0x00002834,0x0000283a,
33480x00002833,0x00050084,0x00000006,0x00002804,
33490x0000014d,0x000023e8,0x00050080,0x00000006,
33500x00002805,0x00002834,0x00002804,0x00050041,
33510x00000153,0x00002806,0x000000f9,0x00000151,
33520x0004003d,0x00000007,0x00002807,0x00002806,
33530x00050051,0x00000027,0x0000280a,0x00002aa8,
33540x00000000,0x0004007c,0x00000006,0x00002847,
33550x0000280a,0x00050051,0x00000006,0x00002860,
33560x00002807,0x00000000,0x00050095,0x000000a8,
33570x00002862,0x00002860,0x00002805,0x00050051,
33580x00000006,0x00002863,0x00002862,0x00000001,
33590x00050051,0x00000006,0x00002864,0x00002862,
33600x00000000,0x00050051,0x00000006,0x00002867,
33610x00002807,0x00000001,0x00050080,0x00000006,
33620x00002869,0x00002867,0x00002863,0x00050050,
33630x00000007,0x0000286a,0x00002864,0x00002869,
33640x0004007c,0x00000014,0x0000285a,0x0000286a,
33650x00060041,0x000000d8,0x00002852,0x0000285a,
33660x000000d7,0x000000d7,0x0005003e,0x00002852,
33670x00002847,0x00000002,0x00000004,0x00050080,
33680x00000006,0x0000280d,0x00002805,0x00000107,
33690x00050051,0x00000027,0x00002811,0x00002aa8,
33700x00000001,0x0004007c,0x00000006,0x00002870,
33710x00002811,0x00050095,0x000000a8,0x0000288b,
33720x00002860,0x0000280d,0x00050051,0x00000006,
33730x0000288c,0x0000288b,0x00000001,0x00050051,
33740x00000006,0x0000288d,0x0000288b,0x00000000,
33750x00050080,0x00000006,0x00002892,0x00002867,
33760x0000288c,0x00050050,0x00000007,0x00002893,
33770x0000288d,0x00002892,0x0004007c,0x00000014,
33780x00002883,0x00002893,0x00060041,0x000000d8,
33790x0000287b,0x00002883,0x000000d7,0x000000d7,
33800x0005003e,0x0000287b,0x00002870,0x00000002,
33810x00000004,0x00050080,0x00000006,0x00002814,
33820x00002805,0x0000010e,0x00050051,0x00000027,
33830x00002818,0x00002aa8,0x00000002,0x0004007c,
33840x00000006,0x00002899,0x00002818,0x00050095,
33850x000000a8,0x000028b4,0x00002860,0x00002814,
33860x00050051,0x00000006,0x000028b5,0x000028b4,
33870x00000001,0x00050051,0x00000006,0x000028b6,
33880x000028b4,0x00000000,0x00050080,0x00000006,
33890x000028bb,0x00002867,0x000028b5,0x00050050,
33900x00000007,0x000028bc,0x000028b6,0x000028bb,
33910x0004007c,0x00000014,0x000028ac,0x000028bc,
33920x00060041,0x000000d8,0x000028a4,0x000028ac,
33930x000000d7,0x000000d7,0x0005003e,0x000028a4,
33940x00002899,0x00000002,0x00000004,0x00050080,
33950x00000006,0x0000281b,0x00002805,0x00000115,
33960x00050051,0x00000027,0x0000281f,0x00002aaa,
33970x00000000,0x0004007c,0x00000006,0x000028c2,
33980x0000281f,0x00050095,0x000000a8,0x000028dd,
33990x00002860,0x0000281b,0x00050051,0x00000006,
34000x000028de,0x000028dd,0x00000001,0x00050051,
34010x00000006,0x000028df,0x000028dd,0x00000000,
34020x00050080,0x00000006,0x000028e4,0x00002867,
34030x000028de,0x00050050,0x00000007,0x000028e5,
34040x000028df,0x000028e4,0x0004007c,0x00000014,
34050x000028d5,0x000028e5,0x00060041,0x000000d8,
34060x000028cd,0x000028d5,0x000000d7,0x000000d7,
34070x0005003e,0x000028cd,0x000028c2,0x00000002,
34080x00000004,0x00050080,0x00000006,0x00002822,
34090x00002805,0x0000011c,0x00050051,0x00000027,
34100x00002826,0x00002aaa,0x00000001,0x0004007c,
34110x00000006,0x000028eb,0x00002826,0x00050095,
34120x000000a8,0x00002906,0x00002860,0x00002822,
34130x00050051,0x00000006,0x00002907,0x00002906,
34140x00000001,0x00050051,0x00000006,0x00002908,
34150x00002906,0x00000000,0x00050080,0x00000006,
34160x0000290d,0x00002867,0x00002907,0x00050050,
34170x00000007,0x0000290e,0x00002908,0x0000290d,
34180x0004007c,0x00000014,0x000028fe,0x0000290e,
34190x00060041,0x000000d8,0x000028f6,0x000028fe,
34200x000000d7,0x000000d7,0x0005003e,0x000028f6,
34210x000028eb,0x00000002,0x00000004,0x00050080,
34220x00000006,0x00002829,0x00002805,0x00000186,
34230x00050051,0x00000027,0x0000282d,0x00002aaa,
34240x00000002,0x0004007c,0x00000006,0x00002914,
34250x0000282d,0x00050095,0x000000a8,0x0000292f,
34260x00002860,0x00002829,0x00050051,0x00000006,
34270x00002930,0x0000292f,0x00000001,0x00050051,
34280x00000006,0x00002931,0x0000292f,0x00000000,
34290x00050080,0x00000006,0x00002936,0x00002867,
34300x00002930,0x00050050,0x00000007,0x00002937,
34310x00002931,0x00002936,0x0004007c,0x00000014,
34320x00002927,0x00002937,0x00060041,0x000000d8,
34330x0000291f,0x00002927,0x000000d7,0x000000d7,
34340x0005003e,0x0000291f,0x00002914,0x00000002,
34350x00000004,0x000200f9,0x00000a68,0x000200f8,
34360x00000a68,0x000200f9,0x00000a5f,0x000200f8,
34370x00000a5f,0x000200f9,0x00000a56,0x000200f8,
34380x00000a56,0x000200f9,0x00000a4d,0x000200f8,
34390x00000a4d,0x000200f9,0x00000a27,0x000200f8,
34400x00000a27,0x000200f9,0x00000a6e,0x000200f8,
34410x00000a6e,0x000100fd,0x00010038}
diff --git a/runtime/test/allocator_proxy_test.cpp b/runtime/test/allocator_proxy_test.cpp
new file mode 100644
index 000000000..733e37cac
--- /dev/null
+++ b/runtime/test/allocator_proxy_test.cpp
@@ -0,0 +1,382 @@
1// Xbox-ABI command allocator proxies (d3d12_xs_device.h, device slot 9) behind the device proxy, on the Vulkan-backed
2// device and on the host PC runtime (WARP, and the first hardware adapter when there is one):
3// - Vulkan device: slot 9 wraps the allocator; the public chain (9 slots) is forwarded with the real allocator's
4// answers, every slot past it up to the end of the table is refused (E_NOTIMPL), and a read past the table faults
5// in the guard region and is counted;
6// - QueryInterface identity, GetDevice -> the device proxy, references and release orders;
7// - a command list created on the proxy and Reset on it (the Vulkan layer resolves the proxy), recording a buffer
8// copy that runs through the queue and fence proxies and is read back, twice, with the allocator Reset between;
9// and D3D12's allocator rules through the proxy (Reset while a list records: E_FAIL; a second list on a busy
10// allocator: E_INVALIDARG);
11// - MakeResident/Evict with an allocator proxy give the real allocator's HRESULT;
12// - host runtime: slot 9 hands out the PC allocator unwrapped (its lists could not resolve a proxy), and the same
13// copy works.
14// LEONIDA_VK_VALIDATION=1 runs the Vulkan device under VK_LAYER_KHRONOS_validation with synchronization validation;
15// any validation error fails the test. Exits 77 when neither a host D3D12 device nor a Vulkan device can be made.
16// No shaders, game data or Xbox DLLs.
17#include "vk_test_device.h"
18#include "../shims/d3d12_com.h"
19#include "../shims/d3d12_xs_device.h"
20
21#include <d3d12.h>
22#include <dxgi1_4.h>
23
24#include <cstdint>
25#include <cstdio>
26#include <cstring>
27
28#define EXPECT(condition) do { \
29 if (!(condition)) { std::fprintf(stderr, "%s line %d: %s\n", label, __LINE__, #condition); return 1; } \
30} while (0)
31
32namespace {
33
34namespace xs = rt::d3d12_xs;
35
36template <class T>
37struct Ref {
38 T* p = nullptr;
39 Ref() = default;
40 Ref(const Ref&) = delete;
41 Ref& operator=(const Ref&) = delete;
42 ~Ref() { reset(); }
43 void reset() {
44 if (p) p->Release();
45 p = nullptr;
46 }
47 T* operator->() const { return p; }
48};
49
50struct Backend {
51 const char* label;
52 ID3D12Device* device; // the device proxy
53 ID3D12Device* real; // the device behind it (PC runtime or Vulkan layer)
54 bool vulkan;
55};
56
57using SlotFn = std::uint64_t(WINAPI*)(void*, std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t,
58 std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t,
59 std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t);
60
61// A call through slot `slot` with all words zero, the way a title calls a console method the PC interface lacks.
62HRESULT call_slot(void* object, unsigned slot) {
63 void** vtable = *reinterpret_cast<void***>(object);
64 return static_cast<HRESULT>(static_cast<std::uint32_t>(
65 reinterpret_cast<SlotFn>(vtable[slot])(object, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
66}
67
68ULONG_PTR g_fault_address = 0;
69
70int record_fault(EXCEPTION_POINTERS* info) {
71 g_fault_address = info->ExceptionRecord->NumberParameters >= 2 ? info->ExceptionRecord->ExceptionInformation[1] : 0;
72 return EXCEPTION_EXECUTE_HANDLER;
73}
74
75// The read in a function of its own: clang-cl's __try only catches a fault raised inside a call.
76__declspec(noinline) void* read_entry(void* const* vtable, unsigned slot) {
77 return *static_cast<void* const volatile*>(&vtable[slot]);
78}
79
80// Reads vtable[slot] the way a call through it does. The exception code, or 0 when the read worked.
81DWORD read_slot_guarded(void* const* vtable, unsigned slot) {
82 g_fault_address = 0;
83 __try {
84 void* volatile entry = read_entry(vtable, slot);
85 (void)entry;
86 return 0;
87 } __except (record_fault(GetExceptionInformation())) {
88 return GetExceptionCode();
89 }
90}
91
92int wait_for(const char* label, ID3D12Fence* fence, UINT64 value) {
93 HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
94 EXPECT(event != nullptr);
95 const bool set = SUCCEEDED(fence->SetEventOnCompletion(value, event)) && WaitForSingleObject(event, 5000) == 0;
96 CloseHandle(event);
97 EXPECT(set && fence->GetCompletedValue() >= value);
98 return 0;
99}
100
101int make_buffer(const char* label, ID3D12Device* device, D3D12_HEAP_TYPE heap_type, D3D12_RESOURCE_STATES state,
102 Ref<ID3D12Resource>& out) {
103 D3D12_HEAP_PROPERTIES heap{};
104 heap.Type = heap_type;
105 D3D12_RESOURCE_DESC desc{};
106 desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
107 desc.Width = 256;
108 desc.Height = desc.DepthOrArraySize = desc.MipLevels = 1;
109 desc.SampleDesc.Count = 1;
110 desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
111 EXPECT(SUCCEEDED(device->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, state, nullptr,
112 IID_PPV_ARGS(&out.p))));
113 return 0;
114}
115
116// One recording on `list` (open, recording into the allocator): 256 bytes of `byte` copied from an upload buffer to a
117// readback buffer, executed through the queue proxy, finished through the fence proxy at `value`, then compared.
118int copy_round(const char* label, ID3D12Device* device, ID3D12CommandQueue* queue, ID3D12Fence* fence,
119 ID3D12GraphicsCommandList* list, std::uint8_t byte, UINT64 value) {
120 Ref<ID3D12Resource> upload, readback;
121 if (make_buffer(label, device, D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_STATE_GENERIC_READ, upload)) return 1;
122 if (make_buffer(label, device, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST, readback)) return 1;
123 void* mapped = nullptr;
124 EXPECT(SUCCEEDED(upload->Map(0, nullptr, &mapped)) && mapped);
125 std::memset(mapped, byte, 256);
126 upload->Unmap(0, nullptr);
127 list->CopyBufferRegion(readback.p, 0, upload.p, 0, 256);
128 EXPECT(SUCCEEDED(list->Close()));
129 ID3D12CommandList* lists[] = {list};
130 queue->ExecuteCommandLists(1, lists);
131 EXPECT(SUCCEEDED(queue->Signal(fence, value)));
132 if (wait_for(label, fence, value)) return 1;
133 const D3D12_RANGE read{0, 256};
134 EXPECT(SUCCEEDED(readback->Map(0, &read, &mapped)) && mapped);
135 const auto* bytes = static_cast<const std::uint8_t*>(mapped);
136 int wrong = 0;
137 for (int i = 0; i < 256; ++i) wrong += bytes[i] != byte;
138 const D3D12_RANGE none{0, 0};
139 readback->Unmap(0, &none);
140 EXPECT(wrong == 0);
141 return 0;
142}
143
144// ---- 1. The proxy itself: slots, identity, guard (Vulkan device) ----
145
146int check_proxy(const Backend& b, ID3D12CommandAllocator* allocator) {
147 const char* label = b.label;
148 ID3D12CommandAllocator* real = xs::allocator_proxy_real_allocator(allocator);
149 EXPECT(real && static_cast<void*>(real) != static_cast<void*>(allocator));
150 EXPECT(xs::allocator_proxy_slot_count(allocator) == 9);
151 EXPECT(xs::command_object_proxy_ref_count(allocator) == 1);
152
153 // QueryInterface: the base chain and the allocator itself answer with the proxy; anything else is refused.
154 const IID modelled[] = {__uuidof(IUnknown), __uuidof(ID3D12Object), __uuidof(ID3D12DeviceChild),
155 __uuidof(ID3D12Pageable), __uuidof(ID3D12CommandAllocator)};
156 for (const IID& iid : modelled) {
157 void* same = nullptr;
158 EXPECT(SUCCEEDED(allocator->QueryInterface(iid, &same)) && same == allocator);
159 static_cast<IUnknown*>(same)->Release();
160 }
161 void* other = reinterpret_cast<void*>(1);
162 EXPECT(allocator->QueryInterface(__uuidof(ID3D12Fence), &other) == E_NOINTERFACE && !other);
163 other = reinterpret_cast<void*>(1); // the Vulkan layer's private tag: not modelled, the real object stays hidden
164 EXPECT(allocator->QueryInterface(xs::kLeonidaCommandAllocatorTag, &other) == E_NOINTERFACE && !other);
165 EXPECT(xs::command_object_proxy_ref_count(allocator) == 1);
166
167 ID3D12Device* owner = nullptr;
168 EXPECT(SUCCEEDED(allocator->GetDevice(IID_PPV_ARGS(&owner))) && owner == b.device);
169 owner->Release();
170 // Private data and SetName go to the real allocator; the proxy pointer round-trips as an interface.
171 EXPECT(SUCCEEDED(allocator->SetName(L"leonida allocator proxy")));
172 constexpr GUID key{0x2a6b8c41, 0x77d2, 0x4e19, {0x9c, 0x3a, 0x51, 0xe0, 0x8f, 0x24, 0x6d, 0x0b}};
173 EXPECT(SUCCEEDED(allocator->SetPrivateDataInterface(key, allocator)));
174 IUnknown* back = nullptr;
175 UINT size = sizeof(back);
176 EXPECT(SUCCEEDED(allocator->GetPrivateData(key, &size, &back)) && back == allocator);
177 back->Release();
178 EXPECT(SUCCEEDED(allocator->SetPrivateDataInterface(key, nullptr)));
179
180 // The refused tail: every slot past the public chain, up to the table end, is E_NOTIMPL and counted.
181 const unsigned table = xs::allocator_proxy_table_size();
182 EXPECT(table == 64);
183 for (unsigned slot = 9; slot < table; ++slot) {
184 const std::uint64_t before = xs::allocator_slot_hits(slot);
185 EXPECT(call_slot(allocator, slot) == E_NOTIMPL);
186 EXPECT(xs::allocator_slot_hits(slot) == before + 1 && xs::allocator_slot_first_call_seen(slot));
187 }
188
189 // Past the table: the vtable read itself faults in the guard region, at the slot's address, and is counted.
190 EXPECT(xs::command_object_tables_guarded());
191 void* const* vtable = *reinterpret_cast<void* const* const*>(allocator);
192 EXPECT(read_slot_guarded(vtable, table - 1) == 0);
193 for (unsigned slot : {table, table + 512, table + 7000}) {
194 const std::uint64_t before = xs::allocator_table_overruns();
195 EXPECT(read_slot_guarded(vtable, slot) == EXCEPTION_ACCESS_VIOLATION);
196 EXPECT(g_fault_address == reinterpret_cast<ULONG_PTR>(&vtable[slot]));
197 EXPECT(xs::allocator_table_overruns() == before + 1);
198 }
199 std::printf("%s: allocator proxy: 9 public slots forwarded, slots 9-%u refused, the guard region names a read "
200 "past the table; QueryInterface/GetDevice/private data keep the proxy identity\n", label, table - 1);
201 return 0;
202}
203
204// ---- 2. Lists on the allocator, GPU work, D3D12's allocator rules, residency ----
205
206int check_backend(const Backend& b) {
207 const char* label = b.label;
208 const unsigned long device_refs = xs::device_proxy_ref_count(b.device);
209 {
210 Ref<ID3D12CommandAllocator> allocator;
211 EXPECT(SUCCEEDED(b.device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
212 IID_PPV_ARGS(&allocator.p))));
213 // Vulkan layer: wrapped. Host runtime: its lists could not resolve a proxy, so the PC allocator comes back.
214 EXPECT(xs::is_allocator_proxy(allocator.p) == b.vulkan);
215 if (b.vulkan && check_proxy(b, allocator.p)) return 1;
216 // As IUnknown, and without an output (the device's own answer), as slot 8 does for queues.
217 Ref<IUnknown> as_unknown;
218 EXPECT(SUCCEEDED(b.device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(IUnknown),
219 reinterpret_cast<void**>(&as_unknown.p))));
220 EXPECT(xs::is_allocator_proxy(as_unknown.p) == b.vulkan);
221#pragma warning(suppress : 6387) // the null output on purpose
222 EXPECT(b.device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator),
223 nullptr) ==
224 b.real->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator),
225 nullptr));
226 Ref<ID3D12Fence> not_an_allocator; // asked for an interface the allocator does not have
227 not_an_allocator.p = reinterpret_cast<ID3D12Fence*>(1);
228 const HRESULT wrong_iid = b.device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
229 IID_PPV_ARGS(&not_an_allocator.p));
230 const bool cleared = !not_an_allocator.p;
231 not_an_allocator.p = nullptr;
232 EXPECT(FAILED(wrong_iid) && cleared);
233
234 D3D12_COMMAND_QUEUE_DESC queue_desc{};
235 Ref<ID3D12CommandQueue> queue;
236 Ref<ID3D12Fence> fence;
237 EXPECT(SUCCEEDED(b.device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))));
238 EXPECT(SUCCEEDED(b.device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))));
239 EXPECT(xs::is_queue_proxy(queue.p) && xs::is_fence_proxy(fence.p));
240
241 // A list on the allocator: the Vulkan layer resolves the proxy in CreateCommandList.
242 Ref<ID3D12GraphicsCommandList> list;
243 EXPECT(SUCCEEDED(b.device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr,
244 IID_PPV_ARGS(&list.p))));
245 // D3D12's rules, through the proxy: a recording list holds the allocator.
246 const std::uint64_t resets_before = xs::allocator_slot_hits(8);
247 EXPECT(allocator->Reset() == E_FAIL);
248 Ref<ID3D12GraphicsCommandList> second;
249 EXPECT(b.device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr,
250 IID_PPV_ARGS(&second.p)) == E_INVALIDARG && !second.p);
251 if (copy_round(label, b.device, queue.p, fence.p, list.p, 0x5a, 1)) return 1;
252
253 // Done on the GPU: the allocator resets through the proxy, and the list resets onto it (Reset resolves it).
254 EXPECT(SUCCEEDED(allocator->Reset()));
255 EXPECT(SUCCEEDED(list->Reset(allocator.p, nullptr)));
256 if (copy_round(label, b.device, queue.p, fence.p, list.p, 0xa5, 2)) return 1;
257 // The two allocator Reset calls above went through slot 8 (list->Reset is the list's method, not this one).
258 if (b.vulkan) EXPECT(xs::allocator_slot_hits(8) == resets_before + 2);
259
260 // Residency: the real runtime gets the real allocator (an allocator is a pageable).
261 ID3D12Pageable* pageable = allocator.p;
262 ID3D12CommandAllocator* real_allocator =
263 b.vulkan ? xs::allocator_proxy_real_allocator(allocator.p) : allocator.p;
264 ID3D12Pageable* real_pageable = real_allocator;
265 EXPECT(b.device->MakeResident(1, &pageable) == b.real->MakeResident(1, &real_pageable));
266 EXPECT(b.device->Evict(1, &pageable) == b.real->Evict(1, &real_pageable));
267
268 // Release orders: the allocator first while its (closed) list still exists, then the list.
269 if (b.vulkan) EXPECT(xs::command_object_proxy_ref_count(allocator.p) == 1);
270 allocator.reset();
271 list.reset();
272 }
273 EXPECT(xs::device_proxy_ref_count(b.device) == device_refs); // nothing the proxies made kept the device
274 std::printf("%s: CreateCommandAllocator %s; a list created and Reset on it, two GPU copies through the queue and "
275 "fence proxies read back exactly; allocator rules and residency as on the real allocator\n", label,
276 b.vulkan ? "returns an allocator proxy" : "returns the PC allocator unwrapped");
277 return 0;
278}
279
280int run_host(IDXGIAdapter1* adapter, const char* label) {
281 ID3D12Device* real = nullptr;
282 if (FAILED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&real)))) {
283 std::printf("%s: no D3D12 device, skipped\n", label);
284 return 77;
285 }
286 real->AddRef(); // the backend's own reference; the proxy takes the other
287 Ref<ID3D12Device> device;
288 if (FAILED(xs::create_device_proxy(real, __uuidof(ID3D12Device), reinterpret_cast<void**>(&device.p)))) {
289 real->Release();
290 real->Release();
291 std::fprintf(stderr, "%s: device proxy creation failed\n", label);
292 return 1;
293 }
294 const int result = check_backend(Backend{label, device.p, real, false});
295 device.reset();
296 if (result) return 1;
297 if (real->Release() != 0) {
298 std::fprintf(stderr, "%s: the PC device outlives its proxies\n", label);
299 return 1;
300 }
301 return 0;
302}
303
304} // namespace
305
306// A failure ends the process with a message on stderr, never in a dialog a test run would wait on.
307static void no_dialogs() {
308 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
309 SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
310}
311
312int main() {
313 no_dialogs();
314 std::setvbuf(stdout, nullptr, _IONBF, 0);
315 const char* label = "allocator_proxy_test";
316 int ran = 0;
317
318 // Host PC runtime: WARP, then the first hardware adapter. Under Wine the host d3d12.dll is Wine's own, not the
319 // PC runtime the proxy is written against, so only Vulkan runs there.
320 const bool wine = GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version") != nullptr;
321 Ref<IDXGIFactory4> factory;
322 if (wine) std::printf("host D3D12: under Wine, skipped\n");
323 if (!wine && SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&factory.p)))) {
324 Ref<IDXGIAdapter1> warp;
325 if (SUCCEEDED(factory->EnumWarpAdapter(IID_PPV_ARGS(&warp.p)))) {
326 const int r = run_host(warp.p, "host WARP");
327 if (r == 1) return 1;
328 ran += r == 0;
329 }
330 for (UINT i = 0;; ++i) {
331 Ref<IDXGIAdapter1> adapter;
332 if (factory->EnumAdapters1(i, &adapter.p) == DXGI_ERROR_NOT_FOUND) break;
333 DXGI_ADAPTER_DESC1 desc{};
334 if (FAILED(adapter->GetDesc1(&desc)) || (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)) continue;
335 char name[128] = {};
336 WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, name, sizeof(name) - 1, nullptr, nullptr);
337 char host_label[160];
338 std::snprintf(host_label, sizeof(host_label), "host %s", name);
339 const int r = run_host(adapter.p, host_label);
340 if (r == 1) return 1;
341 ran += r == 0;
342 break;
343 }
344 }
345
346 // The Vulkan-backed device, the way D3D12XboxCreateDevice hands it out with LEONIDA_D3D12=vulkan.
347 vktest::Device d;
348 if (d.create()) {
349 label = "Vulkan";
350 rt::d3d12::VulkanDeviceInfo info{};
351 info.get_instance_proc = d.instance_proc;
352 info.instance = d.instance;
353 info.physical = d.physical;
354 info.device = d.device;
355 info.queue = d.queue;
356 info.queue_family = d.family;
357 ID3D12Device* inner = nullptr;
358 EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner))));
359 inner->AddRef(); // the backend's own reference; the proxy takes the other
360 ID3D12Device* device = nullptr;
361 EXPECT(SUCCEEDED(xs::create_device_proxy(inner, __uuidof(ID3D12Device), reinterpret_cast<void**>(&device))));
362 rt::d3d12::set_device_outer(inner, device);
363 const int result = check_backend(Backend{label, device, inner, true});
364 device->Release();
365 if (result) return 1;
366 EXPECT(inner->Release() == 0); // nothing the proxies made kept the layer's device alive
367 ++ran;
368 if (d.validation_errors()) {
369 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
370 return 1;
371 }
372 } else {
373 std::printf("Vulkan: no device, skipped\n");
374 }
375
376 if (!ran) {
377 std::printf("SKIP allocator_proxy_test: neither a host D3D12 device nor a Vulkan device\n");
378 return 77;
379 }
380 std::printf("allocator_proxy_test: %d backend(s) passed\n", ran);
381 return 0;
382}
diff --git a/runtime/test/bindless_sizing_test.cpp b/runtime/test/bindless_sizing_test.cpp
index 469274d56..07715f01e 100644
--- a/runtime/test/bindless_sizing_test.cpp
+++ b/runtime/test/bindless_sizing_test.cpp
@@ -172,6 +172,37 @@ int main() {
172 EXPECT(totals(f).all <= 30000 && count(f, D::dim_2d) > 4096); 172 EXPECT(totals(f).all <= 30000 && count(f, D::dim_2d) > 4096);
173 } 173 }
174 174
175 // D3D-219: past maxPerSetDescriptors, growth follows layout_supported (vkGetDescriptorSetLayoutSupport), which
176 // is asked only above that limit. Intel's Xe-LP reports 6159 and supports the full sizes.
177 {
178 Device d = uniform(1048576, 1048576);
179 d.v11.maxPerSetDescriptors = 6159;
180 d.limits.maxSamplerAllocationCount = 4000;
181 unsigned asked = 0, asked_within = 0;
182 const auto all_supported = [&](const BindlessFeatures& candidate) {
183 ++asked;
184 asked_within += totals(candidate).all <= 6159;
185 return true;
186 };
187 BindlessFeatures f = with_ms(true);
188 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, all_supported));
189 EXPECT(asked > 0 && asked_within == 0);
190 EXPECT(count(f, D::dim_2d) == bindless::max_2d_images &&
191 f.counts[bindless::sampler_binding] == 4000 - bindless::reserved_samplers);
192 EXPECT(storage(f, D::dim_2d) == bindless::max_storage_indices && storage_consistent(f));
193
194 // A driver that supports less: growth stops where it says no.
195 const auto up_to_20000 = [&](const BindlessFeatures& candidate) { return totals(candidate).all <= 20000; };
196 f = with_ms(true);
197 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, up_to_20000));
198 EXPECT(totals(f).all <= 20000 && totals(f).all > 6159 && count(f, D::dim_2d) > 4096);
199
200 // Without the callback, maxPerSetDescriptors still caps growth as before.
201 f = with_ms(true);
202 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12));
203 EXPECT(totals(f).all <= 6159 || (count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024));
204 }
205
175 // The default features are today's counts, which the device-less users (vk_image_fuzz) still get. 206 // The default features are today's counts, which the device-less users (vk_image_fuzz) still get.
176 EXPECT(BindlessFeatures{}.counts == defaults); 207 EXPECT(BindlessFeatures{}.counts == defaults);
177 std::printf("bindless sizing: synthetic limits gave the expected counts\n"); 208 std::printf("bindless sizing: synthetic limits gave the expected counts\n");
diff --git a/runtime/test/check_d3d12_trace.py b/runtime/test/check_d3d12_trace.py
index a95f01b35..d24e02058 100644
--- a/runtime/test/check_d3d12_trace.py
+++ b/runtime/test/check_d3d12_trace.py
@@ -50,12 +50,17 @@ def main():
50 ] 50 ]
51 else: 51 else:
52 expected = [ 52 expected = [
53 "ID3D12GraphicsCommandList::SetPipelineState called",
54 "ID3D12GraphicsCommandList::SetGraphicsRootSignature called",
53 "ID3D12GraphicsCommandList::SetMarker called", 55 "ID3D12GraphicsCommandList::SetMarker called",
54 "ID3D12GraphicsCommandList3::SetProtectedResourceSession unsupported", 56 "ID3D12GraphicsCommandList3::SetProtectedResourceSession unsupported",
55 "ID3D12GraphicsCommandList3::SetProtectedResourceSession unsupported", 57 "ID3D12GraphicsCommandList3::SetProtectedResourceSession unsupported",
56 "ID3D12GraphicsCommandList::Close ok", 58 "ID3D12GraphicsCommandList::Close ok",
57 "ID3D12GraphicsCommandList::Close failed", 59 "ID3D12GraphicsCommandList::Close failed",
58 "ID3D12GraphicsCommandList::Reset ok", 60 "ID3D12GraphicsCommandList::Reset ok",
61 "ID3D12GraphicsCommandList::DrawInstanced called",
62 "ID3D12GraphicsCommandList::DrawIndexedInstanced called",
63 "ID3D12GraphicsCommandList::Close failed",
59 ] 64 ]
60 65
61 observed = iter(entries) 66 observed = iter(entries)
diff --git a/runtime/test/check_vk_pipeline_cli.cmake b/runtime/test/check_vk_pipeline_cli.cmake
new file mode 100644
index 000000000..4800d2605
--- /dev/null
+++ b/runtime/test/check_vk_pipeline_cli.cmake
@@ -0,0 +1,33 @@
1file(MAKE_DIRECTORY "${TEST_DIR}")
2file(WRITE "${TEST_DIR}/index.json" "not JSON\n")
3
4# ${RUNNER} is CMAKE_CROSSCOMPILING_EMULATOR: CTest does not apply it to a script
5# test (the command is the host CMake), so the script runs the tool through it itself.
6function(check_invalid option)
7 execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}" "${option}" ${ARGN}
8 RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5)
9 if(NOT code STREQUAL "2" OR NOT log MATCHES "${option} requires a valid value")
10 message(FATAL_ERROR "${option} ${ARGN}: expected usage error, got ${code}\n${log}")
11 endif()
12endfunction()
13
14check_invalid(--count)
15check_invalid(--count --compute-only)
16check_invalid(--count 18446744073709551616)
17check_invalid(--jobs 4294967296)
18check_invalid(--start -1)
19check_invalid(--max-bytes 1MiB)
20check_invalid(--large-module-bytes -1)
21check_invalid(--slow nonsense)
22check_invalid(--slow nan)
23check_invalid(--slow -0.5)
24check_invalid(--stage --graphics-only)
25check_invalid(--stats)
26
27execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}"
28 --jobs 2 --start 3 --count 0 --max-bytes 0 --large-module-bytes 0
29 --slow 0.5 --stage cs --stats report.csv
30 RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5)
31if(NOT code STREQUAL "2" OR NOT log MATCHES "malformed JSON")
32 message(FATAL_ERROR "Expected valid arguments to reach the malformed index, got ${code}\n${log}")
33endif()
diff --git a/runtime/test/d3d12_clear_test.cpp b/runtime/test/d3d12_clear_test.cpp
index 53103a31f..3d2cd3944 100644
--- a/runtime/test/d3d12_clear_test.cpp
+++ b/runtime/test/d3d12_clear_test.cpp
@@ -350,6 +350,9 @@ int main(int argc, char** argv) {
350 const ColorFormat color_formats[] = { 350 const ColorFormat color_formats[] = {
351 {DXGI_FORMAT_R8G8B8A8_UNORM, "R8G8B8A8_UNORM", 4, float_values, nf}, 351 {DXGI_FORMAT_R8G8B8A8_UNORM, "R8G8B8A8_UNORM", 4, float_values, nf},
352 {DXGI_FORMAT_R8G8B8A8_SNORM, "R8G8B8A8_SNORM", 4, float_values, nf}, 352 {DXGI_FORMAT_R8G8B8A8_SNORM, "R8G8B8A8_SNORM", 4, float_values, nf},
353 // B8G8R8X8 is stored in a BGRA8 image; B8G8R8A8 next to it shows what the X byte changes.
354 {DXGI_FORMAT_B8G8R8A8_UNORM, "B8G8R8A8_UNORM", 4, float_values, nf},
355 {DXGI_FORMAT_B8G8R8X8_UNORM, "B8G8R8X8_UNORM", 4, float_values, nf},
353 {DXGI_FORMAT_R32G32B32A32_FLOAT, "R32G32B32A32_FLOAT", 16, float_values, nf}, 356 {DXGI_FORMAT_R32G32B32A32_FLOAT, "R32G32B32A32_FLOAT", 16, float_values, nf},
354 {DXGI_FORMAT_R8G8_UINT, "R8G8_UINT", 2, int_values, ni}, 357 {DXGI_FORMAT_R8G8_UINT, "R8G8_UINT", 2, int_values, ni},
355 {DXGI_FORMAT_R8G8B8A8_UINT, "R8G8B8A8_UINT", 4, int_values, ni}, 358 {DXGI_FORMAT_R8G8B8A8_UINT, "R8G8B8A8_UINT", 4, int_values, ni},
diff --git a/runtime/test/d3d12_compute_test.cpp b/runtime/test/d3d12_compute_test.cpp
index 2ac216bcb..e53f9ab4b 100644
--- a/runtime/test/d3d12_compute_test.cpp
+++ b/runtime/test/d3d12_compute_test.cpp
@@ -10,6 +10,7 @@
10// No game data. Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation. 10// No game data. Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation.
11#include "vk_test_device.h" 11#include "vk_test_device.h"
12#include "../shims/d3d12_com.h" 12#include "../shims/d3d12_com.h"
13#include "../src/gfx10_descriptors.h"
13#include "../src/shader_library.h" 14#include "../src/shader_library.h"
14#include "../shims/d3d12_xs_device.h" 15#include "../shims/d3d12_xs_device.h"
15 16
@@ -33,6 +34,8 @@ using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10
33// Device slot 62 as XboxBvhBuilder.dll calls it on 1.0.2.1: (desc, 0, 0, riid, out) (main's 28cf235). 34// Device slot 62 as XboxBvhBuilder.dll calls it on 1.0.2.1: (desc, 0, 0, riid, out) (main's 28cf235).
34using XboxComputePipelineFn = HRESULT(WINAPI*)(void* device, const D3D12_COMPUTE_PIPELINE_STATE_DESC*, std::uint64_t, 35using XboxComputePipelineFn = HRESULT(WINAPI*)(void* device, const D3D12_COMPUTE_PIPELINE_STATE_DESC*, std::uint64_t,
35 std::uint64_t, const IID*, void**); 36 std::uint64_t, const IID*, void**);
37// Device slot 67 as amd_fidelityfx_upscaler_xbox.dll calls it: (desc, riid, out).
38using XboxNativeComputePipelineFn = HRESULT(WINAPI*)(void* device, const void*, const IID*, void**);
36using SerializeFn = HRESULT(WINAPI*)(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC*, ID3DBlob**, ID3DBlob**); 39using SerializeFn = HRESULT(WINAPI*)(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC*, ID3DBlob**, ID3DBlob**);
37 40
38template<class T> 41template<class T>
@@ -169,6 +172,7 @@ int main() {
169 constexpr UINT elements = 64, bytes = elements * 4; 172 constexpr UINT elements = 64, bytes = elements * 4;
170 const std::uint32_t table_values[4] = {1000, 2000, 3000, 4000}; 173 const std::uint32_t table_values[4] = {1000, 2000, 3000, 4000};
171 std::vector<std::uint32_t> first(elements), second(elements); 174 std::vector<std::uint32_t> first(elements), second(elements);
175 std::vector<std::uint32_t> cbv_a_out(elements), cbv_oob_out(elements), cbv_b_out(elements), cbv_null_out(elements);
172 { 176 {
173 rt::d3d12::VulkanDeviceInfo info{}; 177 rt::d3d12::VulkanDeviceInfo info{};
174 info.get_instance_proc = d.instance_proc; 178 info.get_instance_proc = d.instance_proc;
@@ -178,6 +182,7 @@ int main() {
178 info.queue = d.queue; 182 info.queue = d.queue;
179 info.queue_family = d.family; 183 info.queue_family = d.family;
180 info.buffer_device_address = true; 184 info.buffer_device_address = true;
185 info.subgroup = d.subgroup;
181 info.shader_dir = library.string(); 186 info.shader_dir = library.string();
182 ID3D12Device* inner = nullptr; 187 ID3D12Device* inner = nullptr;
183 EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner)))); 188 EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner))));
@@ -220,6 +225,40 @@ int main() {
220 EXPECT(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&unknown.p)) == E_INVALIDARG && !unknown.p); 225 EXPECT(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&unknown.p)) == E_INVALIDARG && !unknown.p);
221 pso_desc.CS = {container.data(), container.size()}; 226 pso_desc.CS = {container.data(), container.size()};
222 227
228 // The PSO through slot 67, compute pipeline from native code; maps to CreateComputePipelineState.
229 struct XboxNativeComputeDesc {
230 ID3D12RootSignature* root_signature;
231 const void* kind0;
232 std::uint64_t kind0_size;
233 const void* kind1;
234 std::uint64_t kind1_size;
235 const void* kind6;
236 std::uint64_t kind6_size;
237 const void* kind7;
238 std::uint64_t kind7_size;
239 } native_desc{};
240 native_desc.root_signature = root.p;
241 native_desc.kind6 = fssm.data();
242 native_desc.kind6_size = fssm.size();
243 Ref<ID3D12PipelineState> pso67, unknown67;
244 EXPECT(SUCCEEDED(reinterpret_cast<XboxNativeComputePipelineFn>(slot(device.p, 67))(
245 device.p, &native_desc, &pso_iid, reinterpret_cast<void**>(&pso67.p))));
246 EXPECT(pso67.p != nullptr);
247 native_desc.kind6 = other.data();
248 native_desc.kind6_size = other.size();
249 EXPECT(reinterpret_cast<XboxNativeComputePipelineFn>(slot(device.p, 67))(
250 device.p, &native_desc, &pso_iid, reinterpret_cast<void**>(&unknown67.p)) == E_INVALIDARG && !unknown67.p);
251 void* out_null = reinterpret_cast<void*>(0x1111);
252 EXPECT(reinterpret_cast<XboxNativeComputePipelineFn>(slot(device.p, 67))(
253 device.p, nullptr, &pso_iid, &out_null) == E_INVALIDARG && !out_null);
254 out_null = reinterpret_cast<void*>(0x1111);
255 native_desc.kind6 = fssm.data();
256 native_desc.kind6_size = fssm.size();
257 EXPECT(reinterpret_cast<XboxNativeComputePipelineFn>(slot(device.p, 67))(
258 device.p, &native_desc, nullptr, &out_null) == E_POINTER && !out_null);
259 EXPECT(reinterpret_cast<XboxNativeComputePipelineFn>(slot(device.p, 67))(
260 device.p, &native_desc, &pso_iid, nullptr) == E_POINTER);
261
223 // A device whose maxPushConstantsSize is the Vulkan minimum (128 bytes) cannot hold the 144-byte block, so 262 // A device whose maxPushConstantsSize is the Vulkan minimum (128 bytes) cannot hold the 144-byte block, so
224 // its PSOs are refused instead of creating a pipeline layout the spec forbids (#224's fallback flag). 263 // its PSOs are refused instead of creating a pipeline layout the spec forbids (#224's fallback flag).
225 { 264 {
@@ -343,6 +382,128 @@ int main() {
343 std::memcpy(first.data(), results, bytes); 382 std::memcpy(first.data(), results, bytes);
344 std::memcpy(second.data(), static_cast<const std::uint8_t*>(results) + bytes, bytes); 383 std::memcpy(second.data(), static_cast<const std::uint8_t*>(results) + bytes, bytes);
345 384
385 // CreateConstantBufferView: populate shader-visible descriptor heap slots with GFX10 V# descriptors for a
386 // 512-byte arena constant buffer (two 256-byte CBVs: A at +0, B at +256) and null CBVs.
387 {
388 const UINT inc = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
389 EXPECT(inc == 32);
390 const auto cb_desc = buffer_desc(512, D3D12_RESOURCE_FLAG_NONE);
391 Ref<ID3D12Resource> cb_upload, cb_default, cb_readback;
392 EXPECT(SUCCEEDED(device->CreateCommittedResource(&upload_heap, D3D12_HEAP_FLAG_NONE, &cb_desc,
393 D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
394 IID_PPV_ARGS(&cb_upload.p))));
395 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &cb_desc,
396 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
397 IID_PPV_ARGS(&cb_default.p))));
398 const auto cb_rb_desc = buffer_desc(4 * bytes, D3D12_RESOURCE_FLAG_NONE);
399 EXPECT(SUCCEEDED(device->CreateCommittedResource(&readback_heap, D3D12_HEAP_FLAG_NONE, &cb_rb_desc,
400 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
401 IID_PPV_ARGS(&cb_readback.p))));
402 void* cb_mapped = nullptr;
403 EXPECT(SUCCEEDED(cb_upload->Map(0, nullptr, &cb_mapped)));
404 auto* cb_words = static_cast<std::uint32_t*>(cb_mapped);
405 for (UINT i = 0; i < elements; ++i) {
406 cb_words[i] = 0x10000u + i;
407 cb_words[elements + i] = 0x20000u + i;
408 }
409 const D3D12_GPU_VIRTUAL_ADDRESS cb_va = cb_default->GetGPUVirtualAddress();
410 EXPECT(cb_va >= 0x10000 && cb_va < (1ull << 32));
411
412 const auto slot_cpu = [&](UINT idx) { return D3D12_CPU_DESCRIPTOR_HANDLE{SIZE_T(cpu + idx * inc)}; };
413 const auto slot_gpu = [&](UINT idx) { return D3D12_GPU_DESCRIPTOR_HANDLE{gpu + idx * inc}; };
414
415 // Pre-fill slot 3 with non-zero bytes to prove null CBV zeroes the entire 32-byte slot.
416 std::memset(reinterpret_cast<void*>(slot_cpu(3).ptr), 0xA5, inc);
417 device->CreateConstantBufferView(nullptr, slot_cpu(3));
418 std::uint8_t zeros[32] = {};
419 EXPECT(std::memcmp(reinterpret_cast<const void*>(slot_cpu(3).ptr), zeros, sizeof(zeros)) == 0);
420
421 // Zero BufferLocation or zero SizeInBytes also produces a zeroed null V#.
422 const D3D12_CONSTANT_BUFFER_VIEW_DESC zero_loc{0, 256};
423 std::memset(reinterpret_cast<void*>(slot_cpu(3).ptr), 0x5A, inc);
424 device->CreateConstantBufferView(&zero_loc, slot_cpu(3));
425 EXPECT(std::memcmp(reinterpret_cast<const void*>(slot_cpu(3).ptr), zeros, sizeof(zeros)) == 0);
426 const D3D12_CONSTANT_BUFFER_VIEW_DESC zero_size{cb_va, 0};
427 std::memset(reinterpret_cast<void*>(slot_cpu(3).ptr), 0x5A, inc);
428 device->CreateConstantBufferView(&zero_size, slot_cpu(3));
429 EXPECT(std::memcmp(reinterpret_cast<const void*>(slot_cpu(3).ptr), zeros, sizeof(zeros)) == 0);
430
431 const D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_a{cb_va, 256};
432 const D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_b{cb_va + 256, 256};
433 device->CreateConstantBufferView(&cbv_a, slot_cpu(1));
434 device->CreateConstantBufferView(&cbv_b, slot_cpu(2));
435
436 // Decode the written V# in slots 1 and 2 and verify every field + zeroed trailing 16 bytes.
437 for (const auto& [slot_idx, expected_va] :
438 {std::pair{1u, std::uint64_t(cb_va)}, std::pair{2u, std::uint64_t(cb_va + 256)}}) {
439 leonida::gfx10::BufferWords raw{};
440 std::memcpy(raw.data(), reinterpret_cast<const void*>(slot_cpu(slot_idx).ptr), sizeof(raw));
441 leonida::gfx10::Buffer decoded{};
442 EXPECT(leonida::gfx10::decode(raw, decoded));
443 EXPECT(decoded.address == expected_va);
444 EXPECT(decoded.stride == 0);
445 EXPECT(decoded.num_records == 256);
446 EXPECT(decoded.format == leonida::gfx10::format_from_vulkan(VK_FORMAT_R32_UINT));
447 EXPECT(decoded.swizzle == leonida::gfx10::identity_swizzle);
448 EXPECT(decoded.oob_select == leonida::gfx10::OobSelect::raw);
449 EXPECT(std::memcmp(reinterpret_cast<const std::uint8_t*>(slot_cpu(slot_idx).ptr) + 16, zeros, 16) == 0);
450 }
451
452 // Copy CBV data into the arena buffer, then run 4 dispatches:
453 // 1) CBV A at byte offset 0 (all 64 dwords in-bounds)
454 // 2) CBV A at byte offset 128 (dwords 0..31 in-bounds, dwords 32..63 OOB -> 0)
455 // 3) CBV B at byte offset 0 (negative control: all 64 dwords flip to 0x20000 + i)
456 // 4) Null CBV at byte offset 0 (negative control: all 64 dwords become 0)
457 EXPECT(SUCCEEDED(allocator->Reset()) && SUCCEEDED(list->Reset(allocator.p, pso.p)));
458 list->CopyBufferRegion(cb_default.p, 0, cb_upload.p, 0, 512);
459 const D3D12_RESOURCE_BARRIER cb_ready[] = {
460 transition(cb_default.p, D3D12_RESOURCE_STATE_COPY_DEST,
461 D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER),
462 transition(out_a.p, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
463 };
464 list->ResourceBarrier(2, cb_ready);
465 list->SetDescriptorHeaps(1, heaps);
466 list->SetComputeRootSignature(root.p);
467 list->SetComputeRootUnorderedAccessView(1, va_a);
468
469 const struct CbvDispatch {
470 UINT byte_offset;
471 UINT slot_idx;
472 UINT readback_offset;
473 } cbv_dispatches[] = {
474 {0, 1, 0 * bytes},
475 {128, 1, 1 * bytes},
476 {0, 2, 2 * bytes},
477 {0, 3, 3 * bytes},
478 };
479 for (const auto& d_cfg : cbv_dispatches) {
480 const std::uint32_t rc[2] = {d_cfg.byte_offset, 0}; // s1 == 0 selects CBV V# mode
481 list->SetComputeRoot32BitConstants(0, 2, rc, 0);
482 list->SetComputeRootDescriptorTable(2, slot_gpu(d_cfg.slot_idx));
483 list->Dispatch(1, 1, 1);
484 const auto to_src =
485 transition(out_a.p, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
486 list->ResourceBarrier(1, &to_src);
487 list->CopyBufferRegion(cb_readback.p, d_cfg.readback_offset, out_a.p, 0, bytes);
488 const auto to_uav =
489 transition(out_a.p, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
490 list->ResourceBarrier(1, &to_uav);
491 }
492 EXPECT(list->Close() == S_OK);
493 queue->ExecuteCommandLists(1, lists);
494 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
495 EXPECT(SUCCEEDED(queue->Signal(fence.p, 2)));
496 EXPECT(SUCCEEDED(fence->SetEventOnCompletion(2, nullptr)));
497
498 void* cb_res = nullptr;
499 EXPECT(SUCCEEDED(cb_readback->Map(0, nullptr, &cb_res)));
500 const auto* src_bytes = static_cast<const std::uint8_t*>(cb_res);
501 std::memcpy(cbv_a_out.data(), src_bytes + 0 * bytes, bytes);
502 std::memcpy(cbv_oob_out.data(), src_bytes + 1 * bytes, bytes);
503 std::memcpy(cbv_b_out.data(), src_bytes + 2 * bytes, bytes);
504 std::memcpy(cbv_null_out.data(), src_bytes + 3 * bytes, bytes);
505 }
506
346 for (auto* r : {&out_a, &out_b, &constants, &readback}) r->reset(); 507 for (auto* r : {&out_a, &out_b, &constants, &readback}) r->reset();
347 pso.reset(); 508 pso.reset();
348 root.reset(); 509 root.reset();
@@ -363,6 +524,27 @@ int main() {
363 std::fprintf(stderr, "element %u: got %u and %u, want %u and %u\n", i, first[i], second[i], a, b); 524 std::fprintf(stderr, "element %u: got %u and %u, want %u and %u\n", i, first[i], second[i], a, b);
364 } 525 }
365 EXPECT(!mismatches); 526 EXPECT(!mismatches);
527 UINT cbv_b_diff = 0, cbv_null_diff = 0;
528 for (std::uint32_t i = 0; i < elements; ++i) {
529 const std::uint32_t want_a = 0x10000u + i;
530 const std::uint32_t want_oob = i < 32 ? (0x10000u + 32u + i) : 0u;
531 const std::uint32_t want_b = 0x20000u + i;
532 if (cbv_a_out[i] != want_a && mismatches++ < 4)
533 std::fprintf(stderr, "CBV A[%u]: got 0x%x want 0x%x\n", i, cbv_a_out[i], want_a);
534 if (cbv_oob_out[i] != want_oob && mismatches++ < 4)
535 std::fprintf(stderr, "CBV OOB[%u]: got 0x%x want 0x%x\n", i, cbv_oob_out[i], want_oob);
536 if (cbv_b_out[i] != want_b && mismatches++ < 4)
537 std::fprintf(stderr, "CBV B[%u]: got 0x%x want 0x%x\n", i, cbv_b_out[i], want_b);
538 if (cbv_null_out[i] != 0u && mismatches++ < 4)
539 std::fprintf(stderr, "CBV null[%u]: got 0x%x want 0\n", i, cbv_null_out[i]);
540 if (cbv_b_out[i] != cbv_a_out[i]) ++cbv_b_diff;
541 if (cbv_null_out[i] != cbv_a_out[i]) ++cbv_null_diff;
542 }
543 EXPECT(!mismatches);
544 EXPECT(cbv_b_diff == elements && cbv_null_diff == elements);
545 std::printf("CreateConstantBufferView: 64/64 dwords matched for CBV A, 32 in-bounds + 32 OOB-zero matched at "
546 "+128, negative controls flipped %u/%u (CBV B) and %u/%u (null CBV)\n",
547 cbv_b_diff, elements, cbv_null_diff, elements);
366 if (d.validation_errors()) { 548 if (d.validation_errors()) {
367 std::fprintf(stderr, "%u validation errors\n", d.validation_errors()); 549 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
368 return 1; 550 return 1;
diff --git a/runtime/test/d3d12_copy_compare.h b/runtime/test/d3d12_copy_compare.h
index 3679ab754..3d4281a17 100644
--- a/runtime/test/d3d12_copy_compare.h
+++ b/runtime/test/d3d12_copy_compare.h
@@ -5,7 +5,8 @@
5// into a readback buffer prefilled with 0xcd, and the bytes are compared. Only the texels a footprint row holds are 5// into a readback buffer prefilled with 0xcd, and the bytes are compared. Only the texels a footprint row holds are
6// compared (row padding is the driver's); everything else, including the 0xcd around a partial copy, must match. 6// compared (row padding is the driver's); everything else, including the 0xcd around a partial copy, must match.
7// Layouts come from the host's GetCopyableFootprints for both sides (those are compared separately). 7// Layouts come from the host's GetCopyableFootprints for both sides (those are compared separately).
8// LEONIDA_HOST_ADAPTER picks the host side: "warp", or part of an adapter name; unset is the default adapter. 8// LEONIDA_HOST_ADAPTER picks the host side: "warp", or part of an adapter name; unset is the layer's own adapter when
9// the test has set layer_adapter(), else the default adapter.
9#pragma once 10#pragma once
10#include <windows.h> 11#include <windows.h>
11#include <d3d12.h> 12#include <d3d12.h>
@@ -18,6 +19,7 @@
18#include <cstdio> 19#include <cstdio>
19#include <cstring> 20#include <cstring>
20#include <functional> 21#include <functional>
22#include <optional>
21#include <string> 23#include <string>
22#include <vector> 24#include <vector>
23 25
@@ -110,12 +112,25 @@ inline bool try_create_host(Ptr<ID3D12Device>& host, std::string& name, const LU
110 return true; 112 return true;
111} 113}
112 114
113// A host device, or false when there is none (the comparisons are then skipped). When LEONIDA_HOST_ADAPTER names an 115// The adapter behind the layer's Vulkan device (VkPhysicalDeviceIDProperties::deviceLUID), for a test that knows it.
114// adapter that cannot be had, the run fails: a typo must not turn the comparisons into a silent pass. 116// On a PC with two GPUs D3D12's default adapter can be the other one, whose driver accepts other formats (an AMD
117// layer device accepts an R9G9B9E5 render target that the NVIDIA host refuses), so the comparison would be between
118// two GPUs instead of between the layer and the host runtime.
119inline std::optional<LUID>& layer_adapter() {
120 static std::optional<LUID> luid;
121 return luid;
122}
123
124// A host device, or false when there is none (the comparisons are then skipped). Without LEONIDA_HOST_ADAPTER it is
125// on the layer's own adapter when that is set and has a D3D12 device, else on the default adapter. When
126// LEONIDA_HOST_ADAPTER names an adapter that cannot be had, the run fails: a typo must not turn the comparisons into a
127// silent pass.
115inline bool create_host(Ptr<ID3D12Device>& host, std::string& name) { 128inline bool create_host(Ptr<ID3D12Device>& host, std::string& name) {
116 if (try_create_host(host, name)) return true;
117 char want[128] = {}; 129 char want[128] = {};
118 if (GetEnvironmentVariableA("LEONIDA_HOST_ADAPTER", want, sizeof(want)) && want[0]) { 130 const bool named = GetEnvironmentVariableA("LEONIDA_HOST_ADAPTER", want, sizeof(want)) && want[0];
131 if (!named && layer_adapter() && try_create_host(host, name, &*layer_adapter())) return true;
132 if (try_create_host(host, name)) return true;
133 if (named) {
119 std::fprintf(stderr, "LEONIDA_HOST_ADAPTER=%s: no such adapter, or no D3D12 device on it\n", want); 134 std::fprintf(stderr, "LEONIDA_HOST_ADAPTER=%s: no such adapter, or no D3D12 device on it\n", want);
120 std::exit(1); 135 std::exit(1);
121 } 136 }
diff --git a/runtime/test/d3d12_descriptor_test.cpp b/runtime/test/d3d12_descriptor_test.cpp
index 4f587166b..2f6d059c3 100644
--- a/runtime/test/d3d12_descriptor_test.cpp
+++ b/runtime/test/d3d12_descriptor_test.cpp
@@ -13,6 +13,9 @@
13// CreateSampler2 samplers that clamp to a UINT (0,0,0,0) and (1,1,1,1) border, and a float white border on 13// CreateSampler2 samplers that clamp to a UINT (0,0,0,0) and (1,1,1,1) border, and a float white border on
14// the UNORM texture. Every texel is the border: 0, 1 and 255 in each channel. Both white borders are built in 14// the UNORM texture. Every texel is the border: 0, 1 and 255 in each channel. Both white borders are built in
15// at the same S# type, so this also checks that they are two samplers, not one. 15// at the same S# type, so this also checks that they are two samplers, not one.
16// - B8G8R8X8 (D3D-87): a B8G8R8X8_UNORM and a B8G8R8A8_UNORM texture uploaded with the same bytes, the fourth
17// never 255. Their default views read the same red, green and blue; B8G8R8X8 reads alpha 1, B8G8R8A8 the
18// stored byte. Views between the two typeless families give a null descriptor.
16// Multisample SRVs: four masked triangles seed different values per sample and array layer. A compute shader reads 19// Multisample SRVs: four masked triangles seed different values per sample and array layer. A compute shader reads
17// them back using the T#s for the 2D, full-array and sliced-array views. The test builds its pipelines in Vulkan 20// them back using the T#s for the 2D, full-array and sliced-array views. The test builds its pipelines in Vulkan
18// and binds the device's set (rt::d3d12::bindless_set). Without glslangValidator the GPU readbacks are skipped. 21// and binds the device's set (rt::d3d12::bindless_set). Without glslangValidator the GPU readbacks are skipped.
@@ -81,6 +84,13 @@ std::array<std::uint8_t, 4> texel(UINT x, UINT y) {
81 return {std::uint8_t(x * 32), std::uint8_t(y * 32), std::uint8_t(128 + x + 8 * y), 255}; 84 return {std::uint8_t(x * 32), std::uint8_t(y * 32), std::uint8_t(128 + x + 8 * y), 255};
82} 85}
83 86
87// The same texel in B, G, R memory order, with a fourth byte that is never 255: what a B8G8R8X8 texture and a
88// B8G8R8A8 one with the same bytes are uploaded with. Through a view the first reads alpha 1, the second this byte.
89std::array<std::uint8_t, 4> bgrx_texel(UINT x, UINT y) {
90 const auto t = texel(x, y);
91 return {t[2], t[1], t[0], std::uint8_t(3 * (y * 8 + x))};
92}
93
84#ifdef LEONIDA_TEST_CS_SAMPLE_SPV 94#ifdef LEONIDA_TEST_CS_SAMPLE_SPV
85// What cs_sample.comp is pushed: a T#, an S#, and where in the output buffer its 64 texels go. 95// What cs_sample.comp is pushed: a T#, an S#, and where in the output buffer its 64 texels go.
86struct SampleKeys { 96struct SampleKeys {
@@ -292,7 +302,7 @@ int main() {
292 if (device_status != vktest::DeviceStatus::ready) return 1; 302 if (device_status != vktest::DeviceStatus::ready) return 1;
293 303
294 constexpr UINT size = 8, texels = size * size, bytes = texels * 4; 304 constexpr UINT size = 8, texels = size * size, bytes = texels * 4;
295 std::vector<std::uint8_t> results(4 * bytes), after_destruction(bytes), borders(3 * bytes); 305 std::vector<std::uint8_t> results(4 * bytes), after_destruction(bytes), borders(3 * bytes), bgr_results(2 * bytes);
296 bool sampled_through_set = false; 306 bool sampled_through_set = false;
297 UINT lod_mismatches = 0; 307 UINT lod_mismatches = 0;
298 { 308 {
@@ -532,6 +542,32 @@ int main() {
532 for (UINT x = 0; x < fp.Width; ++x) std::memcpy(row + 4 * x, color.data(), 4); 542 for (UINT x = 0; x < fp.Width; ++x) std::memcpy(row + 4 * x, color.data(), 4);
533 } 543 }
534 } 544 }
545 // A B8G8R8X8_UNORM texture and a B8G8R8A8_UNORM one, uploaded with the same bgrx_texel bytes past the cube
546 // array's footprints.
547 constexpr DXGI_FORMAT bgr_formats[2] = {DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM};
548 Ref<ID3D12Resource> bgr_textures[2];
549 D3D12_PLACED_SUBRESOURCE_FOOTPRINT bgr_placed[2]{};
550 const auto& last_array = array_levels[std::size(array_levels) - 1];
551 constexpr UINT64 placement = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT;
552 const UINT64 bgr_start =
553 (last_array.Offset + UINT64(last_array.Footprint.RowPitch) * last_array.Footprint.Height + placement - 1) &
554 ~(placement - 1);
555 for (UINT f = 0; f < 2; ++f) {
556 D3D12_RESOURCE_DESC desc = texture_desc;
557 desc.Format = bgr_formats[f];
558 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &desc,
559 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
560 IID_PPV_ARGS(&bgr_textures[f].p))));
561 device->GetCopyableFootprints(&desc, 0, 1, bgr_start + 8192 * f, &bgr_placed[f], nullptr, nullptr, nullptr);
562 EXPECT(bgr_placed[f].Footprint.Format == bgr_formats[f]);
563 EXPECT(bgr_placed[f].Offset + UINT64(bgr_placed[f].Footprint.RowPitch) * size <= upload_desc.Width);
564 for (UINT y = 0; y < size; ++y)
565 for (UINT x = 0; x < size; ++x)
566 std::memcpy(static_cast<std::uint8_t*>(mapped) + bgr_placed[f].Offset +
567 y * bgr_placed[f].Footprint.RowPitch + x * 4,
568 bgrx_texel(x, y).data(), 4);
569 }
570 EXPECT(bgr_placed[0].Footprint.RowPitch == bgr_placed[1].Footprint.RowPitch);
535 571
536 // Shader-visible heaps, start handles in the Xbox shape. 572 // Shader-visible heaps, start handles in the Xbox shape.
537 const UINT step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); 573 const UINT step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
@@ -562,7 +598,7 @@ int main() {
562 volume_lod_slot = cube_lod_slot + cube_lod_count, 598 volume_lod_slot = cube_lod_slot + cube_lod_count,
563 ms_slot = volume_lod_slot + volume_lod_count, ms_array_slot, ms_slice_slot, ms_first_layer_slot, 599 ms_slot = volume_lod_slot + volume_lod_count, ms_array_slot, ms_slice_slot, ms_first_layer_slot,
564 ms_uint_slot, ms_uint_array_slot, ms_sint_slot, ms_sint_array_slot, 600 ms_uint_slot, ms_uint_array_slot, ms_sint_slot, ms_sint_array_slot,
565 line_default, line_mip, line_clamped, view_slot_count 601 line_default, line_mip, line_clamped, bgrx_slot, bgra_slot, typed_bgrx_slot, view_slot_count
566 }; 602 };
567 D3D12_DESCRIPTOR_HEAP_DESC heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, view_slot_count, 603 D3D12_DESCRIPTOR_HEAP_DESC heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, view_slot_count,
568 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0}; 604 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0};
@@ -1099,6 +1135,51 @@ int main() {
1099 std::memset(view_bytes(null_slot), 0x77, step); 1135 std::memset(view_bytes(null_slot), 0x77, step);
1100 device->CreateShaderResourceView(texture.p, &colour_plane, view_slot(null_slot)); 1136 device->CreateShaderResourceView(texture.p, &colour_plane, view_slot(null_slot));
1101 EXPECT(null_at(null_slot)); 1137 EXPECT(null_at(null_slot));
1138
1139 // B8G8R8X8 is a BGRA8 image whose views read alpha as 1, so its T# selects one where B8G8R8A8's selects W.
1140 // B8G8R8X8 and B8G8R8A8 are different typeless families: a view never crosses from one to the other.
1141 device->CreateShaderResourceView(bgr_textures[0].p, nullptr, view_slot(bgrx_slot));
1142 device->CreateShaderResourceView(bgr_textures[1].p, nullptr, view_slot(bgra_slot));
1143 g::Image bgrx_image{}, bgra_image{};
1144 EXPECT(image_at(bgrx_slot, bgrx_image) && image_at(bgra_slot, bgra_image));
1145 EXPECT(bgrx_image.format == g::format_from_vulkan(VK_FORMAT_B8G8R8A8_UNORM) &&
1146 bgra_image.format == bgrx_image.format);
1147 EXPECT((bgrx_image.swizzle == g::Swizzle{g::select_z, g::select_y, g::select_x, g::select_one}));
1148 EXPECT((bgra_image.swizzle == g::Swizzle{g::select_z, g::select_y, g::select_x, g::select_w}));
1149 Ref<ID3D12Resource> bgrx_typeless;
1150 D3D12_RESOURCE_DESC bgrx_typeless_desc = texture_desc;
1151 bgrx_typeless_desc.Format = DXGI_FORMAT_B8G8R8X8_TYPELESS;
1152 bgrx_typeless_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; // allowed, but no format gives a UAV
1153 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &bgrx_typeless_desc,
1154 D3D12_RESOURCE_STATE_COMMON, nullptr,
1155 IID_PPV_ARGS(&bgrx_typeless.p))));
1156 D3D12_SHADER_RESOURCE_VIEW_DESC bgr_view = flat_view;
1157 bgr_view.Format = DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
1158 device->CreateShaderResourceView(bgrx_typeless.p, &bgr_view, view_slot(typed_bgrx_slot));
1159 g::Image typed_bgrx_image{};
1160 EXPECT(image_at(typed_bgrx_slot, typed_bgrx_image));
1161 EXPECT(typed_bgrx_image.format == g::format_from_vulkan(VK_FORMAT_B8G8R8A8_SRGB));
1162 EXPECT(typed_bgrx_image.swizzle == bgrx_image.swizzle && typed_bgrx_image.address != bgrx_image.address);
1163 bgr_view.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
1164 for (ID3D12Resource* x8 : {bgr_textures[0].p, bgrx_typeless.p}) {
1165 std::memset(view_bytes(null_slot), 0x77, step);
1166 device->CreateShaderResourceView(x8, &bgr_view, view_slot(null_slot));
1167 EXPECT(null_at(null_slot));
1168 }
1169 bgr_view.Format = DXGI_FORMAT_B8G8R8X8_UNORM;
1170 std::memset(view_bytes(null_slot), 0x77, step);
1171 device->CreateShaderResourceView(bgr_textures[1].p, &bgr_view, view_slot(null_slot));
1172 EXPECT(null_at(null_slot));
1173 D3D12_UNORDERED_ACCESS_VIEW_DESC bgrx_write{};
1174 bgrx_write.Format = DXGI_FORMAT_B8G8R8X8_UNORM;
1175 bgrx_write.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
1176 const D3D12_UNORDERED_ACCESS_VIEW_DESC* const bgrx_uavs[2] = {nullptr, &bgrx_write};
1177 for (const D3D12_UNORDERED_ACCESS_VIEW_DESC* uav : bgrx_uavs) {
1178 std::memset(view_bytes(null_slot), 0x77, step);
1179 device->CreateUnorderedAccessView(bgrx_typeless.p, nullptr, uav, view_slot(null_slot));
1180 EXPECT(null_at(null_slot));
1181 }
1182 bgrx_typeless.reset();
1102 cube.reset(); 1183 cube.reset();
1103 writable.reset(); 1184 writable.reset();
1104 1185
@@ -1205,6 +1286,11 @@ int main() {
1205 transition(bc.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE); 1286 transition(bc.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
1206 list->ResourceBarrier(1, &barrier); 1287 list->ResourceBarrier(1, &barrier);
1207 } 1288 }
1289 for (UINT f = 0; f < 2; ++f) {
1290 to_texture.pResource = bgr_textures[f].p;
1291 from_upload.PlacedFootprint = bgr_placed[f];
1292 list->CopyTextureRegion(&to_texture, 0, 0, 0, &from_upload, nullptr);
1293 }
1208 to_texture.pResource = volume.p; 1294 to_texture.pResource = volume.p;
1209 for (UINT mip = 0; mip < 2; ++mip) { 1295 for (UINT mip = 0; mip < 2; ++mip) {
1210 to_texture.SubresourceIndex = mip; 1296 to_texture.SubresourceIndex = mip;
@@ -1221,7 +1307,11 @@ int main() {
1221 transition(line.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE), 1307 transition(line.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
1222 transition(packed.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE), 1308 transition(packed.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
1223 transition(uint_texture.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE), 1309 transition(uint_texture.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
1224 transition(volume.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE)}; 1310 transition(volume.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
1311 transition(bgr_textures[0].p, D3D12_RESOURCE_STATE_COPY_DEST,
1312 D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
1313 transition(bgr_textures[1].p, D3D12_RESOURCE_STATE_COPY_DEST,
1314 D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE)};
1225 list->ResourceBarrier(UINT(std::size(sampled)), sampled); 1315 list->ResourceBarrier(UINT(std::size(sampled)), sampled);
1226 to_texture.pResource = array_texture.p; 1316 to_texture.pResource = array_texture.p;
1227 for (UINT sub = 0; sub < std::size(array_levels); ++sub) { 1317 for (UINT sub = 0; sub < std::size(array_levels); ++sub) {
@@ -1854,6 +1944,15 @@ int main() {
1854 } 1944 }
1855 EXPECT(rgb96_differ == 0); 1945 EXPECT(rgb96_differ == 0);
1856 } 1946 }
1947 // The B8G8R8X8 and B8G8R8A8 textures through their default views.
1948 SampleKeys bgr_keys[2] = {};
1949 const UINT bgr_slots[2] = {bgrx_slot, bgra_slot};
1950 for (UINT k = 0; k < 2; ++k) {
1951 std::memcpy(bgr_keys[k].tsharp, view_bytes(bgr_slots[k]), sizeof(bgr_keys[k].tsharp));
1952 std::memcpy(bgr_keys[k].ssharp, sampler_bytes, sizeof(bgr_keys[k].ssharp));
1953 bgr_keys[k].first = k * texels;
1954 }
1955 EXPECT(sample_through_set(d, set0, set0_layout, bgr_keys, bgr_results.data()));
1857#endif 1956#endif
1858 1957
1859 // A destroyed texture takes its views out of the set: the next ExecuteCommandLists writes that, and nothing 1958 // A destroyed texture takes its views out of the set: the next ExecuteCommandLists writes that, and nothing
@@ -2067,6 +2166,47 @@ int main() {
2067#endif 2166#endif
2068 } 2167 }
2069 2168
2169 // Cross-family castable SRV: write_image_descriptor must pass resource.has_view_format_list() into a single
2170 // bind_image call so a listed R8G8B8A8_UINT -> R32_UINT view registers cleanly without a spurious first-pass
2171 // failure (and without double-binding every view).
2172 if (d.bindless) {
2173 Ref<ID3D12Device10> inner10;
2174 EXPECT(SUCCEEDED(inner->QueryInterface(IID_PPV_ARGS(&inner10.p))));
2175 D3D12_RESOURCE_DESC1 cast_desc{};
2176 cast_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
2177 cast_desc.Width = 4;
2178 cast_desc.Height = 4;
2179 cast_desc.DepthOrArraySize = 1;
2180 cast_desc.MipLevels = 1;
2181 cast_desc.Format = DXGI_FORMAT_R8G8B8A8_UINT;
2182 cast_desc.SampleDesc = {1, 0};
2183 cast_desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
2184 const DXGI_FORMAT cast_formats[] = {DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R32_UINT};
2185 Ref<ID3D12Resource> cast_tex;
2186 EXPECT(SUCCEEDED(inner10->CreateCommittedResource3(
2187 &default_heap, D3D12_HEAP_FLAG_NONE, &cast_desc, D3D12_BARRIER_LAYOUT_COMMON, nullptr, nullptr,
2188 2, cast_formats, IID_PPV_ARGS(&cast_tex.p))));
2189 const D3D12_DESCRIPTOR_HEAP_DESC cast_hd{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1,
2190 D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
2191 Ref<ID3D12DescriptorHeap> cast_heap;
2192 EXPECT(SUCCEEDED(inner10->CreateDescriptorHeap(&cast_hd, IID_PPV_ARGS(&cast_heap.p))));
2193 const D3D12_CPU_DESCRIPTOR_HANDLE cast_slot = cast_heap->GetCPUDescriptorHandleForHeapStart();
2194 D3D12_SHADER_RESOURCE_VIEW_DESC cast_srv{};
2195 cast_srv.Format = DXGI_FORMAT_R32_UINT;
2196 cast_srv.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
2197 cast_srv.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
2198 cast_srv.Texture2D.MipLevels = 1;
2199 inner10->CreateShaderResourceView(cast_tex.p, &cast_srv, cast_slot);
2200 g::ImageWords cast_words{};
2201 std::memcpy(cast_words.data(), reinterpret_cast<const void*>(cast_slot.ptr), sizeof(cast_words));
2202 g::Image decoded{};
2203 EXPECT(g::decode(cast_words, decoded) && decoded.type == g::ImageType::image_2d);
2204 EXPECT(decoded.format == g::format_from_vulkan(VK_FORMAT_R32_UINT));
2205 std::uint32_t cast_key[8]{};
2206 std::memcpy(cast_key, cast_words.data(), sizeof(cast_key));
2207 EXPECT(rt::d3d12::bindless_hash_lookup(device.p, cast_key) != 0);
2208 }
2209
2070 upload.reset(); 2210 upload.reset();
2071 array_texture.reset(); 2211 array_texture.reset();
2072 line.reset(); 2212 line.reset();
@@ -2078,6 +2218,7 @@ int main() {
2078 byte_heap.reset(); 2218 byte_heap.reset();
2079 ms_texture.reset(); 2219 ms_texture.reset();
2080 ms_array.reset(); 2220 ms_array.reset();
2221 for (auto& resource : bgr_textures) resource.reset();
2081 view_heap.reset(); 2222 view_heap.reset();
2082 sampler_heap.reset(); 2223 sampler_heap.reset();
2083 list.reset(); 2224 list.reset();
@@ -2141,6 +2282,19 @@ int main() {
2141 } 2282 }
2142 EXPECT(!mismatches); 2283 EXPECT(!mismatches);
2143 EXPECT(lod_mismatches == 0); 2284 EXPECT(lod_mismatches == 0);
2285 // Both read red, green and blue from the same bytes; B8G8R8X8 reads alpha 1, B8G8R8A8 the stored byte.
2286 const char* bgr_names[2] = {"B8G8R8X8_UNORM", "B8G8R8A8_UNORM"};
2287 for (UINT k = 0; k < 2; ++k)
2288 for (UINT i = 0; i < texels; ++i) {
2289 auto want = texel(i % size, i / size);
2290 if (k == 1) want[3] = bgrx_texel(i % size, i / size)[3];
2291 const std::uint8_t* got = bgr_results.data() + k * bytes + i * 4;
2292 if (std::memcmp(got, want.data(), 4) != 0 && mismatches++ < 4)
2293 std::fprintf(stderr, "%s texel %u: got %u,%u,%u,%u, want %u,%u,%u,%u\n", bgr_names[k], i,
2294 unsigned(got[0]), unsigned(got[1]), unsigned(got[2]), unsigned(got[3]),
2295 unsigned(want[0]), unsigned(want[1]), unsigned(want[2]), unsigned(want[3]));
2296 }
2297 EXPECT(!mismatches);
2144 if (d.validation_errors()) { 2298 if (d.validation_errors()) {
2145 std::fprintf(stderr, "%u validation errors\n", d.validation_errors()); 2299 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
2146 return 1; 2300 return 1;
@@ -2148,6 +2302,7 @@ int main() {
2148 std::printf("descriptors: copies matched; a T# and an S# from CreateShaderResourceView and CreateSampler were " 2302 std::printf("descriptors: copies matched; a T# and an S# from CreateShaderResourceView and CreateSampler were "
2149 "found in the device's bindless set by a shader, %u RGBA8 and RGB9E5 texels matched, and an unknown descriptor " 2303 "found in the device's bindless set by a shader, %u RGBA8 and RGB9E5 texels matched, and an unknown descriptor "
2150 "and a destroyed texture's gave the fallback; UINT black, UINT white and float white borders read " 2304 "and a destroyed texture's gave the fallback; UINT black, UINT white and float white borders read "
2151 "0, 1 and 255\n", texels); 2305 "0, 1 and 255; B8G8R8X8 read alpha 1 where B8G8R8A8 read the same bytes' alpha (%u texels each)\n",
2306 texels, texels);
2152 return 0; 2307 return 0;
2153} 2308}
diff --git a/runtime/test/d3d12_draw_test.cpp b/runtime/test/d3d12_draw_test.cpp
index 574872b8a..12a1c71cf 100644
--- a/runtime/test/d3d12_draw_test.cpp
+++ b/runtime/test/d3d12_draw_test.cpp
@@ -84,6 +84,8 @@ int main() {
84 constexpr UINT size = 64; 84 constexpr UINT size = 64;
85 std::vector<std::uint8_t> pixels(size * 256), second_pixels(size * 256); 85 std::vector<std::uint8_t> pixels(size * 256), second_pixels(size * 256);
86 std::vector<std::uint8_t> strip16_pixels(size * 256), strip32_pixels(size * 256), strip_nocut_pixels(size * 256); 86 std::vector<std::uint8_t> strip16_pixels(size * 256), strip32_pixels(size * 256), strip_nocut_pixels(size * 256);
87 std::vector<std::uint8_t> msaa_full_pixels(size * 256), msaa_half_pixels(size * 256);
88 bool ran_msaa = false;
87 const bool logic_op = d.enabled.logicOp == VK_TRUE; 89 const bool logic_op = d.enabled.logicOp == VK_TRUE;
88 { 90 {
89 rt::d3d12::VulkanDeviceInfo info{}; 91 rt::d3d12::VulkanDeviceInfo info{};
@@ -94,6 +96,7 @@ int main() {
94 info.queue = d.queue; 96 info.queue = d.queue;
95 info.queue_family = d.family; 97 info.queue_family = d.family;
96 info.buffer_device_address = true; 98 info.buffer_device_address = true;
99 info.subgroup = d.subgroup;
97 info.shader_dir = library.string(); 100 info.shader_dir = library.string();
98 // Of the PSO features only logicOp is passed on, so the other feature refusals below still apply. 101 // Of the PSO features only logicOp is passed on, so the other feature refusals below still apply.
99 info.features.logicOp = d.enabled.logicOp; 102 info.features.logicOp = d.enabled.logicOp;
@@ -466,6 +469,102 @@ int main() {
466 } 469 }
467 } 470 }
468 471
472 // Multisampled graphics pipeline (4x MSAA): draw the top-left red quad into a 4x MSAA target and resolve.
473 // Full SampleMask (0xFFFFFFFF) writes all 4 samples red; half SampleMask (0x5) writes 2 of 4 samples so the
474 // resolved top-left quadrant shifts from (255, 0, 0, 255) to ~50/50 purple (128, 0, 128, 255).
475 {
476 // SampleDesc.Count == 0, non-power-of-two/out-of-range counts, and non-zero quality must all be rejected.
477 auto bad_desc = pso_desc;
478 Ref<ID3D12PipelineState> bad_pso;
479 for (const DXGI_SAMPLE_DESC sd : {DXGI_SAMPLE_DESC{0, 0}, DXGI_SAMPLE_DESC{3, 0}, DXGI_SAMPLE_DESC{64, 0},
480 DXGI_SAMPLE_DESC{4, 1}, DXGI_SAMPLE_DESC{1, 1}}) {
481 bad_desc.SampleDesc = sd;
482 EXPECT(device->CreateGraphicsPipelineState(&bad_desc, IID_PPV_ARGS(&bad_pso.p)) == E_INVALIDARG &&
483 !bad_pso.p);
484 }
485 // Any power-of-two sample count not supported by the attachment format must also be rejected.
486 D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS ms32{DXGI_FORMAT_R8G8B8A8_UNORM, 32,
487 D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE, 0};
488 if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &ms32, sizeof(ms32))) &&
489 ms32.NumQualityLevels == 0) {
490 bad_desc.SampleDesc = {32, 0};
491 EXPECT(device->CreateGraphicsPipelineState(&bad_desc, IID_PPV_ARGS(&bad_pso.p)) == E_INVALIDARG &&
492 !bad_pso.p);
493 }
494
495 D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS ms_levels{DXGI_FORMAT_R8G8B8A8_UNORM, 4,
496 D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE, 0};
497 if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &ms_levels,
498 sizeof(ms_levels))) &&
499 ms_levels.NumQualityLevels > 0) {
500 auto ms_rt_desc = rt_desc;
501 ms_rt_desc.SampleDesc.Count = 4;
502 Ref<ID3D12Resource> ms_target;
503 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &ms_rt_desc,
504 D3D12_RESOURCE_STATE_RENDER_TARGET, nullptr,
505 IID_PPV_ARGS(&ms_target.p))));
506 D3D12_DESCRIPTOR_HEAP_DESC ms_heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1,
507 D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
508 Ref<ID3D12DescriptorHeap> ms_rtv_heap;
509 EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&ms_heap_desc, IID_PPV_ARGS(&ms_rtv_heap.p))));
510 const D3D12_CPU_DESCRIPTOR_HANDLE ms_rtv{
511 SIZE_T(reinterpret_cast<XboxHeapHandleFn>(slot(ms_rtv_heap.p, 9))(ms_rtv_heap.p))};
512 device->CreateRenderTargetView(ms_target.p, nullptr, ms_rtv);
513
514 auto ms_pso_desc = pso_desc;
515 ms_pso_desc.SampleDesc.Count = 4;
516 Ref<ID3D12PipelineState> ms_full_pso, ms_half_pso;
517 ms_pso_desc.SampleMask = 0xFFFFFFFFu;
518 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&ms_pso_desc, IID_PPV_ARGS(&ms_full_pso.p))));
519 ms_pso_desc.SampleMask = 0x5u;
520 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&ms_pso_desc, IID_PPV_ARGS(&ms_half_pso.p))));
521
522 struct MsaaPass {
523 ID3D12PipelineState* pso;
524 std::vector<std::uint8_t>* out;
525 };
526 const MsaaPass ms_passes[] = {{ms_full_pso.p, &msaa_full_pixels}, {ms_half_pso.p, &msaa_half_pixels}};
527 UINT64 ms_fence = 20;
528 for (UINT pass = 0; pass < std::size(ms_passes); ++pass) {
529 EXPECT(SUCCEEDED(allocator->Reset()) && SUCCEEDED(list->Reset(allocator.p, ms_passes[pass].pso)));
530 if (pass > 0) {
531 const auto ms_to_rt = transition(ms_target.p, D3D12_RESOURCE_STATE_RESOLVE_SOURCE,
532 D3D12_RESOURCE_STATE_RENDER_TARGET);
533 list->ResourceBarrier(1, &ms_to_rt);
534 }
535 list->ClearRenderTargetView(ms_rtv, blue, 0, nullptr);
536 list->SetGraphicsRootSignature(root.p);
537 list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
538 list->IASetVertexBuffers(0, 1, &vbv);
539 list->IASetIndexBuffer(&ibv);
540 list->RSSetViewports(1, &viewport);
541 list->RSSetScissorRects(1, &scissor);
542 list->OMSetRenderTargets(1, &ms_rtv, FALSE, nullptr);
543 list->SetGraphicsRoot32BitConstants(0, 2, origin, 0);
544 list->SetGraphicsRootConstantBufferView(1, upload_va + 512);
545 list->DrawIndexedInstanced(6, 1, 0, 0, 0);
546 const D3D12_RESOURCE_BARRIER pre_resolve[] = {
547 transition(ms_target.p, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_RESOLVE_SOURCE),
548 transition(target.p, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RESOLVE_DEST),
549 };
550 list->ResourceBarrier(2, pre_resolve);
551 list->ResolveSubresource(target.p, 0, ms_target.p, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
552 const auto post_resolve =
553 transition(target.p, D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE);
554 list->ResourceBarrier(1, &post_resolve);
555 list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
556 EXPECT(list->Close() == S_OK);
557 queue->ExecuteCommandLists(1, lists);
558 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
559 ++ms_fence;
560 EXPECT(SUCCEEDED(queue->Signal(fence.p, ms_fence)) &&
561 SUCCEEDED(fence->SetEventOnCompletion(ms_fence, nullptr)));
562 std::memcpy(ms_passes[pass].out->data(), mapped, ms_passes[pass].out->size());
563 }
564 ran_msaa = true;
565 }
566 }
567
469 // A draw with no viewport (never set, or unbound with a count of 0) rasterizes nothing in D3D12. It is not 568 // A draw with no viewport (never set, or unbound with a count of 0) rasterizes nothing in D3D12. It is not
470 // recorded, so the list closes and executes cleanly (Vulkan forbids a 0x0 viewport). 569 // recorded, so the list closes and executes cleanly (Vulkan forbids a 0x0 viewport).
471 EXPECT(SUCCEEDED(allocator->Reset()) && SUCCEEDED(list->Reset(allocator.p, pso.p))); 570 EXPECT(SUCCEEDED(allocator->Reset()) && SUCCEEDED(list->Reset(allocator.p, pso.p)));
@@ -478,7 +577,7 @@ int main() {
478 EXPECT(list->Close() == S_OK); 577 EXPECT(list->Close() == S_OK);
479 queue->ExecuteCommandLists(1, lists); 578 queue->ExecuteCommandLists(1, lists);
480 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success); 579 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
481 EXPECT(SUCCEEDED(queue->Signal(fence.p, 20)) && SUCCEEDED(fence->SetEventOnCompletion(20, nullptr))); 580 EXPECT(SUCCEEDED(queue->Signal(fence.p, 30)) && SUCCEEDED(fence->SetEventOnCompletion(30, nullptr)));
482 581
483 // Each parent draw starts with a 0.25 blend factor, then executes one of four bundles. 582 // Each parent draw starts with a 0.25 blend factor, then executes one of four bundles.
484 // Empty and reset bundles preserve it. Explicit zero and nullptr replace it with zero and one. 583 // Empty and reset bundles preserve it. Explicit zero and nullptr replace it with zero and one.
@@ -531,7 +630,8 @@ int main() {
531 EXPECT(list->Close() == S_OK); 630 EXPECT(list->Close() == S_OK);
532 queue->ExecuteCommandLists(1, lists); 631 queue->ExecuteCommandLists(1, lists);
533 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success); 632 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
534 EXPECT(SUCCEEDED(queue->Signal(fence.p, 4)) && SUCCEEDED(fence->SetEventOnCompletion(4, nullptr))); 633 // Above the strip passes' 20: a lower value is already reached, so the wait would return at once.
634 EXPECT(SUCCEEDED(queue->Signal(fence.p, 21)) && SUCCEEDED(fence->SetEventOnCompletion(21, nullptr)));
535 const auto* result = static_cast<const std::uint8_t*>(mapped); 635 const auto* result = static_cast<const std::uint8_t*>(mapped);
536 for (UINT row = 0; row < size; ++row) { 636 for (UINT row = 0; row < size; ++row) {
537 for (UINT col = 0; col < size; ++col) { 637 for (UINT col = 0; col < size; ++col) {
@@ -629,6 +729,38 @@ int main() {
629 std::printf("strip cut (0xFFFF & 0xFFFFFFFF): 4096/4096 pixels matched each (no-cut negative control painted %u " 729 std::printf("strip cut (0xFFFF & 0xFFFFFFFF): 4096/4096 pixels matched each (no-cut negative control painted %u "
630 "bridge pixels in bottom-left)\n", 730 "bridge pixels in bottom-left)\n",
631 nocut_bl_red); 731 nocut_bl_red);
732 if (ran_msaa) {
733 UINT half_changed = 0;
734 for (UINT row = 0; row < size; ++row) {
735 for (UINT col = 0; col < size; ++col) {
736 const bool top_left = row < size / 2 && col < size / 2;
737 const std::uint8_t* got_full = msaa_full_pixels.data() + row * 256 + col * 4;
738 const std::uint8_t* got_half = msaa_half_pixels.data() + row * 256 + col * 4;
739 const std::uint8_t want_full[4] = {std::uint8_t(top_left ? 255 : 0), 0,
740 std::uint8_t(top_left ? 0 : 255), 255};
741 if (std::memcmp(got_full, want_full, 4) != 0 && mismatches++ < 6)
742 std::fprintf(stderr, "4x MSAA full mask (%u,%u): got %u,%u,%u,%u want %u,%u,%u,%u\n", col, row,
743 got_full[0], got_full[1], got_full[2], got_full[3], want_full[0], want_full[1],
744 want_full[2], want_full[3]);
745 if (top_left) {
746 const bool ok = std::abs(int(got_half[0]) - 128) <= 1 && got_half[1] == 0 &&
747 std::abs(int(got_half[2]) - 128) <= 1 && got_half[3] == 255;
748 if (!ok && mismatches++ < 6)
749 std::fprintf(stderr, "4x MSAA half mask (%u,%u): got %u,%u,%u,%u want ~128,0,128,255\n", col,
750 row, got_half[0], got_half[1], got_half[2], got_half[3]);
751 if (std::memcmp(got_half, got_full, 4) != 0) ++half_changed;
752 } else if (std::memcmp(got_half, want_full, 4) != 0 && mismatches++ < 6) {
753 std::fprintf(stderr, "4x MSAA half mask bg (%u,%u): got %u,%u,%u,%u want 0,0,255,255\n", col, row,
754 got_half[0], got_half[1], got_half[2], got_half[3]);
755 }
756 }
757 }
758 EXPECT(!mismatches);
759 EXPECT(half_changed == (size / 2) * (size / 2));
760 std::printf("4x MSAA graphics pipeline: 4096/4096 resolved pixels matched (SampleMask 0x5 changed %u/%u "
761 "top-left pixels to purple)\n",
762 half_changed, (size / 2) * (size / 2));
763 }
632 if (d.validation_errors()) { 764 if (d.validation_errors()) {
633 std::fprintf(stderr, "%u validation errors\n", d.validation_errors()); 765 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
634 return 1; 766 return 1;
diff --git a/runtime/test/d3d12_gcl8_test.cpp b/runtime/test/d3d12_gcl8_test.cpp
index 7e3020583..8b0426e6c 100644
--- a/runtime/test/d3d12_gcl8_test.cpp
+++ b/runtime/test/d3d12_gcl8_test.cpp
@@ -36,6 +36,10 @@ int main(int argc, char** argv) {
36 EXPECT(SUCCEEDED(create_command_allocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p)))); 36 EXPECT(SUCCEEDED(create_command_allocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))));
37 EXPECT(SUCCEEDED(create_command_list(D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, IID_PPV_ARGS(&list7.p)))); 37 EXPECT(SUCCEEDED(create_command_list(D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, IID_PPV_ARGS(&list7.p))));
38 38
39 // Null bindings exercise the public entry points without creating a pipeline or loading Vulkan.
40 list7.p->SetPipelineState(nullptr);
41 list7.p->SetGraphicsRootSignature(nullptr);
42
39 // AddRef through the GCL7 pointer gives the count this test expects while the QueryInterface reference is held. 43 // AddRef through the GCL7 pointer gives the count this test expects while the QueryInterface reference is held.
40 const ULONG held = list7.p->AddRef(); 44 const ULONG held = list7.p->AddRef();
41 list7.p->Release(); 45 list7.p->Release();
@@ -82,6 +86,11 @@ int main(int argc, char** argv) {
82 EXPECT(list7.p->AddRef() == held); // QueryInterface released its reference 86 EXPECT(list7.p->AddRef() == held); // QueryInterface released its reference
83 list7.p->Release(); 87 list7.p->Release();
84 88
89 // Calls made before pipeline setup still belong in the trace. They invalidate this list without needing a GPU.
90 list7.p->DrawInstanced(3, 1, 0, 0);
91 list7.p->DrawIndexedInstanced(3, 1, 0, 0, 0);
92 EXPECT(list7.p->Close() == E_INVALIDARG);
93
85 UINT ignored_front = 0, ignored_back = 0; 94 UINT ignored_front = 0, ignored_back = 0;
86 EXPECT(!front_back_stencil_ref(nullptr, ignored_front, ignored_back)); 95 EXPECT(!front_back_stencil_ref(nullptr, ignored_front, ignored_back));
87 96
diff --git a/runtime/test/d3d12_m2_textured_test.cpp b/runtime/test/d3d12_m2_textured_test.cpp
index db8e9fd3f..8d13bf214 100644
--- a/runtime/test/d3d12_m2_textured_test.cpp
+++ b/runtime/test/d3d12_m2_textured_test.cpp
@@ -20,6 +20,7 @@
20// [1] POINT/WRAP. The left half takes the WRAP sampler (U + 1 wraps back: the gradient again), the right half the 20// [1] POINT/WRAP. The left half takes the WRAP sampler (U + 1 wraps back: the gradient again), the right half the
21// CLAMP one (U + 1 clamps to the last column: each row is that row's right-edge texel of the reflected texture). The 21// CLAMP one (U + 1 clamps to the last column: each row is that row's right-edge texel of the reflected texture). The
22// pixels are predicted on the CPU, error 0, and 1536 of them differ from the plain reflection. 22// pixels are predicted on the CPU, error 0, and 1536 of them differ from the plain reflection.
23// The control also keeps one unbounded SRV table bound and selects its two entries by a root constant.
23// Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation (0 errors required). 24// Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation (0 errors required).
24#include "vk_test_device.h" 25#include "vk_test_device.h"
25#include "d3d12_test_shaders.h" 26#include "d3d12_test_shaders.h"
@@ -148,6 +149,22 @@ int main() {
148 pso_desc.SampleDesc.Count = 1; 149 pso_desc.SampleDesc.Count = 1;
149 Ref<ID3D12PipelineState> pso, uoff_pso; 150 Ref<ID3D12PipelineState> pso, uoff_pso;
150 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso.p)))); 151 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso.p))));
152 D3D12_DESCRIPTOR_RANGE indexed_range = srv_range;
153 indexed_range.NumDescriptors = UINT32_MAX;
154 D3D12_ROOT_PARAMETER indexed_params[3] = {params[0], params[1], {}};
155 indexed_params[0].DescriptorTable = {1, &indexed_range};
156 indexed_params[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
157 indexed_params[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
158 indexed_params[2].Constants = {0, 0, 2}; // s4 = SRV index, s5 = SRV stride in bytes
159 D3D12_VERSIONED_ROOT_SIGNATURE_DESC indexed_desc = root_desc;
160 indexed_desc.Desc_1_0.NumParameters = 3;
161 indexed_desc.Desc_1_0.pParameters = indexed_params;
162 const auto indexed_blob = serialize_root_signature(indexed_desc);
163 EXPECT(!indexed_blob.empty());
164 Ref<ID3D12RootSignature> indexed_root;
165 EXPECT(SUCCEEDED(device->CreateRootSignature(0, indexed_blob.data(), indexed_blob.size(),
166 IID_PPV_ARGS(&indexed_root.p))));
167 pso_desc.pRootSignature = indexed_root.p;
151 pso_desc.PS = {uoff_container.data(), uoff_container.size()}; 168 pso_desc.PS = {uoff_container.data(), uoff_container.size()};
152 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&uoff_pso.p)))); 169 EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&uoff_pso.p))));
153 170
@@ -350,8 +367,9 @@ int main() {
350 D3D12_RESOURCE_STATE_RENDER_TARGET); 367 D3D12_RESOURCE_STATE_RENDER_TARGET);
351 list2->ResourceBarrier(1, &back); 368 list2->ResourceBarrier(1, &back);
352 list2->ClearRenderTargetView(rtv, clear, 0, nullptr); 369 list2->ClearRenderTargetView(rtv, clear, 0, nullptr);
353 list2->SetGraphicsRootSignature(root.p); 370 list2->SetGraphicsRootSignature(indexed_root.p);
354 list2->SetDescriptorHeaps(2, heaps); 371 list2->SetDescriptorHeaps(2, heaps);
372 list2->SetGraphicsRootDescriptorTable(0, D3D12_GPU_DESCRIPTOR_HANDLE{srv_gpu});
355 list2->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); 373 list2->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
356 list2->IASetIndexBuffer(&ibv); 374 list2->IASetIndexBuffer(&ibv);
357 list2->RSSetViewports(1, &viewport); 375 list2->RSSetViewports(1, &viewport);
@@ -359,7 +377,8 @@ int main() {
359 for (UINT half = 0; half < 2; ++half) { 377 for (UINT half = 0; half < 2; ++half) {
360 const D3D12_RECT scissor{LONG(half * target_size / 2), 0, LONG((half + 1) * target_size / 2), LONG(target_size)}; 378 const D3D12_RECT scissor{LONG(half * target_size / 2), 0, LONG((half + 1) * target_size / 2), LONG(target_size)};
361 list2->RSSetScissorRects(1, &scissor); 379 list2->RSSetScissorRects(1, &scissor);
362 list2->SetGraphicsRootDescriptorTable(0, D3D12_GPU_DESCRIPTOR_HANDLE{srv_gpu + std::uint64_t(half) * step}); 380 const UINT srv_args[] = {half, step};
381 list2->SetGraphicsRoot32BitConstants(2, 2, srv_args, 0);
363 list2->SetGraphicsRootDescriptorTable( 382 list2->SetGraphicsRootDescriptorTable(
364 1, D3D12_GPU_DESCRIPTOR_HANDLE{sampler_gpu + std::uint64_t(half == 0 ? sampler_step : 0)}); 383 1, D3D12_GPU_DESCRIPTOR_HANDLE{sampler_gpu + std::uint64_t(half == 0 ? sampler_step : 0)});
365 list2->DrawIndexedInstanced(6, 1, 0, 0, 0); 384 list2->DrawIndexedInstanced(6, 1, 0, 0, 0);
@@ -387,6 +406,7 @@ int main() {
387 uoff_pso.reset(); 406 uoff_pso.reset();
388 list2.reset(); 407 list2.reset();
389 allocator2.reset(); 408 allocator2.reset();
409 indexed_root.reset();
390 root.reset(); 410 root.reset();
391 srv_heap.reset(); 411 srv_heap.reset();
392 sampler_heap.reset(); 412 sampler_heap.reset();
diff --git a/runtime/test/d3d12_present_test.cpp b/runtime/test/d3d12_present_test.cpp
index 764b3e0f5..8b28eb67a 100644
--- a/runtime/test/d3d12_present_test.cpp
+++ b/runtime/test/d3d12_present_test.cpp
@@ -108,11 +108,13 @@ PFN_vkCreateSemaphore real_create_semaphore = nullptr;
108PFN_vkDestroySemaphore real_destroy_semaphore = nullptr; 108PFN_vkDestroySemaphore real_destroy_semaphore = nullptr;
109PFN_vkGetPhysicalDeviceSurfaceFormatsKHR real_surface_formats = nullptr; 109PFN_vkGetPhysicalDeviceSurfaceFormatsKHR real_surface_formats = nullptr;
110PFN_vkCreateSwapchainKHR real_create_swapchain = nullptr; 110PFN_vkCreateSwapchainKHR real_create_swapchain = nullptr;
111PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR real_get_caps = nullptr;
111VkResult fail_next_submit = VK_SUCCESS; // armed: the next vkQueueSubmit returns this and submits nothing 112VkResult fail_next_submit = VK_SUCCESS; // armed: the next vkQueueSubmit returns this and submits nothing
112VkResult next_present = VK_SUCCESS; // armed: the next present that succeeds reports this instead 113VkResult next_present = VK_SUCCESS; // armed: the next present that succeeds reports this instead
113int fail_semaphore_in = 0; // armed: the n-th vkCreateSemaphore from now fails 114int fail_semaphore_in = 0; // armed: the n-th vkCreateSemaphore from now fails
114bool fail_surface_formats = false; // armed: the next surface-format query fails before creation 115bool fail_surface_formats = false; // armed: the next surface-format query fails before creation
115bool observe_next_swapchain = false; 116bool observe_next_swapchain = false;
117bool report_undefined_extent = false; // armed: surface capabilities reports undefined extent (0xFFFFFFFF)
116VkSwapchainKHR last_created_swapchain = VK_NULL_HANDLE; 118VkSwapchainKHR last_created_swapchain = VK_NULL_HANDLE;
117VkSwapchainKHR observed_old_swapchain = VK_NULL_HANDLE; 119VkSwapchainKHR observed_old_swapchain = VK_NULL_HANDLE;
118unsigned out_of_date = 0; // presents the real driver reported out of date 120unsigned out_of_date = 0; // presents the real driver reported out of date
@@ -177,6 +179,16 @@ VKAPI_ATTR VkResult VKAPI_CALL create_swapchain(VkDevice device, const VkSwapcha
177 return result; 179 return result;
178} 180}
179 181
182VKAPI_ATTR VkResult VKAPI_CALL get_surface_capabilities(VkPhysicalDevice physical, VkSurfaceKHR surface,
183 VkSurfaceCapabilitiesKHR* caps) {
184 const VkResult result = real_get_caps(physical, surface, caps);
185 if (result == VK_SUCCESS && report_undefined_extent && caps) {
186 caps->currentExtent.width = 0xFFFFFFFF;
187 caps->currentExtent.height = 0xFFFFFFFF;
188 }
189 return result;
190}
191
180VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char* name) { 192VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char* name) {
181 const std::string_view n = name; 193 const std::string_view n = name;
182 if (n == "vkQueueSubmit") return reinterpret_cast<PFN_vkVoidFunction>(queue_submit); 194 if (n == "vkQueueSubmit") return reinterpret_cast<PFN_vkVoidFunction>(queue_submit);
@@ -188,9 +200,12 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char*
188} 200}
189 201
190VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_instance(VkInstance instance, const char* name) { 202VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_instance(VkInstance instance, const char* name) {
191 if (std::string_view(name) == "vkGetDeviceProcAddr") return reinterpret_cast<PFN_vkVoidFunction>(get_device); 203 const std::string_view n = name;
192 if (std::string_view(name) == "vkGetPhysicalDeviceSurfaceFormatsKHR") 204 if (n == "vkGetDeviceProcAddr") return reinterpret_cast<PFN_vkVoidFunction>(get_device);
205 if (n == "vkGetPhysicalDeviceSurfaceFormatsKHR")
193 return reinterpret_cast<PFN_vkVoidFunction>(surface_formats); 206 return reinterpret_cast<PFN_vkVoidFunction>(surface_formats);
207 if (n == "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")
208 return reinterpret_cast<PFN_vkVoidFunction>(get_surface_capabilities);
194 return real_get_instance(instance, name); 209 return real_get_instance(instance, name);
195} 210}
196 211
@@ -204,6 +219,8 @@ void install(PFN_vkGetInstanceProcAddr instance_proc, VkInstance instance, VkDev
204 real_surface_formats = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>( 219 real_surface_formats = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(
205 instance_proc(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR")); 220 instance_proc(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
206 real_create_swapchain = reinterpret_cast<PFN_vkCreateSwapchainKHR>(real_get_device(device, "vkCreateSwapchainKHR")); 221 real_create_swapchain = reinterpret_cast<PFN_vkCreateSwapchainKHR>(real_get_device(device, "vkCreateSwapchainKHR"));
222 real_get_caps = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(
223 instance_proc(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
207} 224}
208} // namespace driver 225} // namespace driver
209 226
@@ -390,8 +407,17 @@ int main() {
390 for (int i = 0; i < 4; ++i) EXPECT(frame(1)); // both frames in flight come round again 407 for (int i = 0; i < 4; ++i) EXPECT(frame(1)); // both frames in flight come round again
391 EXPECT(presenter->presented() == before + 4 - (driver::out_of_date - out_of_date_before)); 408 EXPECT(presenter->presented() == before + 4 - (driver::out_of_date - out_of_date_before));
392 EXPECT(SUCCEEDED(fence->SetEventOnCompletion(signalled, nullptr))); 409 EXPECT(SUCCEEDED(fence->SetEventOnCompletion(signalled, nullptr)));
410
411 // 4. Undefined surface extent (0xFFFFFFFF, reported by Intel UHD graphics / Win32 WSI; D3D-165):
412 // the presenter queries the window client extent and clamps to surface bounds.
413 driver::report_undefined_extent = true;
414 EXPECT(frame(1));
415 EXPECT(presenter->extent().width == 400 && presenter->extent().height == 300);
416 driver::report_undefined_extent = false;
417
393 std::printf("injected: out-of-date and suboptimal presents counted apart, a failed swapchain recreation " 418 std::printf("injected: out-of-date and suboptimal presents counted apart, a failed swapchain recreation "
394 "released and retried, a failed blit submission recovered (%u real out-of-date presents)\n", 419 "released and retried, a failed blit submission recovered, undefined surface extent resolved "
420 "(%u real out-of-date presents)\n",
395 real_out_of_date); 421 real_out_of_date);
396 422
397 // What reached the screen: the centre of the client area, if the window is in front. 423 // What reached the screen: the centre of the client area, if the window is in front.
diff --git a/runtime/test/d3d12_queue_wait_test.cpp b/runtime/test/d3d12_queue_wait_test.cpp
index d1a868a25..3dfb1bad3 100644
--- a/runtime/test/d3d12_queue_wait_test.cpp
+++ b/runtime/test/d3d12_queue_wait_test.cpp
@@ -1,7 +1,9 @@
1// D3D-97: cross-queue Wait-before-Signal must make progress. No game files. 1// D3D-97: cross-queue Wait-before-Signal must make progress. No game files.
2#include "../shims/d3d12_com.h" 2#include "../shims/d3d12_com.h"
3 3
4#include <cstdlib>
4#include <cstdio> 5#include <cstdio>
6#include <cstring>
5 7
6namespace { 8namespace {
7template<class T> struct Ref { 9template<class T> struct Ref {
@@ -10,19 +12,35 @@ template<class T> struct Ref {
10 T* operator->() const { return p; } 12 T* operator->() const { return p; }
11}; 13};
12 14
13bool wait_for(ID3D12Fence* fence, UINT64 value) { 15bool wait_for(ID3D12Fence* fence, UINT64 value, DWORD timeout_ms = 3000) {
14 HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); 16 HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
15 if (!event) return false; 17 if (!event) return false;
16 const bool complete = SUCCEEDED(fence->SetEventOnCompletion(value, event)) && 18 if (FAILED(fence->SetEventOnCompletion(value, event))) {
17 WaitForSingleObject(event, 3000) == WAIT_OBJECT_0; 19 CloseHandle(event); // no wait was registered
20 return false;
21 }
22 if (WaitForSingleObject(event, timeout_ms) != WAIT_OBJECT_0) {
23 // The fence dispatcher can still hold this event, and a queued GPU Wait can keep the queue destructor
24 // blocked forever. End the failed test without closing live handles or waiting for blocked queues.
25 std::fputs("cross-queue Wait-before-Signal timed out\n", stderr);
26 std::fflush(stderr);
27 std::_Exit(1);
28 }
18 CloseHandle(event); 29 CloseHandle(event);
19 return complete; 30 return true;
20} 31}
21} // namespace 32} // namespace
22 33
23int main() { 34int main(int argc, char** argv) {
24 Ref<ID3D12Device> device; 35 Ref<ID3D12Device> device;
25 if (FAILED(rt::d3d12::create_vulkan_device_standalone(IID_PPV_ARGS(&device.p)))) return 77; 36 if (FAILED(rt::d3d12::create_vulkan_device_standalone(IID_PPV_ARGS(&device.p)))) return 77;
37 if (argc == 2 && std::strcmp(argv[1], "--timeout-control") == 0) {
38 Ref<ID3D12Fence> never_signaled;
39 if (FAILED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&never_signaled.p)))) return 1;
40 // Expected to leave the process with code 1 promptly, without destroying the pending event.
41 wait_for(never_signaled.p, 1, 20);
42 return 0; // a completed wait here means the control did not exercise the timeout path
43 }
26 D3D12_COMMAND_QUEUE_DESC desc{}; 44 D3D12_COMMAND_QUEUE_DESC desc{};
27 Ref<ID3D12CommandQueue> copy, compute, direct_a, direct_b; 45 Ref<ID3D12CommandQueue> copy, compute, direct_a, direct_b;
28 desc.Type = D3D12_COMMAND_LIST_TYPE_COPY; 46 desc.Type = D3D12_COMMAND_LIST_TYPE_COPY;
@@ -49,11 +67,11 @@ int main() {
49 const bool copy_complete = submitted && wait_for(done_copy.p, 1); 67 const bool copy_complete = submitted && wait_for(done_copy.p, 1);
50 const bool direct_complete = submitted && wait_for(done_direct.p, 1); 68 const bool direct_complete = submitted && wait_for(done_direct.p, 1);
51 if (!copy_complete || !direct_complete) { 69 if (!copy_complete || !direct_complete) {
52 // Unblock submitted waits before queue destructors call vkQueueWaitIdle. 70 // A failed submit can leave a GPU Wait pending. Gate 1 is not a valid fallback once queue signals
53 gate_copy->Signal(1); 71 // have claimed 2, so do not destroy queues or fences while their work may still be outstanding.
54 gate_direct->Signal(1); 72 std::fputs("cross-queue Wait-before-Signal did not complete\n", stderr);
55 std::fprintf(stderr, "cross-queue Wait-before-Signal did not complete\n"); 73 std::fflush(stderr);
56 return 1; 74 std::_Exit(1);
57 } 75 }
58 std::puts("copy/compute and direct/direct Wait-before-Signal completed"); 76 std::puts("copy/compute and direct/direct Wait-before-Signal completed");
59 return 0; 77 return 0;
diff --git a/runtime/test/d3d12_set0_compute_test.cpp b/runtime/test/d3d12_set0_compute_test.cpp
new file mode 100644
index 000000000..69663d764
--- /dev/null
+++ b/runtime/test/d3d12_set0_compute_test.cpp
@@ -0,0 +1,337 @@
1// Set 0 from the compute bind point, through the Xbox-ABI proxy over the Vulkan device. A compute PSO whose shader
2// declares set-0 bindings is created and dispatched through D3D12 alone; nothing in the test touches Vulkan's
3// descriptor sets. The dispatches only give the right words if the layer has the device's bindless set 0 in the
4// pipeline layout and binds it at the dispatch:
5// - two 8x8 textures, a gradient and its point reflection, uploaded with Map and CopyTextureRegion;
6// - a shader-visible CBV/SRV/UAV heap with an SRV for each in slots 0 and 1 and 32 bytes no view was made for in
7// slot 2, and a sampler heap with a POINT sampler that wraps in slot 0 and one that clamps in slot 1;
8// - a root signature of two constants, a root UAV and the two descriptor tables.
9// test/glsl/cs_set0_sample.comp loads the T# and the S# from the tables in the GPU address arena, looks them up in
10// the descriptor hash table (set 0, binding 2) and samples one tile to the right in U. Four dispatches:
11// 1. slot 0 with the wrapping sampler: the gradient, texel for texel;
12// 2. slot 1 with the wrapping sampler: the reflected texture, so the T# decides the image;
13// 3. slot 2 with the wrapping sampler: the fallback image, one colour everywhere;
14// 4. slot 0 with the clamping sampler: the gradient's right edge in every column, so the S# decides the sampler.
15// A device without the bindless set refuses the PSO. No game data: the program is two marker words and the module is
16// GLSL written to the translator's contract.
17// Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation (0 errors required).
18#include "vk_test_device.h"
19#include "d3d12_test_shaders.h"
20#include "../shims/d3d12_com.h"
21#include "../shims/d3d12_xs_device.h"
22#include "../src/shader_library.h"
23
24#include <array>
25#include <cstdint>
26#include <cstring>
27#include <filesystem>
28#include <fstream>
29#include <vector>
30
31#ifndef LEONIDA_TEST_CS_SET0_SAMPLE_SPV
32#error "LEONIDA_TEST_CS_SET0_SAMPLE_SPV must name the compiled test shader"
33#endif
34
35#define EXPECT(condition) do { \
36 if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \
37} while (0)
38
39using namespace d3d12test;
40using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10: handle in RAX
41
42namespace {
43
44using Texel = std::array<std::uint8_t, 4>;
45constexpr UINT texture_size = 8, texels = texture_size * texture_size, run_bytes = texels * 4, runs = 4;
46
47// The synthetic gradient: red rises with x, green with y, blue falls along the diagonal.
48Texel gradient(UINT x, UINT y) {
49 return {std::uint8_t(x * 36), std::uint8_t(y * 36), std::uint8_t(255 - (x + y) * 16), 255};
50}
51// The second texture: the first one point-reflected, so no texel of it is in the same place.
52Texel reflected(UINT x, UINT y) { return gradient(texture_size - 1 - x, texture_size - 1 - y); }
53
54} // namespace
55
56int main() {
57 vktest::Device d;
58 const auto device_status = d.initialize();
59 if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips
60 if (device_status != vktest::DeviceStatus::ready) return 1;
61 if (!d.bindless) {
62 std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n");
63 return 77;
64 }
65
66 // The program the PSO carries, and a translator index that maps its hash to the test module. The index lists
67 // set-0 bindings for the shader, as the translator does for one that samples.
68 const auto program = fssm_program({0x43530003, 0xbf810000});
69 const auto container = shader_container(program);
70 const auto library = std::filesystem::temp_directory_path() / "leonida_set0_compute_test";
71 std::filesystem::create_directories(library);
72 std::filesystem::copy_file(LEONIDA_TEST_CS_SET0_SAMPLE_SPV, library / "cs_set0_sample.spv",
73 std::filesystem::copy_options::overwrite_existing);
74 {
75 std::ofstream index(library / "index.json", std::ios::binary);
76 index << "{\"cs_set0_sample\": {\"stage\": \"cs\", \"fssm_sha256\": \"" << leonida::sha256_hex(program)
77 << "\", \"bindings\": [0, 1, 2], \"push_constant_bytes\": 144, \"local_size\": [64, 1, 1], "
78 "\"uses_code_base\": false, \"wave64\": false}}";
79 }
80
81 std::vector<std::uint8_t> results(runs * run_bytes);
82 {
83 rt::d3d12::VulkanDeviceInfo info{};
84 info.get_instance_proc = d.instance_proc;
85 info.instance = d.instance;
86 info.physical = d.physical;
87 info.device = d.device;
88 info.queue = d.queue;
89 info.queue_family = d.family;
90 info.buffer_device_address = true;
91 info.bindless = d.bindless;
92 info.bindless_partially_bound = d.partially_bound;
93 info.image_view_min_lod = d.image_view_min_lod;
94 info.shader_dir = library.string();
95 ID3D12Device* inner = nullptr;
96 EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner))));
97 Ref<ID3D12Device> device;
98 EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device),
99 reinterpret_cast<void**>(&device.p))));
100 rt::d3d12::set_device_outer(inner, device.p);
101 EXPECT(rt::d3d12::bindless_set(device.p) != VK_NULL_HANDLE);
102
103 // Root signature: [0] two constants (s0: the view slot's offset in dwords, s1: the first output element),
104 // [1] a root UAV (s2:s3, the output buffer), [2] the table of views (s4:s5), [3] the table of samplers
105 // (s6:s7).
106 D3D12_DESCRIPTOR_RANGE view_range{D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 3, 0, 0, 0};
107 D3D12_DESCRIPTOR_RANGE sampler_range{D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 1, 0, 0, 0};
108 D3D12_ROOT_PARAMETER params[4] = {};
109 params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
110 params[0].Constants = {0, 0, 2};
111 params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
112 params[1].Descriptor = {0, 0};
113 params[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
114 params[2].DescriptorTable = {1, &view_range};
115 params[3].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
116 params[3].DescriptorTable = {1, &sampler_range};
117 D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{};
118 root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
119 root_desc.Desc_1_0 = {4, params, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE};
120 const auto root_blob = serialize_root_signature(root_desc);
121 EXPECT(!root_blob.empty());
122 Ref<ID3D12RootSignature> root;
123 EXPECT(SUCCEEDED(device->CreateRootSignature(0, root_blob.data(), root_blob.size(), IID_PPV_ARGS(&root.p))));
124
125 // The PSO: its shader has set-0 bindings, so its layout holds the device's set.
126 D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc{};
127 pso_desc.pRootSignature = root.p;
128 pso_desc.CS = {container.data(), container.size()};
129 Ref<ID3D12PipelineState> pso;
130 EXPECT(SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso.p))));
131
132 // A device without the bindless set has nothing such a shader could find its images in: the PSO is refused.
133 {
134 rt::d3d12::VulkanDeviceInfo plain_info = info;
135 plain_info.bindless = plain_info.bindless_partially_bound = false;
136 Ref<ID3D12Device> plain;
137 EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(plain_info, IID_PPV_ARGS(&plain.p))));
138 EXPECT(rt::d3d12::bindless_set(plain.p) == VK_NULL_HANDLE);
139 Ref<ID3D12RootSignature> plain_root;
140 EXPECT(SUCCEEDED(plain->CreateRootSignature(0, root_blob.data(), root_blob.size(),
141 IID_PPV_ARGS(&plain_root.p))));
142 D3D12_COMPUTE_PIPELINE_STATE_DESC plain_desc = pso_desc;
143 plain_desc.pRootSignature = plain_root.p;
144 Ref<ID3D12PipelineState> refused;
145 EXPECT(plain->CreateComputePipelineState(&plain_desc, IID_PPV_ARGS(&refused.p)) == E_NOTIMPL && !refused.p);
146 }
147
148 const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
149 const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD};
150 const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK};
151 D3D12_RESOURCE_DESC texture_desc{};
152 texture_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
153 texture_desc.Width = texture_desc.Height = texture_size;
154 texture_desc.DepthOrArraySize = 1;
155 texture_desc.MipLevels = 1;
156 texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
157 texture_desc.SampleDesc.Count = 1;
158 Ref<ID3D12Resource> textures[2], upload, output, readback;
159 for (auto& texture : textures)
160 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &texture_desc,
161 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
162 IID_PPV_ARGS(&texture.p))));
163 // The upload buffer: texture A at 0, texture B at 2048 (8 rows of the 256-byte pitch).
164 constexpr UINT64 b_offset = 2048;
165 const auto upload_desc = buffer_desc(4096);
166 EXPECT(SUCCEEDED(device->CreateCommittedResource(&upload_heap, D3D12_HEAP_FLAG_NONE, &upload_desc,
167 D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
168 IID_PPV_ARGS(&upload.p))));
169 const auto output_desc = buffer_desc(results.size(), D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
170 EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &output_desc,
171 D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr,
172 IID_PPV_ARGS(&output.p))));
173 const auto readback_desc = buffer_desc(results.size());
174 EXPECT(SUCCEEDED(device->CreateCommittedResource(&readback_heap, D3D12_HEAP_FLAG_NONE, &readback_desc,
175 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
176 IID_PPV_ARGS(&readback.p))));
177 D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint{};
178 device->GetCopyableFootprints(&texture_desc, 0, 1, 0, &footprint, nullptr, nullptr, nullptr);
179 EXPECT(footprint.Footprint.RowPitch == 256 && footprint.Footprint.RowPitch * texture_size <= b_offset);
180 std::uint8_t* up = nullptr;
181 EXPECT(SUCCEEDED(upload->Map(0, nullptr, reinterpret_cast<void**>(&up))));
182 for (UINT y = 0; y < texture_size; ++y)
183 for (UINT x = 0; x < texture_size; ++x) {
184 const Texel a = gradient(x, y), b = reflected(x, y);
185 std::memcpy(up + y * footprint.Footprint.RowPitch + x * 4, a.data(), 4);
186 std::memcpy(up + b_offset + y * footprint.Footprint.RowPitch + x * 4, b.data(), 4);
187 }
188
189 // The two heaps; their start handles come back in RAX (heap slots 9 and 10). Shader-visible heaps live in
190 // the GPU address arena, so the GPU handles are console VAs and the bytes the views and the samplers wrote
191 // are what the shader loads.
192 const D3D12_DESCRIPTOR_HEAP_DESC view_heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 4,
193 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0};
194 const D3D12_DESCRIPTOR_HEAP_DESC sampler_heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 2,
195 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0};
196 Ref<ID3D12DescriptorHeap> view_heap, sampler_heap;
197 EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&view_heap_desc, IID_PPV_ARGS(&view_heap.p))));
198 EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&sampler_heap_desc, IID_PPV_ARGS(&sampler_heap.p))));
199 const std::uint64_t view_cpu = reinterpret_cast<XboxHeapHandleFn>(slot(view_heap.p, 9))(view_heap.p);
200 const std::uint64_t view_gpu = reinterpret_cast<XboxHeapHandleFn>(slot(view_heap.p, 10))(view_heap.p);
201 const std::uint64_t sampler_cpu = reinterpret_cast<XboxHeapHandleFn>(slot(sampler_heap.p, 9))(sampler_heap.p);
202 const std::uint64_t sampler_gpu = reinterpret_cast<XboxHeapHandleFn>(slot(sampler_heap.p, 10))(sampler_heap.p);
203 const UINT view_step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
204 const UINT sampler_step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
205 EXPECT(view_cpu && sampler_cpu && view_gpu >= 0x10000 && sampler_gpu >= 0x10000);
206 EXPECT(view_gpu < (1ull << 32) && sampler_gpu < (1ull << 32));
207 EXPECT(view_step >= 32 && view_step % 4 == 0 && sampler_step >= 16);
208
209 for (UINT i = 0; i < 2; ++i) {
210 D3D12_SHADER_RESOURCE_VIEW_DESC srv{};
211 srv.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
212 srv.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
213 srv.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
214 srv.Texture2D = {0, 1, 0, 0.0f};
215 device->CreateShaderResourceView(textures[i].p, &srv,
216 D3D12_CPU_DESCRIPTOR_HANDLE{SIZE_T(view_cpu + i * view_step)});
217 }
218 // Slot 2: bytes no view was made for. The hash table has no entry for them.
219 std::uint32_t unknown[8];
220 for (std::uint32_t i = 0; i < 8; ++i) unknown[i] = 0x5a5a0000u + i;
221 std::memcpy(reinterpret_cast<void*>(view_cpu + 2 * view_step), unknown, sizeof(unknown));
222 EXPECT(rt::d3d12::bindless_hash_lookup(device.p, unknown) == 0);
223 for (UINT i = 0; i < 2; ++i) {
224 D3D12_SAMPLER_DESC sampler_desc{};
225 sampler_desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
226 sampler_desc.AddressU = sampler_desc.AddressV = sampler_desc.AddressW =
227 i ? D3D12_TEXTURE_ADDRESS_MODE_CLAMP : D3D12_TEXTURE_ADDRESS_MODE_WRAP;
228 sampler_desc.MaxAnisotropy = 1;
229 sampler_desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
230 sampler_desc.MaxLOD = D3D12_FLOAT32_MAX;
231 device->CreateSampler(&sampler_desc, D3D12_CPU_DESCRIPTOR_HANDLE{SIZE_T(sampler_cpu + i * sampler_step)});
232 }
233
234 D3D12_COMMAND_QUEUE_DESC queue_desc{};
235 Ref<ID3D12CommandQueue> queue;
236 Ref<ID3D12CommandAllocator> allocator;
237 Ref<ID3D12GraphicsCommandList> list;
238 Ref<ID3D12Fence> fence;
239 EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))));
240 EXPECT(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))));
241 EXPECT(SUCCEEDED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr,
242 IID_PPV_ARGS(&list.p))));
243 EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))));
244
245 // Upload both textures and make them shader resources for a compute shader.
246 for (UINT i = 0; i < 2; ++i) {
247 D3D12_TEXTURE_COPY_LOCATION dst{};
248 dst.pResource = textures[i].p;
249 dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
250 D3D12_TEXTURE_COPY_LOCATION src{};
251 src.pResource = upload.p;
252 src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
253 src.PlacedFootprint = footprint;
254 src.PlacedFootprint.Offset = i ? b_offset : 0;
255 list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
256 }
257 D3D12_RESOURCE_BARRIER sampled[2] = {
258 transition(textures[0].p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE),
259 transition(textures[1].p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE)};
260 list->ResourceBarrier(2, sampled);
261
262 // The four dispatches. Each keeps the slot, the output position and the sampler table it was recorded with.
263 const D3D12_GPU_VIRTUAL_ADDRESS output_va = output->GetGPUVirtualAddress();
264 EXPECT(output_va >= 0x10000 && output_va < (1ull << 32));
265 ID3D12DescriptorHeap* heaps[] = {view_heap.p, sampler_heap.p};
266 list->SetDescriptorHeaps(2, heaps);
267 list->SetComputeRootSignature(root.p);
268 list->SetPipelineState(pso.p);
269 list->SetComputeRootUnorderedAccessView(1, output_va);
270 list->SetComputeRootDescriptorTable(2, D3D12_GPU_DESCRIPTOR_HANDLE{view_gpu});
271 const UINT view_slot[runs] = {0, 1, 2, 0};
272 const UINT sampler_slot[runs] = {0, 0, 0, 1};
273 for (UINT run = 0; run < runs; ++run) {
274 const std::uint32_t offset_and_first[2] = {view_slot[run] * view_step / 4, run * texels};
275 list->SetComputeRoot32BitConstants(0, 2, offset_and_first, 0);
276 list->SetComputeRootDescriptorTable(
277 3, D3D12_GPU_DESCRIPTOR_HANDLE{sampler_gpu + std::uint64_t(sampler_slot[run]) * sampler_step});
278 list->Dispatch(1, 1, 1);
279 }
280 D3D12_RESOURCE_BARRIER to_copy = transition(output.p, D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
281 D3D12_RESOURCE_STATE_COPY_SOURCE);
282 list->ResourceBarrier(1, &to_copy);
283 list->CopyBufferRegion(readback.p, 0, output.p, 0, results.size());
284 EXPECT(list->Close() == S_OK);
285 ID3D12CommandList* lists[] = {list.p};
286 queue->ExecuteCommandLists(1, lists);
287 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
288 EXPECT(SUCCEEDED(queue->Signal(fence.p, 1)));
289 EXPECT(SUCCEEDED(fence->SetEventOnCompletion(1, nullptr)));
290 void* mapped = nullptr;
291 EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped)));
292 std::memcpy(results.data(), mapped, results.size());
293
294 for (auto& texture : textures) texture.reset();
295 for (auto* r : {&upload, &output, &readback}) r->reset();
296 pso.reset();
297 root.reset();
298 view_heap.reset();
299 sampler_heap.reset();
300 list.reset();
301 allocator.reset();
302 queue.reset();
303 fence.reset();
304 EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1);
305 }
306 std::filesystem::remove_all(library);
307
308 // Runs 0, 1 and 3 against the textures; run 2 is the fallback image, whose colour the test does not fix: it
309 // must be one colour everywhere, which neither texture gives.
310 const char* const names[runs] = {"slot 0, wrapping", "slot 1, wrapping", "the unknown slot", "slot 0, clamping"};
311 unsigned mismatches = 0;
312 for (UINT run = 0; run < runs; ++run) {
313 const std::uint8_t* got_run = results.data() + run * run_bytes;
314 for (UINT i = 0; i < texels; ++i) {
315 const UINT x = i % texture_size, y = i / texture_size;
316 const std::uint8_t* got = got_run + i * 4;
317 Texel want{};
318 if (run == 0) want = gradient(x, y);
319 else if (run == 1) want = reflected(x, y);
320 else if (run == 3) want = gradient(texture_size - 1, y);
321 else std::memcpy(want.data(), got_run, 4); // the fallback: texel 0 of the run, everywhere
322 if (std::memcmp(got, want.data(), 4) == 0) continue;
323 if (mismatches++ < 8)
324 std::fprintf(stderr, "%s, texel %u: got %u,%u,%u,%u want %u,%u,%u,%u\n", names[run], i, got[0], got[1],
325 got[2], got[3], want[0], want[1], want[2], want[3]);
326 }
327 }
328 EXPECT(!mismatches);
329 if (d.validation_errors()) {
330 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
331 return 1;
332 }
333 std::printf("set 0 from compute: four dispatches sampled through the bindless set the layer bound; %u texels "
334 "matched for each of two SRVs and for a clamping sampler, and bytes no view was made for gave the "
335 "fallback image\n", texels);
336 return 0;
337}
diff --git a/runtime/test/d3d12_subgroup_test.cpp b/runtime/test/d3d12_subgroup_test.cpp
new file mode 100644
index 000000000..4eae49a5b
--- /dev/null
+++ b/runtime/test/d3d12_subgroup_test.cpp
@@ -0,0 +1,672 @@
1// Subgroup size control in PSOs, end to end through the Xbox-ABI proxy over the Vulkan device (src/subgroup_size.h):
2// three translated compute shaders from runtime/test/shaders, each dispatched through a D3D12 PSO found by the
3// SHA-256 of its FSSM program, writing eight words through the V# in s[0:3] (four root constants), read back:
4// w64 native cs_w64x_readlane translated natively: v_readlane across both halves of a wave64. Exact only in a
5// 64-wide subgroup, so the PSO must ask for 64 (and full subgroups) on a device that can give it.
6// On a device that cannot (NVIDIA: 32 only) the PSO reports it, and the result is not judged.
7// w64 emulated the same shader translated with --wave64-emulate: exact on any size, the PSO asks for nothing.
8// w32 native cs_wqm_w32, a wave32 shader with whole-quad mode on lane masks; the PSO asks for 32 where the
9// device's default or range would otherwise change it.
10// Each case also prints a control run with the layer's size request switched off, to show what the request changes
11// on this GPU; the control is not judged. No game data. Set LEONIDA_VK_VALIDATION=1 to run under
12// VK_LAYER_KHRONOS_validation; validation errors fail the test.
13#include "vk_test_device.h"
14#include "../shims/d3d12_com.h"
15#include "../src/shader_library.h"
16#include "../shims/d3d12_xs_device.h"
17
18#include <array>
19#include <cstdint>
20#include <cstring>
21#include <filesystem>
22#include <string>
23#include <vector>
24
25#ifndef LEONIDA_TEST_SUBGROUP_SHADERS
26#error "LEONIDA_TEST_SUBGROUP_SHADERS must name the folder with the translated test shaders"
27#endif
28
29#define EXPECT(condition) do { \
30 if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \
31} while (0)
32
33namespace {
34
35using XboxComputePipelineFn = HRESULT(WINAPI*)(void* device, const D3D12_COMPUTE_PIPELINE_STATE_DESC*, std::uint64_t,
36 std::uint64_t, const IID*, void**);
37using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10: handle in RAX
38using SerializeFn = HRESULT(WINAPI*)(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC*, ID3DBlob**, ID3DBlob**);
39
40template<class T>
41struct Ref {
42 T* p = nullptr;
43 ~Ref() { reset(); }
44 void reset() {
45 if (p) p->Release();
46 p = nullptr;
47 }
48 T* operator->() const { return p; }
49};
50
51void* slot(void* object, unsigned index) { return (*reinterpret_cast<void***>(object))[index]; }
52
53void put32(std::vector<std::uint8_t>& out, std::uint32_t v) {
54 for (int i = 0; i < 4; ++i) out.push_back(std::uint8_t(v >> (8 * i)));
55}
56
57std::vector<std::uint8_t> zlib_stored(const std::vector<std::uint8_t>& data) {
58 std::vector<std::uint8_t> out = {0x78, 0x01, 0x01};
59 const auto length = std::uint16_t(data.size());
60 out.insert(out.end(), {std::uint8_t(length), std::uint8_t(length >> 8), std::uint8_t(~length),
61 std::uint8_t(~length >> 8)});
62 out.insert(out.end(), data.begin(), data.end());
63 std::uint32_t a = 1, b = 0;
64 for (const std::uint8_t x : data) {
65 a = (a + x) % 65521;
66 b = (b + a) % 65521;
67 }
68 const std::uint32_t adler = (b << 16) | a;
69 out.insert(out.end(), {std::uint8_t(adler >> 24), std::uint8_t(adler >> 16), std::uint8_t(adler >> 8),
70 std::uint8_t(adler)});
71 return out;
72}
73
74// DXBC { DXIL { stub, XDAT { 0x0D: XBCH + zlib(fssm) } } }, the layout tools/fssm_unpack.py reads.
75std::vector<std::uint8_t> shader_container(const std::vector<std::uint8_t>& fssm) {
76 const auto stream = zlib_stored(fssm);
77 std::vector<std::uint8_t> xbch = {'X', 'B', 'C', 'H'};
78 for (const std::uint32_t v : {1u, std::uint32_t(stream.size()), 0u, std::uint32_t(fssm.size()), 0u}) put32(xbch, v);
79 xbch.insert(xbch.end(), stream.begin(), stream.end());
80 std::vector<std::uint8_t> dxil(16, 0);
81 dxil.insert(dxil.end(), {'X', 'D', 'A', 'T'});
82 put32(dxil, 1);
83 put32(dxil, 12);
84 put32(dxil, 0x0d);
85 put32(dxil, 16 + 12 + 12);
86 put32(dxil, std::uint32_t(xbch.size()));
87 dxil.insert(dxil.end(), xbch.begin(), xbch.end());
88 std::vector<std::uint8_t> out = {'D', 'X', 'B', 'C'};
89 out.resize(28, 0);
90 put32(out, 1);
91 put32(out, 36);
92 out.insert(out.end(), {'D', 'X', 'I', 'L'});
93 put32(out, std::uint32_t(dxil.size()));
94 out.insert(out.end(), dxil.begin(), dxil.end());
95 return out;
96}
97
98// runtime/test/shaders/compute_fixture.py's header for a compute shader without "; group:" or "; rsrc2:" lines:
99// 0x148 bytes, COMPUTE_PGM_RSRC2 0x8088 (four user SGPRs, TGID_X, 512 bytes of LDS) at 0x138 and a 64x1x1 group.
100std::vector<std::uint8_t> fixture_fssm() {
101 std::vector<std::uint8_t> fssm(0x138, 0);
102 for (const std::uint32_t v : {0x8088u, 64u, 1u, 1u}) put32(fssm, v);
103 return fssm;
104}
105
106std::vector<std::uint8_t> serialize(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC& desc) {
107 const HMODULE d3d12 = LoadLibraryExA("d3d12.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
108 const auto fn = d3d12 ? reinterpret_cast<SerializeFn>(
109 reinterpret_cast<void*>(GetProcAddress(d3d12, "D3D12SerializeVersionedRootSignature")))
110 : nullptr;
111 std::vector<std::uint8_t> out;
112 ID3DBlob* blob = nullptr;
113 if (fn && SUCCEEDED(fn(&desc, &blob, nullptr)) && blob) {
114 const auto* p = static_cast<const std::uint8_t*>(blob->GetBufferPointer());
115 out.assign(p, p + blob->GetBufferSize());
116 blob->Release();
117 }
118 return out;
119}
120
121D3D12_RESOURCE_DESC buffer_desc(UINT64 bytes, D3D12_RESOURCE_FLAGS flags) {
122 D3D12_RESOURCE_DESC desc{};
123 desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
124 desc.Width = bytes;
125 desc.Height = 1;
126 desc.DepthOrArraySize = 1;
127 desc.MipLevels = 1;
128 desc.SampleDesc.Count = 1;
129 desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
130 desc.Flags = flags;
131 return desc;
132}
133
134using Words = std::array<std::uint32_t, 8>;
135
136struct Shader {
137 const char* label;
138 const char* folder; // under LEONIDA_TEST_SUBGROUP_SHADERS; its spirv/ holds index.json and the module
139 Words expected;
140};
141
142constexpr Shader w64_native{"w64 native (cs_w64x_readlane)", "w64_native", {121, 121, 16, 97, 16, 100, 100, 121}};
143constexpr Shader w64_emulated{"w64 emulated (cs_w64x_readlane, --wave64-emulate)", "w64_emulated",
144 {121, 121, 16, 97, 16, 100, 100, 121}};
145constexpr Shader w32_native{"w32 native (cs_wqm_w32)", "w32_native", {12, 1, 4, 0, 8, 15728880, 4, 32}};
146
147struct Result {
148 int failure = 0; // a line number, 0 when the case ran
149 Words words{};
150 std::vector<leonida::SubgroupRequest> requests;
151};
152
153// One dispatch of the shader's PSO on a device created with `caps` as what the layer knows of the GPU.
154Result run(vktest::Device& d, const std::filesystem::path& library, const leonida::SubgroupSizeCaps& caps) {
155 Result result;
156 const auto fail = [&](int line) {
157 result.failure = line;
158 return result;
159 };
160#define CASE_EXPECT(condition) do { if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return fail(__LINE__); } } while (0)
161
162 const auto fssm = fixture_fssm();
163 const auto container = shader_container(fssm);
164 CASE_EXPECT(leonida::fssm_program(container) == fssm);
165 {
166 leonida::ShaderLibrary index;
167 CASE_EXPECT(index.load(library.string()));
168 CASE_EXPECT(index.find("cs", leonida::sha256_hex(fssm))); // the translator's header is the fixture's
169 }
170
171 rt::d3d12::VulkanDeviceInfo info{};
172 info.get_instance_proc = d.instance_proc;
173 info.instance = d.instance;
174 info.physical = d.physical;
175 info.device = d.device;
176 info.queue = d.queue;
177 info.queue_family = d.family;
178 info.buffer_device_address = true;
179 info.shader_dir = library.string();
180 info.subgroup = caps;
181 ID3D12Device* inner = nullptr;
182 CASE_EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner))));
183 Ref<ID3D12Device> device;
184 CASE_EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device),
185 reinterpret_cast<void**>(&device.p))));
186 rt::d3d12::set_device_outer(inner, device.p);
187
188 // Root signature: [0] four constants (s0..s3), the V# the shaders store through.
189 D3D12_ROOT_PARAMETER param{};
190 param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
191 param.Constants = {0, 0, 4};
192 D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{};
193 root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
194 root_desc.Desc_1_0 = {1, &param, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE};
195 const auto root_blob = serialize(root_desc);
196 CASE_EXPECT(!root_blob.empty());
197 Ref<ID3D12RootSignature> root;
198 CASE_EXPECT(SUCCEEDED(device->CreateRootSignature(0, root_blob.data(), root_blob.size(), IID_PPV_ARGS(&root.p))));
199
200 D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc{};
201 pso_desc.pRootSignature = root.p;
202 pso_desc.CS = {container.data(), container.size()};
203 const IID pso_iid = __uuidof(ID3D12PipelineState);
204 Ref<ID3D12PipelineState> pso;
205 CASE_EXPECT(SUCCEEDED(reinterpret_cast<XboxComputePipelineFn>(slot(device.p, 62))(
206 device.p, &pso_desc, 0, 0, &pso_iid, reinterpret_cast<void**>(&pso.p))));
207 const auto* requests = rt::d3d12::pipeline_subgroup_requests(pso.p);
208 CASE_EXPECT(requests && requests->size() == 1);
209 result.requests = *requests;
210
211 constexpr UINT bytes = 256;
212 const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
213 const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK};
214 Ref<ID3D12Resource> out, readback;
215 const auto uav = buffer_desc(bytes, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
216 CASE_EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &uav,
217 D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr,
218 IID_PPV_ARGS(&out.p))));
219 const auto readback_desc = buffer_desc(bytes, D3D12_RESOURCE_FLAG_NONE);
220 CASE_EXPECT(SUCCEEDED(device->CreateCommittedResource(&readback_heap, D3D12_HEAP_FLAG_NONE, &readback_desc,
221 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
222 IID_PPV_ARGS(&readback.p))));
223 const D3D12_GPU_VIRTUAL_ADDRESS va = out->GetGPUVirtualAddress();
224 CASE_EXPECT(va >= 0x10000 && va < (1ull << 32));
225
226 D3D12_COMMAND_QUEUE_DESC queue_desc{};
227 Ref<ID3D12CommandQueue> queue;
228 Ref<ID3D12CommandAllocator> allocator;
229 Ref<ID3D12GraphicsCommandList> list;
230 Ref<ID3D12Fence> fence;
231 CASE_EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))));
232 CASE_EXPECT(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))));
233 CASE_EXPECT(SUCCEEDED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, pso.p,
234 IID_PPV_ARGS(&list.p))));
235 CASE_EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))));
236
237 // The V# the shaders read from s[0:3]: base = the buffer's console VA (the shader adds the heap base), stride 0,
238 // num_records unlimited, OOB_SELECT 3 (raw: a stride of 0 is a bounds check in the other modes).
239 list->SetComputeRootSignature(root.p);
240 const std::uint32_t vsharp[4] = {std::uint32_t(va), std::uint32_t(va >> 32) & 0xffff, 0xffffffffu, 0x31016FACu};
241 list->SetComputeRoot32BitConstants(0, 4, vsharp, 0);
242 list->Dispatch(1, 1, 1);
243 D3D12_RESOURCE_BARRIER barrier{};
244 barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
245 barrier.Transition = {out.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
246 D3D12_RESOURCE_STATE_COPY_SOURCE};
247 list->ResourceBarrier(1, &barrier);
248 list->CopyBufferRegion(readback.p, 0, out.p, 0, bytes);
249 CASE_EXPECT(list->Close() == S_OK);
250 ID3D12CommandList* lists[] = {list.p};
251 queue->ExecuteCommandLists(1, lists);
252 CASE_EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
253 CASE_EXPECT(SUCCEEDED(queue->Signal(fence.p, 1)));
254 CASE_EXPECT(SUCCEEDED(fence->SetEventOnCompletion(1, nullptr)));
255 void* mapped = nullptr;
256 CASE_EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped)));
257 std::memcpy(result.words.data(), mapped, sizeof(result.words));
258
259 for (auto* r : {&out, &readback}) r->reset();
260 pso.reset();
261 root.reset();
262 list.reset();
263 allocator.reset();
264 queue.reset();
265 fence.reset();
266 CASE_EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1);
267#undef CASE_EXPECT
268 return result;
269}
270
271std::string words_text(const Words& w) {
272 std::string s;
273 for (const std::uint32_t v : w) s += (s.empty() ? "" : " ") + std::to_string(v);
274 return s;
275}
276
277// What the decision function says about the shader's own index entry on this device.
278leonida::SubgroupRequest expected_request(const Shader& shader, const leonida::SubgroupSizeCaps& caps) {
279 leonida::ShaderLibrary index;
280 const auto dir = std::filesystem::path(LEONIDA_TEST_SUBGROUP_SHADERS) / shader.folder / "spirv";
281 if (!index.load(dir.string())) return {};
282 const auto* entry = index.find("cs", leonida::sha256_hex(fixture_fssm()));
283 return entry ? leonida::decide_subgroup_size(*entry, caps) : leonida::SubgroupRequest{};
284}
285
286std::filesystem::path shader_dir(const Shader& shader) {
287 return std::filesystem::path(LEONIDA_TEST_SUBGROUP_SHADERS) / shader.folder / "spirv";
288}
289
290// ---- Probe shaders (GLSL, test/glsl) and the graphics path -----------------------------------------------------------
291// What the translator would write into an index entry for a shader of each kind.
292struct Mode {
293 const char* label;
294 bool wave64;
295 std::uint32_t size; // subgroup_size
296 bool emulated; // --wave64-emulate: subgroup_size null, wave64_exchange "workgroup"
297};
298constexpr Mode mode_w64{"wave64, subgroup_size 64", true, 64, false};
299constexpr Mode mode_w32{"wave32, subgroup_size 32", false, 32, false};
300constexpr Mode mode_emulated{"emulated (wave64_exchange)", true, 0, true};
301
302std::string mode_json(const Mode& m) {
303 std::string s = std::string("\"wave64\": ") + (m.wave64 ? "true" : "false") + ", \"subgroup_size\": " +
304 (m.emulated ? std::string("null") : std::to_string(m.size));
305 if (m.emulated) s += ", \"wave64_exchange\": \"workgroup\"";
306 return s;
307}
308
309struct LibraryEntry {
310 std::string name, stage, tail; // tail: the rest of the index entry's members
311 std::filesystem::path spv;
312};
313
314// A translator-style folder with the entries' modules, every entry keyed by the fixture program's hash.
315std::filesystem::path make_library(const std::string& tag, const std::vector<LibraryEntry>& entries) {
316 const auto dir = std::filesystem::temp_directory_path() / ("leonida_subgroup_" + tag);
317 std::filesystem::remove_all(dir);
318 std::filesystem::create_directories(dir);
319 std::ofstream index(dir / "index.json", std::ios::binary);
320 index << "{";
321 bool first = true;
322 for (const LibraryEntry& e : entries) {
323 std::filesystem::copy_file(e.spv, dir / (e.name + ".spv"), std::filesystem::copy_options::overwrite_existing);
324 index << (first ? "" : ",\n") << "\"" << e.name << "\": {\"stage\": \"" << e.stage << "\", \"fssm_sha256\": \""
325 << leonida::sha256_hex(fixture_fssm()) << "\", \"bindings\": [], \"push_constant_bytes\": 144, "
326 << e.tail << "}";
327 first = false;
328 }
329 index << "}";
330 return dir;
331}
332
333std::filesystem::path glsl_spv(const char* name) {
334 return std::filesystem::path(LEONIDA_TEST_SUBGROUP_SHADERS) / "glsl" / (std::string(name) + ".spv");
335}
336
337// The compute probe: a library with cs_sg_probe in the given mode.
338std::filesystem::path compute_probe_library(const Mode& mode) {
339 return make_library("cs_probe", {{"cs_sg_probe", "cs",
340 "\"local_size\": [64, 1, 1], \"uses_code_base\": false, " + mode_json(mode),
341 glsl_spv("cs_sg_probe.comp")}});
342}
343
344constexpr UINT draw_size = 64;
345using Pixel = std::array<std::uint32_t, 4>;
346
347struct DrawResult {
348 int failure = 0;
349 std::vector<Pixel> pixels; // draw_size * draw_size
350 std::vector<leonida::SubgroupRequest> requests; // vertex, pixel
351};
352
353// One draw of a full-viewport triangle through a graphics PSO whose VS is vs_fullscreen and whose PS is `ps` of the
354// library, into a 64x64 R32G32B32A32_FLOAT target that is read back as bit patterns.
355DrawResult draw(vktest::Device& d, const std::filesystem::path& library, const leonida::SubgroupSizeCaps& caps) {
356 DrawResult result;
357 const auto fail = [&](int line) {
358 result.failure = line;
359 return result;
360 };
361#define CASE_EXPECT(condition) do { if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return fail(__LINE__); } } while (0)
362 const auto container = shader_container(fixture_fssm());
363
364 rt::d3d12::VulkanDeviceInfo info{};
365 info.get_instance_proc = d.instance_proc;
366 info.instance = d.instance;
367 info.physical = d.physical;
368 info.device = d.device;
369 info.queue = d.queue;
370 info.queue_family = d.family;
371 info.buffer_device_address = true;
372 info.shader_dir = library.string();
373 info.subgroup = caps;
374 ID3D12Device* inner = nullptr;
375 CASE_EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner))));
376 Ref<ID3D12Device> device;
377 CASE_EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device),
378 reinterpret_cast<void**>(&device.p))));
379 rt::d3d12::set_device_outer(inner, device.p);
380
381 D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{};
382 root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
383 root_desc.Desc_1_0 = {0, nullptr, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE};
384 const auto root_blob = serialize(root_desc);
385 CASE_EXPECT(!root_blob.empty());
386 Ref<ID3D12RootSignature> root;
387 CASE_EXPECT(SUCCEEDED(device->CreateRootSignature(0, root_blob.data(), root_blob.size(), IID_PPV_ARGS(&root.p))));
388
389 D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc{};
390 pso_desc.pRootSignature = root.p;
391 pso_desc.VS = {container.data(), container.size()};
392 pso_desc.PS = {container.data(), container.size()};
393 pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
394 pso_desc.SampleMask = 0xffffffff;
395 pso_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
396 pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
397 pso_desc.RasterizerState.DepthClipEnable = TRUE;
398 pso_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
399 pso_desc.NumRenderTargets = 1;
400 pso_desc.RTVFormats[0] = DXGI_FORMAT_R32G32B32A32_FLOAT;
401 pso_desc.SampleDesc.Count = 1;
402 Ref<ID3D12PipelineState> pso;
403 CASE_EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso.p))));
404 const auto* requests = rt::d3d12::pipeline_subgroup_requests(pso.p);
405 CASE_EXPECT(requests && requests->size() == 2);
406 result.requests = *requests;
407
408 const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
409 const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK};
410 constexpr UINT pitch = draw_size * 16;
411 Ref<ID3D12Resource> readback, target;
412 const auto readback_desc = buffer_desc(pitch * draw_size, D3D12_RESOURCE_FLAG_NONE);
413 CASE_EXPECT(SUCCEEDED(device->CreateCommittedResource(&readback_heap, D3D12_HEAP_FLAG_NONE, &readback_desc,
414 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
415 IID_PPV_ARGS(&readback.p))));
416 D3D12_RESOURCE_DESC rt_desc{};
417 rt_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
418 rt_desc.Width = rt_desc.Height = draw_size;
419 rt_desc.DepthOrArraySize = 1;
420 rt_desc.MipLevels = 1;
421 rt_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
422 rt_desc.SampleDesc.Count = 1;
423 rt_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
424 CASE_EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &rt_desc,
425 D3D12_RESOURCE_STATE_COMMON, nullptr,
426 IID_PPV_ARGS(&target.p))));
427 const D3D12_DESCRIPTOR_HEAP_DESC heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
428 Ref<ID3D12DescriptorHeap> rtv_heap;
429 CASE_EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&heap_desc, IID_PPV_ARGS(&rtv_heap.p))));
430 const D3D12_CPU_DESCRIPTOR_HANDLE rtv{SIZE_T(reinterpret_cast<XboxHeapHandleFn>(slot(rtv_heap.p, 9))(rtv_heap.p))};
431 device->CreateRenderTargetView(target.p, nullptr, rtv);
432
433 D3D12_COMMAND_QUEUE_DESC queue_desc{};
434 Ref<ID3D12CommandQueue> queue;
435 Ref<ID3D12CommandAllocator> allocator;
436 Ref<ID3D12GraphicsCommandList> list;
437 Ref<ID3D12Fence> fence;
438 CASE_EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))));
439 CASE_EXPECT(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))));
440 CASE_EXPECT(SUCCEEDED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, pso.p,
441 IID_PPV_ARGS(&list.p))));
442 CASE_EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))));
443
444 D3D12_RESOURCE_BARRIER to_target{};
445 to_target.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
446 to_target.Transition = {target.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_COMMON,
447 D3D12_RESOURCE_STATE_RENDER_TARGET};
448 list->ResourceBarrier(1, &to_target);
449 const FLOAT zero[4] = {0, 0, 0, 0};
450 list->ClearRenderTargetView(rtv, zero, 0, nullptr);
451 list->SetGraphicsRootSignature(root.p);
452 list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
453 const D3D12_VIEWPORT viewport{0, 0, float(draw_size), float(draw_size), 0, 1};
454 const D3D12_RECT scissor{0, 0, LONG(draw_size), LONG(draw_size)};
455 list->RSSetViewports(1, &viewport);
456 list->RSSetScissorRects(1, &scissor);
457 list->OMSetRenderTargets(1, &rtv, FALSE, nullptr);
458 list->DrawInstanced(3, 1, 0, 0);
459 D3D12_RESOURCE_BARRIER to_copy{};
460 to_copy.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
461 to_copy.Transition = {target.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_RENDER_TARGET,
462 D3D12_RESOURCE_STATE_COPY_SOURCE};
463 list->ResourceBarrier(1, &to_copy);
464 D3D12_TEXTURE_COPY_LOCATION dst{};
465 dst.pResource = readback.p;
466 dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
467 dst.PlacedFootprint = {0, {DXGI_FORMAT_R32G32B32A32_FLOAT, draw_size, draw_size, 1, pitch}};
468 D3D12_TEXTURE_COPY_LOCATION src{};
469 src.pResource = target.p;
470 src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
471 list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
472 CASE_EXPECT(list->Close() == S_OK);
473 ID3D12CommandList* lists[] = {list.p};
474 queue->ExecuteCommandLists(1, lists);
475 CASE_EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
476 CASE_EXPECT(SUCCEEDED(queue->Signal(fence.p, 1)));
477 CASE_EXPECT(SUCCEEDED(fence->SetEventOnCompletion(1, nullptr)));
478 void* mapped = nullptr;
479 CASE_EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped)));
480 result.pixels.resize(draw_size * draw_size);
481 std::memcpy(result.pixels.data(), mapped, result.pixels.size() * sizeof(Pixel));
482
483 for (auto* r : {&readback, &target}) r->reset();
484 pso.reset();
485 root.reset();
486 rtv_heap.reset();
487 list.reset();
488 allocator.reset();
489 queue.reset();
490 fence.reset();
491 CASE_EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1);
492#undef CASE_EXPECT
493 return result;
494}
495
496// The vertex shader of every draw. It is marked emulated so that it asks for nothing: only the pixel stage is under test.
497LibraryEntry fullscreen_vs() {
498 return {"vs_fullscreen", "vs", "\"input_signature\": [], " + mode_json(mode_emulated), glsl_spv("vs_sg_fullscreen.vert")};
499}
500
501LibraryEntry ps_probe(const Mode& mode) {
502 return {"ps_sg_probe", "ps", "\"outputs\": [0], " + mode_json(mode), glsl_spv("ps_sg_probe.frag")};
503}
504
505// The wave64 pixel shader with readlane across both halves, translated by the build (test/shaders/ps_w64x_readlane.asm).
506LibraryEntry ps_readlane(const Mode& mode) {
507 return {"ps_w64x_readlane", "ps", "\"outputs\": [0], " + mode_json(mode),
508 std::filesystem::path(LEONIDA_TEST_SUBGROUP_SHADERS) / "ps_w64_native" / "spirv" / "ps_w64x_readlane.spv"};
509}
510
511// The subgroup size a probe pixel reports, or 0 when the pixels disagree or do not look like a probe's.
512std::uint32_t probed_size(const std::vector<Pixel>& pixels) {
513 std::uint32_t size = 0;
514 for (const Pixel& p : pixels) {
515 if ((p[0] & 0xffff0000u) != 0x40000000u) return 0;
516 const std::uint32_t s = p[0] & 0xffff;
517 if (size && s != size) return 0;
518 size = s;
519 }
520 return size;
521}
522
523const Pixel readlane_expected = {0x40000079u, 0x40000010u, 0x40000064u, 0x400000beu};
524
525} // namespace
526
527int main() {
528 vktest::Device d;
529 const auto device_status = d.initialize();
530 if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips
531 if (device_status != vktest::DeviceStatus::ready) return 1;
532 const leonida::SubgroupSizeCaps& caps = d.subgroup;
533 leonida::SubgroupSizeCaps off = caps; // the control: the layer knows nothing of the device's sizes
534 off.min_size = off.max_size = off.default_size = 0;
535 off.subgroup_size_control = off.compute_full_subgroups = false;
536 off.required_stages = 0;
537
538 unsigned judged = 0;
539 for (const Shader* shader : {&w64_native, &w64_emulated, &w32_native}) {
540 const leonida::SubgroupRequest want = expected_request(*shader, caps);
541 const Result result = run(d, shader_dir(*shader), caps);
542 EXPECT(!result.failure);
543 EXPECT(result.requests.size() == 1);
544 const leonida::SubgroupRequest& got = result.requests[0];
545 // The PSO asked for what the decision function says.
546 EXPECT(got.outcome == want.outcome && got.size == want.size && got.flags == want.flags);
547 EXPECT(got.stage == VK_SHADER_STAGE_COMPUTE_BIT);
548
549 const bool exact = result.words == shader->expected;
550 std::printf("%s: outcome %d, required size %u, full subgroups %s; result %s (%s)\n", shader->label,
551 int(got.outcome), got.size, got.flags ? "yes" : "no", exact ? "exact" : "DIFFERS",
552 words_text(result.words).c_str());
553 if (shader == &w64_native && got.outcome == leonida::SubgroupOutcome::unavailable) {
554 // This GPU cannot give a wave64 compute shader 64 lanes. The layer said so (a log line, above); the
555 // build for this GPU should have used --wave64-emulate, which the next case checks.
556 std::printf(" this device has no 64-wide compute subgroup (sizes %u..%u): native wave64 not judged\n",
557 caps.min_size, caps.max_size);
558 } else {
559 if (!exact) std::fprintf(stderr, "%s: wanted %s\n", shader->label, words_text(shader->expected).c_str());
560 EXPECT(exact);
561 ++judged;
562 }
563 if (shader == &w64_native && got.outcome != leonida::SubgroupOutcome::unavailable) {
564 EXPECT(got.outcome != leonida::SubgroupOutcome::unknown_device);
565 EXPECT(got.outcome == leonida::SubgroupOutcome::required || got.outcome == leonida::SubgroupOutcome::device_fixed ||
566 got.outcome == leonida::SubgroupOutcome::device_default);
567 if (got.outcome == leonida::SubgroupOutcome::required) {
568 EXPECT(got.size == 64);
569 EXPECT(!caps.compute_full_subgroups ||
570 got.flags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT);
571 }
572 }
573 if (shader == &w64_emulated) EXPECT(got.outcome == leonida::SubgroupOutcome::emulated && !got.size && !got.flags);
574
575 // Control, not judged: the same PSO with no size asked for.
576 if (shader != &w64_emulated) {
577 const Result control = run(d, shader_dir(*shader), off);
578 EXPECT(!control.failure);
579 std::printf(" control, nothing requested: %s (%s)\n", control.words == shader->expected ? "exact" : "differs",
580 words_text(control.words).c_str());
581 }
582 }
583 // --- The driver's choice, observed: probe shaders that store gl_SubgroupSize ------------------------------------
584 const auto exact_outcome = [](leonida::SubgroupOutcome o) {
585 return o == leonida::SubgroupOutcome::required || o == leonida::SubgroupOutcome::device_fixed;
586 };
587 for (const Mode* mode : {&mode_w64, &mode_w32, &mode_emulated}) {
588 const auto library = compute_probe_library(*mode);
589 const Result r = run(d, library, caps);
590 EXPECT(!r.failure && r.requests.size() == 1);
591 const leonida::SubgroupRequest& req = r.requests[0];
592 const std::uint32_t seen = r.words[0];
593 std::printf("compute probe, %s: outcome %d (asked %u), the driver ran it %u-wide\n", mode->label,
594 int(req.outcome), req.size, seen);
595 if (exact_outcome(req.outcome)) EXPECT(seen == req.wanted); // the size the PSO asked for is the size it got
596 const Result control = run(d, library, off);
597 EXPECT(!control.failure);
598 std::printf(" control, nothing requested: %u-wide (device default %u)\n", control.words[0], caps.default_size);
599 // The request matters: a wave32 shader on a device whose default is not 32 runs at the default without it.
600 if (mode == &mode_w32 && req.outcome == leonida::SubgroupOutcome::required && caps.default_size != 32)
601 EXPECT(control.words[0] != 32);
602 std::filesystem::remove_all(library);
603 }
604
605 std::uint32_t fragment_default = 0;
606 {
607 const auto library = make_library("ps_probe", {fullscreen_vs(), ps_probe(mode_w32)});
608 const DrawResult control = draw(d, library, off);
609 EXPECT(!control.failure);
610 fragment_default = probed_size(control.pixels);
611 EXPECT(fragment_default);
612 std::printf("pixel probe, nothing requested: the driver runs pixel shaders %u-wide\n", fragment_default);
613 std::filesystem::remove_all(library);
614 }
615 for (const Mode* mode : {&mode_w64, &mode_w32, &mode_emulated}) {
616 const auto library = make_library("ps_probe", {fullscreen_vs(), ps_probe(*mode)});
617 const DrawResult r = draw(d, library, caps);
618 EXPECT(!r.failure && r.requests.size() == 2);
619 const leonida::SubgroupRequest& vs_req = r.requests[0];
620 const leonida::SubgroupRequest& req = r.requests[1];
621 EXPECT(vs_req.outcome == leonida::SubgroupOutcome::emulated && vs_req.stage == VK_SHADER_STAGE_VERTEX_BIT);
622 EXPECT(req.stage == VK_SHADER_STAGE_FRAGMENT_BIT);
623 const std::uint32_t seen = probed_size(r.pixels);
624 EXPECT(seen);
625 std::printf("pixel probe, %s: outcome %d (asked %u), the driver ran it %u-wide\n", mode->label,
626 int(req.outcome), req.size, seen);
627 if (exact_outcome(req.outcome)) EXPECT(seen == req.wanted);
628 if (req.outcome == leonida::SubgroupOutcome::required && fragment_default != req.wanted)
629 std::printf(" the request changes it: %u-wide without, %u-wide with\n", fragment_default, seen);
630 std::filesystem::remove_all(library);
631 }
632
633 // --- A wave64 pixel shader with a cross-half v_readlane, through a graphics PSO ---------------------------------
634 {
635 const auto library = make_library("ps_readlane", {fullscreen_vs(), ps_readlane(mode_w64)});
636 const auto count_exact = [](const std::vector<Pixel>& pixels) {
637 std::size_t n = 0;
638 for (const Pixel& p : pixels) n += p == readlane_expected;
639 return n;
640 };
641 const DrawResult r = draw(d, library, caps);
642 EXPECT(!r.failure && r.requests.size() == 2);
643 const leonida::SubgroupRequest& req = r.requests[1];
644 const std::size_t exact = count_exact(r.pixels), total = r.pixels.size();
645 std::printf("wave64 pixel shader (ps_w64x_readlane): outcome %d, required size %u; %zu of %zu pixels exact\n",
646 int(req.outcome), req.size, exact, total);
647 if (exact_outcome(req.outcome)) {
648 if (exact != total)
649 std::fprintf(stderr, "first pixel %08x %08x %08x %08x\n", r.pixels[0][0], r.pixels[0][1],
650 r.pixels[0][2], r.pixels[0][3]);
651 EXPECT(exact == total);
652 ++judged;
653 } else {
654 std::printf(" this device cannot require 64 for a wave64 pixel shader: not judged\n");
655 }
656 const DrawResult control = draw(d, library, off);
657 EXPECT(!control.failure);
658 const std::size_t control_exact = count_exact(control.pixels);
659 std::printf(" control, nothing requested (pixel shaders run %u-wide): %zu of %zu pixels exact\n",
660 fragment_default, control_exact, total);
661 // Where the default is not 64, the shader crosses halves that are not there: the request must matter.
662 if (req.outcome == leonida::SubgroupOutcome::required && fragment_default != 64) EXPECT(control_exact < total);
663 std::filesystem::remove_all(library);
664 }
665 if (d.validation_errors()) {
666 std::fprintf(stderr, "%u validation errors\n", d.validation_errors());
667 return 1;
668 }
669 std::printf("subgroup size: %u shaders judged exact through the layer's PSOs (sizes %u..%u, default %u)\n",
670 judged, caps.min_size, caps.max_size, caps.default_size);
671 return 0;
672}
diff --git a/runtime/test/d3d12_vulkan_device_test.cpp b/runtime/test/d3d12_vulkan_device_test.cpp
index 1eb25adf1..a528202bc 100644
--- a/runtime/test/d3d12_vulkan_device_test.cpp
+++ b/runtime/test/d3d12_vulkan_device_test.cpp
@@ -324,8 +324,8 @@ int cpu_copies(ID3D12Device* device, bool bc, const char* path) {
324 return 0; 324 return 0;
325} 325}
326 326
327// The host PC runtime's D3D12 device to compare answers with: the default adapter, or the one LEONIDA_HOST_ADAPTER 327// The host PC runtime's D3D12 device to compare answers with: the layer's own adapter (set in main), else the default
328// names ("warp", or part of an adapter's name); false if there is none. 328// one, or the one LEONIDA_HOST_ADAPTER names ("warp", or part of an adapter's name); false if there is none.
329// Under Wine there is none (copycmp::create_host). 329// Under Wine there is none (copycmp::create_host).
330bool create_host_device(Ref<ID3D12Device>& host, std::string* adapter_name = nullptr) { 330bool create_host_device(Ref<ID3D12Device>& host, std::string* adapter_name = nullptr) {
331 copycmp::Ptr<ID3D12Device> device; 331 copycmp::Ptr<ID3D12Device> device;
@@ -506,6 +506,9 @@ int compare_footprints(ID3D12Device* ours) {
506 {texture_desc(13, 7, DXGI_FORMAT_B5G5R5A1_UNORM, D3D12_RESOURCE_FLAG_NONE, 4, 2), 8}, 506 {texture_desc(13, 7, DXGI_FORMAT_B5G5R5A1_UNORM, D3D12_RESOURCE_FLAG_NONE, 4, 2), 8},
507 {texture_desc(13, 7, DXGI_FORMAT_A8_UNORM, D3D12_RESOURCE_FLAG_NONE, 4, 2), 8}, 507 {texture_desc(13, 7, DXGI_FORMAT_A8_UNORM, D3D12_RESOURCE_FLAG_NONE, 4, 2), 8},
508 {texture_desc(13, 7, DXGI_FORMAT_R16G16B16A16_FLOAT, D3D12_RESOURCE_FLAG_NONE, 4), 4}, 508 {texture_desc(13, 7, DXGI_FORMAT_R16G16B16A16_FLOAT, D3D12_RESOURCE_FLAG_NONE, 4), 4},
509 {texture_desc(13, 7, DXGI_FORMAT_B8G8R8X8_UNORM, D3D12_RESOURCE_FLAG_NONE, 4, 2), 8},
510 {texture_desc(13, 7, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, D3D12_RESOURCE_FLAG_NONE, 4), 4},
511 {texture_desc(16, 16, DXGI_FORMAT_B8G8R8X8_TYPELESS, D3D12_RESOURCE_FLAG_NONE, 3), 3},
509 {texture_desc(10, 6, DXGI_FORMAT_BC1_UNORM, D3D12_RESOURCE_FLAG_NONE, 4), 4}, 512 {texture_desc(10, 6, DXGI_FORMAT_BC1_UNORM, D3D12_RESOURCE_FLAG_NONE, 4), 4},
510 {texture_desc(4, 4, DXGI_FORMAT_BC7_UNORM_SRGB, D3D12_RESOURCE_FLAG_NONE, 1, 3), 3}, 513 {texture_desc(4, 4, DXGI_FORMAT_BC7_UNORM_SRGB, D3D12_RESOURCE_FLAG_NONE, 1, 3), 3},
511 {texture_desc(16, 16, DXGI_FORMAT_BC5_UNORM, D3D12_RESOURCE_FLAG_NONE, 5), 5}, 514 {texture_desc(16, 16, DXGI_FORMAT_BC5_UNORM, D3D12_RESOURCE_FLAG_NONE, 5), 5},
@@ -694,6 +697,97 @@ int compare_allocation_info(ID3D12Device* ours) {
694 {"16x16 R8G8_TYPELESS", texture_desc(16, 16, DXGI_FORMAT_R8G8_TYPELESS, none, 1), 16 * 16 * 2}, 697 {"16x16 R8G8_TYPELESS", texture_desc(16, 16, DXGI_FORMAT_R8G8_TYPELESS, none, 1), 16 * 16 * 2},
695 {"16x16 R8G8_UINT", texture_desc(16, 16, DXGI_FORMAT_R8G8_UINT, none, 1), 16 * 16 * 2}, 698 {"16x16 R8G8_UINT", texture_desc(16, 16, DXGI_FORMAT_R8G8_UINT, none, 1), 16 * 16 * 2},
696 {"16x16 R8G8_SINT", texture_desc(16, 16, DXGI_FORMAT_R8G8_SINT, none, 1), 16 * 16 * 2}, 699 {"16x16 R8G8_SINT", texture_desc(16, 16, DXGI_FORMAT_R8G8_SINT, none, 1), 16 * 16 * 2},
700 // Tiled (64KB_UNDEFINED_SWIZZLE) textures: 64 KiB alignment and tile-multiple size; 1D, buffers, 4 KiB
701 // alignment, untileable 96-bit and two-plane depth-stencil formats are invalid.
702 {"tiled 2D 256x256", [&] {
703 D3D12_RESOURCE_DESC d = texture_desc(256, 256, rgba8, none, 1);
704 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
705 return d;
706 }(), 256 * 256 * 4},
707 {"tiled 2D D32F 256x256", [&] {
708 D3D12_RESOURCE_DESC d = texture_desc(256, 256, DXGI_FORMAT_D32_FLOAT,
709 D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, 1);
710 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
711 return d;
712 }(), 256 * 256 * 4},
713 {"tiled 3D 64x64x64", [&] {
714 D3D12_RESOURCE_DESC d = small_volume(64, 64, 64, rgba8);
715 d.Alignment = 0;
716 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
717 return d;
718 }(), 64 * 64 * 64 * 4},
719 {"tiled buffer (invalid)", [&] {
720 D3D12_RESOURCE_DESC d = buffer_desc(4096);
721 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
722 return d;
723 }(), 0},
724 {"tiled 1D (invalid)", [&] {
725 D3D12_RESOURCE_DESC d = line_desc(256, 1, 1, rgba8);
726 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
727 return d;
728 }(), 0},
729 {"tiled 2D 4K alignment (invalid)", [&] {
730 D3D12_RESOURCE_DESC d = with(texture_desc(16, 16, rgba8, none, 1), k4);
731 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
732 return d;
733 }(), 0},
734 {"tiled 2D RGB32F (invalid)", [&] {
735 D3D12_RESOURCE_DESC d = texture_desc(64, 64, DXGI_FORMAT_R32G32B32_FLOAT, none, 1);
736 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
737 return d;
738 }(), 0},
739 {"tiled 2D D24S8 (invalid)", [&] {
740 D3D12_RESOURCE_DESC d = texture_desc(64, 64, DXGI_FORMAT_D24_UNORM_S8_UINT,
741 D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, 1);
742 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
743 return d;
744 }(), 0},
745 {"tiled 2D 4x MSAA RGBA8", [&] {
746 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8, rt, 1), 0, 4);
747 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
748 return d;
749 }(), 256 * 256 * 4 * 4},
750 {"tiled 2D 4x MSAA RGBA32F", [&] {
751 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, DXGI_FORMAT_R32G32B32A32_FLOAT, rt, 1), 0, 4);
752 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
753 return d;
754 }(), 256 * 256 * 16 * 4},
755 {"tiled 2D 4x MSAA D32F", [&] {
756 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, DXGI_FORMAT_D32_FLOAT,
757 D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, 1), 0, 4);
758 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
759 return d;
760 }(), 256 * 256 * 4 * 4},
761 {"tiled 2D 2x MSAA (invalid)", [&] {
762 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8, rt, 1), 0, 2);
763 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
764 return d;
765 }(), 0},
766 {"tiled 2D 8x MSAA (invalid)", [&] {
767 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8, rt, 1), 0, 8);
768 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
769 return d;
770 }(), 0},
771 {"tiled 2D 4x MSAA NONE (invalid)", [&] {
772 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8, none, 1), 0, 4);
773 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
774 return d;
775 }(), 0},
776 {"tiled 2D 4x MSAA RT+DS (invalid)", [&] {
777 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8,
778 rt | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, 1), 0, 4);
779 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
780 return d;
781 }(), 0},
782 {"tiled 2D 4x MSAA 4M alignment (invalid)", [&] {
783 D3D12_RESOURCE_DESC d = with(texture_desc(256, 256, rgba8, rt, 1),
784 D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, 4);
785 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
786 return d;
787 }(), 0},
788 {"UNKNOWN 4x MSAA NONE (invalid)", with(texture_desc(256, 256, rgba8, none, 1), 0, 4), 0},
789 {"UNKNOWN 4x MSAA RT+DS (invalid)",
790 with(texture_desc(256, 256, rgba8, rt | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, 1), 0, 4), 0},
697 }; 791 };
698 int mismatches = 0; 792 int mismatches = 0;
699 const auto mismatch = [&](const char* name, const D3D12_RESOURCE_ALLOCATION_INFO& a, 793 const auto mismatch = [&](const char* name, const D3D12_RESOURCE_ALLOCATION_INFO& a,
@@ -706,6 +800,18 @@ int compare_allocation_info(ID3D12Device* ours) {
706 for (const Case& c : cases) { 800 for (const Case& c : cases) {
707 const D3D12_RESOURCE_ALLOCATION_INFO a = ours->GetResourceAllocationInfo(0, 1, &c.desc); 801 const D3D12_RESOURCE_ALLOCATION_INFO a = ours->GetResourceAllocationInfo(0, 1, &c.desc);
708 const D3D12_RESOURCE_ALLOCATION_INFO b = host->GetResourceAllocationInfo(0, 1, &c.desc); 802 const D3D12_RESOURCE_ALLOCATION_INFO b = host->GetResourceAllocationInfo(0, 1, &c.desc);
803 if (c.top_mip_bytes && b.SizeInBytes == UINT64_MAX && c.desc.SampleDesc.Count > 1 &&
804 c.desc.Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE) {
805 D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS ms{
806 c.desc.Format, c.desc.SampleDesc.Count, D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_TILED_RESOURCE, 0};
807 if (SUCCEEDED(host->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &ms, sizeof(ms))) &&
808 ms.NumQualityLevels == 0) {
809 if (a.SizeInBytes == UINT64_MAX || a.Alignment != D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)
810 mismatch(c.name, a, b);
811 std::printf("allocation info %s: host unsupported (NumQualityLevels=0), skipped\n", c.name);
812 continue;
813 }
814 }
709 if (b.SizeInBytes == UINT64_MAX || !c.top_mip_bytes) { 815 if (b.SizeInBytes == UINT64_MAX || !c.top_mip_bytes) {
710 if (a.SizeInBytes != b.SizeInBytes || (b.SizeInBytes != UINT64_MAX && a.Alignment != b.Alignment)) 816 if (a.SizeInBytes != b.SizeInBytes || (b.SizeInBytes != UINT64_MAX && a.Alignment != b.Alignment))
711 mismatch(c.name, a, b); 817 mismatch(c.name, a, b);
@@ -1506,6 +1612,15 @@ int compare_feature_support(ID3D12Device* ours) {
1506 1612
1507// Same-adapter host D3D12 device matched by VkPhysicalDeviceIDProperties (LUID first, then PCI IDs), falling back 1613// Same-adapter host D3D12 device matched by VkPhysicalDeviceIDProperties (LUID first, then PCI IDs), falling back
1508// to the default adapter. False if the host has no D3D12 device. 1614// to the default adapter. False if the host has no D3D12 device.
1615// D3D11.3 spec 3.2.3.8's ideal FLOAT -> SRGB encoding of c in [0, 1], before scaling to the format's maximum.
1616double ideal_srgb(double c) { return c <= 0.0031308 ? c * 12.92 : 1.055 * std::pow(c, 1.0 / 2.4) - 0.055; }
1617
1618// Both bytes within 0.6 ULP (on the integer side) of the ideal value: the tolerance spec 3.2.3.6 (FLOAT -> UNORM)
1619// and 3.2.3.8 (FLOAT -> SRGB) permit, so two drivers may give the codes either side of a near-tie.
1620bool within_06_ulp(std::uint8_t a, std::uint8_t b, double ideal) {
1621 return std::abs(double(a) - ideal) <= 0.6 && std::abs(double(b) - ideal) <= 0.6;
1622}
1623
1509bool create_host_device_for_physical(VkInstance instance, VkPhysicalDevice physical, 1624bool create_host_device_for_physical(VkInstance instance, VkPhysicalDevice physical,
1510 PFN_vkGetInstanceProcAddr instance_proc, Ref<ID3D12Device>& host, 1625 PFN_vkGetInstanceProcAddr instance_proc, Ref<ID3D12Device>& host,
1511 std::string& adapter_name) { 1626 std::string& adapter_name) {
@@ -2147,6 +2262,21 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2147 struct Case { 2262 struct Case {
2148 const char* name; 2263 const char* name;
2149 InvalidCase call; 2264 InvalidCase call;
2265 bool (*comparable)(ID3D12Device*) = nullptr;
2266 };
2267 const auto device10 = [](ID3D12Device* d) {
2268 Ref<ID3D12Device10> newer;
2269 return SUCCEEDED(d->QueryInterface(IID_PPV_ARGS(&newer.p)));
2270 };
2271 const auto not_elevated = [](ID3D12Device*) {
2272 HANDLE token = nullptr;
2273 TOKEN_ELEVATION elevation{};
2274 DWORD size = 0;
2275 const bool elevated = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token) &&
2276 GetTokenInformation(token, TokenElevation, &elevation, sizeof(elevation), &size) &&
2277 elevation.TokenIsElevated;
2278 if (token) CloseHandle(token);
2279 return !elevated;
2150 }; 2280 };
2151 static const Case cases[] = { 2281 static const Case cases[] = {
2152 // CreateCommittedResource: arguments. 2282 // CreateCommittedResource: arguments.
@@ -2224,7 +2354,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2224 }}, 2354 }},
2225 {"committed: upload buffer in COMMON", [](ID3D12Device* d) { 2355 {"committed: upload buffer in COMMON", [](ID3D12Device* d) {
2226 return committed(d, {D3D12_HEAP_TYPE_UPLOAD}, buffer_desc(256), D3D12_RESOURCE_STATE_COMMON); 2356 return committed(d, {D3D12_HEAP_TYPE_UPLOAD}, buffer_desc(256), D3D12_RESOURCE_STATE_COMMON);
2227 }}, 2357 }, +device10},
2228 {"committed: upload buffer in COPY_DEST", [](ID3D12Device* d) { 2358 {"committed: upload buffer in COPY_DEST", [](ID3D12Device* d) {
2229 return committed(d, {D3D12_HEAP_TYPE_UPLOAD}, buffer_desc(256), D3D12_RESOURCE_STATE_COPY_DEST); 2359 return committed(d, {D3D12_HEAP_TYPE_UPLOAD}, buffer_desc(256), D3D12_RESOURCE_STATE_COPY_DEST);
2230 }}, 2360 }},
@@ -2350,7 +2480,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2350 {"committed: BC1 6x6 top mip", [](ID3D12Device* d) { 2480 {"committed: BC1 6x6 top mip", [](ID3D12Device* d) {
2351 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, 2481 return committed(d, {D3D12_HEAP_TYPE_DEFAULT},
2352 texture_desc(6, 6, DXGI_FORMAT_BC1_UNORM, D3D12_RESOURCE_FLAG_NONE)); 2482 texture_desc(6, 6, DXGI_FORMAT_BC1_UNORM, D3D12_RESOURCE_FLAG_NONE));
2353 }}, 2483 }, host_supports_unaligned_block_textures},
2354 {"committed: render target and depth stencil", [](ID3D12Device* d) { 2484 {"committed: render target and depth stencil", [](ID3D12Device* d) {
2355 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, 2485 return committed(d, {D3D12_HEAP_TYPE_DEFAULT},
2356 texture_desc(16, 16, DXGI_FORMAT_D32_FLOAT, 2486 texture_desc(16, 16, DXGI_FORMAT_D32_FLOAT,
@@ -2422,7 +2552,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2422 }}, 2552 }},
2423 {"committed: readback buffer in COMMON", [](ID3D12Device* d) { 2553 {"committed: readback buffer in COMMON", [](ID3D12Device* d) {
2424 return committed(d, {D3D12_HEAP_TYPE_READBACK}, buffer_desc(256), D3D12_RESOURCE_STATE_COMMON); 2554 return committed(d, {D3D12_HEAP_TYPE_READBACK}, buffer_desc(256), D3D12_RESOURCE_STATE_COMMON);
2425 }}, 2555 }, +device10},
2426 {"committed: readback buffer with UAV", [](ID3D12Device* d) { 2556 {"committed: readback buffer with UAV", [](ID3D12Device* d) {
2427 auto desc = buffer_desc(256); 2557 auto desc = buffer_desc(256);
2428 desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; 2558 desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
@@ -2582,7 +2712,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2582 }}, 2712 }},
2583 {"committed: heap flag HARDWARE_PROTECTED on a texture", [](ID3D12Device* d) { 2713 {"committed: heap flag HARDWARE_PROTECTED on a texture", [](ID3D12Device* d) {
2584 return with_heap_flags(d, rgba8(), D3D12_HEAP_FLAG_HARDWARE_PROTECTED); 2714 return with_heap_flags(d, rgba8(), D3D12_HEAP_FLAG_HARDWARE_PROTECTED);
2585 }}, 2715 }, +device10},
2586 {"committed: heap flag ALLOW_WRITE_WATCH on a buffer", [](ID3D12Device* d) { 2716 {"committed: heap flag ALLOW_WRITE_WATCH on a buffer", [](ID3D12Device* d) {
2587 return with_heap_flags(d, buffer_desc(256), D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH); 2717 return with_heap_flags(d, buffer_desc(256), D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH);
2588 }}, 2718 }},
@@ -2637,7 +2767,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2637 auto desc = buffer_desc(256); 2767 auto desc = buffer_desc(256);
2638 desc.Flags = D3D12_RESOURCE_FLAGS(D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE); 2768 desc.Flags = D3D12_RESOURCE_FLAGS(D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE);
2639 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc); 2769 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc);
2640 }}, 2770 }, +device10},
2641 {"committed: resource flag 0x200 on a buffer", [](ID3D12Device* d) { 2771 {"committed: resource flag 0x200 on a buffer", [](ID3D12Device* d) {
2642 auto desc = buffer_desc(256); 2772 auto desc = buffer_desc(256);
2643 desc.Flags = D3D12_RESOURCE_FLAGS(0x200); 2773 desc.Flags = D3D12_RESOURCE_FLAGS(0x200);
@@ -2665,15 +2795,15 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2665 {"committed: resource flag RAYTRACING_ACCELERATION_STRUCTURE on a texture", [](ID3D12Device* d) { 2795 {"committed: resource flag RAYTRACING_ACCELERATION_STRUCTURE on a texture", [](ID3D12Device* d) {
2666 auto desc = rgba8(D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE); 2796 auto desc = rgba8(D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE);
2667 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc); 2797 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc);
2668 }}, 2798 }, +device10},
2669 {"committed: resource flag 0x400 on a buffer", [](ID3D12Device* d) { 2799 {"committed: resource flag 0x400 on a buffer", [](ID3D12Device* d) {
2670 auto desc = buffer_desc(256); 2800 auto desc = buffer_desc(256);
2671 desc.Flags = D3D12_RESOURCE_FLAGS(0x400); 2801 desc.Flags = D3D12_RESOURCE_FLAGS(0x400);
2672 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc); 2802 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, desc);
2673 }}, 2803 }, +device10},
2674 {"committed: resource flag 0x400 on a texture", [](ID3D12Device* d) { 2804 {"committed: resource flag 0x400 on a texture", [](ID3D12Device* d) {
2675 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, rgba8(D3D12_RESOURCE_FLAGS(0x400))); 2805 return committed(d, {D3D12_HEAP_TYPE_DEFAULT}, rgba8(D3D12_RESOURCE_FLAGS(0x400)));
2676 }}, 2806 }, +device10},
2677 // A null output is a capability check; with invalid arguments too, the host's answer says which comes first. 2807 // A null output is a capability check; with invalid arguments too, the host's answer says which comes first.
2678 {"committed: heap type 99, null output", [](ID3D12Device* d) { 2808 {"committed: heap type 99, null output", [](ID3D12Device* d) {
2679 const H heap{D3D12_HEAP_TYPE(99)}; 2809 const H heap{D3D12_HEAP_TYPE(99)};
@@ -2726,7 +2856,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2726 {"descriptor heap: shader-visible 2049 samplers", [](ID3D12Device* d) { 2856 {"descriptor heap: shader-visible 2049 samplers", [](ID3D12Device* d) {
2727 return descriptor_heap(d, {D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 2049, 2857 return descriptor_heap(d, {D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 2049,
2728 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}); 2858 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE});
2729 }}, 2859 }, +device10},
2730 {"descriptor heap: shader-visible 2048 samplers", [](ID3D12Device* d) { 2860 {"descriptor heap: shader-visible 2048 samplers", [](ID3D12Device* d) {
2731 return descriptor_heap(d, {D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 2048, 2861 return descriptor_heap(d, {D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 2048,
2732 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}); 2862 D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE});
@@ -2771,7 +2901,7 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2771 }}, 2901 }},
2772 {"command queue: global realtime priority", [](ID3D12Device* d) { 2902 {"command queue: global realtime priority", [](ID3D12Device* d) {
2773 return command_queue(d, {D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME}); 2903 return command_queue(d, {D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME});
2774 }}, 2904 }, +not_elevated},
2775 {"command queue: compute", [](ID3D12Device* d) { return command_queue(d, {D3D12_COMMAND_LIST_TYPE_COMPUTE}); }}, 2905 {"command queue: compute", [](ID3D12Device* d) { return command_queue(d, {D3D12_COMMAND_LIST_TYPE_COMPUTE}); }},
2776 {"command queue: copy", [](ID3D12Device* d) { return command_queue(d, {D3D12_COMMAND_LIST_TYPE_COPY}); }}, 2906 {"command queue: copy", [](ID3D12Device* d) { return command_queue(d, {D3D12_COMMAND_LIST_TYPE_COPY}); }},
2777 {"command queue: high priority", [](ID3D12Device* d) { 2907 {"command queue: high priority", [](ID3D12Device* d) {
@@ -2861,6 +2991,11 @@ int compare_invalid_arguments(ID3D12Device* ours) {
2861 const HRESULT a = call_guarded(c.call, ours), b = call_guarded(c.call, host.p); 2991 const HRESULT a = call_guarded(c.call, ours), b = call_guarded(c.call, host.p);
2862 if (verbose) std::printf(" ours 0x%08lx host 0x%08lx\n", a, b); 2992 if (verbose) std::printf(" ours 0x%08lx host 0x%08lx\n", a, b);
2863 if (a == b) continue; 2993 if (a == b) continue;
2994 if (c.comparable && !c.comparable(host.p)) {
2995 std::printf("invalid arguments %s: not comparable on this host (ours 0x%08lx, host 0x%08lx)\n", c.name,
2996 a, b);
2997 continue;
2998 }
2864 ++mismatches; 2999 ++mismatches;
2865 std::fprintf(stderr, "invalid arguments %s: ours 0x%08lx, host 0x%08lx\n", c.name, a, b); 3000 std::fprintf(stderr, "invalid arguments %s: ours 0x%08lx, host 0x%08lx\n", c.name, a, b);
2866 } 3001 }
@@ -2925,6 +3060,18 @@ int main() {
2925 const auto status = d.initialize(); 3060 const auto status = d.initialize();
2926 if (status == vktest::DeviceStatus::unavailable) return 77; 3061 if (status == vktest::DeviceStatus::unavailable) return 77;
2927 if (status == vktest::DeviceStatus::failed) return 1; 3062 if (status == vktest::DeviceStatus::failed) return 1;
3063 {
3064 // The host comparisons (create_host_device, the copies) run on the layer's own adapter, not D3D12's default
3065 // one, which on a PC with two GPUs can be the other GPU (copycmp::layer_adapter).
3066 VkPhysicalDeviceIDProperties id{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES};
3067 VkPhysicalDeviceProperties2 properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &id};
3068 d.instance_fn<PFN_vkGetPhysicalDeviceProperties2>("vkGetPhysicalDeviceProperties2")(d.physical, &properties);
3069 if (id.deviceLUIDValid) {
3070 LUID luid{};
3071 std::memcpy(&luid, id.deviceLUID, sizeof(luid));
3072 copycmp::layer_adapter() = luid;
3073 }
3074 }
2928 EXPECT(d.depth_format_usable(VK_FORMAT_D32_SFLOAT_S8_UINT)); 3075 EXPECT(d.depth_format_usable(VK_FORMAT_D32_SFLOAT_S8_UINT));
2929 VkSampleCountFlags depth_sample_counts = 0, color_sample_counts = 0; 3076 VkSampleCountFlags depth_sample_counts = 0, color_sample_counts = 0;
2930 { 3077 {
@@ -3142,7 +3289,8 @@ int main() {
3142 DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SINT, 3289 DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SINT,
3143 DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_UINT, 3290 DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_UINT,
3144 DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R8G8_TYPELESS, DXGI_FORMAT_R8G8_UINT, 3291 DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R8G8_TYPELESS, DXGI_FORMAT_R8G8_UINT,
3145 DXGI_FORMAT_R8G8_SINT}) { 3292 DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_B8G8R8X8_TYPELESS, DXGI_FORMAT_B8G8R8X8_UNORM,
3293 DXGI_FORMAT_B8G8R8X8_UNORM_SRGB}) {
3146 D3D12_FEATURE_DATA_FORMAT_SUPPORT fs{f}; 3294 D3D12_FEATURE_DATA_FORMAT_SUPPORT fs{f};
3147 EXPECT(SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &fs, sizeof(fs)))); 3295 EXPECT(SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &fs, sizeof(fs))));
3148 EXPECT(fs.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D); 3296 EXPECT(fs.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D);
@@ -3154,6 +3302,42 @@ int main() {
3154 EXPECT(tex.p != nullptr); 3302 EXPECT(tex.p != nullptr);
3155 } 3303 }
3156 } 3304 }
3305 // D3D-87, B8G8R8X8: no typed UAV and no typed texture that allows unordered access (the typeless family may),
3306 // as the host runtime answers; render targets as for B8G8R8A8.
3307 {
3308 Ref<ID3D12Device> host;
3309 if (create_host_device(host)) {
3310 const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
3311 for (DXGI_FORMAT f : {DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB,
3312 DXGI_FORMAT_B8G8R8X8_TYPELESS}) {
3313 D3D12_FEATURE_DATA_FORMAT_SUPPORT a{f}, b{f};
3314 EXPECT(SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &a, sizeof(a))));
3315 EXPECT(SUCCEEDED(host->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &b, sizeof(b))));
3316 constexpr UINT typed_uav = D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW;
3317 constexpr UINT typed_uav2 = D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD | D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE;
3318 EXPECT((UINT(a.Support1) & typed_uav) == (UINT(b.Support1) & typed_uav));
3319 EXPECT((UINT(a.Support2) & typed_uav2) == (UINT(b.Support2) & typed_uav2));
3320 for (auto flag : {D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET}) {
3321 const D3D12_RESOURCE_DESC desc = texture_desc(16, 16, f, flag, 1);
3322 Ref<ID3D12Resource> ours_resource, host_resource;
3323 const HRESULT ours_hr = device->CreateCommittedResource(
3324 &default_heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
3325 IID_PPV_ARGS(&ours_resource.p));
3326 const HRESULT host_hr = host->CreateCommittedResource(
3327 &default_heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
3328 IID_PPV_ARGS(&host_resource.p));
3329 if (SUCCEEDED(ours_hr) != SUCCEEDED(host_hr))
3330 std::fprintf(stderr, "B8G8R8X8 format %d flags %d: ours %08lx, host %08lx\n", int(f),
3331 int(flag), static_cast<unsigned long>(ours_hr),
3332 static_cast<unsigned long>(host_hr));
3333 EXPECT(SUCCEEDED(ours_hr) == SUCCEEDED(host_hr));
3334 }
3335 }
3336 std::printf("B8G8R8X8: typed UAV support and UAV/RTV resource creation match the host runtime\n");
3337 } else {
3338 std::printf("B8G8R8X8: no host D3D12 device to compare with, skipped\n");
3339 }
3340 }
3157 3341
3158 const int options_mismatches = compare_feature_options(device.p, info); 3342 const int options_mismatches = compare_feature_options(device.p, info);
3159 EXPECT(options_mismatches == 0); 3343 EXPECT(options_mismatches == 0);
@@ -4578,16 +4762,16 @@ int main() {
4578 EXPECT(placed_va && placed_va % D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT == 0); 4762 EXPECT(placed_va && placed_va % D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT == 0);
4579 EXPECT(placed_b->GetGPUVirtualAddress() == placed_va + 65536); 4763 EXPECT(placed_b->GetGPUVirtualAddress() == placed_va + 65536);
4580 EXPECT(placed_image->GetGPUVirtualAddress() == 0); // only buffers are addressable, as in D3D12 4764 EXPECT(placed_image->GetGPUVirtualAddress() == 0); // only buffers are addressable, as in D3D12
4581 // Off the 64 KiB grid, past the heap end, and tiled: refused, not placed somewhere wrong. 4765 // Off the 64 KiB grid, past the heap end, and non-ROW_MAJOR buffers: E_INVALIDARG, not placed somewhere wrong.
4582 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 512, &placed_buffer, D3D12_RESOURCE_STATE_COMMON, 4766 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 512, &placed_buffer, D3D12_RESOURCE_STATE_COMMON,
4583 nullptr, IID_PPV_ARGS(&refused.p)) == E_INVALIDARG); 4767 nullptr, IID_PPV_ARGS(&refused.p)) == E_INVALIDARG);
4584 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 256 * 1024, &placed_buffer, 4768 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 256 * 1024, &placed_buffer,
4585 D3D12_RESOURCE_STATE_COMMON, nullptr, 4769 D3D12_RESOURCE_STATE_COMMON, nullptr,
4586 IID_PPV_ARGS(&refused.p)) == E_INVALIDARG); 4770 IID_PPV_ARGS(&refused.p)) == E_INVALIDARG);
4587 D3D12_RESOURCE_DESC tiled = buffer_desc(4096); 4771 D3D12_RESOURCE_DESC tiled_buf = buffer_desc(4096);
4588 tiled.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; 4772 tiled_buf.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
4589 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 0, &tiled, D3D12_RESOURCE_STATE_COMMON, nullptr, 4773 EXPECT(standalone->CreatePlacedResource(placed_heap.p, 0, &tiled_buf, D3D12_RESOURCE_STATE_COMMON, nullptr,
4590 IID_PPV_ARGS(&refused.p)) == E_NOTIMPL); 4774 IID_PPV_ARGS(&refused.p)) == E_INVALIDARG);
4591 EXPECT(!refused.p); 4775 EXPECT(!refused.p);
4592 // A placed buffer reads as zeroed through the copy path, at its console VA. 4776 // A placed buffer reads as zeroed through the copy path, at its console VA.
4593 D3D12_HEAP_PROPERTIES readback_props{}; 4777 D3D12_HEAP_PROPERTIES readback_props{};
@@ -4613,6 +4797,44 @@ int main() {
4613 EXPECT(SUCCEEDED(zeroes->Map(0, nullptr, &zero_bytes))); 4797 EXPECT(SUCCEEDED(zeroes->Map(0, nullptr, &zero_bytes)));
4614 report("placed buffer", 0, static_cast<std::uint8_t*>(zero_bytes), std::array<std::uint8_t, 64>{}.data(), 64); 4798 report("placed buffer", 0, static_cast<std::uint8_t*>(zero_bytes), std::array<std::uint8_t, 64>{}.data(), 64);
4615 zeroes->Unmap(0, nullptr); 4799 zeroes->Unmap(0, nullptr);
4800
4801 // Placed buffers carry their console VA in VulkanContext (so VA-resolved commands like WriteBufferImmediate
4802 // find them) and placed readback buffers mark host_readable (so the submission flushes GPU writes to host).
4803 {
4804 D3D12_HEAP_DESC rb_heap_desc{};
4805 rb_heap_desc.Properties.Type = D3D12_HEAP_TYPE_READBACK;
4806 rb_heap_desc.SizeInBytes = 65536;
4807 rb_heap_desc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
4808 Ref<ID3D12Heap> rb_heap;
4809 Ref<ID3D12Resource> placed_rb;
4810 EXPECT(SUCCEEDED(standalone->CreateHeap(&rb_heap_desc, IID_PPV_ARGS(&rb_heap.p))));
4811 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(rb_heap.p, 0, &placed_buffer,
4812 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
4813 IID_PPV_ARGS(&placed_rb.p))));
4814 Ref<ID3D12GraphicsCommandList2> placed_list2;
4815 EXPECT(SUCCEEDED(placed_list->QueryInterface(IID_PPV_ARGS(&placed_list2.p))));
4816 EXPECT(SUCCEEDED(placed_allocator->Reset()) && SUCCEEDED(placed_list->Reset(placed_allocator.p, nullptr)));
4817 const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER wp{placed_va + 16, 0xCAFEBABEu};
4818 const D3D12_WRITEBUFFERIMMEDIATE_MODE wm = D3D12_WRITEBUFFERIMMEDIATE_MODE_DEFAULT;
4819 placed_list2->WriteBufferImmediate(1, &wp, &wm);
4820 D3D12_RESOURCE_BARRIER b{};
4821 b.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
4822 b.Transition = {placed_a.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
4823 D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE};
4824 placed_list->ResourceBarrier(1, &b);
4825 placed_list->CopyBufferRegion(placed_rb.p, 0, placed_a.p, 0, 64);
4826 EXPECT(SUCCEEDED(placed_list->Close()));
4827 queue->ExecuteCommandLists(1, placed_lists);
4828 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
4829 EXPECT(SUCCEEDED(queue->Signal(fence.p, 7)) && SUCCEEDED(fence->SetEventOnCompletion(7, nullptr)));
4830 void* rb_bytes = nullptr;
4831 EXPECT(SUCCEEDED(placed_rb->Map(0, nullptr, &rb_bytes)));
4832 std::uint32_t word = 0;
4833 std::memcpy(&word, static_cast<const std::uint8_t*>(rb_bytes) + 16, sizeof(word));
4834 EXPECT(word == 0xCAFEBABEu);
4835 placed_rb->Unmap(0, nullptr);
4836 }
4837
4616 // The heap owns the range: releasing it puts the next heap of that size back at the same place. 4838 // The heap owns the range: releasing it puts the next heap of that size back at the same place.
4617 placed_image.reset(); 4839 placed_image.reset();
4618 placed_b.reset(); 4840 placed_b.reset();
@@ -4622,6 +4844,437 @@ int main() {
4622 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(again.p, 0, &placed_buffer, D3D12_RESOURCE_STATE_GENERIC_READ, 4844 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(again.p, 0, &placed_buffer, D3D12_RESOURCE_STATE_GENERIC_READ,
4623 nullptr, IID_PPV_ARGS(&placed_a.p)))); 4845 nullptr, IID_PPV_ARGS(&placed_a.p))));
4624 EXPECT(placed_a->GetGPUVirtualAddress() == placed_va); 4846 EXPECT(placed_a->GetGPUVirtualAddress() == placed_va);
4847
4848 // D3D-191: tiled placed resources (D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE and Xbox 0x101).
4849 D3D12_HEAP_DESC tiled_heap_desc{};
4850 tiled_heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT;
4851 tiled_heap_desc.SizeInBytes = 2 * 1024 * 1024;
4852 tiled_heap_desc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
4853 Ref<ID3D12Heap> tiled_heap, upload_placed_heap;
4854 EXPECT(SUCCEEDED(standalone->CreateHeap(&tiled_heap_desc, IID_PPV_ARGS(&tiled_heap.p))));
4855 D3D12_HEAP_DESC upload_heap_desc = tiled_heap_desc;
4856 upload_heap_desc.Properties.Type = D3D12_HEAP_TYPE_UPLOAD;
4857 EXPECT(SUCCEEDED(standalone->CreateHeap(&upload_heap_desc, IID_PPV_ARGS(&upload_placed_heap.p))));
4858
4859 auto tiled_2d = [&](UINT w, UINT h, DXGI_FORMAT fmt, UINT16 mips, D3D12_RESOURCE_FLAGS flags,
4860 UINT64 align = 0) {
4861 D3D12_RESOURCE_DESC d = texture_desc(w, h, fmt, flags, mips);
4862 d.Alignment = align;
4863 d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
4864 return d;
4865 };
4866 const D3D12_RESOURCE_DESC tiled_rt_desc =
4867 tiled_2d(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
4868 const D3D12_RESOURCE_DESC tiled_bc_desc =
4869 tiled_2d(256, 256, DXGI_FORMAT_BC1_UNORM, 0, D3D12_RESOURCE_FLAG_NONE);
4870 const D3D12_RESOURCE_DESC tiled_ds_desc =
4871 tiled_2d(256, 256, DXGI_FORMAT_D32_FLOAT, 1, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
4872 D3D12_RESOURCE_DESC tiled_3d_desc =
4873 tiled_2d(64, 64, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_RESOURCE_FLAG_NONE);
4874 tiled_3d_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
4875 tiled_3d_desc.DepthOrArraySize = 32;
4876 D3D12_RESOURCE_DESC xbox_tiled_desc =
4877 tiled_2d(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D12_RESOURCE_FLAG_NONE);
4878 xbox_tiled_desc.Layout = static_cast<D3D12_TEXTURE_LAYOUT>(0x101);
4879
4880 Ref<ID3D12Resource> tiled_rt, tiled_bc, tiled_ds, tiled_3d, xbox_tiled;
4881 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 0, &tiled_rt_desc, D3D12_RESOURCE_STATE_COMMON,
4882 nullptr, IID_PPV_ARGS(&tiled_rt.p))));
4883 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 512 * 1024, &tiled_bc_desc,
4884 D3D12_RESOURCE_STATE_COMMON, nullptr,
4885 IID_PPV_ARGS(&tiled_bc.p))));
4886 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 640 * 1024, &tiled_ds_desc,
4887 D3D12_RESOURCE_STATE_COMMON, nullptr,
4888 IID_PPV_ARGS(&tiled_ds.p))));
4889 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 1024 * 1024, &tiled_3d_desc,
4890 D3D12_RESOURCE_STATE_COMMON, nullptr,
4891 IID_PPV_ARGS(&tiled_3d.p))));
4892 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 0, &xbox_tiled_desc, D3D12_RESOURCE_STATE_COMMON,
4893 nullptr, IID_PPV_ARGS(&xbox_tiled.p))));
4894
4895 for (ID3D12Resource* r : {tiled_rt.p, tiled_bc.p, tiled_ds.p, tiled_3d.p}) {
4896 const D3D12_RESOURCE_DESC got = r->GetDesc();
4897 EXPECT(r->GetGPUVirtualAddress() == 0);
4898 EXPECT(got.Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE);
4899 EXPECT(got.Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
4900 EXPECT(got.MipLevels > 0);
4901 D3D12_HEAP_PROPERTIES got_hp{};
4902 D3D12_HEAP_FLAGS got_hf = D3D12_HEAP_FLAG_NONE;
4903 EXPECT(SUCCEEDED(r->GetHeapProperties(&got_hp, &got_hf)));
4904 EXPECT(got_hp.Type == D3D12_HEAP_TYPE_DEFAULT);
4905 const D3D12_RESOURCE_ALLOCATION_INFO ai = standalone->GetResourceAllocationInfo(0, 1, &got);
4906 UINT tiles = 0;
4907 D3D12_TILE_SHAPE shape{};
4908 standalone->GetResourceTiling(r, &tiles, nullptr, &shape, nullptr, 0, nullptr);
4909 EXPECT(tiles > 0 && shape.WidthInTexels > 0 && ai.Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
4910 EXPECT(ai.SizeInBytes == UINT64(tiles) * D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES);
4911 }
4912 EXPECT(static_cast<UINT>(xbox_tiled->GetDesc().Layout) == 0x101);
4913 UINT xbox_tiles = 0;
4914 standalone->GetResourceTiling(xbox_tiled.p, &xbox_tiles, nullptr, nullptr, nullptr, 0, nullptr);
4915 EXPECT(xbox_tiles == 4);
4916
4917 // Refusals matching host D3D12: 1D, 4 KiB alignment, 96-bit, two-plane DS, invalid MSAA, upload heap, past-end.
4918 D3D12_RESOURCE_DESC bad_1d = line_desc(256, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM);
4919 bad_1d.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
4920 auto tiled_2d_msaa = [&](UINT samples, D3D12_RESOURCE_FLAGS flags, UINT64 align = 0) {
4921 D3D12_RESOURCE_DESC d = tiled_2d(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, 1, flags, align);
4922 d.SampleDesc.Count = samples;
4923 return d;
4924 };
4925 const D3D12_RESOURCE_DESC bad_cases[] = {
4926 bad_1d,
4927 tiled_2d(16, 16, DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D12_RESOURCE_FLAG_NONE,
4928 D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT),
4929 tiled_2d(64, 64, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D12_RESOURCE_FLAG_NONE),
4930 tiled_2d(64, 64, DXGI_FORMAT_D24_UNORM_S8_UINT, 1, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL),
4931 tiled_2d(64, 64, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, 1, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL),
4932 tiled_2d_msaa(2, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET),
4933 tiled_2d_msaa(4, D3D12_RESOURCE_FLAG_NONE),
4934 tiled_2d_msaa(4, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT),
4935 };
4936 for (const D3D12_RESOURCE_DESC& bad : bad_cases) {
4937 Ref<ID3D12Resource> fail;
4938 EXPECT(standalone->CreatePlacedResource(tiled_heap.p, 0, &bad, D3D12_RESOURCE_STATE_COMMON, nullptr,
4939 IID_PPV_ARGS(&fail.p)) == E_INVALIDARG);
4940 EXPECT(!fail.p);
4941 }
4942 {
4943 Ref<ID3D12Resource> fail;
4944 EXPECT(standalone->CreatePlacedResource(upload_placed_heap.p, 0, &tiled_rt_desc,
4945 D3D12_RESOURCE_STATE_COMMON, nullptr,
4946 IID_PPV_ARGS(&fail.p)) == E_INVALIDARG);
4947 const D3D12_RESOURCE_ALLOCATION_INFO rt_alloc = standalone->GetResourceAllocationInfo(0, 1, &tiled_rt_desc);
4948 EXPECT(standalone->CreatePlacedResource(tiled_heap.p,
4949 tiled_heap_desc.SizeInBytes - rt_alloc.SizeInBytes + 65536,
4950 &tiled_rt_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
4951 IID_PPV_ARGS(&fail.p)) == E_INVALIDARG);
4952 EXPECT(!fail.p);
4953 }
4954
4955 // Clear and read back a placed tiled RTV to verify GPU execution.
4956 D3D12_DESCRIPTOR_HEAP_DESC tiled_rtv_desc{};
4957 tiled_rtv_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
4958 tiled_rtv_desc.NumDescriptors = 1;
4959 Ref<ID3D12DescriptorHeap> tiled_rtv_heap;
4960 EXPECT(SUCCEEDED(standalone->CreateDescriptorHeap(&tiled_rtv_desc, IID_PPV_ARGS(&tiled_rtv_heap.p))));
4961 standalone->CreateRenderTargetView(tiled_rt.p, nullptr, tiled_rtv_heap->GetCPUDescriptorHandleForHeapStart());
4962 D3D12_HEAP_PROPERTIES rb_props{D3D12_HEAP_TYPE_READBACK};
4963 const D3D12_RESOURCE_DESC rb_desc = buffer_desc(256);
4964 Ref<ID3D12Resource> tiled_rb;
4965 EXPECT(SUCCEEDED(standalone->CreateCommittedResource(&rb_props, D3D12_HEAP_FLAG_NONE, &rb_desc,
4966 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
4967 IID_PPV_ARGS(&tiled_rb.p))));
4968 Ref<ID3D12CommandAllocator> tiled_alloc;
4969 Ref<ID3D12GraphicsCommandList> tiled_list;
4970 EXPECT(SUCCEEDED(standalone->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
4971 IID_PPV_ARGS(&tiled_alloc.p))));
4972 EXPECT(SUCCEEDED(standalone->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, tiled_alloc.p, nullptr,
4973 IID_PPV_ARGS(&tiled_list.p))));
4974 const FLOAT tiled_color[4] = {64.0f / 255.0f, 128.0f / 255.0f, 191.0f / 255.0f, 1.0f};
4975 D3D12_RESOURCE_BARRIER b = transition(tiled_rt.p, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_RENDER_TARGET);
4976 tiled_list->ResourceBarrier(1, &b);
4977 tiled_list->ClearRenderTargetView(tiled_rtv_heap->GetCPUDescriptorHandleForHeapStart(), tiled_color, 0, nullptr);
4978 b = transition(tiled_rt.p, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
4979 tiled_list->ResourceBarrier(1, &b);
4980 D3D12_PLACED_SUBRESOURCE_FOOTPRINT fp{};
4981 fp.Footprint = {DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 1, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT};
4982 const D3D12_TEXTURE_COPY_LOCATION copy_dst = footprint(tiled_rb.p, fp);
4983 const D3D12_TEXTURE_COPY_LOCATION copy_src = subresource(tiled_rt.p, 0);
4984 D3D12_BOX box{0, 0, 0, 1, 1, 1};
4985 tiled_list->CopyTextureRegion(&copy_dst, 0, 0, 0, &copy_src, &box);
4986 EXPECT(SUCCEEDED(tiled_list->Close()));
4987 ID3D12CommandList* tiled_lists[] = {tiled_list.p};
4988 queue->ExecuteCommandLists(1, tiled_lists);
4989 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
4990 EXPECT(SUCCEEDED(queue->Signal(fence.p, 8)) && SUCCEEDED(fence->SetEventOnCompletion(8, nullptr)));
4991 void* tiled_bytes = nullptr;
4992 EXPECT(SUCCEEDED(tiled_rb->Map(0, nullptr, &tiled_bytes)));
4993 const std::uint8_t want_rgba[4] = {64, 128, 191, 255};
4994 report("tiled placed RTV", 0, static_cast<std::uint8_t*>(tiled_bytes), want_rgba, 4);
4995 EXPECT(std::memcmp(tiled_bytes, want_rgba, 4) == 0);
4996 tiled_rb->Unmap(0, nullptr);
4997
4998 // Compare placed 64KB_UNDEFINED_SWIZZLE acceptance, layout, alignment, heap props and tile shape with host.
4999 Ref<ID3D12Device> host_dev;
5000 if (create_host_device(host_dev)) {
5001 D3D12_FEATURE_DATA_D3D12_OPTIONS host_opts{};
5002 if (SUCCEEDED(host_dev->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &host_opts, sizeof(host_opts))) &&
5003 host_opts.TiledResourcesTier != D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED) {
5004 Ref<ID3D12Heap> host_heap;
5005 if (SUCCEEDED(host_dev->CreateHeap(&tiled_heap_desc, IID_PPV_ARGS(&host_heap.p)))) {
5006 const D3D12_RESOURCE_DESC host_cases[] = {
5007 tiled_2d(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D12_RESOURCE_FLAG_NONE),
5008 tiled_2d(256, 256, DXGI_FORMAT_D32_FLOAT, 1, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL),
5009 tiled_3d_desc,
5010 };
5011 for (int idx = 0; idx < int(std::size(host_cases)); ++idx) {
5012 const D3D12_RESOURCE_DESC& host_desc = host_cases[idx];
5013 if (host_desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D &&
5014 host_opts.TiledResourcesTier < D3D12_TILED_RESOURCES_TIER_3)
5015 continue;
5016 Ref<ID3D12Resource> our_r, host_r;
5017 const HRESULT our_hr = standalone->CreatePlacedResource(
5018 tiled_heap.p, 0, &host_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&our_r.p));
5019 const HRESULT host_hr = host_dev->CreatePlacedResource(
5020 host_heap.p, 0, &host_desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&host_r.p));
5021 if (FAILED(host_hr)) continue;
5022 EXPECT(SUCCEEDED(our_hr));
5023 EXPECT(our_r->GetDesc().Layout == host_r->GetDesc().Layout);
5024 EXPECT(our_r->GetDesc().Alignment == host_r->GetDesc().Alignment);
5025 D3D12_HEAP_PROPERTIES ohp{}, hhp{};
5026 EXPECT(SUCCEEDED(our_r->GetHeapProperties(&ohp, nullptr)) &&
5027 SUCCEEDED(host_r->GetHeapProperties(&hhp, nullptr)));
5028 EXPECT(ohp.Type == hhp.Type);
5029 D3D12_TILE_SHAPE os{}, hs{};
5030 standalone->GetResourceTiling(our_r.p, nullptr, nullptr, &os, nullptr, 0, nullptr);
5031 host_dev->GetResourceTiling(host_r.p, nullptr, nullptr, &hs, nullptr, 0, nullptr);
5032 EXPECT(os.WidthInTexels == hs.WidthInTexels && os.HeightInTexels == hs.HeightInTexels &&
5033 os.DepthInTexels == hs.DepthInTexels);
5034 }
5035 }
5036 }
5037 }
5038
5039 // D3D-222: multisampled placed textures (UNKNOWN and 4x tiled).
5040 D3D12_HEAP_DESC msaa_heap_desc{};
5041 msaa_heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT;
5042 msaa_heap_desc.SizeInBytes = 16 * 1024 * 1024;
5043 msaa_heap_desc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT;
5044 Ref<ID3D12Heap> msaa_heap;
5045 EXPECT(SUCCEEDED(standalone->CreateHeap(&msaa_heap_desc, IID_PPV_ARGS(&msaa_heap.p))));
5046 D3D12_HEAP_DESC deny_rt_desc = tiled_heap_desc;
5047 deny_rt_desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
5048 Ref<ID3D12Heap> deny_rt_heap;
5049 EXPECT(SUCCEEDED(standalone->CreateHeap(&deny_rt_desc, IID_PPV_ARGS(&deny_rt_heap.p))));
5050
5051 auto msaa_desc = [&](UINT w, UINT h, UINT samples, UINT64 align, D3D12_TEXTURE_LAYOUT layout,
5052 D3D12_RESOURCE_FLAGS flags, DXGI_FORMAT fmt = DXGI_FORMAT_R8G8B8A8_UNORM,
5053 UINT16 mips = 1) {
5054 D3D12_RESOURCE_DESC d = texture_desc(w, h, fmt, flags, mips);
5055 d.Alignment = align;
5056 d.SampleDesc.Count = samples;
5057 d.Layout = layout;
5058 return d;
5059 };
5060 const D3D12_RESOURCE_DESC msaa_unk_rt_desc =
5061 msaa_desc(256, 256, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
5062 const D3D12_RESOURCE_DESC msaa_unk_small_desc = msaa_desc(
5063 256, 256, 4, D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, D3D12_TEXTURE_LAYOUT_UNKNOWN,
5064 D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
5065 const D3D12_RESOURCE_DESC msaa_unk_ds_desc =
5066 msaa_desc(256, 256, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL,
5067 DXGI_FORMAT_D32_FLOAT);
5068 const D3D12_RESOURCE_DESC msaa_tiled_rt_desc = tiled_2d_msaa(4, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
5069 D3D12_RESOURCE_DESC msaa_xbox_rt_desc = msaa_tiled_rt_desc;
5070 msaa_xbox_rt_desc.Layout = static_cast<D3D12_TEXTURE_LAYOUT>(0x101);
5071
5072 Ref<ID3D12Resource> msaa_unk_rt, msaa_unk_small, msaa_unk_ds, msaa_tiled_rt, msaa_xbox_rt, msaa_cast_rt;
5073 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(msaa_heap.p, D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT,
5074 &msaa_unk_rt_desc, D3D12_RESOURCE_STATE_COMMON, nullptr,
5075 IID_PPV_ARGS(&msaa_unk_rt.p))));
5076 EXPECT(msaa_unk_rt->GetGPUVirtualAddress() == 0);
5077 EXPECT(msaa_unk_rt->GetDesc().Alignment == D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT);
5078 EXPECT(msaa_unk_rt->GetDesc().SampleDesc.Count == 4);
5079 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 65536, &msaa_unk_small_desc,
5080 D3D12_RESOURCE_STATE_COMMON, nullptr,
5081 IID_PPV_ARGS(&msaa_unk_small.p))));
5082 EXPECT(msaa_unk_small->GetDesc().Alignment == D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT);
5083 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(msaa_heap.p, 8 * 1024 * 1024, &msaa_unk_ds_desc,
5084 D3D12_RESOURCE_STATE_COMMON, nullptr,
5085 IID_PPV_ARGS(&msaa_unk_ds.p))));
5086 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 65536, &msaa_tiled_rt_desc,
5087 D3D12_RESOURCE_STATE_COMMON, nullptr,
5088 IID_PPV_ARGS(&msaa_tiled_rt.p))));
5089 EXPECT(msaa_tiled_rt->GetDesc().Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
5090 UINT msaa_tiles = 0;
5091 D3D12_TILE_SHAPE msaa_shape{};
5092 standalone->GetResourceTiling(msaa_tiled_rt.p, &msaa_tiles, nullptr, &msaa_shape, nullptr, 0, nullptr);
5093 EXPECT(msaa_tiles == 16 && msaa_shape.WidthInTexels == 64 && msaa_shape.HeightInTexels == 64);
5094 EXPECT(SUCCEEDED(standalone->CreatePlacedResource(tiled_heap.p, 65536, &msaa_xbox_rt_desc,
5095 D3D12_RESOURCE_STATE_COMMON, nullptr,
5096 IID_PPV_ARGS(&msaa_xbox_rt.p))));
5097 EXPECT(msaa_xbox_rt->GetDesc().Alignment == D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
5098 EXPECT(static_cast<UINT>(msaa_xbox_rt->GetDesc().Layout) == 0x101);
5099
5100 {
5101 Ref<ID3D12Device10> standalone10;
5102 EXPECT(SUCCEEDED(standalone->QueryInterface(IID_PPV_ARGS(&standalone10.p))));
5103 D3D12_RESOURCE_DESC1 cast_msaa{};
5104 cast_msaa.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
5105 cast_msaa.Width = 64;
5106 cast_msaa.Height = 64;
5107 cast_msaa.DepthOrArraySize = 1;
5108 cast_msaa.MipLevels = 1;
5109 cast_msaa.Format = DXGI_FORMAT_R8G8B8A8_TYPELESS;
5110 cast_msaa.SampleDesc.Count = 4;
5111 cast_msaa.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
5112 const DXGI_FORMAT cast_list[] = {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB};
5113 EXPECT(SUCCEEDED(standalone10->CreatePlacedResource2(
5114 msaa_heap.p, 0, &cast_msaa, D3D12_BARRIER_LAYOUT_COMMON, nullptr, 2, cast_list,
5115 IID_PPV_ARGS(&msaa_cast_rt.p))));
5116 }
5117
5118 // Refusals matching host D3D12 for MSAA placed resources.
5119 {
5120 struct BadMsaaCase {
5121 ID3D12Heap* heap;
5122 UINT64 offset;
5123 D3D12_RESOURCE_DESC desc;
5124 };
5125 D3D12_RESOURCE_DESC msaa_3d =
5126 msaa_desc(16, 16, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
5127 msaa_3d.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
5128 msaa_3d.DepthOrArraySize = 8;
5129 const BadMsaaCase bad_msaa[] = {
5130 // 4 MiB-aligned UNKNOWN MSAA fails on a 64 KiB heap (even at offset 0) and at misaligned offsets.
5131 {tiled_heap.p, 0, msaa_unk_rt_desc},
5132 {msaa_heap.p, 65536, msaa_unk_rt_desc},
5133 {msaa_heap.p, msaa_heap_desc.SizeInBytes - 65536, msaa_unk_small_desc},
5134 {upload_placed_heap.p, 0, msaa_unk_small_desc},
5135 {deny_rt_heap.p, 0, msaa_unk_small_desc},
5136 {msaa_heap.p, 0,
5137 msaa_desc(256, 256, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_NONE)},
5138 {msaa_heap.p, 0,
5139 msaa_desc(256, 256, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN,
5140 D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)},
5141 {msaa_heap.p, 0,
5142 msaa_desc(64, 64, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
5143 DXGI_FORMAT_R8G8B8A8_UNORM, 0)},
5144 {msaa_heap.p, 0, msaa_3d},
5145 };
5146 for (const BadMsaaCase& bad : bad_msaa) {
5147 Ref<ID3D12Resource> fail;
5148 EXPECT(standalone->CreatePlacedResource(bad.heap, bad.offset, &bad.desc, D3D12_RESOURCE_STATE_COMMON,
5149 nullptr, IID_PPV_ARGS(&fail.p)) == E_INVALIDARG);
5150 EXPECT(!fail.p);
5151 }
5152 }
5153
5154 // Clear placed 4x MSAA RTVs (UNKNOWN + tiled) and DSV, resolve, and read back to verify GPU execution.
5155 {
5156 const D3D12_RESOURCE_DESC resolved_desc =
5157 texture_desc(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_NONE, 1);
5158 Ref<ID3D12Resource> msaa_resolved_unk, msaa_resolved_tiled;
5159 D3D12_HEAP_PROPERTIES def_hp{D3D12_HEAP_TYPE_DEFAULT};
5160 EXPECT(SUCCEEDED(standalone->CreateCommittedResource(&def_hp, D3D12_HEAP_FLAG_NONE, &resolved_desc,
5161 D3D12_RESOURCE_STATE_RESOLVE_DEST, nullptr,
5162 IID_PPV_ARGS(&msaa_resolved_unk.p))));
5163 EXPECT(SUCCEEDED(standalone->CreateCommittedResource(&def_hp, D3D12_HEAP_FLAG_NONE, &resolved_desc,
5164 D3D12_RESOURCE_STATE_RESOLVE_DEST, nullptr,
5165 IID_PPV_ARGS(&msaa_resolved_tiled.p))));
5166
5167 D3D12_DESCRIPTOR_HEAP_DESC msaa_rtv_hd{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 2, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
5168 D3D12_DESCRIPTOR_HEAP_DESC msaa_dsv_hd{D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
5169 Ref<ID3D12DescriptorHeap> msaa_rtv_heap, msaa_dsv_heap;
5170 EXPECT(SUCCEEDED(standalone->CreateDescriptorHeap(&msaa_rtv_hd, IID_PPV_ARGS(&msaa_rtv_heap.p))));
5171 EXPECT(SUCCEEDED(standalone->CreateDescriptorHeap(&msaa_dsv_hd, IID_PPV_ARGS(&msaa_dsv_heap.p))));
5172 const UINT rtv_step = standalone->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
5173 const D3D12_CPU_DESCRIPTOR_HANDLE rtv0 = msaa_rtv_heap->GetCPUDescriptorHandleForHeapStart();
5174 const D3D12_CPU_DESCRIPTOR_HANDLE rtv1{rtv0.ptr + rtv_step};
5175 standalone->CreateRenderTargetView(msaa_unk_rt.p, nullptr, rtv0);
5176 standalone->CreateRenderTargetView(msaa_tiled_rt.p, nullptr, rtv1);
5177 standalone->CreateDepthStencilView(msaa_unk_ds.p, nullptr, msaa_dsv_heap->GetCPUDescriptorHandleForHeapStart());
5178
5179 EXPECT(SUCCEEDED(tiled_alloc->Reset()) && SUCCEEDED(tiled_list->Reset(tiled_alloc.p, nullptr)));
5180 D3D12_RESOURCE_BARRIER barriers[] = {
5181 transition(msaa_unk_rt.p, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_RENDER_TARGET),
5182 transition(msaa_tiled_rt.p, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_RENDER_TARGET),
5183 transition(msaa_unk_ds.p, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_DEPTH_WRITE),
5184 };
5185 tiled_list->ResourceBarrier(3, barriers);
5186 tiled_list->ClearRenderTargetView(rtv0, tiled_color, 0, nullptr);
5187 tiled_list->ClearRenderTargetView(rtv1, tiled_color, 0, nullptr);
5188 tiled_list->ClearDepthStencilView(msaa_dsv_heap->GetCPUDescriptorHandleForHeapStart(),
5189 D3D12_CLEAR_FLAG_DEPTH, 0.5f, 0, 0, nullptr);
5190 D3D12_RESOURCE_BARRIER to_resolve[] = {
5191 transition(msaa_unk_rt.p, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_RESOLVE_SOURCE),
5192 transition(msaa_tiled_rt.p, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_RESOLVE_SOURCE),
5193 };
5194 tiled_list->ResourceBarrier(2, to_resolve);
5195 tiled_list->ResolveSubresource(msaa_resolved_unk.p, 0, msaa_unk_rt.p, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
5196 tiled_list->ResolveSubresource(msaa_resolved_tiled.p, 0, msaa_tiled_rt.p, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
5197 D3D12_RESOURCE_BARRIER to_copy[] = {
5198 transition(msaa_resolved_unk.p, D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE),
5199 transition(msaa_resolved_tiled.p, D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE),
5200 };
5201 tiled_list->ResourceBarrier(2, to_copy);
5202 Ref<ID3D12Resource> msaa_rb;
5203 const D3D12_RESOURCE_DESC msaa_rb_desc = buffer_desc(1024);
5204 EXPECT(SUCCEEDED(standalone->CreateCommittedResource(&rb_props, D3D12_HEAP_FLAG_NONE, &msaa_rb_desc,
5205 D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
5206 IID_PPV_ARGS(&msaa_rb.p))));
5207 D3D12_PLACED_SUBRESOURCE_FOOTPRINT fp_unk{}, fp_tiled{};
5208 fp_unk.Offset = 0;
5209 fp_unk.Footprint = {DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 1, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT};
5210 fp_tiled = fp_unk;
5211 fp_tiled.Offset = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT;
5212 const D3D12_TEXTURE_COPY_LOCATION dst_unk = footprint(msaa_rb.p, fp_unk);
5213 const D3D12_TEXTURE_COPY_LOCATION src_unk = subresource(msaa_resolved_unk.p, 0);
5214 const D3D12_TEXTURE_COPY_LOCATION dst_tiled = footprint(msaa_rb.p, fp_tiled);
5215 const D3D12_TEXTURE_COPY_LOCATION src_tiled = subresource(msaa_resolved_tiled.p, 0);
5216 tiled_list->CopyTextureRegion(&dst_unk, 0, 0, 0, &src_unk, &box);
5217 tiled_list->CopyTextureRegion(&dst_tiled, 0, 0, 0, &src_tiled, &box);
5218 EXPECT(SUCCEEDED(tiled_list->Close()));
5219 queue->ExecuteCommandLists(1, tiled_lists);
5220 EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success);
5221 EXPECT(SUCCEEDED(queue->Signal(fence.p, 9)) && SUCCEEDED(fence->SetEventOnCompletion(9, nullptr)));
5222 void* msaa_bytes = nullptr;
5223 EXPECT(SUCCEEDED(msaa_rb->Map(0, nullptr, &msaa_bytes)));
5224 const auto* out_bytes = static_cast<const std::uint8_t*>(msaa_bytes);
5225 report("placed MSAA UNKNOWN RTV resolve", 0, out_bytes, want_rgba, 4);
5226 report("placed MSAA tiled RTV resolve", 0, out_bytes + D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT, want_rgba, 4);
5227 EXPECT(std::memcmp(out_bytes, want_rgba, 4) == 0);
5228 EXPECT(std::memcmp(out_bytes + D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT, want_rgba, 4) == 0);
5229 msaa_rb->Unmap(0, nullptr);
5230 }
5231
5232 // Host parity for MSAA placed acceptance/refusals, layout, alignment, heap flags and tiled 4x shape.
5233 if (host_dev.p) {
5234 Ref<ID3D12Heap> host_heap64, host_heap4m;
5235 if (SUCCEEDED(host_dev->CreateHeap(&tiled_heap_desc, IID_PPV_ARGS(&host_heap64.p))) &&
5236 SUCCEEDED(host_dev->CreateHeap(&msaa_heap_desc, IID_PPV_ARGS(&host_heap4m.p)))) {
5237 struct MsaaParityCase {
5238 ID3D12Heap* our_heap;
5239 ID3D12Heap* host_heap;
5240 UINT64 offset;
5241 D3D12_RESOURCE_DESC desc;
5242 };
5243 const MsaaParityCase parity[] = {
5244 {tiled_heap.p, host_heap64.p, 0, msaa_unk_rt_desc},
5245 {msaa_heap.p, host_heap4m.p, 65536, msaa_unk_rt_desc},
5246 {msaa_heap.p, host_heap4m.p, 0, msaa_unk_rt_desc},
5247 {tiled_heap.p, host_heap64.p, 65536, msaa_unk_small_desc},
5248 {tiled_heap.p, host_heap64.p, 65536, msaa_tiled_rt_desc},
5249 };
5250 for (const MsaaParityCase& mc : parity) {
5251 Ref<ID3D12Resource> our_r, host_r;
5252 const HRESULT our_hr = standalone->CreatePlacedResource(
5253 mc.our_heap, mc.offset, &mc.desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&our_r.p));
5254 const HRESULT host_hr = host_dev->CreatePlacedResource(
5255 mc.host_heap, mc.offset, &mc.desc, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&host_r.p));
5256 EXPECT(SUCCEEDED(our_hr) == SUCCEEDED(host_hr));
5257 if (FAILED(host_hr)) {
5258 EXPECT(our_hr == host_hr);
5259 continue;
5260 }
5261 EXPECT(our_r->GetDesc().Layout == host_r->GetDesc().Layout);
5262 EXPECT(our_r->GetDesc().Alignment == host_r->GetDesc().Alignment);
5263 EXPECT(our_r->GetDesc().SampleDesc.Count == host_r->GetDesc().SampleDesc.Count);
5264 D3D12_HEAP_PROPERTIES ohp{}, hhp{};
5265 EXPECT(SUCCEEDED(our_r->GetHeapProperties(&ohp, nullptr)) &&
5266 SUCCEEDED(host_r->GetHeapProperties(&hhp, nullptr)));
5267 EXPECT(ohp.Type == hhp.Type);
5268 if (mc.desc.Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE) {
5269 D3D12_TILE_SHAPE os{}, hs{};
5270 standalone->GetResourceTiling(our_r.p, nullptr, nullptr, &os, nullptr, 0, nullptr);
5271 host_dev->GetResourceTiling(host_r.p, nullptr, nullptr, &hs, nullptr, 0, nullptr);
5272 EXPECT(os.WidthInTexels == hs.WidthInTexels && os.HeightInTexels == hs.HeightInTexels &&
5273 os.DepthInTexels == hs.DepthInTexels);
5274 }
5275 }
5276 }
5277 }
4625 } 5278 }
4626 5279
4627 // D3D-90, the placed half of castable formats: CreatePlacedResource2 takes NumCastableFormats exactly as 5280 // D3D-90, the placed half of castable formats: CreatePlacedResource2 takes NumCastableFormats exactly as
@@ -4853,6 +5506,15 @@ int main() {
4853 EXPECT(words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0); 5506 EXPECT(words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0);
4854 } 5507 }
4855 5508
5509 // The tolerance host_side applies, pinned here so every GPU checks it: its accept side only runs where the
5510 // host rounds differently (Intel's SRGB clear), so a change to it would otherwise stay green elsewhere.
5511 // One code either side of a near-tie is accepted; two codes, or a code past 0.6 ULP, are not.
5512 EXPECT(within_06_ulp(187, 188, ideal_srgb(0.5) * 255.0) && within_06_ulp(127, 128, 127.5));
5513 EXPECT(!within_06_ulp(186, 188, ideal_srgb(0.5) * 255.0) && !within_06_ulp(126, 128, 127.5));
5514 EXPECT(!within_06_ulp(224, 225, ideal_srgb(0.75) * 255.0) &&
5515 !within_06_ulp(136, 137, ideal_srgb(0.25) * 255.0));
5516 EXPECT(!within_06_ulp(254, 255, 255.0));
5517
4856 // The host PC runtime's bytes and refusals: the default adapter when it can cast, WARP otherwise. 5518 // The host PC runtime's bytes and refusals: the default adapter when it can cast, WARP otherwise.
4857 bool compared = false; 5519 bool compared = false;
4858 const char* source = "no host"; 5520 const char* source = "no host";
@@ -4862,33 +5524,44 @@ int main() {
4862 if (!placed_cast_scenario(device10, false, host.data())) return false; 5524 if (!placed_cast_scenario(device10, false, host.data())) return false;
4863 if (!placed_cast_refusals(device10, host_refusals)) return false; 5525 if (!placed_cast_refusals(device10, host_refusals)) return false;
4864 unsigned differences = 0; 5526 unsigned differences = 0;
4865 // D3D12 does not pin float -> UNORM at a tie: the D3D11.3 functional spec (3.2.3.6 FLOAT -> UNORM) 5527 // D3D12 does not pin float -> UNORM or float -> SRGB to one code: the D3D11.3 functional spec
4866 // computes c * (2^n - 1) + 0.5 and drops the fraction, but permits a tolerance of 0.6 ULP on the integer 5528 // (3.2.3.6 FLOAT -> UNORM, 3.2.3.8 FLOAT -> SRGB) permits a tolerance of 0.6 ULP on the integer side, so
4867 // side, so a value exactly halfway between two codes (0.5 * 255 = 127.5) may map to either. WARP and AMD 5529 // a value near halfway between two codes may map to either. The plain clear's 0.5 * 255 = 127.5 is a
4868 // give the upper code; NVIDIA's D3D12 driver and its Vulkan driver the lower (RTX 3080 616.64, RTX 3090 5530 // tie: WARP and AMD give the upper code, NVIDIA's D3D12 driver and its Vulkan driver the lower (RTX 3080
4869 // 610.88 and RTX 5070 Laptop 617.42). On the layer's own adapter (same LUID) the comparison stays exact; 5531 // 616.64, RTX 3090 610.88 and RTX 5070 Laptop 617.42). The SRGB-cast clear's 0.5 encodes to 187.516:
4870 // against another adapter or WARP the plain clear accepts either code on a tie channel. 5532 // WARP and NVIDIA's Vulkan driver give 188, Intel's Vulkan driver 187 (UHD 770 101.7092), both within
5533 // 0.6 ULP. On the layer's own adapter (same LUID) the comparison stays exact; against another adapter
5534 // or WARP a byte may differ when both sides are within 0.6 ULP of the ideal value.
4871 const FLOAT clear_value[4] = {0.25f, 0.5f, 0.75f, 1.0f}; // placed_cast_scenario's clear colour 5535 const FLOAT clear_value[4] = {0.25f, 0.5f, 0.75f, 1.0f}; // placed_cast_scenario's clear colour
4872 unsigned tie_bytes_other_way = 0; 5536 const auto within_tolerance = [&](std::uint8_t ours_byte, std::uint8_t host_byte, double ideal) {
5537 return !same_adapter && within_06_ulp(ours_byte, host_byte, ideal);
5538 };
5539 unsigned plain_within = 0, srgb_within = 0;
4873 for (UINT row = 0; row < 4; ++row) 5540 for (UINT row = 0; row < 4; ++row)
4874 for (UINT i = 0; i < 16; ++i) { 5541 for (UINT i = 0; i < 16; ++i) {
4875 const UINT a = row * 256 + i, b = 1024 + row * 256 + i; 5542 const UINT a = row * 256 + i, b = 1024 + row * 256 + i;
4876 const double scaled = double(clear_value[i % 4]) * 255.0; 5543 const double c = clear_value[i % 4];
4877 const bool tie = !same_adapter && scaled - std::floor(scaled) == 0.5; 5544 const double plain_ideal = c * 255.0;
4878 if (tie && std::abs(int(ours[b]) - int(host[b])) == 1) { 5545 const double srgb_ideal = (i % 4 == 3 ? c : ideal_srgb(c)) * 255.0; // alpha stays linear
4879 ++tie_bytes_other_way; 5546 if (ours[b] != host[b]) {
4880 } else if (ours[b] != host[b] && differences++ < 8) { 5547 if (within_tolerance(ours[b], host[b], plain_ideal))
4881 std::fprintf(stderr, "placed plain clear row %u byte %u: ours %02x, host %02x\n", row, i, 5548 ++plain_within;
4882 ours[b], host[b]); 5549 else if (differences++ < 8)
5550 std::fprintf(stderr, "placed plain clear row %u byte %u: ours %02x, host %02x\n", row, i,
5551 ours[b], host[b]);
5552 }
5553 if (ours[a] != host[a]) {
5554 if (within_tolerance(ours[a], host[a], srgb_ideal))
5555 ++srgb_within;
5556 else if (differences++ < 8)
5557 std::fprintf(stderr, "placed SRGB-cast clear row %u byte %u: ours %02x, host %02x\n",
5558 row, i, ours[a], host[a]);
4883 } 5559 }
4884 if (ours[a] != host[a] && differences++ < 8)
4885 std::fprintf(stderr, "placed SRGB-cast clear row %u byte %u: ours %02x, host %02x\n", row,
4886 i, ours[a], host[a]);
4887 } 5560 }
4888 if (tie_bytes_other_way) 5561 if (plain_within || srgb_within)
4889 std::printf("placed plain clear: the host rounds the exact .5 tie the other way in %u bytes (within " 5562 std::printf("placed clears: %u plain and %u SRGB-cast bytes differ from the host by one code, both "
4890 "the 0.6 ULP tolerance of D3D11.3 spec 3.2.3.6)\n", 5563 "within the 0.6 ULP tolerance of D3D11.3 spec 3.2.3.6 and 3.2.3.8\n",
4891 tie_bytes_other_way); 5564 plain_within, srgb_within);
4892 for (UINT i = 0; i < 3; ++i) 5565 for (UINT i = 0; i < 3; ++i)
4893 if (our_refusals[i] != host_refusals[i]) { 5566 if (our_refusals[i] != host_refusals[i]) {
4894 ++differences; 5567 ++differences;
diff --git a/runtime/test/d3d12_xdxr_rt_test.cpp b/runtime/test/d3d12_xdxr_rt_test.cpp
index 9499dbe0d..0b4d3da52 100644
--- a/runtime/test/d3d12_xdxr_rt_test.cpp
+++ b/runtime/test/d3d12_xdxr_rt_test.cpp
@@ -2,7 +2,8 @@
2// 4.8, src/xdxr_build.h), the layout the game's translated traversal shaders read. A BLAS of two geometries (an 2// 4.8, src/xdxr_build.h), the layout the game's translated traversal shaders read. A BLAS of two geometries (an
3// unindexed triangle soup, and an R16-indexed grid with a 16-byte stride and a 3x4 transform) and a TLAS of three 3// unindexed triangle soup, and an R16-indexed grid with a 16-byte stride and a 3x4 transform) and a TLAS of three
4// instances are built through the D3D12 API, sized by GetRaytracingAccelerationStructurePrebuildInfo, copied to 4// instances are built through the D3D12 API, sized by GetRaytracingAccelerationStructurePrebuildInfo, copied to
5// readback buffers and written to <out dir> as <case>.bin + <case>.json at their console GPU virtual addresses. 5// readback buffers and written to <out dir>; the BLAS is then updated in place (PERFORM_UPDATE) after its soup moves,
6// and written again as d3d12_blas_update as <case>.bin + <case>.json at their console GPU virtual addresses.
6// `python -I tools/xdxr_bvh.py check-build <out dir>` validates them and traces rays against brute force (ctest: 7// `python -I tools/xdxr_bvh.py check-build <out dir>` validates them and traces rays against brute force (ctest:
7// d3d12_xdxr_rt + d3d12_xdxr_rt_check). Exit 77 without a Vulkan device, or with LEONIDA_RT_AS=khr. No game files. 8// d3d12_xdxr_rt + d3d12_xdxr_rt_check). Exit 77 without a Vulkan device, or with LEONIDA_RT_AS=khr. No game files.
8#include "../shims/d3d12_com.h" 9#include "../shims/d3d12_com.h"
@@ -153,6 +154,7 @@ int main(int argc, char** argv) {
153 154
154 D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS blas_inputs{}; 155 D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS blas_inputs{};
155 blas_inputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL; 156 blas_inputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL;
157 blas_inputs.Flags = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_UPDATE; // updated below
156 blas_inputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY; 158 blas_inputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY;
157 blas_inputs.NumDescs = 2; 159 blas_inputs.NumDescs = 2;
158 blas_inputs.pGeometryDescs = geometries; 160 blas_inputs.pGeometryDescs = geometries;
@@ -239,7 +241,7 @@ int main(int argc, char** argv) {
239 ID3D12CommandList* lists[] = {list.p}; 241 ID3D12CommandList* lists[] = {list.p};
240 queue->ExecuteCommandLists(1, lists); 242 queue->ExecuteCommandLists(1, lists);
241 if (FAILED(queue->Signal(fence.p, 1))) return fail("Signal"); 243 if (FAILED(queue->Signal(fence.p, 1))) return fail("Signal");
242 HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); 244 HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); // reused for the update below
243 const bool done = event && SUCCEEDED(fence->SetEventOnCompletion(1, event)) && 245 const bool done = event && SUCCEEDED(fence->SetEventOnCompletion(1, event)) &&
244 WaitForSingleObject(event, 10000) == WAIT_OBJECT_0; 246 WaitForSingleObject(event, 10000) == WAIT_OBJECT_0;
245 if (event) CloseHandle(event); 247 if (event) CloseHandle(event);
@@ -258,31 +260,35 @@ int main(int argc, char** argv) {
258 rb->Unmap(0, nullptr); 260 rb->Unmap(0, nullptr);
259 return ok; 261 return ok;
260 }; 262 };
261 std::string tris = "["; 263 // The BLAS's triangles as the reference sees them, for the soup's current positions.
262 bool first = true; 264 auto triangles_json = [&](const std::vector<float>& soup_now) {
263 auto add_tri = [&](const float v[3][3], int geometry, UINT primitive) { 265 std::string tris = "[";
264 tris += first ? "\n [" : ",\n ["; 266 bool first = true;
265 first = false; 267 auto add_tri = [&](const float v[3][3], int geometry, UINT primitive) {
266 for (int k = 0; k < 3; ++k) 268 tris += first ? "\n [" : ",\n [";
267 tris += (k ? ", [" : "[") + num(v[k][0]) + ", " + num(v[k][1]) + ", " + num(v[k][2]) + "]"; 269 first = false;
268 tris += ", " + std::to_string(geometry) + ", " + std::to_string(primitive) + "]"; 270 for (int k = 0; k < 3; ++k)
269 }; 271 tris += (k ? ", [" : "[") + num(v[k][0]) + ", " + num(v[k][1]) + ", " + num(v[k][2]) + "]";
270 for (UINT t = 0; t < soup_tris; ++t) { 272 tris += ", " + std::to_string(geometry) + ", " + std::to_string(primitive) + "]";
271 float v[3][3]; 273 };
272 for (int k = 0; k < 9; ++k) v[k / 3][k % 3] = soup[9 * t + k]; 274 for (UINT t = 0; t < soup_tris; ++t) {
273 add_tri(v, 0, t); 275 float v[3][3];
274 } 276 for (int k = 0; k < 9; ++k) v[k / 3][k % 3] = soup_now[9 * t + k];
275 for (UINT t = 0; t < indices.size() / 3; ++t) { 277 add_tri(v, 0, t);
276 float v[3][3];
277 for (int k = 0; k < 3; ++k) {
278 const float* p = &grid[4 * indices[3 * t + k]];
279 for (int r = 0; r < 3; ++r)
280 v[k][r] = transform[4 * r] * p[0] + transform[4 * r + 1] * p[1] + transform[4 * r + 2] * p[2] +
281 transform[4 * r + 3];
282 } 278 }
283 add_tri(v, 1, t); 279 for (UINT t = 0; t < indices.size() / 3; ++t) {
284 } 280 float v[3][3];
285 tris += "]"; 281 for (int k = 0; k < 3; ++k) {
282 const float* p = &grid[4 * indices[3 * t + k]];
283 for (int r = 0; r < 3; ++r)
284 v[k][r] = transform[4 * r] * p[0] + transform[4 * r + 1] * p[1] + transform[4 * r + 2] * p[2] +
285 transform[4 * r + 3];
286 }
287 add_tri(v, 1, t);
288 }
289 return tris + "]";
290 };
291 const std::string tris = triangles_json(soup);
286 if (!dump(blas_rb.p, blas_info.ResultDataMaxSizeInBytes, "d3d12_blas", 292 if (!dump(blas_rb.p, blas_info.ResultDataMaxSizeInBytes, "d3d12_blas",
287 "{\"kind\": \"blas\", \"address\": " + std::to_string(blas->GetGPUVirtualAddress()) + 293 "{\"kind\": \"blas\", \"address\": " + std::to_string(blas->GetGPUVirtualAddress()) +
288 ", \"triangles\": " + tris + "}\n")) 294 ", \"triangles\": " + tris + "}\n"))
@@ -298,6 +304,38 @@ int main(int argc, char** argv) {
298 "{\"kind\": \"tlas\", \"address\": " + std::to_string(tlas->GetGPUVirtualAddress()) + 304 "{\"kind\": \"tlas\", \"address\": " + std::to_string(tlas->GetGPUVirtualAddress()) +
299 ", \"bias\": 0, \"blas\": [\"d3d12_blas\"], \"instances\": " + inst + "}\n")) 305 ", \"bias\": 0, \"blas\": [\"d3d12_blas\"], \"instances\": " + inst + "}\n"))
300 return fail("TLAS readback"); 306 return fail("TLAS readback");
307
308 // ---- PERFORM_UPDATE in place: the soup moves (every vertex), the grid stays; the BLAS is refitted ----
309 std::vector<float> moved = soup;
310 std::uniform_real_distribution<float> nudge(-1.0f, 1.0f);
311 for (std::size_t v = 0; v < moved.size(); v += 3) {
312 moved[v] = moved[v] * 1.3f + nudge(rng);
313 moved[v + 1] = moved[v + 1] * 0.7f + nudge(rng);
314 moved[v + 2] += nudge(rng);
315 }
316 if (FAILED(upload->Map(0, nullptr, reinterpret_cast<void**>(&mapped)))) return fail("Map upload for the update");
317 std::memcpy(mapped + (soup_va - upload->GetGPUVirtualAddress()), moved.data(), std::size_t(soup_bytes));
318 upload->Unmap(0, nullptr);
319 if (FAILED(allocator->Reset()) || FAILED(list->Reset(allocator.p, nullptr))) return fail("Reset for the update");
320 build.Inputs = blas_inputs;
321 build.Inputs.Flags |= D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE;
322 build.DestAccelerationStructureData = blas->GetGPUVirtualAddress();
323 build.SourceAccelerationStructureData = blas->GetGPUVirtualAddress();
324 list->BuildRaytracingAccelerationStructure(&build, 0, nullptr);
325 list->ResourceBarrier(1, &barrier);
326 list->CopyBufferRegion(blas_rb.p, 0, blas.p, 0, blas_info.ResultDataMaxSizeInBytes);
327 if (FAILED(hr = list->Close())) return fail("Close (update)", hr);
328 queue->ExecuteCommandLists(1, lists);
329 if (FAILED(queue->Signal(fence.p, 2))) return fail("Signal (update)");
330 event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
331 const bool updated = event && SUCCEEDED(fence->SetEventOnCompletion(2, event)) &&
332 WaitForSingleObject(event, 10000) == WAIT_OBJECT_0;
333 if (event) CloseHandle(event);
334 if (!updated) return fail("the update did not complete");
335 if (!dump(blas_rb.p, blas_info.ResultDataMaxSizeInBytes, "d3d12_blas_update",
336 "{\"kind\": \"blas\", \"address\": " + std::to_string(blas->GetGPUVirtualAddress()) +
337 ", \"triangles\": " + triangles_json(moved) + "}\n"))
338 return fail("BLAS readback after the update");
301 std::printf("d3d12_xdxr_rt: BLAS %llu bytes (prebuild %llu), TLAS (prebuild %llu), written to %s\n", 339 std::printf("d3d12_xdxr_rt: BLAS %llu bytes (prebuild %llu), TLAS (prebuild %llu), written to %s\n",
302 static_cast<unsigned long long>(blas_info.ResultDataMaxSizeInBytes), 340 static_cast<unsigned long long>(blas_info.ResultDataMaxSizeInBytes),
303 static_cast<unsigned long long>(blas_info.ResultDataMaxSizeInBytes), 341 static_cast<unsigned long long>(blas_info.ResultDataMaxSizeInBytes),
diff --git a/runtime/test/depth24_convert_test.cpp b/runtime/test/depth24_convert_test.cpp
index 365628519..89e98b091 100644
--- a/runtime/test/depth24_convert_test.cpp
+++ b/runtime/test/depth24_convert_test.cpp
@@ -673,6 +673,97 @@ int main() {
673 std::printf("depth24: 96-bit texels repack both ways, split into rows and into slices\n"); 673 std::printf("depth24: 96-bit texels repack both ways, split into rows and into slices\n");
674 } 674 }
675 675
676 // 7. ScratchBuffers::collect() must check VkResult from vkGetSemaphoreCounterValue() (leaving in-flight
677 // chunks retired if the query fails even when *pValue is overwritten with UINT64_MAX) and reclaim
678 // ticket-0 batches without querying the timeline semaphore.
679 {
680 struct MockVk {
681 std::uint64_t next_handle = 1;
682 VkResult sem_result = VK_ERROR_DEVICE_LOST;
683 std::uint64_t sem_value = UINT64_MAX;
684 unsigned sem_queries = 0;
685 unsigned destroyed_buffers = 0;
686
687 static MockVk*& state() {
688 static MockVk* s = nullptr;
689 return s;
690 }
691 static VKAPI_ATTR VkResult VKAPI_CALL create_buf(VkDevice, const VkBufferCreateInfo*,
692 const VkAllocationCallbacks*, VkBuffer* out) {
693 *out = reinterpret_cast<VkBuffer>(state()->next_handle++);
694 return VK_SUCCESS;
695 }
696 static VKAPI_ATTR void VKAPI_CALL destroy_buf(VkDevice, VkBuffer, const VkAllocationCallbacks*) {
697 ++state()->destroyed_buffers;
698 }
699 static VKAPI_ATTR void VKAPI_CALL mem_req(VkDevice, VkBuffer, VkMemoryRequirements* req) {
700 *req = {};
701 req->size = 4096;
702 req->alignment = 256;
703 req->memoryTypeBits = 1;
704 }
705 static VKAPI_ATTR VkResult VKAPI_CALL bind_buf(VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize) {
706 return VK_SUCCESS;
707 }
708 static VKAPI_ATTR void VKAPI_CALL free_mem(VkDevice, VkDeviceMemory, const VkAllocationCallbacks*) {}
709 static VKAPI_ATTR VkResult VKAPI_CALL get_sem(VkDevice, VkSemaphore, std::uint64_t* out) {
710 ++state()->sem_queries;
711 if (out) *out = state()->sem_value;
712 return state()->sem_result;
713 }
714 static VKAPI_ATTR VkResult VKAPI_CALL wait_idle(VkDevice) { return VK_SUCCESS; }
715 static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL gdpa(VkDevice, const char* name) {
716 if (std::strcmp(name, "vkCreateBuffer") == 0) return reinterpret_cast<PFN_vkVoidFunction>(create_buf);
717 if (std::strcmp(name, "vkDestroyBuffer") == 0)
718 return reinterpret_cast<PFN_vkVoidFunction>(destroy_buf);
719 if (std::strcmp(name, "vkGetBufferMemoryRequirements") == 0)
720 return reinterpret_cast<PFN_vkVoidFunction>(mem_req);
721 if (std::strcmp(name, "vkBindBufferMemory") == 0)
722 return reinterpret_cast<PFN_vkVoidFunction>(bind_buf);
723 if (std::strcmp(name, "vkFreeMemory") == 0) return reinterpret_cast<PFN_vkVoidFunction>(free_mem);
724 if (std::strcmp(name, "vkGetSemaphoreCounterValue") == 0)
725 return reinterpret_cast<PFN_vkVoidFunction>(get_sem);
726 if (std::strcmp(name, "vkDeviceWaitIdle") == 0) return reinterpret_cast<PFN_vkVoidFunction>(wait_idle);
727 return nullptr;
728 }
729 };
730 MockVk mock{};
731 MockVk::state() = &mock;
732 const VkSemaphore fake_sem = reinterpret_cast<VkSemaphore>(std::uintptr_t(0x1234));
733 {
734 ScratchBuffers scratch(&MockVk::gdpa, reinterpret_cast<VkDevice>(std::uintptr_t(1)),
735 [&](const VkMemoryRequirements&) {
736 return reinterpret_cast<VkDeviceMemory>(mock.next_handle++);
737 });
738 EXPECT(scratch.loaded());
739 VkBuffer b1 = VK_NULL_HANDLE, b2 = VK_NULL_HANDLE;
740 VkDeviceSize off = 0;
741 EXPECT(scratch.get(1024, b1, off));
742 scratch.retire(fake_sem, 1);
743 // Query fails with VK_ERROR_DEVICE_LOST while writing UINT64_MAX to *pValue: chunk must NOT be recycled!
744 scratch.collect();
745 EXPECT(scratch.get(1024, b2, off));
746 EXPECT(b2 != b1); // b1 is still in flight; must not have been reclaimed into spare_
747 // Unsubmitted batch (ticket == 0): must reclaim without calling vkGetSemaphoreCounterValue.
748 const unsigned queries_before = mock.sem_queries;
749 scratch.retire(fake_sem, 0);
750 mock.sem_result = VK_SUCCESS;
751 mock.sem_value = 0;
752 scratch.collect();
753 EXPECT(mock.sem_queries == queries_before + 1); // only queried for b1 (ticket 1), not b2 (ticket 0)
754 VkBuffer b3 = VK_NULL_HANDLE;
755 EXPECT(scratch.get(1024, b3, off));
756 EXPECT(b3 == b2); // b2 was reclaimed cleanly from ticket 0
757 // Now b1's ticket completes cleanly.
758 mock.sem_value = 1;
759 scratch.collect();
760 scratch.retire(fake_sem, 0);
761 }
762 EXPECT(mock.destroyed_buffers == 2);
763 MockVk::state() = nullptr;
764 std::printf("depth24: ScratchBuffers::collect() checks vkGetSemaphoreCounterValue VkResult and ticket 0 ok\n");
765 }
766
676 EXPECT(gpu.validation_errors() == 0); 767 EXPECT(gpu.validation_errors() == 0);
677 std::printf("depth24_convert_test: ok\n"); 768 std::printf("depth24_convert_test: ok\n");
678 return 0; 769 return 0;
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index e414f155b..70cae9a89 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -151,19 +151,19 @@ int main() {
151 unsigned slots = rt::d3d12_xs::device_proxy_slot_count(device.Get()); 151 unsigned slots = rt::d3d12_xs::device_proxy_slot_count(device.Get());
152 std::printf("proxy forwards %u PC vtable slots (ID3D12Device..Device14 max is 83)\n", slots); 152 std::printf("proxy forwards %u PC vtable slots (ID3D12Device..Device14 max is 83)\n", slots);
153 check(slots >= 44, "proxy forwards at least the base ID3D12Device vtable"); 153 check(slots >= 44, "proxy forwards at least the base ID3D12Device vtable");
154 check(!rt::d3d12_xs::device_slot_overridden(9), "device slot 9 is forwarded (PC CreateCommandAllocator)"); 154 check(rt::d3d12_xs::device_slot_overridden(9), "device slot 9 is CreateCommandAllocator (allocator proxies)");
155 check(!rt::d3d12_xs::device_slot_overridden(10), "device slot 10 is forwarded (PC CreateGraphicsPipelineState)"); 155 check(!rt::d3d12_xs::device_slot_overridden(10), "device slot 10 is forwarded (PC CreateGraphicsPipelineState)");
156 check(rt::d3d12_xs::device_slot_overridden(14), "device slot 14 is the descriptor-heap override"); 156 check(rt::d3d12_xs::device_slot_overridden(14), "device slot 14 is the descriptor-heap override");
157 check(rt::d3d12_xs::device_slot_overridden(62), "device slot 62 is the compute-PSO override"); 157 check(rt::d3d12_xs::device_slot_overridden(62), "device slot 62 is the compute-PSO override");
158 check(rt::d3d12_xs::device_slot_overridden(76), "device slot 76 is the resource override"); 158 check(rt::d3d12_xs::device_slot_overridden(76), "device slot 76 is the resource override");
159 check(rt::d3d12_xs::device_slot_overridden(67), 159 check(rt::d3d12_xs::device_slot_overridden(67),
160 "device slot 67 is refused (console DeserializeComputePipelineStateX, " 160 "device slot 67 is the DeserializeComputePipelineStateX override (console native-code compute pipeline, not PC CreateProtectedResourceSession1)");
161 "not PC CreateProtectedResourceSession1)");
162 161
163 void** proxy_vtbl = *reinterpret_cast<void***>(device.Get()); 162 void** proxy_vtbl = *reinterpret_cast<void***>(device.Get());
164 void** real_vtbl = real ? *reinterpret_cast<void***>(real) : nullptr; 163 void** real_vtbl = real ? *reinterpret_cast<void***>(real) : nullptr;
165 check(proxy_vtbl != nullptr && proxy_vtbl[14] != real_vtbl[14], "slot 14 thunk differs from the PC entry"); 164 check(proxy_vtbl != nullptr && proxy_vtbl[14] != real_vtbl[14], "slot 14 thunk differs from the PC entry");
166 if (slots > 62) check(proxy_vtbl[62] != real_vtbl[62], "slot 62 thunk differs from PC CreateStateObject"); 165 if (slots > 62) check(proxy_vtbl[62] != real_vtbl[62], "slot 62 thunk differs from PC CreateStateObject");
166 if (slots > 67) check(proxy_vtbl[67] != real_vtbl[67], "slot 67 thunk differs from PC CreateProtectedResourceSession1");
167 if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3"); 167 if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3");
168 168
169 rt::d3d12_xs::reset_device_proxy_stats(); 169 rt::d3d12_xs::reset_device_proxy_stats();
@@ -278,6 +278,8 @@ int main() {
278 ComPtr<ID3D12CommandAllocator> allocator; 278 ComPtr<ID3D12CommandAllocator> allocator;
279 hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(allocator.GetAddressOf())); 279 hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(allocator.GetAddressOf()));
280 check(SUCCEEDED(hr) && allocator != nullptr, "device slot 9 forwards CreateCommandAllocator"); 280 check(SUCCEEDED(hr) && allocator != nullptr, "device slot 9 forwards CreateCommandAllocator");
281 // A PC runtime allocator is not wrapped: the PC runtime's lists could not resolve an allocator proxy.
282 check(!rt::d3d12_xs::is_allocator_proxy(allocator.Get()), "slot 9 hands out the PC allocator unwrapped");
281 check(rt::d3d12_xs::device_slot_hits(9) == 1, "slot 9 hit counter is 1"); 283 check(rt::d3d12_xs::device_slot_hits(9) == 1, "slot 9 hit counter is 1");
282 284
283 // Slot 76: buffer resource with the measured Xbox layout word 0x101; PC committed resources take ROW_MAJOR. 285 // Slot 76: buffer resource with the measured Xbox layout word 0x101; PC committed resources take ROW_MAJOR.
@@ -342,6 +344,31 @@ int main() {
342 check(SUCCEEDED(hr) && pso != nullptr, "slot 62 creates a compute PSO via CreateComputePipelineState"); 344 check(SUCCEEDED(hr) && pso != nullptr, "slot 62 creates a compute PSO via CreateComputePipelineState");
343 check(rt::d3d12_xs::device_slot_hits(62) == 1, "slot 62 hit counter is 1"); 345 check(rt::d3d12_xs::device_slot_hits(62) == 1, "slot 62 hit counter is 1");
344 check(rt::d3d12_xs::device_slot_first_call_seen(62), "slot 62 first-call flag is set"); 346 check(rt::d3d12_xs::device_slot_first_call_seen(62), "slot 62 first-call flag is set");
347
348 // Slot 67: Xbox native compute pipeline creation. Maps the console descriptor (+0x00 root signature,
349 // +0x28 kind 6 code blob, +0x30 code size) to D3D12_COMPUTE_PIPELINE_STATE_DESC and calls CreateComputePipelineState.
350 struct XboxNativeComputeDesc {
351 ID3D12RootSignature* root_signature;
352 const void* kind0;
353 std::uint64_t kind0_size;
354 const void* kind1;
355 std::uint64_t kind1_size;
356 const void* kind6;
357 std::uint64_t kind6_size;
358 const void* kind7;
359 std::uint64_t kind7_size;
360 } xbox_desc{};
361 xbox_desc.root_signature = root_signature.Get();
362 xbox_desc.kind6 = bytecode->GetBufferPointer();
363 xbox_desc.kind6_size = bytecode->GetBufferSize();
364
365 using XboxCreateNativeComputePsoFn = HRESULT(WINAPI*)(void*, const void*, const IID*, void**);
366 auto create_native_pso = reinterpret_cast<XboxCreateNativeComputePsoFn>(proxy_vtbl[67]);
367 ComPtr<ID3D12PipelineState> pso67;
368 hr = create_native_pso(device.Get(), &xbox_desc, &iid_pso, reinterpret_cast<void**>(pso67.GetAddressOf()));
369 check(SUCCEEDED(hr) && pso67 != nullptr, "slot 67 creates a compute PSO via CreateComputePipelineState");
370 check(rt::d3d12_xs::device_slot_hits(67) == 1, "slot 67 hit counter is 1");
371 check(rt::d3d12_xs::device_slot_first_call_seen(67), "slot 67 first-call flag is set");
345 } 372 }
346 373
347 // _COM_Outptr_ (d3d12.h): a failed create leaves NULL in the output. WARP accepts invalid heap descriptions, 374 // _COM_Outptr_ (d3d12.h): a failed create leaves NULL in the output. WARP accepts invalid heap descriptions,
@@ -357,6 +384,14 @@ int main() {
357 D3D12_COMPUTE_PIPELINE_STATE_DESC empty_pso{}; 384 D3D12_COMPUTE_PIPELINE_STATE_DESC empty_pso{};
358 hr = reinterpret_cast<Slot62Fn>(proxy_vtbl[62])(device.Get(), &empty_pso, 0, 0, nullptr, &proxy_out); 385 hr = reinterpret_cast<Slot62Fn>(proxy_vtbl[62])(device.Get(), &empty_pso, 0, 0, nullptr, &proxy_out);
359 check(FAILED(hr) && proxy_out == nullptr, "slot 62 nulls its output for a null IID"); 386 check(FAILED(hr) && proxy_out == nullptr, "slot 62 nulls its output for a null IID");
387 using Slot67Fn = HRESULT(WINAPI*)(void*, const void*, const IID*, void**);
388 proxy_out = reinterpret_cast<void*>(0x1111);
389 const IID iid_pso = __uuidof(ID3D12PipelineState);
390 hr = reinterpret_cast<Slot67Fn>(proxy_vtbl[67])(device.Get(), nullptr, &iid_pso, &proxy_out);
391 check(FAILED(hr) && proxy_out == nullptr, "slot 67 nulls its output for a null description");
392 proxy_out = reinterpret_cast<void*>(0x1111);
393 hr = reinterpret_cast<Slot67Fn>(proxy_vtbl[67])(device.Get(), &root_desc, nullptr, &proxy_out);
394 check(FAILED(hr) && proxy_out == nullptr, "slot 67 nulls its output for a null IID");
360 using Slot76Fn = HRESULT(WINAPI*)(void*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS, 395 using Slot76Fn = HRESULT(WINAPI*)(void*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS,
361 const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES, 396 const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES,
362 const D3D12_CLEAR_VALUE*, const IID*, void**); 397 const D3D12_CLEAR_VALUE*, const IID*, void**);
diff --git a/runtime/test/dxgi_swapchain_test.cpp b/runtime/test/dxgi_swapchain_test.cpp
index 86129852e..c42707640 100644
--- a/runtime/test/dxgi_swapchain_test.cpp
+++ b/runtime/test/dxgi_swapchain_test.cpp
@@ -77,6 +77,19 @@ HWND create_test_window(int width, int height) {
77 nullptr); 77 nullptr);
78} 78}
79 79
80// Native DXGI on NVIDIA and WARP reports DISJOINT once after creation or ResizeBuffers, including when the
81// first query follows a Present. A null output must not consume that notification (D3D-211).
82bool check_statistics_disjoint(IDXGISwapChain* swapchain) {
83 if (swapchain->GetFrameStatistics(nullptr) != DXGI_ERROR_INVALID_CALL) return false;
84 DXGI_FRAME_STATISTICS stats;
85 std::memset(&stats, 0xcd, sizeof(stats));
86 if (swapchain->GetFrameStatistics(&stats) != DXGI_ERROR_FRAME_STATISTICS_DISJOINT) return false;
87 if (stats.PresentCount || stats.PresentRefreshCount || stats.SyncRefreshCount ||
88 stats.SyncQPCTime.QuadPart || stats.SyncGPUTime.QuadPart)
89 return false;
90 return swapchain->GetFrameStatistics(&stats) == S_OK;
91}
92
80} // namespace 93} // namespace
81 94
82int main() { 95int main() {
@@ -263,6 +276,18 @@ int main() {
263 scd.BufferCount = 2; 276 scd.BufferCount = 2;
264 scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; 277 scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
265 278
279 for (const UINT count : {0u, 1u, DXGI_MAX_SWAP_CHAIN_BUFFERS + 1u}) {
280 DXGI_SWAP_CHAIN_DESC1 invalid = scd;
281 invalid.BufferCount = count;
282 IDXGISwapChain1* rejected = nullptr;
283 const HRESULT hr = factory->CreateSwapChainForHwnd(queue, hwnd, &invalid, nullptr, nullptr, &rejected);
284 if (rejected) {
285 rejected->Release();
286 return fail("CreateSwapChainForHwnd returned a swapchain for an invalid buffer count");
287 }
288 if (hr != DXGI_ERROR_INVALID_CALL) return fail("CreateSwapChainForHwnd invalid buffer count HRESULT");
289 }
290
266 IDXGISwapChain1* sc1 = nullptr; 291 IDXGISwapChain1* sc1 = nullptr;
267 if (FAILED(factory->CreateSwapChainForHwnd(queue, hwnd, &scd, nullptr, nullptr, &sc1)) || !sc1) 292 if (FAILED(factory->CreateSwapChainForHwnd(queue, hwnd, &scd, nullptr, nullptr, &sc1)) || !sc1)
268 return fail("CreateSwapChainForHwnd"); 293 return fail("CreateSwapChainForHwnd");
@@ -270,6 +295,8 @@ int main() {
270 if (FAILED(sc1->QueryInterface(IID_PPV_ARGS(&sc))) || !sc) return fail("QI IDXGISwapChain3"); 295 if (FAILED(sc1->QueryInterface(IID_PPV_ARGS(&sc))) || !sc) return fail("QI IDXGISwapChain3");
271 sc1->Release(); 296 sc1->Release();
272 297
298 if (!check_statistics_disjoint(sc)) return fail("initial frame-statistics disjoint notification");
299
273 ID3D12CommandQueue* got_queue = nullptr; 300 ID3D12CommandQueue* got_queue = nullptr;
274 if (FAILED(sc->GetDevice(IID_PPV_ARGS(&got_queue))) || got_queue != queue) { 301 if (FAILED(sc->GetDevice(IID_PPV_ARGS(&got_queue))) || got_queue != queue) {
275 if (got_queue) got_queue->Release(); 302 if (got_queue) got_queue->Release();
@@ -406,6 +433,25 @@ int main() {
406 return 0; 433 return 0;
407 }; 434 };
408 435
436 // Invalid counts must leave the initial back buffers usable for the first frame.
437 {
438 DXGI_SWAP_CHAIN_DESC1 before_resize{};
439 if (FAILED(sc->GetDesc1(&before_resize))) return fail("GetDesc1 before invalid resizes");
440 const std::vector<UINT> node_masks(DXGI_MAX_SWAP_CHAIN_BUFFERS + 1, 1);
441 const std::vector<IUnknown*> present_queues(DXGI_MAX_SWAP_CHAIN_BUFFERS + 1, queue);
442 for (const UINT count : {1u, DXGI_MAX_SWAP_CHAIN_BUFFERS + 1u}) {
443 if (sc->ResizeBuffers(count, 64, 64, DXGI_FORMAT_UNKNOWN, 0) != E_INVALIDARG)
444 return fail("ResizeBuffers invalid buffer count HRESULT");
445 if (sc->ResizeBuffers1(count, 64, 64, DXGI_FORMAT_UNKNOWN, 0, node_masks.data(), present_queues.data()) !=
446 E_INVALIDARG)
447 return fail("ResizeBuffers1 invalid buffer count HRESULT");
448 }
449 DXGI_SWAP_CHAIN_DESC1 after_resize{};
450 if (FAILED(sc->GetDesc1(&after_resize)) || after_resize.BufferCount != before_resize.BufferCount ||
451 after_resize.Width != before_resize.Width || after_resize.Height != before_resize.Height)
452 return fail("Invalid resize changed swapchain buffers");
453 }
454
409 // Frame 1: 128x128 clear to (64, 128, 255, 255), read back all 16,384 pixels, Present. 455 // Frame 1: 128x128 clear to (64, 128, 255, 255), read back all 16,384 pixels, Present.
410 const float blue_ish[4] = {64.0f / 255.0f, 128.0f / 255.0f, 1.0f, 1.0f}; 456 const float blue_ish[4] = {64.0f / 255.0f, 128.0f / 255.0f, 1.0f, 1.0f};
411 if (run_clear_readback_present(128, 128, blue_ish, 64, 128, 255) != 0) return 1; 457 if (run_clear_readback_present(128, 128, blue_ish, 64, 128, 255) != 0) return 1;
@@ -593,13 +639,14 @@ int main() {
593 if (sc->GetLastPresentCount(nullptr) != E_INVALIDARG) 639 if (sc->GetLastPresentCount(nullptr) != E_INVALIDARG)
594 return fail("GetLastPresentCount(nullptr) should return E_INVALIDARG"); 640 return fail("GetLastPresentCount(nullptr) should return E_INVALIDARG");
595 641
642 if (!check_statistics_disjoint(sc)) return fail("post-resize frame-statistics disjoint notification");
596 DXGI_FRAME_STATISTICS stats{}; 643 DXGI_FRAME_STATISTICS stats{};
597 if (FAILED(sc->GetFrameStatistics(&stats)) || stats.PresentCount != count_before || 644 if (FAILED(sc->GetFrameStatistics(&stats)) || stats.PresentCount != count_before ||
598 stats.PresentRefreshCount != count_before || stats.SyncRefreshCount != count_before || 645 stats.PresentRefreshCount != count_before || stats.SyncRefreshCount != count_before ||
599 stats.SyncQPCTime.QuadPart == 0) 646 stats.SyncQPCTime.QuadPart == 0)
600 return fail("GetFrameStatistics values"); 647 return fail("GetFrameStatistics values");
601 if (sc->GetFrameStatistics(nullptr) != E_INVALIDARG) 648 if (sc->GetFrameStatistics(nullptr) != DXGI_ERROR_INVALID_CALL)
602 return fail("GetFrameStatistics(nullptr) should return E_INVALIDARG"); 649 return fail("GetFrameStatistics(nullptr) should return DXGI_ERROR_INVALID_CALL");
603 } 650 }
604 651
605 // SwapChain::GetParent and non-waitable SetMaximumFrameLatency/GetMaximumFrameLatency (host DXGI returns 652 // SwapChain::GetParent and non-waitable SetMaximumFrameLatency/GetMaximumFrameLatency (host DXGI returns
@@ -731,6 +778,8 @@ int main() {
731 // Zero width or height means the window's client area, in ResizeBuffers (the usual WM_SIZE call) and at 778 // Zero width or height means the window's client area, in ResizeBuffers (the usual WM_SIZE call) and at
732 // creation; host DXGI: ResizeBuffers(0, 0, 0) after resizing the window gives the new client size. 779 // creation; host DXGI: ResizeBuffers(0, 0, 0) after resizing the window gives the new client size.
733 { 780 {
781 DXGI_SWAP_CHAIN_DESC1 before_zero{};
782 if (FAILED(sc->GetDesc1(&before_zero))) return fail("GetDesc1 before zero-count resize");
734 RECT wr{0, 0, 300, 200}; 783 RECT wr{0, 0, 300, 200};
735 AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); 784 AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
736 SetWindowPos(hwnd, nullptr, 0, 0, wr.right - wr.left, wr.bottom - wr.top, SWP_NOMOVE | SWP_NOZORDER); 785 SetWindowPos(hwnd, nullptr, 0, 0, wr.right - wr.left, wr.bottom - wr.top, SWP_NOMOVE | SWP_NOZORDER);
@@ -738,7 +787,8 @@ int main() {
738 GetClientRect(hwnd, &cr); 787 GetClientRect(hwnd, &cr);
739 if (FAILED(sc->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0))) return fail("ResizeBuffers(0, 0, 0)"); 788 if (FAILED(sc->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0))) return fail("ResizeBuffers(0, 0, 0)");
740 DXGI_SWAP_CHAIN_DESC1 d{}; 789 DXGI_SWAP_CHAIN_DESC1 d{};
741 sc->GetDesc1(&d); 790 if (FAILED(sc->GetDesc1(&d)) || d.BufferCount != before_zero.BufferCount)
791 return fail("ResizeBuffers(0, 0, 0) changed the buffer count");
742 if (d.Width != UINT(cr.right) || d.Height != UINT(cr.bottom)) { 792 if (d.Width != UINT(cr.right) || d.Height != UINT(cr.bottom)) {
743 std::fprintf(stderr, "FAIL: ResizeBuffers(0, 0, 0) gave %ux%u, client area is %ldx%ld\n", d.Width, d.Height, 793 std::fprintf(stderr, "FAIL: ResizeBuffers(0, 0, 0) gave %ux%u, client area is %ldx%ld\n", d.Width, d.Height,
744 cr.right, cr.bottom); 794 cr.right, cr.bottom);
@@ -778,11 +828,31 @@ int main() {
778 return fail("CheckFeatureSupport should reject null data or wrong size with E_INVALIDARG"); 828 return fail("CheckFeatureSupport should reject null data or wrong size with E_INVALIDARG");
779 factory5->Release(); 829 factory5->Release();
780 830
831 constexpr UINT tearing_flag = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
832 constexpr UINT waitable_flag = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
833 constexpr UINT both_flags = tearing_flag | waitable_flag;
834 const UINT node_masks[2] = {1, 1};
835 IUnknown* const present_queues[2] = {queue, queue};
836 const auto rejects_flag_change = [&](IDXGISwapChain3* chain, UINT flags) {
837 DXGI_SWAP_CHAIN_DESC1 before{}, after{};
838 if (FAILED(chain->GetDesc1(&before))) return false;
839 const UINT width = before.Width + 1;
840 return chain->ResizeBuffers(0, width, before.Height, DXGI_FORMAT_UNKNOWN, flags) == E_INVALIDARG &&
841 chain->ResizeBuffers1(2, width, before.Height, DXGI_FORMAT_UNKNOWN, flags,
842 node_masks, present_queues) == E_INVALIDARG &&
843 SUCCEEDED(chain->GetDesc1(&after)) && after.Flags == before.Flags &&
844 after.BufferCount == before.BufferCount && after.Width == before.Width &&
845 after.Height == before.Height;
846 };
847
781 // Non-waitable, non-tearing swapchain: GetFrameLatencyWaitableObject is null and ALLOW_TEARING is rejected. 848 // Non-waitable, non-tearing swapchain: GetFrameLatencyWaitableObject is null and ALLOW_TEARING is rejected.
849 for (UINT flags : {waitable_flag, tearing_flag, both_flags})
850 if (!rejects_flag_change(sc, flags)) return fail("Resize accepted adding a creation-only flag");
782 if (sc->GetFrameLatencyWaitableObject() != nullptr) 851 if (sc->GetFrameLatencyWaitableObject() != nullptr)
783 return fail("Non-waitable swapchain should return nullptr from GetFrameLatencyWaitableObject"); 852 return fail("Non-waitable swapchain should return nullptr from GetFrameLatencyWaitableObject");
784 if (sc->Present(0, DXGI_PRESENT_ALLOW_TEARING) != DXGI_ERROR_INVALID_CALL) 853 if (sc->Present(0, DXGI_PRESENT_ALLOW_TEARING) != DXGI_ERROR_INVALID_CALL)
785 return fail("Present(ALLOW_TEARING) on non-tearing swapchain should return DXGI_ERROR_INVALID_CALL"); 854 return fail("Present(ALLOW_TEARING) on non-tearing swapchain should return DXGI_ERROR_INVALID_CALL");
855 if (FAILED(sc->Present(0, 0))) return fail("Present after rejected resize on a plain swapchain");
786 856
787 HWND hwnd3 = create_test_window(128, 96); 857 HWND hwnd3 = create_test_window(128, 96);
788 if (!hwnd3) return fail("CreateWindowExW (third)"); 858 if (!hwnd3) return fail("CreateWindowExW (third)");
@@ -790,7 +860,7 @@ int main() {
790 wdesc.Width = 128; 860 wdesc.Width = 128;
791 wdesc.Height = 96; 861 wdesc.Height = 96;
792 wdesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM; // also tests presenting an untouched offscreen backbuffer 862 wdesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM; // also tests presenting an untouched offscreen backbuffer
793 wdesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT; 863 wdesc.Flags = both_flags;
794 IDXGISwapChain1* wsc1 = nullptr; 864 IDXGISwapChain1* wsc1 = nullptr;
795 if (FAILED(factory->CreateSwapChainForHwnd(queue, hwnd3, &wdesc, nullptr, nullptr, &wsc1)) || !wsc1) 865 if (FAILED(factory->CreateSwapChainForHwnd(queue, hwnd3, &wdesc, nullptr, nullptr, &wsc1)) || !wsc1)
796 return fail("CreateSwapChainForHwnd (tearing + waitable)"); 866 return fail("CreateSwapChainForHwnd (tearing + waitable)");
@@ -798,6 +868,8 @@ int main() {
798 if (FAILED(wsc1->QueryInterface(IID_PPV_ARGS(&wsc))) || !wsc) return fail("QI IDXGISwapChain3 (waitable)"); 868 if (FAILED(wsc1->QueryInterface(IID_PPV_ARGS(&wsc))) || !wsc) return fail("QI IDXGISwapChain3 (waitable)");
799 wsc1->Release(); 869 wsc1->Release();
800 870
871 for (UINT flags : {0u, waitable_flag, tearing_flag})
872 if (!rejects_flag_change(wsc, flags)) return fail("Resize accepted removing a creation-only flag");
801 DXGI_SWAP_CHAIN_DESC1 got_desc{}; 873 DXGI_SWAP_CHAIN_DESC1 got_desc{};
802 if (FAILED(wsc->GetDesc1(&got_desc)) || got_desc.Flags != wdesc.Flags) 874 if (FAILED(wsc->GetDesc1(&got_desc)) || got_desc.Flags != wdesc.Flags)
803 return fail("Waitable swapchain GetDesc1 did not preserve Flags"); 875 return fail("Waitable swapchain GetDesc1 did not preserve Flags");
@@ -817,13 +889,134 @@ int main() {
817 return fail("Present(1, ALLOW_TEARING) should return DXGI_ERROR_INVALID_CALL"); 889 return fail("Present(1, ALLOW_TEARING) should return DXGI_ERROR_INVALID_CALL");
818 if (FAILED(wsc->Present(0, DXGI_PRESENT_ALLOW_TEARING))) 890 if (FAILED(wsc->Present(0, DXGI_PRESENT_ALLOW_TEARING)))
819 return fail("Present(0, ALLOW_TEARING) on untouched 10-bit offscreen swapchain failed"); 891 return fail("Present(0, ALLOW_TEARING) on untouched 10-bit offscreen swapchain failed");
892 if (!check_statistics_disjoint(wsc)) return fail("first statistics query after Present should be disjoint");
820 if (WaitForSingleObject(waitable, 5000) != WAIT_OBJECT_0) 893 if (WaitForSingleObject(waitable, 5000) != WAIT_OBJECT_0)
821 return fail("Post-Present WaitForSingleObject on waitable swapchain failed"); 894 return fail("Post-Present WaitForSingleObject on waitable swapchain failed");
895 if (FAILED(wsc->ResizeBuffers(0, wdesc.Width + 1, wdesc.Height, DXGI_FORMAT_UNKNOWN, both_flags)) ||
896 FAILED(wsc->GetDesc1(&got_desc)) || got_desc.Width != wdesc.Width + 1 || got_desc.Flags != both_flags)
897 return fail("ResizeBuffers with matching creation flags failed");
898 if (FAILED(wsc->Present(0, DXGI_PRESENT_ALLOW_TEARING)) ||
899 WaitForSingleObject(waitable, 5000) != WAIT_OBJECT_0)
900 return fail("Present or wait after resizing the waitable swapchain failed");
822 CloseHandle(waitable); 901 CloseHandle(waitable);
823 wsc->Release(); 902 wsc->Release();
824 DestroyWindow(hwnd3); 903 DestroyWindow(hwnd3);
825 } 904 }
826 905
906 // CreateSwapChainForCoreWindow & Occlusion status registration
907 {
908 // 1. Parameter validation
909 IDXGISwapChain1* sc_dummy = nullptr;
910 if (factory->CreateSwapChainForCoreWindow(queue, nullptr, &scd, nullptr, &sc_dummy) != E_INVALIDARG)
911 return fail("CreateSwapChainForCoreWindow(null window) should return E_INVALIDARG");
912 if (factory->CreateSwapChainForCoreWindow(nullptr, queue, &scd, nullptr, &sc_dummy) != E_INVALIDARG)
913 return fail("CreateSwapChainForCoreWindow(null device) should return E_INVALIDARG");
914 if (factory->CreateSwapChainForCoreWindow(queue, queue, nullptr, nullptr, &sc_dummy) != E_INVALIDARG)
915 return fail("CreateSwapChainForCoreWindow(null desc) should return E_INVALIDARG");
916 if (factory->CreateSwapChainForCoreWindow(queue, queue, &scd, nullptr, nullptr) != E_POINTER)
917 return fail("CreateSwapChainForCoreWindow(null out) should return E_POINTER");
918
919 // Non-CoreWindow IUnknown
920 if (factory->CreateSwapChainForCoreWindow(queue, queue, &scd, nullptr, &sc_dummy) != DXGI_ERROR_INVALID_CALL)
921 return fail("CreateSwapChainForCoreWindow with non-CoreWindow should return DXGI_ERROR_INVALID_CALL");
922
923 // 2. Mock ICoreWindow with ICoreWindowInterop
924 static constexpr GUID kIID_ICoreWindowInterop = {
925 0x45D64A29, 0xA63E, 0x4CB6, {0xB4, 0x98, 0x57, 0x81, 0xD2, 0x98, 0xCB, 0x4F}};
926 struct MockCoreWindow final : public IUnknown {
927 HWND window_handle = nullptr;
928 std::atomic<ULONG> refs{1};
929
930 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** out) override {
931 if (!out) return E_POINTER;
932 if (riid == IID_IUnknown || riid == kIID_ICoreWindowInterop) {
933 *out = this;
934 AddRef();
935 return S_OK;
936 }
937 *out = nullptr;
938 return E_NOINTERFACE;
939 }
940 ULONG STDMETHODCALLTYPE AddRef() override { return ++refs; }
941 ULONG STDMETHODCALLTYPE Release() override {
942 ULONG r = --refs;
943 if (!r) delete this;
944 return r;
945 }
946 virtual HRESULT STDMETHODCALLTYPE get_WindowHandle(HWND* hwnd) {
947 if (!hwnd) return E_POINTER;
948 *hwnd = window_handle;
949 return S_OK;
950 }
951 virtual HRESULT STDMETHODCALLTYPE put_MessageHandled(unsigned char) { return S_OK; }
952 };
953
954 auto* mock_cw = new MockCoreWindow();
955 // Null HWND in interop
956 if (factory->CreateSwapChainForCoreWindow(queue, mock_cw, &scd, nullptr, &sc_dummy) != DXGI_ERROR_INVALID_CALL) {
957 mock_cw->Release();
958 return fail("CreateSwapChainForCoreWindow with null HWND should return DXGI_ERROR_INVALID_CALL");
959 }
960
961 // Valid HWND in mock CoreWindow
962 HWND hwnd4 = create_test_window(160, 120);
963 if (!hwnd4) {
964 mock_cw->Release();
965 return fail("CreateWindowExW (fourth)");
966 }
967 mock_cw->window_handle = hwnd4;
968 IDXGISwapChain1* cw_sc1 = nullptr;
969 if (FAILED(factory->CreateSwapChainForCoreWindow(queue, mock_cw, &scd, nullptr, &cw_sc1)) || !cw_sc1) {
970 mock_cw->Release();
971 DestroyWindow(hwnd4);
972 return fail("CreateSwapChainForCoreWindow with valid MockCoreWindow failed");
973 }
974 IDXGISwapChain3* cw_sc = nullptr;
975 if (FAILED(cw_sc1->QueryInterface(IID_PPV_ARGS(&cw_sc))) || !cw_sc) {
976 cw_sc1->Release();
977 mock_cw->Release();
978 DestroyWindow(hwnd4);
979 return fail("QI IDXGISwapChain3 on CoreWindow swapchain failed");
980 }
981 cw_sc1->Release();
982 DXGI_SWAP_CHAIN_DESC1 cw_desc{};
983 if (FAILED(cw_sc->GetDesc1(&cw_desc)) || cw_desc.Width != scd.Width || cw_desc.Height != scd.Height) {
984 cw_sc->Release();
985 mock_cw->Release();
986 DestroyWindow(hwnd4);
987 return fail("GetDesc1 on CoreWindow swapchain mismatch");
988 }
989 if (FAILED(cw_sc->Present(0, 0))) {
990 cw_sc->Release();
991 mock_cw->Release();
992 DestroyWindow(hwnd4);
993 return fail("Present on CoreWindow swapchain failed");
994 }
995 cw_sc->Release();
996 mock_cw->Release();
997 DestroyWindow(hwnd4);
998
999 // 3. Occlusion status registration
1000 DWORD cookie1 = 0, cookie2 = 0;
1001 if (factory->RegisterOcclusionStatusWindow(nullptr, WM_USER, &cookie1) != DXGI_ERROR_INVALID_CALL)
1002 return fail("RegisterOcclusionStatusWindow(null hwnd) should return DXGI_ERROR_INVALID_CALL");
1003 if (factory->RegisterOcclusionStatusWindow(hwnd, WM_USER, nullptr) != DXGI_ERROR_INVALID_CALL)
1004 return fail("RegisterOcclusionStatusWindow(null cookie) should return DXGI_ERROR_INVALID_CALL");
1005 if (FAILED(factory->RegisterOcclusionStatusWindow(hwnd, WM_USER, &cookie1)) || cookie1 == 0)
1006 return fail("RegisterOcclusionStatusWindow failed");
1007
1008 HANDLE ev = CreateEventW(nullptr, FALSE, FALSE, nullptr);
1009 if (factory->RegisterOcclusionStatusEvent(nullptr, &cookie2) != DXGI_ERROR_INVALID_CALL)
1010 return fail("RegisterOcclusionStatusEvent(null event) should return DXGI_ERROR_INVALID_CALL");
1011 if (factory->RegisterOcclusionStatusEvent(ev, nullptr) != DXGI_ERROR_INVALID_CALL)
1012 return fail("RegisterOcclusionStatusEvent(null cookie) should return DXGI_ERROR_INVALID_CALL");
1013 if (FAILED(factory->RegisterOcclusionStatusEvent(ev, &cookie2)) || cookie2 == 0 || cookie2 == cookie1)
1014 return fail("RegisterOcclusionStatusEvent failed or duplicated cookie");
1015 factory->UnregisterOcclusionStatus(cookie1);
1016 factory->UnregisterOcclusionStatus(cookie2);
1017 CloseHandle(ev);
1018 }
1019
827 rtv_heap->Release(); 1020 rtv_heap->Release();
828 sc->Release(); 1021 sc->Release();
829 fence->Release(); 1022 fence->Release();
@@ -843,7 +1036,7 @@ int main() {
843 return 1; 1036 return 1;
844 } 1037 }
845 std::printf("device: %s (validation %s)\n", chosen.deviceName, val_active ? "on" : "off"); 1038 std::printf("device: %s (validation %s)\n", chosen.deviceName, val_active ? "on" : "off");
846 std::printf("dxgi_swapchain_test: PASS (CreateSwapChainForHwnd, GetBuffer+GetDesc, clear+readback, Present, " 1039 std::printf("dxgi_swapchain_test: PASS (CreateSwapChainForHwnd, CreateSwapChainForCoreWindow, occlusion status, "
847 "ResizeBuffers; 0 validation errors)\n"); 1040 "GetBuffer+GetDesc, clear+readback, Present, ResizeBuffers; 0 validation errors)\n");
848 return 0; 1041 return 0;
849} 1042}
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp
index c33098d2a..1fcaf6710 100644
--- a/runtime/test/file_system_test.cpp
+++ b/runtime/test/file_system_test.cpp
@@ -99,7 +99,7 @@ int main() {
99 write_path(package / "data" / "hello.txt", "package"); 99 write_path(package / "data" / "hello.txt", "package");
100 write_path(package / "data" / "dup.txt", "package"); 100 write_path(package / "data" / "dup.txt", "package");
101 write_path(package / "data" / "bye.txt", "package"); 101 write_path(package / "data" / "bye.txt", "package");
102 std::filesystem::create_directories(package / "data" / "sub"); 102 write_path(package / "data" / "sub" / "nested.txt", "nested");
103 103
104 rt::fs::configure(package, overlay); 104 rt::fs::configure(package, overlay);
105 check(rt::fs::game_dir() == package, "configure() sets the game folder"); 105 check(rt::fs::game_dir() == package, "configure() sets the game folder");
@@ -249,6 +249,15 @@ int main() {
249 SetLastError(0); 249 SetLastError(0);
250 check(delete_w(L"GAME:\\nope\\missing.txt") == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND, 250 check(delete_w(L"GAME:\\nope\\missing.txt") == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND,
251 "deleting a file that never existed reports ERROR_FILE_NOT_FOUND"); 251 "deleting a file that never existed reports ERROR_FILE_NOT_FOUND");
252
253 // Deleting a nested package file creates parent directories inside .gta6rt-deleted/; those marker parent
254 // directories must not hide the corresponding ancestor directories in the package.
255 check(delete_w(L"GAME:\\data\\sub\\nested.txt") != FALSE, "DeleteFileW accepts a nested package file");
256 const DWORD sub_attrs = attributes_w(L"GAME:\\data\\sub");
257 check(sub_attrs != INVALID_FILE_ATTRIBUTES && (sub_attrs & FILE_ATTRIBUTE_DIRECTORY) != 0,
258 "deleting a nested package file does not hide its parent folder");
259 check(contains(list(first_w, next_w, find_close, L"GAME:\\data\\*"), L"sub"),
260 "the parent folder stays listed after deleting a nested package file");
252 } 261 }
253 262
254 // Nothing leaves the package and the overlay. 263 // Nothing leaves the package and the overlay.
diff --git a/runtime/test/fsr_dispatch_test.cpp b/runtime/test/fsr_dispatch_test.cpp
index 7affaee7a..9a66071ac 100644
--- a/runtime/test/fsr_dispatch_test.cpp
+++ b/runtime/test/fsr_dispatch_test.cpp
@@ -28,7 +28,7 @@
28// driver refuses one of its textures (DXGI_FORMAT_R9G9B9E5_SHAREDEXP with ALLOW_UNORDERED_ACCESS); on WARP the 28// driver refuses one of its textures (DXGI_FORMAT_R9G9B9E5_SHAREDEXP with ALLOW_UNORDERED_ACCESS); on WARP the
29// context is created as is. The other backend ids are controls: they end in FFX_API_RETURN_ERROR before the device 29// context is created as is. The other backend ids are controls: they end in FFX_API_RETURN_ERROR before the device
30// is touched. In step 7 the dispatch is recorded up to the DLL's compute pipeline, which a PC device cannot create 30// is touched. In step 7 the dispatch is recorded up to the DLL's compute pipeline, which a PC device cannot create
31// (slot 67 is console-only and refused; slot 62's code is not a PC shader). The INFO lines are the measurement; the 31// (slot 67 and 62 codes are not PC shaders). The INFO lines are the measurement; the
32// PASS/FAIL checks only cover what is known to work. 32// PASS/FAIL checks only cover what is known to work.
33#include <windows.h> 33#include <windows.h>
34 34
@@ -958,7 +958,7 @@ int main() {
958 note(" device slot 62 (compute pipeline from a D3D12_COMPUTE_PIPELINE_STATE_DESC) called " + 958 note(" device slot 62 (compute pipeline from a D3D12_COMPUTE_PIPELINE_STATE_DESC) called " +
959 std::to_string(g_slot62_calls) + "x, last HRESULT " + hex(static_cast<uint32_t>(g_slot62_hr))); 959 std::to_string(g_slot62_calls) + "x, last HRESULT " + hex(static_cast<uint32_t>(g_slot62_hr)));
960 if (g_formatted) note(" the DLL formatted HRESULT " + hex(g_first_formatted)); 960 if (g_formatted) note(" the DLL formatted HRESULT " + hex(g_first_formatted));
961 // On a PC device both pipeline paths fail (67 is refused, 62's code is not a PC shader); on the 961 // On a PC device both pipeline paths fail (neither slot 67's nor 62's code is a PC shader); on the
962 // Vulkan device CreateRootSignature (slot 16) is not implemented yet. Either way the dispatch goes 962 // Vulkan device CreateRootSignature (slot 16) is not implemented yet. Either way the dispatch goes
963 // on with a null pipeline and faults when it records it (RVA 0x65ff reads the pipeline's +0x10, 963 // on with a null pipeline and faults when it records it (RVA 0x65ff reads the pipeline's +0x10,
964 // the same pointer it passes to SetPipelineState): a documented stop, not a test failure. 964 // the same pointer it passes to SetPipelineState): a documented stop, not a test failure.
diff --git a/runtime/test/gameinput_probe.cpp b/runtime/test/gameinput_probe.cpp
index aa077b257..32ddf5d91 100644
--- a/runtime/test/gameinput_probe.cpp
+++ b/runtime/test/gameinput_probe.cpp
@@ -85,12 +85,17 @@ int main(int argc, char** argv) {
85 if (input->GetCurrentReading(GameInputKindGamepad, nullptr, &r) == S_OK) { 85 if (input->GetCurrentReading(GameInputKindGamepad, nullptr, &r) == S_OK) {
86 GameInputGamepadState s{}; 86 GameInputGamepadState s{};
87 GameInputUiNavigationState ui{}; 87 GameInputUiNavigationState ui{};
88 GameInputMotionState m{};
89 const bool motion = r->GetMotionState(&m);
88 r->GetGamepadState(&s); 90 r->GetGamepadState(&s);
89 r->GetUiNavigationState(&ui); 91 r->GetUiNavigationState(&ui);
90 std::printf("\rbuttons=%04x ui=%06x LT=%.2f RT=%.2f L=(%+.2f,%+.2f) R=(%+.2f,%+.2f) seq=%llu ", s.buttons, 92 std::printf("\rbuttons=%04x ui=%06x LT=%.2f RT=%.2f L=(%+.2f,%+.2f) R=(%+.2f,%+.2f) seq=%llu ", s.buttons,
91 ui.buttons, s.leftTrigger, s.rightTrigger, s.leftThumbstickX, s.leftThumbstickY, 93 ui.buttons, s.leftTrigger, s.rightTrigger, s.leftThumbstickX, s.leftThumbstickY,
92 s.rightThumbstickX, s.rightThumbstickY, 94 s.rightThumbstickX, s.rightThumbstickY,
93 static_cast<unsigned long long>(r->GetSequenceNumber(GameInputKindGamepad))); 95 static_cast<unsigned long long>(r->GetSequenceNumber(GameInputKindGamepad)));
96 if (motion) // fractions of motionInfo's maxima: accel includes gravity, so a resting pad shows ~0.5 g
97 std::printf("\n[a]=(%+.2f,%+.2f,%+.2f) [w]=(%+.2f,%+.2f,%+.2f) ", m.accelerationX, m.accelerationY,
98 m.accelerationZ, m.angularVelocityX, m.angularVelocityY, m.angularVelocityZ);
94 std::fflush(stdout); 99 std::fflush(stdout);
95 r->Release(); 100 r->Release();
96 } 101 }
diff --git a/runtime/test/gameinput_test.cpp b/runtime/test/gameinput_test.cpp
index a0bcaf444..d1923ceaf 100644
--- a/runtime/test/gameinput_test.cpp
+++ b/runtime/test/gameinput_test.cpp
@@ -80,7 +80,7 @@ bool SDLCALL on_effect(void* u, const void* data, int size) {
80} 80}
81void SDLCALL on_player(void* u, int index) { static_cast<Pad*>(u)->player = index; } 81void SDLCALL on_player(void* u, int index) { static_cast<Pad*>(u)->player = index; }
82 82
83void attach(Pad& pad, const char* name, uint16_t vendor, uint16_t product, bool trigger_motors) { 83void attach(Pad& pad, const char* name, uint16_t vendor, uint16_t product, bool trigger_motors, bool sensors = false) {
84 SDL_VirtualJoystickDesc d; 84 SDL_VirtualJoystickDesc d;
85 SDL_INIT_INTERFACE(&d); 85 SDL_INIT_INTERFACE(&d);
86 d.type = SDL_JOYSTICK_TYPE_GAMEPAD; 86 d.type = SDL_JOYSTICK_TYPE_GAMEPAD;
@@ -97,6 +97,11 @@ void attach(Pad& pad, const char* name, uint16_t vendor, uint16_t product, bool
97 d.SetLED = on_led; 97 d.SetLED = on_led;
98 d.SendEffect = on_effect; 98 d.SendEffect = on_effect;
99 d.SetPlayerIndex = on_player; 99 d.SetPlayerIndex = on_player;
100 static const SDL_VirtualJoystickSensorDesc kSensors[] = {{SDL_SENSOR_GYRO, 250.0f}, {SDL_SENSOR_ACCEL, 250.0f}};
101 if (sensors) {
102 d.nsensors = 2;
103 d.sensors = kSensors;
104 }
100 pad.id = SDL_AttachVirtualJoystick(&d); 105 pad.id = SDL_AttachVirtualJoystick(&d);
101 pad.js = pad.id ? SDL_OpenJoystick(pad.id) : nullptr; 106 pad.js = pad.id ? SDL_OpenJoystick(pad.id) : nullptr;
102 if (pad.js) { // triggers at rest: the full-range virtual axis maps -32768 to 0 107 if (pad.js) { // triggers at rest: the full-range virtual axis maps -32768 to 0
@@ -206,6 +211,134 @@ bool sticks_at_rest(const GameInputGamepadState& st) {
206 st.rightThumbstickY == 0 && st.leftTrigger == 0 && st.rightTrigger == 0; 211 st.rightThumbstickY == 0 && st.leftTrigger == 0 && st.rightTrigger == 0;
207} 212}
208 213
214// ---- motion: SDL sensors through the shim ----
215void send_motion(Pad& pad, float ax, float ay, float az, float gx, float gy, float gz) {
216 const Uint64 ts = SDL_GetTicksNS();
217 const float accel[3] = {ax, ay, az};
218 const float gyro[3] = {gx, gy, gz};
219 SDL_SendJoystickVirtualSensorData(pad.js, SDL_SENSOR_ACCEL, ts, accel, 3);
220 SDL_SendJoystickVirtualSensorData(pad.js, SDL_SENSOR_GYRO, ts, gyro, 3);
221}
222
223GameInputMotionState motion_state(IGameInput* input, IGameInputDevice* dev, bool* ok = nullptr) {
224 GameInputMotionState ms{};
225 IGameInputReading* r = nullptr;
226 const bool got = input->GetCurrentReading(GameInputKindMotion, dev, &r) == S_OK && r && r->GetMotionState(&ms);
227 if (r) r->Release();
228 if (ok) *ok = got;
229 return ms;
230}
231
232void test_motion(IGameInput* input) {
233 const size_t events_before = g_device_events.size(); // other tests' events are still queued in the vector
234 Pad gyro_pad, plain;
235 attach(gyro_pad, "Leonida virtual gyro pad", 0x054C, 0x0CE6, false, true); // Sony ids, sensors on
236 attach(plain, "Leonida virtual plain pad", 0x045E, 0x02FF, false);
237 rt::gameinput::poll();
238 check(rt::gameinput::connected_count() == 2, "motion: both pads connected");
239 // The connect events for these two pads are the first two CONNECTED events after `events_before`, deduplicated
240 // by device: earlier test sections leave their device callbacks registered, so every connect is delivered more
241 // than once, and a disconnect from a previous test may be queued in between.
242 std::vector<IGameInputDevice*> found;
243 for (size_t i = events_before; i < g_device_events.size() && found.size() < 2; ++i) {
244 const DeviceEvent& e = g_device_events[i];
245 if (!(e.current & GameInputDeviceConnected)) continue;
246 if (std::find(found.begin(), found.end(), e.device) != found.end()) continue;
247 found.push_back(e.device);
248 }
249 IGameInputDevice* mdev = found.size() > 0 ? found[0] : nullptr; // attach order: gyro pad first
250 IGameInputDevice* pdev = found.size() > 1 ? found[1] : nullptr;
251 if (mdev) mdev->AddRef();
252 if (pdev) pdev->AddRef();
253 check(mdev && pdev, "motion: both device objects arrived");
254 if (!mdev || !pdev) return;
255
256 const GameInputDeviceInfo* mi = mdev->GetDeviceInfo();
257 const GameInputDeviceInfo* pi = pdev->GetDeviceInfo();
258 check((mi->supportedInput & GameInputKindMotion) != 0, "motion: the gyro pad reports GameInputKindMotion");
259 check((pi->supportedInput & GameInputKindMotion) == 0, "motion: the plain pad does not");
260 const GameInputMotionInfo* mmotion = static_cast<const GameInputMotionInfo*>(mi->motionInfo);
261 check(mmotion != nullptr && mmotion->maxAcceleration == 19.6133f && mmotion->maxAngularVelocity == 34.9066f &&
262 mmotion->maxMagneticFieldStrength == 0.0f,
263 "motion: motionInfo carries the shim's maxima (magnetometer unavailable)");
264 check(pi->motionInfo == nullptr, "motion: the plain pad's motionInfo is null");
265
266 // Before the first sensor sample arrives, SDL answers reads with zeros and the shim reports no motion at all.
267 IGameInputReading* r = nullptr;
268 GameInputMotionState unused{};
269 check(input->GetCurrentReading(GameInputKindGamepad, mdev, &r) == S_OK && r && !r->GetMotionState(&unused),
270 "motion: before the first sample, GetMotionState is false even on a sensor pad");
271 if (r) r->Release();
272
273 // 9.80665 m/s^2 is half of the 2 g maximum; 17.4533 rad/s is half of 2000 deg/s. A reading with the sample needs
274 // either a gamepad change or the ~8 ms motion cadence, so the test waits out the window before polling.
275 send_motion(gyro_pad, 0.0f, 0.0f, 9.80665f, 17.4533f, 0.0f, 0.0f);
276 Sleep(12);
277 rt::gameinput::poll();
278 bool got = false;
279 const GameInputMotionState ms = motion_state(input, mdev, &got);
280 check(got, "motion: GetMotionState true on a motion reading");
281 check(approx(ms.accelerationZ, 0.5f) && approx(ms.angularVelocityX, 0.5f),
282 "motion: accel and gyro normalised against the motionInfo maxima");
283 check(ms.accelerometerAccuracy == GameInputMotionAccuracyHigh && ms.gyroscopeAccuracy == GameInputMotionAccuracyHigh,
284 "motion: live sensors report High accuracy");
285 check(ms.magnetometerAccuracy == GameInputMotionAccuracyUnknown &&
286 ms.orientationAccuracy == GameInputMotionAccuracyUnknown,
287 "motion: sensors the shim does not provide report Unknown");
288
289 r = nullptr;
290 check(input->GetCurrentReading(GameInputKindMotion, pdev, &r) == GAMEINPUT_E_READING_NOT_FOUND && !r,
291 "motion: a motion query on the plain pad is READING_NOT_FOUND");
292 check(input->GetCurrentReading(GameInputKindGamepad, mdev, &r) == S_OK && r && !r->GetMotionState(nullptr) &&
293 (r->GetInputKind() & GameInputKindMotion),
294 "motion: GetMotionState(nullptr) is false; the gyro pad's reading kind includes Motion");
295 if (r) r->Release();
296 unused = {};
297 check(input->GetCurrentReading(GameInputKindGamepad, pdev, &r) == S_OK && r &&
298 !(r->GetInputKind() & GameInputKindMotion) && !r->GetMotionState(&unused),
299 "motion: the plain pad's reading has no motion kind and GetMotionState is false");
300 if (r) r->Release();
301
302 send_motion(gyro_pad, 100.0f, -100.0f, 0.0f, 0.0f, 0.0f, -100.0f);
303 Sleep(12);
304 rt::gameinput::poll();
305 const GameInputMotionState sat = motion_state(input, mdev);
306 check(sat.accelerationX == 1.0f && sat.accelerationY == -1.0f && sat.angularVelocityZ == -1.0f,
307 "motion: out-of-range sensor values clamp to the +-1 fraction range");
308
309 // The cadence: with the buttons idle, a changed gyro yields a new reading only once per ~8 ms window, not one
310 // per poll, so the history still spans the half second it is documented for.
311 send_motion(gyro_pad, 0.0f, 0.0f, 9.80665f, 0.0f, 0.0f, 0.0f);
312 rt::gameinput::poll();
313 IGameInputReading* first = nullptr;
314 check(input->GetCurrentReading(GameInputKindMotion, mdev, &first) == S_OK && first,
315 "motion: a reading exists after a sensor update");
316 send_motion(gyro_pad, 0.0f, 0.0f, 9.80665f, 34.9066f, 0.0f, 0.0f); // gravity stays: zero accel means "no sample"
317 rt::gameinput::poll();
318 IGameInputReading* none = nullptr;
319 check(input->GetNextReading(first, GameInputKindMotion, mdev, &none) == GAMEINPUT_E_READING_NOT_FOUND && !none,
320 "motion: no new reading within the 8 ms cadence window");
321 Sleep(12);
322 rt::gameinput::poll();
323 IGameInputReading* next = nullptr;
324 check(input->GetNextReading(first, GameInputKindMotion, mdev, &next) == S_OK && next,
325 "motion: after the window the latest sensor state is in a new reading");
326 if (next) {
327 GameInputMotionState later{};
328 check(next->GetMotionState(&later) && approx(later.angularVelocityX, 1.0f),
329 "motion: the new reading carries the newest gyro sample");
330 next->Release();
331 }
332 if (first) first->Release();
333
334 detach(gyro_pad);
335 detach(plain);
336 rt::gameinput::poll();
337 if (mdev) mdev->Release();
338 if (pdev) pdev->Release();
339 check(rt::gameinput::connected_count() == 0, "motion: both pads closed again");
340}
341
209// WASD, the mouse and its buttons. Runs in the focused mode with focus and nothing held. 342// WASD, the mouse and its buttons. Runs in the focused mode with focus and nothing held.
210void test_keyboard_pad_sticks(IGameInput* input, IGameInputDevice* kb) { 343void test_keyboard_pad_sticks(IGameInput* input, IGameInputDevice* kb) {
211 rt::gameinput::poll(); 344 rt::gameinput::poll();
@@ -965,6 +1098,7 @@ int main() {
965 1098
966 test_twins(input); 1099 test_twins(input);
967 test_keyboard_pad(input); 1100 test_keyboard_pad(input);
1101 test_motion(input);
968 input->Release(); 1102 input->Release();
969 1103
970 std::printf("%d checks, %d failures\n", g_checks, g_failures); 1104 std::printf("%d checks, %d failures\n", g_checks, g_failures);
diff --git a/runtime/test/glsl/cs_set0_sample.comp b/runtime/test/glsl/cs_set0_sample.comp
new file mode 100644
index 000000000..f007da556
--- /dev/null
+++ b/runtime/test/glsl/cs_set0_sample.comp
@@ -0,0 +1,77 @@
1#version 460
2// A compute shader that samples through set 0 the way translated shaders do, written to the translator's runtime
3// contract (docs/design.md, "User data", "Xbox GPU addresses" and "Images"; the lookup is tools/rdna2spirv.py
4// desc_probe), standing in for a translated one in d3d12_set0_compute_test. Its root arguments:
5// s0 a root constant: where the view slot to sample starts inside the view table, in dwords
6// s1 a root constant: the first element of the output it writes
7// s2:s3 a root UAV: the console VA of the output buffer
8// s4:s5 a descriptor table of views: a T# in the first eight dwords of each slot
9// s6:s7 a descriptor table of samplers: the S# of its first slot, four dwords
10// It loads the T# and the S# from the tables at heap base + VA, looks both up in the hash table at set 0 binding 2
11// (FNV-1a over the eight key dwords, eight probes, a miss is index 0; an S# key is its four dwords and four of
12// 0xFFFFFFFF), samples the 2D image array at binding 0 with the sampler array at binding 1, and writes
13// out[s1 + i] = the texel at ((i % 8) + 0.5, (i / 8) + 0.5) / 8 + (1, 0), as RGBA8 with red in the low byte.
14// The whole tile to the right in U: a sampler that wraps in U gives the texel at the same place in the image, one
15// that clamps gives the image's right edge. So the result depends on the S# as well as on the T#.
16// Set 0 is the device's bindless set. The D3D12 layer has it in the pipeline layout and binds it at the dispatch,
17// because the index lists bindings for this shader; nothing else in the test binds it.
18#extension GL_EXT_nonuniform_qualifier : require
19#extension GL_EXT_buffer_reference : require
20#extension GL_EXT_buffer_reference_uvec2 : require
21
22layout(local_size_x = 64) in;
23
24layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words {
25 uint w[];
26};
27
28layout(push_constant) uniform UserData {
29 uint s[32];
30 uvec2 heap_base;
31 uvec2 code_base;
32} pc;
33
34layout(set = 0, binding = 0) uniform texture2D images[];
35layout(set = 0, binding = 1) uniform sampler samplers[];
36layout(set = 0, binding = 2, std430) readonly buffer DescriptorMap {
37 uint map[]; // mask, then 10 uints per slot: key[8], index, pad
38};
39
40uvec2 add64(uvec2 a, uvec2 b) {
41 uint carry;
42 const uint low = uaddCarry(a.x, b.x, carry);
43 return uvec2(low, a.y + b.y + carry);
44}
45
46Words at(uvec2 va) {
47 return Words(add64(pc.heap_base, va));
48}
49
50uint lookup(uint key[8]) {
51 uint h = 2166136261u;
52 for (int i = 0; i < 8; ++i) h = (h ^ key[i]) * 16777619u;
53 const uint mask = map[0];
54 for (uint k = 0; k < 8; ++k) {
55 const uint slot = 1 + ((h + k) & mask) * 10;
56 bool same = true;
57 for (int i = 0; i < 8; ++i) same = same && map[slot + i] == key[i];
58 if (same) return map[slot + 8];
59 }
60 return 0;
61}
62
63void main() {
64 const uint i = gl_GlobalInvocationID.x;
65 Words views = at(uvec2(pc.s[4], pc.s[5]));
66 Words sampler_table = at(uvec2(pc.s[6], pc.s[7]));
67 uint image_key[8], sampler_key[8];
68 for (int k = 0; k < 8; ++k) {
69 image_key[k] = views.w[pc.s[0] + k];
70 sampler_key[k] = k < 4 ? sampler_table.w[k] : 0xffffffffu;
71 }
72 const uint image = lookup(image_key), smp = lookup(sampler_key);
73 const vec2 uv = (vec2(i % 8, i / 8) + 0.5) / 8.0 + vec2(1.0, 0.0);
74 const vec4 texel = textureLod(sampler2D(images[image], samplers[smp]), uv, 0.0);
75 Words result = at(uvec2(pc.s[2], pc.s[3]));
76 result.w[pc.s[1] + i] = packUnorm4x8(texel);
77}
diff --git a/runtime/test/glsl/cs_sg_probe.comp b/runtime/test/glsl/cs_sg_probe.comp
new file mode 100644
index 000000000..921cf1a49
--- /dev/null
+++ b/runtime/test/glsl/cs_sg_probe.comp
@@ -0,0 +1,29 @@
1#version 460
2// A compute shader written to the translator's runtime contract that stores the subgroup size the driver ran it
3// with (gl_SubgroupSize) in out[0], for d3d12_subgroup_test. s0:s1 is a root UAV: the console VA of the output.
4#extension GL_EXT_buffer_reference : require
5#extension GL_EXT_buffer_reference_uvec2 : require
6#extension GL_KHR_shader_subgroup_basic : require
7
8layout(local_size_x = 64) in;
9
10layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words {
11 uint w[];
12};
13
14layout(push_constant) uniform UserData {
15 uint s[32];
16 uvec2 heap_base;
17 uvec2 code_base;
18} pc;
19
20uvec2 add64(uvec2 a, uvec2 b) {
21 uint carry;
22 const uint low = uaddCarry(a.x, b.x, carry);
23 return uvec2(low, a.y + b.y + carry);
24}
25
26void main() {
27 Words out_words = Words(add64(pc.heap_base, uvec2(pc.s[0], pc.s[1])));
28 if (gl_LocalInvocationIndex == 0u) out_words.w[0] = gl_SubgroupSize;
29}
diff --git a/runtime/test/glsl/cs_user_data.comp b/runtime/test/glsl/cs_user_data.comp
index a932cc086..82779ccb1 100644
--- a/runtime/test/glsl/cs_user_data.comp
+++ b/runtime/test/glsl/cs_user_data.comp
@@ -36,8 +36,20 @@ Words at(uvec2 va) {
36void main() { 36void main() {
37 const uint i = gl_GlobalInvocationID.x; 37 const uint i = gl_GlobalInvocationID.x;
38 Words table = at(uvec2(pc.s[4], pc.s[5])); 38 Words table = at(uvec2(pc.s[4], pc.s[5]));
39 Words result = at(uvec2(pc.s[2], pc.s[3]));
40 if (pc.s[1] == 0u) {
41 // CBV V# mode: table holds a 16-byte GFX10 raw buffer descriptor written by CreateConstantBufferView.
42 const uint num_records = table.w[2];
43 const uint byte_off = pc.s[0] + i * 4u;
44 if (byte_off + 4u <= num_records) {
45 Words cbv = at(uvec2(table.w[0], table.w[1] & 0xFFFFu));
46 result.w[i] = cbv.w[byte_off >> 2u];
47 } else {
48 result.w[i] = 0u;
49 }
50 return;
51 }
39 Words constants = at(uvec2(table.w[0], table.w[1])); 52 Words constants = at(uvec2(table.w[0], table.w[1]));
40 Words code = at(pc.code_base); 53 Words code = at(pc.code_base);
41 Words result = at(uvec2(pc.s[2], pc.s[3]));
42 result.w[i] = pc.s[0] + pc.s[1] * i + constants.w[i % 4] + code.w[1]; 54 result.w[i] = pc.s[0] + pc.s[1] * i + constants.w[i % 4] + code.w[1];
43} 55}
diff --git a/runtime/test/glsl/ps_sg_probe.frag b/runtime/test/glsl/ps_sg_probe.frag
new file mode 100644
index 000000000..7b4f74e1a
--- /dev/null
+++ b/runtime/test/glsl/ps_sg_probe.frag
@@ -0,0 +1,11 @@
1#version 460
2// A pixel shader that outputs the subgroup size the driver ran it with, (0x40000000 | gl_SubgroupSize, 0x40000000 |
3// gl_SubgroupInvocationID, ...) as float bit patterns (the or keeps them normal floats), for d3d12_subgroup_test.
4#extension GL_KHR_shader_subgroup_basic : require
5
6layout(location = 0) out vec4 target;
7
8void main() {
9 target = uintBitsToFloat(uvec4(0x40000000u | gl_SubgroupSize, 0x40000000u | gl_SubgroupInvocationID, 0x40000000u,
10 0x40000000u));
11}
diff --git a/runtime/test/glsl/vs_sg_fullscreen.vert b/runtime/test/glsl/vs_sg_fullscreen.vert
new file mode 100644
index 000000000..80e4b203a
--- /dev/null
+++ b/runtime/test/glsl/vs_sg_fullscreen.vert
@@ -0,0 +1,6 @@
1#version 460
2// One triangle that covers the whole viewport, from gl_VertexIndex alone, for d3d12_subgroup_test.
3void main() {
4 const vec2 p = vec2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2));
5 gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
6}
diff --git a/runtime/test/process_cmdline_test.cpp b/runtime/test/process_cmdline_test.cpp
index 4c78835bb..8f35a8ef7 100644
--- a/runtime/test/process_cmdline_test.cpp
+++ b/runtime/test/process_cmdline_test.cpp
@@ -1,10 +1,14 @@
1// The process shim's command line round-trips: what GetCommandLineW says must parse with CommandLineToArgvW (the 1// The process shim's command line round-trips: what GetCommandLineW says must parse with CommandLineToArgvW (the
2// documented rules the CRT's argv parser shares) back to the __wargv the shim hands out, and __wargv must hold what 2// documented rules the CRT's argv parser shares) back to the __wargv the shim hands out, and __wargv must hold what
3// main.cpp passed, whatever the system code page (RT-84). No game files. 3// main.cpp passed, whatever the system code page (RT-84). The WinMain line (lpCmdLine) is the game's too, and the
4// command line and ExitProcess are served under kernelbase.dll and the API-set names as well as kernel32.dll.
5// No game files.
4#include <windows.h> 6#include <windows.h>
5#include <shellapi.h> 7#include <shellapi.h>
6 8
7#include <cstdio> 9#include <cstdio>
10#include <cstring>
11#include <cwchar>
8#include <string> 12#include <string>
9#include <vector> 13#include <vector>
10 14
@@ -54,6 +58,60 @@ void check_non_ascii(const std::wstring& want, const char* what) {
54 ++failures; 58 ++failures;
55 } 59 }
56} 60}
61
62// An executable can import GetCommandLineA/W and ExitProcess from kernel32.dll, kernelbase.dll or the API set its
63// umbrella library names, and the loader matches the DLL name exactly: every name must hand out the same shim.
64void check_import_names() {
65 for (const char* dll : {"kernelbase.dll", "api-ms-win-core-processenvironment-l1-1-0.dll"})
66 for (const char* name : {"GetCommandLineA", "GetCommandLineW"}) {
67 void* fn = rt::shims::find(dll, name);
68 if (!fn || fn != rt::shims::find("kernel32.dll", name)) {
69 std::fprintf(stderr, "FAIL %s!%s is not the kernel32.dll shim\n", dll, name);
70 ++failures;
71 }
72 }
73 for (const char* dll : {"kernelbase.dll", "api-ms-win-core-processthreads-l1-1-0.dll"}) {
74 void* fn = rt::shims::find(dll, "ExitProcess");
75 if (!fn || fn != rt::shims::find("kernel32.dll", "ExitProcess")) {
76 std::fprintf(stderr, "FAIL %s!ExitProcess is not the kernel32.dll shim\n", dll);
77 ++failures;
78 }
79 }
80 for (const char* dll : {"api-ms-win-crt-runtime-l1-1-0.dll", "ucrtbase.dll", "ucrtbased.dll"})
81 for (const char* name : {"_get_narrow_winmain_command_line", "_get_wide_winmain_command_line"})
82 if (!rt::shims::find(dll, name)) {
83 std::fprintf(stderr, "FAIL %s!%s is not shimmed\n", dll, name);
84 ++failures;
85 }
86}
87
88// lpCmdLine as the CRT's WinMain startup gets it from _get_wide/_get_narrow_winmain_command_line: the game's command
89// line after the program name and the blanks that follow it (the narrow one in the ANSI code page).
90void check_winmain(const std::wstring& program, const std::vector<std::wstring>& args, const wchar_t* want,
91 const char* what) {
92 rt::process::set_command_line(program, args);
93 using Wide = wchar_t*(__cdecl*)();
94 using Narrow = char*(__cdecl*)();
95 for (const char* dll : {"api-ms-win-crt-runtime-l1-1-0.dll", "ucrtbase.dll"}) {
96 const auto wide_fn = reinterpret_cast<Wide>(rt::shims::find(dll, "_get_wide_winmain_command_line"));
97 const auto narrow_fn = reinterpret_cast<Narrow>(rt::shims::find(dll, "_get_narrow_winmain_command_line"));
98 if (!wide_fn || !narrow_fn) continue; // check_import_names has reported the missing shim
99 const wchar_t* wide = wide_fn();
100 const char* line = narrow_fn();
101 char expected[256] = {};
102 WideCharToMultiByte(CP_ACP, 0, want, -1, expected, sizeof(expected), nullptr, nullptr);
103 if (!wide || std::wcscmp(wide, want) != 0) {
104 std::fwprintf(stderr, L"FAIL %hs (%hs): the wide WinMain line is [%ls], want [%ls]\n", what, dll,
105 wide ? wide : L"(null)", want);
106 ++failures;
107 }
108 if (!line || std::strcmp(line, expected) != 0) {
109 std::fprintf(stderr, "FAIL %s (%s): the narrow WinMain line is [%s], want [%s]\n", what, dll,
110 line ? line : "(null)", expected);
111 ++failures;
112 }
113 }
114}
57} // namespace 115} // namespace
58 116
59int main() { 117int main() {
@@ -67,8 +125,16 @@ int main() {
67 // Greek, Cyrillic and CJK together: no single-byte code page holds all of them, so this covers every PC. 125 // Greek, Cyrillic and CJK together: no single-byte code page holds all of them, so this covers every PC.
68 check_non_ascii(L"\u0394\u0416\u6F22 x", "an argument outside any single-byte code page"); 126 check_non_ascii(L"\u0394\u0416\u6F22 x", "an argument outside any single-byte code page");
69 127
128 check_import_names();
129 check_winmain(L"game.exe", {L"-foo", L"with space"}, L"-foo \"with space\"", "arguments after a plain name");
130 check_winmain(L"C:\\My Games\\game.exe", {L"-x"}, L"-x", "a quoted program name with a space");
131 check_winmain(L"game.exe", {}, L"", "no arguments");
132 // A byte above 0x7f in the narrow program name is part of the name, not the end of it.
133 check_winmain(L"caf\u00e9.exe", {L"-x"}, L"-x", "a non-ASCII program name");
134
70 if (failures) return 1; 135 if (failures) return 1;
71 std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u)\n", 136 std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u); "
137 "the WinMain line and the kernelbase/API-set names are the game's\n",
72 GetACP()); 138 GetACP());
73 return 0; 139 return 0;
74} 140}
diff --git a/runtime/test/queue_proxy_test.cpp b/runtime/test/queue_proxy_test.cpp
index 23a550685..69c1c26bd 100644
--- a/runtime/test/queue_proxy_test.cpp
+++ b/runtime/test/queue_proxy_test.cpp
@@ -33,6 +33,7 @@
33#include <cstring> 33#include <cstring>
34#include <cwchar> 34#include <cwchar>
35#include <iterator> 35#include <iterator>
36#include <mutex>
36#include <string> 37#include <string>
37#include <system_error> 38#include <system_error>
38#include <thread> 39#include <thread>
@@ -822,29 +823,37 @@ ChildRun run_process(const wchar_t* exe, const wchar_t* arguments, DWORD limit_m
822 RunnerFault fault = RunnerFault::none) { 823 RunnerFault fault = RunnerFault::none) {
823 ChildRun run; 824 ChildRun run;
824 std::wstring command = L"\"" + std::wstring(exe) + L"\" " + arguments; 825 std::wstring command = L"\"" + std::wstring(exe) + L"\" " + arguments;
825 SECURITY_ATTRIBUTES inherit{sizeof(inherit), nullptr, TRUE}; 826 // Both ends are made uninheritable. The write end becomes inheritable only while the start lock is held, just for
827 // its own child's CreateProcessW: children are started from several threads at once (check_differential), and a
828 // write end inheritable at any other time would also go to a sibling started meanwhile, which would then keep this
829 // pipe open after this child ended.
826 HANDLE read_end = nullptr, write_end = nullptr; 830 HANDLE read_end = nullptr, write_end = nullptr;
827 if (fault == RunnerFault::pipe) SetLastError(ERROR_NOT_ENOUGH_MEMORY); 831 if (fault == RunnerFault::pipe) SetLastError(ERROR_NOT_ENOUGH_MEMORY);
828 if (fault == RunnerFault::pipe || !CreatePipe(&read_end, &write_end, &inherit, 0)) { 832 if (fault == RunnerFault::pipe || !CreatePipe(&read_end, &write_end, nullptr, 0)) {
829 report_runner_error("CreatePipe"); 833 report_runner_error("CreatePipe");
830 return run; 834 return run;
831 } 835 }
832 if (!SetHandleInformation(read_end, HANDLE_FLAG_INHERIT, 0)) {
833 report_runner_error("SetHandleInformation");
834 CloseHandle(read_end);
835 CloseHandle(write_end);
836 return run;
837 }
838 STARTUPINFOW startup{sizeof(startup)}; 836 STARTUPINFOW startup{sizeof(startup)};
839 startup.dwFlags = STARTF_USESTDHANDLES; 837 startup.dwFlags = STARTF_USESTDHANDLES;
840 startup.hStdOutput = write_end; 838 startup.hStdOutput = write_end;
841 startup.hStdError = GetStdHandle(STD_ERROR_HANDLE); 839 startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
842 startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE); 840 startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
843 PROCESS_INFORMATION process{}; 841 PROCESS_INFORMATION process{};
844 const BOOL started = 842 BOOL started = FALSE;
845 CreateProcessW(exe, command.data(), nullptr, nullptr, TRUE, 0, nullptr, nullptr, &startup, &process); 843 DWORD start_error = 0;
846 const DWORD start_error = GetLastError(); 844 {
847 CloseHandle(write_end); // the child holds the only write end now: the reader sees the pipe end when it is gone 845 static std::mutex start_lock;
846 const std::lock_guard<std::mutex> hold(start_lock);
847 if (!SetHandleInformation(write_end, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
848 report_runner_error("SetHandleInformation");
849 CloseHandle(read_end);
850 CloseHandle(write_end);
851 return run;
852 }
853 started = CreateProcessW(exe, command.data(), nullptr, nullptr, TRUE, 0, nullptr, nullptr, &startup, &process);
854 start_error = GetLastError();
855 CloseHandle(write_end); // the child holds the only write end now: the reader sees the pipe end when it is gone
856 }
848 if (!started) { 857 if (!started) {
849 std::fprintf(stderr, "child runner: CreateProcessW \"%ls\" failed (error %lu)\n", exe, start_error); 858 std::fprintf(stderr, "child runner: CreateProcessW \"%ls\" failed (error %lu)\n", exe, start_error);
850 CloseHandle(read_end); 859 CloseHandle(read_end);
@@ -1044,14 +1053,49 @@ int check_child_runner() {
1044 return 0; 1053 return 0;
1045} 1054}
1046 1055
1056// How many differential children run at once: LEONIDA_QUEUE_PROXY_JOBS when set (1 = one after another, as before),
1057// else half the logical processors, from 1 to 8. Each child pays its own device start-up (about 5 s each on an AMD
1058// RDNA2 iGPU, TEST-242), and that waiting is what running them side by side hides.
1059unsigned differential_jobs() {
1060 char value[16] = {};
1061 const DWORD length = GetEnvironmentVariableA("LEONIDA_QUEUE_PROXY_JOBS", value, sizeof(value));
1062 if (length > 0 && length < sizeof(value)) { // set, and short enough to be a number
1063 const unsigned long jobs = std::strtoul(value, nullptr, 10);
1064 if (jobs >= 1 && jobs <= 64) return static_cast<unsigned>(jobs);
1065 }
1066 const unsigned half = std::thread::hardware_concurrency() / 2;
1067 return half < 1 ? 1 : half > 8 ? 8 : half;
1068}
1069
1047// Each case, in a child process for the real object and in another for the proxy: the same HRESULT, the device 1070// Each case, in a child process for the real object and in another for the proxy: the same HRESULT, the device
1048// removed (or not) alike, and no validation errors. A case the real runtime faults on is reported, not compared. 1071// removed (or not) alike, and no validation errors. A case the real runtime faults on is reported, not compared.
1072// The children run differential_jobs() at a time; the results are judged afterwards in case order, so the report is
1073// the same as one child after another would give (a proxy child whose real one faulted is run but not judged).
1049int check_differential(const Backend& b) { 1074int check_differential(const Backend& b) {
1050 const char* label = b.label; 1075 const char* label = b.label;
1051 int compared = 0, faulting = 0; 1076 int compared = 0, faulting = 0;
1052 for (int i = 0; i < static_cast<int>(std::size(kDiffCases)); ++i) { 1077 constexpr int kCases = static_cast<int>(std::size(kDiffCases));
1078 std::vector<ChildResult> results(2 * kCases); // [2 * case] real, [2 * case + 1] proxy
1079 {
1080 std::atomic<int> next{0};
1081 const auto work = [&] {
1082 for (int job; (job = next.fetch_add(1)) < 2 * kCases;)
1083 results[job] = run_child(b.kind, job / 2, job % 2 == 1);
1084 };
1085 const unsigned jobs = differential_jobs();
1086 std::vector<std::thread> pool;
1087 try {
1088 for (unsigned t = 1; t < jobs; ++t) pool.emplace_back(work);
1089 } catch (const std::system_error& e) { // fewer helpers; this thread still runs every job left
1090 std::fprintf(stderr, "%s: %zu of %u differential runner threads (%s)\n", label, pool.size() + 1, jobs,
1091 e.what());
1092 }
1093 work();
1094 for (std::thread& t : pool) t.join();
1095 }
1096 for (int i = 0; i < kCases; ++i) {
1053 const char* name = kDiffCases[i].name; 1097 const char* name = kDiffCases[i].name;
1054 const ChildResult want = run_child(b.kind, i, false); 1098 const ChildResult& want = results[2 * i];
1055 if (!want.ok) { 1099 if (!want.ok) {
1056 std::fprintf(stderr, "%s: %s: the real-object child did not report\n", label, name); 1100 std::fprintf(stderr, "%s: %s: the real-object child did not report\n", label, name);
1057 return 1; 1101 return 1;
@@ -1061,7 +1105,7 @@ int check_differential(const Backend& b) {
1061 ++faulting; 1105 ++faulting;
1062 continue; 1106 continue;
1063 } 1107 }
1064 const ChildResult got = run_child(b.kind, i, true); 1108 const ChildResult& got = results[2 * i + 1];
1065 if (!got.ok || !got.ran || got.hr != want.hr || got.removed != want.removed || got.validation || 1109 if (!got.ok || !got.ran || got.hr != want.hr || got.removed != want.removed || got.validation ||
1066 want.validation) { 1110 want.validation) {
1067 std::fprintf(stderr, 1111 std::fprintf(stderr,
diff --git a/runtime/test/resource_tiling_test.cpp b/runtime/test/resource_tiling_test.cpp
index 4634f6830..4e0f39d48 100644
--- a/runtime/test/resource_tiling_test.cpp
+++ b/runtime/test/resource_tiling_test.cpp
@@ -6,6 +6,7 @@
6#include "../src/resource_tiling.h" 6#include "../src/resource_tiling.h"
7 7
8#include <cstdio> 8#include <cstdio>
9#include <tuple>
9 10
10#define CHECK(condition) do { \ 11#define CHECK(condition) do { \
11 if (!(condition)) { \ 12 if (!(condition)) { \
@@ -176,6 +177,20 @@ int main() {
176 } 177 }
177 } 178 }
178 179
180 // 2D 4x MSAA: tile shape divides by 4 in texels, 1 mip only, unsupported sample counts fail.
181 for (const auto& ms : {std::tuple{1u, 128u, 128u, 4u}, std::tuple{2u, 128u, 64u, 8u},
182 std::tuple{4u, 64u, 64u, 16u}, std::tuple{8u, 64u, 32u, 32u},
183 std::tuple{16u, 32u, 32u, 64u}}) {
184 const auto [bytes, sw, sh, want_tiles] = ms;
185 CHECK(resource_tiling({TiledKind::texture2d, 256, 256, 1, 1, bytes, 1, 4}, t));
186 CHECK(t.shape.width == sw && t.shape.height == sh && t.shape.depth == 1 && t.total_tiles == want_tiles);
187 }
188 CHECK(resource_tiling({TiledKind::texture2d, 64, 64, 1, 1, 1, 1, 4}, t) && t.total_tiles == 1);
189 CHECK(!resource_tiling({TiledKind::texture2d, 256, 256, 1, 1, 4, 1, 2}, t));
190 CHECK(!resource_tiling({TiledKind::texture2d, 256, 256, 1, 1, 4, 1, 8}, t));
191 CHECK(!resource_tiling({TiledKind::texture2d, 256, 256, 1, 2, 4, 1, 4}, t));
192 CHECK(!resource_tiling({TiledKind::texture3d, 64, 64, 16, 1, 4, 1, 4}, t));
193
179 // Element sizes that have no tile shape, and empty descriptions. 194 // Element sizes that have no tile shape, and empty descriptions.
180 CHECK(!resource_tiling({TiledKind::texture2d, 64, 64, 1, 1, 12, 1}, t)); 195 CHECK(!resource_tiling({TiledKind::texture2d, 64, 64, 1, 1, 12, 1}, t));
181 CHECK(!resource_tiling({TiledKind::texture2d, 64, 64, 1, 0, 4, 1}, t)); 196 CHECK(!resource_tiling({TiledKind::texture2d, 64, 64, 1, 0, 4, 1}, t));
diff --git a/runtime/test/root_signature_oracle_test.cpp b/runtime/test/root_signature_oracle_test.cpp
index d0794ddbd..261004328 100644
--- a/runtime/test/root_signature_oracle_test.cpp
+++ b/runtime/test/root_signature_oracle_test.cpp
@@ -120,6 +120,48 @@ int main() {
120 const PackResult packed = pack(model); 120 const PackResult packed = pack(model);
121 check(packed.ok && packed.dword_count == 6, "oracle model packs to 6 dwords"); 121 check(packed.ok && packed.dword_count == 6, "oracle model packs to 6 dwords");
122 122
123 // The descriptor count and range offset are independent. The final SRV range is unbounded
124 // and begins immediately after the fixed range, but the whole table still occupies one GPU address.
125 {
126 D3D12_DESCRIPTOR_RANGE1 ranges[] = {
127 {D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 2, 3, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC, 0},
128 {D3D12_DESCRIPTOR_RANGE_TYPE_SRV, UINT32_MAX, 7, 1,
129 D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
130 };
131 D3D12_ROOT_PARAMETER1 table_and_constants[2] = {{}, params[0]};
132 auto& table = table_and_constants[0];
133 table.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
134 table.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
135 table.DescriptorTable = {2, ranges};
136 const auto unbounded_desc = make_desc(table_and_constants, 2);
137 Blobs unbounded;
138 const HRESULT result =
139 D3D12SerializeVersionedRootSignature(&unbounded_desc, &unbounded.blob, &unbounded.error);
140 check(result == S_OK, "Microsoft serializer accepts an unbounded SRV range");
141 RootSignature table_model;
142 if (SUCCEEDED(result) && unbounded.blob &&
143 parse_blob(unbounded.blob, table_model) && table_model.params.size() == 2 &&
144 table_model.params[0].ranges.size() == 2) {
145 const auto& fixed = table_model.params[0].ranges[0];
146 const auto& tail = table_model.params[0].ranges[1];
147 check(table_model.params[0].type == ParamType::Table &&
148 table_model.params[0].visibility == Visibility::Pixel &&
149 fixed.num_descriptors == 2 && fixed.offset_in_table == 0 &&
150 tail.range_type == D3D12_DESCRIPTOR_RANGE_TYPE_SRV &&
151 tail.num_descriptors == UINT32_MAX && tail.base_shader_register == 7 &&
152 tail.register_space == 1 && tail.flags == D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE &&
153 tail.offset_in_table == kRangeOffsetAppend,
154 "fixed and unbounded SRV ranges survive native serialization");
155 const auto table_pack = pack(table_model);
156 check(table_pack.ok && table_pack.d3d12_cost == 5 && table_pack.dword_count == 6 &&
157 table_pack.provenance.size() == 6 &&
158 table_pack.provenance[1].param_index == 0 && table_pack.provenance[2].param_index == 1,
159 "unbounded SRV table occupies two SGPRs before the following constants");
160 } else {
161 check(false, "native unbounded table parses with two ranges and two parameters");
162 }
163 }
164
123 // Static samplers, one signature per version: every field round-trips through the real serializer, and 1.2 165 // Static samplers, one signature per version: every field round-trips through the real serializer, and 1.2
124 // adds D3D12_STATIC_SAMPLER_DESC1::Flags (a 14th dword) to each sampler record. Each also carries a table and a 166 // adds D3D12_STATIC_SAMPLER_DESC1::Flags (a 14th dword) to each sampler record. Each also carries a table and a
125 // root descriptor, so the 1.1/1.2 descriptor and range flags sit between the samplers and the header. 167 // root descriptor, so the 1.1/1.2 descriptor and range flags sit between the samplers and the header.
diff --git a/runtime/test/shader_library_corpus_test.cpp b/runtime/test/shader_library_corpus_test.cpp
new file mode 100644
index 000000000..6e3e6be94
--- /dev/null
+++ b/runtime/test/shader_library_corpus_test.cpp
@@ -0,0 +1,159 @@
1// The runtime's shader lookup (src/shader_library.h) over a translated corpus from the player's own copy.
2//
3// LEONIDA_SHADERS=<work>/shaders/spirv the translator's output (index.json and the .spv modules)
4// LEONIDA_SHADER_DXBC=<work>/shaders/dxbc optional; the carved DXBC containers, default <spirv>/../dxbc
5//
6// For every container the test does what d3d12_vulkan_device.cpp does with a PSO's bytecode: inflate the FSSM program
7// from the DXIL/XDAT/XBCH entry, hash it and look it up under the container's stage. The stage comes from the DXIL
8// part's program header, not from index.json. Every container has to resolve to its own entry (the one named after
9// the file, or one of its `~N` duplicates) with a readable SPIR-V module, and every index entry has to be reached by
10// a container. Containers with more than one 0x0D payload are counted, and their first payload must not stand in for
11// the last: that is the rule fssm_program follows, so a regression to the first payload fails here.
12//
13// Without LEONIDA_SHADERS it prints SKIP and exits 77 (SKIP_RETURN_CODE). It reads the work folder in place, writes
14// nothing, and prints counts; on a failure it names at most a few shaders, which stay on your machine.
15#include "../src/shader_library.h"
16
17#include <cstdio>
18#include <cstdlib>
19#include <filesystem>
20#include <fstream>
21#include <set>
22#include <string>
23#include <vector>
24
25namespace {
26
27namespace fs = std::filesystem;
28
29std::string env(const char* name) {
30 const char* value = std::getenv(name);
31 return value ? value : "";
32}
33
34std::vector<std::uint8_t> read_file(const fs::path& path) {
35 std::ifstream file(path, std::ios::binary);
36 return {std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
37}
38
39std::uint32_t u32(std::span<const std::uint8_t> data, std::size_t at) {
40 if (at + 4 > data.size()) return 0;
41 std::uint32_t v;
42 std::memcpy(&v, data.data() + at, 4);
43 return v;
44}
45
46// The stage the DXIL program header names (DxilProgramHeader::ProgramVersion, kind in bits 31:16; D3D12's
47// D3D12_SHADER_VERSION_TYPE), in the translator's spelling. Empty for a kind the corpus has no translation for.
48std::string dxil_stage(std::span<const std::uint8_t> container) {
49 const auto dxil = leonida::dxbc_part(container, "DXIL");
50 if (dxil.size() < 4) return {};
51 switch (u32(dxil, 0) >> 16) {
52 case 0: return "ps";
53 case 1: return "vs";
54 case 2: return "gs";
55 case 5: return "cs";
56 case 13: return "ms";
57 default: return {};
58 }
59}
60
61// Every 0x0D (XBCH) payload of the container's XDAT table, in table order, inflated. fssm_program keeps the last.
62std::vector<std::vector<std::uint8_t>> all_programs(std::span<const std::uint8_t> container) {
63 std::vector<std::vector<std::uint8_t>> out;
64 const auto dxil = leonida::dxbc_part(container, "DXIL");
65 std::size_t xdat = 0;
66 while (xdat + 4 <= dxil.size() && std::memcmp(dxil.data() + xdat, "XDAT", 4) != 0) ++xdat;
67 const std::uint32_t count = u32(dxil, xdat + 4);
68 for (std::uint32_t i = 0; i < count; ++i) {
69 const std::size_t entry = xdat + 12 + 12 * std::size_t(i);
70 if (entry + 12 > dxil.size()) break;
71 const std::uint32_t tag = u32(dxil, entry), offset = u32(dxil, entry + 4), size = u32(dxil, entry + 8);
72 if (tag != 0x0d || size < 24 || std::size_t(offset) + size > dxil.size()) continue;
73 const auto blob = dxil.subspan(offset, size);
74 std::vector<std::uint8_t> program;
75 if (std::memcmp(blob.data(), "XBCH", 4) == 0 && leonida::zlib_inflate(blob.subspan(24), program, u32(blob, 16)))
76 out.push_back(std::move(program));
77 }
78 return out;
79}
80
81bool own_entry(const leonida::ShaderEntry& entry, const std::string& stem) {
82 return entry.name == stem || entry.name.rfind(stem + "~", 0) == 0;
83}
84
85} // namespace
86
87int main() {
88 const std::string spirv_dir = env("LEONIDA_SHADERS");
89 if (spirv_dir.empty()) {
90 std::printf("SKIP (no translated corpus: set LEONIDA_SHADERS to <work>/shaders/spirv)\n");
91 return 77;
92 }
93 std::string dxbc_dir = env("LEONIDA_SHADER_DXBC");
94 if (dxbc_dir.empty()) dxbc_dir = (fs::path(spirv_dir) / ".." / "dxbc").lexically_normal().string();
95
96 int failures = 0, named = 0;
97 const auto fail = [&](const std::string& what, const std::string& shader) {
98 ++failures;
99 if (named++ < 8) std::fprintf(stderr, "FAIL %s: %s\n", what.c_str(), shader.c_str());
100 };
101
102 leonida::ShaderLibrary library;
103 std::string error;
104 if (!library.load(spirv_dir, &error)) {
105 std::fprintf(stderr, "FAIL loading %s: %s\n", spirv_dir.c_str(), error.c_str());
106 return 1;
107 }
108 std::error_code ec;
109 if (!fs::is_directory(dxbc_dir, ec)) {
110 std::fprintf(stderr, "FAIL no DXBC folder %s (set LEONIDA_SHADER_DXBC)\n", dxbc_dir.c_str());
111 return 1;
112 }
113
114 std::size_t containers = 0, multi = 0;
115 std::set<std::string> reached;
116 for (const auto& item : fs::directory_iterator(dxbc_dir)) {
117 if (!item.is_regular_file() || item.path().extension() != ".dxbc") continue;
118 ++containers;
119 const std::string stem = item.path().stem().string();
120 const auto bytes = read_file(item.path());
121 const std::string stage = dxil_stage(bytes);
122 if (stage.empty()) {
123 fail("no shader stage in the DXIL program header", stem);
124 continue;
125 }
126 const auto program = leonida::fssm_program(bytes);
127 if (program.size() < 4 || std::memcmp(program.data(), "FSSM", 4) != 0) {
128 fail("no FSSM program", stem);
129 continue;
130 }
131 bool found = false;
132 for (const leonida::ShaderEntry* entry : library.candidates(stage, leonida::sha256_hex(program))) {
133 if (!own_entry(*entry, stem)) continue;
134 found = true;
135 reached.insert(entry->name);
136 if (library.spirv(*entry).empty()) fail("no SPIR-V module for", entry->name);
137 }
138 if (!found) fail("not found under its " + stage + " stage", stem);
139
140 // The 0x0D payloads that differ from the last: none of them may be what the index has for this container.
141 const auto programs = all_programs(bytes);
142 if (programs.empty() || programs.back() != program) fail("fssm_program is not the last 0x0D payload", stem);
143 bool differs = false;
144 for (std::size_t i = 0; i + 1 < programs.size(); ++i) {
145 if (programs[i] == program) continue;
146 differs = true;
147 for (const leonida::ShaderEntry* entry : library.candidates(stage, leonida::sha256_hex(programs[i])))
148 if (own_entry(*entry, stem)) fail("an earlier 0x0D payload is the indexed program", stem);
149 }
150 multi += differs;
151 }
152
153 if (containers == 0) fail("no .dxbc containers in", dxbc_dir);
154 if (reached.size() != library.size())
155 fail(std::to_string(library.size() - reached.size()) + " index entries reached by no container", spirv_dir);
156 std::printf("%zu containers, %zu index entries, %zu reached; %zu containers with more than one program; "
157 "%d failures\n", containers, library.size(), reached.size(), multi, failures);
158 return failures ? 1 : 0;
159}
diff --git a/runtime/test/shader_library_test.cpp b/runtime/test/shader_library_test.cpp
index 1fecf1205..49189f69c 100644
--- a/runtime/test/shader_library_test.cpp
+++ b/runtime/test/shader_library_test.cpp
@@ -194,6 +194,7 @@ int main() {
194 const auto dir = std::filesystem::temp_directory_path() / "leonida_shader_library_test"; 194 const auto dir = std::filesystem::temp_directory_path() / "leonida_shader_library_test";
195 std::filesystem::create_directories(dir); 195 std::filesystem::create_directories(dir);
196 const std::string hash = sha256_hex(skewed(600)); 196 const std::string hash = sha256_hex(skewed(600));
197 const std::string hash2 = sha256_hex(bytes("another program"));
197 { 198 {
198 std::ofstream index(dir / "index.json", std::ios::binary); 199 std::ofstream index(dir / "index.json", std::ios::binary);
199 index << "{\"cs_test\": {\"stage\": \"cs\", \"fssm_sha256\": \"" << hash 200 index << "{\"cs_test\": {\"stage\": \"cs\", \"fssm_sha256\": \"" << hash
@@ -208,6 +209,10 @@ int main() {
208 "{\"semantic\": \"TEXCOORD\", \"semantic_index\": 3, \"register\": -1, \"system_value\": 0, " 209 "{\"semantic\": \"TEXCOORD\", \"semantic_index\": 3, \"register\": -1, \"system_value\": 0, "
209 "\"component_type\": \"float\"}]},\n" 210 "\"component_type\": \"float\"}]},\n"
210 " \"ps_out\": {\"stage\": \"ps\", \"fssm_sha256\": \"" << hash << "\", \"outputs\": [0, 2]},\n" 211 " \"ps_out\": {\"stage\": \"ps\", \"fssm_sha256\": \"" << hash << "\", \"outputs\": [0, 2]},\n"
212 " \"ps_native\": {\"stage\": \"ps\", \"fssm_sha256\": \"" << hash2 << "\", \"wave64\": true, "
213 "\"subgroup_size\": 64},\n"
214 " \"cs_emulated\": {\"stage\": \"cs\", \"fssm_sha256\": \"" << hash2 << "\", \"wave64\": true, "
215 "\"subgroup_size\": null, \"wave64_exchange\": \"workgroup\"},\n"
211 " \"ps_unhashed\": {\"stage\": \"ps\", \"bindings\": []}}"; 216 " \"ps_unhashed\": {\"stage\": \"ps\", \"bindings\": []}}";
212 std::ofstream spv(dir / "cs_test.spv", std::ios::binary); 217 std::ofstream spv(dir / "cs_test.spv", std::ios::binary);
213 const std::uint32_t words[5] = {0x07230203, 0x00010500, 0, 1, 0}; 218 const std::uint32_t words[5] = {0x07230203, 0x00010500, 0, 1, 0};
@@ -215,7 +220,7 @@ int main() {
215 } 220 }
216 ShaderLibrary library; 221 ShaderLibrary library;
217 std::string error; 222 std::string error;
218 CHECK(library.load(dir.string(), &error) && library.size() == 4); 223 CHECK(library.load(dir.string(), &error) && library.size() == 6);
219 const ShaderEntry* vs = library.find("vs", hash); 224 const ShaderEntry* vs = library.find("vs", hash);
220 CHECK(vs && vs->input_signature.size() == 2 && vs->input_signature[0].semantic == "COLOR"); 225 CHECK(vs && vs->input_signature.size() == 2 && vs->input_signature[0].semantic == "COLOR");
221 CHECK(vs->input_signature[1].register_index == 2 && vs->input_signature[1].system_value == 6 && 226 CHECK(vs->input_signature[1].register_index == 2 && vs->input_signature[1].system_value == 6 &&
@@ -232,6 +237,13 @@ int main() {
232 CHECK(entry && entry->name == "cs_test" && entry->binding_count == 1 && entry->push_constant_bytes == 144); 237 CHECK(entry && entry->name == "cs_test" && entry->binding_count == 1 && entry->push_constant_bytes == 144);
233 CHECK(entry->local_size[0] == 64 && entry->uses_code_base && !entry->wave64); 238 CHECK(entry->local_size[0] == 64 && entry->uses_code_base && !entry->wave64);
234 CHECK(!library.find("ms", hash)); // no mesh shader with this hash 239 CHECK(!library.find("ms", hash)); // no mesh shader with this hash
240 // The subgroup fields of the index (wave64 / subgroup_size / wave64_exchange): absent, native and emulated.
241 CHECK(!entry->subgroup_size && entry->wave64_exchange.empty() && !entry->emulated());
242 const ShaderEntry* native = library.find("ps", hash2);
243 CHECK(native && native->wave64 && native->subgroup_size == 64 && !native->emulated());
244 const ShaderEntry* emulated = library.find("cs", hash2);
245 CHECK(emulated && emulated->wave64 && emulated->subgroup_size == 0 && emulated->wave64_exchange == "workgroup" &&
246 emulated->emulated());
235 CHECK(library.spirv(*entry).size() == 5); 247 CHECK(library.spirv(*entry).size() == 5);
236 CHECK(!library.load((dir / "missing").string(), &error) && !error.empty()); 248 CHECK(!library.load((dir / "missing").string(), &error) && !error.empty());
237 { 249 {
diff --git a/runtime/test/shaders/build.py b/runtime/test/shaders/build.py
index f7979ee69..c9796f244 100644
--- a/runtime/test/shaders/build.py
+++ b/runtime/test/shaders/build.py
@@ -135,6 +135,10 @@ def translate_tests(work, names):
135def main(): 135def main():
136 if len(sys.argv) < 2: 136 if len(sys.argv) < 2:
137 sys.exit(__doc__) 137 sys.exit(__doc__)
138 # The CMake test targets name the spirv-as/spirv-val folder here instead of passing a whole PATH, which the Visual
139 # Studio generator's command line can't carry intact (a PATH entry ending in a backslash escapes the next quote).
140 if os.environ.get("LEONIDA_SPIRV_TOOLS"):
141 os.environ["PATH"] = os.environ["LEONIDA_SPIRV_TOOLS"] + os.pathsep + os.environ.get("PATH", "")
138 out = Path(sys.argv[1]) 142 out = Path(sys.argv[1])
139 available = sorted({p.stem for p in Path(HERE).glob("*.asm")} | CLIP_CASES.keys()) 143 available = sorted({p.stem for p in Path(HERE).glob("*.asm")} | CLIP_CASES.keys())
140 names = sys.argv[2:] or available 144 names = sys.argv[2:] or available
diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py
index 5b4fa43c8..585d208e6 100644
--- a/runtime/test/shaders/check.py
+++ b/runtime/test/shaders/check.py
@@ -81,7 +81,7 @@ CS_SMEM = [0x5eed0024, 0x5eed0028, 0x5eed002c, 0x5eed0030, 0x5eed0010, 0x5eed001
81WAVE32_DUMPS = ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", 81WAVE32_DUMPS = ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute",
82 "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", "cs_w32_lds_u8_d16", "cs_bpermute32", 82 "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", "cs_w32_lds_u8_d16", "cs_bpermute32",
83 "cs_w32_partial_scmp", "cs_exec_const", "cs_w32_mask_imm", "cs_w32_int_ext", 83 "cs_w32_partial_scmp", "cs_exec_const", "cs_w32_mask_imm", "cs_w32_int_ext",
84 "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops") 84 "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_w32_sincos")
85# Wave32 lane-mask dumps: their EXEC/VCC masks and lane selects cover 32 lanes, so a device whose widest subgroup is 85# Wave32 lane-mask dumps: their EXEC/VCC masks and lane selects cover 32 lanes, so a device whose widest subgroup is
86# narrower (Mesa llvmpipe: 8) can't produce their words. They are skipped there, as ps_bitmask_perm is. They run with 86# narrower (Mesa llvmpipe: 8) can't produce their words. They are skipped there, as ps_bitmask_perm is. They run with
87# 32 lanes requested (WAVE32_LANE_ENV), as run_gpu_tests.py does: a device with a range like 8..32 (Intel ANV) may 87# 32 lanes requested (WAVE32_LANE_ENV), as run_gpu_tests.py does: a device with a range like 8..32 (Intel ANV) may
@@ -130,6 +130,8 @@ CS_DUMPS = [*CS_DPP, ("cs_store", CS_STORE), ("cs_smem_soffset_imm", CS_SMEM),
130 ("cs_wqm_w64", [20, 4, 12, 8, 1, 0, 15728895, 20]), ("cs_wqm_w32", [12, 1, 4, 0, 8, 15728880, 4, 32]), 130 ("cs_wqm_w64", [20, 4, 12, 8, 1, 0, 15728895, 20]), ("cs_wqm_w32", [12, 1, 4, 0, 8, 15728880, 4, 32]),
131 ("cs_bpermute32", [0, 50, 162, 99, 36, 218, 183, 15]), 131 ("cs_bpermute32", [0, 50, 162, 99, 36, 218, 183, 15]),
132 ("cs_w32_partial_scmp", [0, 1, 1, 0, 1, 1, 1, 1]), # a 20-thread wave32: s_cmp mask, -1 132 ("cs_w32_partial_scmp", [0, 1, 1, 0, 1, 1, 1, 1]), # a 20-thread wave32: s_cmp mask, -1
133 # SHADER-88: v_sin/v_cos reduce the angle in turns (a regression guard, tolerance 1e-3)
134 ("cs_w32_sincos", [1, 1, 1, 1, 1, 1]),
133 ("cs_wqm_w64_half", [11, 14, 0, 1, 6, 8, 12, 2]), 135 ("cs_wqm_w64_half", [11, 14, 0, 1, 6, 8, 12, 2]),
134 # SHADER-91: two s_barrier sites in wave-uniform branches meet like one barrier; wave 0 reads wave 3 136 # SHADER-91: two s_barrier sites in wave-uniform branches meet like one barrier; wave 0 reads wave 3
135 ("cs_barrier_divergent", [127, 126, 125, 124, 123, 122, 121, 120]), 137 ("cs_barrier_divergent", [127, 126, 125, 124, 123, 122, 121, 120]),
@@ -156,6 +158,22 @@ CMPX_CLASS_WORDS = [0xEEEEEEEE] * 3 + [0x22] + [0x11] * 4
156# cs_fmt_1010102.asm: descriptor loads, immediate-format load, raw input words and the two packed stores. 158# cs_fmt_1010102.asm: descriptor loads, immediate-format load, raw input words and the two packed stores.
157FMT_1010102_WORDS = [0, 0x3F800000, 0, 0x3F800000, 0x3F800000, 0, 0x3F800000, 0, 159FMT_1010102_WORDS = [0, 0x3F800000, 0, 0x3F800000, 0x3F800000, 0, 0x3F800000, 0,
158 0, 0x3F800000, 0, 0x3F800000, 0xC00FFC00, 0x003FF003, 0xE00003FF, 0xFFE00003] 160 0, 0x3F800000, 0, 0x3F800000, 0xC00FFC00, 0x003FF003, 0xE00003FF, 0xFFE00003]
161# cs_fmt_sint32.asm: hand-derived full-width and D16 load results, inputs, stores, and untouched words.
162FMT_SINT32_WORDS = [
163 0x80000000, 0x7FFFFFFF, 0x80000000, 1,
164 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 0x80000000,
165 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 17,
166 0x80000000, 0x7FFFFFFF, 0, 0,
167 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 0,
168 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 17,
169 0x7FFF8000, 0x0011FFFD, 0x7FFF8000, 0x0011FFFD,
170 0xFFFFFFFD, 0xFFFFFFFD, 0xEEEEEEEE, 0xEEEEEEEE,
171 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 17,
172 0x80000000, 0x7FFFFFFF, 0xEEEEEEEE, 0xEEEEEEEE,
173 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 0xEEEEEEEE,
174 0x80000000, 0x7FFFFFFF, 0xFFFFFFFD, 17,
175 0xFFFFFFFD, 0xFFFF8000, 0xFFFFFFFD, *[0xEEEEEEEE] * 13,
176]
159# cs_fmt_xy_xyz.asm (TEST-185): 12 xy/xyz loads, then the 9 store regions read back, as a Radeon 680M (gfx1035) gives 177# cs_fmt_xy_xyz.asm (TEST-185): 12 xy/xyz loads, then the 9 store regions read back, as a Radeon 680M (gfx1035) gives
160# them natively, with the updated UINT saturation case checked on gfx1036. Layout and rules in the .asm header. 178# them natively, with the updated UINT saturation case checked on gfx1036. Layout and rules in the .asm header.
161FMT_XY_XYZ_WORDS = [ 179FMT_XY_XYZ_WORDS = [
@@ -197,6 +215,9 @@ W64_EMULATED = os.environ.get("LEONIDA_W64_EMULATE") == "1"
197# LEONIDA_BARY_FALLBACK=1 (set for build.py too): a pixel shader that reads raw barycentrics was translated with 215# LEONIDA_BARY_FALLBACK=1 (set for build.py too): a pixel shader that reads raw barycentrics was translated with
198# --bary-fallback and is drawn through its pass-through geometry shader, <name>.bary_gs.spv. 216# --bary-fallback and is drawn through its pass-through geometry shader, <name>.bary_gs.spv.
199BARY_FALLBACK = os.environ.get("LEONIDA_BARY_FALLBACK") == "1" 217BARY_FALLBACK = os.environ.get("LEONIDA_BARY_FALLBACK") == "1"
218# LEONIDA_F16_INTERP_FALLBACK=1 (as build.py reads it): *_f16 interps were translated from decoded-half inputs, with no
219# PerVertexKHR inputs at all, so the translator refuses a computed I/J pair (ps_ij_computed) there.
220F16_HALVES = os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1"
200W64X_DUMPS = [("cs_dpp_w64", [1, 0, 3, 2, 5, 4, 7, 6]), 221W64X_DUMPS = [("cs_dpp_w64", [1, 0, 3, 2, 5, 4, 7, 6]),
201 ("cs_w64x_readlane", [121, 121, 16, 97, 16, 100, 100, 121]), 222 ("cs_w64x_readlane", [121, 121, 16, 97, 16, 100, 100, 121]),
202 ("cs_w64x_writelane", [4660, 77, 99, 2748, 0, 0, 4660, 99]), 223 ("cs_w64x_writelane", [4660, 77, 99, 2748, 0, 0, 4660, 99]),
@@ -236,6 +257,8 @@ PIXEL_BITS = {"ps_clip_color": (0x3e800000, 0x3f000000, 0x3f400000, 0x3f800000),
236 "ps_vcmpx_forms": (0xf05b2a48, 0xf05e8a12, 0xb174be18, 0x15550000), 257 "ps_vcmpx_forms": (0xf05b2a48, 0xf05e8a12, 0xb174be18, 0x15550000),
237 "ps_med3_mods": (0x3f800000, 0x40400000, 0x40c00000, 0x3f400000), 258 "ps_med3_mods": (0x3f800000, 0x40400000, 0x40c00000, 0x3f400000),
238 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), 259 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203),
260 "ps_scc_logic32": (0x0fff0fff, 0x000f000f, 0xf00ff00f, 0x36),
261 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16),
239 "ps_fma_literal": (0x41b80000, 0x41800000, 0x40e00000, 0x41a40000), 262 "ps_fma_literal": (0x41b80000, 0x41800000, 0x40e00000, 0x41a40000),
240 "ps_f64_mods": (0x40040000, 0x3ff00000, 0x3fe40000, 0x3ff00000), 263 "ps_f64_mods": (0x40040000, 0x3ff00000, 0x3fe40000, 0x3ff00000),
241 # f16 op_sel, partial writes, inline constants: words measured on RDNA2 hardware (.asm headers) 264 # f16 op_sel, partial writes, inline constants: words measured on RDNA2 hardware (.asm headers)
@@ -248,6 +271,8 @@ PIXEL_BITS = {"ps_clip_color": (0x3e800000, 0x3f000000, 0x3f400000, 0x3f800000),
248 "ps_f16_const": (0xaaaa3d00, 0x38005555, 0xaaaa3800, 0x3f000000), 271 "ps_f16_const": (0xaaaa3d00, 0x38005555, 0xaaaa3800, 0x3f000000),
249 "ps_f16_const2": (0x42003d00, 0x3d004200, 0xaaaabc00, 3), 272 "ps_f16_const2": (0x42003d00, 0x3d004200, 0xaaaabc00, 3),
250 "ps_f16_pack": (0x34003c00, 0x38003400, 0x34000000, 0x44004200), 273 "ps_f16_pack": (0x34003c00, 0x38003400, 0x34000000, 0x44004200),
274 # v_pack_b32_f16 neg/abs on the selected half: a sign flip / clear before packing (SHADER-260)
275 "ps_f16_pack_mods": (0x4400b400, 0xc4003400, 0x4400c200, 0xb400b400),
251 "ps_sff_imm": (2, 1, 20, 16), 276 "ps_sff_imm": (2, 1, 20, 16),
252 "ps_fnan_med3": (0x40a00000, 0xc0200000, 0xc0200000, 0x40600000), 277 "ps_fnan_med3": (0x40a00000, 0xc0200000, 0xc0200000, 0x40600000),
253 "ps_fnan_fract": (0x3f7fffff, 0x00003bff, 0xc0200000, 0xc0200000), 278 "ps_fnan_fract": (0x3f7fffff, 0x00003bff, 0xc0200000, 0xc0200000),
@@ -267,7 +292,13 @@ PIXEL_BITS = {"ps_clip_color": (0x3e800000, 0x3f000000, 0x3f400000, 0x3f800000),
267 "ps_vint_bits": (0xfffffffe, 0x40000000, 0x1e6a2c48, 0x000001d5), 292 "ps_vint_bits": (0xfffffffe, 0x40000000, 0x1e6a2c48, 0x000001d5),
268 "ps_vint_mul24": (0x13345678, 0xfffffffd, 0x00007fff, 0x0000ffff), 293 "ps_vint_mul24": (0x13345678, 0xfffffffd, 0x00007fff, 0x0000ffff),
269 "ps_vint_minmax": (0x7ffffffe, 0x80000001, 0x80000001, 0x7ffffffe), 294 "ps_vint_minmax": (0x7ffffffe, 0x80000001, 0x80000001, 0x7ffffffe),
270 "ps_vint_minmax3": (0xf0f0f0f0, 0xab800000, 0xf0f0f0f0, 0xab800000)} 295 "ps_vint_minmax3": (0xf0f0f0f0, 0xab800000, 0xf0f0f0f0, 0xab800000),
296 # v_readlane_b32 across both halves of a wave64 (the .asm header derives the words)
297 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000be)}
298# Pixel shaders that are exact only when the pixel stage really ran 64 lanes wide. vk_harness says so when it chained
299# a required subgroup size onto the fragment stage ("fragment subgroup size: N required"). A device that cannot
300# require 64 there (NVIDIA: 32 only; llvmpipe: 8) has no frame to judge: the test is skipped, not failed.
301WIDE_PIXEL_TESTS = {"ps_w64x_readlane": 64}
271# h0..h7 of the ps_vint_* fixtures: 24-bit fields with bit 23 set and garbage above, 33 (a shift of 32+), a 302# h0..h7 of the ps_vint_* fixtures: 24-bit fields with bit 23 set and garbage above, 33 (a shift of 32+), a
272# negative i32 that is a large u32, and plain bit patterns. 303# negative i32 that is a large u32, and plain bit patterns.
273VINT_ENV = {"VKH_SGPRS": "0x1000,0,32,0", 304VINT_ENV = {"VKH_SGPRS": "0x1000,0,32,0",
@@ -444,6 +475,10 @@ def fmt_1010102_test(tools, spirv, env=None):
444 return dump_test(tools, spirv, "cs_fmt_1010102", FMT_1010102_WORDS + [0xEEEEEEEE] * 48, 64, env) 475 return dump_test(tools, spirv, "cs_fmt_1010102", FMT_1010102_WORDS + [0xEEEEEEEE] * 48, 64, env)
445 476
446 477
478def fmt_sint32_test(tools, spirv, env=None):
479 return dump_test(tools, spirv, "cs_fmt_sint32", FMT_SINT32_WORDS, len(FMT_SINT32_WORDS), env)
480
481
447def fmt_xy_xyz_test(tools, spirv, env=None): 482def fmt_xy_xyz_test(tools, spirv, env=None):
448 """TEST-185: the 84 result words and the untouched words after them, up to the inputs at 0x200. The heap needs 483 """TEST-185: the 84 result words and the untouched words after them, up to the inputs at 0x200. The heap needs
449 0x2d0 bytes, so it is 192 words.""" 484 0x2d0 bytes, so it is 192 words."""
@@ -692,9 +727,10 @@ def subgroup_size(spirv, name):
692 return None 727 return None
693 728
694 729
695def bindless_test(tools, spirv): 730def bindless_test(tools, spirv, pixel="ps_tex"):
696 """ps_tex: a texture found through the descriptor hash table and the bindless set (vk_bindless_test).""" 731 """ps_tex: a texture found through the descriptor hash table and the bindless set (vk_bindless_test).
697 shaders = [os.path.join(spirv, name + ".spv") for name in ("vs_ids", "ps_tex")] 732 ps_imgatomic: image atomics in a pixel shader through the set's r32ui storage arrays, checked per texel."""
733 shaders = [os.path.join(spirv, name + ".spv") for name in ("vs_ids", pixel)]
698 for path in shaders: 734 for path in shaders:
699 if not os.path.isfile(path): 735 if not os.path.isfile(path):
700 return f"missing {os.path.basename(path)}" 736 return f"missing {os.path.basename(path)}"
@@ -702,6 +738,9 @@ def bindless_test(tools, spirv):
702 if code == UNSUPPORTED: 738 if code == UNSUPPORTED:
703 m = re.search(r"unsupported: .*", out) 739 m = re.search(r"unsupported: .*", out)
704 return Skip(f"SKIP ({m.group(0) if m else 'unsupported device'})") 740 return Skip(f"SKIP ({m.group(0) if m else 'unsupported device'})")
741 if pixel == "ps_imgatomic":
742 m = re.search(r"ps_imgatomic: (\d+) of \d+ texels wrong.*; (\d+) of \d+ render-target pixels wrong", out)
743 return "" if code == 0 and m and m.group(1) == "0" and m.group(2) == "0" else failure(code, out, 3)
705 m = re.search(r"(\d+) draws read back, (\d+) bad pixels", out) 744 m = re.search(r"(\d+) draws read back, (\d+) bad pixels", out)
706 return "" if code == 0 and m and m.group(2) == "0" else failure(code, out, 3) 745 return "" if code == 0 and m and m.group(2) == "0" else failure(code, out, 3)
707 746
@@ -1072,13 +1111,27 @@ def interp_f16_high_problem(px):
1072 return "" if err < 2e-3 else f"f16 halves off by {err:.3g}" 1111 return "" if err < 2e-3 else f"f16 halves off by {err:.3g}"
1073 1112
1074 1113
1114def wide_pixel_skip(name, out):
1115 """A Skip when `name` needs a 64-wide pixel stage (WIDE_PIXEL_TESTS) and vk_harness's output does not say that size
1116 was required of the fragment stage, else None."""
1117 want = WIDE_PIXEL_TESTS.get(name)
1118 if not want or re.search(rf"^fragment subgroup size: {want} required$", out, re.MULTILINE):
1119 return None
1120 m = re.search(r"subgroup (\d+)\.\.(\d+)", out)
1121 seen = f": subgroup {m.group(1)}..{m.group(2)}" if m else ""
1122 return Skip(f"SKIP (this device cannot require a {want}-wide fragment subgroup{seen})")
1123
1124
1075def pixel_test(tools, spirv, name): 1125def pixel_test(tools, spirv, name):
1076 path = os.path.join(spirv, name + ".spv") 1126 path = os.path.join(spirv, name + ".spv")
1127 if name == "ps_ij_computed" and (BARY_FALLBACK or F16_HALVES):
1128 # Before the .spv check: without PerVertexKHR inputs the translator refuses a computed I/J pair (no .spv).
1129 return Skip("SKIP (computed I/J pairs need PerVertexKHR inputs: no --bary-fallback / --f16-interp-fallback)")
1077 if not os.path.isfile(path): 1130 if not os.path.isfile(path):
1078 return f"missing {name}.spv" 1131 return f"missing {name}.spv"
1079 if name in ("ps_texoff", "ps_texoff_implicit"): 1132 if name in ("ps_texoff", "ps_texoff_implicit"):
1080 return texoff_test(tools, spirv, name) 1133 return texoff_test(tools, spirv, name)
1081 if name in ("ps_interp_f16_high", "ps_ij_computed") and BARY_FALLBACK: 1134 if name == "ps_interp_f16_high" and BARY_FALLBACK:
1082 return Skip("SKIP (per-vertex interpolants need VK_KHR_fragment_shader_barycentric)") 1135 return Skip("SKIP (per-vertex interpolants need VK_KHR_fragment_shader_barycentric)")
1083 fmt = "<4f" if name == "ps_bary" else "<2I2f" if name in ("ps_flat", "ps_uniform_branch", "ps_scc_mask32") else "<4I" 1136 fmt = "<4f" if name == "ps_bary" else "<2I2f" if name in ("ps_flat", "ps_uniform_branch", "ps_scc_mask32") else "<4I"
1084 px, out = pixels(tools, spirv, name, fmt, PIXEL_VERTEX.get(name, "vs_ids")) 1137 px, out = pixels(tools, spirv, name, fmt, PIXEL_VERTEX.get(name, "vs_ids"))
@@ -1093,6 +1146,8 @@ def pixel_test(tools, spirv, name):
1093 return Skip("SKIP (vk_harness reported no subgroup width)") 1146 return Skip("SKIP (vk_harness reported no subgroup width)")
1094 if int(m.group(1)) < 32: 1147 if int(m.group(1)) < 32:
1095 return Skip(f"SKIP (subgroup {m.group(1)} is narrower than 32 lanes)") 1148 return Skip(f"SKIP (subgroup {m.group(1)} is narrower than 32 lanes)")
1149 if skip := wide_pixel_skip(name, out):
1150 return skip
1096 if name == "ps_vcmpx_forms": 1151 if name == "ps_vcmpx_forms":
1097 if skip := vcmpx_forms_narrow_skip(out): 1152 if skip := vcmpx_forms_narrow_skip(out):
1098 return skip 1153 return skip
@@ -1184,6 +1239,7 @@ def main():
1184 results.append(("cs_cmpx_class_f32", compute_test(tools, spirv, "cs_cmpx_class_f32", "1", "dump", 1239 results.append(("cs_cmpx_class_f32", compute_test(tools, spirv, "cs_cmpx_class_f32", "1", "dump",
1185 expected_words=CMPX_CLASS_WORDS))) 1240 expected_words=CMPX_CLASS_WORDS)))
1186 results.append(("cs_fmt_1010102", fmt_1010102_test(tools, spirv))) 1241 results.append(("cs_fmt_1010102", fmt_1010102_test(tools, spirv)))
1242 results.append(("cs_fmt_sint32", fmt_sint32_test(tools, spirv)))
1187 results.append(("cs_fmt_xy_xyz", fmt_xy_xyz_test(tools, spirv))) 1243 results.append(("cs_fmt_xy_xyz", fmt_xy_xyz_test(tools, spirv)))
1188 for name, groups, want in GLOBAL_OFFSET: 1244 for name, groups, want in GLOBAL_OFFSET:
1189 results.append((name, compute_test(tools, spirv, name, groups, "dump", expected_words=want))) 1245 results.append((name, compute_test(tools, spirv, name, groups, "dump", expected_words=want)))
@@ -1222,6 +1278,7 @@ def main():
1222 results.append((name, texture_constant_test(tools, spirv, name))) 1278 results.append((name, texture_constant_test(tools, spirv, name)))
1223 results.append(("ps_tex", bindless_test(tools, spirv))) 1279 results.append(("ps_tex", bindless_test(tools, spirv)))
1224 results.append(("ps_ssharp", sampler_test(tools, spirv))) 1280 results.append(("ps_ssharp", sampler_test(tools, spirv)))
1281 results.append(("ps_imgatomic", bindless_test(tools, spirv, "ps_imgatomic")))
1225 for name in MIP_TEST_PASSES: 1282 for name in MIP_TEST_PASSES:
1226 results.append((name, texture_mip_test(tools, spirv, name))) 1283 results.append((name, texture_mip_test(tools, spirv, name)))
1227 for name in GRADIENT_TESTS: 1284 for name in GRADIENT_TESTS:
diff --git a/runtime/test/shaders/cs_fmt_sint32.asm b/runtime/test/shaders/cs_fmt_sint32.asm
new file mode 100644
index 000000000..a444421ce
--- /dev/null
+++ b/runtime/test/shaders/cs_fmt_sint32.asm
@@ -0,0 +1,90 @@
1; SHADER-257: GFX10 32-bit signed typed buffers. Lane 0 writes [-2147483648, 2147483647, -3, 17] at 0x80.
2; MUBUF loads at out[0..11] test integer DST_SEL=1 for format 63 (X,Y,X,1) and raw words for 73/76.
3; MTBUF loads at out[12..23] use a bound 32_FLOAT descriptor and take width and identity selectors from the
4; instruction (XY00, XYZ0, XYZW). D16 loads at out[24..27] check signed saturation, including -3, for both forms.
5; Single-channel SINT MUBUF/MTBUF loads place -3 in out[28..29].
6; MUBUF stores at 0x90/0xa0/0xb0 write the low 2/3/4 original words. The D16 store at 0xc0 sign-extends
7; 0xfffd and 0x8000 to dwords. The single-channel store at 0xc8 writes -3. Unwritten words retain 0xeeeeeeee.
8v_cmpx_eq_u32_e32 0, v0
9v_mov_b32_e32 v1, 0x80000000
10v_mov_b32_e32 v2, 0x7fffffff
11v_mov_b32_e32 v3, -3
12v_mov_b32_e32 v4, 17
13v_mov_b32_e32 v5, 0x80
14buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen
15s_mov_b32 s4, s0
16s_mov_b32 s5, s1
17s_mov_b32 s6, s2
18
19; MUBUF load via format 63.
20s_mov_b32 s7, 0x3103f32c
21buffer_load_format_xyzw v[8:11], v5, s[4:7], 0 offen
22v_mov_b32_e32 v6, 0x0
23buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
24
25; MUBUF load via format 73.
26s_mov_b32 s7, 0x31049fac
27buffer_load_format_xyzw v[8:11], v5, s[4:7], 0 offen
28v_mov_b32_e32 v6, 0x10
29buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
30
31; MUBUF load via format 76.
32s_mov_b32 s7, 0x3104cfac
33buffer_load_format_xyzw v[8:11], v5, s[4:7], 0 offen
34v_mov_b32_e32 v6, 0x20
35buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
36
37; A bound FLOAT descriptor with a different size and selectors from each instruction.
38s_mov_b32 s7, 0x31016000
39tbuffer_load_format_xyzw v[8:11], v5, s[4:7], 0 format:[BUF_FMT_32_32_SINT] offen
40v_mov_b32_e32 v6, 0x30
41buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
42tbuffer_load_format_xyzw v[8:11], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_SINT] offen
43v_mov_b32_e32 v6, 0x40
44buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
45tbuffer_load_format_xyzw v[8:11], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_SINT] offen
46v_mov_b32_e32 v6, 0x50
47buffer_store_dwordx4 v[8:11], v6, s[0:3], 0 offen
48
49; Packs (0x8000, 0x7fff) and (0xfffd, 0x0011).
50s_mov_b32 s7, 0x3104cfac
51buffer_load_format_d16_xyzw v[8:9], v5, s[4:7], 0 offen
52v_mov_b32_e32 v6, 0x60
53buffer_store_dwordx2 v[8:9], v6, s[0:3], 0 offen
54s_mov_b32 s7, 0x31016000
55tbuffer_load_format_d16_xyzw v[8:9], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_SINT] offen
56v_mov_b32_e32 v6, 0x68
57buffer_store_dwordx2 v[8:9], v6, s[0:3], 0 offen
58
59; Single-component 32_SINT at 0x88, with a bound FLOAT descriptor for the MTBUF case.
60s_mov_b32 s7, 0x31015004
61buffer_load_format_x v8, v5, s[4:7], 0 offen offset:8
62s_mov_b32 s7, 0x31016000
63tbuffer_load_format_x v9, v5, s[4:7], 0 format:[BUF_FMT_32_SINT] offen offset:8
64v_mov_b32_e32 v6, 0x70
65buffer_store_dwordx2 v[8:9], v6, s[0:3], 0 offen
66
67; MUBUF store via format 63.
68s_mov_b32 s7, 0x3103ffac
69v_mov_b32_e32 v6, 0x90
70buffer_store_format_xy v[1:2], v6, s[4:7], 0 offen
71
72; MUBUF store via format 73.
73s_mov_b32 s7, 0x31049fac
74v_mov_b32_e32 v6, 0xa0
75buffer_store_format_xyz v[1:3], v6, s[4:7], 0 offen
76
77; MUBUF store via format 76.
78s_mov_b32 s7, 0x3104cfac
79v_mov_b32_e32 v6, 0xb0
80buffer_store_format_xyzw v[1:4], v6, s[4:7], 0 offen
81
82; A signed packed store must extend both halves.
83s_mov_b32 s7, 0x3103ffac
84v_mov_b32_e32 v6, 0xc0
85v_mov_b32_e32 v7, 0x8000fffd
86buffer_store_format_d16_xy v7, v6, s[4:7], 0 offen
87s_mov_b32 s7, 0x31015004
88v_mov_b32_e32 v6, 0xc8
89buffer_store_format_x v3, v6, s[4:7], 0 offen
90s_endpgm
diff --git a/runtime/test/shaders/cs_w32_sincos.asm b/runtime/test/shaders/cs_w32_sincos.asm
new file mode 100644
index 000000000..6777867da
--- /dev/null
+++ b/runtime/test/shaders/cs_w32_sincos.asm
@@ -0,0 +1,60 @@
1; SHADER-88: v_sin_f32 / v_cos_f32 take the angle in turns and must reduce it in turns before scaling by 2*pi.
2; Six large-angle cases (254.25, 254.5, -200.75, 100.3, 254.51, -254.51 turns); each stores 1 when
3; |result - reference| < 1e-3 (the reference is sin/cos(2*pi*x) in double; a Vulkan Sin/Cos is only guaranteed to
4; 2^-11 = 4.9e-4 in [-pi, pi], so the shader compares with a tolerance and stores a flag, not the float).
5; Lane 0 stores out[0..5] = 1 1 1 1 1 1. (Expected references, f32 bits: 1.0, -1.0, 1.0, 0xbe9e39de,
6; 0xbd808642, 0xbf7f7ed2.)
7; group: 32,1,1
8; Run: vk_compute_test cs_w32_sincos.spv 1 dump -> out[0..5] = 1 1 1 1 1 1
9; mattr: +wavefrontsize32,-wavefrontsize64
10v_mov_b32_e32 v9, 0x3a83126f
11v_cmpx_eq_u32_e32 0, v0
12v_mov_b32_e32 v1, 0x437e4000
13v_sin_f32_e32 v2, v1
14v_sub_f32_e32 v2, 0x3f800000, v2
15v_and_b32_e32 v2, 0x7fffffff, v2
16v_cmp_gt_f32_e32 vcc_lo, v9, v2
17v_cndmask_b32_e64 v20, 0, 1, vcc_lo
18v_mov_b32_e32 v21, 0
19buffer_store_dword v20, v21, s[0:3], 0 offen
20v_mov_b32_e32 v1, 0x437e8000
21v_cos_f32_e32 v2, v1
22v_sub_f32_e32 v2, 0xbf800000, v2
23v_and_b32_e32 v2, 0x7fffffff, v2
24v_cmp_gt_f32_e32 vcc_lo, v9, v2
25v_cndmask_b32_e64 v20, 0, 1, vcc_lo
26v_mov_b32_e32 v21, 4
27buffer_store_dword v20, v21, s[0:3], 0 offen
28v_mov_b32_e32 v1, 0xc348c000
29v_sin_f32_e32 v2, v1
30v_sub_f32_e32 v2, 0x3f800000, v2
31v_and_b32_e32 v2, 0x7fffffff, v2
32v_cmp_gt_f32_e32 vcc_lo, v9, v2
33v_cndmask_b32_e64 v20, 0, 1, vcc_lo
34v_mov_b32_e32 v21, 8
35buffer_store_dword v20, v21, s[0:3], 0 offen
36v_mov_b32_e32 v1, 0x42c8999a
37v_cos_f32_e32 v2, v1
38v_sub_f32_e32 v2, 0xbe9e39de, v2
39v_and_b32_e32 v2, 0x7fffffff, v2
40v_cmp_gt_f32_e32 vcc_lo, v9, v2
41v_cndmask_b32_e64 v20, 0, 1, vcc_lo
42v_mov_b32_e32 v21, 12
43buffer_store_dword v20, v21, s[0:3], 0 offen
44v_mov_b32_e32 v1, 0x437e828f
45v_sin_f32_e32 v2, v1
46v_sub_f32_e32 v2, 0xbd808642, v2
47v_and_b32_e32 v2, 0x7fffffff, v2
48v_cmp_gt_f32_e32 vcc_lo, v9, v2
49v_cndmask_b32_e64 v20, 0, 1, vcc_lo
50v_mov_b32_e32 v21, 16
51buffer_store_dword v20, v21, s[0:3], 0 offen
52v_mov_b32_e32 v1, 0xc37e828f
53v_cos_f32_e32 v2, v1
54v_sub_f32_e32 v2, 0xbf7f7ed2, v2
55v_and_b32_e32 v2, 0x7fffffff, v2
56v_cmp_gt_f32_e32 vcc_lo, v9, v2
57v_cndmask_b32_e64 v20, 0, 1, vcc_lo
58v_mov_b32_e32 v21, 20
59buffer_store_dword v20, v21, s[0:3], 0 offen
60s_endpgm
diff --git a/runtime/test/shaders/ps_f16_pack_mods.asm b/runtime/test/shaders/ps_f16_pack_mods.asm
new file mode 100644
index 000000000..1ef415ee9
--- /dev/null
+++ b/runtime/test/shaders/ps_f16_pack_mods.asm
@@ -0,0 +1,19 @@
1; v_pack_b32_f16 with NEG and ABS on a source: each acts on the selected 16-bit half as a plain bit move
2; (ABS clears bit 15, NEG flips it, ABS first), before the half is packed. The rule and its words were measured
3; on a Radeon 680M (gfx1036, RDNA2 iGPU, AMD Windows driver 32.0.21044.64) with raw kernels: -v0 turned 0x7c01
4; into 0xfe01 under IEEE mode 1 and 0xfc01 under mode 0, in either half and with op_sel (#1548 SHADER-260).
5; Quieting an sNaN half under IEEE mode 1 is not modelled (SHADER-190); the values below are not NaNs.
6; v0 = 0.25 | 3.0 << 16, v1 = 4.0 | 0.25 << 16 (low | high half).
7; -v0, |v1|: -0x3400 | 0x4400 << 16
8; v0, -v1: 0x3400 | -0x4400 << 16
9; -|v0|, v1 op_sel:[1,0,0]: -(0x4200) | 0x4400 << 16
10; -v0, -|v1| op_sel:[0,1,0]: -0x3400 | -(0x3400) << 16
11; Expected mrt0 bits: 0x4400b400, 0xc4003400, 0x4400c200, 0xb400b400
12v_mov_b32 v0, 0x42003400
13v_mov_b32 v1, 0x34004400
14v_pack_b32_f16 v2, -v0, |v1|
15v_pack_b32_f16 v3, v0, -v1
16v_pack_b32_f16 v4, -|v0|, v1 op_sel:[1,0,0]
17v_pack_b32_f16 v5, -v0, -|v1| op_sel:[0,1,0]
18exp mrt0 v2, v3, v4, v5 done vm
19s_endpgm
diff --git a/runtime/test/shaders/ps_imgatomic.asm b/runtime/test/shaders/ps_imgatomic.asm
new file mode 100644
index 000000000..b8f888c13
--- /dev/null
+++ b/runtime/test/shaders/ps_imgatomic.asm
@@ -0,0 +1,44 @@
1; Image atomics in a pixel shader, the forms the game uses (1,018 of its 1,038 image-atomic shaders are pixel shaders:
2; image_atomic_or / umin / umax on a 2D image and umax on a 3D one), through the descriptor table and the set-0
3; r32ui storage arrays (binding 4 for 2D, 7 for 3D). User data s2:s3 is the console VA of a table of four T#s:
4; +0x00 the 2D umax image, +0x20 the 2D umin image, +0x40 the 2D or image, +0x60 the 3D umax image (any 8 dwords:
5; only the key matters). Each of the 64x64 pixels computes px, py from attr0 (vs_ids runs it 0..1 over the target),
6; its id = px + 64 * py, and its texel tx = px >> 3, ty = py >> 3, so 64 pixels contend for each texel of the 8x8
7; images:
8; umax2d[ty][tx] = max(id), umin2d[ty][tx] = min(id), or2d[ty][tx] |= 1 << (id & 31),
9; umax3d[px & 3][ty >> 1][tx >> 1] = max(id) (a 4x4x4 image)
10; After its atomics, every odd px is discarded (v_cmpx). The atomics of a pixel that is discarded afterwards still
11; count, as on hardware: the expected values above are over all 4096 pixels. Even pixels export 1.0.
12; Run: vk_bindless_test vs_ids.spv ps_imgatomic.spv (images cleared to 0, umin to 0xffffffff; checked per texel)
13s_load_dwordx8 s[8:15], s[2:3], 0x0
14s_load_dwordx8 s[16:23], s[2:3], 0x20
15s_load_dwordx8 s[24:31], s[2:3], 0x40
16s_load_dwordx8 s[32:39], s[2:3], 0x60
17s_waitcnt lgkmcnt(0)
18v_interp_p1_f32_e32 v2, v0, attr0.x
19v_interp_p2_f32_e32 v2, v1, attr0.x
20v_interp_p1_f32_e32 v3, v0, attr0.y
21v_interp_p2_f32_e32 v3, v1, attr0.y
22v_mul_f32_e32 v2, 0x42800000, v2
23v_mul_f32_e32 v3, 0x42800000, v3
24v_cvt_u32_f32_e32 v4, v2
25v_cvt_u32_f32_e32 v5, v3
26v_lshlrev_b32_e32 v6, 6, v5
27v_add_nc_u32_e32 v6, v6, v4
28v_lshrrev_b32_e32 v7, 3, v4
29v_lshrrev_b32_e32 v8, 3, v5
30image_atomic_umax v6, v[7:8], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm
31image_atomic_umin v6, v[7:8], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm
32v_and_b32_e32 v9, 31, v6
33v_lshlrev_b32_e64 v9, v9, 1
34image_atomic_or v9, v[7:8], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm
35v_lshrrev_b32_e32 v10, 1, v7
36v_lshrrev_b32_e32 v11, 1, v8
37v_and_b32_e32 v12, 3, v4
38image_atomic_umax v6, v[10:12], s[32:39] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm
39s_waitcnt vmcnt(0)
40v_and_b32_e32 v13, 1, v4
41v_cmpx_eq_u32_e32 0, v13
42v_mov_b32_e32 v14, 1.0
43exp mrt0 v14, v14, v14, v14 done vm
44s_endpgm
diff --git a/runtime/test/shaders/ps_m2_uoff.asm b/runtime/test/shaders/ps_m2_uoff.asm
index 7f1167944..1c96f50d5 100644
--- a/runtime/test/shaders/ps_m2_uoff.asm
+++ b/runtime/test/shaders/ps_m2_uoff.asm
@@ -2,9 +2,12 @@
2; and the fallback sampler give the same pixels; with U + 1 the CLAMP sampler returns the last column and the WRAP one 2; and the fallback sampler give the same pixels; with U + 1 the CLAMP sampler returns the last column and the WRAP one
3; the same texel as without the offset, so the pixels tell which sampler the draw used. Idea and measurements by 3; the same texel as without the offset, so the pixels tell which sampler the draw used. Idea and measurements by
4; @Vonsek (#1489). Run: d3d12_m2_textured_test. 4; @Vonsek (#1489). Run: d3d12_m2_textured_test.
5; The same unbounded SRV table stays bound across both draws. Root constants s4 and s5 hold
6; the descriptor index and byte stride, respectively.
5; fssm-at: 0x10 7; fssm-at: 0x10
6; fssm-data: 0x324d5350 0x4f465520 8; fssm-data: 0x324d5350 0x4f465520
7s_load_dwordx8 s[8:15], s[0:1], 0x0 9s_mul_i32 s20, s4, s5
10s_load_dwordx8 s[8:15], s[0:1], s20
8s_load_dwordx4 s[16:19], s[2:3], 0x0 11s_load_dwordx4 s[16:19], s[2:3], 0x0
9s_waitcnt lgkmcnt(0) 12s_waitcnt lgkmcnt(0)
10v_interp_p1_f32_e32 v2, v0, attr0.x 13v_interp_p1_f32_e32 v2, v0, attr0.x
diff --git a/runtime/test/shaders/ps_scc_logic32.asm b/runtime/test/shaders/ps_scc_logic32.asm
new file mode 100644
index 000000000..3b36f1362
--- /dev/null
+++ b/runtime/test/shaders/ps_scc_logic32.asm
@@ -0,0 +1,44 @@
1; s_nand_b32, s_nor_b32, s_xnor_b32: D = ~(S0 op S1), SCC = (D != 0). Values by hand from the RDNA2 ISA SOP2 text.
2; s2 = 0xf0f0f0f0, s3 = 0xff00ff00: and = 0xf000f000, or = 0xfff0fff0, xor = 0x0ff00ff0.
3; Expected mrt0 bits: nand 0x0fff0fff, nor 0x000f000f, xnor 0xf00ff00f, and an SCC word, bit n = SCC after case n:
4; 0 nand(-1, -1) = 0 -> 0 1 nor(0, 0) = -1 -> 1 2 xnor(x, x) = -1 -> 1
5; 3 xnor(x, ~x) = 0 -> 0 4 nor(0xfffffff0, 0) = 0xf -> 1 5 nand(0x80000000, -1) = 0x7fffffff -> 1
6; so the SCC word is 0x36.
7s_mov_b32 s2, 0xf0f0f0f0
8s_mov_b32 s3, 0xff00ff00
9s_nand_b32 s4, s2, s3
10s_nor_b32 s5, s2, s3
11s_xnor_b32 s6, s2, s3
12s_mov_b32 s8, -1
13s_mov_b32 s9, 0
14s_mov_b32 s10, 0x0f0f0f0f
15s_mov_b32 s11, 0xfffffff0
16s_mov_b32 s12, 0x80000000
17s_nand_b32 s13, s8, s8
18s_cselect_b32 s20, 1, 0
19s_nor_b32 s13, s9, s9
20s_cselect_b32 s21, 1, 0
21s_xnor_b32 s13, s2, s2
22s_cselect_b32 s22, 1, 0
23s_xnor_b32 s13, s2, s10
24s_cselect_b32 s23, 1, 0
25s_nor_b32 s13, s11, s9
26s_cselect_b32 s24, 1, 0
27s_nand_b32 s13, s12, s8
28s_cselect_b32 s25, 1, 0
29s_lshl_b32 s21, s21, 1
30s_lshl_b32 s22, s22, 2
31s_lshl_b32 s23, s23, 3
32s_lshl_b32 s24, s24, 4
33s_lshl_b32 s25, s25, 5
34s_or_b32 s20, s20, s21
35s_or_b32 s20, s20, s22
36s_or_b32 s20, s20, s23
37s_or_b32 s20, s20, s24
38s_or_b32 s20, s20, s25
39v_mov_b32_e32 v0, s4
40v_mov_b32_e32 v1, s5
41v_mov_b32_e32 v2, s6
42v_mov_b32_e32 v3, s20
43exp mrt0 v0, v1, v2, v3 done vm
44s_endpgm
diff --git a/runtime/test/shaders/ps_scc_logic64.asm b/runtime/test/shaders/ps_scc_logic64.asm
new file mode 100644
index 000000000..3ffb677ae
--- /dev/null
+++ b/runtime/test/shaders/ps_scc_logic64.asm
@@ -0,0 +1,49 @@
1; s_nand_b64, s_nor_b64, s_xnor_b64 on plain SGPR pairs: D = ~(S0 op S1), SCC = ((D.lo | D.hi) != 0). By hand from the RDNA2 ISA.
2; A = s[2:3] = (lo 0xf0f0f0f0, hi 0x0000ffff), B = s[4:5] = (lo 0xff00ff00, hi 0x00ff00ff).
3; Expected mrt0 bits: nand.lo 0x0fff0fff, nor.hi 0xff000000 (A.hi | B.hi = 0x00ffffff), xnor.hi 0xff0000ff (A.hi ^ B.hi = 0x00ffff00),
4; and an SCC word, bit n = SCC after case n (X = (-1, 0), Y = (0, -1)):
5; 0 nand(ones, ones) = 0 -> 0 1 nor(X, 0) = (0, -1), only the high dword set -> 1
6; 2 xnor(X, X) = all ones -> 1 3 xnor(X, Y) = 0 -> 0
7; 4 nor(Y, (0xfffffff0, 0)) = (0xf, 0), only the low dword set -> 1
8; so the SCC word is 0x16.
9s_mov_b32 s2, 0xf0f0f0f0
10s_mov_b32 s3, 0x0000ffff
11s_mov_b32 s4, 0xff00ff00
12s_mov_b32 s5, 0x00ff00ff
13s_nand_b64 s[6:7], s[2:3], s[4:5]
14s_nor_b64 s[8:9], s[2:3], s[4:5]
15s_xnor_b64 s[10:11], s[2:3], s[4:5]
16s_mov_b32 s12, -1
17s_mov_b32 s13, -1
18s_mov_b32 s14, -1
19s_mov_b32 s15, 0
20s_mov_b32 s16, 0
21s_mov_b32 s17, -1
22s_mov_b32 s18, 0
23s_mov_b32 s19, 0
24s_mov_b32 s24, 0xfffffff0
25s_mov_b32 s25, 0
26s_nand_b64 s[30:31], s[12:13], s[12:13]
27s_cselect_b32 s40, 1, 0
28s_nor_b64 s[30:31], s[14:15], s[18:19]
29s_cselect_b32 s41, 1, 0
30s_xnor_b64 s[30:31], s[14:15], s[14:15]
31s_cselect_b32 s42, 1, 0
32s_xnor_b64 s[30:31], s[14:15], s[16:17]
33s_cselect_b32 s43, 1, 0
34s_nor_b64 s[30:31], s[16:17], s[24:25]
35s_cselect_b32 s44, 1, 0
36s_lshl_b32 s41, s41, 1
37s_lshl_b32 s42, s42, 2
38s_lshl_b32 s43, s43, 3
39s_lshl_b32 s44, s44, 4
40s_or_b32 s40, s40, s41
41s_or_b32 s40, s40, s42
42s_or_b32 s40, s40, s43
43s_or_b32 s40, s40, s44
44v_mov_b32_e32 v0, s6
45v_mov_b32_e32 v1, s9
46v_mov_b32_e32 v2, s11
47v_mov_b32_e32 v3, s40
48exp mrt0 v0, v1, v2, v3 done vm
49s_endpgm
diff --git a/runtime/test/shaders/ps_w64x_readlane.asm b/runtime/test/shaders/ps_w64x_readlane.asm
new file mode 100644
index 000000000..895254471
--- /dev/null
+++ b/runtime/test/shaders/ps_w64x_readlane.asm
@@ -0,0 +1,27 @@
1; Wave64 pixel shader with v_readlane_b32 across both halves of the wave (RDNA2 ISA: lane = S1 % 64, EXEC ignored).
2; The translator's pixel path takes the lane from SubgroupLocalInvocationId, which is the hardware lane only in a
3; 64-wide subgroup; in a 32-wide one the lane select wraps (lane 40 reads lane 8), so the words below differ.
4; v2 = 3 * lane + 1. Every lane of a full wave reads the same scalars:
5; s6 = v2[40] = 121, s7 = v2[5] = 16, s8 = v2[33] = 100, s9 = v2[63] = 190
6; Each is or'ed with 0x40000000 so the export is a normal float (a float render target keeps bit patterns, but a
7; denormal could be flushed). Export mrt0 = (0x40000079, 0x40000010, 0x40000064, 0x400000be) for every covered
8; pixel of a full wave; draw a triangle that covers the whole target so every wave is full.
9; Run: d3d12_subgroup_test (the PS through a D3D12 graphics PSO, R32G32B32A32_FLOAT target).
10; mattr: +wavefrontsize64,-wavefrontsize32
11v_mbcnt_lo_u32_b32 v1, -1, 0
12v_mbcnt_hi_u32_b32 v1, -1, v1
13v_mad_u32_u24 v2, v1, 3, 1
14v_readlane_b32 s6, v2, 40
15v_readlane_b32 s7, v2, 5
16v_readlane_b32 s8, v2, 33
17v_readlane_b32 s9, v2, 63
18s_or_b32 s6, s6, 0x40000000
19s_or_b32 s7, s7, 0x40000000
20s_or_b32 s8, s8, 0x40000000
21s_or_b32 s9, s9, 0x40000000
22v_mov_b32 v3, s6
23v_mov_b32 v4, s7
24v_mov_b32 v5, s8
25v_mov_b32 v6, s9
26exp mrt0 v3, v4, v5, v6 done vm
27s_endpgm
diff --git a/runtime/test/subgroup_size_test.cpp b/runtime/test/subgroup_size_test.cpp
new file mode 100644
index 000000000..e61387e07
--- /dev/null
+++ b/runtime/test/subgroup_size_test.cpp
@@ -0,0 +1,256 @@
1// The subgroup-size decision of pipeline creation (src/subgroup_size.h) without a GPU: synthetic shader index
2// entries against synthetic device properties, and the VkPipelineShaderStageCreateInfo chain that results.
3// The devices are the three shapes known so far:
4// - AMD, Windows driver (measured on a Radeon 880M, 26.11.2) and current Mesa RADV on GFX10+: sizes 32..64, the
5// stages FRAGMENT | COMPUTE | TASK | MESH can be required;
6// - NVIDIA: every stage can be required, but the only size is 32;
7// - an old RADV: sizes 32..64, COMPUTE only.
8// No game data.
9#include "../src/subgroup_size.h"
10
11#include <cstdio>
12#include <string>
13
14#define CHECK(condition) do { \
15 if (!(condition)) { \
16 std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); \
17 return 1; \
18 } \
19} while (0)
20
21using namespace leonida;
22
23namespace {
24
25constexpr VkShaderStageFlags amd_stages = VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_COMPUTE_BIT |
26 VK_SHADER_STAGE_TASK_BIT_EXT | VK_SHADER_STAGE_MESH_BIT_EXT;
27constexpr VkShaderStageFlags all_stages = VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_COMPUTE_BIT |
28 VK_SHADER_STAGE_TASK_BIT_EXT | VK_SHADER_STAGE_MESH_BIT_EXT;
29
30SubgroupSizeCaps amd() {
31 SubgroupSizeCaps c;
32 c.subgroup_size_control = c.compute_full_subgroups = true;
33 c.min_size = 32;
34 c.max_size = 64;
35 c.default_size = 64;
36 c.max_compute_workgroup_subgroups = 16;
37 c.required_stages = amd_stages;
38 return c;
39}
40
41SubgroupSizeCaps nvidia() {
42 SubgroupSizeCaps c;
43 c.subgroup_size_control = c.compute_full_subgroups = true;
44 c.min_size = c.max_size = c.default_size = 32;
45 c.max_compute_workgroup_subgroups = 32;
46 c.required_stages = all_stages;
47 return c;
48}
49
50SubgroupSizeCaps old_radv() {
51 SubgroupSizeCaps c = amd();
52 c.required_stages = VK_SHADER_STAGE_COMPUTE_BIT;
53 return c;
54}
55
56// An index entry as the translator writes it: `wave64` shaders carry subgroup_size 64, the rest 32, and a shader
57// translated with --wave64-emulate has no size and a wave64_exchange.
58ShaderEntry entry(const char* stage, bool wave64, std::array<std::uint32_t, 3> local = {64, 1, 1},
59 bool emulated = false) {
60 ShaderEntry e;
61 e.name = std::string(stage) + (wave64 ? "_w64" : "_w32") + (emulated ? "_emu" : "");
62 e.stage = stage;
63 e.wave64 = wave64;
64 e.subgroup_size = emulated ? 0 : (wave64 ? 64 : 32);
65 if (emulated) e.wave64_exchange = "workgroup";
66 e.local_size = local;
67 return e;
68}
69
70} // namespace
71
72int main() {
73 // --- AMD-like -------------------------------------------------------------------------------------------
74 {
75 const SubgroupSizeCaps caps = amd();
76 // Native wave64 compute: 64, plus full subgroups when X is a multiple of 64.
77 auto r = decide_subgroup_size(entry("cs", true), caps);
78 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 && r.wanted == 64);
79 CHECK(r.stage == VK_SHADER_STAGE_COMPUTE_BIT);
80 CHECK(r.flags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT);
81 r = decide_subgroup_size(entry("cs", true, {128, 2, 1}), caps);
82 CHECK(r.size == 64 && (r.flags & VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT));
83 // X not a multiple of 64 (32x2): 64 is still required, full subgroups are not (-pNext-02757).
84 r = decide_subgroup_size(entry("cs", true, {32, 2, 1}), caps);
85 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 && r.flags == 0);
86 r = decide_subgroup_size(entry("cs", true, {96, 1, 1}), caps);
87 CHECK(r.size == 64 && r.flags == 0);
88 // A wave32 compute shader on a 32..64 device: 32 (the default is 64 here), full subgroups when X % 32 == 0.
89 r = decide_subgroup_size(entry("cs", false, {96, 1, 1}), caps);
90 CHECK(r.outcome == SubgroupOutcome::required && r.size == 32 &&
91 r.flags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT);
92 r = decide_subgroup_size(entry("cs", false, {48, 1, 1}), caps);
93 CHECK(r.size == 32 && r.flags == 0);
94 // Pixel shaders can be required on AMD: wave64 gets 64, wave32 gets 32, never a full-subgroups flag.
95 r = decide_subgroup_size(entry("ps", true), caps);
96 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 && r.flags == 0 &&
97 r.stage == VK_SHADER_STAGE_FRAGMENT_BIT);
98 r = decide_subgroup_size(entry("ps", false), caps);
99 CHECK(r.outcome == SubgroupOutcome::required && r.size == 32 && r.flags == 0);
100 // Mesh: wave64 by construction, 64 and no flag (the flag is only asked of compute).
101 r = decide_subgroup_size(entry("ms", true, {128, 1, 1}), caps);
102 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 && r.flags == 0 &&
103 r.stage == VK_SHADER_STAGE_MESH_BIT_EXT);
104 // Vertex and geometry stages are not in the list: a wave64 VS cannot be given 64, but the default is 64, so it
105 // works as it is (device_default); there is no emulation for it.
106 r = decide_subgroup_size(entry("vs", true), caps);
107 CHECK(r.outcome == SubgroupOutcome::device_default && r.size == 0 && r.wanted == 64);
108 r = decide_subgroup_size(entry("gs", true), caps);
109 CHECK(r.outcome == SubgroupOutcome::device_default);
110 // A wave32 VS on a 64-wide default is wrong too.
111 r = decide_subgroup_size(entry("vs", false), caps);
112 CHECK(r.outcome == SubgroupOutcome::unavailable && r.wanted == 32);
113 // Emulated shaders ask for nothing, whatever the stage.
114 r = decide_subgroup_size(entry("cs", true, {64, 1, 1}, true), caps);
115 CHECK(r.outcome == SubgroupOutcome::emulated && r.size == 0 && r.flags == 0);
116 r = decide_subgroup_size(entry("ms", true, {128, 1, 1}, true), caps);
117 CHECK(r.outcome == SubgroupOutcome::emulated && r.size == 0 && r.flags == 0);
118 }
119
120 // --- NVIDIA-like: 32 only ----------------------------------------------------------------------------------
121 {
122 const SubgroupSizeCaps caps = nvidia();
123 // Wave32 is what the device does: nothing to chain, in any stage.
124 for (const char* stage : {"cs", "ps", "vs", "gs", "ms"}) {
125 const auto r = decide_subgroup_size(entry(stage, false), caps);
126 CHECK(r.outcome == SubgroupOutcome::device_fixed && r.size == 0 && r.flags == 0);
127 }
128 // Wave64 cannot be had (64 > max): native wave64 is reported in every stage, emulated is fine.
129 for (const char* stage : {"cs", "ps", "vs", "gs", "ms"}) {
130 const auto r = decide_subgroup_size(entry(stage, true), caps);
131 CHECK(r.outcome == SubgroupOutcome::unavailable && r.size == 0 && r.flags == 0 && r.wanted == 64);
132 }
133 const auto emulated = decide_subgroup_size(entry("cs", true, {64, 1, 1}, true), caps);
134 CHECK(emulated.outcome == SubgroupOutcome::emulated && emulated.size == 0);
135 }
136
137 // --- An old RADV: COMPUTE only ----------------------------------------------------------------------------------
138 {
139 const SubgroupSizeCaps caps = old_radv();
140 auto r = decide_subgroup_size(entry("cs", true), caps);
141 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 &&
142 r.flags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT);
143 // Pixel shaders cannot be required, and the default is 64: a wave32 PS is wrong, a wave64 PS works as it is
144 // (device_default: nothing guarantees the default, min != max).
145 r = decide_subgroup_size(entry("ps", false), caps);
146 CHECK(r.outcome == SubgroupOutcome::unavailable && r.size == 0);
147 r = decide_subgroup_size(entry("ps", true), caps);
148 CHECK(r.outcome == SubgroupOutcome::device_default && r.size == 0);
149 r = decide_subgroup_size(entry("ms", true, {128, 1, 1}), caps);
150 CHECK(r.outcome == SubgroupOutcome::device_default);
151 }
152
153 // --- Feature, limit and index edge cases -------------------------------------------------------------------------
154 {
155 SubgroupSizeCaps caps = amd();
156 // computeFullSubgroups off: the size is still required, the flag is not set.
157 caps.compute_full_subgroups = false;
158 auto r = decide_subgroup_size(entry("cs", true), caps);
159 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64 && r.flags == 0);
160 // subgroupSizeControl not enabled: the chain would break VUID -pNext-02755, so it is not asked for.
161 caps = amd();
162 caps.subgroup_size_control = false;
163 r = decide_subgroup_size(entry("cs", true), caps);
164 CHECK(r.outcome == SubgroupOutcome::device_default && r.size == 0 && r.flags == 0);
165 // The workgroup must fit size * maxComputeWorkgroupSubgroups (-pNext-02756): 1024 > 64 * 8.
166 caps = amd();
167 caps.max_compute_workgroup_subgroups = 8;
168 r = decide_subgroup_size(entry("cs", true, {1024, 1, 1}), caps);
169 CHECK(r.outcome == SubgroupOutcome::device_default);
170 r = decide_subgroup_size(entry("cs", true, {512, 1, 1}), caps);
171 CHECK(r.outcome == SubgroupOutcome::required && r.size == 64);
172 r = decide_subgroup_size(entry("cs", true, {16, 8, 8}), caps); // 1024 invocations too
173 CHECK(r.outcome == SubgroupOutcome::device_default);
174 // The limit is for compute and mesh; a pixel shader is not subject to it.
175 r = decide_subgroup_size(entry("ps", true), caps);
176 CHECK(r.outcome == SubgroupOutcome::required);
177 // A size that is not a power of two, or outside [min, max], is not chained.
178 caps = amd();
179 ShaderEntry odd = entry("cs", true);
180 odd.subgroup_size = 48;
181 CHECK(decide_subgroup_size(odd, caps).outcome == SubgroupOutcome::unavailable);
182 odd.subgroup_size = 128;
183 CHECK(decide_subgroup_size(odd, caps).outcome == SubgroupOutcome::unavailable);
184 odd.subgroup_size = 16;
185 CHECK(decide_subgroup_size(odd, caps).outcome == SubgroupOutcome::unavailable);
186 // An entry without subgroup_size (an index from an older translator) follows `wave64`.
187 ShaderEntry bare = entry("cs", true);
188 bare.subgroup_size = 0;
189 CHECK(decide_subgroup_size(bare, amd()).size == 64);
190 bare.wave64 = false;
191 CHECK(decide_subgroup_size(bare, amd()).size == 32);
192 // Device sizes that were never queried: nothing is asked for and nothing is reported.
193 CHECK(decide_subgroup_size(entry("cs", true), SubgroupSizeCaps{}).outcome == SubgroupOutcome::unknown_device);
194 // A stage this layer has no pipeline for.
195 CHECK(decide_subgroup_size(entry("rt", true), amd()).outcome == SubgroupOutcome::unknown_stage);
196 // A device that only has 64 runs a wave64 shader as it is.
197 caps = amd();
198 caps.min_size = caps.max_size = caps.default_size = 64;
199 CHECK(decide_subgroup_size(entry("ps", true), caps).outcome == SubgroupOutcome::device_fixed);
200 CHECK(decide_subgroup_size(entry("ps", false), caps).outcome == SubgroupOutcome::unavailable);
201 }
202
203 // --- The create-info chain -------------------------------------------------------------------------------------
204 {
205 const SubgroupSizeCaps caps = amd();
206 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo storage{};
207 VkPipelineShaderStageCreateInfo stage{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO};
208 stage.stage = VK_SHADER_STAGE_COMPUTE_BIT;
209 apply_subgroup_request(decide_subgroup_size(entry("cs", true), caps), storage, stage);
210 CHECK(stage.flags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT);
211 CHECK(stage.pNext == &storage);
212 CHECK(storage.sType == VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO);
213 CHECK(storage.requiredSubgroupSize == 64 && storage.pNext == nullptr);
214
215 // It goes in front of what the stage already chains.
216 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo other{};
217 VkPipelineShaderStageCreateInfo chained{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO};
218 chained.pNext = &other;
219 apply_subgroup_request(decide_subgroup_size(entry("ps", false), caps), storage, chained);
220 CHECK(chained.pNext == &storage && storage.pNext == &other && storage.requiredSubgroupSize == 32);
221 CHECK(chained.flags == 0);
222
223 // A request for nothing leaves the stage alone, whatever the reason.
224 for (const auto& e : {entry("cs", true, {64, 1, 1}, true), entry("vs", true)}) {
225 VkPipelineShaderStageCreateInfo untouched{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO};
226 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo unused{};
227 apply_subgroup_request(decide_subgroup_size(e, caps), unused, untouched);
228 CHECK(untouched.pNext == nullptr && untouched.flags == 0 && unused.sType == 0);
229 }
230 }
231
232 // --- Querying the device ----------------------------------------------------------------------------------------
233 {
234 VkPhysicalDevice device = reinterpret_cast<VkPhysicalDevice>(std::uintptr_t(0x1000));
235 VkPhysicalDevice seen = VK_NULL_HANDLE;
236 const auto fake = [&](VkPhysicalDevice physical, VkPhysicalDeviceProperties2* properties) {
237 seen = physical;
238 auto* subgroup = static_cast<VkPhysicalDeviceSubgroupProperties*>(properties->pNext);
239 auto* control = static_cast<VkPhysicalDeviceSubgroupSizeControlProperties*>(subgroup->pNext);
240 subgroup->subgroupSize = 64;
241 control->minSubgroupSize = 32;
242 control->maxSubgroupSize = 64;
243 control->maxComputeWorkgroupSubgroups = 16;
244 control->requiredSubgroupSizeStages = amd_stages;
245 };
246 SubgroupSizeCaps caps;
247 CHECK(query_subgroup_size_caps(fake, device, true, false, caps));
248 CHECK(seen == device);
249 CHECK(caps.default_size == 64 && caps.min_size == 32 && caps.max_size == 64 &&
250 caps.max_compute_workgroup_subgroups == 16 && caps.required_stages == amd_stages);
251 CHECK(caps.subgroup_size_control && !caps.compute_full_subgroups);
252 }
253
254 std::printf("subgroup size decision: AMD-like, NVIDIA-like, old RADV, limits, create-info chain and query OK\n");
255 return 0;
256}
diff --git a/runtime/test/vk_bc_zero_init_test.cpp b/runtime/test/vk_bc_zero_init_test.cpp
new file mode 100644
index 000000000..6edc36fcb
--- /dev/null
+++ b/runtime/test/vk_bc_zero_init_test.cpp
@@ -0,0 +1,388 @@
1// Committed block-compressed (BC*) texture zero-initialization regression (D3D-220, #1725):
2// D3D12 committed textures start zeroed unless D3D12_HEAP_FLAG_CREATE_NOT_ZEROED is set. Vulkan forbids
3// vkCmdClearColorImage on BC formats, so detail::initialize() must zero-fill them via vkCmdCopyBufferToImage
4// from either the device zero page (vk.zero_buffer) or a zeroed transfer-scratch chunk (vk.copy_scratch).
5//
6// Cases (all on explicitly poisoned 0x5A backing memory when host-visible, plus default device memory):
7// 1. Path A (vk.zero_buffer): CopyTextureRegion R32G32_UINT 2x2 -> BC1 16x16 at (8, 4) — untouched blocks are 0x00.
8// 2. Path A (vk.zero_buffer): CopyResource R32G32_UINT 3x2 -> BC1 12x8, 2 mips — mip 1 untouched block (bytes 56..63) is 0x00.
9// 3. Path A (tiny 32-byte vk.zero_buffer): 32x32 BC7 image tiled in multiple row/column chunks — all 1024 bytes are 0x00.
10// 4. Path B (enable_copy_scratch, no zero_buffer — matches d3d12_copy_xfmt): both D3D-220 cases match bit for bit.
11// 5. not_zeroed = true (CREATE_NOT_ZEROED): zero-fill is skipped.
12// Skips with exit code 77 when no Vulkan 1.3 device with textureCompressionBC is available. No game data.
13#include "vk_test_device.h"
14#include "../src/vulkan_backend.h"
15
16#include <algorithm>
17#include <cstdint>
18#include <cstdio>
19#include <cstring>
20#include <vector>
21
22#define EXPECT(condition) do { \
23 if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \
24} while (0)
25
26namespace {
27
28struct OwnedImage {
29 VkDevice device = VK_NULL_HANDLE;
30 PFN_vkDestroyImage destroy_image = nullptr;
31 PFN_vkFreeMemory free_memory = nullptr;
32 VkImage image = VK_NULL_HANDLE;
33 VkDeviceMemory memory = VK_NULL_HANDLE;
34 bool poisoned = false;
35
36 ~OwnedImage() {
37 if (image && destroy_image) destroy_image(device, image, nullptr);
38 if (memory && free_memory) free_memory(device, memory, nullptr);
39 }
40 OwnedImage(const OwnedImage&) = delete;
41 OwnedImage& operator=(const OwnedImage&) = delete;
42 OwnedImage() = default;
43};
44
45bool create_image(const vktest::Device& d, VkFormat format, std::uint32_t width, std::uint32_t height,
46 std::uint32_t mips, VkBuffer poison_buf, OwnedImage& out) {
47 out.device = d.device;
48 out.destroy_image = d.fn<PFN_vkDestroyImage>("vkDestroyImage");
49 out.free_memory = d.fn<PFN_vkFreeMemory>("vkFreeMemory");
50
51 VkImageCreateInfo info{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
52 info.imageType = VK_IMAGE_TYPE_2D;
53 info.format = format;
54 info.extent = {width, height, 1};
55 info.mipLevels = mips;
56 info.arrayLayers = 1;
57 info.samples = VK_SAMPLE_COUNT_1_BIT;
58 info.tiling = VK_IMAGE_TILING_OPTIMAL;
59 info.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
60 if (d.fn<PFN_vkCreateImage>("vkCreateImage")(d.device, &info, nullptr, &out.image) != VK_SUCCESS) return false;
61
62 VkMemoryRequirements req{};
63 d.fn<PFN_vkGetImageMemoryRequirements>("vkGetImageMemoryRequirements")(d.device, out.image, &req);
64 VkPhysicalDeviceMemoryProperties mp{};
65 d.instance_fn<PFN_vkGetPhysicalDeviceMemoryProperties>("vkGetPhysicalDeviceMemoryProperties")(d.physical, &mp);
66
67 std::uint32_t type = UINT32_MAX;
68 for (std::uint32_t i = 0; i < mp.memoryTypeCount; ++i) {
69 if (!(req.memoryTypeBits & (1u << i))) continue;
70 if (type == UINT32_MAX) type = i;
71 if (mp.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
72 type = i;
73 break;
74 }
75 }
76 if (type == UINT32_MAX) return false;
77
78 VkMemoryAllocateInfo alloc{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
79 alloc.allocationSize = req.size;
80 alloc.memoryTypeIndex = type;
81 if (d.fn<PFN_vkAllocateMemory>("vkAllocateMemory")(d.device, &alloc, nullptr, &out.memory) != VK_SUCCESS)
82 return false;
83 if (d.fn<PFN_vkBindImageMemory>("vkBindImageMemory")(d.device, out.image, out.memory, 0) != VK_SUCCESS)
84 return false;
85
86 // Pre-fill every mip on the GPU with 0x5A so stale recycled VRAM is modeled deterministically on every GPU
87 // (discrete and integrated alike), before registering the image in LayoutTracker as UNDEFINED.
88 if (poison_buf) {
89 const bool ok = const_cast<vktest::Device&>(d).run([&](VkCommandBuffer cb) {
90 VkImageMemoryBarrier to_dst{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
91 to_dst.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
92 to_dst.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
93 to_dst.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
94 to_dst.srcQueueFamilyIndex = to_dst.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
95 to_dst.image = out.image;
96 to_dst.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, mips, 0, 1};
97 d.fn<PFN_vkCmdPipelineBarrier>("vkCmdPipelineBarrier")(cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
98 VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0,
99 nullptr, 1, &to_dst);
100 std::vector<VkBufferImageCopy> regions;
101 for (std::uint32_t m = 0; m < mips; ++m) {
102 VkBufferImageCopy r{};
103 r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, m, 0, 1};
104 r.imageExtent = {std::max(1u, width >> m), std::max(1u, height >> m), 1};
105 regions.push_back(r);
106 }
107 d.fn<PFN_vkCmdCopyBufferToImage>("vkCmdCopyBufferToImage")(
108 cb, poison_buf, out.image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, std::uint32_t(regions.size()),
109 regions.data());
110 return true;
111 });
112 if (!ok) return false;
113 out.poisoned = true;
114 }
115 return true;
116}
117
118VkDeviceMemory allocate_device_local(const vktest::Device& d, const VkMemoryRequirements& req) {
119 VkPhysicalDeviceMemoryProperties mp{};
120 d.instance_fn<PFN_vkGetPhysicalDeviceMemoryProperties>("vkGetPhysicalDeviceMemoryProperties")(d.physical, &mp);
121 std::uint32_t chosen = UINT32_MAX;
122 for (std::uint32_t i = 0; i < mp.memoryTypeCount; ++i) {
123 if (!(req.memoryTypeBits & (1u << i))) continue;
124 if (chosen == UINT32_MAX) chosen = i;
125 if (mp.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
126 chosen = i;
127 break;
128 }
129 }
130 if (chosen == UINT32_MAX) return VK_NULL_HANDLE;
131 VkMemoryAllocateInfo info{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
132 info.allocationSize = req.size;
133 info.memoryTypeIndex = chosen;
134 VkDeviceMemory mem = VK_NULL_HANDLE;
135 if (d.fn<PFN_vkAllocateMemory>("vkAllocateMemory")(d.device, &info, nullptr, &mem) != VK_SUCCESS)
136 return VK_NULL_HANDLE;
137 return mem;
138}
139
140// Runs the two D3D-220 partial uncompressed -> BC1 copies on a given context/queue:
141// (a) CopyTextureRegion R32G32_UINT 2x2 -> BC1 16x16 at (8, 4)
142// (b) CopyResource R32G32_UINT 3x2 -> BC1 12x8, 2 mips
143int run_d3d220_cases(const vktest::Device& d, leonida::VulkanContext& ctx, leonida::VulkanQueue& q,
144 VkBuffer poison_buf, VkBuffer up_buf, void* up_ptr, VkBuffer rb_buf, void* rb_ptr,
145 const char* label) {
146 using namespace leonida;
147
148 auto* up = static_cast<std::uint8_t*>(up_ptr);
149 auto* rb = static_cast<std::uint8_t*>(rb_ptr);
150 for (std::size_t i = 0; i < 4096; ++i) up[i] = static_cast<std::uint8_t>(i * 7 + 3);
151
152 // Case (a): CopyTextureRegion R32G32_UINT 2x2 -> BC1 16x16 at (8, 4).
153 // Destination has 4x4 BC1 blocks (8 bytes/block). Only blocks (2,1), (3,1), (2,2), (3,2) are written;
154 // the other 12 blocks (including block (0,0) at byte 0) must be 0x00.
155 {
156 OwnedImage src_img, dst_img;
157 EXPECT(create_image(d, VK_FORMAT_R32G32_UINT, 2, 2, 1, VK_NULL_HANDLE, src_img));
158 EXPECT(create_image(d, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, 16, 16, 1, poison_buf, dst_img));
159
160 ResourceBinding src_rb{};
161 src_rb.image = src_img.image;
162 src_rb.format = VK_FORMAT_R32G32_UINT;
163 src_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
164 src_rb.width = 2; src_rb.height = 2; src_rb.mip_levels = 1; src_rb.array_layers = 1; src_rb.depth = 1; src_rb.samples = 1;
165
166 ResourceBinding dst_rb{};
167 dst_rb.image = dst_img.image;
168 dst_rb.format = VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
169 dst_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
170 dst_rb.width = 16; dst_rb.height = 16; dst_rb.mip_levels = 1; dst_rb.array_layers = 1; dst_rb.depth = 1; dst_rb.samples = 1;
171
172 ctx.add_resource(10, src_rb, VK_IMAGE_LAYOUT_UNDEFINED);
173 ctx.add_resource(11, dst_rb, VK_IMAGE_LAYOUT_UNDEFINED);
174 std::memset(rb, 0xCD, 4096);
175
176 CommandList list;
177 CopyLocation up_loc{1, true, 0, 0, 2, 2, 1, 256};
178 CopyLocation src_loc{10, false, 0, 0, 0, 0, 0, 0};
179 CopyLocation dst_loc{11, false, 0, 0, 0, 0, 0, 0};
180 CopyLocation rb_loc{2, true, 0, 0, 16, 16, 1, 256};
181 EXPECT(list.copy_texture({src_loc, 0, 0, 0, up_loc, false, {}}));
182 EXPECT(list.transition({10, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
183 EXPECT(list.copy_texture({dst_loc, 8, 4, 0, src_loc, false, {}}));
184 EXPECT(list.transition({11, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
185 EXPECT(list.copy_texture({rb_loc, 0, 0, 0, dst_loc, false, {}}));
186 EXPECT(list.close());
187
188 const CommandList* ptr = &list;
189 EXPECT(q.execute({&ptr, 1}) == ReplayResult::success);
190 EXPECT(q.idle());
191
192 // Check every 8-byte block across the 4x4 block grid (row pitch 256).
193 for (std::uint32_t by = 0; by < 4; ++by) {
194 for (std::uint32_t bx = 0; bx < 4; ++bx) {
195 const std::uint8_t* got = rb + std::size_t(by) * 256 + std::size_t(bx) * 8;
196 if (bx >= 2 && bx < 4 && by >= 1 && by < 3) {
197 const std::uint8_t* want = up + std::size_t(by - 1) * 256 + std::size_t(bx - 2) * 8;
198 EXPECT(std::memcmp(got, want, 8) == 0);
199 } else {
200 for (int k = 0; k < 8; ++k) EXPECT(got[k] == 0x00);
201 }
202 }
203 }
204 ctx.remove_resource(10);
205 ctx.remove_resource(11);
206 }
207
208 // Case (b): CopyResource R32G32_UINT 3x2 -> BC1 12x8, 2 mips.
209 // Mip 0: 3x2 -> 12x8 (3x2 = 6 blocks written).
210 // Mip 1: 1x1 -> 6x4 (2x1 = 2 blocks; block 0 is written, block 1 at bytes 8..15 of mip 1 is untouched -> 0x00).
211 {
212 OwnedImage src_img, dst_img;
213 EXPECT(create_image(d, VK_FORMAT_R32G32_UINT, 3, 2, 2, VK_NULL_HANDLE, src_img));
214 EXPECT(create_image(d, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, 12, 8, 2, poison_buf, dst_img));
215
216 ResourceBinding src_rb{};
217 src_rb.image = src_img.image;
218 src_rb.format = VK_FORMAT_R32G32_UINT;
219 src_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
220 src_rb.width = 3; src_rb.height = 2; src_rb.mip_levels = 2; src_rb.array_layers = 1; src_rb.depth = 1; src_rb.samples = 1;
221
222 ResourceBinding dst_rb{};
223 dst_rb.image = dst_img.image;
224 dst_rb.format = VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
225 dst_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
226 dst_rb.width = 12; dst_rb.height = 8; dst_rb.mip_levels = 2; dst_rb.array_layers = 1; dst_rb.depth = 1; dst_rb.samples = 1;
227
228 ctx.add_resource(12, src_rb, VK_IMAGE_LAYOUT_UNDEFINED);
229 ctx.add_resource(13, dst_rb, VK_IMAGE_LAYOUT_UNDEFINED);
230 std::memset(rb, 0xCD, 4096);
231
232 // Upload mip 0 at offset 0 (2 rows * 256 = 512 bytes) and mip 1 at offset 512 (1 row * 256).
233 CommandList list;
234 CopyLocation up0{1, true, 0, 0, 3, 2, 1, 256};
235 CopyLocation up1{1, true, 0, 512, 1, 1, 1, 256};
236 CopyLocation src0{12, false, 0, 0, 0, 0, 0, 0};
237 CopyLocation src1{12, false, 1, 0, 0, 0, 0, 0};
238 CopyLocation dst0{13, false, 0, 0, 0, 0, 0, 0};
239 CopyLocation dst1{13, false, 1, 0, 0, 0, 0, 0};
240 CopyLocation rb0{2, true, 0, 0, 12, 8, 1, 256};
241 CopyLocation rb1{2, true, 0, 512, 6, 4, 1, 256};
242 EXPECT(list.copy_texture({src0, 0, 0, 0, up0, false, {}}));
243 EXPECT(list.copy_texture({src1, 0, 0, 0, up1, false, {}}));
244 EXPECT(list.transition({12, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
245 EXPECT(list.copy_resource({13, 12}));
246 EXPECT(list.transition({13, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
247 EXPECT(list.copy_texture({rb0, 0, 0, 0, dst0, false, {}}));
248 EXPECT(list.copy_texture({rb1, 0, 0, 0, dst1, false, {}}));
249 EXPECT(list.close());
250
251 const CommandList* ptr = &list;
252 EXPECT(q.execute({&ptr, 1}) == ReplayResult::success);
253 EXPECT(q.idle());
254
255 // Mip 0: 2 rows of 3 blocks (24 bytes per row).
256 EXPECT(std::memcmp(rb + 0, up + 0, 24) == 0);
257 EXPECT(std::memcmp(rb + 256, up + 256, 24) == 0);
258 // Mip 1: block 0 (bytes 0..7) matches up + 512; untouched block 1 (bytes 8..15) must be 0x00.
259 EXPECT(std::memcmp(rb + 512, up + 512, 8) == 0);
260 for (int k = 8; k < 16; ++k) EXPECT(rb[512 + k] == 0x00);
261
262 ctx.remove_resource(12);
263 ctx.remove_resource(13);
264 }
265
266 (void)up_buf;
267 (void)rb_buf;
268 std::printf("bc zero-init (%s): partial CopyTextureRegion and 2-mip CopyResource ok\n", label);
269 return 0;
270}
271
272} // namespace
273
274int main() {
275 using namespace leonida;
276
277 vktest::Device d;
278 if (!d.create(false) || !d.bc) {
279 std::fprintf(stderr, "vk_bc_zero_init_test: no Vulkan 1.3 device with BC support, skipped\n");
280 return 77;
281 }
282
283 void* up_ptr = nullptr;
284 void* rb_ptr = nullptr;
285 void* zero_ptr = nullptr;
286 void* poison_ptr = nullptr;
287 const VkBuffer up_buf = d.buffer(4096, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &up_ptr);
288 const VkBuffer rb_buf = d.buffer(8192, VK_BUFFER_USAGE_TRANSFER_DST_BIT, &rb_ptr);
289 const VkBuffer zero_buf = d.buffer(65536, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &zero_ptr);
290 const VkBuffer poison_buf = d.buffer(4096, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &poison_ptr);
291 EXPECT(up_buf && rb_buf && zero_buf && poison_buf);
292 std::memset(zero_ptr, 0, 65536);
293 std::memset(poison_ptr, 0x5A, 4096);
294
295 ResourceBinding up_rb{};
296 up_rb.buffer = up_buf;
297 up_rb.size = 4096;
298 ResourceBinding rb_rb{};
299 rb_rb.buffer = rb_buf;
300 rb_rb.size = 8192;
301 rb_rb.host_readable = true;
302
303 // Path A: device arena zero page (vk.zero_buffer).
304 {
305 VulkanContext ctx(d.device_proc, d.device, true);
306 EXPECT(ctx.loaded());
307 ctx.set_zero_page(zero_buf, 0, 65536);
308 ctx.add_resource(1, up_rb);
309 ctx.add_resource(2, rb_rb);
310 VulkanQueue q(ctx, d.queue, d.family);
311 EXPECT(q.ok());
312 EXPECT(run_d3d220_cases(d, ctx, q, poison_buf, up_buf, up_ptr, rb_buf, rb_ptr, "zero_buffer") == 0);
313
314 // Multi-tile chunking: shrink zero_page to 32 bytes (2 BC7 blocks) and zero-init a 32x32 BC7 image (64 blocks).
315 ctx.set_zero_page(zero_buf, 16, 32);
316 OwnedImage bc7_img;
317 EXPECT(create_image(d, VK_FORMAT_BC7_UNORM_BLOCK, 32, 32, 1, poison_buf, bc7_img));
318 ResourceBinding bc7_rb{};
319 bc7_rb.image = bc7_img.image;
320 bc7_rb.format = VK_FORMAT_BC7_UNORM_BLOCK;
321 bc7_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
322 bc7_rb.width = 32; bc7_rb.height = 32; bc7_rb.mip_levels = 1; bc7_rb.array_layers = 1; bc7_rb.depth = 1; bc7_rb.samples = 1;
323 ctx.add_resource(20, bc7_rb, VK_IMAGE_LAYOUT_UNDEFINED);
324 std::memset(rb_ptr, 0xCD, 8192);
325
326 CommandList list;
327 EXPECT(list.transition({20, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
328 CopyLocation bc7_loc{20, false, 0, 0, 0, 0, 0, 0};
329 CopyLocation rb_loc{2, true, 0, 0, 32, 32, 1, 256};
330 EXPECT(list.copy_texture({rb_loc, 0, 0, 0, bc7_loc, false, {}}));
331 EXPECT(list.close());
332 const CommandList* ptr = &list;
333 EXPECT(q.execute({&ptr, 1}) == ReplayResult::success);
334 EXPECT(q.idle());
335
336 auto* rb = static_cast<std::uint8_t*>(rb_ptr);
337 for (std::uint32_t row = 0; row < 8; ++row)
338 for (std::uint32_t x = 0; x < 8 * 16; ++x)
339 EXPECT(rb[row * 256 + x] == 0x00);
340 ctx.remove_resource(20);
341 std::printf("bc zero-init (tiny 32-byte zero_buffer chunking on 32x32 BC7): ok\n");
342
343 // CREATE_NOT_ZEROED (not_zeroed = true) must skip zero-fill.
344 ctx.set_zero_page(zero_buf, 0, 65536);
345 OwnedImage nz_img;
346 EXPECT(create_image(d, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, 16, 16, 1, poison_buf, nz_img));
347 EXPECT(nz_img.poisoned);
348 ResourceBinding nz_rb{};
349 nz_rb.image = nz_img.image;
350 nz_rb.format = VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
351 nz_rb.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
352 nz_rb.width = 16; nz_rb.height = 16; nz_rb.mip_levels = 1; nz_rb.array_layers = 1; nz_rb.depth = 1; nz_rb.samples = 1;
353 nz_rb.not_zeroed = true;
354 ctx.add_resource(21, nz_rb, VK_IMAGE_LAYOUT_UNDEFINED);
355 std::memset(rb_ptr, 0xCD, 8192);
356
357 CommandList nz_list;
358 EXPECT(nz_list.transition({21, all_subresources, d3d12_state::copy_dest, d3d12_state::copy_source}));
359 CopyLocation nz_loc{21, false, 0, 0, 0, 0, 0, 0};
360 CopyLocation nz_rb_loc{2, true, 0, 0, 16, 16, 1, 256};
361 EXPECT(nz_list.copy_texture({nz_rb_loc, 0, 0, 0, nz_loc, false, {}}));
362 EXPECT(nz_list.close());
363 const CommandList* nz_ptr = &nz_list;
364 EXPECT(q.execute({&nz_ptr, 1}) == ReplayResult::success);
365 EXPECT(q.idle());
366 EXPECT(rb[0] == 0x5A);
367 ctx.remove_resource(21);
368 std::printf("bc zero-init (not_zeroed = true skips zero-fill): ok\n");
369 }
370
371 // Path B: copy_scratch + vkCmdFillBuffer fallback (no zero_buffer, matching d3d12_copy_xfmt without BDA).
372 {
373 VulkanContext ctx(d.device_proc, d.device, true);
374 EXPECT(ctx.loaded());
375 ctx.enable_copy_scratch(d.device_proc, [&](const VkMemoryRequirements& req) {
376 return allocate_device_local(d, req);
377 });
378 ctx.add_resource(1, up_rb);
379 ctx.add_resource(2, rb_rb);
380 VulkanQueue q(ctx, d.queue, d.family);
381 EXPECT(q.ok());
382 EXPECT(run_d3d220_cases(d, ctx, q, poison_buf, up_buf, up_ptr, rb_buf, rb_ptr, "copy_scratch") == 0);
383 }
384
385 EXPECT(d.validation_errors() == 0);
386 std::printf("vk_bc_zero_init_test: ok\n");
387 return 0;
388}
diff --git a/runtime/test/vk_bindless_test.cpp b/runtime/test/vk_bindless_test.cpp
index 73ac39013..419a1dda4 100644
--- a/runtime/test/vk_bindless_test.cpp
+++ b/runtime/test/vk_bindless_test.cpp
@@ -24,6 +24,7 @@
24#include "vk_shader_fma.h" 24#include "vk_shader_fma.h"
25#include "../src/vulkan_bindless.h" 25#include "../src/vulkan_bindless.h"
26 26
27#include <algorithm>
27#include <array> 28#include <array>
28#include <cmath> 29#include <cmath>
29#include <cstdio> 30#include <cstdio>
@@ -105,7 +106,7 @@ std::uint32_t probe_depth(std::span<const std::uint32_t> table, const Descriptor
105 106
106int main(int argc, char** argv) { 107int main(int argc, char** argv) {
107 if (argc < 3) { 108 if (argc < 3) {
108 std::fprintf(stderr, "usage: vk_bindless_test <vs_ids.spv> <ps_tex.spv>\n"); 109 std::fprintf(stderr, "usage: vk_bindless_test <vs_ids.spv> <ps_tex.spv | ps_imgatomic.spv>\n");
109 return 2; 110 return 2;
110 } 111 }
111 // A bad readback in a single channel must still fail when all three others match. 112 // A bad readback in a single channel must still fail when all three others match.
@@ -225,6 +226,15 @@ int main(int argc, char** argv) {
225 VkPhysicalDeviceFeatures2 enable{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &enable12}; 226 VkPhysicalDeviceFeatures2 enable{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &enable12};
226 enable.features.shaderInt64 = VK_TRUE; 227 enable.features.shaderInt64 = VK_TRUE;
227 enable.features.shaderSampledImageArrayDynamicIndexing = VK_TRUE; 228 enable.features.shaderSampledImageArrayDynamicIndexing = VK_TRUE;
229 // ps_imgatomic: image atomics in a pixel shader need fragment stores and atomics.
230 const bool atomic_mode = std::strstr(argv[2], "imgatomic") != nullptr;
231 if (atomic_mode) {
232 if (!have.features.fragmentStoresAndAtomics) {
233 std::printf("unsupported: fragmentStoresAndAtomics (image atomics in a pixel shader)\n");
234 return unsupported;
235 }
236 enable.features.fragmentStoresAndAtomics = VK_TRUE;
237 }
228 238
229 std::uint32_t qn = 0; 239 std::uint32_t qn = 0;
230 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr); 240 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr);
@@ -260,7 +270,7 @@ int main(int argc, char** argv) {
260 LD(vkDeviceWaitIdle); LD(vkDestroyPipeline); LD(vkDestroyPipelineLayout); 270 LD(vkDeviceWaitIdle); LD(vkDestroyPipeline); LD(vkDestroyPipelineLayout);
261 LD(vkDestroyCommandPool); LD(vkDestroyShaderModule); LD(vkDestroyFramebuffer); LD(vkDestroyRenderPass); 271 LD(vkDestroyCommandPool); LD(vkDestroyShaderModule); LD(vkDestroyFramebuffer); LD(vkDestroyRenderPass);
262 LD(vkDestroySampler); LD(vkDestroyImageView); LD(vkDestroyImage); LD(vkDestroyBuffer); 272 LD(vkDestroySampler); LD(vkDestroyImageView); LD(vkDestroyImage); LD(vkDestroyBuffer);
263 LD(vkFreeMemory); LD(vkDestroyDevice); 273 LD(vkFreeMemory); LD(vkDestroyDevice); LD(vkCmdClearColorImage);
264 VkQueue queue = VK_NULL_HANDLE; 274 VkQueue queue = VK_NULL_HANDLE;
265 vkGetDeviceQueue(dev, qi, 0, &queue); 275 vkGetDeviceQueue(dev, qi, 0, &queue);
266 VkPhysicalDeviceMemoryProperties mp; 276 VkPhysicalDeviceMemoryProperties mp;
@@ -663,6 +673,171 @@ int main(int argc, char** argv) {
663 const std::uint32_t sampler_index = set.add_sampler(nearest); 673 const std::uint32_t sampler_index = set.add_sampler(nearest);
664 EXPECT(decoy_sampler == 1 && sampler_index == 2); 674 EXPECT(decoy_sampler == 1 && sampler_index == 2);
665 675
676 if (atomic_mode) {
677 // ps_imgatomic.asm: image_atomic_umax/umin/or on three 8x8 r32ui images and umax on a 4x4x4 one, from
678 // every pixel of the 64x64 draw (64 pixels per 2D texel), each found through its own T# key. Odd
679 // pixels are discarded after their atomics, which still count.
680 constexpr std::uint32_t atomic_va = 1024, AW = 8, A3 = 4;
681 const std::array<DescriptorKey, 4> keys{{{0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8},
682 {0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8},
683 {0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8},
684 {0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8}}};
685 for (std::uint32_t k = 0; k < 4; ++k)
686 std::memcpy(static_cast<char*>(heap_map) + atomic_va + 32 * k, keys[k].data(), 32);
687 const VkImageUsageFlags atomic_usage =
688 VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
689 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
690 VkImage images[4];
691 VkImageView views[4];
692 for (int k = 0; k < 3; ++k) CHECK(make_image(VK_FORMAT_R32_UINT, AW, AW, atomic_usage, &images[k], &views[k]));
693 { // the 3D image
694 VkImageCreateInfo ii{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
695 ii.imageType = VK_IMAGE_TYPE_3D;
696 ii.format = VK_FORMAT_R32_UINT;
697 ii.extent = {A3, A3, A3};
698 ii.mipLevels = 1;
699 ii.arrayLayers = 1;
700 ii.samples = VK_SAMPLE_COUNT_1_BIT;
701 ii.usage = atomic_usage;
702 CHECK(vkCreateImage(dev, &ii, nullptr, &images[3]));
703 VkMemoryRequirements mr;
704 vkGetImageMemoryRequirements(dev, images[3], &mr);
705 VkMemoryAllocateInfo ai{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
706 ai.allocationSize = mr.size;
707 ai.memoryTypeIndex = memtype(mr.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
708 VkDeviceMemory m;
709 CHECK(vkAllocateMemory(dev, &ai, nullptr, &m));
710 allocations.push_back(m);
711 CHECK(vkBindImageMemory(dev, images[3], m, 0));
712 VkImageViewCreateInfo vi{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO};
713 vi.image = images[3];
714 vi.viewType = VK_IMAGE_VIEW_TYPE_3D;
715 vi.format = VK_FORMAT_R32_UINT;
716 vi.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
717 CHECK(vkCreateImageView(dev, &vi, nullptr, &views[3]));
718 }
719 std::uint32_t indices[4];
720 for (int k = 0; k < 4; ++k) {
721 StorageViews storage;
722 storage.as_uint = views[k];
723 storage.r32ui = views[k];
724 indices[k] = set.add_image(k == 3 ? ImageDimension::dim_3d : ImageDimension::dim_2d, views[k],
725 VK_IMAGE_LAYOUT_GENERAL, storage);
726 EXPECT(indices[k] != 0);
727 EXPECT(set.insert_key(keys[k], indices[k]));
728 }
729 EXPECT(flush());
730
731 // Clear: umax and or start at 0, umin at all ones; then GENERAL for the shader's atomics.
732 CHECK(vkResetCommandBuffer(cmd, 0));
733 CHECK(vkBeginCommandBuffer(cmd, &begin));
734 if (!set.fallbacks_ready()) set.record_fallback_init(cmd);
735 for (int k = 0; k < 4; ++k) {
736 VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
737 b.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
738 b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
739 b.newLayout = VK_IMAGE_LAYOUT_GENERAL;
740 b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
741 b.image = images[k];
742 b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
743 vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0,
744 nullptr, 0, nullptr, 1, &b);
745 VkClearColorValue value{};
746 for (auto& c : value.uint32) c = k == 1 ? 0xFFFFFFFFu : 0u;
747 vkCmdClearColorImage(cmd, images[k], VK_IMAGE_LAYOUT_GENERAL, &value, 1, &b.subresourceRange);
748 b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
749 b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
750 b.oldLayout = b.newLayout = VK_IMAGE_LAYOUT_GENERAL;
751 vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0,
752 nullptr, 0, nullptr, 1, &b);
753 }
754 CHECK(submit());
755
756 // The draw, then the images and the render target read back.
757 const VkDeviceSize image_bytes = 3 * AW * AW * 4 + A3 * A3 * A3 * 4;
758 VkBuffer atomic_readback;
759 void* atomic_map;
760 CHECK(make_buffer(image_bytes, VK_BUFFER_USAGE_TRANSFER_DST_BIT, &atomic_readback, &atomic_map));
761 CHECK(vkResetCommandBuffer(cmd, 0));
762 CHECK(vkBeginCommandBuffer(cmd, &begin));
763 VkClearValue clear{};
764 for (float& channel : clear.color.float32) channel = 0.25f;
765 VkRenderPassBeginInfo rbi{VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO};
766 rbi.renderPass = pass;
767 rbi.framebuffer = framebuffer;
768 rbi.renderArea = scissor;
769 rbi.clearValueCount = 1;
770 rbi.pClearValues = &clear;
771 vkCmdBeginRenderPass(cmd, &rbi, VK_SUBPASS_CONTENTS_INLINE);
772 vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
773 const VkDescriptorSet bound = set.set();
774 vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1, &bound, 0, nullptr);
775 std::uint32_t block[36] = {};
776 block[2] = atomic_va;
777 block[32] = std::uint32_t(heap_base);
778 block[33] = std::uint32_t(heap_base >> 32);
779 vkCmdPushConstants(cmd, pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0,
780 sizeof(block), block);
781 vkCmdDraw(cmd, 3, 1, 0, 0);
782 vkCmdEndRenderPass(cmd);
783 VkMemoryBarrier after{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
784 after.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
785 after.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
786 vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &after,
787 0, nullptr, 0, nullptr);
788 VkDeviceSize offset = 0;
789 for (int k = 0; k < 4; ++k) {
790 VkBufferImageCopy rc{};
791 rc.bufferOffset = offset;
792 rc.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
793 rc.imageExtent = k == 3 ? VkExtent3D{A3, A3, A3} : VkExtent3D{AW, AW, 1};
794 vkCmdCopyImageToBuffer(cmd, images[k], VK_IMAGE_LAYOUT_GENERAL, atomic_readback, 1, &rc);
795 offset += k == 3 ? A3 * A3 * A3 * 4 : AW * AW * 4;
796 }
797 VkBufferImageCopy tc{};
798 tc.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
799 tc.imageExtent = {W, H, 1};
800 vkCmdCopyImageToBuffer(cmd, target, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, readback, 1, &tc);
801 CHECK(submit());
802
803 // The model: every pixel's atomics, discarded or not.
804 std::vector<std::uint32_t> want(3 * AW * AW + A3 * A3 * A3, 0);
805 for (std::uint32_t t = 0; t < AW * AW; ++t) want[AW * AW + t] = 0xFFFFFFFFu;
806 for (std::uint32_t py = 0; py < H; ++py)
807 for (std::uint32_t px = 0; px < W; ++px) {
808 const std::uint32_t id = px + 64 * py, t = (py >> 3) * AW + (px >> 3);
809 want[t] = std::max(want[t], id);
810 want[AW * AW + t] = std::min(want[AW * AW + t], id);
811 want[2 * AW * AW + t] |= 1u << (id & 31);
812 const std::uint32_t v = ((px & 3) * A3 + (py >> 4)) * A3 + (px >> 4);
813 want[3 * AW * AW + v] = std::max(want[3 * AW * AW + v], id);
814 }
815 const auto* got = static_cast<const std::uint32_t*>(atomic_map);
816 const char* names[] = {"2D umax", "2D umin", "2D or", "3D umax"};
817 unsigned wrong = 0;
818 for (std::size_t i = 0; i < want.size(); ++i) {
819 if (got[i] == want[i]) continue;
820 const int k = i < 3 * AW * AW ? int(i / (AW * AW)) : 3;
821 if (wrong++ < 8)
822 std::printf(" %s texel %zu: got 0x%08x, want 0x%08x\n", names[k],
823 k == 3 ? i - 3 * AW * AW : i % (AW * AW), got[i], want[i]);
824 }
825 const float* rt = static_cast<const float*>(readback_map);
826 unsigned bad_rt = 0;
827 for (std::uint32_t py = 0; py < H; ++py)
828 for (std::uint32_t px = 0; px < W; ++px)
829 bad_rt += rt[(py * W + px) * 4] != ((px & 1) ? 0.25f : 1.0f);
830 std::printf("ps_imgatomic: %u of %zu texels wrong (2D umax/umin/or 8x8 each, 3D umax 4x4x4); "
831 "%u of %u render-target pixels wrong (odd columns discarded)\n",
832 wrong, want.size(), bad_rt, W * H);
833 vkDeviceWaitIdle(dev);
834 if (g_validation_errors) {
835 std::printf("ps_imgatomic: %u validation errors\n", g_validation_errors);
836 return 1;
837 }
838 return wrong || bad_rt ? 1 : 0;
839 }
840
666 // A view that comes and goes before the set is flushed is never written: a texture created and destroyed 841 // A view that comes and goes before the set is flushed is never written: a texture created and destroyed
667 // between two submissions. Its slots are written once, with the fallback; a write of the destroyed view 842 // between two submissions. Its slots are written once, with the fallback; a write of the destroyed view
668 // would be a validation error. 843 // would be a validation error.
diff --git a/runtime/test/vk_pipeline_check.cpp b/runtime/test/vk_pipeline_check.cpp
index bdefac894..a8fe0eaeb 100644
--- a/runtime/test/vk_pipeline_check.cpp
+++ b/runtime/test/vk_pipeline_check.cpp
@@ -32,6 +32,7 @@
32#include <cctype> 32#include <cctype>
33#include <charconv> 33#include <charconv>
34#include <chrono> 34#include <chrono>
35#include <cmath>
35#include <condition_variable> 36#include <condition_variable>
36#include <cstdio> 37#include <cstdio>
37#include <cstring> 38#include <cstring>
@@ -395,27 +396,36 @@ int main(int argc, char** argv) {
395 bool cache_feedback = false; 396 bool cache_feedback = false;
396 for (int i = 2; i < argc; i++) { 397 for (int i = 2; i < argc; i++) {
397 std::string a = argv[i]; 398 std::string a = argv[i];
398 auto val = [&] { return i + 1 < argc ? std::string(argv[++i]) : std::string("0"); }; 399 auto value = [&]() -> std::string_view {
399 if (a == "--jobs") jobs = std::max(1u, uint32_t(std::stoul(val()))); 400 if (i + 1 == argc || std::string_view(argv[i + 1]).starts_with("--")) return {};
400 else if (a == "--start") start = std::stoull(val()); 401 return argv[++i];
401 else if (a == "--count") count = std::stoull(val()); 402 };
402 else if (a == "--slow") slow = std::stod(val()); 403 auto number = [&](auto& dest) {
403 else if (a == "--stage") stage_filter = val(); 404 const auto text = value();
405 if (text.empty()) return false;
406 const auto end = text.data() + text.size();
407 const auto [ptr, ec] = std::from_chars(text.data(), end, dest);
408 return ec == std::errc{} && ptr == end;
409 };
410 bool valid = true;
411 if (a == "--jobs") {
412 valid = number(jobs);
413 jobs = std::max(1u, jobs);
414 } else if (a == "--start") valid = number(start);
415 else if (a == "--count") valid = number(count);
416 else if (a == "--slow") valid = number(slow) && std::isfinite(slow) && slow >= 0.0;
417 else if (a == "--stage") valid = !(stage_filter = value()).empty();
404 else if (a == "--compute-only") stage_filter = "cs"; 418 else if (a == "--compute-only") stage_filter = "cs";
405 else if (a == "--graphics-only") stage_filter = "graphics"; 419 else if (a == "--graphics-only") stage_filter = "graphics";
406 else if (a == "--max-bytes") max_bytes = std::stoull(val()); 420 else if (a == "--max-bytes") valid = number(max_bytes);
407 else if (a == "--large-module-bytes") { 421 else if (a == "--large-module-bytes") valid = number(large_module_bytes);
408 const std::string_view value = i + 1 < argc ? argv[++i] : ""; 422 else if (a == "--stats") valid = !(stats_path = value()).empty();
409 const auto end = value.data() + value.size();
410 const auto [ptr, ec] = std::from_chars(value.data(), end, large_module_bytes);
411 if (ec != std::errc{} || ptr != end) {
412 std::fprintf(stderr, "--large-module-bytes requires a non-negative byte count\n");
413 return 2;
414 }
415 }
416 else if (a == "--stats") stats_path = val();
417 else if (a == "--cache-feedback") cache_feedback = true; 423 else if (a == "--cache-feedback") cache_feedback = true;
418 else cache_path = a; 424 else cache_path = a;
425 if (!valid) {
426 std::fprintf(stderr, "%s requires a valid value\n", a.c_str());
427 return 2;
428 }
419 } 429 }
420 if (stage_filter != "all" && stage_filter != "cs" && stage_filter != "graphics") { 430 if (stage_filter != "all" && stage_filter != "cs" && stage_filter != "graphics") {
421 std::fprintf(stderr, "unknown --stage '%s' (expected: all, cs, graphics)\n", stage_filter.c_str()); 431 std::fprintf(stderr, "unknown --stage '%s' (expected: all, cs, graphics)\n", stage_filter.c_str());
diff --git a/runtime/test/vk_presenter_sync_test.cpp b/runtime/test/vk_presenter_sync_test.cpp
index 3748aeec7..46a2531ef 100644
--- a/runtime/test/vk_presenter_sync_test.cpp
+++ b/runtime/test/vk_presenter_sync_test.cpp
@@ -19,10 +19,12 @@
19#include "../src/vulkan_present.h" 19#include "../src/vulkan_present.h"
20 20
21#include <atomic> 21#include <atomic>
22#include <chrono>
22#include <cmath> 23#include <cmath>
23#include <cstdint> 24#include <cstdint>
24#include <cstdio> 25#include <cstdio>
25#include <cstdlib> 26#include <cstdlib>
27#include <functional>
26#include <string_view> 28#include <string_view>
27#include <thread> 29#include <thread>
28#include <vector> 30#include <vector>
@@ -49,10 +51,12 @@ namespace driver {
49PFN_vkGetInstanceProcAddr real_get_instance = nullptr; 51PFN_vkGetInstanceProcAddr real_get_instance = nullptr;
50PFN_vkGetDeviceProcAddr real_get_device = nullptr; 52PFN_vkGetDeviceProcAddr real_get_device = nullptr;
51PFN_vkQueueSubmit real_submit = nullptr; 53PFN_vkQueueSubmit real_submit = nullptr;
54PFN_vkQueuePresentKHR real_present = nullptr;
52PFN_vkCmdPipelineBarrier real_barrier = nullptr; 55PFN_vkCmdPipelineBarrier real_barrier = nullptr;
53PFN_vkCmdCopyImageToBuffer real_copy_i2b = nullptr; 56PFN_vkCmdCopyImageToBuffer real_copy_i2b = nullptr;
54 57
55std::atomic<VkResult> fail_next_submit{VK_SUCCESS}; 58std::atomic<VkResult> fail_next_submit{VK_SUCCESS};
59std::function<void()> on_next_present;
56std::atomic<bool> observe_capture{false}; 60std::atomic<bool> observe_capture{false};
57std::atomic<bool> saw_capture_waw{false}; 61std::atomic<bool> saw_capture_waw{false};
58std::atomic<std::uint32_t> capture_copies{0}; 62std::atomic<std::uint32_t> capture_copies{0};
@@ -65,6 +69,15 @@ VKAPI_ATTR VkResult VKAPI_CALL queue_submit(VkQueue queue, std::uint32_t count,
65 return real_submit(queue, count, submits, fence); 69 return real_submit(queue, count, submits, fence);
66} 70}
67 71
72VKAPI_ATTR VkResult VKAPI_CALL queue_present(VkQueue queue, const VkPresentInfoKHR* info) {
73 if (on_next_present) {
74 auto cb = std::move(on_next_present);
75 on_next_present = {};
76 cb();
77 }
78 return real_present(queue, info);
79}
80
68VKAPI_ATTR void VKAPI_CALL cmd_pipeline_barrier(VkCommandBuffer cb, VkPipelineStageFlags src_stage, 81VKAPI_ATTR void VKAPI_CALL cmd_pipeline_barrier(VkCommandBuffer cb, VkPipelineStageFlags src_stage,
69 VkPipelineStageFlags dst_stage, VkDependencyFlags flags, 82 VkPipelineStageFlags dst_stage, VkDependencyFlags flags,
70 std::uint32_t mem_count, const VkMemoryBarrier* mem, 83 std::uint32_t mem_count, const VkMemoryBarrier* mem,
@@ -100,6 +113,7 @@ VKAPI_ATTR void VKAPI_CALL cmd_copy_image_to_buffer(VkCommandBuffer cb, VkImage
100VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char* name) { 113VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char* name) {
101 const std::string_view n = name; 114 const std::string_view n = name;
102 if (n == "vkQueueSubmit") return reinterpret_cast<PFN_vkVoidFunction>(queue_submit); 115 if (n == "vkQueueSubmit") return reinterpret_cast<PFN_vkVoidFunction>(queue_submit);
116 if (n == "vkQueuePresentKHR") return reinterpret_cast<PFN_vkVoidFunction>(queue_present);
103 if (n == "vkCmdPipelineBarrier") return reinterpret_cast<PFN_vkVoidFunction>(cmd_pipeline_barrier); 117 if (n == "vkCmdPipelineBarrier") return reinterpret_cast<PFN_vkVoidFunction>(cmd_pipeline_barrier);
104 if (n == "vkCmdCopyImageToBuffer") return reinterpret_cast<PFN_vkVoidFunction>(cmd_copy_image_to_buffer); 118 if (n == "vkCmdCopyImageToBuffer") return reinterpret_cast<PFN_vkVoidFunction>(cmd_copy_image_to_buffer);
105 return real_get_device(device, name); 119 return real_get_device(device, name);
@@ -114,6 +128,7 @@ void install(PFN_vkGetInstanceProcAddr instance_proc, VkInstance instance, VkDev
114 real_get_instance = instance_proc; 128 real_get_instance = instance_proc;
115 real_get_device = reinterpret_cast<PFN_vkGetDeviceProcAddr>(instance_proc(instance, "vkGetDeviceProcAddr")); 129 real_get_device = reinterpret_cast<PFN_vkGetDeviceProcAddr>(instance_proc(instance, "vkGetDeviceProcAddr"));
116 real_submit = reinterpret_cast<PFN_vkQueueSubmit>(real_get_device(device, "vkQueueSubmit")); 130 real_submit = reinterpret_cast<PFN_vkQueueSubmit>(real_get_device(device, "vkQueueSubmit"));
131 real_present = reinterpret_cast<PFN_vkQueuePresentKHR>(real_get_device(device, "vkQueuePresentKHR"));
117 real_barrier = reinterpret_cast<PFN_vkCmdPipelineBarrier>(real_get_device(device, "vkCmdPipelineBarrier")); 132 real_barrier = reinterpret_cast<PFN_vkCmdPipelineBarrier>(real_get_device(device, "vkCmdPipelineBarrier"));
118 real_copy_i2b = reinterpret_cast<PFN_vkCmdCopyImageToBuffer>(real_get_device(device, "vkCmdCopyImageToBuffer")); 133 real_copy_i2b = reinterpret_cast<PFN_vkCmdCopyImageToBuffer>(real_get_device(device, "vkCmdCopyImageToBuffer"));
119} 134}
@@ -193,15 +208,36 @@ int main() {
193 EXPECT(presenter.ok()); 208 EXPECT(presenter.ok());
194 EXPECT(presenter.enable_capture()); 209 EXPECT(presenter.enable_capture());
195 210
196 // 1. Failed vkQueueSubmit must NOT commit the UNDEFINED -> GENERAL transition in LayoutTracker. 211 // 1. Failed vkQueueSubmit must NOT commit the UNDEFINED -> GENERAL transition in LayoutTracker (O(1) rollback
212 // even with many live tracked textures), and tracker_mutex_ must be released before vkQueuePresentKHR.
213 for (ResourceId extra = 1000; extra < 1512; ++extra)
214 context.add_resource(extra, side_rb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
197 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_UNDEFINED); 215 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_UNDEFINED);
198 driver::fail_next_submit.store(VK_ERROR_OUT_OF_HOST_MEMORY); 216 driver::fail_next_submit.store(VK_ERROR_OUT_OF_HOST_MEMORY);
199 EXPECT(presenter.present(1, true) == VK_ERROR_OUT_OF_HOST_MEMORY); 217 EXPECT(presenter.present(1, true) == VK_ERROR_OUT_OF_HOST_MEMORY);
200 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_UNDEFINED); 218 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_UNDEFINED);
201 219 EXPECT(context.layout(1000, 0) == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
202 // Next present succeeds, runs the deferred zero-fill, and commits GENERAL. 220
221 // Next present succeeds, runs the deferred zero-fill, commits GENERAL, and unlocks tracker_mutex_ before
222 // vkQueuePresentKHR so other threads' emit() / layout() calls are not blocked by presentation.
223 std::atomic<bool> read_done{false};
224 VkImageLayout seen_during_present = VK_IMAGE_LAYOUT_UNDEFINED;
225 bool unblocked_during_present = false;
226 std::thread reader;
227 driver::on_next_present = [&] {
228 reader = std::thread([&] {
229 seen_during_present = context.layout(1, 0);
230 read_done.store(true, std::memory_order_release);
231 });
232 std::this_thread::sleep_for(std::chrono::milliseconds(30));
233 unblocked_during_present = read_done.load(std::memory_order_acquire);
234 };
203 EXPECT(presenter.present(1, true) == VK_SUCCESS); 235 EXPECT(presenter.present(1, true) == VK_SUCCESS);
236 if (reader.joinable()) reader.join();
237 EXPECT(unblocked_during_present);
238 EXPECT(seen_during_present == VK_IMAGE_LAYOUT_GENERAL);
204 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_GENERAL); 239 EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_GENERAL);
240 for (ResourceId extra = 1000; extra < 1512; ++extra) context.remove_resource(extra);
205 std::vector<std::uint8_t> pixels; 241 std::vector<std::uint8_t> pixels;
206 VkExtent2D ext{}; 242 VkExtent2D ext{};
207 VkFormat fmt = VK_FORMAT_UNDEFINED; 243 VkFormat fmt = VK_FORMAT_UNDEFINED;
diff --git a/runtime/test/vk_queue_query_sync_test.cpp b/runtime/test/vk_queue_query_sync_test.cpp
new file mode 100644
index 000000000..a9daf6477
--- /dev/null
+++ b/runtime/test/vk_queue_query_sync_test.cpp
@@ -0,0 +1,351 @@
1// VulkanQueue / VulkanContext query-state synchronization and failed-submit wait preservation regressions
2// (runtime/src/vulkan_backend.h):
3// 1. VulkanContext::remove_query_pool() must serialize with tracker_mutex_ so an in-flight VulkanQueue::execute()
4// that already unlocked resource_mutex_ cannot suffer a use-after-free in QueryReplay::commit().
5// 2. VulkanQueue::execute() must acquire tracker_mutex_ before QueryReplay::plan() so concurrent queues see
6// submission-order query state (no data race on QueryPool::ended / QueryPool::occlusion and no stale zero-fill).
7// 3. A transient vkQueueSubmit failure must preserve pending VulkanQueue::wait() timeline semaphores for the retry.
8// 4. Concurrent multi-queue query End/Resolve + add/remove_query_pool stress with zero Vulkan validation errors.
9// Skips with exit code 77 when no Vulkan 1.3 device is available. No game data.
10#include "vk_test_device.h"
11#include "../src/vulkan_backend.h"
12
13#include <atomic>
14#include <chrono>
15#include <cstdint>
16#include <cstdio>
17#include <cstring>
18#include <functional>
19#include <string_view>
20#include <thread>
21#include <vector>
22
23#define EXPECT(condition) do { \
24 if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \
25} while (0)
26
27namespace {
28
29namespace driver {
30PFN_vkGetDeviceProcAddr real_get_device = nullptr;
31PFN_vkQueueSubmit real_submit = nullptr;
32PFN_vkCmdCopyQueryPoolResults real_copy_queries = nullptr;
33PFN_vkCmdFillBuffer real_fill_buffer = nullptr;
34
35std::atomic<VkResult> fail_next_submit{VK_SUCCESS};
36std::atomic<bool> capture_next_waits{false};
37std::atomic<std::uint32_t> captured_wait_count{0};
38std::atomic<std::uintptr_t> captured_wait_sem{0};
39std::atomic<std::uint64_t> captured_wait_val{0};
40
41std::atomic<bool> count_resolves{false};
42std::atomic<std::uint32_t> copy_query_calls{0};
43std::atomic<std::uint32_t> fill_buffer_calls{0};
44
45// Optional one-shot callback invoked inside vkQueueSubmit right before calling the real driver.
46// Returning non-VK_SUCCESS short-circuits the submit with that status.
47std::function<VkResult()> on_next_submit;
48
49VKAPI_ATTR VkResult VKAPI_CALL queue_submit(VkQueue queue, std::uint32_t count, const VkSubmitInfo* submits,
50 VkFence fence) {
51 if (on_next_submit) {
52 auto cb = std::move(on_next_submit);
53 on_next_submit = {};
54 const VkResult override_res = cb();
55 if (override_res != VK_SUCCESS) return override_res;
56 }
57 const VkResult armed = fail_next_submit.exchange(VK_SUCCESS);
58 if (armed != VK_SUCCESS) return armed;
59 if (capture_next_waits.exchange(false) && count > 0 && submits) {
60 captured_wait_count.store(submits[0].waitSemaphoreCount);
61 if (submits[0].waitSemaphoreCount > 0 && submits[0].pWaitSemaphores) {
62 captured_wait_sem.store(reinterpret_cast<std::uintptr_t>(submits[0].pWaitSemaphores[0]));
63 const auto* timeline = reinterpret_cast<const VkTimelineSemaphoreSubmitInfo*>(submits[0].pNext);
64 if (timeline && timeline->sType == VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO &&
65 timeline->waitSemaphoreValueCount > 0 && timeline->pWaitSemaphoreValues) {
66 captured_wait_val.store(timeline->pWaitSemaphoreValues[0]);
67 }
68 }
69 }
70 return real_submit(queue, count, submits, fence);
71}
72
73VKAPI_ATTR void VKAPI_CALL cmd_copy_query_pool_results(VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first,
74 std::uint32_t count, VkBuffer dst, VkDeviceSize offset,
75 VkDeviceSize stride, VkQueryResultFlags flags) {
76 if (count_resolves.load(std::memory_order_relaxed)) copy_query_calls.fetch_add(1, std::memory_order_relaxed);
77 real_copy_queries(cb, pool, first, count, dst, offset, stride, flags);
78}
79
80VKAPI_ATTR void VKAPI_CALL cmd_fill_buffer(VkCommandBuffer cb, VkBuffer dst, VkDeviceSize offset, VkDeviceSize size,
81 std::uint32_t data) {
82 if (count_resolves.load(std::memory_order_relaxed)) fill_buffer_calls.fetch_add(1, std::memory_order_relaxed);
83 real_fill_buffer(cb, dst, offset, size, data);
84}
85
86VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device(VkDevice device, const char* name) {
87 const std::string_view n = name;
88 if (n == "vkQueueSubmit") return reinterpret_cast<PFN_vkVoidFunction>(queue_submit);
89 if (n == "vkCmdCopyQueryPoolResults") return reinterpret_cast<PFN_vkVoidFunction>(cmd_copy_query_pool_results);
90 if (n == "vkCmdFillBuffer") return reinterpret_cast<PFN_vkVoidFunction>(cmd_fill_buffer);
91 return real_get_device(device, name);
92}
93
94void install(PFN_vkGetDeviceProcAddr device_proc, VkDevice device) {
95 real_get_device = device_proc;
96 real_submit = reinterpret_cast<PFN_vkQueueSubmit>(device_proc(device, "vkQueueSubmit"));
97 real_copy_queries =
98 reinterpret_cast<PFN_vkCmdCopyQueryPoolResults>(device_proc(device, "vkCmdCopyQueryPoolResults"));
99 real_fill_buffer = reinterpret_cast<PFN_vkCmdFillBuffer>(device_proc(device, "vkCmdFillBuffer"));
100}
101} // namespace driver
102
103} // namespace
104
105int main() {
106 using namespace leonida;
107
108 vktest::Device d;
109 if (!d.create(false)) {
110 std::fprintf(stderr, "vk_queue_query_sync_test: no Vulkan 1.3 device, skipped\n");
111 return 77;
112 }
113 driver::install(d.device_proc, d.device);
114
115 const auto create_query_pool = d.fn<PFN_vkCreateQueryPool>("vkCreateQueryPool");
116 const auto destroy_query_pool = d.fn<PFN_vkDestroyQueryPool>("vkDestroyQueryPool");
117 EXPECT(create_query_pool && destroy_query_pool);
118
119 auto make_occlusion_pool = [&](std::uint32_t count) -> VkQueryPool {
120 VkQueryPoolCreateInfo info{VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO};
121 info.queryType = VK_QUERY_TYPE_OCCLUSION;
122 info.queryCount = count;
123 VkQueryPool pool = VK_NULL_HANDLE;
124 if (create_query_pool(d.device, &info, nullptr, &pool) != VK_SUCCESS) return VK_NULL_HANDLE;
125 return pool;
126 };
127
128 const VkQueryPool pool_uaf = make_occlusion_pool(2);
129 const VkQueryPool pool_race = make_occlusion_pool(2);
130 const VkQueryPool pool_stress = make_occlusion_pool(32);
131 EXPECT(pool_uaf && pool_race && pool_stress);
132
133 {
134 VulkanContext context(driver::get_device, d.device, true);
135 EXPECT(context.loaded());
136 VulkanQueue queue_a(context, d.queue, d.family);
137 VulkanQueue queue_b(context, d.queue, d.family);
138 EXPECT(queue_a.ok() && queue_b.ok());
139
140 void* src_ptr = nullptr;
141 void* dst_ptr = nullptr;
142 void* res_ptr = nullptr;
143 const VkBuffer src_buf = d.buffer(64, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &src_ptr);
144 const VkBuffer dst_buf = d.buffer(64, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &dst_ptr);
145 const VkBuffer res_buf = d.buffer(64, VK_BUFFER_USAGE_TRANSFER_DST_BIT, &res_ptr);
146 EXPECT(src_buf && dst_buf && res_buf);
147
148 ResourceBinding src_rb{};
149 src_rb.buffer = src_buf;
150 src_rb.size = 64;
151 ResourceBinding dst_rb{};
152 dst_rb.buffer = dst_buf;
153 dst_rb.size = 64;
154 dst_rb.host_readable = true;
155 ResourceBinding res_rb{};
156 res_rb.buffer = res_buf;
157 res_rb.size = 64;
158 res_rb.host_readable = true;
159 context.add_resource(1, src_rb);
160 context.add_resource(2, dst_rb);
161 context.add_resource(3, res_rb);
162
163 // 1. remove_query_pool() must block on tracker_mutex_ while execute() is between resource_lock.unlock() and
164 // QueryReplay::commit(), preventing a use-after-free on the QueryPool* stored in QueryReplay::pending_.
165 {
166 constexpr QueryHeapId heap_id = 77;
167 QueryPool qp{};
168 qp.pool = pool_uaf;
169 qp.heap_type = d3d12_query_heap::occlusion;
170 qp.count = 2;
171 qp.ended.assign(2, false);
172 context.add_query_pool(heap_id, qp);
173
174 CommandList list;
175 EXPECT(list.begin_query({heap_id, d3d12_query::occlusion, 0}));
176 EXPECT(list.end_query({heap_id, d3d12_query::occlusion, 0}));
177 EXPECT(list.close());
178 const CommandList* ptr = &list;
179
180 std::atomic<bool> removed{false};
181 bool removed_during_submit = false;
182 std::thread remover;
183 driver::on_next_submit = [&]() -> VkResult {
184 remover = std::thread([&] {
185 context.remove_query_pool(heap_id);
186 removed.store(true, std::memory_order_release);
187 });
188 std::this_thread::sleep_for(std::chrono::milliseconds(30));
189 removed_during_submit = removed.load(std::memory_order_acquire);
190 // If remove_query_pool already erased the node, abort the submit so queries.commit() does not
191 // corrupt the heap before the EXPECT below reports the failure cleanly.
192 return removed_during_submit ? VK_ERROR_OUT_OF_HOST_MEMORY : VK_SUCCESS;
193 };
194 const ReplayResult exec_res = queue_a.execute({&ptr, 1});
195 if (remover.joinable()) remover.join();
196 EXPECT(!removed_during_submit);
197 EXPECT(exec_res == ReplayResult::success);
198 EXPECT(removed.load(std::memory_order_acquire));
199 EXPECT(context.query_heap_type(heap_id) == ~0u);
200 EXPECT(queue_a.idle());
201 std::printf("queue/query sync: remove_query_pool serialized with QueryReplay::commit ok\n");
202 }
203
204 // 2. Concurrent queue_b.execute(ResolveQueries) must not run QueryReplay::plan() before queue_a commits
205 // EndQuery; otherwise queue_b sees ended[0] == false and emits vkCmdFillBuffer(0) instead of copying.
206 {
207 constexpr QueryHeapId heap_id = 88;
208 QueryPool qp{};
209 qp.pool = pool_race;
210 qp.heap_type = d3d12_query_heap::occlusion;
211 qp.count = 2;
212 qp.ended.assign(2, false);
213 context.add_query_pool(heap_id, qp);
214
215 CommandList end_list;
216 EXPECT(end_list.begin_query({heap_id, d3d12_query::occlusion, 0}));
217 EXPECT(end_list.end_query({heap_id, d3d12_query::occlusion, 0}));
218 EXPECT(end_list.close());
219 const CommandList* end_ptr = &end_list;
220
221 CommandList resolve_list;
222 EXPECT(resolve_list.resolve_queries({heap_id, d3d12_query::occlusion, 0, 1, 3, 0}));
223 EXPECT(resolve_list.close());
224 const CommandList* resolve_ptr = &resolve_list;
225
226 std::memset(res_ptr, 0xAB, 64);
227 driver::copy_query_calls.store(0);
228 driver::fill_buffer_calls.store(0);
229 driver::count_resolves.store(true);
230
231 std::thread resolver;
232 ReplayResult resolve_res = ReplayResult::unsupported;
233 driver::on_next_submit = [&]() -> VkResult {
234 resolver = std::thread([&] { resolve_res = queue_b.execute({&resolve_ptr, 1}); });
235 // Give queue_b ample time to run prepare() and reach QueryReplay::plan() while queue_a holds
236 // tracker_mutex_ (and has already unlocked resource_mutex_).
237 std::this_thread::sleep_for(std::chrono::milliseconds(40));
238 return VK_SUCCESS;
239 };
240
241 const ReplayResult end_res = queue_a.execute({&end_ptr, 1});
242 if (resolver.joinable()) resolver.join();
243 driver::count_resolves.store(false);
244 EXPECT(end_res == ReplayResult::success);
245 EXPECT(resolve_res == ReplayResult::success);
246 EXPECT(queue_a.idle() && queue_b.idle());
247 EXPECT(driver::copy_query_calls.load() == 1);
248 EXPECT(driver::fill_buffer_calls.load() == 0);
249 std::uint64_t resolved = 0xDEADBEEFULL;
250 std::memcpy(&resolved, res_ptr, sizeof(resolved));
251 EXPECT(resolved == 0); // empty occlusion query resolves 0 via vkCmdCopyQueryPoolResults
252 context.remove_query_pool(heap_id);
253 std::printf("queue/query sync: cross-queue QueryReplay::plan serialized with commit ok\n");
254 }
255
256 // 3. A transient vkQueueSubmit failure must preserve pending VulkanQueue::wait() semaphores for the retry.
257 {
258 VulkanFence fence(context, 0);
259 EXPECT(fence.semaphore() != VK_NULL_HANDLE);
260
261 const std::uint64_t pattern = 0x1122334455667788ULL;
262 std::memcpy(src_ptr, &pattern, sizeof(pattern));
263 std::memset(dst_ptr, 0, sizeof(pattern));
264
265 CommandList copy_list;
266 EXPECT(copy_list.copy_buffer({2, 0, 1, 0, sizeof(pattern)}));
267 EXPECT(copy_list.close());
268 const CommandList* ptr = &copy_list;
269
270 queue_a.wait(fence.semaphore(), 1);
271 driver::fail_next_submit.store(VK_ERROR_OUT_OF_HOST_MEMORY);
272 EXPECT(queue_a.execute({&ptr, 1}) == ReplayResult::unsupported);
273
274 // Retry: the pending wait on (fence, 1) must still be attached to the next vkQueueSubmit.
275 EXPECT(fence.signal(1));
276 driver::captured_wait_count.store(0);
277 driver::captured_wait_sem.store(0);
278 driver::captured_wait_val.store(0);
279 driver::capture_next_waits.store(true);
280 EXPECT(queue_a.execute({&ptr, 1}) == ReplayResult::success);
281 EXPECT(queue_a.idle());
282 EXPECT(driver::captured_wait_count.load() == 1);
283 EXPECT(driver::captured_wait_sem.load() == reinterpret_cast<std::uintptr_t>(fence.semaphore()));
284 EXPECT(driver::captured_wait_val.load() == 1);
285
286 std::uint64_t got = 0;
287 std::memcpy(&got, dst_ptr, sizeof(got));
288 EXPECT(got == pattern);
289 std::printf("queue/query sync: pending Wait() preserved across failed vkQueueSubmit ok\n");
290 }
291
292 // 4. Concurrent multi-queue EndQuery + ResolveQueries + temporary query pool add/remove stress.
293 // Each iteration uses a distinct query slot so no slot is reset while another submission resolves it.
294 {
295 constexpr QueryHeapId main_heap = 99;
296 QueryPool qp{};
297 qp.pool = pool_stress;
298 qp.heap_type = d3d12_query_heap::occlusion;
299 qp.count = 32;
300 qp.ended.assign(32, false);
301 context.add_query_pool(main_heap, qp);
302
303 CommandList res_list;
304 EXPECT(res_list.resolve_queries({main_heap, d3d12_query::occlusion, 0, 1, 3, 0}));
305 EXPECT(res_list.close());
306 const CommandList* res_ptr_cmd = &res_list;
307
308 std::atomic<bool> stop{false};
309 std::atomic<bool> worker_err{false};
310 std::thread worker([&] {
311 for (std::uint64_t round = 0; !stop.load(std::memory_order_relaxed); ++round) {
312 if (queue_b.execute({&res_ptr_cmd, 1}) != ReplayResult::success || !queue_b.idle()) {
313 worker_err.store(true);
314 break;
315 }
316 const QueryHeapId temp_id = 1000 + (round % 16);
317 context.add_query_pool(temp_id, qp);
318 context.remove_query_pool(temp_id);
319 }
320 });
321
322 ReplayResult main_err = ReplayResult::success;
323 for (std::uint32_t i = 0; i < 32; ++i) {
324 CommandList end_list;
325 if (!end_list.begin_query({main_heap, d3d12_query::occlusion, i}) ||
326 !end_list.end_query({main_heap, d3d12_query::occlusion, i}) || !end_list.close()) {
327 main_err = ReplayResult::invalid_query;
328 break;
329 }
330 const CommandList* end_ptr = &end_list;
331 main_err = queue_a.execute({&end_ptr, 1});
332 if (main_err != ReplayResult::success) break;
333 }
334 stop.store(true, std::memory_order_relaxed);
335 worker.join();
336 EXPECT(main_err == ReplayResult::success);
337 EXPECT(!worker_err.load());
338 EXPECT(queue_a.idle() && queue_b.idle());
339 context.remove_query_pool(main_heap);
340 std::printf("queue/query sync: concurrent multi-queue query stress ok\n");
341 }
342 }
343
344 destroy_query_pool(d.device, pool_uaf, nullptr);
345 destroy_query_pool(d.device, pool_race, nullptr);
346 destroy_query_pool(d.device, pool_stress, nullptr);
347
348 EXPECT(d.validation_errors() == 0);
349 std::printf("vk_queue_query_sync_test: ok\n");
350 return 0;
351}
diff --git a/runtime/test/vk_sync_validation_selftest.cpp b/runtime/test/vk_sync_validation_selftest.cpp
new file mode 100644
index 000000000..6b6cf380f
--- /dev/null
+++ b/runtime/test/vk_sync_validation_selftest.cpp
@@ -0,0 +1,93 @@
1// Proves that Vulkan synchronization validation reports hazards on this machine when LEONIDA_VK_VALIDATION=1, so a
2// "0 validation errors" from the GPU tests means the layer looked, not that it was absent or silent.
3//
4// vk_test_device.h asks for VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT whenever validation is on.
5// This test records two vkCmdCopyBuffer into the same bytes:
6// - without a barrier between them, synchronization validation must report the write-after-write hazard;
7// - with a transfer -> transfer memory barrier, it must report nothing.
8// The second half keeps the first honest: a layer that reported every copy would fail it.
9//
10// Exit codes: 0 pass; 1 the hazard was not reported, the barrier case was, or the device failed;
11// 77 (ctest skip) when validation is not requested or there is no Vulkan device. No game files, no runtime code.
12#include "vk_test_device.h"
13
14#include <cstdio>
15#include <cstdlib>
16#include <cstring>
17
18namespace {
19
20// Validation errors reported while recording and submitting the two copies, or ~0u when the copies could not run.
21unsigned copy_twice(vktest::Device& d, bool barrier) {
22 void* mapped = nullptr;
23 const VkBuffer src = d.buffer(4096, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, &mapped);
24 const VkBuffer dst = d.buffer(4096, VK_BUFFER_USAGE_TRANSFER_DST_BIT, &mapped);
25 if (!src || !dst) return ~0u;
26 const auto copy = d.fn<PFN_vkCmdCopyBuffer>("vkCmdCopyBuffer");
27 const auto pipeline_barrier = d.fn<PFN_vkCmdPipelineBarrier>("vkCmdPipelineBarrier");
28 const unsigned before = d.validation_errors();
29 const bool ran = d.run([&](VkCommandBuffer cb) {
30 const VkBufferCopy region{0, 0, 4096};
31 copy(cb, src, dst, 1, &region);
32 if (barrier) {
33 VkMemoryBarrier memory{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
34 memory.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
35 memory.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
36 pipeline_barrier(cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &memory, 0,
37 nullptr, 0, nullptr);
38 }
39 copy(cb, src, dst, 1, &region);
40 return true;
41 });
42 return ran ? d.validation_errors() - before : ~0u;
43}
44
45bool validation_requested() {
46#ifdef _MSC_VER
47#pragma warning(push)
48#pragma warning(disable : 4996) // getenv: read once, as vk_test_device.h does
49#endif
50 const char* env = std::getenv("LEONIDA_VK_VALIDATION");
51#ifdef _MSC_VER
52#pragma warning(pop)
53#endif
54 return env && std::strcmp(env, "0") != 0;
55}
56
57} // namespace
58
59int main() {
60 if (!validation_requested()) {
61 std::printf("SKIP vk_sync_validation_selftest: LEONIDA_VK_VALIDATION is not set, nothing to prove\n");
62 return 77;
63 }
64 vktest::Device d;
65 const auto status = d.initialize(); // fails, with a message, when the Khronos layer is not installed
66 if (status == vktest::DeviceStatus::unavailable) {
67 std::printf("SKIP vk_sync_validation_selftest: no Vulkan device\n");
68 return 77;
69 }
70 if (status != vktest::DeviceStatus::ready || !d.validation) {
71 std::fprintf(stderr, "vk_sync_validation_selftest: no validated Vulkan device\n");
72 return 1;
73 }
74 const unsigned hazard = copy_twice(d, false);
75 const unsigned clean = copy_twice(d, true);
76 if (hazard == ~0u || clean == ~0u) {
77 std::fprintf(stderr, "vk_sync_validation_selftest: the copies could not be recorded or submitted\n");
78 return 1;
79 }
80 std::printf("two copies into the same bytes: %u validation error(s) without a barrier, %u with one\n", hazard,
81 clean);
82 if (hazard == 0) {
83 std::fprintf(stderr, "vk_sync_validation_selftest: FAIL, the write-after-write hazard was not reported: "
84 "synchronization validation is not active, so 0 errors elsewhere proves nothing\n");
85 return 1;
86 }
87 if (clean != 0) {
88 std::fprintf(stderr, "vk_sync_validation_selftest: FAIL, the synchronized copies were reported too\n");
89 return 1;
90 }
91 std::printf("vk_sync_validation_selftest: PASS, synchronization validation is active\n");
92 return 0;
93}
diff --git a/runtime/test/vk_test_device.h b/runtime/test/vk_test_device.h
index 0fb490d18..635a3107b 100644
--- a/runtime/test/vk_test_device.h
+++ b/runtime/test/vk_test_device.h
@@ -6,6 +6,7 @@
6#include "vulkan_loader.h" 6#include "vulkan_loader.h"
7#include "../src/vulkan_device_filter.h" 7#include "../src/vulkan_device_filter.h"
8#include "vk_device_pick.h" 8#include "vk_device_pick.h"
9#include "../src/subgroup_size.h"
9 10
10#include <algorithm> 11#include <algorithm>
11#include <cstdint> 12#include <cstdint>
@@ -101,6 +102,8 @@ public:
101 bool request_buffer_device_address = false; // set before create(): enable bufferDeviceAddress where supported 102 bool request_buffer_device_address = false; // set before create(): enable bufferDeviceAddress where supported
102 bool buffer_device_address = false; // enabled: buffer() memory and buffers can be addressed (device_address()) 103 bool buffer_device_address = false; // enabled: buffer() memory and buffers can be addressed (device_address())
103 bool debug_utils = false; // VK_EXT_debug_utils is enabled on the instance 104 bool debug_utils = false; // VK_EXT_debug_utils is enabled on the instance
105 // The subgroup sizes of the device, with subgroupSizeControl and computeFullSubgroups enabled where it has them.
106 leonida::SubgroupSizeCaps subgroup;
104 107
105 Device() = default; 108 Device() = default;
106 Device(const Device&) = delete; 109 Device(const Device&) = delete;
@@ -328,6 +331,15 @@ public:
328 conditional_rendering ? &enable_conditional : nullptr}; 331 conditional_rendering ? &enable_conditional : nullptr};
329 enable13.dynamicRendering = VK_TRUE; 332 enable13.dynamicRendering = VK_TRUE;
330 enable13.synchronization2 = VK_TRUE; 333 enable13.synchronization2 = VK_TRUE;
334 enable13.subgroupSizeControl = features13.subgroupSizeControl;
335 enable13.computeFullSubgroups = features13.computeFullSubgroups;
336 leonida::query_subgroup_size_caps(instance_fn<PFN_vkGetPhysicalDeviceProperties2>("vkGetPhysicalDeviceProperties2"),
337 physical, features13.subgroupSizeControl, features13.computeFullSubgroups,
338 subgroup);
339 std::printf("subgroup sizes: %u..%u (default %u), requirable in stages 0x%x, subgroupSizeControl %s, "
340 "computeFullSubgroups %s\n",
341 subgroup.min_size, subgroup.max_size, subgroup.default_size, unsigned(subgroup.required_stages),
342 subgroup.subgroup_size_control ? "on" : "off", subgroup.compute_full_subgroups ? "on" : "off");
331 // shaderDrawParameters, where available: translated vertex shaders will read BaseVertex and BaseInstance once PR 436 343 // shaderDrawParameters, where available: translated vertex shaders will read BaseVertex and BaseInstance once PR 436
332 // (zero-based VS ids) is in; harmless before. 344 // (zero-based VS ids) is in; harmless before.
333 VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13}; 345 VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13};
@@ -364,6 +376,7 @@ public:
364 queue_info.pQueuePriorities = &priority; 376 queue_info.pQueuePriorities = &priority;
365 VkPhysicalDeviceFeatures enable{}; 377 VkPhysicalDeviceFeatures enable{};
366 enable.textureCompressionBC = features.features.textureCompressionBC; // BC uploads, where available 378 enable.textureCompressionBC = features.features.textureCompressionBC; // BC uploads, where available
379 enable.shaderInt64 = features.features.shaderInt64; // translated shaders declare Int64 (index features)
367 bc = features.features.textureCompressionBC == VK_TRUE; 380 bc = features.features.textureCompressionBC == VK_TRUE;
368 enable.shaderSampledImageArrayDynamicIndexing = bindless; 381 enable.shaderSampledImageArrayDynamicIndexing = bindless;
369 enable.shaderStorageImageArrayDynamicIndexing = bindless; 382 enable.shaderStorageImageArrayDynamicIndexing = bindless;
@@ -434,6 +447,7 @@ public:
434 if (host_image_copy) device_extensions.push_back(host_image_copy_name); 447 if (host_image_copy) device_extensions.push_back(host_image_copy_name);
435 const char* swapchain = "VK_KHR_swapchain"; 448 const char* swapchain = "VK_KHR_swapchain";
436 if (presentation) device_extensions.push_back(swapchain); 449 if (presentation) device_extensions.push_back(swapchain);
450#if defined(VK_KHR_swapchain_maintenance1)
437 VkPhysicalDeviceSwapchainMaintenance1FeaturesKHR swapchain_m1{ 451 VkPhysicalDeviceSwapchainMaintenance1FeaturesKHR swapchain_m1{
438 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_KHR}; 452 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_KHR};
439 if (presentation) { 453 if (presentation) {
@@ -455,6 +469,7 @@ public:
455 } 469 }
456 } 470 }
457 } 471 }
472#endif
458#ifdef VK_KHR_SHADER_FMA_EXTENSION_NAME 473#ifdef VK_KHR_SHADER_FMA_EXTENSION_NAME
459 if (shader_fma) device_extensions.push_back(VK_KHR_SHADER_FMA_EXTENSION_NAME); 474 if (shader_fma) device_extensions.push_back(VK_KHR_SHADER_FMA_EXTENSION_NAME);
460#endif 475#endif
diff --git a/runtime/test/vk_xdxr_build_test.cpp b/runtime/test/vk_xdxr_build_test.cpp
index 136f49f68..6f354b2b2 100644
--- a/runtime/test/vk_xdxr_build_test.cpp
+++ b/runtime/test/vk_xdxr_build_test.cpp
@@ -6,10 +6,11 @@
6// 6//
7// Cases: one triangle; five (two levels); 1000 random triangles; an indexed R16 grid with a 16-byte vertex stride; 7// Cases: one triangle; five (two levels); 1000 random triangles; an indexed R16 grid with a 16-byte vertex stride;
8// R32 indices with R32G32 vertices; a geometry transform; two geometries with an inactive (NaN) triangle; no 8// R32 indices with R32G32 vertices; a geometry transform; two geometries with an inactive (NaN) triangle; no
9// triangles; 5000 triangles (three radix-sort tiles); and a TLAS of four instances (rotated and scaled, one with mask 0, one with no BLAS). 9// triangles; 5000 triangles (many radix-sort tiles); updates (refits) in place and into another buffer; a TLAS of four instances (rotated and scaled, one with mask 0, one with no BLAS).
10// Exit 77 when there is no Vulkan device with bufferDeviceAddress. 10// Exit 77 when there is no Vulkan device with bufferDeviceAddress.
11// `vk_xdxr_build_test <out dir> <triangles>` instead times BLAS builds of that many random triangles (wall clock of 11// `vk_xdxr_build_test <out dir> <triangles>` instead times BLAS builds of that many random triangles (wall clock of
12// one submission each, after one warm-up; result and scratch in device-local memory) and writes nothing. 12// one submission each, after one warm-up; result and scratch in device-local memory), then in-place updates
13// (refits) of the same structure, and writes nothing.
13#include "vk_test_device.h" 14#include "vk_test_device.h"
14#include "../src/xdxr_build.h" 15#include "../src/xdxr_build.h"
15 16
@@ -117,9 +118,12 @@ struct Built {
117 std::vector<Tri> tris; 118 std::vector<Tri> tris;
118}; 119};
119 120
121// With `moved` (the same geometries with new vertex positions) the BLAS is then updated: refitted in place, or with
122// `into_other` into a second buffer, in which case the untouched source is written too, as <name>_source.
120int build_blas(vktest::Device& gpu, XdxrBuilder& builder, const std::string& dir, const std::string& name, 123int build_blas(vktest::Device& gpu, XdxrBuilder& builder, const std::string& dir, const std::string& name,
121 const std::vector<Geometry>& geometries, Built& built, unsigned rays = 0) { 124 const std::vector<Geometry>& geometries, Built& built, unsigned rays = 0,
122 std::vector<Buffer> keep; 125 const std::vector<Geometry>* moved = nullptr, bool into_other = false) {
126 std::vector<Buffer> keep, vertex_buffers;
123 std::vector<XdxrTriangles> descs; 127 std::vector<XdxrTriangles> descs;
124 std::uint32_t total = 0; 128 std::uint32_t total = 0;
125 for (std::size_t g = 0; g < geometries.size(); ++g) { 129 for (std::size_t g = 0; g < geometries.size(); ++g) {
@@ -134,6 +138,7 @@ int build_blas(vktest::Device& gpu, XdxrBuilder& builder, const std::string& dir
134 d.triangle_count = geo.triangle_count; 138 d.triangle_count = geo.triangle_count;
135 d.flags = 1; 139 d.flags = 1;
136 keep.push_back(v); 140 keep.push_back(v);
141 vertex_buffers.push_back(v);
137 if (!geo.indices.empty()) { 142 if (!geo.indices.empty()) {
138 Buffer ib = make(gpu, geo.indices.size() * 4); 143 Buffer ib = make(gpu, geo.indices.size() * 4);
139 EXPECT(ib.buffer); 144 EXPECT(ib.buffer);
@@ -170,13 +175,41 @@ int build_blas(vktest::Device& gpu, XdxrBuilder& builder, const std::string& dir
170 return recorded; 175 return recorded;
171 })); 176 }));
172 built.address = base; 177 built.address = base;
173 const auto* bytes = static_cast<const char*>(dst.map) + (base - dst.address); 178 auto dump = [&](const std::string& case_name, const Buffer& buffer, std::uint64_t at, const std::vector<Tri>& tris) {
174 EXPECT(write_file(dir + "/" + name + ".bin", bytes, layout.size)); 179 const auto* bytes = static_cast<const char*>(buffer.map) + (at - buffer.address);
175 const std::string json = "{\"kind\": \"blas\", \"address\": " + std::to_string(base) + 180 const std::string json = "{\"kind\": \"blas\", \"address\": " + std::to_string(at) +
176 (rays ? ", \"rays\": " + std::to_string(rays) : std::string()) + 181 (rays ? ", \"rays\": " + std::to_string(rays) : std::string()) +
177 ", \"triangles\": " + tris_json(built.tris) + "}\n"; 182 ", \"triangles\": " + tris_json(tris) + "}\n";
178 EXPECT(write_file(dir + "/" + name + ".json", json.data(), json.size())); 183 return write_file(dir + "/" + case_name + ".bin", bytes, layout.size) &&
179 std::printf("%s: %u triangles, %u bytes, %u nodes\n", name.c_str(), total, layout.size, layout.nodes); 184 write_file(dir + "/" + case_name + ".json", json.data(), json.size());
185 };
186 if (!moved) {
187 EXPECT(dump(name, dst, base, built.tris));
188 std::printf("%s: %u triangles, %u bytes, %u nodes\n", name.c_str(), total, layout.size, layout.nodes);
189 return 0;
190 }
191 // the update: new positions in the same vertex buffers, then a refit of the structure just built
192 EXPECT(moved->size() == geometries.size());
193 std::vector<Tri> moved_tris;
194 for (std::size_t g = 0; g < moved->size(); ++g) {
195 EXPECT((*moved)[g].vertex_data.size() == geometries[g].vertex_data.size());
196 std::memcpy(vertex_buffers[g].map, (*moved)[g].vertex_data.data(), (*moved)[g].vertex_data.size() * 4);
197 expand((*moved)[g], std::uint32_t(g), moved_tris);
198 }
199 Buffer other = into_other ? make(gpu, layout.size + 256) : Buffer{};
200 const std::uint64_t target = into_other ? (other.address + 255) & ~std::uint64_t(255) : base;
201 EXPECT(!into_other || other.buffer);
202 EXPECT(gpu.run([&](VkCommandBuffer cb) {
203 recorded = builder.record_blas(cb, layout, descs, target, scratch.address, base);
204 barrier_to_host(gpu, cb);
205 return recorded;
206 }));
207 if (into_other) EXPECT(dump(name + "_source", dst, base, built.tris)); // a refit must not touch its source
208 EXPECT(dump(name, into_other ? other : dst, target, moved_tris));
209 built.tris = moved_tris;
210 built.address = target;
211 std::printf("%s: %u triangles refitted %s, %u bytes\n", name.c_str(), total,
212 into_other ? "into another buffer" : "in place", layout.size);
180 return 0; 213 return 0;
181} 214}
182 215
@@ -234,8 +267,17 @@ int main(int argc, char** argv) {
234 const double ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count(); 267 const double ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count();
235 if (rep) best = std::min(best, ms); 268 if (rep) best = std::min(best, ms);
236 } 269 }
237 std::printf("%u triangles: %.2f ms (best of 3), result %u bytes, scratch %llu bytes, sort size %u\n", n, best, 270 double refit = 1e30; // an update of the structure just built, in place
238 layout.size, static_cast<unsigned long long>(layout.scratch), layout.sort_size); 271 for (int rep = 0; rep < 4; ++rep) {
272 const auto t0 = std::chrono::steady_clock::now();
273 EXPECT(gpu.run([&](VkCommandBuffer cb) {
274 return builder.record_blas(cb, layout, {d}, dst.address, scratch.address, dst.address);
275 }));
276 const double ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count();
277 if (rep) refit = std::min(refit, ms);
278 }
279 std::printf("%u triangles: %.2f ms (best of 3), refit %.2f ms, result %u bytes, scratch %llu bytes, sort size %u\n",
280 n, best, refit, layout.size, static_cast<unsigned long long>(layout.scratch), layout.sort_size);
239 return 0; 281 return 0;
240 } 282 }
241 283
@@ -287,10 +329,33 @@ int main(int argc, char** argv) {
287 b.vertex_data[3 * 3 * 7] = std::nanf(""); // triangle 7 of geometry 1: inactive 329 b.vertex_data[3 * 3 * 7] = std::nanf(""); // triangle 7 of geometry 1: inactive
288 if (build_blas(gpu, builder, dir, "blas_two_geometries", {a, b}, multi)) return 1; 330 if (build_blas(gpu, builder, dir, "blas_two_geometries", {a, b}, multi)) return 1;
289 if (build_blas(gpu, builder, dir, "blas_empty", {}, empty)) return 1; 331 if (build_blas(gpu, builder, dir, "blas_empty", {}, empty)) return 1;
290 // three radix-sort tiles of 2048, the last one partial (fewer rays: the reference's brute force is slow) 332 // many radix-sort tiles (RADIX_TILE elements each), the last one partial (fewer rays: the brute force is slow)
291 Built tiles; 333 Built tiles;
292 if (build_blas(gpu, builder, dir, "blas_three_sort_tiles", {soup(5000)}, tiles, 200)) return 1; 334 if (build_blas(gpu, builder, dir, "blas_three_sort_tiles", {soup(5000)}, tiles, 200)) return 1;
293 335
336 // Updates. Every triangle moves (its own offset, and a stretch), so each box changes; the tree is kept.
337 auto move = [&](Geometry g, float amount) {
338 std::uniform_real_distribution<float> d(-amount, amount);
339 const std::uint32_t floats = g.stride / 4;
340 for (std::size_t v = 0; v + 2 < g.vertex_data.size(); v += floats) {
341 const float dx = d(rng), dy = d(rng);
342 g.vertex_data[v] = g.vertex_data[v] * 1.25f + dx;
343 g.vertex_data[v + 1] = g.vertex_data[v + 1] * 0.8f + dy;
344 if (!g.xy) g.vertex_data[v + 2] += d(rng);
345 }
346 return g;
347 };
348 {
349 Built refitted;
350 const Geometry big = soup(3000); // the radix-sort path
351 const std::vector<Geometry> after = {move(big, 1.5f)};
352 if (build_blas(gpu, builder, dir, "blas_refit_in_place", {big}, refitted, 300, &after)) return 1;
353 Built copied;
354 const Geometry g = grid(12, 4, false); // R32 indices, stride 16; the small-sort path
355 const std::vector<Geometry> after_grid = {move(g, 0.3f)};
356 if (build_blas(gpu, builder, dir, "blas_refit_into_other", {g}, copied, 0, &after_grid, true)) return 1;
357 }
358
294 // TLAS: instances over blas_random and blas_grid_u16_stride16. An instance names its BLAS by a 40-bit address 359 // TLAS: instances over blas_random and blas_grid_u16_stride16. An instance names its BLAS by a 40-bit address
295 // (256-byte units in 32 bits), as on the console; device addresses can be wider (llvmpipe's are host pointers). 360 // (256-byte units in 32 bits), as on the console; device addresses can be wider (llvmpipe's are host pointers).
296 // The instances hold application-style addresses, device address - bias, as the layer's address window does. 361 // The instances hold application-style addresses, device address - bias, as the layer's address window does.
@@ -338,6 +403,34 @@ int main(int argc, char** argv) {
338 } 403 }
339 json += "]}\n"; 404 json += "]}\n";
340 EXPECT(write_file(dir + "/tlas.json", json.data(), json.size())); 405 EXPECT(write_file(dir + "/tlas.json", json.data(), json.size()));
406
407 // The TLAS updated in place: every instance moves and turns; the masked and the BLAS-less ones stay so.
408 Inst moved_insts[sizeof insts / sizeof insts[0]];
409 std::memcpy(moved_insts, insts, sizeof insts);
410 const float c2 = std::cos(1.9f), s2 = std::sin(1.9f);
411 const float turned[12] = {c2, 0, s2, 4, 0, 1, 0, -3, -s2, 0, c2, 2};
412 std::memcpy(moved_insts[0].m, turned, sizeof turned);
413 moved_insts[1].m[3] -= 7;
414 moved_insts[1].m[7] += 5;
415 moved_insts[2].m[11] -= 4;
416 for (std::uint32_t i = 0; i < count; ++i) std::memcpy(static_cast<char*>(descs.map) + 64 * i, moved_insts[i].m, 48);
417 EXPECT(gpu.run([&](VkCommandBuffer cb) {
418 recorded = builder.record_tlas(cb, layout, descs.address, base, scratch.address, bias, base);
419 barrier_to_host(gpu, cb);
420 return recorded;
421 }));
422 EXPECT(write_file(dir + "/tlas_refit.bin", static_cast<const char*>(dst.map) + (base - dst.address), layout.size));
423 std::string json2 = "{\"kind\": \"tlas\", \"address\": " + std::to_string(base) + ", \"bias\": " +
424 std::to_string(bias) + ", \"blas\": [\"blas_random\", \"blas_grid_u16_stride16\"], \"instances\": [";
425 for (std::uint32_t i = 0; i < count; ++i) {
426 json2 += i ? ", {" : "{";
427 json2 += "\"transform\": [";
428 for (int k = 0; k < 12; ++k) json2 += (k ? ", " : "") + num(moved_insts[i].m[k]);
429 json2 += "], \"mask\": " + std::to_string(moved_insts[i].id_mask >> 24) + ", \"blas\": " +
430 std::to_string(moved_insts[i].which) + "}";
431 }
432 json2 += "]}\n";
433 EXPECT(write_file(dir + "/tlas_refit.json", json2.data(), json2.size()));
341 std::printf("tlas: %u instances, %u bytes\nvk_xdxr_build_test: built every case\n", count, layout.size); 434 std::printf("tlas: %u instances, %u bytes\nvk_xdxr_build_test: built every case\n", count, layout.size);
342 return 0; 435 return 0;
343} 436}
diff --git a/runtime/test/xgameruntime_test.cpp b/runtime/test/xgameruntime_test.cpp
index 755b64381..ac36f40d9 100644
--- a/runtime/test/xgameruntime_test.cpp
+++ b/runtime/test/xgameruntime_test.cpp
@@ -10,6 +10,7 @@
10#include <atomic> 10#include <atomic>
11#include <cstdint> 11#include <cstdint>
12#include <cstdio> 12#include <cstdio>
13#include <cstdlib>
13#include <cstring> 14#include <cstring>
14 15
15#include <XAsync.h> 16#include <XAsync.h>
@@ -98,6 +99,31 @@ HRESULT CALLBACK provider(XAsyncOp op, const XAsyncProviderData* data) {
98 } 99 }
99} 100}
100 101
102HMODULE g_teardown_rt_mod = nullptr;
103FARPROC(WINAPI* g_teardown_get_proc)(HMODULE, LPCSTR) = nullptr;
104BOOL(WINAPI* g_teardown_free_lib)(HMODULE) = nullptr;
105
106// Registered with std::atexit before check_run_time_load() constructs any function-local statics in library_loader.
107// LIFO atexit order means this runs after those statics would have been destroyed, simulating mapped-DLL
108// DLL_PROCESS_DETACH or earlier atexit handlers calling GetProcAddress/FreeLibrary on a pseudo-handle during exit.
109void check_late_teardown() {
110 if (!g_teardown_rt_mod || !g_teardown_get_proc || !g_teardown_free_lib) return;
111 if (g_teardown_get_proc(g_teardown_rt_mod, "UninitializeApiImpl") == nullptr) {
112 std::fprintf(stderr, "FAIL late teardown GetProcAddress on pseudo-handle\n");
113 std::_Exit(1);
114 }
115 SetLastError(0);
116 if (g_teardown_get_proc(g_teardown_rt_mod, "LateTeardownMissingSymbol") != nullptr ||
117 GetLastError() != ERROR_PROC_NOT_FOUND) {
118 std::fprintf(stderr, "FAIL late teardown unserved GetProcAddress on pseudo-handle\n");
119 std::_Exit(1);
120 }
121 if (g_teardown_free_lib(g_teardown_rt_mod) != TRUE) {
122 std::fprintf(stderr, "FAIL late teardown FreeLibrary on pseudo-handle\n");
123 std::_Exit(1);
124 }
125}
126
101// xgameruntime.lib's thunks don't import the runtime: they LoadLibraryW(L"xgameruntime.dll") and GetProcAddress five 127// xgameruntime.lib's thunks don't import the runtime: they LoadLibraryW(L"xgameruntime.dll") and GetProcAddress five
102// names (measured in the package's libHttpClient.GDK.dll and XCurl.dll). Drive that path through the loader shims, 128// names (measured in the package's libHttpClient.GDK.dll and XCurl.dll). Drive that path through the loader shims,
103// bound by the api set XCurl.dll imports them from, as a mapped image would be. 129// bound by the api set XCurl.dll imports them from, as a mapped image would be.
@@ -136,6 +162,9 @@ void check_run_time_load() {
136 SetLastError(0); 162 SetLastError(0);
137 check(get_proc(rt_mod, "NoSuchRuntimeFunction") == nullptr && GetLastError() == ERROR_PROC_NOT_FOUND, 163 check(get_proc(rt_mod, "NoSuchRuntimeFunction") == nullptr && GetLastError() == ERROR_PROC_NOT_FOUND,
138 "an unserved name is NULL with ERROR_PROC_NOT_FOUND, as from a real module"); 164 "an unserved name is NULL with ERROR_PROC_NOT_FOUND, as from a real module");
165 SetLastError(0);
166 check(get_proc(rt_mod, nullptr) == nullptr && GetLastError() == ERROR_PROC_NOT_FOUND,
167 "a null proc name is NULL with ERROR_PROC_NOT_FOUND");
139 168
140 struct Options { 169 struct Options {
141 uint32_t unknown; 170 uint32_t unknown;
@@ -162,6 +191,10 @@ void check_run_time_load() {
162 "GetProcAddress on a host module is the host's"); 191 "GetProcAddress on a host module is the host's");
163 check(free_lib(rt_mod) == TRUE && load_w(L"xgameruntime.dll") == rt_mod, 192 check(free_lib(rt_mod) == TRUE && load_w(L"xgameruntime.dll") == rt_mod,
164 "FreeLibrary on the runtime succeeds and keeps it loaded"); 193 "FreeLibrary on the runtime succeeds and keeps it loaded");
194
195 g_teardown_rt_mod = rt_mod;
196 g_teardown_get_proc = get_proc;
197 g_teardown_free_lib = free_lib;
165} 198}
166 199
167} // namespace 200} // namespace
@@ -262,6 +295,7 @@ int main() {
262 check(init() == S_OK, "XGameRuntimeInitialize works again after balanced uninitialize calls"); 295 check(init() == S_OK, "XGameRuntimeInitialize works again after balanced uninitialize calls");
263 uninit(); 296 uninit();
264 297
298 std::atexit(check_late_teardown);
265 check_run_time_load(); 299 check_run_time_load();
266 300
267 if (g_failures) { 301 if (g_failures) {
diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp
index 429261e98..f115b6655 100644
--- a/runtime/test/xs_proxy_mock_test.cpp
+++ b/runtime/test/xs_proxy_mock_test.cpp
@@ -70,7 +70,7 @@ namespace xs = rt::d3d12_xs;
70 70
71// ---- Mocks ---- 71// ---- Mocks ----
72 72
73enum class Kind { device, queue, fence, resource }; 73enum class Kind { device, queue, fence, resource, allocator };
74 74
75constexpr unsigned kMockSlots = 128; 75constexpr unsigned kMockSlots = 128;
76constexpr std::uint64_t kFenceHandle = 0x1000, kResourceHandle = 0x2000; // the handles the mock device opens 76constexpr std::uint64_t kFenceHandle = 0x1000, kResourceHandle = 0x2000; // the handles the mock device opens
@@ -84,6 +84,7 @@ struct Mock {
84 long refs; 84 long refs;
85 int device_level; // device: highest ID3D12DeviceN it answers (0 = ID3D12Device only) 85 int device_level; // device: highest ID3D12DeviceN it answers (0 = ID3D12Device only)
86 bool fence1; // fence: answers ID3D12Fence1; device: the fences it makes do 86 bool fence1; // fence: answers ID3D12Fence1; device: the fences it makes do
87 bool allocator_tag; // allocator: answers kLeonidaCommandAllocatorTag; device: the allocators it makes do
87 bool create_null; // device: creation returns create_result with no object 88 bool create_null; // device: creation returns create_result with no object
88 HRESULT create_result; // device: what creation returns (S_OK makes the object) 89 HRESULT create_result; // device: what creation returns (S_OK makes the object)
89 Mock* last_child; // device: the object its last creation or open made 90 Mock* last_child; // device: the object its last creation or open made
@@ -126,6 +127,9 @@ bool mock_has(const Mock* m, REFIID iid) {
126 case Kind::fence: 127 case Kind::fence:
127 return IsEqualIID(iid, __uuidof(ID3D12Fence)) || (m->fence1 && IsEqualIID(iid, __uuidof(ID3D12Fence1))); 128 return IsEqualIID(iid, __uuidof(ID3D12Fence)) || (m->fence1 && IsEqualIID(iid, __uuidof(ID3D12Fence1)));
128 case Kind::resource: return IsEqualIID(iid, __uuidof(ID3D12Resource)); 129 case Kind::resource: return IsEqualIID(iid, __uuidof(ID3D12Resource));
130 case Kind::allocator:
131 return IsEqualIID(iid, __uuidof(ID3D12CommandAllocator)) ||
132 (m->allocator_tag && IsEqualIID(iid, xs::kLeonidaCommandAllocatorTag));
129 default: return false; 133 default: return false;
130 } 134 }
131} 135}
@@ -148,6 +152,7 @@ HRESULT mock_create(Mock* device, Kind kind, std::uint64_t riid, std::uint64_t o
148 if (device->create_null || FAILED(device->create_result)) return device->create_result; 152 if (device->create_null || FAILED(device->create_result)) return device->create_result;
149 Mock* child = new_mock(kind); 153 Mock* child = new_mock(kind);
150 child->fence1 = device->fence1; 154 child->fence1 = device->fence1;
155 child->allocator_tag = device->allocator_tag;
151 device->last_child = child; 156 device->last_child = child;
152 return mock_query(child, reinterpret_cast<const IID*>(riid), out); 157 return mock_query(child, reinterpret_cast<const IID*>(riid), out);
153} 158}
@@ -163,6 +168,7 @@ std::uint64_t mock_call(Mock* m, unsigned slot, const std::uint64_t* words) {
163 if (m->kind == Kind::device) { 168 if (m->kind == Kind::device) {
164 switch (slot) { 169 switch (slot) {
165 case 8: return static_cast<std::uint32_t>(mock_create(m, Kind::queue, a2, a3)); // CreateCommandQueue 170 case 8: return static_cast<std::uint32_t>(mock_create(m, Kind::queue, a2, a3)); // CreateCommandQueue
171 case 9: return static_cast<std::uint32_t>(mock_create(m, Kind::allocator, a2, a3)); // CreateCmdAllocator
166 case 75: return static_cast<std::uint32_t>(mock_create(m, Kind::queue, a3, a4)); // CreateCommandQueue1 172 case 75: return static_cast<std::uint32_t>(mock_create(m, Kind::queue, a3, a4)); // CreateCommandQueue1
167 case 36: return static_cast<std::uint32_t>(mock_create(m, Kind::fence, a3, a4)); // CreateFence 173 case 36: return static_cast<std::uint32_t>(mock_create(m, Kind::fence, a3, a4)); // CreateFence
168 case 32: // OpenSharedHandle 174 case 32: // OpenSharedHandle
@@ -248,10 +254,11 @@ const IID kDevice1Iid = __uuidof(ID3D12Device1);
248const D3D12_COMMAND_QUEUE_DESC kQueueDesc{}; 254const D3D12_COMMAND_QUEUE_DESC kQueueDesc{};
249 255
250// A device proxy over a new mock device. The proxy takes the mock's one reference. 256// A device proxy over a new mock device. The proxy takes the mock's one reference.
251void* make_device(Mock*& mock, int level, bool fence1) { 257void* make_device(Mock*& mock, int level, bool fence1, bool allocator_tag = true) {
252 mock = new_mock(Kind::device); 258 mock = new_mock(Kind::device);
253 mock->device_level = level; 259 mock->device_level = level;
254 mock->fence1 = fence1; 260 mock->fence1 = fence1;
261 mock->allocator_tag = allocator_tag;
255 mock->refs = 1; 262 mock->refs = 1;
256 void* device = nullptr; 263 void* device = nullptr;
257 if (FAILED(xs::create_device_proxy(reinterpret_cast<ID3D12Device*>(mock), __uuidof(ID3D12Device), &device))) 264 if (FAILED(xs::create_device_proxy(reinterpret_cast<ID3D12Device*>(mock), __uuidof(ID3D12Device), &device)))
@@ -563,7 +570,85 @@ int check_alloc_failures() {
563 return 0; 570 return 0;
564} 571}
565 572
566// ---- 6. The refused tail and the guard region ---- 573// ---- 6. Command allocators (device slot 9) ----
574
575int check_allocators() {
576 const IID allocator_iid = __uuidof(ID3D12CommandAllocator);
577 // An allocator that answers Leonida's tag (its lists resolve a proxy) comes back wrapped.
578 {
579 Mock* mock = nullptr;
580 void* device = make_device(mock, 9, true, true);
581 EXPECT(device);
582 const unsigned long device_refs = xs::device_proxy_ref_count(device);
583 void* allocator = nullptr;
584 EXPECT(hr_of(raw(device, 9, D3D12_COMMAND_LIST_TYPE_DIRECT, word(&allocator_iid), word(&allocator))) == S_OK);
585 Mock* const real = mock->last_child;
586 EXPECT(xs::is_allocator_proxy(allocator) && word(xs::allocator_proxy_real_allocator(allocator)) == word(real));
587 EXPECT(mock->args[9][0] == D3D12_COMMAND_LIST_TYPE_DIRECT && real->refs == 1);
588 EXPECT(xs::allocator_proxy_slot_count(allocator) == 9 && xs::device_proxy_ref_count(device) == device_refs + 1);
589 // Reset (slot 8) reaches the real allocator; every slot past it up to the table end is refused.
590 EXPECT(hr_of(raw(allocator, 8)) == S_OK && real->calls[8] == 1);
591 for (unsigned slot = 9; slot < xs::allocator_proxy_table_size(); ++slot)
592 EXPECT(hr_of(raw(allocator, slot)) == E_NOTIMPL && real->calls[slot] == 0);
593 // The tag and the real object stay hidden: QueryInterface answers only the modelled interfaces.
594 void* found = reinterpret_cast<void*>(1);
595 EXPECT(hr_of(raw(allocator, 0, word(&xs::kLeonidaCommandAllocatorTag), word(&found))) == E_NOINTERFACE &&
596 !found);
597 EXPECT(hr_of(raw(allocator, 0, word(&allocator_iid), word(&found))) == S_OK && found == allocator);
598 EXPECT(release(found) == 1);
599 // An allocator is a pageable: MakeResident gives the real runtime the real allocator.
600 const std::uint64_t objects[1] = {word(allocator)};
601 EXPECT(hr_of(raw(device, 34, 1, word(objects))) == S_OK && mock->array[34][0] == word(real));
602 EXPECT(release(allocator) == 0 && real->refs == 0);
603 EXPECT(xs::device_proxy_ref_count(device) == device_refs);
604 // Null IID, null output, a failing or empty creation, an IID the allocator lacks.
605 void* out = reinterpret_cast<void*>(1);
606 EXPECT(hr_of(raw(device, 9, 0, 0, word(&out))) == E_POINTER && !out);
607 EXPECT(hr_of(raw(device, 9, 0, word(&allocator_iid), 0)) == S_FALSE); // the device's own answer
608 mock->create_result = E_OUTOFMEMORY;
609 out = reinterpret_cast<void*>(1);
610 EXPECT(hr_of(raw(device, 9, 0, word(&allocator_iid), word(&out))) == E_OUTOFMEMORY && !out);
611 mock->create_result = S_OK;
612 mock->create_null = true;
613 out = reinterpret_cast<void*>(1);
614 EXPECT(hr_of(raw(device, 9, 0, word(&allocator_iid), word(&out))) == E_FAIL && !out);
615 mock->create_null = false;
616 const IID fence_iid = __uuidof(ID3D12Fence);
617 out = reinterpret_cast<void*>(1);
618 EXPECT(hr_of(raw(device, 9, 0, word(&fence_iid), word(&out))) == E_NOINTERFACE && !out);
619 EXPECT(mock->last_child->refs == 0);
620 // A refused allocation for the proxy: E_OUTOFMEMORY, and the real allocator is released.
621 g_fail_news = 1;
622 out = reinterpret_cast<void*>(1);
623 const HRESULT starved = hr_of(raw(device, 9, 0, word(&allocator_iid), word(&out)));
624 g_fail_news = 0;
625 EXPECT(starved == E_OUTOFMEMORY && !out && mock->last_child->refs == 0);
626 EXPECT(xs::device_proxy_ref_count(device) == device_refs);
627 EXPECT(release(device) == 0 && mock->refs == 0);
628 }
629 // An allocator without the tag (a PC runtime allocator, whose lists could not resolve a proxy) comes back as it
630 // is, as the interface asked for.
631 {
632 Mock* mock = nullptr;
633 void* device = make_device(mock, 9, true, false);
634 EXPECT(device);
635 void* allocator = nullptr;
636 EXPECT(hr_of(raw(device, 9, 0, word(&allocator_iid), word(&allocator))) == S_OK);
637 EXPECT(allocator == mock->last_child && !xs::is_allocator_proxy(allocator) && mock->last_child->refs == 1);
638 Mock* const real = mock->last_child;
639 EXPECT(release(allocator) == 0 && real->refs == 0);
640 const IID fence_iid = __uuidof(ID3D12Fence);
641 void* out = reinterpret_cast<void*>(1);
642 EXPECT(hr_of(raw(device, 9, 0, word(&fence_iid), word(&out))) == E_NOINTERFACE && !out);
643 EXPECT(mock->last_child->refs == 0);
644 EXPECT(release(device) == 0 && mock->refs == 0);
645 }
646 std::printf("%s: allocators answering Leonida's tag are wrapped (Reset forwarded, tail refused, residency "
647 "unwrapped, references balanced); others come back unwrapped; failures leave no reference\n", g_label);
648 return 0;
649}
650
651// ---- 7. The refused tail and the guard region ----
567 652
568int check_tail(bool want_guarded) { 653int check_tail(bool want_guarded) {
569 Mock* mock = nullptr; 654 Mock* mock = nullptr;
@@ -686,7 +771,7 @@ int main(int argc, char** argv) {
686 if (argc == 2) return run_fault_mode(argv[1]); 771 if (argc == 2) return run_fault_mode(argv[1]);
687 if (argc != 1) return 2; 772 if (argc != 1) return 2;
688 if (check_tail(true) || check_levels() || check_fence1() || check_create_failures() || check_open_shared() || 773 if (check_tail(true) || check_levels() || check_fence1() || check_create_failures() || check_open_shared() ||
689 check_alloc_failures()) 774 check_alloc_failures() || check_allocators())
690 return 1; 775 return 1;
691 std::printf("xs_proxy_mock_test: PASS (%d allocations refused on purpose)\n", g_failed_news); 776 std::printf("xs_proxy_mock_test: PASS (%d allocations refused on purpose)\n", g_failed_news);
692 return 0; 777 return 0;