diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b73d82490..2a87444e4 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,33 +27,112 @@ jobs: run: python3 -B tests/gpu_report_format_check.py - name: Check the opt-in compiler cache arguments in dev.ps1 run: python3 -B tests/dev_ps1_sccache_check.py + - name: Check the required SPIR-V bridge WARP test list + run: python3 -B tests/spirv_window/require_warp_results_check.py - name: Check machine-code inputs with LLVM 15 run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends llvm-15 spirv-tools spirv-cross - python3 -B tests/spirv_window/sampler.py spirv-as spirv-val spirv-cross - python3 -B tests/spirv_window/ballot.py spirv-as spirv-val spirv-cross - python3 -B tests/spirv_window/check.py - python3 -B tests/spirv_window/compare_sampler.py spirv-as spirv-val spirv-cross - python3 -B tests/sampled_coverage_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/depth_mask_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/pixel_aot_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/pixel_compare_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/mesh_indexed_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/mesh_entry_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/mesh_descriptor_swap_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/mesh_lit_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/mesh_shadow_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 - python3 -B tests/startup_sampler_heap_check.py binary llvm-mc-15 - python3 -B tests/startup_image_sample_l_check.py binary llvm-mc-15 - python3 -B tests/startup_image_3d_check.py binary llvm-mc-15 - python3 -B tests/startup_image_load_mip_check.py --llvm-mc llvm-mc-15 - python3 -B tests/startup_image_2d_array_check.py binary llvm-mc-15 - python3 -B tests/startup_flat_param_check.py binary llvm-mc-15 - python3 -B tests/startup_inline_sampler_check.py binary llvm-mc-15 - LLVM_LIB=libLLVM-15.so.1 LLVM_MC=llvm-mc-15 LLVM_OBJCOPY=llvm-objcopy-15 python3 -B tests/rdna2_tools_check.py + python3 -B - <<'PY' + import concurrent.futures + import os + import subprocess + import sys + import time + + COMMON_LLVM = ["binary", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1"] + SPIRV = ["spirv-as", "spirv-val", "spirv-cross"] + CHECKS = [ + (["tests/compute_store_check.py", *COMMON_LLVM], {}), + (["tests/compute_load_format_check.py", *COMMON_LLVM], {}), + (["tests/pixel_aot_check.py", *COMMON_LLVM], {}), + (["tests/sampled_coverage_check.py", *COMMON_LLVM], {}), + (["tests/pixel_compare_gather_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1"], {}), + (["tests/pixel_gather_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1"], {}), + (["tests/pixel_sample_gradient_check.py", *COMMON_LLVM, "llc-15"], {}), + (["tests/pixel_sample_gradient_check.py", "binary-coarse", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1", "llc-15"], {}), + (["tests/depth_mask_check.py", *COMMON_LLVM], {}), + (["tests/mesh_entry_check.py", *COMMON_LLVM], {}), + (["tests/mesh_dynamic_geometry_check.py", *COMMON_LLVM], {}), + (["tests/rdna2_tools_check.py"], {"LLVM_LIB": "libLLVM-15.so.1", "LLVM_MC": "llvm-mc-15", "LLVM_OBJCOPY": "llvm-objcopy-15"}), + (["tests/ffx_dispatch_aot_check.py", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1"], {}), + (["tests/spirv_window/sampler.py", *SPIRV], {}), + (["tests/spirv_window/ballot.py", *SPIRV], {}), + (["tests/spirv_window/check.py"], {}), + (["tests/spirv_window/compare_sampler.py", *SPIRV], {}), + (["tests/pixel_sample_offset_check.py", *COMMON_LLVM], {}), + (["tests/pixel_compare_sample_check.py", *COMMON_LLVM], {}), + (["tests/pixel_compare_check.py", *COMMON_LLVM], {}), + (["tests/pixel_attribute_sampled_check.py", *COMMON_LLVM], {}), + (["tests/compute_mimg_msaa_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "libLLVM-15.so.1"], {}), + (["tests/compute_mimg_float_store_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "--llvm", "libLLVM-15.so.1"], {}), + (["tests/compute_mimg_float_store_d16_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "--llvm", "libLLVM-15.so.1"], {}), + (["tests/compute_image_atomics_gfx1013_check.py", "--binary", "llvm-mc-15", "llvm-objcopy-15", "--llvm", "libLLVM-15.so.1"], {}), + (["tests/mesh_indexed_check.py", *COMMON_LLVM], {}), + (["tests/mesh_multi_check.py", *COMMON_LLVM], {}), + (["tests/mesh_descriptor_swap_check.py", *COMMON_LLVM], {}), + (["tests/mesh_lit_check.py", *COMMON_LLVM], {}), + (["tests/pixel_get_lod_check.py", *COMMON_LLVM], {}), + (["tests/mesh_shadow_check.py", *COMMON_LLVM], {}), + (["tests/startup_sampler_heap_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_scalar_m0_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_cvt_alu_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_sample_l_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_gather_lz_check.py", "--llvm-mc", "llvm-mc-15"], {}), + (["tests/startup_image_sample_c_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_3d_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_load_mip_check.py", "--llvm-mc", "llvm-mc-15"], {}), + (["tests/startup_image_2d_array_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_sample_a16_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_image_sample_a16_check.py", "decode", "libLLVM-15.so.1"], {}), + (["tests/startup_flat_param_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_bit_alu_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_mad_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_swap_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_shift64_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_vopc_sdwa_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_vopc_sdwa_check.py", "decode", "libLLVM-15.so.1"], {}), + (["tests/startup_gfx2hlsl_sop2_complement_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_sop2_complement_check.py", "decode", "libLLVM-15.so.1"], {}), + (["tests/startup_gfx2hlsl_f32_lg_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_f32_lg_check.py", "decode", "libLLVM-15.so.1"], {}), + (["tests/startup_gfx2hlsl_f32_nan_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_gfx2hlsl_f32_nan_check.py", "decode", "libLLVM-15.so.1"], {}), + (["tests/startup_inline_sampler_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_smem_address_check.py", "binary", "llvm-mc-15"], {}), + (["tests/compute_entry_layout_check.py", "binary", "llvm-mc-15"], {}), + (["tests/startup_ngg_slice_check.py", "binary", "llvm-mc-15"], {}), + ] + + def run_one(item): + cmd, extra_env = item + env = {**os.environ, **extra_env} if extra_env else None + start = time.monotonic() + proc = subprocess.run( + [sys.executable, "-B", *cmd], + env=env, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + errors="replace", + ) + return cmd[0], proc.returncode, proc.stdout, time.monotonic() - start + + failed = [] + with concurrent.futures.ThreadPoolExecutor(max_workers=os.cpu_count() or 4) as pool: + for script, code, output, secs in pool.map(run_one, CHECKS): + print(f"::group::{script} ({'ok' if code == 0 else f'exit {code}'}, {secs:.1f}s)", flush=True) + sys.stdout.write(output) + if output and not output.endswith("\n"): + sys.stdout.write("\n") + print("::endgroup::", flush=True) + if code != 0: + failed.append(f"{script} (exit {code})") + if failed: + print("FAILED: " + ", ".join(failed), flush=True) + sys.exit(1) + print(f"all {len(CHECKS)} pixel-binary checks passed", flush=True) + PY python-linux: name: Run platform-independent Python checks on Linux runs-on: ubuntu-24.04 @@ -65,59 +144,109 @@ jobs: - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: '3.12' + cache: 'pip' + cache-dependency-path: 'requirements-dev.txt' - name: Install fixture dependencies run: python -m pip install -r requirements-dev.txt - name: Run Python checks run: | - python -B tests/script_state_check.py - python -B tests/resource_root_check.py - python -B tests/bcpack_check.py - python -B tests/bcpack_symbols_check.py - python -B tests/bcpack_tables_check.py - python -B tests/bc7_blocks_check.py - python -B tests/bc7_tiles_check.py - python -B tests/gfx10_texture_roundtrip_check.py - python -B tests/texture_bc_volume_check.py - python -B tests/form_coverage_check.py - python -B tests/resource_ranges_check.py - python -B tests/ttpf_batch_export_check.py - python -B tests/awc_metadata_check.py - python -B tests/sgd5_effects_check.py - python -B tests/dxcontainer_part_offsets_check.py - python -B tests/layout_chunks_check.py - python -B tests/dependency_paths_check.py - python -B tests/pe_package_preflight_check.py - python -B tests/pe_package_ordinal_plan_check.py - python -B tests/compat_report_check.py - python -B tests/intake/paths_check.py - python -B tests/intake/routing_check.py - python -B tests/intake/import_forms_check.py - python -B tests/shader_probe_check.py - python -B tests/shader_census_check.py - python -B tests/shader_corpus_report_check.py - python -B tests/dxil_retarget_check.py - python -B tests/rdna2_tools_check.py - python -B tests/pso_readiness_check.py - python -B tests/xmem_attribute_scan_check.py - python -B tests/xgameruntime_table_check.py - python -B tests/docs_links_check.py - python -B tests/bidi_controls_check.py - python -B tests/gpu_report_format_check.py - python -B tests/hardware_reports_check.py - python -B tests/rectlist_topology_check.py - python -B tests/startup_sampler_heap_check.py - python -B tests/startup_image_sample_l_check.py - python -B tests/startup_image_3d_check.py - python -B tests/startup_image_load_mip_check.py - python -B tests/startup_image_2d_array_check.py - python -B tests/startup_host_cpu_check.py - python -B tests/startup_translator_check.py - python -B tests/startup_flat_param_check.py - python -B tests/startup_inline_sampler_check.py + python -B tools/run_checks_parallel.py \ + tests/script_state_check.py \ + tests/resource_root_check.py \ + tests/pe_authentihash_check.py \ + tests/bcpack_check.py \ + tests/bcpack_symbols_check.py \ + tests/bcpack_tables_check.py \ + tests/bc7_blocks_check.py \ + tests/bc7_tiles_check.py \ + tests/gfx10_texture_roundtrip_check.py \ + tests/texture_bc_volume_check.py \ + tests/form_coverage_check.py \ + tests/resource_ranges_check.py \ + tests/ttpf_batch_export_check.py \ + tests/awc_metadata_check.py \ + tests/startup_audio_timeline_check.py \ + tests/sgd5_effects_check.py \ + tests/dxcontainer_part_offsets_check.py \ + tests/layout_chunks_check.py \ + tests/dependency_paths_check.py \ + tests/pe_package_preflight_check.py \ + tests/host_commit_check.py \ + tests/pe_package_ordinal_plan_check.py \ + tests/compat_report_check.py \ + tests/intake/paths_check.py \ + tests/intake/routing_check.py \ + tests/intake/import_forms_check.py \ + tests/shader_probe_check.py \ + tests/shader_census_check.py \ + tests/shader_corpus_report_check.py \ + tests/dxil_retarget_check.py \ + tests/rdna2_tools_check.py \ + tests/mesh_dynamic_geometry_check.py \ + tests/mesh_dynamic_aot_check.py \ + tests/pso_readiness_check.py \ + tests/xmem_attribute_scan_check.py \ + tests/xgameruntime_table_check.py \ + tests/docs_links_check.py \ + tests/bidi_controls_check.py \ + tests/pixel_denorm_vulkan_check.py \ + tests/gpu_report_format_check.py \ + tests/hardware_reports_check.py \ + tests/rectlist_topology_check.py \ + tests/startup_sampler_heap_check.py \ + tests/startup_image_sample_l_check.py \ + tests/startup_image_gather_lz_check.py \ + tests/startup_image_sample_c_check.py \ + tests/startup_image_3d_check.py \ + tests/startup_image_load_mip_check.py \ + tests/startup_gfx2hlsl_operand_count_check.py \ + tests/startup_image_2d_array_check.py \ + tests/startup_image_sample_a16_check.py \ + tests/startup_host_cpu_check.py \ + tests/startup_live_telemetry_check.py \ + tests/startup_gfx2hlsl_cvt_alu_check.py \ + tests/startup_gfx2hlsl_int_med3_check.py \ + tests/startup_gfx2hlsl_cselect_mask_check.py \ + tests/startup_gfx2hlsl_mask_overwrite_check.py \ + tests/startup_gfx2hlsl_capture_check.py \ + tests/startup_gfx2hlsl_watch_check.py \ + tests/startup_translator_check.py \ + tests/startup_gfx2hlsl_smem_offset_check.py \ + tests/startup_gfx2hlsl_refusals_check.py \ + tests/startup_gfx2hlsl_scalar_m0_check.py \ + tests/startup_gfx2hlsl_readfirstlane_uniform_check.py \ + tests/startup_triage_run_check.py \ + tests/startup_run_ps1_check.py \ + tests/startup_flat_param_check.py \ + tests/startup_gfx2hlsl_bit_alu_check.py \ + tests/startup_gfx2hlsl_mad_check.py \ + tests/startup_gfx2hlsl_swap_check.py \ + tests/startup_gfx2hlsl_shift64_check.py \ + tests/startup_gfx2hlsl_vopc_sdwa_check.py \ + tests/startup_gfx2hlsl_sdwa_cvt_check.py \ + tests/startup_gfx2hlsl_sop2_complement_check.py \ + tests/startup_gfx2hlsl_f32_lg_check.py \ + tests/startup_gfx2hlsl_f32_nan_check.py \ + tests/startup_gfx2hlsl_root_check.py \ + tests/startup_gfx2hlsl_sopk_signext_check.py \ + tests/startup_inline_sampler_check.py \ + tests/startup_buffer_address_check.py \ + tests/startup_smem_address_check.py \ + tests/startup_stream_fetch_check.py \ + tests/startup_stream_interface_check.py \ + tests/compute_alu_cmp_ne_check.py \ + tests/compute_entry_layout_check.py \ + tests/compute_alu_bcnt64_check.py \ + tests/compute_load_format_check.py \ + tests/startup_ngg_slice_check.py \ + tests/startup_gfx2hlsl_handler_arity_check.py \ + tests/run_checks_parallel_check.py build-and-test: name: Build and test on Windows runs-on: windows-2025 - timeout-minutes: 20 + timeout-minutes: 30 + env: + SCCACHE_CACHE_SIZE: '2G' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -125,6 +254,8 @@ jobs: - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: '3.12' + cache: 'pip' + cache-dependency-path: 'requirements-dev.txt' architecture: x64 - name: Install fixture dependencies shell: pwsh @@ -138,6 +269,7 @@ jobs: run: | .\tools\dev.ps1 "msvc=$env:VCToolsVersion" >> $env:GITHUB_OUTPUT + "SCCACHE_DIR=$($env:RUNNER_TEMP)\sccache" >> $env:GITHUB_ENV - name: Restore the pinned SPIR-V tools uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: @@ -146,22 +278,35 @@ jobs: - name: Build the pinned SPIR-V tools shell: pwsh run: .\tools\setup-spirv-tools.ps1 + - name: Install sccache + uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 + - name: Restore compiler cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ${{ runner.temp }}/sccache + key: sccache-${{ runner.os }}-msvc-${{ steps.toolset.outputs.msvc }}-${{ github.event_name == 'pull_request' && 'pr' || 'dev' }}-${{ hashFiles('CMakeLists.txt', 'CMakePresets.json', 'cmake/**', '**/*.c', '**/*.cc', '**/*.cpp', '**/*.h', '**/*.hpp', '**/*.inc', '**/*.inl', '**/*.asm') }} + restore-keys: | + sccache-${{ runner.os }}-msvc-${{ steps.toolset.outputs.msvc }}-${{ github.event_name == 'pull_request' && 'pr' || 'dev' }}- + sccache-${{ runner.os }}-msvc-${{ steps.toolset.outputs.msvc }}-dev- - name: Configure, build and run PC tests shell: pwsh env: X2W_REQUIRE_SPIRV_TOOLS: '1' + X2W_USE_SCCACHE: '1' run: | .\tools\dev.ps1 - cmake --preset dev + cmake --preset dev @X2wSccacheCmakeArgs if ($LASTEXITCODE) { exit $LASTEXITCODE } if ($env:GITHUB_EVENT_NAME -eq 'pull_request') { cmake --build --preset pr if ($LASTEXITCODE) { exit $LASTEXITCODE } + if (Get-Command sccache -CommandType Application -ErrorAction SilentlyContinue) { sccache --show-stats } ctest --preset pr --no-tests=error --output-junit "$PWD/out/test-results.xml" } else { cmake --build --preset dev if ($LASTEXITCODE) { exit $LASTEXITCODE } - ctest --preset dev --no-tests=error -E '_hardware$' --output-junit "$PWD/out/test-results.xml" + if (Get-Command sccache -CommandType Application -ErrorAction SilentlyContinue) { sccache --show-stats } + ctest --preset dev --no-tests=error --parallel 4 -E '_hardware$' --output-junit "$PWD/out/test-results.xml" } exit $LASTEXITCODE - name: Require the SPIR-V bridge WARP tests @@ -201,7 +346,9 @@ jobs: name: Build and test on Windows at /O2 if: github.event_name != 'pull_request' runs-on: windows-2025 - timeout-minutes: 20 + timeout-minutes: 30 + env: + SCCACHE_CACHE_SIZE: '2G' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -209,6 +356,8 @@ jobs: - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: '3.12' + cache: 'pip' + cache-dependency-path: 'requirements-dev.txt' architecture: x64 - name: Install fixture dependencies shell: pwsh @@ -222,6 +371,7 @@ jobs: run: | .\tools\dev.ps1 "msvc=$env:VCToolsVersion" >> $env:GITHUB_OUTPUT + "SCCACHE_DIR=$($env:RUNNER_TEMP)\sccache" >> $env:GITHUB_ENV - name: Restore the pinned SPIR-V tools uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: @@ -230,17 +380,28 @@ jobs: - name: Build the pinned SPIR-V tools shell: pwsh run: .\tools\setup-spirv-tools.ps1 + - name: Install sccache + uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 + - name: Restore compiler cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ${{ runner.temp }}/sccache + key: sccache-${{ runner.os }}-msvc-${{ steps.toolset.outputs.msvc }}-release-${{ hashFiles('CMakeLists.txt', 'CMakePresets.json', 'cmake/**', '**/*.c', '**/*.cc', '**/*.cpp', '**/*.h', '**/*.hpp', '**/*.inc', '**/*.inl', '**/*.asm') }} + restore-keys: | + sccache-${{ runner.os }}-msvc-${{ steps.toolset.outputs.msvc }}-release- - name: Configure, build and run PC tests at /O2 shell: pwsh env: X2W_REQUIRE_SPIRV_TOOLS: '1' + X2W_USE_SCCACHE: '1' run: | .\tools\dev.ps1 - cmake --preset release + cmake --preset release @X2wSccacheCmakeArgs if ($LASTEXITCODE) { exit $LASTEXITCODE } cmake --build --preset release if ($LASTEXITCODE) { exit $LASTEXITCODE } - ctest --preset release --no-tests=error -E '_hardware$' --output-junit "$PWD/out/test-results-release.xml" + if (Get-Command sccache -CommandType Application -ErrorAction SilentlyContinue) { sccache --show-stats } + ctest --preset release --no-tests=error --parallel 4 -E '_hardware$' --output-junit "$PWD/out/test-results-release.xml" - name: Require the SPIR-V bridge WARP tests at /O2 if: ${{ !cancelled() }} shell: pwsh diff --git a/AGENTS.md b/AGENTS.md index 8123a2110..b922f5894 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -105,6 +105,7 @@ python3 -m venv out/pe-env ./out/pe-env/bin/python -m pip install -r requirements-dev.txt ./out/pe-env/bin/python -B tests/script_state_check.py ./out/pe-env/bin/python -B tests/resource_root_check.py +./out/pe-env/bin/python -B tests/pe_authentihash_check.py ./out/pe-env/bin/python -B tests/bcpack_check.py ./out/pe-env/bin/python -B tests/bcpack_symbols_check.py ./out/pe-env/bin/python -B tests/bcpack_tables_check.py @@ -116,11 +117,13 @@ python3 -m venv out/pe-env ./out/pe-env/bin/python -B tests/resource_ranges_check.py ./out/pe-env/bin/python -B tests/ttpf_batch_export_check.py ./out/pe-env/bin/python -B tests/awc_metadata_check.py +./out/pe-env/bin/python -B tests/startup_audio_timeline_check.py ./out/pe-env/bin/python -B tests/sgd5_effects_check.py ./out/pe-env/bin/python -B tests/dxcontainer_part_offsets_check.py ./out/pe-env/bin/python -B tests/layout_chunks_check.py ./out/pe-env/bin/python -B tests/dependency_paths_check.py ./out/pe-env/bin/python -B tests/pe_package_preflight_check.py +./out/pe-env/bin/python -B tests/host_commit_check.py ./out/pe-env/bin/python -B tests/pe_package_ordinal_plan_check.py ./out/pe-env/bin/python -B tests/compat_report_check.py ./out/pe-env/bin/python -B tests/intake/paths_check.py @@ -131,6 +134,7 @@ python3 -m venv out/pe-env ./out/pe-env/bin/python -B tests/shader_corpus_report_check.py ./out/pe-env/bin/python -B tests/dxil_retarget_check.py ./out/pe-env/bin/python -B tests/rdna2_tools_check.py +./out/pe-env/bin/python -B tests/mesh_dynamic_geometry_check.py ./out/pe-env/bin/python -B tests/pso_readiness_check.py ./out/pe-env/bin/python -B tests/xmem_attribute_scan_check.py ./out/pe-env/bin/python -B tests/xgameruntime_table_check.py @@ -143,11 +147,51 @@ python3 -m venv out/pe-env ./out/pe-env/bin/python -B tests/startup_image_sample_l_check.py ./out/pe-env/bin/python -B tests/startup_image_3d_check.py ./out/pe-env/bin/python -B tests/startup_image_load_mip_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_operand_count_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_mad_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_swap_check.py ./out/pe-env/bin/python -B tests/startup_image_2d_array_check.py +./out/pe-env/bin/python -B tests/startup_image_sample_a16_check.py ./out/pe-env/bin/python -B tests/startup_host_cpu_check.py +./out/pe-env/bin/python -B tests/startup_live_telemetry_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_capture_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_watch_check.py ./out/pe-env/bin/python -B tests/startup_translator_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_smem_offset_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_refusals_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_scalar_m0_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_readfirstlane_uniform_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_sop2_complement_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_sdwa_cvt_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_int_med3_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_cselect_mask_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_mask_overwrite_check.py ./out/pe-env/bin/python -B tests/startup_flat_param_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_root_check.py ./out/pe-env/bin/python -B tests/startup_inline_sampler_check.py +./out/pe-env/bin/python -B tests/startup_buffer_address_check.py +./out/pe-env/bin/python -B tests/startup_smem_address_check.py +./out/pe-env/bin/python -B tests/startup_stream_fetch_check.py +./out/pe-env/bin/python -B tests/startup_stream_interface_check.py +./out/pe-env/bin/python -B tests/compute_alu_cmp_ne_check.py +./out/pe-env/bin/python -B tests/compute_entry_layout_check.py +./out/pe-env/bin/python -B tests/compute_alu_bcnt64_check.py +./out/pe-env/bin/python -B tests/compute_load_format_check.py +./out/pe-env/bin/python -B tests/startup_ngg_slice_check.py +./out/pe-env/bin/python -B tests/mesh_dynamic_aot_check.py +./out/pe-env/bin/python -B tests/startup_image_gather_lz_check.py +./out/pe-env/bin/python -B tests/startup_image_sample_c_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_cvt_alu_check.py +./out/pe-env/bin/python -B tests/startup_triage_run_check.py +./out/pe-env/bin/python -B tests/startup_run_ps1_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_bit_alu_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_shift64_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_vopc_sdwa_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_f32_lg_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_f32_nan_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_sopk_signext_check.py +./out/pe-env/bin/python -B tests/run_checks_parallel_check.py +./out/pe-env/bin/python -B tests/startup_gfx2hlsl_handler_arity_check.py ``` `tests/pixel_aot_check.py binary` additionally needs LLVM with gfx1013 support diff --git a/CMakeLists.txt b/CMakeLists.txt index 6afbef55b..f9f331d3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,10 +19,31 @@ if(DSTORAGE_SDK_ROOT) COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${dstorage_native}/bin/x64/dstorage.dll" "${dstorage_native}/bin/x64/dstoragecore.dll" "$" VERBATIM) - foreach(scenario IN ITEMS success truncated checksum trailing oversize undersize) + foreach(scenario IN ITEMS success truncated checksum trailing oversize undersize refusals) add_test(NAME dstorage_rfc1950_${scenario} COMMAND dstorage_rfc1950_check ${scenario}) set_tests_properties(dstorage_rfc1950_${scenario} PROPERTIES TIMEOUT 30) endforeach() + # Negative control for the refusals case: a build-tree copy of the adapter without the 32-bit + # bound on SrcSize. The check must report that request as decoded instead of refused. + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS src/dstorage_rfc1950.cpp) + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/dstorage_rfc1950.cpp" dstorage_rfc1950_text) + string(REPLACE "request.SrcSize > ULONG_MAX || " "" dstorage_rfc1950_control_text "${dstorage_rfc1950_text}") + if(dstorage_rfc1950_control_text STREQUAL dstorage_rfc1950_text) + message(FATAL_ERROR "dstorage_rfc1950.cpp lost the anchor used by dstorage_rfc1950_refusals_truncation_control") + endif() + set(dstorage_rfc1950_control "${CMAKE_CURRENT_BINARY_DIR}/dstorage_rfc1950_control/dstorage_rfc1950.cpp") + file(WRITE "${dstorage_rfc1950_control}" "${dstorage_rfc1950_control_text}") + add_executable(dstorage_rfc1950_truncation_control tests/dstorage_rfc1950_check.cpp "${dstorage_rfc1950_control}") + target_compile_features(dstorage_rfc1950_truncation_control PRIVATE cxx_std_17) + target_include_directories(dstorage_rfc1950_truncation_control PRIVATE src "${dstorage_native}/include") + target_link_libraries(dstorage_rfc1950_truncation_control PRIVATE "${dstorage_native}/lib/x64/dstorage.lib" ZLIB::ZLIB) + add_custom_command(TARGET dstorage_rfc1950_truncation_control POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${dstorage_native}/bin/x64/dstorage.dll" + "${dstorage_native}/bin/x64/dstoragecore.dll" "$" + VERBATIM) + add_test(NAME dstorage_rfc1950_refusals_truncation_control COMMAND dstorage_rfc1950_truncation_control refusals) + set_tests_properties(dstorage_rfc1950_refusals_truncation_control PROPERTIES TIMEOUT 30 + PASS_REGULAR_EXPRESSION "FAIL: refusals src_over_ulong_max: status 0x8007000d") endif() add_executable(guest_content_root_check tests/guest_content_root_check.cpp) target_compile_features(guest_content_root_check PRIVATE cxx_std_17) @@ -44,9 +65,13 @@ add_test(NAME desktop_bvh_root_flags COMMAND d3d12_sdk_check bvh-flags) add_executable(era_heap_check tests/era_heap_check.cpp src/era_heap.cpp) target_include_directories(era_heap_check PRIVATE src) target_compile_features(era_heap_check PRIVATE cxx_std_20) -foreach(scenario IN ITEMS allocation failure concurrency caller_layout reuse observed_words large_alignment graphics_types) +foreach(scenario IN ITEMS allocation failure concurrency caller_layout reuse observed_words large_alignment graphics_types + decode_fields) add_test(NAME era_heap_${scenario} COMMAND era_heap_check ${scenario}) endforeach() +# Negative control: expects a 13-bit object type, so the widest object type must make it fail. +add_test(NAME era_heap_decode_fields_control COMMAND era_heap_check decode_fields_control) +set_tests_properties(era_heap_decode_fields_control PROPERTIES WILL_FAIL TRUE) add_executable(memory_query_check tests/memory_query_check.cpp) target_compile_features(memory_query_check PRIVATE cxx_std_17) @@ -64,6 +89,11 @@ target_compile_features(era_query_check PRIVATE cxx_std_17) foreach(scenario IN ITEMS fields tail registry short) add_test(NAME era_query_${scenario} COMMAND era_query_check ${scenario}) endforeach() +# A clear tail flag overwrites a stale byte, and another process's page at a registered address +# has it clear. The mutated run, which expects the flag set there, is the negative control. +add_test(NAME era_query_clear COMMAND era_query_check clear) +add_test(NAME era_query_clear_foreign_control COMMAND era_query_check clear --mutate foreign) +set_tests_properties(era_query_clear_foreign_control PROPERTIES WILL_FAIL TRUE) # Title GPU address to desktop GPU virtual address table (no GPU needed). add_executable(era_title_va_check tests/era_title_va_check.cpp src/era_title_va.cpp) @@ -91,9 +121,27 @@ target_compile_definitions(era_physical_lenient PRIVATE ERA_PHYSICAL_LENIENT_REL add_executable(era_physical_check tests/era_physical_check.cpp src/era_physical.cpp $) target_include_directories(era_physical_check PRIVATE src) target_compile_features(era_physical_check PRIVATE cxx_std_17) -foreach(scenario IN ITEMS controls lifetime) +foreach(scenario IN ITEMS controls lifetime owns) add_test(NAME era_physical_${scenario} COMMAND era_physical_check ${scenario}) endforeach() +# Control for era_physical_owns: the same check built against a configure-time copy of +# era_physical.cpp whose owns() refuses the last page number, which the full registry must catch. +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS src/era_physical.cpp) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/era_physical.cpp" era_physical_text) +string(FIND "${era_physical_text}" "return page && page <= capacity_pages && " era_physical_anchor) +if(era_physical_anchor LESS 0) + message(FATAL_ERROR "era_physical.cpp lost the anchor used by era_physical_owns_last_page_control") +endif() +string(REPLACE "return page && page <= capacity_pages && " "return page && page < capacity_pages && " + era_physical_text "${era_physical_text}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/era_physical_last_page/era_physical.cpp" "${era_physical_text}") +add_executable(era_physical_last_page_check tests/era_physical_check.cpp + "${CMAKE_CURRENT_BINARY_DIR}/era_physical_last_page/era_physical.cpp" $) +target_include_directories(era_physical_last_page_check PRIVATE src) +target_compile_features(era_physical_last_page_check PRIVATE cxx_std_17) +add_test(NAME era_physical_owns_last_page_control COMMAND era_physical_last_page_check owns) +set_tests_properties(era_physical_owns_last_page_control PROPERTIES PASS_REGULAR_EXPRESSION + "FAIL: owns: last page") # Desktop xmem.dll for native and mapped callers. add_library(xmem_shim SHARED src/xmem_shim.cpp src/xmem_shim.def src/xmem_gpu_usage.cpp src/adapter_identity.cpp src/era_heap.cpp src/era_query.cpp src/era_physical.cpp @@ -154,15 +202,35 @@ target_include_directories(xmem_commit_protection_check PRIVATE src) target_compile_features(xmem_commit_protection_check PRIVATE cxx_std_20) add_test(NAME xmem_commit_protection COMMAND xmem_commit_protection_check) set_tests_properties(xmem_commit_protection PROPERTIES TIMEOUT 30) + +# Slab slot bookkeeping of the physical pages (#1199): standard C++17 only, no Windows calls. +add_executable(xmem_slab_slots_check tests/xmem_slab_slots_check.cpp) +target_include_directories(xmem_slab_slots_check PRIVATE src) +target_compile_features(xmem_slab_slots_check PRIVATE cxx_std_17) +add_test(NAME xmem_slab_slots COMMAND xmem_slab_slots_check) +set_tests_properties(xmem_slab_slots PROPERTIES TIMEOUT 30) if(EXISTS "${INTAKE_PYTHON}") # Startup memory accounting (#1199): the live physical-page section snapshot, and the peak commit # and section count the DirectStorage heartbeat reports from it. add_test(NAME xmem_page_stats COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/xmem_page_stats_check.py" "$") + # A few mapped pages commit about those pages, not the whole 256 MiB slab that holds them (#1199). + add_test(NAME xmem_mapped_pages_commit COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/xmem_mapped_pages_commit_check.py" "$") + add_test(NAME xmem_mapped_pages_commit_failure COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/xmem_mapped_pages_commit_check.py" "$" failure) + set_tests_properties(xmem_mapped_pages_commit xmem_mapped_pages_commit_failure PROPERTIES TIMEOUT 60 RUN_SERIAL TRUE) + set_tests_properties(xmem_mapped_pages_commit_failure PROPERTIES ENVIRONMENT "X2W_XMEM_TEST_COMMIT_FAILURE=1") add_test(NAME startup_heartbeat_commit COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_heartbeat_check.py" "$" "$") set_tests_properties(startup_heartbeat_commit PROPERTIES TIMEOUT 60) + # Startup tooling lint (#1149): every Python file under tools/startup must parse. The check compiles each + # source without running it and self-tests that a broken snippet is rejected, so a passing run means the + # files were actually looked at. It needs no GPU and no game files. + add_test(NAME startup_tools_lint COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_tools_lint_check.py" "${CMAKE_SOURCE_DIR}/tools/startup") + set_tests_properties(startup_tools_lint PROPERTIES TIMEOUT 60) endif() # Mutation controls: each run flips one expected value and passes only when the # named check reports it. An unknown mutation name or an overall PASS fails. @@ -186,6 +254,42 @@ foreach(mutation_and_check FAIL_REGULAR_EXPRESSION "unknown mutation|xmem_commit_protection: PASS") endforeach() +# Startup blocks below 2^40 (#1758, under #874): X2W_XMEM_STARTUP_BELOW_40=1 places the 0x283 large-page +# startup blocks entirely below 2^40 or refuses them. The check loads xmem.dll by path; the deployed +# shim must ignore the test-build mutants, and each mutant in the test-controls build must make the +# named check fail. +add_executable(xmem_startup_below_40_check tests/xmem_startup_below_40_check.cpp) +target_link_libraries(xmem_startup_below_40_check PRIVATE OneCore) +target_compile_features(xmem_startup_below_40_check PRIVATE cxx_std_17) +add_dependencies(xmem_startup_below_40_check xmem_shim xmem_shim_test_controls) +add_test(NAME xmem_startup_below_40 COMMAND xmem_startup_below_40_check "$") +add_test(NAME xmem_startup_below_40_deployed_ignores_mutants + COMMAND xmem_startup_below_40_check "$") +set_tests_properties(xmem_startup_below_40 xmem_startup_below_40_deployed_ignores_mutants PROPERTIES + TIMEOUT 60 PASS_REGULAR_EXPRESSION "xmem_startup_below_40: PASS") +set_tests_properties(xmem_startup_below_40_deployed_ignores_mutants PROPERTIES + ENVIRONMENT "X2W_XMEM_TEST_BELOW_40=no_limit+no_check+no_release") +# Each entry: mutant @ output that must appear @ output that must not. Without the limit the check +# after the allocation still refuses and releases the high block (no NULL or leak failure); without +# the check the high block is returned; without the release it stays allocated. +foreach(entry + "no_limit@check_failed: exhausted_host_refusal@xmem_startup_below_40: PASS|check_failed: exhausted_(null|no_leak)" + "no_limit+no_check@check_failed: exhausted_null@xmem_startup_below_40: PASS" + "no_limit+no_release@check_failed: exhausted_no_leak@xmem_startup_below_40: PASS|check_failed: exhausted_null") + string(REPLACE "@" ";" fields "${entry}") + list(GET fields 0 mutant) + list(GET fields 1 expected_output) + list(GET fields 2 forbidden_output) + string(REPLACE "+" "_" mutant_name "${mutant}") + add_test(NAME xmem_startup_below_40_mutant_${mutant_name} + COMMAND xmem_startup_below_40_check "$") + set_tests_properties(xmem_startup_below_40_mutant_${mutant_name} PROPERTIES + TIMEOUT 60 + ENVIRONMENT "X2W_XMEM_TEST_BELOW_40=${mutant}" + PASS_REGULAR_EXPRESSION "${expected_output}" + FAIL_REGULAR_EXPRESSION "${forbidden_output}") +endforeach() + add_executable(windows_placeholder_partition_check tests/windows_placeholder_partition_check.cpp) target_compile_features(windows_placeholder_partition_check PRIVATE cxx_std_17) target_link_libraries(windows_placeholder_partition_check PRIVATE OneCore) @@ -198,6 +302,14 @@ set_target_properties(d3d12_xs_shim PROPERTIES OUTPUT_NAME d3d12_xs) target_include_directories(d3d12_xs_shim PRIVATE src) target_compile_features(d3d12_xs_shim PRIVATE cxx_std_17) target_link_libraries(d3d12_xs_shim PRIVATE d3d12) +# The creation-IID gate and refusal text of D3D12XboxCreateDevice (src/d3d12x_device_slots.h), +# without a device. The mutated run is the negative control. +add_executable(d3d12x_device_slots_check tests/d3d12x_device_slots_check.cpp src/d3d12x_device_slots.cpp) +target_include_directories(d3d12x_device_slots_check PRIVATE src) +target_compile_features(d3d12x_device_slots_check PRIVATE cxx_std_17) +add_test(NAME d3d12x_device_slots COMMAND d3d12x_device_slots_check) +add_test(NAME d3d12x_device_slots_device1_control COMMAND d3d12x_device_slots_check --mutate device1) +set_tests_properties(d3d12x_device_slots_device1_control PROPERTIES WILL_FAIL TRUE) # Fixture-only desktop xgameruntime.dll. The single X-macro table in # xgameruntime_shim.cpp distinguishes implemented synchronous contracts from @@ -218,7 +330,9 @@ target_compile_features(xgameruntime_shim_check PRIVATE cxx_std_17) add_test(NAME xgameruntime_thunks COMMAND xgameruntime_shim_check "$" "$" "$") -set_tests_properties(xgameruntime_thunks PROPERTIES TIMEOUT 30) +# These three tests use the fixed %TEMP%\xbox-recomp-pls and %TEMP%\xbox-recomp-packages directories, +# so they must not overlap when CTest runs tests in parallel. +set_tests_properties(xgameruntime_thunks PROPERTIES TIMEOUT 30 RESOURCE_LOCK xgameruntime_temp_directories) add_executable(xgameruntime_contracts_check tests/xgameruntime_contracts_check.cpp) target_link_libraries(xgameruntime_contracts_check PRIVATE xgameruntime_shim) @@ -226,7 +340,7 @@ target_compile_features(xgameruntime_contracts_check PRIVATE cxx_std_17) add_test(NAME xgameruntime_contracts COMMAND xgameruntime_contracts_check "$" "$" "$") -set_tests_properties(xgameruntime_contracts PROPERTIES TIMEOUT 30) +set_tests_properties(xgameruntime_contracts PROPERTIES TIMEOUT 30 RESOURCE_LOCK xgameruntime_temp_directories) add_executable(xgameruntime_pls_xpackage_check tests/xgameruntime_pls_xpackage_check.cpp) add_dependencies(xgameruntime_pls_xpackage_check xgameruntime_shim) @@ -234,7 +348,7 @@ target_compile_features(xgameruntime_pls_xpackage_check PRIVATE cxx_std_17) add_test(NAME xgameruntime_pls_xpackage COMMAND xgameruntime_pls_xpackage_check "$" "$" "$") -set_tests_properties(xgameruntime_pls_xpackage PROPERTIES TIMEOUT 30) +set_tests_properties(xgameruntime_pls_xpackage PROPERTIES TIMEOUT 30 RESOURCE_LOCK xgameruntime_temp_directories) add_executable(xgameruntime_identity_check tests/xgameruntime_identity_check.cpp) add_dependencies(xgameruntime_identity_check xgameruntime_shim) @@ -295,6 +409,7 @@ endforeach() # link the shims statically so they never use its runtime (constexpr std::mutex layout). target_link_libraries(startup_stub_xg_xs PRIVATE d3d12 dxguid) target_link_libraries(startup_stub_gameinput PRIVATE user32) +target_link_libraries(startup_stub_xapu PRIVATE winmm) # The DirectStorage heartbeat reports this process's peak commit (#1199). target_link_libraries(startup_stub_xcrdapi PRIVATE psapi) target_sources(startup_stub_gameinput PRIVATE src/startup_stubs/runtime_proxy.cpp) @@ -309,12 +424,51 @@ foreach(adapter IN ITEMS hardware warp) add_test(NAME startup_null_views_${adapter} COMMAND startup_null_views_check ${adapter}) endforeach() set_tests_properties(startup_null_views_hardware PROPERTIES SKIP_RETURN_CODE 77) +# Device slot 15 (GetDescriptorHandleIncrementSize, #870) next to a desktop device on the same adapter. +add_executable(startup_descriptor_increment tests/startup_descriptor_increment.cpp) +target_compile_features(startup_descriptor_increment PRIVATE cxx_std_17) +target_link_libraries(startup_descriptor_increment PRIVATE d3d12_xs_shim d3d12 dxgi) +foreach(adapter IN ITEMS hardware warp) + add_test(NAME startup_descriptor_increment_${adapter} COMMAND startup_descriptor_increment ${adapter}) +endforeach() +set_tests_properties(startup_descriptor_increment_hardware PROPERTIES SKIP_RETURN_CODE 77) +set_tests_properties(startup_descriptor_increment_hardware startup_descriptor_increment_warp PROPERTIES TIMEOUT 60 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_DEBUG=1") +# Which heap type values slot 15 forwards to desktop (src/startup_stubs/descriptor_heap_type.h), without a +# device. The mutated runs are the negative controls. +add_executable(startup_descriptor_heap_type_check tests/startup_descriptor_heap_type_check.cpp) +target_include_directories(startup_descriptor_heap_type_check PRIVATE src) +target_compile_features(startup_descriptor_heap_type_check PRIVATE cxx_std_17) +add_test(NAME startup_descriptor_heap_type COMMAND startup_descriptor_heap_type_check) +add_test(NAME startup_descriptor_heap_type_off_by_one_control COMMAND startup_descriptor_heap_type_check --mutate off-by-one) +add_test(NAME startup_descriptor_heap_type_signed_control COMMAND startup_descriptor_heap_type_check --mutate signed) +set_tests_properties(startup_descriptor_heap_type_off_by_one_control startup_descriptor_heap_type_signed_control PROPERTIES WILL_FAIL TRUE) +# The same header without a GPU (src/startup_stubs/null_texture_view.h): fake adapters that lack +# or have each use, R8G8B8A8 with one use, only B8G8R8A8, and failed queries. WARP has both uses, so +# only this check reaches the rewrite on CI. The mutated run is the negative control. +add_executable(startup_null_texture_view_check tests/startup_null_texture_view_check.cpp) +target_include_directories(startup_null_texture_view_check PRIVATE src) +target_compile_features(startup_null_texture_view_check PRIVATE cxx_std_17) +add_test(NAME startup_null_texture_view COMMAND startup_null_texture_view_check) +add_test(NAME startup_null_texture_view_unchecked_fallback_control COMMAND startup_null_texture_view_check --mutate unchecked-fallback) +set_tests_properties(startup_null_texture_view_unchecked_fallback_control PROPERTIES WILL_FAIL TRUE) +# The slot and label of the x2w-render totals line each null-binding cause is counted under +# (src/startup_stubs/null_binding_cause.h). The mutated run is the negative control. +add_executable(startup_null_cause_labels_check tests/startup_null_cause_labels_check.cpp) +target_include_directories(startup_null_cause_labels_check PRIVATE src) +target_compile_features(startup_null_cause_labels_check PRIVATE cxx_std_17) +add_test(NAME startup_null_cause_labels COMMAND startup_null_cause_labels_check) +add_test(NAME startup_null_cause_labels_buffer_token_control COMMAND startup_null_cause_labels_check --mutate buffer-token) +set_tests_properties(startup_null_cause_labels_buffer_token_control PROPERTIES WILL_FAIL TRUE) # The opt-in API trace reads only declared outputs; this checks the decision about what it observed -# (argument index 0, two outputs, exact and short buffers, same value, partial comparison). +# (argument index 0, two outputs, exact and short buffers, same value, partial comparison) and each +# declared contract. The mutated run is the negative control. add_executable(api_trace_check tests/api_trace_check.cpp) target_compile_features(api_trace_check PRIVATE cxx_std_17) target_include_directories(api_trace_check PRIVATE src) add_test(NAME api_trace COMMAND api_trace_check) +add_test(NAME api_trace_slot_only_control COMMAND api_trace_check --mutate slot-only) +set_tests_properties(api_trace_slot_only_control PROPERTIES WILL_FAIL TRUE) # A view heap larger than the adapter accepts: the stand-in creates the desktop heap at the measured # limit and keeps the title's full-size memory. Skips where the adapter accepts the full request. add_executable(startup_view_heap_check tests/startup_view_heap_check.cpp) @@ -325,23 +479,213 @@ foreach(adapter IN ITEMS hardware warp) set_tests_properties(startup_view_heap_${adapter} PROPERTIES SKIP_RETURN_CODE 77) endforeach() add_executable(startup_stub_consumer tests/startup_stub_consumer.cpp) +add_executable(startup_gameinput_keys tests/startup_gameinput_keys.cpp) +target_compile_features(startup_gameinput_keys PRIVATE cxx_std_17) +add_test(NAME startup_gameinput_keys COMMAND startup_gameinput_keys "$") +add_executable(startup_gameinput_history tests/startup_gameinput_history.cpp) +target_compile_features(startup_gameinput_history PRIVATE cxx_std_17) +add_test(NAME startup_gameinput_history COMMAND startup_gameinput_history "$") +set_tests_properties(startup_gameinput_history PROPERTIES RUN_SERIAL TRUE) +add_executable(startup_gameinput_script tests/startup_gameinput_script.cpp) +target_compile_features(startup_gameinput_script PRIVATE cxx_std_17) +foreach(mode IN ITEMS long entries) + add_test(NAME startup_gameinput_script_${mode} COMMAND startup_gameinput_script "$" ${mode}) + set_tests_properties(startup_gameinput_script_${mode} PROPERTIES RUN_SERIAL TRUE) +endforeach() +add_executable(startup_gameinput_contracts_check tests/startup_gameinput_contracts_check.cpp) +target_compile_features(startup_gameinput_contracts_check PRIVATE cxx_std_17) +add_dependencies(startup_gameinput_contracts_check startup_stub_gameinput) +add_test(NAME startup_gameinput_contracts_check COMMAND startup_gameinput_contracts_check "$") +set_tests_properties(startup_gameinput_contracts_check PROPERTIES TIMEOUT 60 RUN_SERIAL TRUE) +add_executable(startup_gameinput_script_syntax tests/startup_gameinput_script_syntax.cpp) +target_include_directories(startup_gameinput_script_syntax PRIVATE src) +target_compile_features(startup_gameinput_script_syntax PRIVATE cxx_std_17) +add_test(NAME startup_gameinput_script_syntax COMMAND startup_gameinput_script_syntax "$") +set_tests_properties(startup_gameinput_script_syntax PROPERTIES RUN_SERIAL TRUE SKIP_RETURN_CODE 77) +add_executable(startup_present_signature tests/startup_present_signature.cpp) +target_include_directories(startup_present_signature PRIVATE src) +target_compile_features(startup_present_signature PRIVATE cxx_std_17) +target_link_libraries(startup_present_signature PRIVATE d3d12 dxgi) +add_test(NAME startup_present_signature_warp COMMAND startup_present_signature) +set_tests_properties(startup_present_signature_warp PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 60) +# The sampler holds the presented surface until its copy has finished: a stalled queue, the caller's +# release after the present, then the signature, all under the debug layer. The control repeats the +# stall with a copy that does not hold its source and passes only if the debug layer reports it. +add_test(NAME startup_present_signature_held_source_warp COMMAND startup_present_signature held_source) +set_tests_properties(startup_present_signature_held_source_warp PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 60) +add_test(NAME startup_present_signature_unheld_source_control_warp COMMAND startup_present_signature unheld_control) +set_tests_properties(startup_present_signature_unheld_source_control_warp PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 60) add_executable(startup_placement_alloc tests/startup_placement_alloc.cpp) target_compile_features(startup_placement_alloc PRIVATE cxx_std_17) target_include_directories(startup_placement_alloc PRIVATE src) add_test(NAME startup_placement_alloc COMMAND startup_placement_alloc) +# The same registration under the lock held exclusively, and max_width kept at the widest record +# (src/startup_stubs/placement_publish.h). The mutated run is the negative control. +add_executable(startup_placement_publish_check tests/startup_placement_publish_check.cpp) +target_compile_features(startup_placement_publish_check PRIVATE cxx_std_17) +target_include_directories(startup_placement_publish_check PRIVATE src) +add_test(NAME startup_placement_publish COMMAND startup_placement_publish_check) +add_test(NAME startup_placement_publish_shrink_control COMMAND startup_placement_publish_check --mutate shrink) +set_tests_properties(startup_placement_publish_shrink_control PROPERTIES WILL_FAIL TRUE) +# Device slot 133 proves that the allocation is committed from its base to the end of the buffer with +# one region-information call when the whole private allocation is committed, else with a walk that +# stops at the end of the buffer; every alias or refusal must equal the full walk's on the same memory, +# including a decommitted page before the buffer and a block replaced at the same base, and a large +# touched block must need no VirtualQuery (src/startup_stubs/placed_buffer_range.h). The mutated runs +# are the negative controls. +add_executable(startup_placed_buffer_range_check tests/startup_placed_buffer_range_check.cpp) +target_compile_features(startup_placed_buffer_range_check PRIVATE cxx_std_17) +target_include_directories(startup_placed_buffer_range_check PRIVATE src) +add_test(NAME startup_placed_buffer_range COMMAND startup_placed_buffer_range_check) +add_test(NAME startup_placed_buffer_range_region_only_control COMMAND startup_placed_buffer_range_check --mutate region-only) +add_test(NAME startup_placed_buffer_range_walk_only_control COMMAND startup_placed_buffer_range_check --mutate walk-only) +set_tests_properties(startup_placed_buffer_range_region_only_control startup_placed_buffer_range_walk_only_control + PROPERTIES WILL_FAIL TRUE SKIP_RETURN_CODE 77) add_executable(startup_storage_file_range tests/startup_storage_file_range.cpp) target_compile_features(startup_storage_file_range PRIVATE cxx_std_17) target_include_directories(startup_storage_file_range PRIVATE src) add_test(NAME startup_storage_file_range COMMAND startup_storage_file_range) +# The same read at offsets that need the high half of the OVERLAPPED position, in a sparse +# 4 GiB + 20 byte temporary file (src/startup_stubs/dstorage_file_read.h). 77 without sparse files. +add_executable(startup_dstorage_file_read_check tests/startup_dstorage_file_read_check.cpp) +target_compile_features(startup_dstorage_file_read_check PRIVATE cxx_std_17) +target_include_directories(startup_dstorage_file_read_check PRIVATE src) +add_test(NAME startup_dstorage_file_read COMMAND startup_dstorage_file_read_check) +add_test(NAME startup_dstorage_file_read_alias_control COMMAND startup_dstorage_file_read_check --mutate alias) +set_tests_properties(startup_dstorage_file_read startup_dstorage_file_read_alias_control PROPERTIES SKIP_RETURN_CODE 77) +set_tests_properties(startup_dstorage_file_read_alias_control PROPERTIES WILL_FAIL TRUE) +add_executable(startup_inflate_status tests/startup_inflate_status.cpp) +target_compile_features(startup_inflate_status PRIVATE cxx_std_17) +target_include_directories(startup_inflate_status PRIVATE src) +add_test(NAME startup_inflate_status COMMAND startup_inflate_status) +# An allocation failure on the DirectStorage stand-in's worker fails that request, and the worker +# serves the next one (#1199). Skips (77) where the system does not enforce a job commit limit. +add_executable(startup_storage_alloc_failure tests/startup_storage_alloc_failure.cpp) +target_compile_features(startup_storage_alloc_failure PRIVATE cxx_std_17) +target_link_libraries(startup_storage_alloc_failure PRIVATE psapi) +add_dependencies(startup_storage_alloc_failure startup_stub_xcrdapi) +add_test(NAME startup_storage_alloc_failure COMMAND startup_storage_alloc_failure "$") +set_tests_properties(startup_storage_alloc_failure PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77) +# A refused file request (offset at the end of the file, implausible size; raw and zlib) leaves its destination +# untouched, fails its status entry, and the requests around it in the same Submit complete in order (#1586). +add_executable(startup_storage_refusal_order tests/startup_storage_refusal_order.cpp) +target_compile_features(startup_storage_refusal_order PRIVATE cxx_std_17) +add_dependencies(startup_storage_refusal_order startup_stub_xcrdapi) +add_test(NAME startup_storage_refusal_order COMMAND startup_storage_refusal_order "$") +set_tests_properties(startup_storage_refusal_order PROPERTIES TIMEOUT 60) +# Failed requests counted by cause for the heartbeat (#1198): at or past EOF, crossing EOF, other read +# failure, destination capacity, non-writable destination, zlib, BCPack, other. The test compiles the +# stand-in's source into itself to read the counters; the one-bucket expectations are the negative control. +add_executable(startup_storage_failure_counts tests/startup_storage_failure_counts.cpp) +target_compile_features(startup_storage_failure_counts PRIVATE cxx_std_17) +target_include_directories(startup_storage_failure_counts PRIVATE src) +target_link_libraries(startup_storage_failure_counts PRIVATE psapi) +add_test(NAME startup_storage_failure_counts COMMAND startup_storage_failure_counts) +add_test(NAME startup_storage_failure_counts_one_bucket_control COMMAND startup_storage_failure_counts --mutate one-bucket) +set_tests_properties(startup_storage_failure_counts startup_storage_failure_counts_one_bucket_control PROPERTIES TIMEOUT 60) +set_tests_properties(startup_storage_failure_counts_one_bucket_control PROPERTIES WILL_FAIL TRUE) +# Page-destination requests counted by where page_offset + destination_size ends against the first 64 KiB +# page (inside, at its end, past it), each as completed or failed, for the heartbeat (#1198). The test +# compiles the stand-in's source into itself and loads the xmem shim for page writes; the one-bucket +# expectations are the negative control. +add_executable(startup_storage_page_end_counts tests/startup_storage_page_end_counts.cpp) +target_compile_features(startup_storage_page_end_counts PRIVATE cxx_std_17) +target_include_directories(startup_storage_page_end_counts PRIVATE src) +target_link_libraries(startup_storage_page_end_counts PRIVATE psapi) +add_dependencies(startup_storage_page_end_counts xmem_shim) +add_test(NAME startup_storage_page_end_counts COMMAND startup_storage_page_end_counts "$") +add_test(NAME startup_storage_page_end_counts_one_bucket_control + COMMAND startup_storage_page_end_counts "$" --mutate one-bucket) +set_tests_properties(startup_storage_page_end_counts startup_storage_page_end_counts_one_bucket_control PROPERTIES TIMEOUT 60) +set_tests_properties(startup_storage_page_end_counts_one_bucket_control PROPERTIES WILL_FAIL TRUE) +# A matched pair of page-destination zlib requests ending at the first page's end (#1198): one completes, +# one is refused for capacity. Read through XMemMapPhysicalPages views at each fence and after, the refused +# page keeps its sentinel; the pages are then unmapped and freed and a follow-up of the same shape completes. +# The accept-refused control takes the refused destination as data and must fail on that check. +add_executable(startup_storage_consumer_pair tests/startup_storage_consumer_pair.cpp) +target_compile_features(startup_storage_consumer_pair PRIVATE cxx_std_17) +add_dependencies(startup_storage_consumer_pair startup_stub_xcrdapi xmem_shim) +add_test(NAME startup_storage_consumer_pair + COMMAND startup_storage_consumer_pair "$" "$") +add_test(NAME startup_storage_consumer_pair_accept_refused_control + COMMAND startup_storage_consumer_pair "$" "$" + --mutate accept-refused) +set_tests_properties(startup_storage_consumer_pair startup_storage_consumer_pair_accept_refused_control PROPERTIES TIMEOUT 60) +set_tests_properties(startup_storage_consumer_pair_accept_refused_control PROPERTIES PASS_REGULAR_EXPRESSION + "FAIL: after both fences: R destination taken as data differs from the stream prefix in 4096 byte\\(s\\), first at 0xf000") +# The same page followed through a refused request, a later valid write and a later refused write, without +# a release in between (#1198). Statuses stay per entry (R1 stays E_FAIL after V succeeds); the refused R2 +# leaves V's bytes untouched. The accept-refused control takes R1's destination as data and must fail. +add_executable(startup_storage_refused_reuse tests/startup_storage_refused_reuse.cpp) +target_compile_features(startup_storage_refused_reuse PRIVATE cxx_std_17) +add_dependencies(startup_storage_refused_reuse startup_stub_xcrdapi xmem_shim) +add_test(NAME startup_storage_refused_reuse + COMMAND startup_storage_refused_reuse "$" "$") +add_test(NAME startup_storage_refused_reuse_accept_refused_control + COMMAND startup_storage_refused_reuse "$" "$" + --mutate accept-refused) +set_tests_properties(startup_storage_refused_reuse startup_storage_refused_reuse_accept_refused_control PROPERTIES TIMEOUT 60) +set_tests_properties(startup_storage_refused_reuse_accept_refused_control PROPERTIES PASS_REGULAR_EXPRESSION + "FAIL: R1 destination taken as data matches the stream prefix in 0 of 4096 byte") +# A queue whose worker cannot start (both CreateThread attempts fail, or the construction of its work +# throws std::bad_alloc) completes status entries and fences at Submit, never inside Enqueue (#1199). +# The test compiles the stand-in's source into itself so it can redirect CreateThread and operator new. +add_executable(startup_dstorage_destination_check tests/startup_dstorage_destination_check.cpp) +target_compile_features(startup_dstorage_destination_check PRIVATE cxx_std_17) +add_dependencies(startup_dstorage_destination_check startup_stub_xcrdapi) +add_test(NAME startup_dstorage_destination COMMAND startup_dstorage_destination_check "$") +set_tests_properties(startup_dstorage_destination PROPERTIES TIMEOUT 60) +add_executable(startup_storage_worker_start tests/startup_storage_worker_start.cpp) +target_compile_features(startup_storage_worker_start PRIVATE cxx_std_17) +target_include_directories(startup_storage_worker_start PRIVATE src) +target_link_libraries(startup_storage_worker_start PRIVATE psapi) +add_test(NAME startup_storage_worker_start COMMAND startup_storage_worker_start) +set_tests_properties(startup_storage_worker_start PROPERTIES TIMEOUT 60) target_compile_features(startup_stub_consumer PRIVATE cxx_std_17) +target_include_directories(startup_stub_consumer PRIVATE src) +target_sources(startup_stub_consumer PRIVATE src/startup_stubs/runtime_proxy.cpp) target_link_libraries(startup_stub_consumer PRIVATE startup_stub_chad startup_stub_xg_xs xmem_shim d3d12_xs_shim) +# APU heap stand-in: ApuFree reuse, coalescing, refused requests and concurrent callers (docs/startup-runtime.md). +add_executable(startup_acphal_apu_free tests/startup_acphal_apu_free.cpp) +target_compile_features(startup_acphal_apu_free PRIVATE cxx_std_17) +add_dependencies(startup_acphal_apu_free startup_stub_acphal) +add_test(NAME startup_acphal_apu_free COMMAND startup_acphal_apu_free "$") +set_tests_properties(startup_acphal_apu_free PROPERTIES TIMEOUT 60) +add_executable(startup_xapu_queue_check tests/startup_xapu_queue_check.cpp) +target_compile_features(startup_xapu_queue_check PRIVATE cxx_std_17) +add_dependencies(startup_xapu_queue_check startup_stub_xapu) +add_test(NAME startup_xapu_queue COMMAND startup_xapu_queue_check "$") +set_tests_properties(startup_xapu_queue PROPERTIES TIMEOUT 60) + +add_executable(startup_chad_check tests/startup_chad_check.cpp) +target_compile_features(startup_chad_check PRIVATE cxx_std_17) +add_dependencies(startup_chad_check startup_stub_chad) +add_test(NAME startup_chad_check COMMAND startup_chad_check "$") +set_tests_properties(startup_chad_check PROPERTIES TIMEOUT 60) + +# BMP writer of the draw dumps (src/startup_stubs/draw_bmp.h); the mutated runs are negative controls. add_executable(startup_draw_bmp_check tests/startup_draw_bmp.cpp) add_test(NAME startup_draw_bmp COMMAND startup_draw_bmp_check) +foreach(mutation IN ITEMS tight wrap size-image) + add_test(NAME startup_draw_bmp_${mutation}_control COMMAND startup_draw_bmp_check --mutate ${mutation}) + set_tests_properties(startup_draw_bmp_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() +# Names the x2w-noop log gives to command list slots (src/startup_stubs/command_list_slot_names.h, #870). +add_executable(startup_command_list_slot_names tests/startup_command_list_slot_names.cpp) +target_compile_features(startup_command_list_slot_names PRIVATE cxx_std_17) +add_test(NAME startup_command_list_slot_names COMMAND startup_command_list_slot_names) # Game-save stand-in storage (src/startup_stubs/save_store.h): a blob written by one process is read by a second. add_executable(startup_gamesave_persist tests/startup_gamesave_persist.cpp) target_compile_features(startup_gamesave_persist PRIVATE cxx_std_17) add_test(NAME startup_gamesave_persist COMMAND startup_gamesave_persist) +# Enumeration of the same store (Store::list_containers, Store::list_blobs): exact names, sizes and +# order, what is not listed, the busy and untouched-output rules, and a second process that +# publishes two-blob updates while this one lists. +add_executable(startup_gamesave_enumerate tests/startup_gamesave_enumerate.cpp) +target_compile_features(startup_gamesave_enumerate PRIVATE cxx_std_17) +add_test(NAME startup_gamesave_enumerate COMMAND startup_gamesave_enumerate) +set_tests_properties(startup_gamesave_enumerate PROPERTIES TIMEOUT 120) # Publication of a multi-blob update: a second process sees the whole old generation or the whole # new one. The test is built from two generated copies of the store headers, each with a pause # point at every step of the publication (the `x2w-seam` comments). In the second copy the file lock @@ -349,7 +693,7 @@ add_test(NAME startup_gamesave_persist COMMAND startup_gamesave_persist) # can fail. Nothing of this reaches the production headers. file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/startup_stubs/save_store.h" gamesave_store_text) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/startup_stubs/file_lock.h" gamesave_lock_text) -foreach(anchor "#pragma once" "// x2w-seam: moved-aside" "// x2w-seam: published") +foreach(anchor "#pragma once" "// x2w-seam: moved-aside" "// x2w-seam: published" "// x2w-seam: store-read" "// x2w-seam: blob-read") string(FIND "${gamesave_store_text}" "${anchor}" gamesave_anchor) if(gamesave_anchor LESS 0) message(FATAL_ERROR "save_store.h lost the anchor '${anchor}' used by startup_gamesave_publish") @@ -362,6 +706,10 @@ endif() string(REPLACE "#pragma once" "#pragma once\nvoid x2w_save_test_point(unsigned point);" gamesave_store_text "${gamesave_store_text}") string(REPLACE "// x2w-seam: moved-aside" "x2w_save_test_point(2u * static_cast(&step - steps.data()));" gamesave_store_text "${gamesave_store_text}") string(REPLACE "// x2w-seam: published" "x2w_save_test_point(2u * static_cast(&step - steps.data()) + 1u);" gamesave_store_text "${gamesave_store_text}") +# Reader seams for startup_gamesave_read_publish: a hook that is null unless that test sets it. +string(REPLACE "void x2w_save_test_point(unsigned point);" "void x2w_save_test_point(unsigned point);\ninline void (*x2w_save_read_hook)(int point, unsigned long long index) = nullptr;" gamesave_store_text "${gamesave_store_text}") +string(REPLACE "// x2w-seam: store-read" "if (x2w_save_read_hook) x2w_save_read_hook(2, 0);" gamesave_store_text "${gamesave_store_text}") +string(REPLACE "// x2w-seam: blob-read" "if (x2w_save_read_hook) x2w_save_read_hook(0, i);" gamesave_store_text "${gamesave_store_text}") string(REPLACE "// x2w-seam: lock-attempt" "static volatile bool x2w_no_lock = true;\n if (x2w_no_lock) return Attempt::locked;" gamesave_nolock_text "${gamesave_lock_text}") foreach(variant locked unlocked) set(gamesave_dir "${CMAKE_CURRENT_BINARY_DIR}/gamesave_publish_${variant}") @@ -376,16 +724,49 @@ foreach(variant locked unlocked) target_compile_features(startup_gamesave_publish_${variant} PRIVATE cxx_std_17) add_test(NAME startup_gamesave_publish_${variant} COMMAND startup_gamesave_publish_${variant}) set_tests_properties(startup_gamesave_publish_${variant} PROPERTIES TIMEOUT 120) + # The synchronous read (slot 20) against the same paused writer in a second process. + add_executable(startup_gamesave_read_publish_${variant} tests/startup_gamesave_read_publish.cpp) + target_include_directories(startup_gamesave_read_publish_${variant} PRIVATE "${gamesave_dir}" src) + target_compile_features(startup_gamesave_read_publish_${variant} PRIVATE cxx_std_17) + add_test(NAME startup_gamesave_read_publish_${variant} COMMAND startup_gamesave_read_publish_${variant}) + set_tests_properties(startup_gamesave_read_publish_${variant} PROPERTIES TIMEOUT 300) endforeach() # The copy without the lock must be caught by the reader that sees a mixed or incomplete generation. set_tests_properties(startup_gamesave_publish_unlocked PROPERTIES PASS_REGULAR_EXPRESSION "reader saw a mixed generation") +set_tests_properties(startup_gamesave_read_publish_unlocked PROPERTIES PASS_REGULAR_EXPRESSION "reader saw a mixed generation") add_executable(startup_gamesave_lock_errors tests/startup_gamesave_lock_errors.cpp) target_include_directories(startup_gamesave_lock_errors PRIVATE src) target_compile_features(startup_gamesave_lock_errors PRIVATE cxx_std_17) add_test(NAME startup_gamesave_lock_errors COMMAND startup_gamesave_lock_errors) +# Negative control: the same check built against a generated copy of file_lock.h whose acquire no +# longer drops the lock the object already holds. The check must report that leaked lock. The copy +# exists only in the test build. +string(REGEX REPLACE "release\\(\\);([\r\n]+ +last_error_ = 0;)" "\\1" gamesave_lock_keep_text "${gamesave_lock_text}") +if(gamesave_lock_keep_text STREQUAL gamesave_lock_text) + message(FATAL_ERROR "file_lock.h lost the release at the start of acquire used by startup_gamesave_lock_errors_reacquire_control") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gamesave_lock_keep/startup_stubs/file_lock.h" "${gamesave_lock_keep_text}") +add_executable(startup_gamesave_lock_errors_keep tests/startup_gamesave_lock_errors.cpp) +target_include_directories(startup_gamesave_lock_errors_keep PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gamesave_lock_keep") +target_compile_features(startup_gamesave_lock_errors_keep PRIVATE cxx_std_17) +add_test(NAME startup_gamesave_lock_errors_reacquire_control COMMAND startup_gamesave_lock_errors_keep) +set_tests_properties(startup_gamesave_lock_errors_reacquire_control PROPERTIES PASS_REGULAR_EXPRESSION "FAIL: re-acquire") +add_executable(startup_gamesave_read tests/startup_gamesave_read.cpp) +target_include_directories(startup_gamesave_read PRIVATE src) +target_compile_features(startup_gamesave_read PRIVATE cxx_std_17) add_executable(startup_gamesave_submit tests/startup_gamesave_submit.cpp) target_include_directories(startup_gamesave_submit PRIVATE src) target_compile_features(startup_gamesave_submit PRIVATE cxx_std_17) +add_executable(startup_gamesave_read_async tests/startup_gamesave_read_async.cpp) +target_include_directories(startup_gamesave_read_async PRIVATE src) +target_compile_features(startup_gamesave_read_async PRIVATE cxx_std_17) +add_executable(startup_runtime_local tests/startup_runtime_local.cpp) +target_include_directories(startup_runtime_local PRIVATE src) +target_compile_features(startup_runtime_local PRIVATE cxx_std_17) +add_test(NAME startup_runtime_local COMMAND startup_runtime_local) +# Control: with the local runtime switch left off, the local answers must be missing. +add_test(NAME startup_runtime_local_control COMMAND startup_runtime_local --control) +set_tests_properties(startup_runtime_local_control PROPERTIES PASS_REGULAR_EXPRESSION "FAIL: ") # Input for the launcher containment check (docs/startup-runtime.md): writes known bytes to both # streams and the trap log, reports a known exit code, or holds memory, spawns a child or stays @@ -407,10 +788,34 @@ target_compile_features(startup_launch_probe PRIVATE cxx_std_17) # Input for the startup debugger's diagnostics check (tests/startup_debug_check.py). add_executable(startup_debug_probe tests/startup_debug_probe.cpp) target_compile_features(startup_debug_probe PRIVATE cxx_std_17) +# The DLL the probe calls for the debugger's call-hook case (--trace-calls). +add_library(startup_debug_calls SHARED tests/startup_debug_calls.cpp) +add_dependencies(startup_debug_probe startup_debug_calls) # Input for tests/startup_inflate_check.py: the DirectStorage stand-in's zlib decoder on one stream. add_executable(startup_inflate_probe tests/startup_inflate_probe.cpp) target_compile_features(startup_inflate_probe PRIVATE cxx_std_17) target_include_directories(startup_inflate_probe PRIVATE src) +# The same probe decoding one bit at a time (the reference), and with one wrong table entry (the control); +# only the startup_inflate test uses them. +if(EXISTS "${INTAKE_PYTHON}") + add_executable(startup_inflate_probe_bitwise tests/startup_inflate_probe.cpp) + target_compile_features(startup_inflate_probe_bitwise PRIVATE cxx_std_17) + target_include_directories(startup_inflate_probe_bitwise PRIVATE src) + target_compile_definitions(startup_inflate_probe_bitwise PRIVATE X2W_INFLATE_FAST_BITS=0) + add_executable(startup_inflate_probe_faulty tests/startup_inflate_probe.cpp) + target_compile_features(startup_inflate_probe_faulty PRIVATE cxx_std_17) + target_include_directories(startup_inflate_probe_faulty PRIVATE src) + target_compile_definitions(startup_inflate_probe_faulty PRIVATE X2W_INFLATE_FAULTY_TABLE) + # Controls for the fast loop: entered one output byte short of the longest match, entered with 7 + # input bytes left, and without its distance check. + foreach(control IN ITEMS margin input_margin distance) + add_executable(startup_inflate_probe_faulty_${control} tests/startup_inflate_probe.cpp) + target_compile_features(startup_inflate_probe_faulty_${control} PRIVATE cxx_std_17) + target_include_directories(startup_inflate_probe_faulty_${control} PRIVATE src) + string(TOUPPER "${control}" control_macro) + target_compile_definitions(startup_inflate_probe_faulty_${control} PRIVATE X2W_INFLATE_FAULTY_${control_macro}) + endforeach() +endif() add_executable(startup_dump_fence_check tests/startup_dump_fence.cpp tests/desktop_gpu.cpp) add_executable(startup_overlay_window tests/startup_overlay_window.cpp) @@ -418,8 +823,12 @@ target_compile_features(startup_overlay_window PRIVATE cxx_std_17) target_include_directories(startup_overlay_window PRIVATE src) target_link_libraries(startup_overlay_window PRIVATE user32) add_test(NAME startup_overlay_window COMMAND startup_overlay_window) -# WASAPI render sink (Refs #1145); exit 77 when the machine has no usable render endpoint. -add_executable(startup_audio_output tests/startup_audio_output.cpp src/startup_stubs/audio_sink.cpp) +# WASAPI render sink (Refs #1145); exit 77 when the machine has no usable render endpoint. The sink is +# compiled once for this check and the pacing control below. +add_library(startup_audio_sink_obj OBJECT src/startup_stubs/audio_sink.cpp) +target_compile_features(startup_audio_sink_obj PRIVATE cxx_std_17) +target_include_directories(startup_audio_sink_obj PRIVATE src) +add_executable(startup_audio_output tests/startup_audio_output.cpp $) target_compile_features(startup_audio_output PRIVATE cxx_std_17) target_include_directories(startup_audio_output PRIVATE src) target_link_libraries(startup_audio_output PRIVATE ole32) @@ -427,7 +836,7 @@ add_test(NAME startup_audio_output COMMAND startup_audio_output) set_tests_properties(startup_audio_output PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 60) # Playback-timing control: the same sink and endpoint as startup_audio_output, fed steady and bursty, # recording first submission, frame counts, clock, drained interval and recovery for comparison. -add_executable(startup_audio_pacing tests/startup_audio_pacing.cpp src/startup_stubs/audio_sink.cpp) +add_executable(startup_audio_pacing tests/startup_audio_pacing.cpp $) target_compile_features(startup_audio_pacing PRIVATE cxx_std_17) target_include_directories(startup_audio_pacing PRIVATE src) target_link_libraries(startup_audio_pacing PRIVATE ole32) @@ -442,16 +851,36 @@ target_include_directories(startup_audio_provider PRIVATE src) target_link_libraries(startup_audio_provider PRIVATE ole32 xaudio2) add_test(NAME startup_audio_provider COMMAND startup_audio_provider) set_tests_properties(startup_audio_provider PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 120) +if(EXISTS "${INTAKE_PYTHON}") + # Audio/input alignment control: generated packet statistics through tools/startup_audio_timeline.py. + # It needs no audio device, no GPU and no game files. + add_test(NAME startup_audio_timeline COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_audio_timeline_check.py") + set_tests_properties(startup_audio_timeline PROPERTIES TIMEOUT 60) +endif() target_compile_features(startup_dump_fence_check PRIVATE cxx_std_17) target_include_directories(startup_dump_fence_check PRIVATE src) target_link_libraries(startup_dump_fence_check PRIVATE d3d12 dxgi) add_test(NAME startup_dump_fence_warp COMMAND startup_dump_fence_check) set_tests_properties(startup_dump_fence_warp PROPERTIES ENVIRONMENT "X2W_SHIM_DRAW_ADAPTER=warp" TIMEOUT 45) +# The control expects a capture whose fence reports device removal to be published, and must fail. +add_test(NAME startup_dump_fence_removed_control_warp COMMAND startup_dump_fence_check --mutate removed) +set_tests_properties(startup_dump_fence_removed_control_warp PROPERTIES ENVIRONMENT "X2W_SHIM_DRAW_ADAPTER=warp" TIMEOUT 45 + WILL_FAIL TRUE) -add_executable(startup_stream_consumer tests/startup_stream_consumer.cpp tests/startup_stream_setup.cpp tests/startup_stream_draw.cpp - tests/startup_address_srv.cpp) +# tests/startup_stream_setup.cpp is compiled once for the consumer and the depth check. +add_library(startup_stream_setup_obj OBJECT tests/startup_stream_setup.cpp) +target_compile_features(startup_stream_setup_obj PRIVATE cxx_std_17) +add_executable(startup_stream_consumer tests/startup_stream_consumer.cpp $ tests/startup_stream_draw.cpp + tests/startup_address_srv.cpp tests/startup_root_cbv.cpp tests/startup_root_heap.cpp) target_compile_features(startup_stream_consumer PRIVATE cxx_std_17) target_link_libraries(startup_stream_consumer PRIVATE d3d12_xs_shim startup_stub_xg_xs d3d12 dxgi) +target_sources(startup_stream_consumer PRIVATE tests/startup_frame_copy.cpp) +target_sources(startup_stream_consumer PRIVATE tests/startup_root_reset.cpp) + +add_executable(startup_stream_depth tests/startup_stream_depth.cpp $) +target_compile_features(startup_stream_depth PRIVATE cxx_std_17) +target_link_libraries(startup_stream_depth PRIVATE d3d12_xs_shim d3d12 dxgi) # Console queue Wait (slot 17) waits on the GPU instead of signalling the fence. add_executable(startup_queue_wait tests/startup_queue_wait.cpp) @@ -471,12 +900,84 @@ foreach(backend IN ITEMS warp hardware) add_test(NAME startup_list_resubmit_${backend} COMMAND startup_list_resubmit ${backend}) set_tests_properties(startup_list_resubmit_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=1") + # The same steps without the D3D12 debug layer: catches UMD faults that SDKLayers validation hides (#1876). + add_test(NAME startup_list_resubmit_nodebug_${backend} COMMAND startup_list_resubmit ${backend}) + set_tests_properties(startup_list_resubmit_nodebug_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=0") + add_test(NAME startup_list_resubmit_nodebug_untracked_${backend} COMMAND startup_list_resubmit ${backend} untracked) + set_tests_properties(startup_list_resubmit_nodebug_untracked_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=0;X2W_TEST_SUBMIT_FENCE_FAIL=1") # The same steps when no submit fence can be created: nothing may be reset or reused. add_test(NAME startup_list_resubmit_untracked_${backend} COMMAND startup_list_resubmit ${backend} untracked) set_tests_properties(startup_list_resubmit_untracked_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=1;X2W_TEST_SUBMIT_FENCE_FAIL=1") endforeach() +add_executable(startup_upload_arena tests/startup_upload_arena.cpp) +target_compile_features(startup_upload_arena PRIVATE cxx_std_17) +target_include_directories(startup_upload_arena PRIVATE src) +target_link_libraries(startup_upload_arena PRIVATE d3d12 dxgi) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_upload_arena_${backend} COMMAND startup_upload_arena ${backend}) + set_tests_properties(startup_upload_arena_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) +endforeach() + +# Upload arena payloads must survive an arena reset while the GPU waits on a fence (Refs #1758). +add_executable(startup_upload_lifetime tests/startup_upload_lifetime.cpp) +target_compile_features(startup_upload_lifetime PRIVATE cxx_std_17) +target_include_directories(startup_upload_lifetime PRIVATE src) +target_link_libraries(startup_upload_lifetime PRIVATE d3d12 dxgi) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_upload_lifetime_${backend} COMMAND startup_upload_lifetime ${backend}) + set_tests_properties(startup_upload_lifetime_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77) +endforeach() + +# GPU writes the dispatch record that the desktop command processor consumes (Refs #1412). +add_executable(startup_indirect_dispatch tests/startup_indirect_dispatch.cpp tests/desktop_gpu.cpp) +target_compile_features(startup_indirect_dispatch PRIVATE cxx_std_17) +target_link_libraries(startup_indirect_dispatch PRIVATE d3d12_xs_shim d3d12 dxgi d3dcompiler) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_indirect_dispatch_${backend} COMMAND startup_indirect_dispatch ${backend}) + add_test(NAME startup_indirect_root_constants_${backend} COMMAND startup_indirect_dispatch ${backend} constants) + set_tests_properties(startup_indirect_dispatch_${backend} startup_indirect_root_constants_${backend} PROPERTIES TIMEOUT 30) +endforeach() +set_tests_properties(startup_indirect_dispatch_hardware startup_indirect_root_constants_hardware PROPERTIES SKIP_RETURN_CODE 77) + +# Occlusion queries recorded through command-list slots 28 to 30 reach the readback buffer (#870). +add_executable(startup_list_queries tests/startup_list_queries.cpp tests/desktop_gpu.cpp) +target_compile_features(startup_list_queries PRIVATE cxx_std_17) +target_link_libraries(startup_list_queries PRIVATE d3d12_xs_shim d3d12 dxgi d3dcompiler) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_list_queries_${backend} COMMAND startup_list_queries ${backend}) + set_tests_properties(startup_list_queries_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) + # Negative control: without X2W_D3D12_QUERY_SLOTS=1 the slots stay no-ops and the buffer keeps its sentinel. + add_test(NAME startup_list_queries_default_${backend}_control COMMAND startup_list_queries ${backend} default) + set_tests_properties(startup_list_queries_default_${backend}_control PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77 + PASS_REGULAR_EXPRESSION "word 0: got 0xa5a5a5a5a5a5a5a5") +endforeach() + +add_executable(startup_indirect_draw_indexed tests/startup_indirect_draw_indexed.cpp tests/desktop_gpu.cpp) +target_compile_features(startup_indirect_draw_indexed PRIVATE cxx_std_17) +target_link_libraries(startup_indirect_draw_indexed PRIVATE d3d12_xs_shim d3d12 dxgi d3dcompiler) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_indirect_draw_indexed_${backend} COMMAND startup_indirect_draw_indexed ${backend}) + add_test(NAME startup_indirect_draw_${backend} COMMAND startup_indirect_draw_indexed ${backend} draw) + add_test(NAME startup_indirect_mesh_${backend} COMMAND startup_indirect_draw_indexed ${backend} mesh) + set_tests_properties(startup_indirect_draw_indexed_${backend} startup_indirect_draw_${backend} PROPERTIES TIMEOUT 30) + set_tests_properties(startup_indirect_mesh_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) +endforeach() +set_tests_properties(startup_indirect_draw_indexed_hardware startup_indirect_draw_hardware PROPERTIES SKIP_RETURN_CODE 77) + +# OMSetRenderTargets with a single descriptor range, handles that hold no view, and a cleared copied descriptor. +add_executable(startup_rtv_bind tests/startup_rtv_bind.cpp) +target_compile_features(startup_rtv_bind PRIVATE cxx_std_17) +target_link_libraries(startup_rtv_bind PRIVATE d3d12_xs_shim d3d12 dxgi) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_rtv_bind_${backend} COMMAND startup_rtv_bind ${backend}) + set_tests_properties(startup_rtv_bind_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=1") +endforeach() + add_executable(startup_nv12_draw tests/startup_nv12_draw.cpp tests/desktop_gpu.cpp) target_compile_features(startup_nv12_draw PRIVATE cxx_std_17) target_include_directories(startup_nv12_draw PRIVATE src) @@ -493,8 +994,30 @@ foreach(backend IN ITEMS warp hardware) set_tests_properties(startup_nv12_draw_${backend} PROPERTIES ENVIRONMENT "X2W_SHIM_DRAW_ADAPTER=${backend}" TIMEOUT 60 SKIP_RETURN_CODE 77) endforeach() +# The same header without a GPU (src/startup_stubs/slice_footprints.h): accepted NV12 descriptions, +# re-read intervals and size cap, the footprint request and the bytes up to the end of the last row. +# The mutated run is the negative control. +add_executable(startup_slice_footprints_check tests/startup_slice_footprints_check.cpp) +target_include_directories(startup_slice_footprints_check PRIVATE src) +target_compile_features(startup_slice_footprints_check PRIVATE cxx_std_17) +add_test(NAME startup_slice_footprints COMMAND startup_slice_footprints_check) +add_test(NAME startup_slice_footprints_padded_control COMMAND startup_slice_footprints_check --mutate padded-last-row) +set_tests_properties(startup_slice_footprints_padded_control PROPERTIES WILL_FAIL TRUE) find_program(DXC_EXECUTABLE dxc REQUIRED) +foreach(stage IN ITEMS mesh pixel) + if(stage STREQUAL mesh) + set(profile ms_6_5) + else() + set(profile ps_6_0) + endif() + set(header "${CMAKE_CURRENT_BINARY_DIR}/startup_indirect_mesh_${stage}.h") + add_custom_command(OUTPUT "${header}" COMMAND "${DXC_EXECUTABLE}" -T ${profile} -E ${stage} + -Vn startup_indirect_mesh_${stage} -Fh "${header}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_indirect_mesh.hlsl" + DEPENDS tests/startup_indirect_mesh.hlsl VERBATIM) + target_sources(startup_indirect_draw_indexed PRIVATE "${header}") +endforeach() +target_include_directories(startup_indirect_draw_indexed PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") get_filename_component(DXC_BIN_DIR "${DXC_EXECUTABLE}" DIRECTORY) target_compile_definitions(root_probe PRIVATE SDK_DXC_DIR=L"${DXC_BIN_DIR}/") add_executable(offscreen_check tests/offscreen_check.cpp tests/compute_check.cpp tests/dxr_check.cpp tests/buffer_ops.cpp @@ -535,11 +1058,22 @@ foreach(adapter IN ITEMS warp hardware) endforeach() target_compile_features(offscreen_check PRIVATE cxx_std_17) # Link the production placement index into this fixture without adding a DLL export. -target_sources(offscreen_check PRIVATE src/startup_stubs/d3d12_xs_device.cpp) set_property(SOURCE src/startup_stubs/d3d12_xs_device.cpp APPEND PROPERTY COMPILE_OPTIONS /bigobj) +set(OFFSCREEN_AGILITY_620_DIR "" CACHE PATH "Agility SDK 1.620.2 x64 DLL directory for debug validation") +# offscreen_check and cpu_placed_dxr_provider compile this file with the same flags (default CRT, the +# desktop SDK headers), so they link one object set instead of compiling the 3,400-line file twice. +# With OFFSCREEN_AGILITY_620_DIR the fixture compiles against the Agility headers instead: it keeps its +# own copy below and the provider keeps its own. d3d12_xs_shim uses the static CRT and is not shared. +if(NOT OFFSCREEN_AGILITY_620_DIR) + add_library(d3d12_xs_device_obj OBJECT src/startup_stubs/d3d12_xs_device.cpp) + target_include_directories(d3d12_xs_device_obj PRIVATE src) + target_compile_features(d3d12_xs_device_obj PRIVATE cxx_std_17) + target_sources(offscreen_check PRIVATE $) +else() + target_sources(offscreen_check PRIVATE src/startup_stubs/d3d12_xs_device.cpp) +endif() target_link_libraries(offscreen_check PRIVATE d3d12 dxgi dxguid d3dcompiler user32 gdi32) target_include_directories(offscreen_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -set(OFFSCREEN_AGILITY_620_DIR "" CACHE PATH "Agility SDK 1.620.2 x64 DLL directory for debug validation") if(OFFSCREEN_AGILITY_620_DIR) if(EXISTS "${OFFSCREEN_AGILITY_620_DIR}/sdk.nupkg") set(agility_headers "${CMAKE_CURRENT_BINARY_DIR}/agility-headers") @@ -609,12 +1143,36 @@ add_custom_command(OUTPUT "${pixel_vs_linear}" COMMAND "${DXC_EXECUTABLE}" -T vs target_sources(offscreen_check PRIVATE tests/pixel_aot_render.cpp tests/pixel_compare_render.cpp "${pixel_vs}" "${pixel_vs_linear}") target_sources(offscreen_check PRIVATE tests/desktop_gpu.cpp tests/mesh_entry_draw.cpp tests/mesh_shadow_draw.cpp) +target_sources(offscreen_check PRIVATE tests/stream_root_srv.cpp) +foreach(stage IN ITEMS vs ps) + string(TOUPPER "${stage}" entry) + set(header "${CMAKE_CURRENT_BINARY_DIR}/stream_root_srv_${stage}.h") + add_custom_command(OUTPUT "${header}" + COMMAND "${DXC_EXECUTABLE}" -T ${stage}_6_0 -E ${entry}Main -Vn stream_root_srv_${stage} + -Fh "${header}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/stream_root_srv.hlsl" + DEPENDS tests/stream_root_srv.hlsl VERBATIM) + target_sources(offscreen_check PRIVATE "${header}") +endforeach() set(descriptor_window_cs "${CMAKE_CURRENT_BINARY_DIR}/descriptor_window_submissions_cs.h") add_custom_command(OUTPUT "${descriptor_window_cs}" COMMAND "${DXC_EXECUTABLE}" -T cs_6_0 -E main -Vn descriptor_window_submissions_cs -Fh "${descriptor_window_cs}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/descriptor_window_submissions.hlsl" DEPENDS tests/descriptor_window_submissions.hlsl VERBATIM) target_sources(offscreen_check PRIVATE tests/descriptor_window_submissions.cpp "${descriptor_window_cs}") +set(cpu_srv_cs "${CMAKE_CURRENT_BINARY_DIR}/cpu_srv_refresh_cs.h") +add_custom_command(OUTPUT "${cpu_srv_cs}" COMMAND "${DXC_EXECUTABLE}" -T cs_6_0 -E main + -Vn cpu_srv_refresh_cs -Fh "${cpu_srv_cs}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/cpu_srv_refresh.hlsl" + DEPENDS tests/cpu_srv_refresh.hlsl VERBATIM) +target_sources(offscreen_check PRIVATE "${cpu_srv_cs}") +# Argument, resource, fence and partial-read refusals and the Map/Unmap ranges of cpu_srv::refresh +# (src/cpu_srv_upload.h), with a fake upload buffer and fence instead of a device. The mutated run +# is the negative control. +add_executable(cpu_srv_upload_check tests/cpu_srv_upload_check.cpp) +target_include_directories(cpu_srv_upload_check PRIVATE src) +target_compile_features(cpu_srv_upload_check PRIVATE cxx_std_17) +add_test(NAME cpu_srv_upload COMMAND cpu_srv_upload_check) +add_test(NAME cpu_srv_upload_written_range_control COMMAND cpu_srv_upload_check --mutate written-range) +set_tests_properties(cpu_srv_upload_written_range_control PROPERTIES WILL_FAIL TRUE) set(startup_sampler_x_cs "${CMAKE_CURRENT_BINARY_DIR}/startup_sampler_x_cs.h") add_custom_command(OUTPUT "${startup_sampler_x_cs}" COMMAND "${DXC_EXECUTABLE}" -T cs_6_0 -E main -Vn startup_sampler_x_cs -Fh "${startup_sampler_x_cs}" @@ -622,13 +1180,79 @@ add_custom_command(OUTPUT "${startup_sampler_x_cs}" COMMAND "${DXC_EXECUTABLE}" DEPENDS tests/startup_sampler_x.hlsl VERBATIM) target_sources(offscreen_check PRIVATE tests/startup_sampler_x.cpp "${startup_sampler_x_cs}") target_sources(offscreen_check PRIVATE tests/startup_sampler_heap.cpp) +# Sampler word decoding, manifest lines and title sampler snapshots behind those draws +# (src/startup_stubs/translated_sampler_bindings.h), without a device. The mutated run is the negative control. +add_executable(startup_translated_sampler_bindings_check tests/startup_translated_sampler_bindings_check.cpp) +target_include_directories(startup_translated_sampler_bindings_check PRIVATE src) +target_compile_features(startup_translated_sampler_bindings_check PRIVATE cxx_std_17) +add_test(NAME startup_translated_sampler_bindings COMMAND startup_translated_sampler_bindings_check) +add_test(NAME startup_translated_sampler_bindings_shared_axis_control + COMMAND startup_translated_sampler_bindings_check --mutate shared-axis) +set_tests_properties(startup_translated_sampler_bindings_shared_axis_control PROPERTIES WILL_FAIL TRUE) +# Real-draw decision for title root signatures that index descriptor heaps directly +# (src/startup_stubs/heap_indexed_root.h), without a device. The mutated runs are the negative controls. +add_executable(startup_heap_indexed_root_check tests/startup_heap_indexed_root_check.cpp) +target_include_directories(startup_heap_indexed_root_check PRIVATE src) +target_compile_features(startup_heap_indexed_root_check PRIVATE cxx_std_17) +add_test(NAME startup_heap_indexed_root COMMAND startup_heap_indexed_root_check) +foreach(mutation IN ITEMS sampler-alone bind-unrestorable) + add_test(NAME startup_heap_indexed_root_${mutation}_control COMMAND startup_heap_indexed_root_check --mutate ${mutation}) + set_tests_properties(startup_heap_indexed_root_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() target_sources(offscreen_check PRIVATE tests/startup_image_3d.cpp) target_sources(offscreen_check PRIVATE tests/startup_flat_param.cpp) +# The storage root handed to the executable ends in a separator and is never cut off +# (src/startup_stubs/storage_root.h); the mutated run is the negative control. +add_executable(startup_storage_root_check tests/startup_storage_root_check.cpp) +target_include_directories(startup_storage_root_check PRIVATE src) +target_compile_features(startup_storage_root_check PRIVATE cxx_std_17) +add_test(NAME startup_storage_root COMMAND startup_storage_root_check) +add_test(NAME startup_storage_root_separator_control COMMAND startup_storage_root_check --mutate separator) +set_tests_properties(startup_storage_root_separator_control PROPERTIES WILL_FAIL TRUE) # Stand-in format for 16-bit packed targets the adapter cannot use (src/startup_stubs/packed_target_format.h). add_executable(startup_packed_target_check tests/startup_packed_target_check.cpp) target_include_directories(startup_packed_target_check PRIVATE src) target_compile_features(startup_packed_target_check PRIVATE cxx_std_17) add_test(NAME startup_packed_target COMMAND startup_packed_target_check) +foreach(mutation IN ITEMS stand-in array b565 view tag) + add_test(NAME startup_packed_target_${mutation}_control COMMAND startup_packed_target_check --mutate ${mutation}) + set_tests_properties(startup_packed_target_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() +# Static samplers built from smp and smpc manifest lines (src/startup_stubs/translated_sampler_bindings.h). +add_executable(startup_sampler_comparison_check tests/startup_sampler_comparison_check.cpp) +target_include_directories(startup_sampler_comparison_check PRIVATE src) +target_compile_features(startup_sampler_comparison_check PRIVATE cxx_std_17) +add_test(NAME startup_sampler_comparison COMMAND startup_sampler_comparison_check) +# Diagnostic line for a refused device slot 70 call (src/startup_stubs/memory_srv_report.h). +add_executable(startup_memory_srv_report_check tests/startup_memory_srv_report_check.cpp) +target_include_directories(startup_memory_srv_report_check PRIVATE src) +target_compile_features(startup_memory_srv_report_check PRIVATE cxx_std_17) +add_test(NAME startup_memory_srv_report COMMAND startup_memory_srv_report_check) + +# View format of the window presenter's read of typeless textures (src/startup_stubs/present_view_format.h); +# the identity run is the old behaviour and the sRGB run is a wrong view; both are negative controls. +add_executable(startup_present_view_check tests/startup_present_view_check.cpp) +target_include_directories(startup_present_view_check PRIVATE src) +target_compile_features(startup_present_view_check PRIVATE cxx_std_17) +target_link_libraries(startup_present_view_check PRIVATE d3d12 dxgi d3dcompiler) +add_test(NAME startup_present_view COMMAND startup_present_view_check) +add_test(NAME startup_present_view_identity_control COMMAND startup_present_view_check --mutate identity) +foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_present_view_${adapter} COMMAND startup_present_view_check ${adapter}) +endforeach() +add_test(NAME startup_present_view_srgb_control COMMAND startup_present_view_check warp --mutate srgb) +set_tests_properties(startup_present_view_identity_control startup_present_view_srgb_control PROPERTIES WILL_FAIL TRUE) +set_tests_properties(startup_present_view_hardware PROPERTIES SKIP_RETURN_CODE 77) +# Buffer memory SRV validation for device slot 70 (src/startup_stubs/memory_srv_buffer.h); the mutated +# runs are negative controls. +add_executable(startup_memory_srv_buffer_check tests/startup_memory_srv_buffer_check.cpp) +target_include_directories(startup_memory_srv_buffer_check PRIVATE src) +target_compile_features(startup_memory_srv_buffer_check PRIVATE cxx_std_17) +add_test(NAME startup_memory_srv_buffer COMMAND startup_memory_srv_buffer_check) +foreach(mutation IN ITEMS height exact-fit first-32) + add_test(NAME startup_memory_srv_buffer_${mutation}_control COMMAND startup_memory_srv_buffer_check --mutate ${mutation}) + set_tests_properties(startup_memory_srv_buffer_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() # Console allocation sizes for depth-with-stencil and multisampled textures # (src/startup_stubs/console_plane_size.h); the mutated run is the negative control. add_executable(startup_plane_size_check tests/startup_plane_size_check.cpp) @@ -637,6 +1261,51 @@ target_compile_features(startup_plane_size_check PRIVATE cxx_std_17) add_test(NAME startup_plane_size COMMAND startup_plane_size_check) add_test(NAME startup_plane_size_packed_control COMMAND startup_plane_size_check --mutate packed) set_tests_properties(startup_plane_size_packed_control PROPERTIES WILL_FAIL TRUE) +# Device slot 41: the indirect argument types desktop D3D12 cannot create +# (src/startup_stubs/command_signature_filter.h); the mutated runs are negative controls. +add_executable(startup_command_signature_filter_check tests/startup_command_signature_filter_check.cpp) +target_include_directories(startup_command_signature_filter_check PRIVATE src) +target_compile_features(startup_command_signature_filter_check PRIVATE cxx_std_17) +add_test(NAME startup_command_signature_filter COMMAND startup_command_signature_filter_check) +foreach(mutation IN ITEMS off-by-one first-only) + add_test(NAME startup_command_signature_filter_${mutation}_control COMMAND startup_command_signature_filter_check --mutate ${mutation}) + set_tests_properties(startup_command_signature_filter_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() +# Device slot 41 through the startup device wrapper with the debug layer on: a desktop-valid argument +# list is created, a console type gets the placeholder, and the debug layer reports no error for either. +add_executable(startup_command_signature tests/startup_command_signature.cpp) +target_compile_features(startup_command_signature PRIVATE cxx_std_17) +target_link_libraries(startup_command_signature PRIVATE d3d12_xs_shim d3d12 dxgi) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_command_signature_${backend} COMMAND startup_command_signature ${backend}) + set_tests_properties(startup_command_signature_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_DEBUG=1") +endforeach() +# GameInput stand-in timestamps: a performance-counter reading in microseconds without a product +# that wraps (src/startup_stubs/qpc_microseconds.h); the mutated run is the negative control. +add_executable(startup_qpc_microseconds_check tests/startup_qpc_microseconds_check.cpp) +target_include_directories(startup_qpc_microseconds_check PRIVATE src) +target_compile_features(startup_qpc_microseconds_check PRIVATE cxx_std_17) +add_test(NAME startup_qpc_microseconds COMMAND startup_qpc_microseconds_check) +add_test(NAME startup_qpc_microseconds_product_control COMMAND startup_qpc_microseconds_check --mutate product) +set_tests_properties(startup_qpc_microseconds_product_control PROPERTIES WILL_FAIL TRUE) +# XGameSaveReadBlobData caller-buffer layout and size-overflow/uint32_t guards +# (src/startup_stubs/save_blob_pack.h); the mutated run is the negative control. +add_executable(startup_save_blob_pack_check tests/startup_save_blob_pack_check.cpp) +target_include_directories(startup_save_blob_pack_check PRIVATE src) +target_compile_features(startup_save_blob_pack_check PRIVATE cxx_std_17) +add_test(NAME startup_save_blob_pack COMMAND startup_save_blob_pack_check) +add_test(NAME startup_save_blob_pack_legacy_size_control COMMAND startup_save_blob_pack_check --mutate legacy-size) +set_tests_properties(startup_save_blob_pack_legacy_size_control PROPERTIES WILL_FAIL TRUE) +# The blend patch a slot 55 derivation applies (src/startup_stubs/derived_blend.h): the last part-2 +# record, its descriptor offset and bytes, and lists that are not whole records. The mutated run is +# the negative control. +add_executable(startup_derived_blend_check tests/startup_derived_blend_check.cpp) +target_include_directories(startup_derived_blend_check PRIVATE src) +target_compile_features(startup_derived_blend_check PRIVATE cxx_std_17) +add_test(NAME startup_derived_blend COMMAND startup_derived_blend_check) +add_test(NAME startup_derived_blend_first_wins_control COMMAND startup_derived_blend_check --mutate first-wins) +set_tests_properties(startup_derived_blend_first_wins_control PROPERTIES WILL_FAIL TRUE) # The same rule through the device wrapper: allocation-info slots 25 and 108, then a placed texture # (slot 133) over memory of the answered size. add_executable(startup_plane_size_device_check tests/startup_plane_size_device_check.cpp) @@ -646,6 +1315,26 @@ foreach(adapter IN ITEMS warp hardware) add_test(NAME startup_plane_size_device_${adapter} COMMAND startup_plane_size_device_check ${adapter}) endforeach() set_tests_properties(startup_plane_size_device_hardware PROPERTIES SKIP_RETURN_CODE 77) +# Committed buffers through the device wrapper (slot 127) on the default, upload and readback heaps: +# upload and readback must start in GENERIC_READ and COPY_DEST, which the Windows 10 runtime enforces. +# The mutated run asks for a 2D texture on an upload heap, which no runtime creates (negative control). +add_executable(startup_committed_heap_state_check tests/startup_committed_heap_state_check.cpp) +target_compile_features(startup_committed_heap_state_check PRIVATE cxx_std_17) +target_link_libraries(startup_committed_heap_state_check PRIVATE d3d12_xs_shim d3d12 dxgi) +foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_committed_heap_state_${adapter} COMMAND startup_committed_heap_state_check ${adapter}) +endforeach() +add_test(NAME startup_committed_heap_state_upload_texture_control COMMAND startup_committed_heap_state_check warp --mutate upload-texture) +set_tests_properties(startup_committed_heap_state_hardware PROPERTIES SKIP_RETURN_CODE 77) +set_tests_properties(startup_committed_heap_state_upload_texture_control PROPERTIES WILL_FAIL TRUE) +# Opt-in BC7 4 KiB standard surfaces (src/startup_stubs/bc7_4k_s.h): accepted descriptions, padded +# sizes, block order and detile; the mutated run (x-first bit order) is the negative control. +add_executable(startup_bc7_4k_s_check tests/startup_bc7_4k_s_check.cpp) +target_include_directories(startup_bc7_4k_s_check PRIVATE src) +target_compile_features(startup_bc7_4k_s_check PRIVATE cxx_std_17) +add_test(NAME startup_bc7_4k_s COMMAND startup_bc7_4k_s_check) +add_test(NAME startup_bc7_4k_s_x_first_control COMMAND startup_bc7_4k_s_check --mutate x-first) +set_tests_properties(startup_bc7_4k_s_x_first_control PROPERTIES WILL_FAIL TRUE) # Descriptor heaps whose desktop CPU start is not an address get plain memory as the start the # executable sees (src/startup_stubs/title_heap_memory.h); the mutated run is the negative control. add_executable(startup_title_heap_check tests/startup_title_heap_check.cpp) @@ -663,6 +1352,57 @@ add_executable(startup_state_block_blend_check tests/startup_state_block_blend_c target_include_directories(startup_state_block_blend_check PRIVATE src) target_compile_features(startup_state_block_blend_check PRIVATE cxx_std_17) add_test(NAME startup_state_block_blend COMMAND startup_state_block_blend_check) +# Depth-stencil state of slot 57 pipelines from state block A (src/startup_stubs/pipeline_state_decode.h, +# #1999): hand-built register words and a synthetic block. The mutated run (words one word later) is the +# negative control. +add_executable(startup_pipeline_state_check tests/startup_pipeline_state_check.cpp) +target_include_directories(startup_pipeline_state_check PRIVATE src) +target_compile_features(startup_pipeline_state_check PRIVATE cxx_std_17) +add_test(NAME startup_pipeline_state COMMAND startup_pipeline_state_check) +add_test(NAME startup_pipeline_state_offset_control COMMAND startup_pipeline_state_check --mutate offset) +set_tests_properties(startup_pipeline_state_offset_control PROPERTIES WILL_FAIL TRUE) +# Root table handles resolved against a logical view heap, and the records a translated draw reads +# from the window (src/startup_stubs/logical_view_table.h). +add_executable(startup_logical_view_table_check tests/startup_logical_view_table_check.cpp) +target_include_directories(startup_logical_view_table_check PRIVATE src) +target_compile_features(startup_logical_view_table_check PRIVATE cxx_std_17) +add_test(NAME startup_logical_view_table COMMAND startup_logical_view_table_check) +# Local switch, logging, and page-probe helpers (src/startup_stubs/local_log.h, #1149). +add_executable(startup_local_log_check tests/startup_local_log_check.cpp) +target_include_directories(startup_local_log_check PRIVATE src) +target_compile_features(startup_local_log_check PRIVATE cxx_std_17) +add_test(NAME startup_local_log COMMAND startup_local_log_check) +add_test(NAME startup_local_log_guard_drop_control COMMAND startup_local_log_check --mutate guard-drop) +set_tests_properties(startup_local_log_guard_drop_control PROPERTIES WILL_FAIL TRUE) +add_test(NAME startup_local_log_reopen_control COMMAND startup_local_log_check --mutate reopen) +set_tests_properties(startup_local_log_reopen_control PROPERTIES WILL_FAIL TRUE) +# Negative control: the same check built against a generated copy of trap.h whose append_log keeps a +# failed open forever. Only the two open-failure recovery cases may fail; the copy exists only in +# the test build. +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/startup_stubs/trap.h" trap_log_text) +string(REPLACE "now + log_retry_ms)); // x2w-seam: failed-open" "~0ull >> 1));" trap_log_cache_text "${trap_log_text}") +if(trap_log_cache_text STREQUAL trap_log_text) + message(FATAL_ERROR "trap.h lost the failed-open anchor used by startup_local_log_cache_failure_control") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/trap_log_cache_failure/startup_stubs/trap.h" "${trap_log_cache_text}") +add_executable(startup_local_log_cache_failure_check tests/startup_local_log_check.cpp) +target_include_directories(startup_local_log_cache_failure_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/trap_log_cache_failure" src) +target_compile_features(startup_local_log_cache_failure_check PRIVATE cxx_std_17) +add_test(NAME startup_local_log_cache_failure_control COMMAND startup_local_log_cache_failure_check --mutate cache-failure) +set_tests_properties(startup_local_log_cache_failure_control PROPERTIES WILL_FAIL TRUE) +# The counting gate the stand-ins used before must let calls through again at the wrap point. +add_test(NAME startup_local_log_wrap_control COMMAND startup_local_log_check --mutate wrap) +set_tests_properties(startup_local_log_wrap_control PROPERTIES + PASS_REGULAR_EXPRESSION "FAIL first_calls passes no call at the wrap point") +# Trap-by-default export macros and env switches (src/startup_stubs/trap.h, #1149). +add_executable(startup_trap_header_check tests/startup_trap_header_check.cpp) +target_include_directories(startup_trap_header_check PRIVATE src) +target_compile_features(startup_trap_header_check PRIVATE cxx_std_17) +add_test(NAME startup_trap_header COMMAND startup_trap_header_check) +add_test(NAME startup_trap_header_prefix_control COMMAND startup_trap_header_check --mutate prefix-match) +add_test(NAME startup_trap_header_precedence_control COMMAND startup_trap_header_check --mutate fail-first) +set_tests_properties(startup_trap_header_prefix_control startup_trap_header_precedence_control + PROPERTIES WILL_FAIL TRUE) # Colour-blend register decoding (src/startup_stubs/cb_blend.h, #1216): decoder table plus draws # compared with a CPU model of the register fields. @@ -675,6 +1415,51 @@ add_custom_command(OUTPUT "${startup_cb_blend_ps}" COMMAND "${DXC_EXECUTABLE}" - -Vn startup_cb_blend_ps -Fh "${startup_cb_blend_ps}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_cb_blend.hlsl" DEPENDS tests/startup_cb_blend.hlsl VERBATIM) target_sources(offscreen_check PRIVATE tests/startup_cb_blend.cpp "${startup_cb_blend_vs}" "${startup_cb_blend_ps}") +# The same decoder without a device (#1149): each factor value in each of the four factor slots, +# colour and alpha combine functions apart, refusal reasons, MIN / MAX per slot, the write mask and +# control_word. The mutated run (destination alpha left in its colour form) is the negative control. +add_executable(startup_cb_blend_check tests/startup_cb_blend_check.cpp) +target_include_directories(startup_cb_blend_check PRIVATE src) +target_compile_features(startup_cb_blend_check PRIVATE cxx_std_17) +add_test(NAME startup_cb_blend_decode COMMAND startup_cb_blend_check) +add_test(NAME startup_cb_blend_decode_dest_alpha_control COMMAND startup_cb_blend_check --mutate dest-alpha-colour) +set_tests_properties(startup_cb_blend_decode_dest_alpha_control PROPERTIES WILL_FAIL TRUE) +# Export write masks from a translated manifest (#1674), without a device. The mutated run applies the +# masks to a shared blend state without expanding it, so a mask on target 1 is lost. +add_executable(startup_export_write_mask_check tests/startup_export_write_mask_check.cpp) +target_include_directories(startup_export_write_mask_check PRIVATE src) +target_compile_features(startup_export_write_mask_check PRIVATE cxx_std_17) +add_test(NAME startup_export_write_mask COMMAND startup_export_write_mask_check) +add_test(NAME startup_export_write_mask_shared_blend_control COMMAND startup_export_write_mask_check --mutate shared-blend) +set_tests_properties(startup_export_write_mask_shared_blend_control PROPERTIES WILL_FAIL TRUE) +# Composite provenance (#1628): one VS and two pixel shaders from one HLSL file. +set(startup_composite_provenance_headers "") +foreach(stage IN ITEMS "vs_6_0;vs_main;vs" "ps_6_0;ps_fill;fill" "ps_6_0;ps_composite;composite") + list(GET stage 0 profile) + list(GET stage 1 entry) + list(GET stage 2 suffix) + set(header "${CMAKE_CURRENT_BINARY_DIR}/startup_composite_provenance_${suffix}.h") + add_custom_command(OUTPUT "${header}" COMMAND "${DXC_EXECUTABLE}" -T ${profile} -E ${entry} + -Vn startup_composite_provenance_${suffix} -Fh "${header}" + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_composite_provenance.hlsl" + DEPENDS tests/startup_composite_provenance.hlsl VERBATIM) + list(APPEND startup_composite_provenance_headers "${header}") +endforeach() +target_sources(offscreen_check PRIVATE tests/startup_composite_provenance.cpp ${startup_composite_provenance_headers}) +# Range provenance (#870): one VS, one consumer and one producer pixel shader from one HLSL file. +set(startup_range_provenance_headers "") +foreach(stage IN ITEMS "vs_6_0;vs_main;vs" "ps_6_0;ps_read;read" "ps_6_0;ps_write;write") + list(GET stage 0 profile) + list(GET stage 1 entry) + list(GET stage 2 suffix) + set(header "${CMAKE_CURRENT_BINARY_DIR}/startup_range_provenance_${suffix}.h") + add_custom_command(OUTPUT "${header}" COMMAND "${DXC_EXECUTABLE}" -T ${profile} -E ${entry} + -Vn startup_range_provenance_${suffix} -Fh "${header}" + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_range_provenance.hlsl" + DEPENDS tests/startup_range_provenance.hlsl VERBATIM) + list(APPEND startup_range_provenance_headers "${header}") +endforeach() +target_sources(offscreen_check PRIVATE tests/startup_range_provenance.cpp ${startup_range_provenance_headers}) target_sources(offscreen_check PRIVATE tests/binding_mips.cpp tests/ffx_recurrent_views.cpp) target_sources(offscreen_check PRIVATE tests/ffx_rcas_views.cpp) foreach(storage IN ITEMS Native Packed) @@ -701,6 +1486,29 @@ target_sources(offscreen_check PRIVATE tests/bvh_reads_waves.cpp tests/bvh_hits. target_sources(offscreen_check PRIVATE tests/bvh_atomics.cpp tests/bvh_numeric.cpp) # A title graphics allocation opened as a D3D12 heap and addressed through translated GPU addresses. target_sources(offscreen_check PRIVATE tests/gpu_alias.cpp src/era_gpu_alias.cpp src/era_title_va.cpp src/era_heap.cpp) +# The same open without a GPU: spans it must refuse before calling D3D12, and spans that must reach +# the device, against a recording fake device. The control builds a generated copy of +# era_gpu_alias.cpp that no longer compares the allocation base, which the interior pointer must catch. +add_executable(era_gpu_alias_check tests/era_gpu_alias_check.cpp tests/era_gpu_alias_fake_device.cpp + src/era_gpu_alias.cpp) +target_include_directories(era_gpu_alias_check PRIVATE src tests) +target_compile_features(era_gpu_alias_check PRIVATE cxx_std_17) +add_test(NAME era_gpu_alias_open COMMAND era_gpu_alias_check) +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS src/era_gpu_alias.cpp) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/era_gpu_alias.cpp" gpu_alias_text) +string(FIND "${gpu_alias_text}" "info.AllocationBase != base || " gpu_alias_anchor) +if(gpu_alias_anchor LESS 0) + message(FATAL_ERROR "era_gpu_alias.cpp lost the anchor used by era_gpu_alias_open_base_control") +endif() +string(REPLACE "info.AllocationBase != base || " "" gpu_alias_text "${gpu_alias_text}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gpu_alias_base_control/era_gpu_alias.cpp" "${gpu_alias_text}") +add_executable(era_gpu_alias_base_control_check tests/era_gpu_alias_check.cpp tests/era_gpu_alias_fake_device.cpp + "${CMAKE_CURRENT_BINARY_DIR}/gpu_alias_base_control/era_gpu_alias.cpp") +target_include_directories(era_gpu_alias_base_control_check PRIVATE src tests) +target_compile_features(era_gpu_alias_base_control_check PRIVATE cxx_std_17) +add_test(NAME era_gpu_alias_open_base_control COMMAND era_gpu_alias_base_control_check) +set_tests_properties(era_gpu_alias_open_base_control PROPERTIES PASS_REGULAR_EXPRESSION + "FAIL: interior pointer: passed to D3D12") # A title buffer window: two 64 KiB pages, a non-page-aligned offset, copies in both directions and # named rejects for an outside address, a misaligned page run and an uncommitted page. target_sources(offscreen_check PRIVATE tests/gpu_alias_window.cpp) @@ -921,7 +1729,12 @@ add_custom_command(OUTPUT "${d3d12x_pso_header}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/d3d12x_pso.hlsl" DEPENDS tests/d3d12x_pso.hlsl BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/d3d12x_pso_cs.cso" VERBATIM) -add_executable(d3d12x_device_check tests/d3d12x_device_check.cpp src/d3d12x_struct_return.cpp "${d3d12x_pso_header}") +# tests/d3d12x_device_check.cpp is compiled once for the check and its struct-return control (same flags, +# same include directories in the same order). +add_library(d3d12x_device_check_obj OBJECT tests/d3d12x_device_check.cpp "${d3d12x_pso_header}") +target_include_directories(d3d12x_device_check_obj PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" src) +target_compile_features(d3d12x_device_check_obj PRIVATE cxx_std_17) +add_executable(d3d12x_device_check $ src/d3d12x_struct_return.cpp "${d3d12x_pso_header}") add_dependencies(d3d12x_device_check d3d12_xs_shim) target_include_directories(d3d12x_device_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_compile_features(d3d12x_device_check PRIVATE cxx_std_17) @@ -940,6 +1753,27 @@ set_tests_properties(d3d12x_device_create_hardware d3d12x_device_negative_hardwa SKIP_RETURN_CODE 77) set_tests_properties(d3d12x_device_negative_warp d3d12x_device_negative_hardware PROPERTIES PASS_REGULAR_EXPRESSION "D3D12XboxCreateDevice: unsupported IID \\{7c0e1a10-5f2d-4b7a-9a51-3d9c6b2e8f01\\}") +# Negative control for the struct-return rejection cases: a build-tree copy of the adapter that +# writes through the second candidate when neither candidate is the device. +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS src/d3d12x_struct_return.cpp) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/d3d12x_struct_return.cpp" d3d12x_struct_return_text) +string(REGEX REPLACE "} else {(\r?\n +)return nullptr;" "} else {\\1output = second;" + d3d12x_struct_return_control_text "${d3d12x_struct_return_text}") +if(d3d12x_struct_return_control_text STREQUAL d3d12x_struct_return_text) + message(FATAL_ERROR "d3d12x_struct_return.cpp lost the anchor used by d3d12x_device_struct_return_neither_control") +endif() +set(d3d12x_struct_return_control "${CMAKE_CURRENT_BINARY_DIR}/d3d12x_struct_return_control/d3d12x_struct_return.cpp") +file(WRITE "${d3d12x_struct_return_control}" "${d3d12x_struct_return_control_text}") +add_executable(d3d12x_device_struct_return_control $ + "${d3d12x_struct_return_control}" "${d3d12x_pso_header}") +add_dependencies(d3d12x_device_struct_return_control d3d12_xs_shim) +target_include_directories(d3d12x_device_struct_return_control PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" src) +target_compile_features(d3d12x_device_struct_return_control PRIVATE cxx_std_17) +target_link_libraries(d3d12x_device_struct_return_control PRIVATE d3d12 dxgi) +add_test(NAME d3d12x_device_struct_return_neither_control_warp COMMAND d3d12x_device_struct_return_control + "$" struct-return warp) +set_tests_properties(d3d12x_device_struct_return_neither_control_warp PROPERTIES + PASS_REGULAR_EXPRESSION "FAIL: struct_return reject neither_is_device: returned ") # Static-sampler root signature and compute PSO through D3D12XboxCreateDevice (#XCL-19). foreach(adapter IN ITEMS warp hardware) add_test(NAME d3d12x_pso_static_sampler_${adapter} COMMAND d3d12x_device_check @@ -984,8 +1818,12 @@ add_custom_command(OUTPUT "${d3d12x_compute_list_cs}" DEPENDS tests/d3d12x_compute_list.hlsl BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/d3d12x_compute_list_cs.cso" VERBATIM) add_custom_target(d3d12x_compute_list_shader DEPENDS "${d3d12x_compute_list_cs}") +# tests/desktop_gpu.cpp again, with the include directory these two checks use. +add_library(d3d12x_desktop_gpu_obj OBJECT tests/desktop_gpu.cpp) +target_include_directories(d3d12x_desktop_gpu_obj PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +target_compile_features(d3d12x_desktop_gpu_obj PRIVATE cxx_std_17) add_executable(d3d12x_compute_list_check tests/d3d12x_compute_list_check.cpp - tests/desktop_gpu.cpp "${d3d12x_compute_list_cs}") + $ "${d3d12x_compute_list_cs}") add_dependencies(d3d12x_compute_list_check d3d12_xs_shim d3d12x_compute_list_shader) target_include_directories(d3d12x_compute_list_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_compile_features(d3d12x_compute_list_check PRIVATE cxx_std_17) @@ -1012,7 +1850,7 @@ endforeach() add_custom_target(d3d12x_graphics_shader DEPENDS "${d3d12x_graphics_vs}" "${d3d12x_graphics_ps}") -add_executable(d3d12x_graphics_list_check tests/d3d12x_graphics_list_check.cpp tests/desktop_gpu.cpp +add_executable(d3d12x_graphics_list_check tests/d3d12x_graphics_list_check.cpp $ "${d3d12x_graphics_vs}" "${d3d12x_graphics_ps}") add_dependencies(d3d12x_graphics_list_check d3d12_xs_shim d3d12x_graphics_shader) target_include_directories(d3d12x_graphics_list_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") @@ -1041,6 +1879,31 @@ foreach(adapter IN ITEMS warp hardware) set_tests_properties(vm_translation_${scenario}_${adapter} PROPERTIES TIMEOUT 45 SKIP_RETURN_CODE 77) endforeach() endforeach() +# One linear CPU-written, GPU-read buffer of title-style memory through real sharing, forced copying +# and forced sharing failure (#1914). Test-only. Each mutated run removes one guarantee (submit-time +# refresh, copy-back after the fence, fence-gated reuse) and must fail every case it protects. +add_executable(unified_buffer_paths_check tests/unified_buffer_paths_check.cpp "${vm_translation_header}") +target_include_directories(unified_buffer_paths_check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" tests) +target_compile_features(unified_buffer_paths_check PRIVATE cxx_std_17) +target_link_libraries(unified_buffer_paths_check PRIVATE d3d12 dxgi OneCore) +foreach(adapter IN ITEMS warp hardware) + add_test(NAME unified_buffer_paths_${adapter} COMMAND unified_buffer_paths_check ${adapter}) + set_tests_properties(unified_buffer_paths_${adapter} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) +endforeach() +foreach(mutant IN ITEMS skip_refresh skip_copy_back reuse_early) + string(REPLACE "_" "-" flag "${mutant}") + add_test(NAME unified_buffer_paths_${mutant}_control COMMAND unified_buffer_paths_check --mutate ${flag} warp) + set_tests_properties(unified_buffer_paths_${mutant}_control PROPERTIES WILL_FAIL TRUE TIMEOUT 90 + SKIP_RETURN_CODE 77) +endforeach() +# The configured range's windows and GPU addresses (src/d3d12_xs_range.h) with a fake device and fake +# windows. The mutated run is the negative control. +add_executable(d3d12_xs_range_check tests/d3d12_xs_range_check.cpp src/d3d12_xs_range.cpp) +target_include_directories(d3d12_xs_range_check PRIVATE src) +target_compile_features(d3d12_xs_range_check PRIVATE cxx_std_17) +add_test(NAME d3d12_xs_range COMMAND d3d12_xs_range_check) +add_test(NAME d3d12_xs_range_full_last_window_control COMMAND d3d12_xs_range_check --mutate full_last_window) +set_tests_properties(d3d12_xs_range_full_last_window_control PROPERTIES WILL_FAIL TRUE) # XG-style swizzle selection compared with AMD addrlib (#870). addrlib is an optional local dependency # fetched by tools/fetch_addrlib.py into out/deps/mesa (Mesa 25.1.0, src/amd/addrlib, MIT); without it the # test skips (77). The source list and definitions follow Mesa's src/amd/addrlib/meson.build. @@ -1076,6 +1939,24 @@ else() endif() add_test(NAME xg_bc64_tiling_reference COMMAND xg_swizzle_select_check --bc64-tiling) set_tests_properties(xg_bc64_tiling_reference PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) +# Which descriptions take the 64 KiB standard BC chain (src/startup_stubs/bc64_chain.h), without addrlib +# or a device. The mutated run expects layout UNKNOWN to be accepted and is the negative control. +add_executable(startup_bc64_supports_check tests/startup_bc64_supports_check.cpp) +target_compile_features(startup_bc64_supports_check PRIVATE cxx_std_17) +target_include_directories(startup_bc64_supports_check PRIVATE src) +add_test(NAME startup_bc64_supports COMMAND startup_bc64_supports_check) +add_test(NAME startup_bc64_supports_layout_control COMMAND startup_bc64_supports_check --mutate layout) +set_tests_properties(startup_bc64_supports_layout_control PROPERTIES WILL_FAIL TRUE) +# Slot-10 tile plan for layout 0x10a (src/startup_stubs/tile64_plan.h) without a device: tile shapes, +# accepted descriptions and hand-worked plans. The mutated runs are negative controls. +add_executable(startup_tile64_plan_check tests/startup_tile64_plan_check.cpp) +target_compile_features(startup_tile64_plan_check PRIVATE cxx_std_17) +target_include_directories(startup_tile64_plan_check PRIVATE src) +add_test(NAME startup_tile64_plan COMMAND startup_tile64_plan_check) +foreach(mutation IN ITEMS bc4 width clamp) + add_test(NAME startup_tile64_plan_${mutation}_control COMMAND startup_tile64_plan_check --mutate ${mutation}) + set_tests_properties(startup_tile64_plan_${mutation}_control PROPERTIES WILL_FAIL TRUE) +endforeach() add_test(NAME xg_swizzle_select COMMAND xg_swizzle_select_check) set_tests_properties(xg_swizzle_select PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) # Mutation control: the same comparison must identify all nine mismatches. @@ -1090,7 +1971,13 @@ foreach(adapter IN ITEMS hardware warp) add_test(NAME ffx_device_init_${adapter} COMMAND offscreen_check ${adapter} --ffx-device-init) add_test(NAME ffx_recurrent_${adapter} COMMAND offscreen_check ${adapter} --ffx-recurrent) add_test(NAME dual_uav_${adapter} COMMAND offscreen_check ${adapter} --dual-uav) + add_test(NAME stream_root_srv_${adapter} COMMAND offscreen_check ${adapter} --stream-root-srv) + set_tests_properties(stream_root_srv_${adapter} PROPERTIES TIMEOUT 45 SKIP_RETURN_CODE 77) add_test(NAME descriptor_window_submissions_${adapter} COMMAND offscreen_check ${adapter} --descriptor-window-submissions) + foreach(mode IN ITEMS refresh stale) + add_test(NAME cpu_srv_${mode}_${adapter} COMMAND offscreen_check ${adapter} --cpu-srv-${mode}) + set_tests_properties(cpu_srv_${mode}_${adapter} PROPERTIES TIMEOUT 45 SKIP_RETURN_CODE 77) + endforeach() add_test(NAME descriptor_window_stale_${adapter} COMMAND offscreen_check ${adapter} --descriptor-window-stale) set_tests_properties(descriptor_window_submissions_${adapter} descriptor_window_stale_${adapter} PROPERTIES TIMEOUT 45 SKIP_RETURN_CODE 77) @@ -1149,6 +2036,7 @@ foreach(adapter IN ITEMS hardware warp) set_tests_properties(dxr_query_${adapter} dxr_pipeline_${adapter} PROPERTIES TIMEOUT 45 SKIP_RETURN_CODE 77) set_tests_properties(offscreen_${adapter} PROPERTIES TIMEOUT 45) endforeach() +set_tests_properties(wave64_emulate_hardware PROPERTIES SKIP_RETURN_CODE 77) set_tests_properties(offscreen_hardware ffx_device_init_hardware ffx_recurrent_hardware ffx_provider_loop_hardware PROPERTIES SKIP_RETURN_CODE 77) set_tests_properties(dual_uav_hardware texture_mips_hardware PROPERTIES SKIP_RETURN_CODE 77) set_tests_properties(bvh_root_roundtrip_hardware PROPERTIES SKIP_RETURN_CODE 77) @@ -1216,8 +2104,20 @@ foreach(adapter IN ITEMS hardware warp) PROPERTIES FAIL_REGULAR_EXPRESSION "startup_sampler_x swapped=0") add_test(NAME startup_cb_blend_${adapter} COMMAND offscreen_check ${adapter} --startup-cb-blend) add_test(NAME startup_cb_blend_swapped_${adapter} COMMAND offscreen_check ${adapter} --startup-cb-blend-swapped) - set_tests_properties(startup_cb_blend_${adapter} startup_cb_blend_swapped_${adapter} PROPERTIES TIMEOUT 60) + set_tests_properties(startup_cb_blend_${adapter} startup_cb_blend_swapped_${adapter} + PROPERTIES TIMEOUT 60) + # Export write masks (#1674): the channels outside a manifest 'wmask' keep the target's value. + add_test(NAME startup_export_write_mask_${adapter} COMMAND offscreen_check ${adapter} --startup-export-write-mask) + add_test(NAME startup_export_write_mask_unmasked_${adapter} COMMAND offscreen_check ${adapter} --startup-export-write-mask-unmasked) + set_tests_properties(startup_export_write_mask_${adapter} startup_export_write_mask_unmasked_${adapter} + PROPERTIES TIMEOUT 60) + add_test(NAME startup_composite_provenance_${adapter} COMMAND offscreen_check ${adapter} --startup-composite-provenance) + set_tests_properties(startup_composite_provenance_${adapter} PROPERTIES TIMEOUT 60) + add_test(NAME startup_range_provenance_${adapter} COMMAND offscreen_check ${adapter} --startup-range-provenance) + set_tests_properties(startup_range_provenance_${adapter} PROPERTIES TIMEOUT 60) endforeach() +set_tests_properties(startup_cb_blend_hardware startup_cb_blend_swapped_hardware + startup_composite_provenance_hardware startup_range_provenance_hardware PROPERTIES SKIP_RETURN_CODE 77) set(SIMPLE_TRIANGLE_DIR "${CMAKE_SOURCE_DIR}/out/reference/b1e77b6ac10f95b07296025fda171ca2ddc42dbe/Samples/IntroGraphics/SimpleTriangle" CACHE PATH "Microsoft SimpleTriangle sample directory") @@ -1292,12 +2192,25 @@ if(FFX_UPSCALER_IMAGE) endif() if(EXISTS "${INTAKE_PYTHON}") # Startup stand-ins: exports, named traps and permissive answers (docs/startup-runtime.md). + # Synchronous save reads after a restart; the second test commits through slots 28 and 29 first. + add_test(NAME startup_gamesave_read COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gamesave_read_check.py" + "$") + set_tests_properties(startup_gamesave_read PROPERTIES TIMEOUT 30) + add_test(NAME startup_gamesave_read_after_async_submit COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gamesave_read_check.py" "$" write-async) + set_tests_properties(startup_gamesave_read_after_async_submit PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77) foreach(scheduler IN ITEMS controlled system) add_test(NAME startup_gamesave_submit_${scheduler} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gamesave_submit_check.py" "$" ${scheduler}) set_tests_properties(startup_gamesave_submit_${scheduler} PROPERTIES TIMEOUT 30) endforeach() set_tests_properties(startup_gamesave_submit_system PROPERTIES SKIP_RETURN_CODE 77) + foreach(scheduler IN ITEMS controlled system) + add_test(NAME startup_gamesave_read_async_${scheduler} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gamesave_read_async_check.py" "$" ${scheduler}) + set_tests_properties(startup_gamesave_read_async_${scheduler} PROPERTIES TIMEOUT 30) + endforeach() + set_tests_properties(startup_gamesave_read_async_system PROPERTIES SKIP_RETURN_CODE 77) add_test(NAME startup_stubs COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stub_check.py" "$" "${CMAKE_CURRENT_SOURCE_DIR}/src/startup_stubs" "$" "$" "$" @@ -1308,14 +2221,29 @@ if(EXISTS "${INTAKE_PYTHON}") "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_storage_directory_batch.py" "$") set_tests_properties(startup_storage_directory_batch PROPERTIES TIMEOUT 30) # The stand-in's zlib decoder (src/startup_stubs/inflate.h) against CPython's zlib (#1149): stored, - # fixed and dynamic blocks, a sync flush, and rejected short, truncated and out-of-window streams. + # fixed and dynamic blocks, a sync flush, and rejected short, truncated and out-of-window streams; + # then seeded random streams against the bit-at-a-time build and a faulty-table control, and small + # streams at every capacity and truncation against it and three fast-loop controls. add_test(NAME startup_inflate COMMAND "${INTAKE_PYTHON}" -B - "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_inflate_check.py" "$") + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_inflate_check.py" "$" + "$" "$" + "$" "$" + "$") set_tests_properties(startup_inflate PROPERTIES TIMEOUT 60) + add_test(NAME startup_live_view COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_live_view_check.py") + set_tests_properties(startup_live_view PROPERTIES TIMEOUT 60) add_test(NAME startup_uniform_lane COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_uniform_lane_check.py") + # NGG primitive-shader cases (#1723): identity triangle against single-change contrasts, reference model. + add_test(NAME startup_ngg_slice COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_ngg_slice_check.py") add_test(NAME startup_image_sample_l COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_image_sample_l_check.py") + add_test(NAME startup_image_gather_lz COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_image_gather_lz_check.py") + add_test(NAME startup_image_sample_c COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_image_sample_c_check.py") # Rewrites for instructions the host processor lacks (tools/startup/host_cpu.py), run on the host. add_test(NAME startup_host_cpu COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_host_cpu_check.py") @@ -1327,20 +2255,147 @@ if(EXISTS "${INTAKE_PYTHON}") # tools/startup/capture.py against synthetic capture.bin files laid out like the writer's (#1149). add_test(NAME startup_capture COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_capture_check.py") + add_test(NAME startup_capture_cli COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_capture_cli_check.py") + # gfx2hlsl.py --capture terminates and refuses malformed pipeline records (wrapper cycles, short descs). + add_test(NAME startup_gfx2hlsl_capture COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_capture_check.py") + set_tests_properties(startup_gfx2hlsl_capture PROPERTIES TIMEOUT 120) + # Two integer operations whose refusal was never reached: v_cvt_i32_f32 with an output + # modifier, and v_readfirstlane_b32 without a proven uniform source. + add_test(NAME startup_gfx2hlsl_op_refusals COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_op_refusals_check.py") + set_tests_properties(startup_gfx2hlsl_op_refusals PROPERTIES TIMEOUT 60) + # gfx2hlsl refuses a binary32 or integer vector operation with a source too few or too many. + add_test(NAME startup_gfx2hlsl_operand_count COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_operand_count_check.py") + # gfx2hlsl lowers v_swap_b32 (VOP1): CPU evaluation of the translated text, refusals of every form llvm-mc rejects. + add_test(NAME startup_gfx2hlsl_swap COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_swap_check.py") + # gfx2hlsl lowers s_bitcmp1_b32 and s_bitcmp0_b32 (SOPC): CPU evaluation of the translated SCC test. + add_test(NAME startup_gfx2hlsl_s_bitcmp COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_bitcmp_check.py") + # gfx2hlsl.py --watch consumes only ready requests and does not retry an unchanged failure. + add_test(NAME startup_gfx2hlsl_watch COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_watch_check.py") + set_tests_properties(startup_gfx2hlsl_watch PROPERTIES TIMEOUT 120) + add_test(NAME startup_gfx2hlsl_handler_arity COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_handler_arity_check.py") # VOP1/VOP2 sub-dword addressing (SDWA) in the translator (#1141), checked against the pixel AOT # lowering of the same selections. add_test(NAME startup_gfx2hlsl_sdwa COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sdwa_check.py") + # image_sample_c_lz with sampler word 2 bits 28-30 set (#1723). + add_test(NAME startup_gfx2hlsl_sample_c_lz_mip COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sample_c_lz_mip_check.py") + # The binary32 class comparison (#1795). + add_test(NAME startup_gfx2hlsl_cmp_class COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_cmp_class_check.py") + # The binary16 class comparison (#1855). + add_test(NAME startup_gfx2hlsl_cmp_class_f16 COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_cmp_class_f16_check.py") + # op_sel on a translated float operation is refused, not dropped (#1735). + add_test(NAME startup_gfx2hlsl_opsel COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_opsel_check.py") + # The 64-bit vector shifts (#1815). + add_test(NAME startup_gfx2hlsl_b64_shift COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_b64_shift_check.py") + # The scalar shift-and-add forms s_lshl1..4_add_u32 (Run 20 census #16). + add_test(NAME startup_gfx2hlsl_s_lshl_add COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_lshl_add_check.py") + # SOPK 16-bit immediates: s_movk_i32 and s_cmpk_*_i32 sign-extend, s_cmpk_*_u32 zero-extend. + add_test(NAME startup_gfx2hlsl_sopk_signext COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sopk_signext_check.py") + # Scalar sign-extends and conditional moves (batch 3 #2). + add_test(NAME startup_gfx2hlsl_s_sext_cmov COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_sext_cmov_check.py") + # SDWA forms of the float-result conversions (#1727). + add_test(NAME startup_gfx2hlsl_sdwa_cvt COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sdwa_cvt_check.py") + # VOPC SDWA compares (#1906): every integer compare, select and sext() evaluated against an integer + # reference; floating-point SDWA forms and unsupported modifiers are refused. The draws are registered below. + add_test(NAME startup_gfx2hlsl_vopc_sdwa COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_vopc_sdwa_check.py") + # f32 lg/nlg ordered for NaN (#1920): every f32 condition, e32 and e64 under every neg/abs, evaluated over + # +-0, denormals, +-1, +-max, +-inf and NaNs against the ISA reference; the old != lowering must fail. + add_test(NAME startup_gfx2hlsl_f32_lg COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_lg_check.py") + # f32 nlt/nle/ngt/nge, o and u hold under FXC's and DXC's rewrites of float compares without -Gis (#1936). + add_test(NAME startup_gfx2hlsl_f32_nan COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_nan_check.py") + # A negated source on the vector select flips that source's sign bit (#1709). + add_test(NAME startup_gfx2hlsl_cndmask_neg COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_cndmask_neg_check.py") + # The neg(x) spelling of the sign modifier is the same sign flip as -x (#1723). + add_test(NAME startup_gfx2hlsl_neg_operand COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_neg_operand_check.py") + set_tests_properties(startup_gfx2hlsl_neg_operand PROPERTIES TIMEOUT 60) + # Output modifiers on float-result conversions (#1705). + add_test(NAME startup_gfx2hlsl_vcvt_omod COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_vcvt_omod_check.py") + # A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695). + add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py") + # 32-bit scalar complement logic: s_nand_b32, s_nor_b32 and s_xnor_b32 against an integer reference (#1919). + add_test(NAME startup_gfx2hlsl_sop2_complement COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sop2_complement_check.py") # gfx2hlsl run-time sampler heap indexing (#1143): translation controls, then a desktop draw with # DXC ps_6_0 and, when the Windows SDK's FXC is found, the ps_5_1 the startup tools compile with. find_program(STARTUP_FXC fxc HINTS "${DXC_BIN_DIR}") + # gfx2hlsl conversion operations: translation controls, then a draw of the translated pairs with + # reference words and one mutated lowering per operation (v_cvt_f16_f32 through DXC only). + # Compute translator: integer inequality lane guards. + add_test(NAME compute_alu_cmp_ne_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/compute_alu_cmp_ne_check.py") + add_test(NAME startup_gfx2hlsl_cvt_alu_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_cvt_alu_check.py") + # Compute translator: scalar pair population count. + add_test(NAME compute_alu_bcnt64_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/compute_alu_bcnt64_check.py") + # Compute translator: buffer_load_format with the format read from V# word 3 at run time. + add_test(NAME compute_load_format_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/compute_load_format_check.py" controls) + # Startup shader translator: signed and unsigned three-source integer min, max and median. + add_test(NAME startup_gfx2hlsl_int_med3_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_int_med3_check.py") + # Startup shader translator: s_cselect_b32 into the wave32 lane masks vcc_lo and exec_lo. + add_test(NAME startup_gfx2hlsl_cselect_mask_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_cselect_mask_check.py") + # Startup shader translator: a scalar load or select into a former lane-mask SGPR clears its mask mark. + add_test(NAME startup_gfx2hlsl_mask_overwrite_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_mask_overwrite_check.py") + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_cvt_alu_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_cvt_alu_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_cvt_alu_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77) + endforeach() add_test(NAME startup_sampler_heap_controls COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_sampler_heap_check.py") + add_test(NAME startup_vertex_fetch_formats_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_vertex_fetch_formats_check.py" controls) + add_test(NAME startup_buffer_address_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_buffer_address_check.py" controls) + add_test(NAME startup_smem_address_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_smem_address_check.py" controls) foreach(adapter IN ITEMS warp hardware) add_test(NAME startup_r8_uint_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_r8_uint_check.py" "${DXC_EXECUTABLE}" "$" ${adapter}) set_tests_properties(startup_r8_uint_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77) + # Every buffer format of the gfx2hlsl vertex-fetch table, read back through the same compute wrapper. + add_test(NAME startup_vertex_fetch_formats_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_vertex_fetch_formats_check.py" "${DXC_EXECUTABLE}" + "$" ${adapter}) + set_tests_properties(startup_vertex_fetch_formats_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + add_test(NAME startup_buffer_address_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_buffer_address_check.py" "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_buffer_address_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + add_test(NAME startup_smem_address_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_smem_address_check.py" "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_smem_address_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) add_test(NAME startup_sampler_heap_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_sampler_heap_check.py" draw "${DXC_EXECUTABLE}" "$" ${adapter} $<$:${STARTUP_FXC}>) @@ -1374,27 +2429,113 @@ if(EXISTS "${INTAKE_PYTHON}") "$" ${adapter} $<$:${STARTUP_FXC}>) set_tests_properties(startup_image_2d_array_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) endforeach() + # gfx2hlsl packed 2D A16 image_sample / image_sample_lz coordinates and modifier validation. + add_test(NAME startup_image_sample_a16_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_image_sample_a16_check.py") + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_image_sample_a16_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_image_sample_a16_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_image_sample_a16_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + endforeach() # gfx2hlsl flat parameters keep the exported words (#1259): translation controls, then a desktop # draw of the translated pair with FXC 5_1 (the --pending path) and DXC 6_0. add_test(NAME startup_flat_param_controls COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_flat_param_check.py") foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_packed_screen_position_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_packed_position_check.py" "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_packed_screen_position_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) add_test(NAME startup_flat_param_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_flat_param_check.py" draw "${DXC_EXECUTABLE}" "$" ${adapter} $<$:${STARTUP_FXC}>) set_tests_properties(startup_flat_param_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) endforeach() + # gfx2hlsl per-lane bit operations: CPU evaluation of the translated text against an independent + # reference with mutation controls, then a desktop draw of the translated pairs (FXC 5_1 and DXC 6_0). + add_test(NAME startup_gfx2hlsl_bit_alu_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_bit_alu_check.py") + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_bit_alu_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_bit_alu_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_bit_alu_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77) + endforeach() + # gfx2hlsl v_cmpx_le_i32_sdwa on a sign-extended byte decides which of 16 x 16 pixels survive, checked + # pixel by pixel (#1906); translations without the select or without sext() must fail the same draw. + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_vopc_sdwa_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_vopc_sdwa_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_vopc_sdwa_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + add_test(NAME startup_gfx2hlsl_sdwa_cvt_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_sdwa_cvt_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_sdwa_cvt_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + endforeach() + # gfx2hlsl v_cmp/v_cmpx lg and nlg f32 over every pair of +-0, denormal, +-1, +-max, +-inf and NaN words decide + # 16 x 16 pixels, checked pixel by pixel (#1920); the old != lowering must fail the same draws. + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_f32_lg_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_lg_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_f32_lg_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77) + endforeach() + # Every lowered f32 condition but lg/nlg decides 16 x 16 pixels with FXC and DXC, checked pixel by pixel (#1936); + # the text before #1936 must fail on the compiler that rewrote it and match that rewrite's image. + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_f32_nan_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_f32_nan_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_f32_nan_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77) + endforeach() + add_test(NAME startup_gfx2hlsl_mad_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_mad_check.py") + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_mad_dispatch_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_mad_check.py" dispatch "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + add_test(NAME startup_gfx2hlsl_mad_preserve_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_mad_check.py" preserve "${DXC_EXECUTABLE}" + "$" ${adapter}) + set_tests_properties(startup_gfx2hlsl_mad_dispatch_${adapter} startup_gfx2hlsl_mad_preserve_${adapter} + PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + endforeach() + # gfx2hlsl 64-bit VOP3 shifts: binary round-trip, overlap, guards and WARP/hardware draws (Refs #1723). + add_test(NAME startup_gfx2hlsl_shift64_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_shift64_check.py") + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_shift64_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_shift64_check.py" draw "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_shift64_${adapter} PROPERTIES TIMEOUT 180 SKIP_RETURN_CODE 77) + endforeach() add_test(NAME startup_xg_bc_tiling COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_xg_bc_tiling_check.py" "$") set_tests_properties(startup_xg_bc_tiling PROPERTIES TIMEOUT 30 ENVIRONMENT "X2W_D3D12_PERMISSIVE=1") + add_test(NAME startup_xg_tile64_tiling COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_xg_tile64_tiling_check.py" "$") + set_tests_properties(startup_xg_tile64_tiling PROPERTIES TIMEOUT 30 ENVIRONMENT "X2W_D3D12_PERMISSIVE=1") add_test(NAME startup_inline_sampler_controls COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_inline_sampler_check.py") + add_test(NAME startup_gfx2hlsl_root COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_root_check.py") + set_tests_properties(startup_gfx2hlsl_root PROPERTIES TIMEOUT 60) foreach(adapter IN ITEMS warp hardware) add_test(NAME startup_inline_sampler_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_inline_sampler_check.py" draw "${DXC_EXECUTABLE}" "$" ${adapter} $<$:${STARTUP_FXC}>) set_tests_properties(startup_inline_sampler_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) endforeach() + add_test(NAME startup_gfx2hlsl_scalar_m0_controls COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_scalar_m0_check.py" controls) + foreach(adapter IN ITEMS warp hardware) + add_test(NAME startup_gfx2hlsl_scalar_m0_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_scalar_m0_check.py" "${DXC_EXECUTABLE}" + "$" ${adapter} $<$:${STARTUP_FXC}>) + set_tests_properties(startup_gfx2hlsl_scalar_m0_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + endforeach() add_test(NAME startup_xg_bc7_layout COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/startup_xg_bc7_layout_check.py" "$") set_tests_properties(startup_xg_bc7_layout PROPERTIES TIMEOUT 30 @@ -1404,8 +2545,12 @@ if(EXISTS "${INTAKE_PYTHON}") add_test(NAME startup_launch COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_launch_check.py" "$") set_tests_properties(startup_launch PROPERTIES TIMEOUT 120) + add_test(NAME startup_launch_cli_check COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_launch_cli_check.py") + set_tests_properties(startup_launch_cli_check PROPERTIES TIMEOUT 30) add_test(NAME startup_debug COMMAND "${INTAKE_PYTHON}" -B - "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_debug_check.py" "$") + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_debug_check.py" "$" + "$") set_tests_properties(startup_debug PROPERTIES TIMEOUT 300) add_test(NAME startup_stream_request_warp COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" @@ -1415,6 +2560,22 @@ if(EXISTS "${INTAKE_PYTHON}") "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_draw_check.py" "$" "${backend}") set_tests_properties(startup_stream_draw_${backend} PROPERTIES TIMEOUT 90) + add_test(NAME startup_stream_viewport_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_viewport_check.py" + "$" "${backend}") + set_tests_properties(startup_stream_viewport_${backend} PROPERTIES TIMEOUT 90) + add_test(NAME startup_stream_fetch_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_fetch_check.py" + "$" "${backend}") + set_tests_properties(startup_stream_fetch_${backend} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + add_test(NAME startup_stream_interface_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_interface_check.py" + "$" "${backend}") + set_tests_properties(startup_stream_interface_${backend} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) + add_test(NAME startup_stream_depth_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_depth_check.py" + "$" "${backend}") + set_tests_properties(startup_stream_depth_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) foreach(compiler IN ITEMS fxc dxc) add_test(NAME startup_mrt_${compiler}_${backend} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_mrt_check.py" @@ -1437,10 +2598,34 @@ if(EXISTS "${INTAKE_PYTHON}") "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_packed_target_draw_check.py" "$" "${DXC_EXECUTABLE}" "${backend}") set_tests_properties(startup_packed_target_draw_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_1d_srv_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_1d_srv_check.py" + "$" ${backend}) + set_tests_properties(startup_1d_srv_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_root_reset_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_root_reset_check.py" + "$" ${backend}) + set_tests_properties(startup_root_reset_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_root_cbv_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_root_cbv_check.py" + "$" ${backend}) + set_tests_properties(startup_root_cbv_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_root_heap_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_root_heap_check.py" + "$" ${backend}) + set_tests_properties(startup_root_heap_${backend} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77) add_test(NAME startup_address_srv_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_address_srv_check.py" "$" "${backend}") set_tests_properties(startup_address_srv_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_address_buffer_srv_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_address_buffer_srv_check.py" + "$" "${backend}") + set_tests_properties(startup_address_buffer_srv_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) + add_test(NAME startup_frame_copy_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" + "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_frame_copy_check.py" + "$" ${backend}) + set_tests_properties(startup_frame_copy_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) add_test(NAME startup_placed_vertex_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}" "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_placed_vertex_check.py" "$" "${backend}") @@ -1458,12 +2643,37 @@ if(EXISTS "${INTAKE_PYTHON}") "$" "$" "${backend}") set_tests_properties(startup_xg_bc_array_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77) endforeach() - set_tests_properties(startup_stream_draw_hardware PROPERTIES SKIP_RETURN_CODE 77) + set_tests_properties(startup_stream_draw_hardware startup_stream_viewport_hardware PROPERTIES SKIP_RETURN_CODE 77) set_tests_properties(startup_stream_request_warp PROPERTIES TIMEOUT 60) + # Stream vertex fetch from the input layout: the translator-only cases (draws: startup_stream_fetch_). + add_test(NAME startup_stream_fetch_translate COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_fetch_check.py") + # Stream stage interface by semantic: the translator-only cases (draws: startup_stream_interface_). + add_test(NAME startup_stream_interface_translate COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_stream_interface_check.py") # Startup shader translator: descriptor offsets inside wide scalar loads (no game data). add_test(NAME startup_translator COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_translator_check.py") + # Startup shader translator: the SMEM offset 'off' is the literal 0; m0 and other operands keep their handling (#1674). + add_test(NAME startup_gfx2hlsl_smem_offset COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_smem_offset_check.py") + # Startup shader translator: uniform sources of v_readfirstlane_b32 in straight-line code (#1723). + add_test(NAME startup_gfx2hlsl_readfirstlane_uniform COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_readfirstlane_uniform_check.py") + # Startup shader translator: read-only census of every refusal site (--refusals). + add_test(NAME startup_gfx2hlsl_refusals COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_refusals_check.py") + # Partial colour exports carry their channel mask to the manifest; compressed exports of whole pairs lower (#1674). + add_test(NAME startup_gfx2hlsl_export_mask COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_export_mask_check.py") + add_test(NAME startup_gfx2hlsl_export_mask_drop_control COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_export_mask_check.py" --mutate drop-mask) + set_tests_properties(startup_gfx2hlsl_export_mask_drop_control PROPERTIES WILL_FAIL TRUE) + add_test(NAME startup_triage_run COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_triage_run_check.py") + add_test(NAME startup_run_ps1 COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_run_ps1_check.py") add_test(NAME xmem_shim_mapped_pages COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/xmem_mapped_pages_check.py" "$") # Large batches: pages as slots of shared sections, adjacent pages in one view. @@ -1473,6 +2683,10 @@ if(EXISTS "${INTAKE_PYTHON}") set_tests_properties(xmem_shim_page_runs PROPERTIES TIMEOUT 300) add_test(NAME docs_links COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/docs_links_check.py") + add_test(NAME emit_variants COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/emit_variants_check.py") + add_test(NAME coverage_svg COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/coverage_svg_check.py") # Compile-only: outcome classification and GVN pass shares, no wall-time threshold (#775). add_test(NAME dxc_compile_time_gvn COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/dxc_compile_time_check.py" "${DXC_EXECUTABLE}") @@ -1523,8 +2737,24 @@ if(EXISTS "${INTAKE_PYTHON}") set_target_properties(${image} PROPERTIES LINKER_LANGUAGE CXX) target_link_options(${image} PRIVATE /NOENTRY /NODEFAULTLIB /INCREMENTAL:NO) endfunction() + # One Python process writes every variant of a fixture (tests/cpu/