mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-29 07:01:11 +00:00
Compare commits
52
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54264e23a4 | ||
|
|
b42133add9 | ||
|
|
14a54f8bb9 | ||
|
|
9071321fe4 | ||
|
|
897d170a3a | ||
|
|
ceac88f0d0 | ||
|
|
721c0593d1 | ||
|
|
c4ca0f6852 | ||
|
|
2b3ad752a7 | ||
|
|
e6d614be5c | ||
|
|
9bfd1749dd | ||
|
|
5a36e3f738 | ||
|
|
d24baa284f | ||
|
|
92860863ca | ||
|
|
0dc4fb1220 | ||
|
|
967e94ffaa | ||
|
|
ce9c10a3ab | ||
|
|
e1b6a24a4f | ||
|
|
d9333d272f | ||
|
|
395aaeb4e7 | ||
|
|
efb63a37d4 | ||
|
|
042746554c | ||
|
|
35cdf56e80 | ||
|
|
8e5856bbcf | ||
|
|
566272082a | ||
|
|
64ba56079f | ||
|
|
e266670e87 | ||
|
|
db3bdb5a5c | ||
|
|
9b20f78a06 | ||
|
|
54b06fea3e | ||
|
|
8eb25fb9fe | ||
|
|
40ffea2789 | ||
|
|
b39780b421 | ||
|
|
f8f497b578 | ||
|
|
80eacf9ac2 | ||
|
|
d9816e4cb5 | ||
|
|
77cec214c0 | ||
|
|
953254a435 | ||
|
|
39b628d60d | ||
|
|
1d70633958 | ||
|
|
a9f55b51f7 | ||
|
|
722388a46d | ||
|
|
e7ff293eba | ||
|
|
dfaaa07df4 | ||
|
|
962b83c731 | ||
|
|
7fff77c801 | ||
|
|
c3684a1ae8 | ||
|
|
d561595599 | ||
|
|
8cab0b1de8 | ||
|
|
d2367dca30 | ||
|
|
60ad6c779e | ||
|
|
ffc7056d26 |
No files matched your search
@@ -7,8 +7,9 @@ body:
|
||||
id: area
|
||||
attributes:
|
||||
label: Area
|
||||
description: "cpu: translation, DBT, PE loading, guest startup, guest memory. gpu: RDNA2, shaders, Metal. runtime: Win32, CRT, C++ runtime, import generation, OS services, platform abstractions. shared: cross-subsystem interfaces. qa: verification, regression, security review."
|
||||
description: "hybrid: CrossOver integration, configuration, diagnostics, benchmarks (active). The areas below are preserved native research unless hybrid work requires them. cpu: translation, DBT, PE loading, guest startup, guest memory. gpu: RDNA2, shaders, Metal. runtime: Win32, CRT, C++ runtime, import generation, OS services, platform abstractions. shared: cross-subsystem interfaces. qa: verification, regression, security review."
|
||||
options:
|
||||
- hybrid
|
||||
- cpu
|
||||
- gpu
|
||||
- runtime
|
||||
@@ -43,7 +44,7 @@ body:
|
||||
id: files
|
||||
attributes:
|
||||
label: Files
|
||||
description: Paths the task may edit, one per line: exact paths, directories ending in "/", or globs with * and **. Two claimed tasks never overlap.
|
||||
description: 'Paths the task may edit, one per line: exact paths, directories ending in "/", or globs with * and **. Two claimed tasks never overlap.'
|
||||
render: text
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -1,42 +1,57 @@
|
||||
name: Bug report
|
||||
description: Report a reproducible defect in Xenora or XenoMetal.
|
||||
description: A reproducible defect.
|
||||
title: "bug: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use synthetic or authorized inputs only. For vulnerabilities, follow SECURITY.md. Remove personal paths, credentials and private data from logs.
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue. For vulnerabilities follow SECURITY.md.'
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: What went wrong? Identify the affected subsystem and expected behavior.
|
||||
description: 'What went wrong and what you expected.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Reproduction steps
|
||||
description: Include exact commands and a minimal, legally distributable input if applicable.
|
||||
description: 'Exact commands and a minimal, legally distributable input.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: Commit, macOS, Apple GPU, RAM, Rust, Xcode and relevant tool versions. Include sanitized doctor output if available.
|
||||
description: 'Commit, macOS, chip, memory, CrossOver and Rosetta 2 versions, graphics backend. Remove personal paths and credentials.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: output
|
||||
id: scope
|
||||
attributes:
|
||||
label: Actual output and diagnostics
|
||||
description: Include expected versus actual results, validation-layer messages and relevant logs.
|
||||
- type: checkboxes
|
||||
id: confirmation
|
||||
label: Scope and dependencies
|
||||
description: 'Affected area; related issues.'
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Confirmation
|
||||
options:
|
||||
- label: I searched for existing reports and have not included sensitive or unauthorized material.
|
||||
required: true
|
||||
label: Acceptance criteria
|
||||
description: 'When is this fixed?'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How to confirm the fix independently.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: 'Only if third-party code or a dependency is involved.'
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Documentation
|
||||
description: Fix, add or restructure documentation.
|
||||
title: "docs: "
|
||||
labels: [documentation]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is unclear, wrong or missing.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Pages and sources involved.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'Files to change; update docs/README.md if pages are added or moved.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'None if none.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Claims are scoped to their evidence; links work.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'scripts/audit/docs_hygiene.py and claims audit pass.'
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Feature proposal
|
||||
description: Propose a compiler, graphics, tooling or other project enhancement.
|
||||
title: "feat: "
|
||||
labels: [enhancement]
|
||||
body:
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem or gap
|
||||
description: Which limitation does this feature address?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed approach
|
||||
description: Explain the intended behavior and affected components. Link relevant public specifications when available.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: criteria
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: What observable results and tests would demonstrate completion?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives and trade-offs
|
||||
description: Include limitations, dependency costs or impacts on native ARM64 and Metal if relevant.
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Hardware verification report
|
||||
description: Submit real hardware test results for Xenora.
|
||||
title: "hardware: "
|
||||
labels: [needs-verification]
|
||||
body:
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Test environment
|
||||
description: Commit, Apple chip/GPU, RAM, macOS, Xcode/Metal version, Rust version, validation settings. Do not include serial numbers or registry IDs.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: commands
|
||||
attributes:
|
||||
label: Commands and inputs
|
||||
description: Include exact commands and synthetic or authorized fixture identifiers.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: results
|
||||
attributes:
|
||||
label: Results
|
||||
description: Report actual output, pass/fail/skip counts, and limitations. Compilation alone does not prove execution.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: performance
|
||||
attributes:
|
||||
label: Performance data (optional)
|
||||
description: Include repetitions, warm-up, timing method, validation state and variability if reporting measurements.
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Hybrid engineering task
|
||||
description: Integration, configuration, diagnostics or tooling around CrossOver.
|
||||
title: "task: "
|
||||
labels: [track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is missing or wrong, and why it matters for the hybrid architecture.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Versions (macOS, chip, CrossOver, Rosetta 2, graphics backend), related issues, upstream references.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'What is in and out. Avoid duplicating what CrossOver already provides.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: "Blocking issues or decisions; write 'none' if none."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Observable, checkable results.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How an independent contributor verifies it; commands, workloads, evidence class.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Performance investigation
|
||||
description: Measure or improve performance with evidence.
|
||||
title: "perf: "
|
||||
labels: [performance,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue. Do not promise gains before measuring.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem and metric
|
||||
description: 'Which metric (average FPS, 1% low, frame-time percentiles, CPU or GPU use, memory, startup, shader compile latency) and why.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Workload, hardware (reference: M4, 24 GB), software versions, settings.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'Measurement only, or change as well.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'Measurement protocol (#353) and baseline (#355).'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Measured before-and-after under equivalent conditions, with variance.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'Correctness and rendering equivalence verified before the result counts.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,42 +1,57 @@
|
||||
name: Technical research
|
||||
description: Record an ISA, Metal or publicly documented graphics research finding.
|
||||
name: Upstream research or dependency evaluation
|
||||
description: Assess a project, component or license from public sources.
|
||||
title: "research: "
|
||||
labels: [research]
|
||||
labels: [research,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Use only public, authorized sources. Do not link to leaked SDKs, private documentation or unauthorized game content.
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: question
|
||||
id: problem
|
||||
attributes:
|
||||
label: Research question or finding
|
||||
label: Question
|
||||
description: 'The decision this research informs.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: sources
|
||||
id: context
|
||||
attributes:
|
||||
label: Sources and applicability
|
||||
description: URLs, specification sections or revision, exact architecture and license/provenance if relevant.
|
||||
label: Technical context
|
||||
description: 'What is already known; link docs/research/upstream-registry.md entries.'
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: evidence
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Evidence class (highest applicable)
|
||||
options:
|
||||
- A - Measured on named hardware
|
||||
- B - Normative source for exact target
|
||||
- C - Normative source for related target
|
||||
- D - Non-normative official material
|
||||
- E - Independent software behavior
|
||||
- F - Uncorroborated community claim
|
||||
- U - Unknown or assumption
|
||||
label: Scope
|
||||
description: 'Which versions or components; desk research or execution.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'Other issues or decisions; execution may need a maintainer-approved environment.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Each claim cites vendor or upstream documentation, or a recorded observation of a stated version; unknowns stay marked unknown.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation, limitations and proposed next steps
|
||||
description: Distinguish Apple or desktop RDNA observations from Xbox behavior.
|
||||
label: Validation requirements
|
||||
description: 'Independent re-derivation and evidence class (A to U).'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Testing and validation
|
||||
description: Add or run a validation for a workload or behaviour.
|
||||
title: "validate: "
|
||||
labels: [needs-verification,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is missing or wrong, and why it matters for the hybrid architecture.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Versions (macOS, chip, CrossOver, Rosetta 2, graphics backend), related issues, upstream references.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'What is in and out. Avoid duplicating what CrossOver already provides.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: "Blocking issues or decisions; write 'none' if none."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Observable, checkable results.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How an independent contributor verifies it; commands, workloads, evidence class.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,29 @@
|
||||
## Related issue
|
||||
|
||||
Closes #
|
||||
|
||||
## Summary
|
||||
|
||||
## Technical changes
|
||||
|
||||
## Tests performed
|
||||
|
||||
Commands, versions, pass/fail/skip counts and hardware. A skipped test is not a pass.
|
||||
|
||||
## Performance impact
|
||||
|
||||
Measured before and after under equivalent conditions, or "none expected" with reason.
|
||||
|
||||
## Compatibility impact
|
||||
|
||||
Workloads, macOS or CrossOver versions and hardware affected. Do not claim support that was not tested.
|
||||
|
||||
## Known limitations
|
||||
|
||||
## Third-party code attribution
|
||||
|
||||
Source repository, exact commit, license, modifications. "None" if none.
|
||||
|
||||
## Dependency and licensing considerations
|
||||
|
||||
New or changed dependencies, license compatibility with GPL-3.0-or-later, redistribution limits (proprietary components are never bundled). DCO: commits are signed off.
|
||||
@@ -1,102 +0,0 @@
|
||||
name: Agent PR checks
|
||||
|
||||
# Checks pull requests against the task queue: linked claimed task, file
|
||||
# ownership, overlap with other open pull requests, and independent
|
||||
# verification. Runs on the base branch only: pull request code is never checked
|
||||
# out or executed; changed files come from the API. Not yet run on GitHub.
|
||||
#
|
||||
# Advisory: problems are reported as a warning and in the run summary, but the
|
||||
# check does not fail until a live smoke test and the migration of existing
|
||||
# issues are done (docs/coordination/agent-tasks.md). Only a comment starting
|
||||
# with /verified starts the verify job; ordinary comments start nothing.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
if: github.event_name == 'pull_request_target'
|
||||
runs-on: ubuntu-24.04-arm
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check pull request
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
PYTHONPATH: scripts
|
||||
run: |
|
||||
set -eu
|
||||
python3 -m agent_queue event --path "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/event.json"
|
||||
number=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["number"])' "$RUNNER_TEMP/event.json")
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --pr "$number" > "$RUNNER_TEMP/state.json"
|
||||
status=0
|
||||
python3 -m agent_queue pr-check --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/result.json" || status=$?
|
||||
{
|
||||
echo '## Agent PR check'
|
||||
echo '```json'
|
||||
cat "$RUNNER_TEMP/result.json"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
# 1 means problems were found: advisory for now. Anything else is a failure of the check itself.
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "::warning title=Agent PR check (advisory)::problems found; see the run summary"
|
||||
elif [ "$status" -ne 0 ]; then
|
||||
exit "$status"
|
||||
fi
|
||||
|
||||
verify:
|
||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/verified')
|
||||
runs-on: ubuntu-24.04-arm
|
||||
# issues: write posts the reply.
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
concurrency:
|
||||
group: agent-verify-${{ github.event.issue.number }}
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Record verification and check again
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
PYTHONPATH: scripts
|
||||
run: |
|
||||
set -eu
|
||||
python3 -m agent_queue event --path "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/event.json"
|
||||
number=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["number"])' "$RUNNER_TEMP/event.json")
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --pr "$number" > "$RUNNER_TEMP/state.json"
|
||||
python3 -m agent_queue decide --event "$RUNNER_TEMP/event.json" --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/actions.json"
|
||||
python3 -m agent_queue apply --repo "$GH_REPO" --actions "$RUNNER_TEMP/actions.json"
|
||||
# Check again only after an accepted verification of the current head: refused, stale,
|
||||
# malformed or unauthorized /verified comments get a reply and nothing else.
|
||||
if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi
|
||||
# pull_request_target runs are recorded against the base branch, not the pull request
|
||||
# head, so the earlier check run cannot be found by head SHA. Evaluate the same check here.
|
||||
status=0
|
||||
python3 -m agent_queue pr-check --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/result.json" || status=$?
|
||||
{
|
||||
echo '## Agent PR check after verification'
|
||||
echo '```json'
|
||||
cat "$RUNNER_TEMP/result.json"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "::warning title=Agent PR check (advisory)::problems found; see the run summary"
|
||||
elif [ "$status" -ne 0 ]; then
|
||||
exit "$status"
|
||||
fi
|
||||
@@ -41,3 +41,6 @@ __pycache__/
|
||||
|
||||
# Native application build output
|
||||
/app/.build/
|
||||
|
||||
# DXVK writes its state cache into the working directory of a run
|
||||
*.dxvk-cache
|
||||
@@ -1,40 +1,60 @@
|
||||
# BetterXen engineering rules
|
||||
|
||||
### Native Apple Silicon
|
||||
These rules apply to every contributor and coding agent. They were rewritten on the `planning/hybrid-first-transition` branch when BetterXen moved from native-first to CrossOver-based hybrid development. `CLAUDE.md` is a symlink to this file. The decision is recorded in `docs/adr/0005-crossover-hybrid-direction.md`; the plan is `docs/roadmap.md`.
|
||||
|
||||
Never introduce Rosetta 2, x86-64 host executables, MoltenVK, Vulkan runtime dependencies, Wine, CrossOver, Windows compatibility layers, OpenGL fallback rendering, or unnecessary graphics abstraction layers.
|
||||
### Direction
|
||||
|
||||
- SPIR-V is permitted as a compiler intermediate representation. It does not justify a Vulkan runtime.
|
||||
- All host executables and native dependencies must support ARM64. Verify with file, lipo -archs and otool -L.
|
||||
- Never run Intel binaries through Rosetta, even temporarily. Never add a dependency that requires Rosetta to build or run. If a dependency cannot run natively, find an alternative or document the limitation.
|
||||
- The guest architecture being decoded may be x86-64, but BetterXen itself runs natively on ARM64.
|
||||
- BetterXen is hybrid-first Apple Silicon compatibility research. **CrossOver is the primary compatibility foundation and hybrid is the only active development direction.** CrossOver is an externally installed dependency unless its license explicitly permits another distribution model.
|
||||
- BetterXen's own work is the layer around it: integration, configuration, environment management, diagnostics, reproducible testing, benchmarking and measured optimization. Reuse established infrastructure before writing an independent replacement; write one only for a demonstrated limitation.
|
||||
- The independent native implementation (x86-64 decoder, ARM64 translator, runtime, gfx1030 shader compiler, Metal backend) is **preserved and paused**. Do not delete it, expand its roadmap, create speculative native issues or assign contributors to it by default. Native work is allowed only when hybrid development directly requires it, or after an explicit maintainer decision to resume (`docs/research/native-roadmap.md`). Keep its tests passing.
|
||||
- This is the intended architecture, not a verified Xbox compatibility stack. Do not assume CrossOver, Rosetta 2 or D3DMetal provide Xbox runtime compatibility; verify the actual capabilities and integration boundaries of the installed versions.
|
||||
|
||||
### Planning
|
||||
|
||||
- Planning is progressive. Only the current phase has a milestone and open issues; the roadmap outlines later phases provisionally and `Parked ideas` holds future items. Do not create speculative issues, trackers or milestones for distant phases; promote an idea when its prerequisites are met.
|
||||
- Every new issue states a specific problem, the evidence it is needed, a deliverable, upstream references, a reuse assessment, dependencies, acceptance criteria and a validation method. Do not create administrative issues to manage planning.
|
||||
- Do not open native-only issues. If hybrid work needs a native component, file a focused hybrid issue.
|
||||
|
||||
### Dependencies and reuse
|
||||
|
||||
- Wine-based compatibility infrastructure, CrossOver, Rosetta 2 where supported and technically appropriate, and D3DMetal (subject to its license terms) are permitted. DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX and similar projects may be evaluated and used where appropriate. Legitimate external dependencies and open-source implementations are encouraged.
|
||||
- Before integrating or copying anything: verify the exact license of the component (the file for copied source, not just the repository), check compatibility with GPL-3.0-or-later and with every other selected component, preserve copyright notices, record the source repository and exact commit or version, document modifications, and add the entry to `docs/research/upstream-registry.md` and `docs/research/component-reuse-matrix.md`. If licensing is uncertain, do not use it until resolved. Never remove upstream notices.
|
||||
- Do not bundle, modify or redistribute proprietary components (CrossOver binaries, D3DMetal, Rosetta 2, Apple tools) unless their license explicitly allows it. Do not assume a proprietary component can be incorporated into GPL-licensed source. Distinguish open-source parts from proprietary parts in every assessment.
|
||||
- Do not bypass licensing or activation requirements of any dependency.
|
||||
- Provenance first: exclude anything derived from leaked proprietary material or unauthorized software. A project's license being GPL does not clear material it was built from or for. Projects whose stated purpose depends on leaked or unauthorized builds, including VIctory, its forks and similar efforts, are discovery references at documentation level; adopt nothing from them without a per-file provenance and license review recorded in the registry. Game-specific, asset-specific and decryption-related code is never adopted.
|
||||
|
||||
### Native Apple Silicon host
|
||||
|
||||
- BetterXen's own host executables, libraries and tools must support ARM64 natively; verify with file, lipo -archs and otool -L. Do not add x86-64 host executables that BetterXen itself builds or ships.
|
||||
- Rosetta 2 may be used where Apple supports it and CrossOver or another selected component relies on it for x86-64 guest code. Record versions and its support status; do not depend on it for BetterXen's own code.
|
||||
- Support M1 through M5 and future generations through runtime capability detection. Do not assume all Apple GPUs share capabilities.
|
||||
- Use aarch64-apple-darwin as the Rust target.
|
||||
- Use aarch64-apple-darwin as the Rust target. Metal is the host graphics API. Do not add graphics abstraction layers beyond what a selected component or a measured need justifies.
|
||||
- SPIR-V remains permitted as a compiler intermediate representation.
|
||||
|
||||
### Honesty and evidence
|
||||
|
||||
- Never report a test as passed unless it ran and passed. Never count a skipped test as GPU verification.
|
||||
- Never invent benchmark results, hardware compatibility, API names, instruction encodings, hardware capabilities or implementation status.
|
||||
- Never invent benchmark results, hardware compatibility, API names, instruction encodings, hardware capabilities, interface details, product capabilities or implementation status. Never promise a performance improvement before measuring it.
|
||||
- Never claim a clean build unless the commands actually succeeded.
|
||||
- Never present planned features as working. State clearly that game execution is not supported unless demonstrated.
|
||||
- Never replace GPU tests with mocks and then claim GPU support.
|
||||
- Unknown information is classified as unknown and becomes a documented research task.
|
||||
- Every hardware claim carries an evidence class (section 9). Never present a lower-class claim as if it were a higher-class one.
|
||||
- Unknown information is classified as unknown and becomes a documented research task. Facts about CrossOver, Rosetta 2, D3DMetal and other upstreams must cite vendor or upstream documentation, or a recorded observation of a stated version.
|
||||
- Every hardware claim carries an evidence class (see docs/claims.toml). Never present a lower-class claim as if it were a higher-class one.
|
||||
- Never claim "verified on Xbox hardware". BetterXen has no Xbox hardware access. Agreement with a spec-derived reference is not agreement with Xbox hardware, and docs must say so.
|
||||
- Do not hide errors behind fallbacks. Do not translate unsupported instructions into silent no-ops. Do not weaken or delete tests to make them pass. Do not change mutation counting, tolerances or gate definitions to improve a score.
|
||||
- A phase is complete only with the evidence its exit conditions name. Do not derive progress from commits, lines of code, closed issues or isolated passing fixtures.
|
||||
|
||||
### Independence of verification
|
||||
|
||||
- The agent that writes a component does not certify it. The two independent reviewers (section 5) re-derive expectations from primary sources and are not told the implementers' conclusions as ground truth.
|
||||
- The agent that writes a component does not certify it. Independent reviewers re-derive expectations from primary sources and are not told the implementers' conclusions as ground truth.
|
||||
- The same faulty code must never produce both the expected and the actual values in a test.
|
||||
|
||||
### Legal and clean-room
|
||||
|
||||
- Use only publicly accessible documentation and authorized materials. Never obtain or use leaked SDKs, confidential Xbox documentation, restricted console tools, firmware, encryption keys, or proprietary game binaries and shader collections. Do not attempt to bypass documentation access restrictions.
|
||||
- Use only publicly accessible documentation, publicly licensed software and authorized materials. All validation uses independently authored or authorized workloads. Never obtain or use leaked executables or SDKs, confidential Xbox documentation, restricted console tools, firmware, encryption keys, unauthorized assets or source code, or proprietary game builds and shader collections. Do not attempt to bypass documentation access restrictions.
|
||||
- Contributors who have seen leaked or confidential Xbox materials must not contribute. State this in CONTRIBUTING.md and require a DCO sign-off (Signed-off-by) on contributions.
|
||||
- Include a plain statement in docs/legal.md: BetterXen does not circumvent console security or DRM, does not load encrypted or protected content, and is a research project built from public documentation. Add a note that this is not legal advice and that contributors should know their local laws, including anti-circumvention provisions such as DMCA section 1201.
|
||||
- Before copying or adapting any upstream code: verify the exact license of that file (not just the repo), check GPL-3.0-or-later compatibility, preserve copyright notices, record source repository and exact commit, document modifications, include required attribution. Never remove upstream copyright notices. If licensing is uncertain, stop using that code until resolved.
|
||||
- Keep BetterXen's emulator implementation original. Never copy, port, translate or adapt emulator source from PE-Vulkan project, KyTx, AnyPS5 or similar projects.
|
||||
- docs/legal.md states: BetterXen does not circumvent console security or DRM, does not load encrypted or protected content, and is a research project built from public documentation. This is not legal advice; contributors should know their local laws, including anti-circumvention provisions such as DMCA section 1201.
|
||||
- Keep BetterXen's own implementation original where it is original. Never copy, port, translate or adapt source from emulator projects built for leaked or unauthorized material (for example PE-Vulkan, KyTx, AnyPS5 and similar).
|
||||
- Validate the technical compatibility and safety of user-provided files. Do not ask for ownership receipts, accounts or acquisition provenance as part of file loading. Contributor provenance and licensing obligations still apply.
|
||||
- Never place restricted material in the repository or its Git history.
|
||||
- Do not push, publish, or change remote visibility without explicit user authorization. Prepare locally and report readiness.
|
||||
@@ -43,7 +63,7 @@ Never introduce Rosetta 2, x86-64 host executables, MoltenVK, Vulkan runtime dep
|
||||
|
||||
No AI slop (section 29).
|
||||
|
||||
Read docs/interfaces.md and docs/progress.md before implementation.
|
||||
Read docs/roadmap.md, docs/interfaces.md and docs/progress.md before implementation.
|
||||
|
||||
## Claiming work before you start
|
||||
|
||||
@@ -84,7 +104,7 @@ A coding agent claims in the name of the person it works for and follows the sam
|
||||
- Lint: `cargo clippy --workspace --all-targets -- -D warnings`
|
||||
- Test: `cargo test --workspace`
|
||||
- Verify the synthetic fixtures: `scripts/assemble-fixture.sh --check`
|
||||
- Run native GPU correctness: `scripts/test-gpu.sh`
|
||||
- Run native GPU correctness (preserved native research): `scripts/test-gpu.sh`
|
||||
- Run the three RDNA-to-Metal fixtures: `scripts/demo.sh`
|
||||
- Run independent CPU validation: `cargo test --locked -p xenora-semantic-review`
|
||||
- Run the correctness-gated benchmark suite: `scripts/benchmark.sh` (idle machine, release, validation off)
|
||||
@@ -101,4 +121,4 @@ Preserve the configured Git author and committer identity.
|
||||
|
||||
## Ownership
|
||||
|
||||
Xbox and claims owns public console research. ISA owns the decoder and oracle fixtures. Compiler owns the parser, IR and MSL. Metal owns the native GPU backend. Testing owns the independent reference and fixture validation. Infrastructure owns shared Cargo configuration, policies and the CPU boundary. R1 independently audits claims and release evidence. R2 independently validates semantic expectations and mutation results.
|
||||
These are responsibility areas, not personal assignments; do not assign people without their agreement. Hybrid integration owns the CrossOver assessment, integration boundary, configuration, diagnostics and benchmarks. Xbox and claims owns public console research. ISA owns the decoder and oracle fixtures. Compiler owns the parser, IR and MSL. Metal owns the native GPU backend. Testing owns the independent reference and fixture validation. Infrastructure owns shared Cargo configuration, policies and the CPU boundary. R1 independently audits claims and release evidence. R2 independently validates semantic expectations and mutation results.
|
||||
@@ -9,17 +9,49 @@ exact revision and known limitations.
|
||||
Guest execution uses original, purpose-built test programs. Commercial Xbox game execution
|
||||
remains unsupported.
|
||||
|
||||
### Security
|
||||
|
||||
- Windows programs started by the hybrid runner no longer inherit the host environment: only a short allowlist and explicit `--env` values are passed. Before this, tokens and `SSH_AUTH_SOCK` were visible to them. This is not a sandbox.
|
||||
|
||||
### Added
|
||||
- Added a security review of the hybrid path, a shader-import decision proposal, a reference-project assessment and a per-file audit coverage ledger, which shows the repository audit is incomplete.
|
||||
- Recorded an evaluation of utmapp/d3dmetal-native: it builds, 4 of its 55 tests pass without Apple's framework, it was not run against D3DMetal, and it is not adopted (`docs/research/d3dmetal-native-evaluation.md`).
|
||||
- Documented the hybrid execution path, its acceptance gates and an audit of the integration base, including which parts of the repository were not read (`docs/hybrid-execution.md`, `docs/research/hybrid-runtime-audit-2026-11-25.md`).
|
||||
- Added `betterxen hybrid`, the same commands as `betterxen-hybrid` inside the main CLI, plus `stop --bottle` for recovery. Runs stop their process group and bottle on SIGINT, SIGTERM and SIGHUP, and record any workload process left behind.
|
||||
- Added an original Direct3D 12 workload (`workloads/d3d12-integrated`). On one Mac it passes every gate except resource release under D3DMetal, where each destroyed D3D12 swapchain leaves a device reference; it produces the same pixel digest as the Direct3D 11 workload. Under the `wined3d` setting frames slow to 2 s after about 440 frames (cause unknown). Not independently reproduced.
|
||||
- Recorded a two-hour Direct3D 12 run on one Mac: 844,497 frames, 1,414 verified by read-back with none mismatched, no working-set growth; only the known resource-release gate failed.
|
||||
- Added an original integrated Windows workload (`workloads/d3d11-integrated`, #365): threads, memory protection and exception handling, timing, files, a window and swapchain, textured depth-tested rendering, a compute pass, scripted input, resource churn and shutdown checks, each reported as a pass/fail gate, with seven fault injections as negative controls. Locally verified on CrossOver 26.3 (Apple M4): pixels match a CPU-computed image on the default, D3DMetal, DXMT, DXVK and wined3d settings, and a macOS capture of the window matches the final frame. Not independently reproduced; input is posted inside Windows, not typed on the Mac.
|
||||
- Added `betterxen-hybrid doctor` (environment preflight) and `inspect` (identify a Windows executable). `run` and `bench` now refuse non-programs, DLLs, ARM64 images, unknown backend names and missing bottles before launching, record the executable's SHA-256 and imports, honour `--require-gates`, and stop runaway output (#355).
|
||||
- Added `scripts/hybrid/accept-integrated.sh`, which reproduces the integrated acceptance sequence including crash and hang recovery, repeats and a 20,000-frame run.
|
||||
- Documented the original Windows workload set and Phase 1 hybrid measurement protocol (#353), including receipt-field sources, percentile definitions, negative controls and independent reproduction requirements. The protocol identifies the unmerged runner candidate and its missing raw traces and measurements; it adds no execution or compatibility claim.
|
||||
- Added `--stall-timeout` and a memory-settle wait to `betterxen-hybrid run`/`bench` (#385): a run that prints nothing for the given time is stopped and classified `stalled`, and after any stop the supervisor waits (up to `--settle-bound`, default 60 s) until free memory is back above the start threshold and records whether it recovered. Based on supervision lessons from skakwy's victory-mac (reimplemented, not copied). Also fixes a defect found by the first real stall run: stopping a bottle used `CX_BOTTLE`, which does not select the bottle, so a stopped Windows process kept running; it now sets `WINEPREFIX`. Verified with 4 new unit tests (stub launcher) and a real CrossOver 26.3 run on the M4: a silent workload was stopped as `stalled` after 4.7 s of a 120 s timeout, nothing was left running, and the next run passed. The low-memory recovery path is only tested with an injected memory reader. Not independently reviewed.
|
||||
- Added `betterxen-hybrid run` and `bench`: launch a Windows program through an installed CrossOver (`bin/wine --bottle`, an interface CodeWeavers does not document for macOS), with timeout, the memory guard, failure classification (passed, failed exit, timed out, stopped on low memory, cannot execute, no graphics device), sampled CrossOver process memory and CPU, thermal notes, recognised host-noise diagnostics and frame statistics, and write a JSON record; `bench` repeats a workload across graphics backends. Locally verified with 24 unit tests (stub launcher) and with real runs on CrossOver 26.3 on the Apple M4.
|
||||
- Executed the original Windows workloads under CrossOver 26.3 for the first time (`docs/research/crossover-baseline-2026-11-25.md`). x86-64 C, Rust, Direct3D 11 clear and triangle/frame-loop programs passed; all four ARM64 builds were rejected by CrossOver (`cannot execute`). Five-repeat, 2000-frame comparison of default, D3DMetal, DXMT, DXVK and wined3d on a trivial offscreen workload: D3DMetal's median submit-and-wait was about 1.8 times the others; this is not rendering performance. Observed on one machine, not independently reproduced, using an undocumented backend variable.
|
||||
- Added `workloads/d3d11-frameloop` (indexed triangle, shaders, event-query frame loop) and negative controls for both Direct3D programs; made workload builds byte-reproducible on one machine with `--no-insert-timestamp`.
|
||||
- Added `betterxen-hybrid guard`, a memory-pressure supervisor: it refuses to start a command when system-wide free memory is below a threshold and stops it (SIGTERM, then SIGKILL) when memory drops below a limit, reporting why. It is adapted from the memory guard in contributor skakwy's `victory-mac` `mac/run-victory.sh` (GPL-3.0, used with his permission) and reimplemented in Rust. Locally verified with 6 unit tests and three end-to-end runs (refuse, pass-through, stop) on macOS 27.0; the `memory_pressure -Q` output format is not a documented interface; not independently reviewed.
|
||||
- Added original Windows workloads and a build script (#364, #365): a C and a Rust self-checking console program and a Direct3D 11 clear-and-readback program (`workloads/`), built for x86-64 and ARM64 with a checksum-verified llvm-mingw 20261117 by `scripts/hybrid/build-windows-workloads.sh` (`docs/research/hybrid-toolchain.md`). All six outputs were confirmed as the right PE architecture with `file`. **The x86-64 outputs were later run under CrossOver (see below).**
|
||||
- Extended `docs/research/upstream-integration-audit.md` with a component-level review of skakwy's `victory-mac`: the reported ~1 FPS is, in his own notes, 1 to 1.9 s per frame of a leaked console-game dump measured by his runtime, so it is not reproducible or adoptable here. His Windows cross-link wrapper failed with Homebrew `llvm@17` and was not integrated; his Metal swizzle and D3DMetal-internals fixes are rejected; game-specific loader patches are rejected.
|
||||
- Added the `betterxen-hybrid` crate (`crates/hybrid`, no third-party dependencies, native arm64) with `host`, `crossover`, `toolchain`, `frames` and `receipt` commands that print JSON: a host receipt (macOS, chip, memory, core split, whether an x86_64 binary runs under Rosetta, GPU and Metal family), CrossOver discovery limited to `Info.plist` metadata, `lipo -archs` and the documented `BottleDir` and `ManagedBottleDirs` preferences, a Windows cross-compiler probe, and frame-time statistics (nearest-rank percentiles, 1 % and 0.1 % lows, stutter count). Locally verified: 13 unit tests, clippy with warnings denied, and a run on the Apple M4 reference machine, where CrossOver is **not installed** (the report says so) and only Homebrew mingw-w64 x86_64 and i686 compilers were found. CrossOver discovery has been tested on a synthetic bundle only and has never inspected a real CrossOver; nothing launches a program or measures a game. Not independently reviewed (#353, #350, #364, #145).
|
||||
- Added `docs/research/upstream-integration-audit.md` and registry and reuse-matrix rows for skakwy/victory-mac, MacBox, ScarlettMac, ossover, Whisky and rum (source read through the GitHub API, nothing executed, no code copied). Findings: MacBox and ScarlettMac are GPL-2.0 and game-specific, so they are rejected; the Game Porting Toolkit licence text (a third-party copy of version 4.0) limits use to developing, testing or evaluating games and distribution to non-commercial; contributor-reported frame results (about 1 FPS, then two rendered frames) are recorded as unverified.
|
||||
- Added the upstream research registry and component reuse matrix (`docs/research/`), a public-documentation review (evidence class D, nothing executed) of CrossOver, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX, VIctory, VIctory-macOS and PortWatch. VIctory-family projects are excluded from reuse on provenance grounds. The GitHub project board is not yet configured because the token lacks the `project` scope (#346).
|
||||
- Added hybrid research records: `docs/research/hybrid-backlog-research-2026-11-25.md` (findings and registry candidates, from search summaries) and `docs/research/primary-source-verification-2026-11-25.md` (re-check against CodeWeavers, Apple, DXMT and Wine primary pages). It confirms CrossOver's backend list, finds no public documentation of `CX_GRAPHICS_BACKEND`, and records that two Apple notices on Rosetta's end disagree; D3DMetal's license text and CrossOver's Rosetta and ARM64 plans remain unverified. Eleven issues created from the research were reviewed the same day: #364 and #365 stay in Phase 1, the others are parked and recorded under "Parked ideas" in the roadmap. Rust 1.100.0 (already installed) is the required toolchain; the default `stable` was 1.94.1. Planning only; nothing was installed or run.
|
||||
- Added `docs/research/crossover-licensing.md`, a per-component license and redistribution record for the hybrid direction: CrossOver itself, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, Apple's Game Porting Toolkit repository, D3DMetal and Rosetta 2, each with the exact text read or the missing document named, plus an entry in `docs/licenses.md` (#354). Nothing is bundled or redistributed; the D3DMetal text (third-party copy, not confirmed against Apple's) and Rosetta 2 terms remain unverified, and CrossOver 26.3.0's FOSS inventory is unknown. Research only; no code or dependency change.
|
||||
- Added File > Open Executable… with Command-O to the app (#252). It opens the focused window's read-only file importer, the same one as that window's button, and is disabled when no window can present it; each window keeps its own importer, so with several windows only the focused one shows the picker. The chosen file goes through the same inspection path as the button, drag and drop and Finder Open With; nothing is executed. A file-importer failure is now shown in red with the system's description instead of being ignored, a cancelled picker shows nothing, and the message clears on the next selection. `BetterXen --smoke-import-result`, run by `scripts/build-app.sh`, checks cancellation, a shown failure and its clearing; it fails on the previous importer handling. Checked locally on Apple Silicon in the running app (Command-O and the menu item open the picker, cancel shows no error, a second Command-O opens it again, with two windows only the focused one presents it, and with every window closed the menu item is disabled); not yet independently reviewed.
|
||||
- Added `docs/research/texture-formats.md`, an inventory of the texture formats and layouts BetterXen handles (#260). For BC1–BC7, RGBA8 and Depth32Float it separates container recognition, CPU decoding, layout conversion, native Metal upload and readback, translated sampling, the host-side D3D12-shaped API (called from Rust, not wired to guest imports) and guest reachability through imported services, and links each cell's implementing files and tests and each format's exact public specification sections, including the packed BC footprints from #241. It cross-references #208 and #209 instead of opening duplicate tasks, lists console layouts, console descriptors and asset or audio containers as unknowns, and ranks three proposed follow-ups with fixture recipes and owners. Research only; no implementation changed.
|
||||
- Rewrote the README around the six development phases and the first-launchable-application target (#311), with colour-coded Mermaid diagrams (system flow, milestone roadmap, CPU, runtime-service and shader-form charts built from the generated registries), badges, a repository overview, a contributing section and corrected texture-sampling wording. The older X1–X25 capability map is kept in a collapsible section. The diagrams were not render-tested locally.
|
||||
- Added a fast "Repository hygiene" check (`.github/workflows/hygiene.yml`, `scripts/audit/docs_hygiene.py`). It runs on Ubuntu without a Rust toolchain or network access and fails only on merge-conflict markers, broken relative Markdown links and invalid workflow YAML in tracked files. A separate advisory step warns, without failing, when source or script changes have no changelog entry. A local run over the 626 tracked files found no problems, and planted failures of each kind were caught; it has not yet run on GitHub.
|
||||
- Documented the proposed guest AVX/AVX2 state and decoding contract and specified an original integer fixture with known results and fault controls (#299).
|
||||
- `betterxen-hybrid host`, `receipt`, `bench` and every `run` record now include the GPU wired-memory sysctls `iogpu.wired_limit_mb` and `iogpu.wired_lwm_mb` as raw integers with their source command, or `null` when a key is absent (#386). They are read only and never set. `0` is recorded as observed, because Apple does not document what it means. Unit tests inject the values; an Apple M5 with macOS 27.2.1 reported `0` for both keys. Not run under CrossOver.
|
||||
|
||||
### Removed
|
||||
- Removed the "Agent PR checks" workflow (`.github/workflows/agent-pr-checks.yml`), its section in `docs/coordination/agent-tasks.md` and the four workflow tests in `tests/agent_queue/test_workflows_cli.py` that only exercised it. Pull requests are no longer checked for `Closes #N`, task file patterns or `/verified` comments; the claims workflow and its tests are unchanged. The agent queue Python tests pass locally (85 tests).
|
||||
- Removed the "PR template" check (`.github/workflows/pr-template.yml`, `scripts/pr_template_check.py` and its tests) and its CI test step. Also removed `.github/PULL_REQUEST_TEMPLATE.md`. Pull request descriptions are no longer validated or pre-filled; CONTRIBUTING.md still asks for the same information and the claim-first rule still applies.
|
||||
|
||||
### Changed
|
||||
- Replaced the native-first development plan with a CrossOver-based hybrid roadmap (`docs/roadmap.md`: five provisional phases, only Phase 1 active; the earlier H0 to H7 breakdown is archived) and an accepted-direction ADR 0005. No hybrid component exists yet and no Xbox title is shown to run; this is planning and research scheduling only, and no phase is verified complete.
|
||||
- Rewrote the engineering rules in `AGENTS.md` (`CLAUDE.md` is a symlink to it) to permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal subject to licensing, while keeping the honesty, independent-verification, provenance and clean-room rules and adding dependency and reuse rules. Resolves #345.
|
||||
- Native work is preserved and paused: tag `native-first-final` marks the last `main` commit before this change, `docs/research/native-roadmap.md`, and archived native-first plan and milestones under `docs/archive/`. GitHub backlog: all native issues except four with assigned contributors and open pull requests were closed as not planned and indexed in `docs/research/native-issue-archive.md`; future-phase issues were parked in the roadmap; only the Phase 1 milestone is open.
|
||||
- Replaced the issue templates with hybrid task, bug, research, performance, validation and documentation forms and added a pull request template. Fixed invalid YAML in the agent-task template. README, CONTRIBUTING and the docs index now describe the hybrid direction.
|
||||
- Replaced our own references to a specific commercial game title (README non-affiliation line, research and integration notes, ignored diagnostics folder names) with generic "commercial title" wording. The ignored folder names are now `diagnostics/title-candidate-*` and `diagnostics/title-check`. Third-party repository names, URLs and code-span paths in research notes are unchanged so their provenance stays accurate. Our own prose references to the upstream project formerly named in the research notes now read "PE-Vulkan project". Added the PortWatch native-macOS research notes. No behavior change.
|
||||
- TLS setup now copies templates from 64 KiB up to 1 MiB straight into the zeroed thread data block, after checking that every template byte is readable, instead of staging them in a second buffer (#111). The pointer array and data block layout, the TLS index write and the error for an unreadable template are unchanged, and nothing is mapped when the template cannot be read. On an Apple M2 Pro, median setup time for original synthetic templates over 31 interleaved samples fell by 21.7 % at 64 KiB, 19.0 % at 256 KiB and 14.2 % at 768 KiB. Smaller and larger templates keep the single staged read and showed no change beyond run-to-run variation.
|
||||
- Removed the contributor avatar section from the README.
|
||||
@@ -45,6 +77,11 @@ remains unsupported.
|
||||
- Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits.
|
||||
|
||||
### Fixed
|
||||
- The hybrid runner now expands a `~` in CrossOver's `BottleDir` preference (reported in review by 1Bartosz).
|
||||
- `betterxen-hybrid run` no longer lets an inherited `CX_GRAPHICS_BACKEND` change the backend while recording none requested (reproduced by IamHeavyLazer in #350); the removed value is recorded.
|
||||
- Run records now sample the Windows program's own memory. The earlier `peak_crossover_rss_kb_sampled` values never included it, because Wine re-parents the program with a drive-letter command line.
|
||||
- A zero-exit run is no longer classified `cannot_execute` because its output mentions that text, non-UTF-8 output no longer empties the log, bottle process matching no longer includes longer bottle names, and launcher spawn errors are recorded.
|
||||
- Hybrid run and benchmark reports now use exclusive, unique filenames and report persistence failures as CLI errors. Earlier reports are preserved; this fixes evidence loss during baseline collection (#398).
|
||||
- Fixed the app's executable inspector so a late result from an earlier selection can no longer replace a newer one (#251). Each selection from the file picker, drag and drop or Finder Open With now takes a request number, and only the latest request may publish its report and status or clear the busy state. The previous report is cleared when a new file is chosen, and a failed inspection of the latest file is shown in red above its report. The read itself is unchanged: size checked before reading, balanced security-scoped access, nothing executed. `BetterXen --smoke-inspection-order`, run by `scripts/build-app.sh`, drives the model with an injected reader that blocks until the check releases each file, so the check (not timing) decides which read finishes first; it checks a stale success, a stale failure and a busy state held for the newer request, and all four checks fail without the change. Checked locally on Apple Silicon; not yet independently reviewed.
|
||||
- Startup reports now reject existing destinations before guest execution, surface journal write failures, and preserve late errors alongside signal termination.
|
||||
- Restored the DBT benchmark report-test fixture after the cache-invalidation counter was added. Its existing percentile, JSON and comparison tests now run in ordinary workspace CI instead of requiring a separate benchmark test-harness command.
|
||||
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
# Contributing to BetterXen
|
||||
|
||||
BetterXen is an experimental Xbox Series X|S recompilation framework for Apple Silicon. Its graphics subsystem, XenoMetal, targets native Metal execution. Contributions should improve verified behavior rather than expand untested claims.
|
||||
BetterXen is hybrid-first Apple Silicon compatibility research built around an externally installed CrossOver, with a preserved but paused independent native implementation. Contributions should improve verified behavior rather than expand untested claims.
|
||||
|
||||
## Which work is active
|
||||
|
||||
The only active development track is the CrossOver-based hybrid architecture in [docs/roadmap.md](docs/roadmap.md). Planning is progressive: only the current milestone (Phase 1) has open issues; ideas for later phases are parked in the roadmap. Native research is paused, its backlog is closed and indexed in [docs/research/native-issue-archive.md](docs/research/native-issue-archive.md), and the few native issues still open only have assigned contributors with open pull requests. Do not start native work; if hybrid development needs a native component, file a focused hybrid issue. Pick an open issue in the current milestone and check its dependencies first. The engineering rules in `AGENTS.md` permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal (subject to licensing) and allow evaluating DXMT, DXVK, VKD3D-Proton and MoltenVK. CrossOver is proprietary: do not bundle or redistribute any of it, and record the exact versions you test. Before adopting or copying any upstream code, verify its license and provenance and add it to the [upstream registry](docs/research/upstream-registry.md); projects built around leaked or unauthorized game builds are not a source of code. Use the issue templates (hybrid task, bug, research, performance, validation, documentation) and fill in the licensing and provenance section.
|
||||
|
||||
## Getting started
|
||||
|
||||
|
||||
Generated
+21
-13
@@ -2,6 +2,27 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "betterxen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"betterxen-hybrid",
|
||||
"xenora-decoder",
|
||||
"xenora-import-gen",
|
||||
"xenora-isa",
|
||||
"xenora-loader",
|
||||
"xenora-metal",
|
||||
"xenora-ref",
|
||||
"xenora-shader",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "betterxen-hybrid"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.2"
|
||||
@@ -149,19 +170,6 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "betterxen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"xenora-decoder",
|
||||
"xenora-import-gen",
|
||||
"xenora-isa",
|
||||
"xenora-loader",
|
||||
"xenora-metal",
|
||||
"xenora-ref",
|
||||
"xenora-shader",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xenora-benchmarks"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# BetterXen
|
||||
|
||||
**Experimental Xbox Series X|S emulation research, built natively for Apple Silicon.**
|
||||
**Hybrid-first Apple Silicon compatibility research built around CrossOver, with preserved independent native ARM64 and Metal research (paused).**
|
||||
|
||||
[](https://github.com/MacosPorters/betterxen/actions/workflows/ci.yml)
|
||||
-1f6feb?logo=apple&logoColor=white)
|
||||
@@ -11,11 +11,14 @@
|
||||

|
||||

|
||||
|
||||
**No Wine. No CrossOver. No Rosetta. No Vulkan runtime.**
|
||||
**The paused native implementation described below uses no Wine, CrossOver, Rosetta or Vulkan runtime. The active hybrid direction intends to use CrossOver and Rosetta 2, subject to research and licensing review.**
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Current direction.** BetterXen's only active development track is a CrossOver-based hybrid architecture: CrossOver (installed externally) as the compatibility foundation, with BetterXen providing whatever integration, configuration, diagnostics, benchmarking and optimization research shows is missing. This is the *intended* architecture, **not a verified Xbox compatibility stack**: no Xbox title has been shown to run through it, and CrossOver is not assumed to provide Xbox runtime compatibility. Work is at the research stage (Phase 1). Planning is progressive: only the current phase has open issues. The independent native implementation described below is **preserved but paused indefinitely**. See the [roadmap](docs/roadmap.md), [ADR 0005](docs/adr/0005-crossover-hybrid-direction.md), the [upstream research registry](docs/research/upstream-registry.md) and the [deferred native roadmap](docs/research/native-roadmap.md). The rewritten engineering rules are in [AGENTS.md](AGENTS.md).
|
||||
|
||||
</div>
|
||||
|
||||
BetterXen is a community-maintained, open-source project written primarily in Rust. It builds and verifies a native, bounded execution environment on Apple Silicon: an independent x86-64 guest path, original PE32+ loading, AMD RDNA 2 shader translation, and a native Apple Metal graphics backend. The host runs as ARM64 code; the x86-64 code being emulated is guest data.
|
||||
BetterXen is a community-maintained, open-source project written primarily in Rust. Its native research implementation (paused) builds and verifies a native, bounded execution environment on Apple Silicon: an independent x86-64 guest path, original PE32+ loading, AMD RDNA 2 shader translation, and a native Apple Metal graphics backend. The host runs as ARM64 code; the x86-64 code being emulated is guest data.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **BetterXen is experimental.** Verified work is restricted to independently authored synthetic programs and shaders. Authentic Xbox executable loading, system-service compatibility and commercial game execution are **not supported**. Progress is measured by reproducible tests, not by estimated game compatibility percentages. See the [current limitations](#current-limitations).
|
||||
@@ -54,72 +57,10 @@ Legend: 🟦 guest loading · 🟩 guest CPU and services · 🟪 shader transla
|
||||
|
||||
---
|
||||
|
||||
## Milestones
|
||||
## Roadmap
|
||||
|
||||
BetterXen's work order is the six [development phases](docs/development-phases.md), which lead to one concrete target: the **first launchable application** (tracker [#311](https://github.com/MacosPorters/betterxen/issues/311)). That target is an original C program, built with native ARM64 tools, that runs through the ARM64 translator, controls its own translated shader pipeline, and shows its Metal frame in the native app window. It is **not** a commercial or authentic Xbox title, and no date or percentage is attached to it.
|
||||
The active plan is the [roadmap](docs/roadmap.md): **Phase 1 — CrossOver Research, Feasibility and Baseline** is the only active phase, and later phases are provisional and will be defined from its findings. The current issues are in the [Phase 1 milestone](https://github.com/MacosPorters/betterxen/milestone/9). The native implementation's six phases and the X1 to X25 capability map are archived in [docs/archive/readme-native-milestones.md](docs/archive/readme-native-milestones.md) and the [native-first plan](docs/archive/development-phases-native-first.md). Native work is paused indefinitely and resumes only after an explicit maintainer decision.
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'fontFamily':'system-ui, sans-serif','lineColor':'#6e7781'}}}%%
|
||||
flowchart LR
|
||||
P1["<b>Phase 1</b><br/>Trustworthy baseline"]:::wip --> P2["<b>Phase 2</b><br/>Hosted C application"]:::wip
|
||||
P2 --> P3["<b>Phase 3</b><br/>Coherent threading"]:::wip
|
||||
P3 --> P4["<b>Phase 4</b><br/>Resource updates<br/>to translated rendering"]:::wip
|
||||
P4 --> P5["<b>Phase 5</b><br/>One integrated<br/>interactive application"]:::plan
|
||||
P5 --> P6["<b>Phase 6</b><br/>Measured performance"]:::plan
|
||||
P2 --> L(["<b>First launchable app</b><br/>issue 311"]):::goal
|
||||
P4 --> L
|
||||
classDef wip fill:#fff8c5,stroke:#9a6700,color:#4d2d00
|
||||
classDef plan fill:#eaeef2,stroke:#8c959f,color:#24292f
|
||||
classDef goal fill:#dafbe1,stroke:#1a7f37,color:#0f5323,stroke-width:3px
|
||||
```
|
||||
|
||||
<sub>🟨 work under way · ⬜ not started · 🟩 the next original-workload target. Nothing here is independently accepted.</sub>
|
||||
|
||||
| Phase | Goal | State | What exists now |
|
||||
| --- | --- | --- | --- |
|
||||
| **1 · Baseline** | Contributors can tell what exists on `main`, what is pending review, and which checks ran | 🟡 In progress | CODEOWNERS review, a fast repository hygiene check, claim-before-work rules, generated status tables and claim audits |
|
||||
| **2 · Hosted C application** | An original hosted C program starts, uses the runtime, reports results and exits with checked cleanup | 🟡 In progress | CRT startup, arguments, exit handlers, formatted output, file streams and the hosted-C fixture (A2) are integrated; a stdio follow-up is still open and the result is not independently accepted |
|
||||
| **3 · Threaded behavior** | A worker-based application can block and resume without stalling other guest work | 🟡 In progress | Deterministic scheduler, guest thread contexts, guarded stacks and thread services. Guest `Sleep` still delays all guest threads (#304); worker TLS and callback lifecycle is a design draft (#312) |
|
||||
| **4 · Resource updates to rendering** | A guest updates a texture and geometry, submits translated rendering and gets a checked frame | 🟡 In progress | Persistent resources, descriptor-table texture binding, translated vertex and pixel stages, blend, depth and indexed draws. Guest-selected pipelines and the typed graphics bridge are open (#314–#316) |
|
||||
| **5 · Integrated interactive app** | Guest execution, rendering, input, audio, filesystem and lifecycle in one session | ⚪ Planned | Swift app with frame loop, input, audio and sandboxed filesystem fixtures exists, but those demonstrations are not guest-integration evidence |
|
||||
| **6 · Measured performance** | Faster execution of workloads whose correctness is already checked | ⚪ Planned | Startup, DBT and TLS measurements recorded; bottlenecks are chosen from measurements, not assumed |
|
||||
|
||||
The launch milestone's proposed acceptance is **60 bounded frames containing two independently distinguishable guest-controlled states, then a clean close and one restart**. Sixty is a fixture criterion, not a measured frame rate. The work is tracked as issues [#313](https://github.com/MacosPorters/betterxen/issues/313)–[#323](https://github.com/MacosPorters/betterxen/issues/323).
|
||||
|
||||
<details>
|
||||
<summary><b>Capability reference: the original X1–X25 map</b></summary>
|
||||
|
||||
The X1–X25 names are an older, broad capability map. Keep them as a reference; use the phases above for the next work order. X10–X25 are proposed engineering milestones, not completed implementations or a guaranteed sequence.
|
||||
|
||||
| Milestone | Implementation | Status |
|
||||
| --- | --- | --- |
|
||||
| X1 — Guest CPU | Bounded x86-64 instruction execution on ARM64 macOS | Verified |
|
||||
| X2 — Executable loading | Loading original fixed-base PE32+ test executables | Verified |
|
||||
| X3 — GPU compute | Guest-submitted Metal compute workloads and readback | Verified |
|
||||
| X4 — Metal rendering | Guest-driven offscreen rendering using authored Metal shaders | Verified |
|
||||
| X5 — Guest execution expansion | Additional bounded CPU execution and fixture coverage | Implemented |
|
||||
| X6 — Guest control flow | Nested calls, returns, checked memory and synthetic PE execution | Verified |
|
||||
| X7 — Imported services | Named imports, guest-to-host service dispatch and result validation | Verified |
|
||||
| X8 — Translated compute | Original gfx1030 compute shaders executing on Metal, partial Wave32 handling and BC1 readback | Verified subset |
|
||||
| X9 — Translated graphics | Persistent resource handles, translated vertex/pixel stages and offscreen Metal rendering | Verified subset |
|
||||
| X10 — Texture sampling | One translated `image_sample_lz` pixel stage with point/clamp sampling of RGBA8 and BC1 2D textures bound through descriptor tables, locally verified on Apple M5 Pro; upload, readback and decode of BC compressed formats (see [Texture support](#texture-support)). Other image instructions and formats are not implemented | Implemented subset |
|
||||
| X11 — Graphics pipeline | Bounded multi-draw passes into offscreen RGBA8 targets: translated vertex and pixel stages, indexed triangle draws, colour write masks and blend state | Implemented |
|
||||
| X12 — Wave execution | Expand Wave32/Wave64 semantics, divergent control flow, cross-lane operations, LDS and barriers | Planned |
|
||||
| X13 — Advanced shaders | Mesh, geometry and additional compute shader capabilities with verified Metal execution | Planned |
|
||||
| X14 — CPU recompilation | Native ARM64 dynamic recompilation of supported x86-64 instructions in synthetic fixtures | Implemented subset |
|
||||
| X15 — Executable compatibility | Static PE inspection reports sections, relocations, thread-local storage (TLS) callbacks, imports and entry-point instructions | Static probe implemented |
|
||||
| X16 — Guest memory and threading | Virtual memory mapping, thread scheduling, synchronization primitives and atomic operations | Implemented subset |
|
||||
| X17 — System services | Implement a tested subset of Xbox-compatible runtime APIs, memory services, filesystem access and application lifecycle | Implemented subset |
|
||||
| X18 — Graphics API translation | Translate supported Xbox graphics commands, resource descriptors, command queues, barriers and fences into Metal operations | Planned |
|
||||
| X19 — Advanced GPU features | Indirect rendering, asynchronous compute, additional texture formats and ray-tracing compatibility research | Planned |
|
||||
| X20 — Integrated guest runtime | Connect CPU recompilation, executable loading, system services and graphics translation into one persistent runtime | Planned |
|
||||
| X21 — Application compatibility | Execute increasingly complex independently authored applications through the complete guest CPU and GPU pipeline | Planned |
|
||||
| X22 — First application boot | Establish a reproducible startup and error-reporting path for supported game-like applications | Planned |
|
||||
| X23 — Initial game compatibility | Investigate startup and execution of legally supported game software, identifying missing runtime and graphics behavior | Long-term goal |
|
||||
| X24 — Gameplay and performance | Expand rendering correctness, input, audio, memory management, shader caching and execution performance | Long-term goal |
|
||||
| X25 — Running games | Achieve reproducible, stable execution of compatible games on native Apple Silicon macOS using Metal | Long-term goal |
|
||||
|
||||
</details>
|
||||
|
||||
All existing verification refers to independently authored synthetic programs and shaders. Commercial-game compatibility remains unverified.
|
||||
|
||||
@@ -490,7 +431,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md), [docs/legal.md](docs/legal.md) and the [
|
||||
|
||||
### Where the work is heading
|
||||
|
||||
See the [milestones](#milestones) for proposed milestones, and the [changelog](CHANGELOG.md) for the current unreleased additions, such as the native blend pass, indexed draws and the depth pass. The remaining research steps are the outstanding items in [current limitations](#current-limitations).
|
||||
See the [roadmap](docs/roadmap.md) for the current phase and the [changelog](CHANGELOG.md) for unreleased additions. The paused native implementation's open research items are listed under [current limitations](#current-limitations).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -15,3 +15,5 @@ Cargo resolves the Rust packages from crates.io at the source checksums in [Carg
|
||||
[LLVM 23.1.6](https://github.com/llvm/llvm-project/tree/5b10d2d74929eae78912771222c9855af97496f4) is used as an external fixture tool under Apache-2.0 WITH LLVM-exception. Xcode and Metal are separate Apple tools under Apple's license terms.
|
||||
|
||||
The [isolated fuzz workspace](fuzz/Cargo.lock) resolves developer-only dependencies, including [libfuzzer-sys](https://github.com/rust-fuzz/libfuzzer/tree/719e4efb9b8857ebaa782ae59376c8cbb78fed0f). See the [fuzz dependency inventory](docs/licenses.md#fuzz-development-dependencies) for locked revisions and selected licenses.
|
||||
|
||||
llvm-mingw release 20261117 is used as an external build tool for original Windows test programs under Apache-2.0 with LLVM exceptions plus its component licences; nothing from it is shipped or copied (see [hybrid-toolchain](docs/research/hybrid-toolchain.md)). `crates/hybrid/src/memory.rs` is a Rust reimplementation of the memory-guard logic in skakwy's [victory-mac](https://github.com/skakwy/victory-mac) `mac/run-victory.sh` (commit 22b3f8e45a59, GPL-3.0), used with the author's permission. The stall detection and memory-settle logic in `crates/hybrid/src/run.rs` follows supervision lessons from the same repository (`mac/PROGRESS.md`, `crates/victory-core/src/notes.rs`) and is reimplemented, not copied.
|
||||
@@ -9,6 +9,7 @@ rust-version.workspace = true
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
betterxen-hybrid = { path = "../hybrid" }
|
||||
xenora-decoder = { path = "../decoder" }
|
||||
xenora-isa = { path = "../isa" }
|
||||
xenora-metal = { path = "../metal" }
|
||||
|
||||
@@ -43,6 +43,10 @@ fn main() -> ExitCode {
|
||||
}
|
||||
},
|
||||
Some("run") => runner::command(std::env::args_os().skip(2)),
|
||||
// Windows programs through an installed CrossOver: the active hybrid path.
|
||||
Some("hybrid") => {
|
||||
betterxen_hybrid::cli::run_cli(&std::env::args().skip(2).collect::<Vec<_>>())
|
||||
}
|
||||
Some("imports") => imports_command(std::env::args().skip(2).collect()),
|
||||
Some("shaders") => shaders::command(&std::env::args().skip(2).collect::<Vec<_>>()),
|
||||
Some("probe") => {
|
||||
@@ -137,7 +141,7 @@ fn main() -> ExitCode {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
eprintln!("usage: betterxen <info|demo|inspect|probe|run|imports|shaders>");
|
||||
eprintln!("usage: betterxen <hybrid|info|demo|inspect|probe|run|imports|shaders>");
|
||||
ExitCode::from(2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "betterxen-hybrid"
|
||||
description = "Host receipt, CrossOver discovery, frame-time statistics and Windows cross-toolchain probes for the hybrid direction"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "betterxen-hybrid"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# signal handling and process groups; already used by the native loader
|
||||
libc = "0.2"
|
||||
@@ -0,0 +1,569 @@
|
||||
//! Command-line interface of the hybrid tooling.
|
||||
|
||||
use crate::{crossover, frames, host, json::Json, memory, pe, preflight, run, toolchain};
|
||||
use std::path::PathBuf;
|
||||
use std::process::ExitCode;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
const USAGE: &str = "usage: betterxen hybrid <command>
|
||||
host host receipt (JSON)
|
||||
crossover [--app P] CrossOver installs and documented preferences (JSON)
|
||||
toolchain Windows cross-compilers found on PATH (JSON)
|
||||
frames <file> frame-time statistics; file has one interval in ms per line (JSON)
|
||||
guard [--min-start-free N] [--min-free N] -- CMD ARGS...
|
||||
run CMD; refuse to start / stop it when free memory is low
|
||||
doctor [--bottle B] [--min-start-free N]
|
||||
check that a run could start here (JSON); non-zero exit if not
|
||||
inspect <file.exe> identify a Windows executable: machine, subsystem, imports (JSON)
|
||||
run --bottle B [--backend d3dmetal|dxmt|dxvk|wined3d] [--timeout S] [--stall-timeout S]
|
||||
[--settle-bound S] [--expect TEXT] [--require-gates a,b,c] [--out DIR]
|
||||
[--min-start-free N] [--min-free N] -- EXE [ARGS...]
|
||||
run a Windows program through CrossOver; write a JSON record
|
||||
bench --bottle B --backends a,b,c [--repeat N] [same options] -- EXE [ARGS...]
|
||||
run the program per backend N times; summarise frame times
|
||||
stop --bottle B stop every Windows process in a bottle (recovery)
|
||||
receipt host + crossover + toolchain in one JSON document
|
||||
|
||||
run and bench also accept: --env NAME=VALUE (repeatable), --inherit-env true, --keep-output true.
|
||||
The child otherwise receives only a short allowlist of host variables. A bottle is not a sandbox.";
|
||||
|
||||
/// Set by the signal handler; every run polls it.
|
||||
static INTERRUPTED: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
extern "C" fn on_signal(_: libc::c_int) {
|
||||
// Storing to an atomic is async-signal-safe.
|
||||
INTERRUPTED.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
fn install_signal_handlers() {
|
||||
let handler = on_signal as extern "C" fn(libc::c_int) as libc::sighandler_t;
|
||||
for signal in [libc::SIGINT, libc::SIGTERM, libc::SIGHUP] {
|
||||
// SAFETY: `on_signal` has the required signature and only touches an atomic.
|
||||
unsafe { libc::signal(signal, handler) };
|
||||
}
|
||||
}
|
||||
|
||||
fn crossover_json(app: Option<PathBuf>) -> Json {
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let cands = match app {
|
||||
Some(p) => vec![p],
|
||||
None => crossover::candidate_paths(&home),
|
||||
};
|
||||
let installs = crossover::discover(&cands);
|
||||
Json::obj(vec![
|
||||
("installed", Json::Bool(!installs.is_empty())),
|
||||
(
|
||||
"installs",
|
||||
Json::Arr(installs.iter().map(|i| i.to_json()).collect()),
|
||||
),
|
||||
(
|
||||
"bottle_dir_preference",
|
||||
Json::opt_str(crossover::preference("BottleDir")),
|
||||
),
|
||||
(
|
||||
"managed_bottle_dirs_preference",
|
||||
Json::opt_str(crossover::preference("ManagedBottleDirs")),
|
||||
),
|
||||
(
|
||||
"searched",
|
||||
Json::Arr(
|
||||
cands
|
||||
.iter()
|
||||
.map(|p| Json::str(p.display().to_string()))
|
||||
.collect(),
|
||||
),
|
||||
),
|
||||
(
|
||||
"note",
|
||||
Json::str(
|
||||
"Only Info.plist metadata, lipo -archs and documented defaults keys are read. Bottle graphics backend and bundle internals are not interpreted (undocumented, #350).",
|
||||
),
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
fn toolchain_json() -> Json {
|
||||
let path = std::env::var("PATH").unwrap_or_default();
|
||||
Json::Arr(
|
||||
toolchain::probe(&path)
|
||||
.iter()
|
||||
.map(|c| c.to_json())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
fn guard(args: &[String]) -> ExitCode {
|
||||
let mut limits = memory::Limits {
|
||||
min_start_free: 70,
|
||||
min_free: 20,
|
||||
poll: std::time::Duration::from_secs(1),
|
||||
grace: std::time::Duration::from_secs(10),
|
||||
};
|
||||
let mut i = 0;
|
||||
while i < args.len() && args[i] != "--" {
|
||||
let v = args.get(i + 1).and_then(|v| v.parse::<u8>().ok());
|
||||
match (args[i].as_str(), v) {
|
||||
("--min-start-free", Some(v)) => limits.min_start_free = v,
|
||||
("--min-free", Some(v)) => limits.min_free = v,
|
||||
_ => {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
let Some(cmd) = args.get(i + 1) else {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
};
|
||||
match memory::supervise(cmd, &args[i + 2..], limits, &mut memory::free_percentage) {
|
||||
memory::Outcome::Exited(Some(0)) => ExitCode::SUCCESS,
|
||||
memory::Outcome::Exited(c) => ExitCode::from(c.map_or(1, |c| c.clamp(1, 255)) as u8),
|
||||
other => {
|
||||
eprintln!("guard: {other:?}");
|
||||
ExitCode::from(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RunArgs {
|
||||
cfg: run::RunConfig,
|
||||
backends: Vec<String>,
|
||||
repeat: u32,
|
||||
out: Option<PathBuf>,
|
||||
/// What the program file is, recorded with every run.
|
||||
executable: Json,
|
||||
}
|
||||
|
||||
fn parse_run_args(args: &[String]) -> Result<RunArgs, String> {
|
||||
let mut bottle = None;
|
||||
let mut backend = None;
|
||||
let mut backends = Vec::new();
|
||||
let mut repeat = 1u32;
|
||||
let mut timeout = 300u64;
|
||||
let mut stall = None;
|
||||
let mut settle = 60u64;
|
||||
let mut expect = None;
|
||||
let mut require_gates = Vec::new();
|
||||
let mut out = None;
|
||||
let (mut min_start, mut min_free) = (50u8, 15u8);
|
||||
let (mut inherit_env, mut keep_output) = (false, false);
|
||||
let mut env = Vec::new();
|
||||
let mut i = 0;
|
||||
while i < args.len() && args[i] != "--" {
|
||||
let v = args
|
||||
.get(i + 1)
|
||||
.ok_or_else(|| format!("{} needs a value", args[i]))?
|
||||
.clone();
|
||||
match args[i].as_str() {
|
||||
"--bottle" => bottle = Some(v),
|
||||
"--backend" => backend = Some(v),
|
||||
"--backends" => backends = v.split(',').map(String::from).collect(),
|
||||
"--repeat" => repeat = v.parse().map_err(|_| "bad --repeat")?,
|
||||
"--timeout" => timeout = v.parse().map_err(|_| "bad --timeout")?,
|
||||
"--stall-timeout" => stall = Some(v.parse().map_err(|_| "bad --stall-timeout")?),
|
||||
"--settle-bound" => settle = v.parse().map_err(|_| "bad --settle-bound")?,
|
||||
"--expect" => expect = Some(v),
|
||||
"--env" => {
|
||||
let (name, value) = v.split_once('=').ok_or("--env needs NAME=VALUE")?;
|
||||
if name.is_empty() || name.contains('\0') {
|
||||
return Err("--env needs NAME=VALUE".into());
|
||||
}
|
||||
if name.starts_with("CX_GRAPHICS_BACKEND") {
|
||||
return Err("select the backend with --backend, not --env".into());
|
||||
}
|
||||
if name.starts_with("DYLD_") {
|
||||
return Err("DYLD_ variables are not passed to the launcher".into());
|
||||
}
|
||||
env.push((name.to_string(), value.to_string()));
|
||||
}
|
||||
"--inherit-env" => inherit_env = v.parse().map_err(|_| "bad --inherit-env")?,
|
||||
"--keep-output" => keep_output = v.parse().map_err(|_| "bad --keep-output")?,
|
||||
"--require-gates" => require_gates = v.split(',').map(String::from).collect(),
|
||||
"--out" => out = Some(PathBuf::from(v)),
|
||||
"--min-start-free" => min_start = v.parse().map_err(|_| "bad --min-start-free")?,
|
||||
"--min-free" => min_free = v.parse().map_err(|_| "bad --min-free")?,
|
||||
o => return Err(format!("unknown option {o}")),
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
let program = args.get(i + 1).ok_or("missing program after --")?.clone();
|
||||
let bottle: String = bottle.ok_or("--bottle is required")?;
|
||||
if !preflight::valid_bottle_name(&bottle) {
|
||||
return Err(format!("invalid bottle name {bottle:?}"));
|
||||
}
|
||||
if let Some(unknown) = backend
|
||||
.iter()
|
||||
.chain(backends.iter().filter(|b| *b != "default"))
|
||||
.find(|b| !run::BACKENDS.contains(&b.as_str()))
|
||||
{
|
||||
return Err(format!(
|
||||
"unknown backend {unknown:?} (CrossOver would ignore it silently); use one of {}",
|
||||
run::BACKENDS.join(", ")
|
||||
));
|
||||
}
|
||||
if program.starts_with('-') {
|
||||
return Err("the program path must not start with '-' (write ./name.exe)".into());
|
||||
}
|
||||
let executable = identify(std::path::Path::new(&program))?;
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let installs = crossover::discover(&crossover::candidate_paths(&home));
|
||||
let install = installs.first().ok_or("no CrossOver installation found")?;
|
||||
let wine = run::wine_path(&install.path);
|
||||
if !wine.is_file() {
|
||||
return Err(format!(
|
||||
"{} not found in this CrossOver build",
|
||||
wine.display()
|
||||
));
|
||||
}
|
||||
if !run::bottle_prefix(&bottle).join("drive_c").is_dir() {
|
||||
return Err(format!(
|
||||
"bottle {bottle:?} not found at {}",
|
||||
run::bottle_prefix(&bottle).display()
|
||||
));
|
||||
}
|
||||
let work = out
|
||||
.clone()
|
||||
.unwrap_or_else(|| PathBuf::from("artifacts/hybrid-runs"));
|
||||
Ok(RunArgs {
|
||||
cfg: run::RunConfig {
|
||||
wine,
|
||||
bottle,
|
||||
backend,
|
||||
program,
|
||||
args: args[i + 2..].to_vec(),
|
||||
timeout: std::time::Duration::from_secs(timeout),
|
||||
limits: memory::Limits {
|
||||
min_start_free: min_start,
|
||||
min_free,
|
||||
poll: std::time::Duration::from_millis(250),
|
||||
grace: std::time::Duration::from_secs(10),
|
||||
},
|
||||
expect,
|
||||
work_dir: work,
|
||||
stall_timeout: stall.map(std::time::Duration::from_secs),
|
||||
settle_bound: std::time::Duration::from_secs(settle),
|
||||
read_free: memory::free_percentage,
|
||||
require_gates,
|
||||
max_output: 64 << 20,
|
||||
inherit_env,
|
||||
env,
|
||||
keep_output,
|
||||
interrupted: &INTERRUPTED,
|
||||
},
|
||||
backends,
|
||||
repeat,
|
||||
out,
|
||||
executable,
|
||||
})
|
||||
}
|
||||
|
||||
/// Refuse anything that is not a launchable Windows program, and describe what is.
|
||||
fn identify(path: &std::path::Path) -> Result<Json, String> {
|
||||
let image = pe::inspect(path)?;
|
||||
image
|
||||
.check_launchable()
|
||||
.map_err(|e| format!("{}: {e}", path.display()))?;
|
||||
let sha256 = crate::cmdutil::run(
|
||||
"/usr/bin/shasum",
|
||||
&["-a", "256", &path.display().to_string()],
|
||||
)
|
||||
.and_then(|o| o.split_whitespace().next().map(String::from));
|
||||
Ok(Json::obj(vec![
|
||||
("path", Json::str(path.display().to_string())),
|
||||
("sha256", Json::opt_str(sha256)),
|
||||
("image", image.to_json()),
|
||||
]))
|
||||
}
|
||||
|
||||
fn with_executable(mut record: Json, executable: &Json) -> Json {
|
||||
if let Json::Obj(fields) = &mut record {
|
||||
fields.push(("executable".into(), executable.clone()));
|
||||
}
|
||||
record
|
||||
}
|
||||
|
||||
fn doctor(args: &[String]) -> ExitCode {
|
||||
let (mut bottle, mut min_start) = (None, 50u8);
|
||||
let mut it = args.iter();
|
||||
while let Some(a) = it.next() {
|
||||
match (a.as_str(), it.next()) {
|
||||
("--bottle", Some(v)) => bottle = Some(v.clone()),
|
||||
("--min-start-free", Some(v)) if v.parse::<u8>().is_ok() => {
|
||||
min_start = v.parse().unwrap_or(min_start)
|
||||
}
|
||||
_ => {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let install = crossover::discover(&crossover::candidate_paths(&home))
|
||||
.into_iter()
|
||||
.next();
|
||||
let wine = install.as_ref().map(|i| run::wine_path(&i.path));
|
||||
let facts = preflight::gather(
|
||||
bottle.as_deref(),
|
||||
wine.as_deref()
|
||||
.map(|w| (crossover_build().unwrap_or_else(|| "unknown".into()), w)),
|
||||
min_start,
|
||||
);
|
||||
let checks = preflight::evaluate(&facts);
|
||||
print!("{}", preflight::to_json(&checks).render());
|
||||
if checks.iter().all(|c| c.ok) {
|
||||
ExitCode::SUCCESS
|
||||
} else {
|
||||
ExitCode::from(1)
|
||||
}
|
||||
}
|
||||
|
||||
fn crossover_build() -> Option<String> {
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
crossover::discover(&crossover::candidate_paths(&home))
|
||||
.first()
|
||||
.and_then(|i| {
|
||||
Some(format!(
|
||||
"{} ({})",
|
||||
i.short_version.clone()?,
|
||||
i.build_version.clone()?
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
fn save(dir: &std::path::Path, kind: &str, j: &Json) -> Result<(), String> {
|
||||
crate::records::save(dir, kind, j)
|
||||
.map(|path| eprintln!("report saved: {}", path.display()))
|
||||
.map_err(|error| format!("cannot save {kind} report in {}: {error}", dir.display()))
|
||||
}
|
||||
|
||||
fn finish_report(passed: bool, out: Option<&std::path::Path>, kind: &str, j: &Json) -> ExitCode {
|
||||
print!("{}", j.render());
|
||||
if let Some(dir) = out
|
||||
&& let Err(error) = save(dir, kind, j)
|
||||
{
|
||||
eprintln!("{error}");
|
||||
return ExitCode::from(1);
|
||||
}
|
||||
if passed {
|
||||
ExitCode::SUCCESS
|
||||
} else {
|
||||
ExitCode::from(1)
|
||||
}
|
||||
}
|
||||
|
||||
fn run_cmd(args: &[String]) -> ExitCode {
|
||||
let a = match parse_run_args(args) {
|
||||
Ok(a) => a,
|
||||
Err(e) => {
|
||||
eprintln!("{e}\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
};
|
||||
let r = run::execute(&a.cfg, crossover_build());
|
||||
if r.class != run::Class::Passed {
|
||||
eprintln!("run: {}", r.class.name());
|
||||
for g in r.gates.iter().filter(|g| !g.passed) {
|
||||
eprintln!(" gate {} failed: {}", g.name, g.detail);
|
||||
}
|
||||
if let Some(e) = &r.error {
|
||||
eprintln!(" {e}");
|
||||
}
|
||||
}
|
||||
finish_report(
|
||||
r.class == run::Class::Passed,
|
||||
a.out.as_deref(),
|
||||
"run",
|
||||
&with_executable(r.json, &a.executable),
|
||||
)
|
||||
}
|
||||
|
||||
fn bench_cmd(args: &[String]) -> ExitCode {
|
||||
let a = match parse_run_args(args) {
|
||||
Ok(a) if !a.backends.is_empty() => a,
|
||||
Ok(_) => {
|
||||
eprintln!("bench needs --backends\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e}\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
};
|
||||
let build = crossover_build();
|
||||
let mut per_backend = Vec::new();
|
||||
let mut all_ok = true;
|
||||
for b in &a.backends {
|
||||
let mut runs = Vec::new();
|
||||
for _ in 0..a.repeat {
|
||||
if INTERRUPTED.load(Ordering::SeqCst) {
|
||||
all_ok = false;
|
||||
break;
|
||||
}
|
||||
let mut cfg = a.cfg.clone();
|
||||
cfg.backend = if b == "default" {
|
||||
None
|
||||
} else {
|
||||
Some(b.clone())
|
||||
};
|
||||
let r = run::execute(&cfg, build.clone());
|
||||
all_ok &= r.class == run::Class::Passed;
|
||||
runs.push(with_executable(r.json, &a.executable));
|
||||
}
|
||||
per_backend.push(Json::obj(vec![
|
||||
("backend", Json::str(b.clone())),
|
||||
("runs", Json::Arr(runs)),
|
||||
]));
|
||||
}
|
||||
let doc = Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-bench/0")),
|
||||
("repeat", Json::Num(a.repeat as f64)),
|
||||
("host", host::collect().to_json()),
|
||||
("results", Json::Arr(per_backend)),
|
||||
]);
|
||||
finish_report(all_ok, a.out.as_deref(), "bench", &doc)
|
||||
}
|
||||
|
||||
fn stop(args: &[String]) -> ExitCode {
|
||||
let [flag, bottle] = args else {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
};
|
||||
if flag != "--bottle" || !preflight::valid_bottle_name(bottle) {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let Some(install) = crossover::discover(&crossover::candidate_paths(&home))
|
||||
.into_iter()
|
||||
.next()
|
||||
else {
|
||||
eprintln!("no CrossOver installation found");
|
||||
return ExitCode::from(1);
|
||||
};
|
||||
if !run::bottle_prefix(bottle).join("drive_c").is_dir() {
|
||||
eprintln!("bottle {bottle:?} not found");
|
||||
return ExitCode::from(1);
|
||||
}
|
||||
run::stop_bottle(&run::wine_path(&install.path), bottle);
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
/// Entry point shared by `betterxen hybrid` and the `betterxen-hybrid` binary. `args` excludes
|
||||
/// the program name and the `hybrid` word.
|
||||
pub fn run_cli(args: &[String]) -> ExitCode {
|
||||
let rest = args.get(1..).unwrap_or_default();
|
||||
match args.first().map(String::as_str) {
|
||||
Some("run") => {
|
||||
install_signal_handlers();
|
||||
return run_cmd(rest);
|
||||
}
|
||||
Some("bench") => {
|
||||
install_signal_handlers();
|
||||
return bench_cmd(rest);
|
||||
}
|
||||
Some("doctor") => return doctor(rest),
|
||||
Some("guard") => return guard(rest),
|
||||
Some("stop") => return stop(rest),
|
||||
_ => {}
|
||||
}
|
||||
let result: Result<Json, String> = match args.first().map(String::as_str) {
|
||||
Some("host") => Ok(host::collect().to_json()),
|
||||
Some("inspect") => match args.get(1) {
|
||||
None => Err("inspect needs a file".into()),
|
||||
Some(f) => pe::inspect(std::path::Path::new(f)).map(|i| i.to_json()),
|
||||
},
|
||||
Some("crossover") => {
|
||||
let app = match args.get(1).map(String::as_str) {
|
||||
Some("--app") => args.get(2).map(PathBuf::from),
|
||||
_ => None,
|
||||
};
|
||||
Ok(crossover_json(app))
|
||||
}
|
||||
Some("toolchain") => Ok(toolchain_json()),
|
||||
Some("frames") => match args.get(1) {
|
||||
None => Err("frames needs a file".into()),
|
||||
Some(f) => std::fs::read_to_string(f)
|
||||
.map_err(|e| format!("{f}: {e}"))
|
||||
.and_then(|t| frames::parse_intervals(&t).map_err(|e| e.to_string()))
|
||||
.and_then(|v| frames::analyze(&v).map_err(|e| e.to_string()))
|
||||
.map(|s| s.to_json()),
|
||||
},
|
||||
Some("receipt") => Ok(Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-receipt/0")),
|
||||
("host", host::collect().to_json()),
|
||||
("crossover", crossover_json(None)),
|
||||
("windows_cross_compilers", toolchain_json()),
|
||||
])),
|
||||
_ => Err(USAGE.into()),
|
||||
};
|
||||
match result {
|
||||
Ok(j) => {
|
||||
print!("{}", j.render());
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
ExitCode::from(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod report_tests {
|
||||
use super::*;
|
||||
|
||||
fn args(a: &[&str]) -> Vec<String> {
|
||||
a.iter().map(|s| s.to_string()).collect()
|
||||
}
|
||||
|
||||
// These fail before CrossOver discovery, so they run on hosts without CrossOver.
|
||||
#[test]
|
||||
fn bad_backend_bottle_or_program_is_refused_before_launch() {
|
||||
let err = |a: &[&str]| parse_run_args(&args(a)).err().unwrap();
|
||||
assert!(
|
||||
err(&["--bottle", "b", "--backend", "dmxt", "--", "x.exe"]).contains("unknown backend")
|
||||
);
|
||||
assert!(
|
||||
err(&["--bottle", "b", "--backends", "default,typo", "--", "x.exe"])
|
||||
.contains("unknown backend")
|
||||
);
|
||||
assert!(err(&["--bottle", "../b", "--", "x.exe"]).contains("invalid bottle"));
|
||||
assert!(err(&["--bottle", "b", "--", "/nonexistent/x.exe"]).contains("/nonexistent/x.exe"));
|
||||
assert!(err(&["--bottle", "b", "--", "/bin/sh"]).contains("not a PE"));
|
||||
assert!(err(&["--bottle", "b", "--", "--help"]).contains("must not start with"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn requested_evidence_failure_overrides_a_passing_workload() {
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"bx-report-invalid-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
));
|
||||
std::fs::write(&path, "keep this file").unwrap();
|
||||
for kind in ["run", "bench"] {
|
||||
assert_eq!(
|
||||
finish_report(true, Some(&path), kind, &Json::Null),
|
||||
ExitCode::from(1)
|
||||
);
|
||||
}
|
||||
assert_eq!(std::fs::read_to_string(&path).unwrap(), "keep this file");
|
||||
std::fs::remove_file(path).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stdout_only_reporting_preserves_workload_status() {
|
||||
assert_eq!(
|
||||
finish_report(true, None, "run", &Json::Null),
|
||||
ExitCode::SUCCESS
|
||||
);
|
||||
assert_eq!(
|
||||
finish_report(false, None, "bench", &Json::Null),
|
||||
ExitCode::from(1)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//! Run a system tool and capture trimmed stdout. A missing tool or non-zero exit is `None`,
|
||||
//! never a guessed value.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
pub fn run(program: &str, args: &[&str]) -> Option<String> {
|
||||
let out = Command::new(program).args(args).output().ok()?;
|
||||
if !out.status.success() {
|
||||
return None;
|
||||
}
|
||||
let s = String::from_utf8_lossy(&out.stdout).trim().to_string();
|
||||
Some(s)
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
//! Discover installed CrossOver bundles and read standard bundle metadata.
|
||||
//!
|
||||
//! Only documented or standard macOS interfaces are used: the app bundle's `Info.plist`
|
||||
//! (read through `plutil`), `lipo -archs` on the bundle's main executable, and the
|
||||
//! `defaults` keys CodeWeavers documents in "Advanced CrossOver Mac Configuration"
|
||||
//! (`BottleDir`, `ManagedBottleDirs` in `com.codeweavers.CrossOver`). Bundle internals such
|
||||
//! as `Contents/SharedSupport` are NOT interpreted: they are undocumented and not a stable
|
||||
//! interface (#350). The graphics backend of a bottle is deliberately not read.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub const BUNDLE_ID: &str = "com.codeweavers.CrossOver";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Install {
|
||||
pub path: PathBuf,
|
||||
pub bundle_id: Option<String>,
|
||||
pub short_version: Option<String>,
|
||||
pub build_version: Option<String>,
|
||||
pub executable_archs: Option<Vec<String>>,
|
||||
pub minimum_macos: Option<String>,
|
||||
}
|
||||
|
||||
/// Candidate bundle locations: standard application directories. Spotlight is consulted too.
|
||||
pub fn candidate_paths(home: &Path) -> Vec<PathBuf> {
|
||||
let mut v = vec![
|
||||
PathBuf::from("/Applications/CrossOver.app"),
|
||||
home.join("Applications/CrossOver.app"),
|
||||
];
|
||||
if let Some(found) = run(
|
||||
"/usr/bin/mdfind",
|
||||
&[&format!("kMDItemCFBundleIdentifier == '{BUNDLE_ID}'")],
|
||||
) {
|
||||
for line in found.lines().filter(|l| !l.is_empty()) {
|
||||
let p = PathBuf::from(line);
|
||||
if !v.contains(&p) {
|
||||
v.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
pub fn discover(candidates: &[PathBuf]) -> Vec<Install> {
|
||||
candidates.iter().filter_map(|p| inspect(p)).collect()
|
||||
}
|
||||
|
||||
/// Inspect one bundle. Returns None if the path has no readable `Contents/Info.plist`.
|
||||
pub fn inspect(app: &Path) -> Option<Install> {
|
||||
let plist = app.join("Contents/Info.plist");
|
||||
if !plist.is_file() {
|
||||
return None;
|
||||
}
|
||||
let json = run(
|
||||
"/usr/bin/plutil",
|
||||
&["-convert", "json", "-o", "-", plist.to_str()?],
|
||||
)?;
|
||||
let exe = crate::host_string(&json, "CFBundleExecutable");
|
||||
let archs = exe.and_then(|e| {
|
||||
let p = app.join("Contents/MacOS").join(e);
|
||||
run("/usr/bin/lipo", &["-archs", p.to_str()?])
|
||||
.map(|s| s.split_whitespace().map(String::from).collect())
|
||||
});
|
||||
Some(Install {
|
||||
path: app.to_path_buf(),
|
||||
bundle_id: crate::host_string(&json, "CFBundleIdentifier"),
|
||||
short_version: crate::host_string(&json, "CFBundleShortVersionString"),
|
||||
build_version: crate::host_string(&json, "CFBundleVersion"),
|
||||
executable_archs: archs,
|
||||
minimum_macos: crate::host_string(&json, "LSMinimumSystemVersion"),
|
||||
})
|
||||
}
|
||||
|
||||
/// A documented CrossOver preference, or None when unset or unreadable.
|
||||
pub fn preference(key: &str) -> Option<String> {
|
||||
run("/usr/bin/defaults", &["read", BUNDLE_ID, key])
|
||||
}
|
||||
|
||||
impl Install {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("path", Json::str(self.path.display().to_string())),
|
||||
("bundle_id", Json::opt_str(self.bundle_id.clone())),
|
||||
("short_version", Json::opt_str(self.short_version.clone())),
|
||||
("build_version", Json::opt_str(self.build_version.clone())),
|
||||
(
|
||||
"executable_archs",
|
||||
self.executable_archs.as_ref().map_or(Json::Null, |a| {
|
||||
Json::Arr(a.iter().map(|s| Json::str(s.clone())).collect())
|
||||
}),
|
||||
),
|
||||
("minimum_macos", Json::opt_str(self.minimum_macos.clone())),
|
||||
(
|
||||
"bundle_id_is_codeweavers_crossover",
|
||||
Json::Bool(self.bundle_id.as_deref() == Some(BUNDLE_ID)),
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs;
|
||||
|
||||
// A synthetic bundle written by the test: it proves the metadata path, not that
|
||||
// any real CrossOver build has this layout.
|
||||
fn fake_bundle(dir: &Path) -> PathBuf {
|
||||
let app = dir.join("CrossOver.app");
|
||||
fs::create_dir_all(app.join("Contents/MacOS")).unwrap();
|
||||
fs::write(
|
||||
app.join("Contents/Info.plist"),
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
<key>CFBundleExecutable</key><string>CrossOver</string>
|
||||
<key>CFBundleIdentifier</key><string>com.codeweavers.CrossOver</string>
|
||||
<key>CFBundleShortVersionString</key><string>99.1.2</string>
|
||||
<key>CFBundleVersion</key><string>12345</string>
|
||||
<key>LSMinimumSystemVersion</key><string>14.0</string>
|
||||
</dict></plist>"#,
|
||||
)
|
||||
.unwrap();
|
||||
// Copy a real system executable so `lipo -archs` has a Mach-O to read.
|
||||
fs::copy("/usr/bin/true", app.join("Contents/MacOS/CrossOver")).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_bundle_metadata() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let tmp = std::env::temp_dir().join(format!("bxhybrid-co-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&tmp);
|
||||
fs::create_dir_all(&tmp).unwrap();
|
||||
let app = fake_bundle(&tmp);
|
||||
let i = inspect(&app).expect("inspect");
|
||||
assert_eq!(i.short_version.as_deref(), Some("99.1.2"));
|
||||
assert_eq!(i.build_version.as_deref(), Some("12345"));
|
||||
assert_eq!(i.minimum_macos.as_deref(), Some("14.0"));
|
||||
assert_eq!(i.bundle_id.as_deref(), Some(BUNDLE_ID));
|
||||
assert!(
|
||||
i.executable_archs.as_ref().is_some_and(|a| !a.is_empty()),
|
||||
"{:?}",
|
||||
i.executable_archs
|
||||
);
|
||||
assert_eq!(discover(&[app.clone(), tmp.join("Missing.app")]).len(), 1);
|
||||
fs::remove_dir_all(&tmp).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_or_plistless_bundle_is_none() {
|
||||
let tmp = std::env::temp_dir().join(format!("bxhybrid-co2-{}", std::process::id()));
|
||||
fs::create_dir_all(tmp.join("X.app/Contents")).unwrap();
|
||||
assert!(inspect(&tmp.join("X.app")).is_none());
|
||||
assert!(inspect(&tmp.join("Nope.app")).is_none());
|
||||
fs::remove_dir_all(&tmp).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
//! Frame-time statistics from a list of frame intervals in milliseconds (issue #145).
|
||||
//!
|
||||
//! Percentiles use the nearest-rank method on the sorted intervals: the p-th percentile is
|
||||
//! the value at rank ceil(p/100 * n) (1-based). "1 % low FPS" is 1000 divided by the 99th
|
||||
//! percentile interval. These definitions are fixed here so reports are comparable; other
|
||||
//! tools define lows differently (for example as the mean of the worst 1 %).
|
||||
|
||||
use crate::json::Json;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct FrameStats {
|
||||
pub frames: usize,
|
||||
pub total_ms: f64,
|
||||
pub mean_ms: f64,
|
||||
pub avg_fps: f64,
|
||||
pub min_ms: f64,
|
||||
pub max_ms: f64,
|
||||
pub p50_ms: f64,
|
||||
pub p95_ms: f64,
|
||||
pub p99_ms: f64,
|
||||
pub p999_ms: f64,
|
||||
pub low_1pct_fps: f64,
|
||||
pub low_01pct_fps: f64,
|
||||
/// Frames longer than twice the median interval.
|
||||
pub stutters: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FrameError {
|
||||
Empty,
|
||||
Invalid { index: usize, value: f64 },
|
||||
Parse { line: usize, text: String },
|
||||
}
|
||||
|
||||
impl std::fmt::Display for FrameError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
FrameError::Empty => write!(f, "no frame intervals"),
|
||||
FrameError::Invalid { index, value } => {
|
||||
write!(
|
||||
f,
|
||||
"frame {index}: interval {value} is not a positive finite number of milliseconds"
|
||||
)
|
||||
}
|
||||
FrameError::Parse { line, text } => {
|
||||
write!(f, "line {line}: cannot parse {text:?} as milliseconds")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for FrameError {}
|
||||
|
||||
fn nearest_rank(sorted: &[f64], pct: f64) -> f64 {
|
||||
let n = sorted.len();
|
||||
let rank = ((pct / 100.0) * n as f64).ceil().max(1.0) as usize;
|
||||
sorted[rank.min(n) - 1]
|
||||
}
|
||||
|
||||
pub fn analyze(intervals_ms: &[f64]) -> Result<FrameStats, FrameError> {
|
||||
if intervals_ms.is_empty() {
|
||||
return Err(FrameError::Empty);
|
||||
}
|
||||
for (index, &value) in intervals_ms.iter().enumerate() {
|
||||
if !value.is_finite() || value <= 0.0 {
|
||||
return Err(FrameError::Invalid { index, value });
|
||||
}
|
||||
}
|
||||
let mut sorted = intervals_ms.to_vec();
|
||||
sorted.sort_by(|a, b| a.total_cmp(b));
|
||||
let total: f64 = intervals_ms.iter().sum();
|
||||
let n = sorted.len();
|
||||
let p50 = nearest_rank(&sorted, 50.0);
|
||||
let p99 = nearest_rank(&sorted, 99.0);
|
||||
let p999 = nearest_rank(&sorted, 99.9);
|
||||
Ok(FrameStats {
|
||||
frames: n,
|
||||
total_ms: total,
|
||||
mean_ms: total / n as f64,
|
||||
avg_fps: n as f64 / (total / 1000.0),
|
||||
min_ms: sorted[0],
|
||||
max_ms: sorted[n - 1],
|
||||
p50_ms: p50,
|
||||
p95_ms: nearest_rank(&sorted, 95.0),
|
||||
p99_ms: p99,
|
||||
p999_ms: p999,
|
||||
low_1pct_fps: 1000.0 / p99,
|
||||
low_01pct_fps: 1000.0 / p999,
|
||||
stutters: intervals_ms.iter().filter(|&&v| v > 2.0 * p50).count(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse one interval per line; blank lines and lines starting with `#` are skipped.
|
||||
pub fn parse_intervals(text: &str) -> Result<Vec<f64>, FrameError> {
|
||||
let mut out = Vec::new();
|
||||
for (i, line) in text.lines().enumerate() {
|
||||
let t = line.trim();
|
||||
if t.is_empty() || t.starts_with('#') {
|
||||
continue;
|
||||
}
|
||||
let v: f64 = t.parse().map_err(|_| FrameError::Parse {
|
||||
line: i + 1,
|
||||
text: t.to_string(),
|
||||
})?;
|
||||
out.push(v);
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
impl FrameStats {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("frames", Json::Num(self.frames as f64)),
|
||||
("total_ms", Json::Num(self.total_ms)),
|
||||
("mean_ms", Json::Num(self.mean_ms)),
|
||||
("avg_fps", Json::Num(self.avg_fps)),
|
||||
("min_ms", Json::Num(self.min_ms)),
|
||||
("max_ms", Json::Num(self.max_ms)),
|
||||
("p50_ms", Json::Num(self.p50_ms)),
|
||||
("p95_ms", Json::Num(self.p95_ms)),
|
||||
("p99_ms", Json::Num(self.p99_ms)),
|
||||
("p999_ms", Json::Num(self.p999_ms)),
|
||||
("low_1pct_fps", Json::Num(self.low_1pct_fps)),
|
||||
("low_0_1pct_fps", Json::Num(self.low_01pct_fps)),
|
||||
("stutters_over_2x_median", Json::Num(self.stutters as f64)),
|
||||
("percentile_method", Json::str("nearest-rank")),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// Expected values below are worked out by hand, not produced by analyze().
|
||||
#[test]
|
||||
fn known_answer_ten_frames() {
|
||||
// Sorted: 10,10,10,10,10,10,10,10,20,100. Total 200 ms, n = 10.
|
||||
let v = [10.0, 10.0, 10.0, 10.0, 20.0, 10.0, 10.0, 10.0, 100.0, 10.0];
|
||||
let s = analyze(&v).unwrap();
|
||||
assert_eq!(s.frames, 10);
|
||||
assert_eq!(s.total_ms, 200.0);
|
||||
assert_eq!(s.mean_ms, 20.0);
|
||||
assert_eq!(s.avg_fps, 50.0);
|
||||
assert_eq!(s.p50_ms, 10.0); // rank 5
|
||||
assert_eq!(s.p95_ms, 100.0); // rank ceil(9.5) = 10
|
||||
assert_eq!(s.p99_ms, 100.0);
|
||||
assert_eq!(s.low_1pct_fps, 10.0);
|
||||
assert_eq!(s.stutters, 1); // threshold is 2 * 10 = 20; 20 is not > 20, only 100 is.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stutter_threshold_is_strict() {
|
||||
let s = analyze(&[10.0, 10.0, 10.0, 20.0, 21.0]).unwrap();
|
||||
assert_eq!(s.stutters, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_frame_per_second() {
|
||||
let s = analyze(&[1000.0, 1000.0]).unwrap();
|
||||
assert_eq!(s.avg_fps, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_bad_input() {
|
||||
assert_eq!(analyze(&[]), Err(FrameError::Empty));
|
||||
assert!(matches!(
|
||||
analyze(&[1.0, 0.0]),
|
||||
Err(FrameError::Invalid { index: 1, .. })
|
||||
));
|
||||
assert!(matches!(
|
||||
analyze(&[f64::NAN]),
|
||||
Err(FrameError::Invalid { .. })
|
||||
));
|
||||
assert!(matches!(analyze(&[-3.0]), Err(FrameError::Invalid { .. })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_text() {
|
||||
assert_eq!(
|
||||
parse_intervals("# c\n16.5\n\n 8 \n").unwrap(),
|
||||
vec![16.5, 8.0]
|
||||
);
|
||||
assert_eq!(
|
||||
parse_intervals("1\nabc\n"),
|
||||
Err(FrameError::Parse {
|
||||
line: 2,
|
||||
text: "abc".into()
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
//! Host receipt: what this Mac is, from documented system interfaces (issue #353).
|
||||
//!
|
||||
//! Every field is `Option` where the probe can fail; absence is reported as null, not guessed.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct HostReceipt {
|
||||
pub macos_version: Option<String>,
|
||||
pub macos_build: Option<String>,
|
||||
pub chip: Option<String>,
|
||||
pub apple_silicon: Option<bool>,
|
||||
pub memory_bytes: Option<u64>,
|
||||
pub logical_cpus: Option<u32>,
|
||||
pub performance_cores: Option<u32>,
|
||||
pub efficiency_cores: Option<u32>,
|
||||
/// True only if an x86_64 slice of a system binary actually executed.
|
||||
pub rosetta_executes_x86_64: Option<bool>,
|
||||
pub gpu_name: Option<String>,
|
||||
pub gpu_cores: Option<String>,
|
||||
pub metal_support: Option<String>,
|
||||
pub gpu_wired: GpuWired,
|
||||
pub host_arch_of_this_binary: &'static str,
|
||||
}
|
||||
|
||||
fn sysctl(name: &str) -> Option<String> {
|
||||
run("/usr/sbin/sysctl", &["-n", name])
|
||||
}
|
||||
|
||||
/// GPU wired-memory sysctls (issue #386), recorded as the raw integers `sysctl -n` prints.
|
||||
///
|
||||
/// Read only: nothing in BetterXen writes these keys. `None` means the key is absent (the
|
||||
/// command failed) or its output is not an unsigned integer. A value of 0 was observed on an
|
||||
/// M4 and an M5; Apple does not document what 0 means in anything reviewed for #386, so it is
|
||||
/// reported as observed and never interpreted (for example as "system default" or "no limit").
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
pub struct GpuWired {
|
||||
/// `iogpu.wired_limit_mb`.
|
||||
pub limit_mb: Option<u64>,
|
||||
/// `iogpu.wired_lwm_mb`.
|
||||
pub lwm_mb: Option<u64>,
|
||||
}
|
||||
|
||||
pub const GPU_WIRED_SOURCE: &str = "sysctl -n iogpu.wired_limit_mb, iogpu.wired_lwm_mb (read-only; raw values, meaning of 0 undocumented)";
|
||||
|
||||
/// Read the GPU wired-memory keys through `read`, which returns a key's trimmed output or
|
||||
/// `None` when the key cannot be read. Injected so tests do not depend on this Mac.
|
||||
pub fn gpu_wired_with(read: impl Fn(&str) -> Option<String>) -> GpuWired {
|
||||
let num = |key: &str| read(key).and_then(|v| v.trim().parse::<u64>().ok());
|
||||
GpuWired {
|
||||
limit_mb: num("iogpu.wired_limit_mb"),
|
||||
lwm_mb: num("iogpu.wired_lwm_mb"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gpu_wired() -> GpuWired {
|
||||
gpu_wired_with(sysctl)
|
||||
}
|
||||
|
||||
impl GpuWired {
|
||||
/// The record fields shared by the host receipt and every run record.
|
||||
pub fn json_fields(&self) -> Vec<(&'static str, Json)> {
|
||||
let n = |v: Option<u64>| v.map_or(Json::Null, |x| Json::Num(x as f64));
|
||||
vec![
|
||||
("gpu_wired_limit_mb", n(self.limit_mb)),
|
||||
("gpu_wired_lwm_mb", n(self.lwm_mb)),
|
||||
("gpu_wired_source", Json::str(GPU_WIRED_SOURCE)),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn collect() -> HostReceipt {
|
||||
let gpu = run(
|
||||
"/usr/sbin/system_profiler",
|
||||
&["SPDisplaysDataType", "-json"],
|
||||
)
|
||||
.and_then(|j| parse_gpu(&j));
|
||||
HostReceipt {
|
||||
macos_version: run("/usr/bin/sw_vers", &["-productVersion"]),
|
||||
macos_build: sysctl("kern.osversion"),
|
||||
chip: sysctl("machdep.cpu.brand_string"),
|
||||
apple_silicon: sysctl("hw.optional.arm64").map(|v| v == "1"),
|
||||
memory_bytes: sysctl("hw.memsize").and_then(|v| v.parse().ok()),
|
||||
logical_cpus: sysctl("hw.logicalcpu").and_then(|v| v.parse().ok()),
|
||||
performance_cores: sysctl("hw.perflevel0.physicalcpu").and_then(|v| v.parse().ok()),
|
||||
efficiency_cores: sysctl("hw.perflevel1.physicalcpu").and_then(|v| v.parse().ok()),
|
||||
// Executes the x86_64 slice of /usr/bin/true. Failure means Rosetta cannot run it
|
||||
// now; it does not distinguish "not installed" from "disabled".
|
||||
rosetta_executes_x86_64: Some(
|
||||
run("/usr/bin/arch", &["-x86_64", "/usr/bin/true"]).is_some(),
|
||||
),
|
||||
gpu_name: gpu.as_ref().map(|g| g.0.clone()),
|
||||
gpu_cores: gpu.as_ref().and_then(|g| g.1.clone()),
|
||||
metal_support: gpu.as_ref().and_then(|g| g.2.clone()),
|
||||
gpu_wired: gpu_wired(),
|
||||
host_arch_of_this_binary: std::env::consts::ARCH,
|
||||
}
|
||||
}
|
||||
|
||||
/// Pull `sppci_model`, `sppci_cores` and `spdisplays_mtlgpufamilysupport` of the first display
|
||||
/// entry from `system_profiler SPDisplaysDataType -json` output. Returns None if the model
|
||||
/// key is absent. Uses a small string scan because this crate has no JSON parser dependency.
|
||||
pub fn parse_gpu(json: &str) -> Option<(String, Option<String>, Option<String>)> {
|
||||
let model = string_value(json, "sppci_model")?;
|
||||
Some((
|
||||
model,
|
||||
string_value(json, "sppci_cores"),
|
||||
string_value(json, "spdisplays_mtlgpufamilysupport"),
|
||||
))
|
||||
}
|
||||
|
||||
fn string_value(json: &str, key: &str) -> Option<String> {
|
||||
let needle = format!("\"{key}\"");
|
||||
let at = json.find(&needle)? + needle.len();
|
||||
let rest = json[at..].trim_start().strip_prefix(':')?.trim_start();
|
||||
let rest = rest.strip_prefix('"')?;
|
||||
let end = rest.find('"')?;
|
||||
Some(rest[..end].to_string())
|
||||
}
|
||||
|
||||
impl HostReceipt {
|
||||
pub fn to_json(&self) -> Json {
|
||||
let n = |v: Option<u32>| v.map_or(Json::Null, |x| Json::Num(x as f64));
|
||||
let mut fields = vec![
|
||||
("macos_version", Json::opt_str(self.macos_version.clone())),
|
||||
("macos_build", Json::opt_str(self.macos_build.clone())),
|
||||
("chip", Json::opt_str(self.chip.clone())),
|
||||
(
|
||||
"apple_silicon",
|
||||
self.apple_silicon.map_or(Json::Null, Json::Bool),
|
||||
),
|
||||
(
|
||||
"memory_bytes",
|
||||
self.memory_bytes
|
||||
.map_or(Json::Null, |x| Json::Num(x as f64)),
|
||||
),
|
||||
("logical_cpus", n(self.logical_cpus)),
|
||||
("performance_cores", n(self.performance_cores)),
|
||||
("efficiency_cores", n(self.efficiency_cores)),
|
||||
(
|
||||
"rosetta_executes_x86_64",
|
||||
self.rosetta_executes_x86_64.map_or(Json::Null, Json::Bool),
|
||||
),
|
||||
("gpu_name", Json::opt_str(self.gpu_name.clone())),
|
||||
("gpu_cores", Json::opt_str(self.gpu_cores.clone())),
|
||||
("metal_support", Json::opt_str(self.metal_support.clone())),
|
||||
];
|
||||
fields.extend(self.gpu_wired.json_fields());
|
||||
fields.push((
|
||||
"receipt_binary_arch",
|
||||
Json::str(self.host_arch_of_this_binary),
|
||||
));
|
||||
Json::obj(fields)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parses_gpu_fixture() {
|
||||
let j = r#"{"SPDisplaysDataType":[{"sppci_cores":"10","sppci_model":"Apple M4",
|
||||
"spdisplays_mtlgpufamilysupport":"spdisplays_metal4"}]}"#;
|
||||
let g = parse_gpu(j).unwrap();
|
||||
assert_eq!(g.0, "Apple M4");
|
||||
assert_eq!(g.1.as_deref(), Some("10"));
|
||||
assert_eq!(g.2.as_deref(), Some("spdisplays_metal4"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_gpu_is_none() {
|
||||
assert!(parse_gpu("{}").is_none());
|
||||
}
|
||||
|
||||
fn reader<'a>(pairs: &'a [(&'a str, &'a str)]) -> impl Fn(&str) -> Option<String> + 'a {
|
||||
move |key| {
|
||||
pairs
|
||||
.iter()
|
||||
.find(|(k, _)| *k == key)
|
||||
.map(|(_, v)| v.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gpu_wired_values_are_reported_raw() {
|
||||
let w = gpu_wired_with(reader(&[
|
||||
("iogpu.wired_limit_mb", "24576"),
|
||||
("iogpu.wired_lwm_mb", "0"),
|
||||
]));
|
||||
assert_eq!(w.limit_mb, Some(24576));
|
||||
// 0 is a value like any other, not "absent".
|
||||
assert_eq!(w.lwm_mb, Some(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_or_unparsable_gpu_wired_keys_are_null() {
|
||||
let w = gpu_wired_with(reader(&[("iogpu.wired_limit_mb", "unlimited")]));
|
||||
assert_eq!(w, GpuWired::default());
|
||||
let j = Json::obj(w.json_fields()).render();
|
||||
assert!(j.contains("\"gpu_wired_limit_mb\": null"), "{j}");
|
||||
assert!(j.contains("\"gpu_wired_lwm_mb\": null"), "{j}");
|
||||
assert!(j.contains("\"gpu_wired_source\": \"sysctl -n"), "{j}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn receipt_carries_gpu_wired_fields() {
|
||||
let mut r = collect();
|
||||
r.gpu_wired = GpuWired {
|
||||
limit_mb: Some(0),
|
||||
lwm_mb: None,
|
||||
};
|
||||
let j = r.to_json().render();
|
||||
assert!(j.contains("\"gpu_wired_limit_mb\": 0"), "{j}");
|
||||
assert!(j.contains("\"gpu_wired_lwm_mb\": null"), "{j}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_runs_on_this_host() {
|
||||
let r = collect();
|
||||
if cfg!(target_os = "macos") {
|
||||
assert!(r.macos_version.is_some());
|
||||
assert!(r.memory_bytes.unwrap() > 0);
|
||||
}
|
||||
assert!(r.to_json().render().contains("receipt_binary_arch"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//! Minimal JSON value and writer. Output only; no parsing is needed by this crate.
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Json {
|
||||
Null,
|
||||
Bool(bool),
|
||||
Num(f64),
|
||||
Str(String),
|
||||
Arr(Vec<Json>),
|
||||
Obj(Vec<(String, Json)>),
|
||||
}
|
||||
|
||||
impl Json {
|
||||
pub fn str(s: impl Into<String>) -> Json {
|
||||
Json::Str(s.into())
|
||||
}
|
||||
pub fn opt_str(s: Option<String>) -> Json {
|
||||
s.map_or(Json::Null, Json::Str)
|
||||
}
|
||||
pub fn obj(fields: Vec<(&str, Json)>) -> Json {
|
||||
Json::Obj(
|
||||
fields
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k.to_string(), v))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render(&self) -> String {
|
||||
let mut out = String::new();
|
||||
self.write(&mut out, 0);
|
||||
out.push('\n');
|
||||
out
|
||||
}
|
||||
|
||||
fn write(&self, out: &mut String, depth: usize) {
|
||||
let pad = |out: &mut String, d: usize| out.push_str(&" ".repeat(d));
|
||||
match self {
|
||||
Json::Null => out.push_str("null"),
|
||||
Json::Bool(b) => out.push_str(if *b { "true" } else { "false" }),
|
||||
Json::Num(n) if n.is_finite() => {
|
||||
if n.fract() == 0.0 && n.abs() < 1e15 {
|
||||
out.push_str(&format!("{}", *n as i64));
|
||||
} else {
|
||||
out.push_str(&format!("{n}"));
|
||||
}
|
||||
}
|
||||
// JSON has no NaN or infinity; refuse to invent a number.
|
||||
Json::Num(_) => out.push_str("null"),
|
||||
Json::Str(s) => escape(s, out),
|
||||
Json::Arr(items) if items.is_empty() => out.push_str("[]"),
|
||||
Json::Arr(items) => {
|
||||
out.push_str("[\n");
|
||||
for (i, item) in items.iter().enumerate() {
|
||||
pad(out, depth + 1);
|
||||
item.write(out, depth + 1);
|
||||
out.push_str(if i + 1 < items.len() { ",\n" } else { "\n" });
|
||||
}
|
||||
pad(out, depth);
|
||||
out.push(']');
|
||||
}
|
||||
Json::Obj(fields) if fields.is_empty() => out.push_str("{}"),
|
||||
Json::Obj(fields) => {
|
||||
out.push_str("{\n");
|
||||
for (i, (k, v)) in fields.iter().enumerate() {
|
||||
pad(out, depth + 1);
|
||||
escape(k, out);
|
||||
out.push_str(": ");
|
||||
v.write(out, depth + 1);
|
||||
out.push_str(if i + 1 < fields.len() { ",\n" } else { "\n" });
|
||||
}
|
||||
pad(out, depth);
|
||||
out.push('}');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn escape(s: &str, out: &mut String) {
|
||||
out.push('"');
|
||||
for c in s.chars() {
|
||||
match c {
|
||||
'"' => out.push_str("\\\""),
|
||||
'\\' => out.push_str("\\\\"),
|
||||
'\n' => out.push_str("\\n"),
|
||||
'\r' => out.push_str("\\r"),
|
||||
'\t' => out.push_str("\\t"),
|
||||
c if (c as u32) < 0x20 => out.push_str(&format!("\\u{:04x}", c as u32)),
|
||||
c => out.push(c),
|
||||
}
|
||||
}
|
||||
out.push('"');
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn escapes_and_nests() {
|
||||
let j = Json::obj(vec![
|
||||
("a", Json::str("q\"\\\n\u{1}")),
|
||||
(
|
||||
"b",
|
||||
Json::Arr(vec![Json::Num(1.0), Json::Num(0.5), Json::Null]),
|
||||
),
|
||||
("c", Json::Num(f64::NAN)),
|
||||
]);
|
||||
let r = j.render();
|
||||
assert!(r.contains(r#""a": "q\"\\\n\u0001""#), "{r}");
|
||||
assert!(r.contains("0.5"));
|
||||
assert!(r.contains(r#""c": null"#));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//! BetterXen hybrid tooling: environment checks, executable identification, supervised
|
||||
//! launches and measurement around an externally installed CrossOver. Nothing here claims
|
||||
//! game or console compatibility.
|
||||
|
||||
pub mod cli;
|
||||
pub mod cmdutil;
|
||||
pub mod crossover;
|
||||
pub mod frames;
|
||||
pub mod host;
|
||||
pub mod json;
|
||||
pub mod memory;
|
||||
pub mod pe;
|
||||
pub mod preflight;
|
||||
pub mod records;
|
||||
pub mod run;
|
||||
pub mod toolchain;
|
||||
|
||||
/// Value of a top-level string key in flat JSON produced by `plutil -convert json`.
|
||||
pub fn host_string(json: &str, key: &str) -> Option<String> {
|
||||
let needle = format!("\"{key}\"");
|
||||
let at = json.find(&needle)? + needle.len();
|
||||
let rest = json[at..]
|
||||
.trim_start()
|
||||
.strip_prefix(':')?
|
||||
.trim_start()
|
||||
.strip_prefix('"')?;
|
||||
let mut out = String::new();
|
||||
let mut chars = rest.chars();
|
||||
while let Some(c) = chars.next() {
|
||||
match c {
|
||||
'"' => return Some(out),
|
||||
'\\' => out.push(chars.next()?),
|
||||
c => out.push(c),
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//! Standalone binary for the hybrid tooling; `betterxen hybrid` runs the same code.
|
||||
|
||||
fn main() -> std::process::ExitCode {
|
||||
betterxen_hybrid::cli::run_cli(&std::env::args().skip(1).collect::<Vec<_>>())
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
//! Memory-pressure supervision of a child process.
|
||||
//!
|
||||
//! Adapted in concept from the memory guard in `mac/run-victory.sh` of
|
||||
//! <https://github.com/skakwy/victory-mac> (author skakwy, GPL-3.0; commit 22b3f8e, used with
|
||||
//! the author's permission): do not start a workload when little memory is free, and stop it
|
||||
//! when system-wide free memory falls below a limit, because GPU memory is wired under
|
||||
//! unified memory and a runaway workload can take the whole Mac down. This version is
|
||||
//! reimplemented in Rust, stops the child with SIGTERM before SIGKILL, and reports why it
|
||||
//! stopped. It supervises any command; it contains nothing game-specific.
|
||||
//!
|
||||
//! The reading is the "System-wide memory free percentage" line of `memory_pressure -Q`.
|
||||
//! That line was observed on macOS 27.0 (build 26A428); its format is not a documented
|
||||
//! stable interface, so an unreadable value is an error, never "assume enough memory".
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use std::process::{Child, Command};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
pub fn parse_free_percentage(output: &str) -> Option<u8> {
|
||||
let line = output
|
||||
.lines()
|
||||
.find(|l| l.contains("System-wide memory free percentage"))?;
|
||||
let digits: String = line
|
||||
.split(':')
|
||||
.nth(1)?
|
||||
.trim()
|
||||
.chars()
|
||||
.take_while(|c| c.is_ascii_digit())
|
||||
.collect();
|
||||
let v: u8 = digits.parse().ok()?;
|
||||
(v <= 100).then_some(v)
|
||||
}
|
||||
|
||||
pub fn free_percentage() -> Option<u8> {
|
||||
run("/usr/bin/memory_pressure", &["-Q"]).and_then(|o| parse_free_percentage(&o))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Limits {
|
||||
/// Refuse to start below this percent free.
|
||||
pub min_start_free: u8,
|
||||
/// Stop the child when free memory drops below this percent.
|
||||
pub min_free: u8,
|
||||
pub poll: Duration,
|
||||
/// Time between SIGTERM and SIGKILL.
|
||||
pub grace: Duration,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Outcome {
|
||||
/// The child ran to completion; `None` means it ended by a signal.
|
||||
Exited(Option<i32>),
|
||||
RefusedToStart {
|
||||
free: u8,
|
||||
need: u8,
|
||||
},
|
||||
StoppedLowMemory {
|
||||
free: u8,
|
||||
limit: u8,
|
||||
},
|
||||
/// Memory could not be read, so no guarantee can be given.
|
||||
MemoryUnreadable,
|
||||
SpawnFailed(String),
|
||||
}
|
||||
|
||||
pub(crate) fn terminate(child: &mut Child, grace: Duration) {
|
||||
let _ = Command::new("/bin/kill")
|
||||
.args(["-TERM", &child.id().to_string()])
|
||||
.status();
|
||||
let t0 = Instant::now();
|
||||
while t0.elapsed() < grace {
|
||||
if matches!(child.try_wait(), Ok(Some(_))) {
|
||||
return;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
}
|
||||
|
||||
/// Run `program` under `limits`, reading memory through `read_free`.
|
||||
pub fn supervise(
|
||||
program: &str,
|
||||
args: &[String],
|
||||
limits: Limits,
|
||||
read_free: &mut dyn FnMut() -> Option<u8>,
|
||||
) -> Outcome {
|
||||
match read_free() {
|
||||
None => return Outcome::MemoryUnreadable,
|
||||
Some(free) if free < limits.min_start_free => {
|
||||
return Outcome::RefusedToStart {
|
||||
free,
|
||||
need: limits.min_start_free,
|
||||
};
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
let mut child = match Command::new(program).args(args).spawn() {
|
||||
Ok(c) => c,
|
||||
Err(e) => return Outcome::SpawnFailed(format!("{program}: {e}")),
|
||||
};
|
||||
loop {
|
||||
match child.try_wait() {
|
||||
Ok(Some(status)) => return Outcome::Exited(status.code()),
|
||||
Ok(None) => {}
|
||||
Err(e) => return Outcome::SpawnFailed(e.to_string()),
|
||||
}
|
||||
match read_free() {
|
||||
None => {
|
||||
terminate(&mut child, limits.grace);
|
||||
return Outcome::MemoryUnreadable;
|
||||
}
|
||||
Some(free) if free < limits.min_free => {
|
||||
terminate(&mut child, limits.grace);
|
||||
return Outcome::StoppedLowMemory {
|
||||
free,
|
||||
limit: limits.min_free,
|
||||
};
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
std::thread::sleep(limits.poll);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn limits() -> Limits {
|
||||
Limits {
|
||||
min_start_free: 50,
|
||||
min_free: 20,
|
||||
poll: Duration::from_millis(20),
|
||||
grace: Duration::from_millis(500),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_memory_pressure_output() {
|
||||
let real = "The system has 25769803776 (1572864 pages with a page size of 16384).\nSystem-wide memory free percentage: 71%\n";
|
||||
assert_eq!(parse_free_percentage(real), Some(71));
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: 100%"),
|
||||
Some(100)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: 101%"),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: x"),
|
||||
None
|
||||
);
|
||||
assert_eq!(parse_free_percentage("nothing"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_to_start_when_low() {
|
||||
let out = supervise("/usr/bin/true", &[], limits(), &mut || Some(30));
|
||||
assert_eq!(out, Outcome::RefusedToStart { free: 30, need: 50 });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unreadable_memory_is_an_error() {
|
||||
assert_eq!(
|
||||
supervise("/usr/bin/true", &[], limits(), &mut || None),
|
||||
Outcome::MemoryUnreadable
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn child_exit_code_is_reported() {
|
||||
let out = supervise(
|
||||
"/bin/sh",
|
||||
&["-c".into(), "exit 7".into()],
|
||||
limits(),
|
||||
&mut || Some(90),
|
||||
);
|
||||
assert_eq!(out, Outcome::Exited(Some(7)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stops_child_when_memory_drops() {
|
||||
let mut calls = 0;
|
||||
let t0 = Instant::now();
|
||||
let out = supervise("/bin/sleep", &["30".into()], limits(), &mut || {
|
||||
calls += 1;
|
||||
Some(if calls < 4 { 90 } else { 10 })
|
||||
});
|
||||
assert_eq!(
|
||||
out,
|
||||
Outcome::StoppedLowMemory {
|
||||
free: 10,
|
||||
limit: 20
|
||||
}
|
||||
);
|
||||
assert!(
|
||||
t0.elapsed() < Duration::from_secs(10),
|
||||
"child was not stopped promptly"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn real_reading_is_available_on_macos() {
|
||||
if cfg!(target_os = "macos") {
|
||||
assert!(free_percentage().is_some());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
//! Identify a Windows executable before it is handed to CrossOver.
|
||||
//!
|
||||
//! Reads only the headers and the import directory names of a PE/COFF image, following
|
||||
//! Microsoft's published "PE Format" specification. The file is untrusted input: every
|
||||
//! offset is checked, counts are capped, and nothing is executed. This answers "is this a
|
||||
//! launchable x86 Windows program, and which DLLs does it import"; it does not prove that
|
||||
//! the program will run.
|
||||
|
||||
use crate::json::Json;
|
||||
|
||||
/// Largest file this will read. Larger programs are refused rather than partly checked.
|
||||
pub const MAX_BYTES: u64 = 1 << 30;
|
||||
const MAX_SECTIONS: usize = 96;
|
||||
const MAX_IMPORTS: usize = 512;
|
||||
const MAX_NAME: usize = 256;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Machine {
|
||||
X86_64,
|
||||
I386,
|
||||
Arm64,
|
||||
Other(u16),
|
||||
}
|
||||
|
||||
impl Machine {
|
||||
pub fn name(self) -> String {
|
||||
match self {
|
||||
Machine::X86_64 => "x86_64".into(),
|
||||
Machine::I386 => "i386".into(),
|
||||
Machine::Arm64 => "arm64".into(),
|
||||
Machine::Other(m) => format!("unknown_0x{m:04x}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Image {
|
||||
pub machine: Machine,
|
||||
pub pe32_plus: bool,
|
||||
pub subsystem: u16,
|
||||
pub is_dll: bool,
|
||||
/// Imported DLL names, lower-cased, from the (non-delayed) import directory.
|
||||
pub imports: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Error {
|
||||
NotPe(&'static str),
|
||||
Truncated(&'static str),
|
||||
Unsupported(String),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Error::NotPe(why) => write!(f, "not a PE executable: {why}"),
|
||||
Error::Truncated(what) => write!(f, "truncated or inconsistent PE: {what}"),
|
||||
Error::Unsupported(why) => write!(f, "unsupported executable: {why}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn bytes<'a>(d: &'a [u8], at: usize, n: usize, what: &'static str) -> Result<&'a [u8], Error> {
|
||||
at.checked_add(n)
|
||||
.and_then(|end| d.get(at..end))
|
||||
.ok_or(Error::Truncated(what))
|
||||
}
|
||||
|
||||
fn u16_at(d: &[u8], at: usize, what: &'static str) -> Result<u16, Error> {
|
||||
let b = bytes(d, at, 2, what)?;
|
||||
Ok(u16::from_le_bytes([b[0], b[1]]))
|
||||
}
|
||||
|
||||
fn u32_at(d: &[u8], at: usize, what: &'static str) -> Result<u32, Error> {
|
||||
let b = bytes(d, at, 4, what)?;
|
||||
Ok(u32::from_le_bytes([b[0], b[1], b[2], b[3]]))
|
||||
}
|
||||
|
||||
struct Section {
|
||||
va: u32,
|
||||
size: u32,
|
||||
file: u32,
|
||||
}
|
||||
|
||||
fn file_offset(sections: &[Section], rva: u32) -> Option<usize> {
|
||||
sections.iter().find_map(|s| {
|
||||
let into = rva.checked_sub(s.va)?;
|
||||
(into < s.size).then(|| s.file.checked_add(into).map(|v| v as usize))?
|
||||
})
|
||||
}
|
||||
|
||||
pub fn parse(d: &[u8]) -> Result<Image, Error> {
|
||||
if bytes(d, 0, 2, "DOS magic").map_err(|_| Error::NotPe("file too small"))? != b"MZ" {
|
||||
return Err(Error::NotPe("missing MZ magic"));
|
||||
}
|
||||
let pe = u32_at(d, 0x3c, "e_lfanew")? as usize;
|
||||
if bytes(d, pe, 4, "PE signature")? != b"PE\0\0" {
|
||||
return Err(Error::NotPe("missing PE signature"));
|
||||
}
|
||||
let coff = pe.checked_add(4).ok_or(Error::Truncated("COFF header"))?;
|
||||
let machine = match u16_at(d, coff, "machine")? {
|
||||
0x8664 => Machine::X86_64,
|
||||
0x014c => Machine::I386,
|
||||
0xaa64 => Machine::Arm64,
|
||||
m => Machine::Other(m),
|
||||
};
|
||||
let section_count = u16_at(d, coff + 2, "section count")? as usize;
|
||||
let optional_size = u16_at(d, coff + 16, "optional header size")? as usize;
|
||||
let characteristics = u16_at(d, coff + 18, "characteristics")?;
|
||||
if characteristics & 0x0002 == 0 {
|
||||
return Err(Error::NotPe("not marked as an executable image"));
|
||||
}
|
||||
if section_count > MAX_SECTIONS {
|
||||
return Err(Error::Truncated("implausible section count"));
|
||||
}
|
||||
let opt = coff + 20;
|
||||
let optional = bytes(d, opt, optional_size, "optional header")?;
|
||||
let (pe32_plus, count_at, dirs_at) = match u16_at(optional, 0, "optional magic")? {
|
||||
0x20b => (true, 108, 112),
|
||||
0x10b => (false, 92, 96),
|
||||
_ => return Err(Error::NotPe("unknown optional header magic")),
|
||||
};
|
||||
let subsystem = u16_at(optional, 68, "subsystem")?;
|
||||
|
||||
let mut sections = Vec::with_capacity(section_count);
|
||||
let table = opt + optional_size;
|
||||
for i in 0..section_count {
|
||||
let at = table + i * 40;
|
||||
sections.push(Section {
|
||||
va: u32_at(d, at + 12, "section address")?,
|
||||
size: u32_at(d, at + 16, "section raw size")?,
|
||||
file: u32_at(d, at + 20, "section raw pointer")?,
|
||||
});
|
||||
}
|
||||
|
||||
let mut imports = Vec::new();
|
||||
let directories = u32_at(optional, count_at, "directory count")?;
|
||||
let import_rva = if directories >= 2 {
|
||||
u32_at(optional, dirs_at + 8, "import directory")?
|
||||
} else {
|
||||
0
|
||||
};
|
||||
if import_rva != 0 {
|
||||
let start = file_offset(§ions, import_rva)
|
||||
.ok_or(Error::Truncated("import directory outside sections"))?;
|
||||
let mut terminated = false;
|
||||
for i in 0..=MAX_IMPORTS {
|
||||
let entry = bytes(d, start + i * 20, 20, "import descriptor")?;
|
||||
if entry.iter().all(|b| *b == 0) {
|
||||
terminated = true;
|
||||
break;
|
||||
}
|
||||
let name_rva = u32_at(entry, 12, "import name")?;
|
||||
let at = file_offset(§ions, name_rva)
|
||||
.ok_or(Error::Truncated("import name outside sections"))?;
|
||||
let rest = d.get(at..).ok_or(Error::Truncated("import name"))?;
|
||||
let len = rest
|
||||
.iter()
|
||||
.take(MAX_NAME)
|
||||
.position(|b| *b == 0)
|
||||
.ok_or(Error::Truncated("unterminated import name"))?;
|
||||
imports.push(String::from_utf8_lossy(&rest[..len]).to_ascii_lowercase());
|
||||
}
|
||||
if !terminated {
|
||||
return Err(Error::Truncated("import directory has no terminator"));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Image {
|
||||
machine,
|
||||
pe32_plus,
|
||||
subsystem,
|
||||
is_dll: characteristics & 0x2000 != 0,
|
||||
imports,
|
||||
})
|
||||
}
|
||||
|
||||
impl Image {
|
||||
/// Refuse what is known not to launch. ARM64 programs were observed to be rejected by
|
||||
/// CrossOver 26.3 on macOS ("cannot execute").
|
||||
pub fn check_launchable(&self) -> Result<(), Error> {
|
||||
if self.is_dll {
|
||||
return Err(Error::Unsupported(
|
||||
"the file is a DLL, not a program".into(),
|
||||
));
|
||||
}
|
||||
if !matches!(self.machine, Machine::X86_64 | Machine::I386) {
|
||||
return Err(Error::Unsupported(format!(
|
||||
"machine {} (CrossOver on macOS runs x86 and x86_64 Windows programs)",
|
||||
self.machine.name()
|
||||
)));
|
||||
}
|
||||
// 2 = Windows GUI, 3 = Windows console.
|
||||
if !matches!(self.subsystem, 2 | 3) {
|
||||
return Err(Error::Unsupported(format!("subsystem {}", self.subsystem)));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("machine", Json::str(self.machine.name())),
|
||||
("pe32_plus", Json::Bool(self.pe32_plus)),
|
||||
("subsystem", Json::Num(self.subsystem as f64)),
|
||||
(
|
||||
"imports",
|
||||
Json::Arr(self.imports.iter().map(|s| Json::str(s.clone())).collect()),
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
/// Read and identify a program file, refusing anything that is not a regular file of a
|
||||
/// plausible size.
|
||||
pub fn inspect(path: &std::path::Path) -> Result<Image, String> {
|
||||
let meta = std::fs::metadata(path).map_err(|e| format!("{}: {e}", path.display()))?;
|
||||
if !meta.is_file() {
|
||||
return Err(format!("{}: not a regular file", path.display()));
|
||||
}
|
||||
if meta.len() > MAX_BYTES {
|
||||
return Err(format!("{}: larger than {MAX_BYTES} bytes", path.display()));
|
||||
}
|
||||
let data = std::fs::read(path).map_err(|e| format!("{}: {e}", path.display()))?;
|
||||
parse(&data).map_err(|e| format!("{}: {e}", path.display()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
|
||||
fn put16(d: &mut [u8], at: usize, v: u16) {
|
||||
d[at..at + 2].copy_from_slice(&v.to_le_bytes());
|
||||
}
|
||||
fn put32(d: &mut [u8], at: usize, v: u32) {
|
||||
d[at..at + 4].copy_from_slice(&v.to_le_bytes());
|
||||
}
|
||||
|
||||
/// A minimal image written field by field from the PE Format specification: one section
|
||||
/// at RVA 0x1000 holding one import descriptor and its name.
|
||||
pub(crate) fn synthetic(machine: u16, characteristics: u16) -> Vec<u8> {
|
||||
let mut d = vec![0u8; 0x400];
|
||||
d[0..2].copy_from_slice(b"MZ");
|
||||
put32(&mut d, 0x3c, 0x40);
|
||||
d[0x40..0x44].copy_from_slice(b"PE\0\0");
|
||||
put16(&mut d, 0x44, machine);
|
||||
put16(&mut d, 0x46, 1); // one section
|
||||
put16(&mut d, 0x54, 240); // PE32+ optional header with 16 directories
|
||||
put16(&mut d, 0x56, characteristics);
|
||||
let opt = 0x58;
|
||||
put16(&mut d, opt, 0x20b);
|
||||
put16(&mut d, opt + 68, 3);
|
||||
put32(&mut d, opt + 108, 16);
|
||||
put32(&mut d, opt + 120, 0x1000); // directory 1: imports
|
||||
let section = opt + 240;
|
||||
put32(&mut d, section + 12, 0x1000);
|
||||
put32(&mut d, section + 16, 0x100);
|
||||
put32(&mut d, section + 20, 0x200);
|
||||
put32(&mut d, 0x200 + 12, 0x1080); // name of descriptor 0
|
||||
d[0x280..0x28a].copy_from_slice(b"D3D11.dll\0");
|
||||
d
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_machine_subsystem_and_imports() {
|
||||
let i = parse(&synthetic(0x8664, 0x0022)).unwrap();
|
||||
assert_eq!(i.machine, Machine::X86_64);
|
||||
assert!(i.pe32_plus);
|
||||
assert_eq!(i.subsystem, 3);
|
||||
assert_eq!(i.imports, ["d3d11.dll"]);
|
||||
assert_eq!(i.check_launchable(), Ok(()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_arm64_dlls_and_unknown_machines() {
|
||||
let arm = parse(&synthetic(0xaa64, 0x0022)).unwrap();
|
||||
assert!(matches!(arm.check_launchable(), Err(Error::Unsupported(_))));
|
||||
let dll = parse(&synthetic(0x8664, 0x2022)).unwrap();
|
||||
assert!(matches!(dll.check_launchable(), Err(Error::Unsupported(_))));
|
||||
let other = parse(&synthetic(0x1f0, 0x0022)).unwrap();
|
||||
assert!(other.check_launchable().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_pe_input_is_an_error() {
|
||||
assert!(matches!(parse(b""), Err(Error::NotPe(_))));
|
||||
assert!(matches!(parse(b"#!/bin/sh\n"), Err(Error::NotPe(_))));
|
||||
let mut d = synthetic(0x8664, 0x0022);
|
||||
d[0x40] = b'X';
|
||||
assert!(matches!(parse(&d), Err(Error::NotPe(_))));
|
||||
assert!(parse(&synthetic(0x8664, 0)).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hostile_offsets_and_truncation_never_panic() {
|
||||
let good = synthetic(0x8664, 0x0022);
|
||||
for n in 0..good.len() {
|
||||
let _ = parse(&good[..n]);
|
||||
}
|
||||
// Every aligned word replaced by extreme values: must return, never panic.
|
||||
for at in (0..good.len() - 4).step_by(2) {
|
||||
for v in [u32::MAX, 0x7fff_ffff, 0x1000] {
|
||||
let mut d = good.clone();
|
||||
put32(&mut d, at, v);
|
||||
let _ = parse(&d);
|
||||
}
|
||||
}
|
||||
let mut far = good.clone();
|
||||
put32(&mut far, 0x58 + 120, 0xdead_0000);
|
||||
assert!(matches!(parse(&far), Err(Error::Truncated(_))));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
//! Read-only environment checks before a run (`betterxen-hybrid doctor`).
|
||||
//!
|
||||
//! Each check is something observed on this host. A pass means the pieces the runner needs
|
||||
//! are present; it does not mean any program will run.
|
||||
|
||||
use crate::json::Json;
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Check {
|
||||
pub name: &'static str,
|
||||
pub ok: bool,
|
||||
pub detail: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Facts {
|
||||
pub host_arch: &'static str,
|
||||
/// None when no CrossOver bundle was found.
|
||||
pub crossover: Option<(String, std::path::PathBuf)>,
|
||||
pub rosetta_runs_x86_64: bool,
|
||||
pub bottle: Option<(String, std::path::PathBuf)>,
|
||||
pub free_percent: Option<u8>,
|
||||
pub min_start_free: u8,
|
||||
}
|
||||
|
||||
pub fn evaluate(f: &Facts) -> Vec<Check> {
|
||||
let mut out = vec![Check {
|
||||
name: "host_arm64",
|
||||
ok: f.host_arch == "aarch64",
|
||||
detail: f.host_arch.to_string(),
|
||||
}];
|
||||
match &f.crossover {
|
||||
None => out.push(Check {
|
||||
name: "crossover_installed",
|
||||
ok: false,
|
||||
detail: "no CrossOver bundle found; install it from CodeWeavers".into(),
|
||||
}),
|
||||
Some((version, wine)) => {
|
||||
out.push(Check {
|
||||
name: "crossover_installed",
|
||||
ok: true,
|
||||
detail: version.clone(),
|
||||
});
|
||||
for (name, path) in [
|
||||
("wine_launcher", wine.clone()),
|
||||
("wineserver", wine.with_file_name("wineserver")),
|
||||
] {
|
||||
out.push(Check {
|
||||
name,
|
||||
ok: path.is_file(),
|
||||
detail: path.display().to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
out.push(Check {
|
||||
name: "rosetta",
|
||||
ok: f.rosetta_runs_x86_64,
|
||||
detail: "whether an x86_64 binary executes (CrossOver 26.3's Wine is x86_64-only)".into(),
|
||||
});
|
||||
if let Some((name, dir)) = &f.bottle {
|
||||
out.push(Check {
|
||||
name: "bottle",
|
||||
ok: valid_bottle_name(name) && dir.join("drive_c").is_dir(),
|
||||
detail: dir.display().to_string(),
|
||||
});
|
||||
}
|
||||
out.push(match f.free_percent {
|
||||
Some(p) => Check {
|
||||
name: "free_memory",
|
||||
ok: p >= f.min_start_free,
|
||||
detail: format!("{p}% free, {}% required", f.min_start_free),
|
||||
},
|
||||
None => Check {
|
||||
name: "free_memory",
|
||||
ok: false,
|
||||
detail: "could not be read".into(),
|
||||
},
|
||||
});
|
||||
out
|
||||
}
|
||||
|
||||
/// A bottle name becomes a path component and a command argument, so it must be neither a
|
||||
/// path nor something the launcher could read as an option.
|
||||
pub fn valid_bottle_name(name: &str) -> bool {
|
||||
!name.is_empty() && !name.starts_with('-') && !name.contains('/') && name != "." && name != ".."
|
||||
}
|
||||
|
||||
pub fn rosetta_runs_x86_64() -> bool {
|
||||
crate::cmdutil::run("/usr/bin/arch", &["-x86_64", "/usr/bin/true"]).is_some()
|
||||
}
|
||||
|
||||
pub fn gather(bottle: Option<&str>, wine: Option<(String, &Path)>, min_start_free: u8) -> Facts {
|
||||
Facts {
|
||||
host_arch: std::env::consts::ARCH,
|
||||
crossover: wine.map(|(v, p)| (v, p.to_path_buf())),
|
||||
rosetta_runs_x86_64: rosetta_runs_x86_64(),
|
||||
bottle: bottle.map(|b| (b.to_string(), crate::run::bottle_prefix(b))),
|
||||
free_percent: crate::memory::free_percentage(),
|
||||
min_start_free,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_json(checks: &[Check]) -> Json {
|
||||
Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-doctor/0")),
|
||||
("ready", Json::Bool(checks.iter().all(|c| c.ok))),
|
||||
(
|
||||
"checks",
|
||||
Json::Arr(
|
||||
checks
|
||||
.iter()
|
||||
.map(|c| {
|
||||
Json::obj(vec![
|
||||
("name", Json::str(c.name)),
|
||||
("ok", Json::Bool(c.ok)),
|
||||
("detail", Json::str(c.detail.clone())),
|
||||
])
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn failing(checks: &[Check]) -> Vec<&str> {
|
||||
checks.iter().filter(|c| !c.ok).map(|c| c.name).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_pieces_are_named() {
|
||||
let f = Facts {
|
||||
host_arch: "aarch64",
|
||||
crossover: None,
|
||||
rosetta_runs_x86_64: false,
|
||||
bottle: Some(("nope".into(), "/nonexistent/nope".into())),
|
||||
free_percent: Some(10),
|
||||
min_start_free: 50,
|
||||
};
|
||||
assert_eq!(
|
||||
failing(&evaluate(&f)),
|
||||
["crossover_installed", "rosetta", "bottle", "free_memory"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_synthetic_environment_passes() {
|
||||
let dir = std::env::temp_dir().join(format!("bx-preflight-{}", std::process::id()));
|
||||
std::fs::create_dir_all(dir.join("bottle/drive_c")).unwrap();
|
||||
std::fs::write(dir.join("wine"), "").unwrap();
|
||||
std::fs::write(dir.join("wineserver"), "").unwrap();
|
||||
let f = Facts {
|
||||
host_arch: "aarch64",
|
||||
crossover: Some(("1.0".into(), dir.join("wine"))),
|
||||
rosetta_runs_x86_64: true,
|
||||
bottle: Some(("bottle".into(), dir.join("bottle"))),
|
||||
free_percent: Some(80),
|
||||
min_start_free: 50,
|
||||
};
|
||||
assert!(failing(&evaluate(&f)).is_empty());
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bottle_names_that_are_paths_or_options_are_invalid() {
|
||||
for bad in ["", "..", ".", "a/b", "--bottle"] {
|
||||
assert!(!valid_bottle_name(bad), "{bad}");
|
||||
}
|
||||
assert!(valid_bottle_name("betterxen-test"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
//! Exclusive report creation: previous evidence is never replaced.
|
||||
|
||||
use crate::json::Json;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
static SEQUENCE: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
/// Save a run or benchmark report under a unique name, reporting all I/O errors.
|
||||
pub fn save(dir: &Path, kind: &str, report: &Json) -> io::Result<PathBuf> {
|
||||
if !matches!(kind, "run" | "bench") {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"unknown report kind",
|
||||
));
|
||||
}
|
||||
std::fs::create_dir_all(dir)?;
|
||||
let nanos = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map_err(io::Error::other)?
|
||||
.as_nanos();
|
||||
let bytes = report.render();
|
||||
loop {
|
||||
let sequence = SEQUENCE.fetch_add(1, Ordering::Relaxed);
|
||||
let path = dir.join(format!(
|
||||
"{kind}-{nanos}-{}-{sequence}.json",
|
||||
std::process::id()
|
||||
));
|
||||
match write_new(&path, bytes.as_bytes(), |file, bytes| file.write_all(bytes)) {
|
||||
Err(e) if e.kind() == io::ErrorKind::AlreadyExists => continue,
|
||||
Err(e) => return Err(e),
|
||||
Ok(()) => return Ok(path),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_new(
|
||||
path: &Path,
|
||||
bytes: &[u8],
|
||||
write: impl FnOnce(&mut File, &[u8]) -> io::Result<()>,
|
||||
) -> io::Result<()> {
|
||||
let mut file = OpenOptions::new().write(true).create_new(true).open(path)?;
|
||||
if let Err(error) = write(&mut file, bytes).and_then(|()| file.sync_all()) {
|
||||
drop(file);
|
||||
// Remove only the incomplete file this call exclusively created.
|
||||
return match std::fs::remove_file(path) {
|
||||
Ok(()) => Err(error),
|
||||
Err(cleanup) => Err(io::Error::new(
|
||||
error.kind(),
|
||||
format!(
|
||||
"{error}; cannot remove incomplete report {}: {cleanup}",
|
||||
path.display()
|
||||
),
|
||||
)),
|
||||
};
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn directory() -> PathBuf {
|
||||
let id = SEQUENCE.fetch_add(1, Ordering::Relaxed);
|
||||
let dir = std::env::temp_dir().join(format!("bx-records-{}-{id}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
dir
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeated_run_and_bench_reports_preserve_prior_evidence() {
|
||||
let dir = directory();
|
||||
std::fs::write(dir.join("bench.json"), "previous evidence").unwrap();
|
||||
let first = save(&dir, "run", &Json::str("first")).unwrap();
|
||||
let second = save(&dir, "run", &Json::str("second")).unwrap();
|
||||
let bench1 = save(&dir, "bench", &Json::str("bench one")).unwrap();
|
||||
let bench2 = save(&dir, "bench", &Json::str("bench two")).unwrap();
|
||||
assert_ne!(first, second);
|
||||
assert_ne!(bench1, bench2);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(first).unwrap(),
|
||||
Json::str("first").render()
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(second).unwrap(),
|
||||
Json::str("second").render()
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(bench1).unwrap(),
|
||||
Json::str("bench one").render()
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(bench2).unwrap(),
|
||||
Json::str("bench two").render()
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(dir.join("bench.json")).unwrap(),
|
||||
"previous evidence"
|
||||
);
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn existing_destination_is_never_truncated() {
|
||||
let dir = directory();
|
||||
let path = dir.join("record.json");
|
||||
std::fs::write(&path, "original").unwrap();
|
||||
let error =
|
||||
write_new(&path, b"replacement", |file, bytes| file.write_all(bytes)).unwrap_err();
|
||||
assert_eq!(error.kind(), io::ErrorKind::AlreadyExists);
|
||||
assert_eq!(std::fs::read_to_string(&path).unwrap(), "original");
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_directory_is_an_error() {
|
||||
let dir = directory();
|
||||
let path = dir.join("not-a-directory");
|
||||
std::fs::write(&path, "original").unwrap();
|
||||
assert!(save(&path, "run", &Json::Null).is_err());
|
||||
assert_eq!(std::fs::read_to_string(path).unwrap(), "original");
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_write_failure_is_reported_and_incomplete_file_removed() {
|
||||
let dir = directory();
|
||||
let path = dir.join("record.json");
|
||||
let error = write_new(&path, b"a complete report", |file, _| {
|
||||
file.write_all(b"partial")?;
|
||||
Err(io::Error::other("injected write failure"))
|
||||
})
|
||||
.unwrap_err();
|
||||
assert!(error.to_string().contains("injected write failure"));
|
||||
assert!(!path.exists());
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,82 @@
|
||||
//! Probe Windows cross-compilers for original test programs (issue #364).
|
||||
//!
|
||||
//! Reports what is installed and what each compiler targets; it does not install anything.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
|
||||
/// (name, kind). Order is the discovery order only, not a preference.
|
||||
pub const CANDIDATES: &[&str] = &[
|
||||
"aarch64-w64-mingw32-clang",
|
||||
"x86_64-w64-mingw32-clang",
|
||||
"x86_64-w64-mingw32-gcc",
|
||||
"i686-w64-mingw32-gcc",
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Compiler {
|
||||
pub name: String,
|
||||
pub path: String,
|
||||
pub version_line: Option<String>,
|
||||
pub target_machine: Option<String>,
|
||||
}
|
||||
|
||||
pub fn probe(search_path: &str) -> Vec<Compiler> {
|
||||
CANDIDATES
|
||||
.iter()
|
||||
.filter_map(|name| {
|
||||
let path = search_path
|
||||
.split(':')
|
||||
.map(|d| std::path::Path::new(d).join(name))
|
||||
.find(|p| p.is_file())?;
|
||||
let p = path.to_str()?.to_string();
|
||||
Some(Compiler {
|
||||
name: name.to_string(),
|
||||
version_line: run(&p, &["--version"])
|
||||
.and_then(|s| s.lines().next().map(String::from)),
|
||||
target_machine: run(&p, &["-dumpmachine"]),
|
||||
path: p,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
impl Compiler {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("name", Json::str(self.name.clone())),
|
||||
("path", Json::str(self.path.clone())),
|
||||
("version", Json::opt_str(self.version_line.clone())),
|
||||
("target_machine", Json::opt_str(self.target_machine.clone())),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn empty_path_finds_nothing() {
|
||||
assert!(probe("").is_empty());
|
||||
assert!(probe("/nonexistent-dir").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finds_a_stub_compiler_and_reports_its_output() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = std::env::temp_dir().join(format!("bxhybrid-tc-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let f = dir.join("x86_64-w64-mingw32-gcc");
|
||||
std::fs::write(&f, "#!/bin/sh\nif [ \"$1\" = -dumpmachine ]; then echo x86_64-w64-mingw32; else echo stub 1.0; fi\n").unwrap();
|
||||
std::fs::set_permissions(&f, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let found = probe(dir.to_str().unwrap());
|
||||
assert_eq!(found.len(), 1);
|
||||
assert_eq!(
|
||||
found[0].target_machine.as_deref(),
|
||||
Some("x86_64-w64-mingw32")
|
||||
);
|
||||
assert_eq!(found[0].version_line.as_deref(), Some("stub 1.0"));
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
}
|
||||
+25
-3
@@ -8,9 +8,16 @@ then read the [interface contracts](interfaces.md). Reproduce an
|
||||
[independent validation suite](../tests/validation/README.md) before changing
|
||||
either path. The [changelog](../CHANGELOG.md) records notable changes.
|
||||
|
||||
Use the [BetterXen development phases](development-phases.md) for current work
|
||||
order, existing issue/PR dependencies and measurable completion criteria.
|
||||
Historical phase checkpoints retain their original evidence scope.
|
||||
Use the [roadmap](roadmap.md) for the active CrossOver-based hybrid plan, phases,
|
||||
critical path and completion criteria; see [ADR 0005](adr/0005-crossover-hybrid-direction.md)
|
||||
for the decision and [project board setup](planning/project-board.md). Native work is
|
||||
paused: [deferred native roadmap](research/native-roadmap.md) and the archived
|
||||
[native-first plan](archive/development-phases-native-first.md) with
|
||||
[retired milestones](archive/native-first-milestones.json), the
|
||||
[native issue archive](research/native-issue-archive.md) and the retired
|
||||
[H0 to H7 breakdown](archive/hybrid-phases-h0-h7.md). Research inputs: the [upstream research registry](research/upstream-registry.md) and
|
||||
[component reuse matrix](research/component-reuse-matrix.md). Historical phase
|
||||
checkpoints retain their original evidence scope.
|
||||
|
||||
## Architecture and technical design
|
||||
|
||||
@@ -46,6 +53,7 @@ Historical phase checkpoints retain their original evidence scope.
|
||||
|
||||
## Testing, validation, and benchmarks
|
||||
|
||||
- [Hybrid workloads and measurement protocol](testing/hybrid-workloads.md) — Original Windows workload selection, metric definitions, receipt sources and independent reproduction requirements; distinguishes the pending hybrid candidate from merged behavior.
|
||||
- [Migrated pull-request integration review](testing/migration-pr-review.md) — Merge decisions, integration fixes, native verification and excluded concurrent work.
|
||||
- [Testing and acceptance index](testing/README.md) — Entry point for test procedures, evidence and review records.
|
||||
- [AMD RDNA2 desktop GPU (gfx1030) form acceptance](testing/shader-form-acceptance.md) — Independence, command, log and promotion rules for fixture-verified instruction forms.
|
||||
@@ -61,9 +69,23 @@ Historical phase checkpoints retain their original evidence scope.
|
||||
|
||||
- [Public sources](research/sources.md), [RDNA 2 notes](research/rdna2.md), and [Xbox GPU evidence](research/xbox-gpu.md) — Specifications, evidence scope, and unknown console behavior.
|
||||
- [Shader inputs](research/shader-containers.md) and [risk register](risk-register.md) — Input provenance and unresolved engineering risks.
|
||||
- [Running a program through the hybrid path](hybrid-execution.md) — What each layer owns, the commands, the acceptance gates with their evidence and limits, and security limits.
|
||||
- [Security review of the hybrid path](research/security-audit-2026-11-25.md) — Why a CrossOver bottle is not a sandbox, findings and what was not reviewed.
|
||||
- [Shader import decision proposal](research/shader-import-decision.md) — The objections to #394 sorted by kind, what can be kept, and the options.
|
||||
- [Reference projects](research/reference-projects-2026-11-25.md) — Which rules restrict each reference repository and what a different policy could evaluate.
|
||||
- [PortWatch VI inventory](research/portwatch-inventory-2026-11-25.md) — Metadata-only snapshot of the tracker's projects ([JSON](research/portwatch-inventory-2026-11-25.json)).
|
||||
- [Audit coverage ledger](research/audit-ledger.tsv) — Every tracked file with the depth it was inspected.
|
||||
- [d3dmetal-native evaluation](research/d3dmetal-native-evaluation.md) — Source review and build of a Wine-free D3DMetal host; not run against D3DMetal; reference only.
|
||||
- [Hybrid runtime audit and integration record](research/hybrid-runtime-audit-2026-11-25.md) — Integration base, open pull-request dispositions, audit coverage and remaining blockers (2026-11-25).
|
||||
- [Upstream integration audit](research/upstream-integration-audit.md) — Source-level review of external macOS compatibility projects, licence and provenance decisions, and what was implemented in `crates/hybrid`.
|
||||
- [CrossOver baseline](research/crossover-baseline-2026-11-25.md) — First executions of original workloads under CrossOver 26.3 on the M4, backend comparison and its limits.
|
||||
- [Windows cross-toolchain](research/hybrid-toolchain.md) — Pinned llvm-mingw release, how original Windows workloads are built, and what was and was not executed.
|
||||
- [Texture format inventory](research/texture-formats.md) — Formats and layouts by stage (decode, layout, native upload, sampling, guest), their public specifications, unknowns and ranked follow-ups.
|
||||
- [PortWatch native macOS research](research/portwatch-native-macos.md) — Screening of public Xbox-on-Windows port projects for native macOS planning; discovery only.
|
||||
- [Synthetic integration and upstream evidence](research/synthetic-integration.md) — Audited source snapshots and remaining commercial startup prerequisites.
|
||||
- [Hybrid backlog research record](research/hybrid-backlog-research-2026-11-25.md) — Findings, registry candidates and the issues they produced (2026-11-25); not verified on hardware.
|
||||
- [Primary-source verification](research/primary-source-verification-2026-11-25.md) — Which hybrid-research claims were confirmed, contradicted or left unverified against vendor documentation.
|
||||
- [CrossOver licensing boundaries](research/crossover-licensing.md) — Per-component licenses and redistribution status for the hybrid direction, with the unread documents named.
|
||||
|
||||
## Security, licensing, and contributions
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# ADR 0005: CrossOver-based hybrid direction
|
||||
|
||||
Status: **Accepted (strategic direction).** Accepted by the maintainers' planning directive of 2026-11-25. The proposed technical architecture below is **not** accepted or verified; each integration still needs validation.
|
||||
|
||||
## Context
|
||||
|
||||
BetterXen was developed native-first: an independent x86-64 decoder, interpreter, ARM64 translator, runtime, shader compiler and Metal backend, verified only on synthetic programs and shaders. No Xbox title runs on it. The maintainers decided to focus all active engineering on a hybrid architecture and to pause native work.
|
||||
|
||||
## Accepted strategic direction
|
||||
|
||||
- CrossOver is the primary compatibility foundation, installed externally.
|
||||
- Hybrid is the only active development direction. Native research is preserved (tag `native-first-final` marks the last `main` commit before this change; the code stays in the workspace) and paused; resuming needs an explicit maintainer decision.
|
||||
- Reuse established infrastructure; build independent replacements only for demonstrated limitations.
|
||||
- The engineering rules in `AGENTS.md` (and `CLAUDE.md`, a symlink) were rewritten accordingly, replacing the former prohibition on Wine, CrossOver, Rosetta and MoltenVK.
|
||||
|
||||
## Proposed technical architecture (not accepted)
|
||||
|
||||
BetterXen provides integration, configuration, environment management, diagnostics, reproducible testing, benchmarking and measured optimization around CrossOver. Within CrossOver, the intended layers are Wine-based runtime APIs, Rosetta 2 for x86-64 translation and D3DMetal or DXMT for graphics, on Apple Silicon (ARM64, Metal, unified memory). The exact responsibility boundary is decided in #351, at the end of Phase 1.
|
||||
|
||||
## Unverified integration assumptions
|
||||
|
||||
- That CrossOver, Rosetta 2, D3DMetal or DXMT run any authorized workload BetterXen needs. Assumed not until measured (#355).
|
||||
- That CrossOver offers supported interfaces for bottle management, configuration, launching and diagnostics (#350).
|
||||
- Rosetta 2's support lifetime and D3DMetal's license terms (#349, #354).
|
||||
- That any of this provides Xbox runtime compatibility. It is assumed not to.
|
||||
|
||||
## Verified implementation capabilities
|
||||
|
||||
None for the hybrid architecture. Verified native-research capabilities (synthetic evidence only) are unchanged and listed in `docs/progress.md`.
|
||||
|
||||
## Planning consequence
|
||||
|
||||
Planning is progressive: Phase 1 (research, feasibility and baseline) is the only active phase; later phases are provisional and defined from its findings. Native work is paused indefinitely.
|
||||
|
||||
## Consequences
|
||||
|
||||
Positive: reuse of mature infrastructure. Negative: dependence on a proprietary vendor and on Rosetta 2 availability; limited ability to modify closed components; the former "No Wine, No CrossOver, No Rosetta" project identity is retired for active work. Anything derived from leaked or unauthorized material stays excluded, including projects built for such inputs (see the upstream registry).
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
Continue native-first; maintain both tracks at 75/25; a generic Wine-based stack without CrossOver.
|
||||
@@ -1,3 +1,5 @@
|
||||
> **Archived 2026-11-25 (superseded). Not the active plan.** Native-first plan retained for history; the active roadmap is [../roadmap.md](../roadmap.md). Relative links below were written for `docs/` and may need `../`.
|
||||
|
||||
# BetterXen development phases
|
||||
|
||||
This is BetterXen's working development plan. Each phase ends with a reproducible
|
||||
@@ -26,10 +28,10 @@ Historical results below remain evidence for their recorded candidates only.
|
||||
| Native app | Swift app, Rust C interface, controller input and audio/virtual-filesystem fixtures | Existing fixtures do not establish one integrated threaded C++ 3D application. |
|
||||
| Quality tools | CPU/runtime inventories, shader coverage reconciliation, task queue, PR checks and acceptance records | Some inventories and ledgers contain stale limitation text. A successful tool invocation does not prove every catalog entry is current. |
|
||||
|
||||
Sources: [CPU registry](cpu/instruction-registry.md),
|
||||
[runtime registry](runtime/registry.md), [guest threads](runtime/threads.md),
|
||||
[interfaces](interfaces.md), [shader coverage](shaders/semantic-coverage.md),
|
||||
[Gate A](testing/gate-a.md), and [QA tooling](testing/infrastructure/README.md).
|
||||
Sources: [CPU registry](../cpu/instruction-registry.md),
|
||||
[runtime registry](../runtime/registry.md), [guest threads](../runtime/threads.md),
|
||||
[interfaces](../interfaces.md), [shader coverage](../shaders/semantic-coverage.md),
|
||||
[Gate A](../testing/gate-a.md), and [QA tooling](../testing/infrastructure/README.md).
|
||||
The read-only shader reconciliation reported zero mismatches during this task;
|
||||
that result is inventory consistency, not new GPU verification.
|
||||
|
||||
@@ -40,18 +42,18 @@ but their phase numbers are not the sequence for new BetterXen work.
|
||||
|
||||
| Existing record or name | Meaning | How to use it now |
|
||||
| --- | --- | --- |
|
||||
| [Phase 01 checkpoints and assurance](testing/phase01-assurance.md), [risk register](risk-register.md), [review log](testing/review-log.md) and [mutation record](testing/mutation.md) | Earlier bounded shader research and candidate-specific gates | Consult the original gate definitions and unresolved findings; do not relabel them as current acceptance. |
|
||||
| [Phase 02 GPU/guest baseline](testing/phase-02-baseline.md) and [CPU feasibility](research/phase02-cpu-feasibility.md), [ecosystem](research/phase02-ecosystem.md), [collaboration](research/phase02-collaboration.md) research | Early graphics expansion and CPU feasibility work | Reuse documented public sources and evidence limits, checking them against current source. |
|
||||
| [CPU/runtime campaign ledger](coordination/cpu-campaign-ledger.md) | Implementation batches and local evidence | Its older limitations are not a current feature inventory: scheduler, atomic and string work has since landed. |
|
||||
| [Infrastructure Phase II/III tooling](testing/infrastructure/README.md) and [compatibility ledger](testing/infrastructure/phase3-compat-ledger.md) | A separate QA campaign | Tool code now includes compatibility-gap analysis and verification profiles beyond the ledger's early checkpoint. Coordinate with existing issue #219 rather than starting another QA framework. |
|
||||
| [Gate A](testing/gate-a.md) | Compiled C execution, split into A1 and hosted-C A2 | A1 has a main-branch test. A2 is under review in PR #283; the document's “not started” description predates that PR. Neither is independently accepted by this plan. |
|
||||
| [Phase 01 checkpoints and assurance](../testing/phase01-assurance.md), [risk register](../risk-register.md), [review log](../testing/review-log.md) and [mutation record](../testing/mutation.md) | Earlier bounded shader research and candidate-specific gates | Consult the original gate definitions and unresolved findings; do not relabel them as current acceptance. |
|
||||
| [Phase 02 GPU/guest baseline](../testing/phase-02-baseline.md) and [CPU feasibility](../research/phase02-cpu-feasibility.md), [ecosystem](../research/phase02-ecosystem.md), [collaboration](../research/phase02-collaboration.md) research | Early graphics expansion and CPU feasibility work | Reuse documented public sources and evidence limits, checking them against current source. |
|
||||
| [CPU/runtime campaign ledger](../coordination/cpu-campaign-ledger.md) | Implementation batches and local evidence | Its older limitations are not a current feature inventory: scheduler, atomic and string work has since landed. |
|
||||
| [Infrastructure Phase II/III tooling](../testing/infrastructure/README.md) and [compatibility ledger](../testing/infrastructure/phase3-compat-ledger.md) | A separate QA campaign | Tool code now includes compatibility-gap analysis and verification profiles beyond the ledger's early checkpoint. Coordinate with existing issue #219 rather than starting another QA framework. |
|
||||
| [Gate A](../testing/gate-a.md) | Compiled C execution, split into A1 and hosted-C A2 | A1 has a main-branch test. A2 is under review in PR #283; the document's “not started” description predates that PR. Neither is independently accepted by this plan. |
|
||||
| Native app numbered gates in `crates/ffi` and `app` | Bounded session, graphics, audio and filesystem fixtures | Inspect their tests before proposing integration. Gate numbers are separate from shader acceptance gates. |
|
||||
| README X1–X25 milestones | Broad capability map | Retain as a capability reference; use the phases below for the next work order. |
|
||||
| Supplied Discord III, III-B, IV, V and VI excerpts | Broad runtime, graphics, application and performance objectives | Only excerpts were supplied. Their omitted requirements and completion status are unknown; they are not execution instructions. |
|
||||
|
||||
Bare issue numbers in historical documents may refer to the source repository.
|
||||
All issue and PR links in the work sections below refer to **MacosPorters/betterxen**.
|
||||
Use [migration records](migration.md) to resolve historical references.
|
||||
Use [migration records](../migration.md) to resolve historical references.
|
||||
|
||||
## Phase 1 — Establish a trustworthy working baseline
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
# Detailed hybrid phases H0 to H7 (retired planning)
|
||||
|
||||
**Archived 2026-11-25; not the active plan.** These eight phases were defined before any research had been done. The active roadmap is [../roadmap.md](../roadmap.md): five provisional phases, with only Phase 1 active. The text below preserves the objectives, scope and exit conditions of the retired H2 to H7 milestones (and H0/H1) for reference when later phases are defined. Issue numbers in it are historical.
|
||||
|
||||
## Phases as originally written
|
||||
|
||||
### H0 — CrossOver Architecture Transition
|
||||
|
||||
**Status:** In development
|
||||
|
||||
**Objective:** Make CrossOver the single authoritative active compatibility foundation across the repository and GitHub planning surfaces.
|
||||
|
||||
**Scope:** README, architecture docs, ADR 0005, rewritten engineering rules, roadmap, upstream research registry, technical plans, labels, milestones, issue and PR templates, issue triage, project board, preservation of the native implementation.
|
||||
|
||||
**Dependencies:** None.
|
||||
|
||||
**Deliverables:** Updated README and docs; ADR 0005; docs/roadmap.md; deferred docs/research/native-roadmap.md; rebuilt issues and milestones; project board; preserved native code.
|
||||
|
||||
**Validation:** Repository link/terminology check; GitHub consistency check.
|
||||
|
||||
**Exit conditions:** Repository, documentation, issues, milestones and board consistently state the CrossOver-based direction. The project board requires a token with the project scope and is not yet configured.
|
||||
|
||||
**Known risks:** Project board cannot be configured without the GitHub project token scope (#346). The engineering rules conflict was resolved by rewriting AGENTS.md (#345).
|
||||
|
||||
### H1 — CrossOver Research and Baseline
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Establish what the installed CrossOver version actually provides and a reproducible baseline, without assuming it provides Xbox runtime compatibility.
|
||||
|
||||
**Scope:** CrossOver architecture, supported macOS versions, Apple Silicon support, relationship to upstream Wine, CPU translation mechanism, graphics backends (D3DMetal, DXMT and others), supported Direct3D versions, configuration interfaces, documented command-line interfaces, bottle management, diagnostics and profiling options, licensing and redistribution, supported integration mechanisms, long-term maintenance. Open-source and proprietary components distinguished.
|
||||
|
||||
**Dependencies:** Engineering rules rewritten (#345, done). CrossOver is an externally installed dependency until its license says otherwise; nothing is bundled.
|
||||
|
||||
**Deliverables:** CrossOver capability and integration-boundary report; licensing and dependency assessment; reproducible environment; baselines of CPU, GPU, memory and stability on authorized workloads.
|
||||
|
||||
**Validation:** Every claim cites vendor or upstream documentation, or a recorded observation on the installed version. Unknown stays unknown. Equivalent workloads, settings, hardware and software versions.
|
||||
|
||||
**Exit conditions:** Capabilities and integration boundaries are documented for the installed version; environment is reproducible by another contributor; baselines recorded; BetterXen vs CrossOver responsibilities proposed.
|
||||
|
||||
**Known risks:** CrossOver is proprietary: bundling, modifying or redistributing may be prohibited; integration interfaces may be undocumented; Xbox titles may not run at all.
|
||||
|
||||
### H2 — BetterXen Integration Foundation
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Build the BetterXen layer around CrossOver: integration boundaries, configuration, diagnostics, reproducible test workflows and host integration.
|
||||
|
||||
**Scope:** Environment and configuration management, diagnostics, test workflows, verified host integration, regression testing. Only what CrossOver does not already provide adequately.
|
||||
|
||||
**Dependencies:** H1.
|
||||
|
||||
**Deliverables:** Boundary document; configuration and environment management where justified; diagnostic infrastructure; reproducible test workflows; verified host integration; regression tests.
|
||||
|
||||
**Validation:** Independent contributor reproduces the workflows; no placeholder components.
|
||||
|
||||
**Exit conditions:** Integration foundation builds, tests and reproduces on a second setup.
|
||||
|
||||
**Known risks:** Reliance on undocumented or changing CrossOver behavior.
|
||||
|
||||
### H3 — Compatibility Validation
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate authorized workloads and document verified behavior and limitations.
|
||||
|
||||
**Scope:** Authorized workloads, documented limitations, runtime behavior, graphics correctness, input and interaction, reproducible failures, integrated validation criteria.
|
||||
|
||||
**Dependencies:** H2.
|
||||
|
||||
**Deliverables:** Validation criteria; per-workload results; reproducible failure reports; verified runtime, graphics and input results.
|
||||
|
||||
**Validation:** Independent verification of rendering and behavior. Startup or a screenshot alone is not proof.
|
||||
|
||||
**Exit conditions:** Selected workloads show verified integrated behavior under documented criteria; failures reproducible.
|
||||
|
||||
**Known risks:** Failures may originate in CrossOver or its components outside project control.
|
||||
|
||||
### H4 — Graphics and Performance Engineering
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate graphics backends and optimize only demonstrated bottlenecks.
|
||||
|
||||
**Scope:** Supported backends, CPU/GPU utilization, unified memory, frame-time consistency, synchronization, shader compilation and caching. Metrics: average FPS, 1% low, frame-time percentiles, CPU and GPU utilization, unified memory, memory pressure, translation overhead where measurable, shader compile latency, startup, thermals, long-duration stability. Reference machine: M4 Mac, 24 GB.
|
||||
|
||||
**Dependencies:** H3; measurement protocol.
|
||||
|
||||
**Deliverables:** Backend comparison; profiling reports; bottleneck list; before/after results; regression tests.
|
||||
|
||||
**Validation:** Equivalent workloads, rendering settings, hardware and versions; correctness and rendering equivalence verified.
|
||||
|
||||
**Exit conditions:** Improvements measurable, reproducible and without loss of correctness or stability. No improvement is promised before measurement.
|
||||
|
||||
**Known risks:** Many components are closed and not modifiable; single reference machine.
|
||||
|
||||
### H5 — Stability and Hardware Scaling
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate Apple Silicon configurations, memory pressure, thermals and long-duration stability.
|
||||
|
||||
**Scope:** Available Apple Silicon configurations, memory pressure, thermal behavior, long-duration tests, hardware documentation, regression coverage.
|
||||
|
||||
**Dependencies:** H3; hardware access.
|
||||
|
||||
**Deliverables:** Hardware compatibility documentation; memory-pressure and thermal reports; long-duration results; expanded regression coverage.
|
||||
|
||||
**Validation:** Each documented configuration backed by a test run on it.
|
||||
|
||||
**Exit conditions:** Tested configurations documented; untested hardware never claimed.
|
||||
|
||||
**Known risks:** Only one reference machine currently available.
|
||||
|
||||
### H6 — Hybrid Architecture Maturity
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Maintainable integration infrastructure and contributor workflows.
|
||||
|
||||
**Scope:** Contributor workflows, verified-capability documentation, reproducible performance results, complexity reduction, long-term dependency risk (CrossOver, Rosetta 2, D3DMetal).
|
||||
|
||||
**Dependencies:** H3 to H5 evidence.
|
||||
|
||||
**Deliverables:** Maintainable infrastructure; contributor documentation; verified capability list; reproducible results; dependency risk assessment.
|
||||
|
||||
**Validation:** Contributors other than the authors maintain the workflow.
|
||||
|
||||
**Exit conditions:** The architecture shows demonstrated value and the team can maintain it.
|
||||
|
||||
**Known risks:** Vendor decisions (CrossOver licensing, Rosetta lifetime) are outside project control.
|
||||
|
||||
### H7 — Future Native Reassessment (deferred)
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Deferred. Reassess independent native components only on an explicit maintainer decision or when one offers a demonstrated benefit to the active architecture.
|
||||
|
||||
**Scope:** See docs/research/native-roadmap.md.
|
||||
|
||||
**Dependencies:** Explicit maintainer decision.
|
||||
|
||||
**Deliverables:** Reassessment record.
|
||||
|
||||
**Validation:** Maintainer decision recorded in an ADR.
|
||||
|
||||
**Exit conditions:** A recorded decision to continue, resume specific native work, or archive components.
|
||||
|
||||
**Known risks:** Premature reinvention of mature infrastructure.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[{"closed_issues":15,"description":"G1–G15 for the bounded native ARM64 and Metal graphics foundation. Release acceptance requires all gates on the exact candidate.","html_url":"https://github.com/MacosPorters/betterxen/milestone/1","number":1,"open_issues":0,"state":"open","title":"Phase 01 - Native Graphics Foundation"},{"closed_issues":7,"description":"Develop independently authored interoperability tests and fixtures from public specifications. External emulator results may inform test selection. Xenora owns its Rust ARM64 runtime, decoder, typed IR, shader compiler and Metal backend. Emulator code, ports, decoder tables, internal metadata and platform-specific dependencies are outside scope.","html_url":"https://github.com/MacosPorters/betterxen/milestone/2","number":2,"open_issues":0,"state":"open","title":"Phase 02 - Ecosystem Integration"},{"closed_issues":8,"description":"Expand independently verified gfx1030 semantics, resource access, wave behavior and native offscreen drawing.\n\n### Deferred engineering\n- [#25](https://github.com/ranveersoni98/Xenora/issues/25) · Verify Wave64 pairing on native Metal. Exercise both halves, cross-half operations, asymmetric masks and barrier safety with 64-lane readback.\n- [#27](https://github.com/ranveersoni98/Xenora/issues/27) · Translate bounded vertex and fragment fixtures. Define stage IO and interpolation from public specifications; verify exact offscreen pixels.","html_url":"https://github.com/MacosPorters/betterxen/milestone/3","number":3,"open_issues":0,"state":"open","title":"Phase 03 - Graphics Maturation"},{"closed_issues":6,"description":"Measure correctness-gated CPU, translation and GPU behavior under reproducible host conditions. Track capability and failure evidence.\n\n### Deferred engineering\n- [#33](https://github.com/ranveersoni98/Xenora/issues/33) · Measure Metal pipeline reuse and cache identity. Separate cold and warm timing; test cache invalidation and verify shared output expectations.","html_url":"https://github.com/MacosPorters/betterxen/milestone/4","number":4,"open_issues":0,"state":"open","title":"Phase 04 - Performance and Compatibility"},{"closed_issues":7,"description":"Grow the bounded interpreter and independently demonstrate ARM64 recompilation, with precise state and fault behavior.\n\n### Deferred engineering\n- [#40](https://github.com/ranveersoni98/Xenora/issues/40) · Choose first measured recompilation target. Use interpreter profiles to choose one bounded basic block and document precise state and fault requirements.\n- [#41](https://github.com/ranveersoni98/Xenora/issues/41) · Execute one translated ARM64 guest basic block. Execute emitted ARM64 code natively, compare registers, flags, memory and traps with interpreter and independent vectors.\n- [#42](https://github.com/ranveersoni98/Xenora/issues/42) · Verify code cache and executable memory policy. Validate mapping permissions, publication, invalidation and dependency provenance on macOS.\n- [#43](https://github.com/ranveersoni98/Xenora/issues/43) · Measure ARM64 translation performance. Compare correctness-gated translated and interpreted inputs with matched native runs and resource records.","html_url":"https://github.com/MacosPorters/betterxen/milestone/5","number":5,"open_issues":0,"state":"open","title":"Phase 05 - CPU Recompilation"},{"closed_issues":6,"description":"Build isolated guest loading, memory, services and checked CPU-to-GPU commands using original inputs.\n\n### Deferred engineering\n- [#49](https://github.com/ranveersoni98/Xenora/issues/49) · Expand synthetic services and authorized runtime boundaries. Define explicit service ABI, faults and lifetimes with original inputs. Document evidence gaps for authentic Xbox platform contracts.\n\nFuture import behavior is tracked in [#55](https://github.com/ranveersoni98/Xenora/issues/55). Compatibility checks do not inspect user acquisition or ownership.","html_url":"https://github.com/MacosPorters/betterxen/milestone/6","number":6,"open_issues":0,"state":"open","title":"Phase 06 - Runtime Infrastructure"},{"closed_issues":5,"description":"Validate the integrated execution path and exact release candidate. Project-run title testing requires suitable inputs and independent evidence. The loader evaluates format and compatibility without checking where user files came from.","html_url":"https://github.com/MacosPorters/betterxen/milestone/7","number":7,"open_issues":1,"state":"open","title":"Phase 07 - Integrated Validation"}]
|
||||
@@ -0,0 +1,70 @@
|
||||
# Native-first README milestones (archived)
|
||||
|
||||
**Archived 2026-11-25; paused native research, not the active plan.** This section was the README's "Milestones" content on `main` when BetterXen moved to the CrossOver-based hybrid direction. Statuses describe the native implementation only, with synthetic evidence. The active plan is the [roadmap](../roadmap.md). Links below were written for the repository root README and may need adjusting.
|
||||
|
||||
## Native-first milestones
|
||||
|
||||
BetterXen's work order is the six [development phases](development-phases-native-first.md), which lead to one concrete target: the **first launchable application** (tracker [#311](https://github.com/MacosPorters/betterxen/issues/311)). That target is an original C program, built with native ARM64 tools, that runs through the ARM64 translator, controls its own translated shader pipeline, and shows its Metal frame in the native app window. It is **not** a commercial or authentic Xbox title, and no date or percentage is attached to it.
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'fontFamily':'system-ui, sans-serif','lineColor':'#6e7781'}}}%%
|
||||
flowchart LR
|
||||
P1["<b>Phase 1</b><br/>Trustworthy baseline"]:::wip --> P2["<b>Phase 2</b><br/>Hosted C application"]:::wip
|
||||
P2 --> P3["<b>Phase 3</b><br/>Coherent threading"]:::wip
|
||||
P3 --> P4["<b>Phase 4</b><br/>Resource updates<br/>to translated rendering"]:::wip
|
||||
P4 --> P5["<b>Phase 5</b><br/>One integrated<br/>interactive application"]:::plan
|
||||
P5 --> P6["<b>Phase 6</b><br/>Measured performance"]:::plan
|
||||
P2 --> L(["<b>First launchable app</b><br/>issue 311"]):::goal
|
||||
P4 --> L
|
||||
classDef wip fill:#fff8c5,stroke:#9a6700,color:#4d2d00
|
||||
classDef plan fill:#eaeef2,stroke:#8c959f,color:#24292f
|
||||
classDef goal fill:#dafbe1,stroke:#1a7f37,color:#0f5323,stroke-width:3px
|
||||
```
|
||||
|
||||
<sub>🟨 work under way · ⬜ not started · 🟩 the next original-workload target. Nothing here is independently accepted.</sub>
|
||||
|
||||
| Phase | Goal | State | What exists now |
|
||||
| --- | --- | --- | --- |
|
||||
| **1 · Baseline** | Contributors can tell what exists on `main`, what is pending review, and which checks ran | 🟡 In progress | CODEOWNERS review, a fast repository hygiene check, claim-before-work rules, generated status tables and claim audits |
|
||||
| **2 · Hosted C application** | An original hosted C program starts, uses the runtime, reports results and exits with checked cleanup | 🟡 In progress | CRT startup, arguments, exit handlers, formatted output, file streams and the hosted-C fixture (A2) are integrated; a stdio follow-up is still open and the result is not independently accepted |
|
||||
| **3 · Threaded behavior** | A worker-based application can block and resume without stalling other guest work | 🟡 In progress | Deterministic scheduler, guest thread contexts, guarded stacks and thread services. Guest `Sleep` still delays all guest threads (#304); worker TLS and callback lifecycle is a design draft (#312) |
|
||||
| **4 · Resource updates to rendering** | A guest updates a texture and geometry, submits translated rendering and gets a checked frame | 🟡 In progress | Persistent resources, descriptor-table texture binding, translated vertex and pixel stages, blend, depth and indexed draws. Guest-selected pipelines and the typed graphics bridge are open (#314–#316) |
|
||||
| **5 · Integrated interactive app** | Guest execution, rendering, input, audio, filesystem and lifecycle in one session | ⚪ Planned | Swift app with frame loop, input, audio and sandboxed filesystem fixtures exists, but those demonstrations are not guest-integration evidence |
|
||||
| **6 · Measured performance** | Faster execution of workloads whose correctness is already checked | ⚪ Planned | Startup, DBT and TLS measurements recorded; bottlenecks are chosen from measurements, not assumed |
|
||||
|
||||
The launch milestone's proposed acceptance is **60 bounded frames containing two independently distinguishable guest-controlled states, then a clean close and one restart**. Sixty is a fixture criterion, not a measured frame rate. The work is tracked as issues [#313](https://github.com/MacosPorters/betterxen/issues/313)–[#323](https://github.com/MacosPorters/betterxen/issues/323).
|
||||
|
||||
<details>
|
||||
<summary><b>Capability reference: the original X1–X25 map</b></summary>
|
||||
|
||||
The X1–X25 names are an older, broad capability map. Keep them as a reference; use the phases above for the next work order. X10–X25 are proposed engineering milestones, not completed implementations or a guaranteed sequence.
|
||||
|
||||
| Milestone | Implementation | Status |
|
||||
| --- | --- | --- |
|
||||
| X1 — Guest CPU | Bounded x86-64 instruction execution on ARM64 macOS | Verified |
|
||||
| X2 — Executable loading | Loading original fixed-base PE32+ test executables | Verified |
|
||||
| X3 — GPU compute | Guest-submitted Metal compute workloads and readback | Verified |
|
||||
| X4 — Metal rendering | Guest-driven offscreen rendering using authored Metal shaders | Verified |
|
||||
| X5 — Guest execution expansion | Additional bounded CPU execution and fixture coverage | Implemented |
|
||||
| X6 — Guest control flow | Nested calls, returns, checked memory and synthetic PE execution | Verified |
|
||||
| X7 — Imported services | Named imports, guest-to-host service dispatch and result validation | Verified |
|
||||
| X8 — Translated compute | Original gfx1030 compute shaders executing on Metal, partial Wave32 handling and BC1 readback | Verified subset |
|
||||
| X9 — Translated graphics | Persistent resource handles, translated vertex/pixel stages and offscreen Metal rendering | Verified subset |
|
||||
| X10 — Texture sampling | One translated `image_sample_lz` pixel stage with point/clamp sampling of RGBA8 and BC1 2D textures bound through descriptor tables, locally verified on Apple M5 Pro; upload, readback and decode of BC compressed formats (see [Texture support](#texture-support)). Other image instructions and formats are not implemented | Implemented subset |
|
||||
| X11 — Graphics pipeline | Bounded multi-draw passes into offscreen RGBA8 targets: translated vertex and pixel stages, indexed triangle draws, colour write masks and blend state | Implemented |
|
||||
| X12 — Wave execution | Expand Wave32/Wave64 semantics, divergent control flow, cross-lane operations, LDS and barriers | Planned |
|
||||
| X13 — Advanced shaders | Mesh, geometry and additional compute shader capabilities with verified Metal execution | Planned |
|
||||
| X14 — CPU recompilation | Native ARM64 dynamic recompilation of supported x86-64 instructions in synthetic fixtures | Implemented subset |
|
||||
| X15 — Executable compatibility | Static PE inspection reports sections, relocations, thread-local storage (TLS) callbacks, imports and entry-point instructions | Static probe implemented |
|
||||
| X16 — Guest memory and threading | Virtual memory mapping, thread scheduling, synchronization primitives and atomic operations | Implemented subset |
|
||||
| X17 — System services | Implement a tested subset of Xbox-compatible runtime APIs, memory services, filesystem access and application lifecycle | Implemented subset |
|
||||
| X18 — Graphics API translation | Translate supported Xbox graphics commands, resource descriptors, command queues, barriers and fences into Metal operations | Planned |
|
||||
| X19 — Advanced GPU features | Indirect rendering, asynchronous compute, additional texture formats and ray-tracing compatibility research | Planned |
|
||||
| X20 — Integrated guest runtime | Connect CPU recompilation, executable loading, system services and graphics translation into one persistent runtime | Planned |
|
||||
| X21 — Application compatibility | Execute increasingly complex independently authored applications through the complete guest CPU and GPU pipeline | Planned |
|
||||
| X22 — First application boot | Establish a reproducible startup and error-reporting path for supported game-like applications | Planned |
|
||||
| X23 — Initial game compatibility | Investigate startup and execution of legally supported game software, identifying missing runtime and graphics behavior | Long-term goal |
|
||||
| X24 — Gameplay and performance | Expand rendering correctness, input, audio, memory management, shader caching and execution performance | Long-term goal |
|
||||
| X25 — Running games | Achieve reproducible, stable execution of compatible games on native Apple Silicon macOS using Metal | Long-term goal |
|
||||
|
||||
</details>
|
||||
@@ -36,10 +36,9 @@ pending-run replay and exact head-SHA verification against a real repository.
|
||||
|
||||
## Production follow-ups
|
||||
|
||||
1. Keep `agent-pr-checks` advisory until this evidence is reviewed.
|
||||
2. Coordinate adding `pull-requests: read` to the production audit job permissions
|
||||
1. Coordinate adding `pull-requests: read` to the production audit job permissions
|
||||
(same defect as the smoke audit failure).
|
||||
3. Add a second QA-eligible verifier before treating `/verified` as smoke-complete.
|
||||
2. Add a second QA-eligible verifier before treating `/verified` as smoke-complete.
|
||||
|
||||
## Local unit suite
|
||||
|
||||
|
||||
@@ -90,22 +90,6 @@ cycles `agent:invalid` (and restores them when fixed), flags overlapping claims
|
||||
writes a JSON summary to the run summary. `scripts/agent-queue.sh status --json` prints the same
|
||||
machine-readable summary (counts and lists per area, priority and state).
|
||||
|
||||
## Pull request checks
|
||||
|
||||
`agent-pr-checks` fails a pull request when: it has no `Closes #N` for a claimed task; the task is held
|
||||
by someone else; it changes files outside the task's patterns; it changes a file that another open
|
||||
pull request also changes; the claim has lapsed without a push; or no eligible `/verified <current
|
||||
head sha>` exists. The SHA must be the full 40 characters and the only argument: a commit with the
|
||||
same short prefix is cheap to make. After an accepted `/verified` (an eligible verifier, the current
|
||||
head) the verify job evaluates the same check again and writes it to its run summary; the earlier
|
||||
check run is not re-run, since `pull_request_target` runs are recorded against the base branch and
|
||||
cannot be found by the pull request head. Refused, stale, malformed or unauthorized `/verified`
|
||||
comments get a reply and nothing else, and other pull request comments start no job.
|
||||
|
||||
The check is advisory for now: a failure is shown as a warning and in the run summary, and the job
|
||||
still succeeds. It becomes blocking (fail on problems, then a required check) only after a live smoke
|
||||
test on GitHub and the migration of existing issues into the queue.
|
||||
|
||||
## Forks and upstream sync
|
||||
|
||||
Work from a fork, but synchronise against the real upstream (`ranveersoni98/Xenora` in the
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
# Running a program through the hybrid path
|
||||
|
||||
How BetterXen launches an original Windows program through an installed CrossOver, what each part owns, and what has actually been shown to work. This is not game or console compatibility: every program run here was written for BetterXen.
|
||||
|
||||
## What runs where
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
subgraph host["Native arm64 macOS (BetterXen)"]
|
||||
CLI["betterxen hybrid run / bench"] --> PRE["identify program, check backend name and bottle"]
|
||||
PRE --> SUP["supervisor: memory, stall, timeout, output limit"]
|
||||
SUP --> REC["classification, gates, JSON record"]
|
||||
end
|
||||
subgraph ext["External, not shipped by BetterXen"]
|
||||
CX["CrossOver bin/wine (x86_64, under Rosetta 2)"]
|
||||
GFX["D3DMetal, DXMT, DXVK + MoltenVK, or wined3d"]
|
||||
end
|
||||
subgraph guest["x86-64 Windows program (original BetterXen workload)"]
|
||||
W["runtime services, window, D3D11, self-checks"]
|
||||
end
|
||||
SUP --> CX --> W --> GFX --> M["Metal and the macOS compositor"]
|
||||
W -- "gate and frame_ms lines on stdout" --> SUP
|
||||
```
|
||||
|
||||
| Boundary | Owner | Code | Shown by |
|
||||
| --- | --- | --- | --- |
|
||||
| Command line and configuration | BetterXen | `crates/hybrid/src/main.rs` (`parse_run_args`) | unit tests |
|
||||
| Environment preflight | BetterXen | `crates/hybrid/src/preflight.rs` | `doctor` on one Mac; unit tests |
|
||||
| Executable identification | BetterXen | `crates/hybrid/src/pe.rs` | unit tests with hostile inputs; real x86-64 and ARM64 files |
|
||||
| Process start, supervision, stop | BetterXen | `crates/hybrid/src/run.rs` (`execute`, `stop_bottle`), `memory.rs` | stub tests; real pass, crash and hang runs |
|
||||
| Windows API, CPU translation | CrossOver, Wine, Rosetta 2 | external | the workload's own checks only |
|
||||
| Direct3D 11, shader compilation | CrossOver backends and `d3dcompiler_47` | external | pixel comparison in the workload |
|
||||
| Presentation | CrossOver, macOS | external | window capture (`check_window.py`) |
|
||||
| Input | Wine message queue | external | posted messages only |
|
||||
| Records | BetterXen | `records.rs`, `json.rs` | unit tests; records kept per run |
|
||||
|
||||
The native research crates (`xenora-*`: x86-64 loader and translator, GFX10.3 shader compiler, Metal backend) are **not on this path**. Nothing in `betterxen-hybrid` depends on them, and the `betterxen` and `app/` front ends reach only the native research code. No console shader translator is connected to the hybrid path.
|
||||
|
||||
CrossOver's `bin/wine --bottle`, `wineserver -k` and `CX_GRAPHICS_BACKEND` are not documented by CodeWeavers as macOS automation interfaces ([#350](https://github.com/MacosPorters/betterxen/issues/350)). A CrossOver update may break them.
|
||||
|
||||
## Commands and independent reproduction
|
||||
|
||||
`betterxen hybrid <command>` is the interface; the `betterxen-hybrid` binary runs the same code. Commands: `doctor`, `inspect`, `run`, `bench`, `stop`, `guard`, `frames`, `receipt`.
|
||||
|
||||
The child process receives only `HOME`, `USER`, `LOGNAME`, `TMPDIR`, the locale variables, a system-only `PATH`, and values given with `--env NAME=VALUE`. `--inherit-env true` passes everything. SIGINT, SIGTERM and SIGHUP stop the run; after a SIGKILL of the supervisor use `betterxen hybrid stop --bottle BOTTLE`. Use one run per bottle at a time.
|
||||
|
||||
To reproduce the results, on an Apple Silicon Mac:
|
||||
|
||||
1. Install CrossOver yourself and create a `win11_64` bottle. Install Rosetta 2, Rust 1.100.0 and the Xcode command-line tools (`swift`, `swiftc`).
|
||||
2. Download the [pinned llvm-mingw](research/hybrid-toolchain.md), check its SHA-256 and unpack it.
|
||||
3. Grant your terminal Screen Recording and Accessibility permission.
|
||||
4. Close heavy applications: runs are refused below 50 % free memory.
|
||||
5. From a clean checkout: `scripts/hybrid/accept-integrated.sh LLVM_MINGW_DIR BOTTLE`. Do not type while the keyboard step runs.
|
||||
6. Report every `ok`, `KNOWN` and `FAIL` line, `commit.txt`, `receipt.json` and the CrossOver version, on [#355](https://github.com/MacosPorters/betterxen/issues/355). Records contain local paths; read them before sharing.
|
||||
|
||||
Reviewing the expected images independently is part of the job: they are computed in `expected_pixel` in each workload and again in `check_window.py`, all written by the same author.
|
||||
|
||||
## Acceptance gates
|
||||
|
||||
Evidence from the acceptance script on one machine: Apple M4 (24 GiB), macOS 27.0 (26A428), CrossOver 26.3 (26.3.0.39832), default backend (inferred D3DMetal), 2026-11-25, revision `14a54f8`: 33 steps ok, one known failure. The author of the code ran it.
|
||||
|
||||
| Gate | Status | Evidence | Limit |
|
||||
| --- | --- | --- | --- |
|
||||
| A. Environment | Pass | `doctor`: all checks true | Checks presence, not correctness |
|
||||
| B. Executable | Pass | identified as x86-64 console PE; ARM64 build refused before launch | Delay-load imports not listed |
|
||||
| C. Runtime | Pass for the services tested | threads, memory protection, exception handling, timing, files; environment isolation | No audio, sockets or controllers |
|
||||
| D. Graphics initialization | Pass, D3D11 and D3D12 | `graphics.init` in both workloads | Feature level 11_0 |
|
||||
| E. Shader execution | Pass | vs, ps, cs at shader model 5.0; fault controls fail | Small shaders; no DXIL / shader model 6 |
|
||||
| F. First verified frame | Pass | read-back, and a window capture for D3D11 (1016 of 1016 samples) | No window capture of the D3D12 workload |
|
||||
| G. Continuous rendering | Pass | 20,000 D3D11 frames; D3D11 and D3D12 digests equal over 600 frames | Sampled verification |
|
||||
| H. Interactive | Pass with synthesized macOS events | key events posted to the process with `CGEventPostToPid` move the quad as expected; wrong or no keys fail | No person typed; no mouse or controller |
|
||||
| I. Extended stability | Pass for rendering and memory over two hours; resource release fails | [long run](#long-run); 5 repeats; 20 back-to-back launches; crash, hang and signal recovery | One run, one machine, D3D12 only; GPU memory not measured |
|
||||
| J. Reproducibility | **Not met** | instructions above | No second person or machine has run it |
|
||||
| Resource release (D3D12) | **Fails on D3DMetal** | see below | |
|
||||
|
||||
## Observed backend behaviour
|
||||
|
||||
All on this one machine and CrossOver version; none confirmed with CodeWeavers or Apple.
|
||||
|
||||
- **D3DMetal keeps a reference for every destroyed D3D12 swapchain.** In a minimal program, each create and destroy cycle left `Release` of the swapchain returning 1 and one more device reference (12 after 12 cycles), also after destroying the window. The `wined3d` and `dxvk` settings returned to zero. The D3D12 workload's `shutdown` gate therefore fails on D3DMetal. D3D11 swapchains released cleanly. A program that recreates swapchains often would accumulate them.
|
||||
- **Under the `wined3d` and `dxvk` settings** D3D12 is provided by Wine's `vkd3d`. 128-frame runs passed every gate; longer runs slowed to 2.0 s per frame after about 440 frames, with vsync on or off, and timed out. Cause unknown.
|
||||
- **`dxmt`** offers no D3D12 device (classified `no_graphics_device`).
|
||||
- **Frame pacing with vsync off is bimodal.** The D3D11 workload's median interval switches between about 1 ms and 4 to 9 ms *within* runs, in no relation to run order; in short D3D11 runs with vsync it was 16.7 ms (the [long D3D12 run](#long-run) did not hold that). The earlier "first run is faster" reading was wrong. Vsync-off intervals from these workloads are not performance measurements. Trigger not identified.
|
||||
|
||||
## Backends
|
||||
|
||||
D3D11: one 300-frame run each; default, `d3dmetal`, `dxmt`, `dxvk`, `wined3d` all passed with the same pixel digest (earlier revision). D3D12: see the observations above.
|
||||
|
||||
## Memory and timing observed
|
||||
|
||||
Revision `14a54f8` unless stated.
|
||||
|
||||
| Measurement | Value |
|
||||
| --- | --- |
|
||||
| Workload resident memory, sampled by `ps` | 94 to 101 MB in the D3D11 first run, D3D12 run and 20,000-frame run |
|
||||
| Persistent CrossOver processes | not part of the workload figure; reported separately as `peak_crossover_rss_kb_sampled` |
|
||||
| First verified frame, from program start | about 0.2 s here; about 1.0 s was seen on some earlier first runs |
|
||||
| 20,000 D3D11 frames, vsync off | p50 8.3 ms, p99 20 ms, one frame of 1,023 ms |
|
||||
| Frame pacing, vsync off | bimodal; see above |
|
||||
| GPU memory, GPU utilization | not measured |
|
||||
|
||||
These describe a 256 by 256 scene with periodic read-back. They are not estimates of any application's performance.
|
||||
|
||||
## Long run
|
||||
|
||||
One D3D12 run of two hours with vsync requested, on the machine above (workload and runner code of revision `14a54f8`, 2026-11-25):
|
||||
|
||||
```sh
|
||||
betterxen hybrid run --bottle betterxen-test --timeout 7600 --stall-timeout 120 --keep-output true --out <dir> -- <path>/d3d12-integrated.exe --duration-s 7200 --vsync --verify-every 600
|
||||
```
|
||||
|
||||
The run is classified `failed_exit_1`: every gate passed except `shutdown`, the D3D12 reference retention described above.
|
||||
|
||||
| Measurement | Value |
|
||||
| --- | --- |
|
||||
| Frames presented | 844,497 over 7,200 s |
|
||||
| Frames verified by read-back | 1,414, none mismatched |
|
||||
| Resource create and destroy cycles | 8,445; device references after release: 2, as in short runs |
|
||||
| Device removed | no |
|
||||
| Workload working set, sampled each minute by the program | 95.3 MB in the first sample, then falling; 50.9 MB at the end |
|
||||
| Lowest system free memory | 46% (69% at start) |
|
||||
| Frame interval | p50 8.9 ms, p99 20.4 ms, p99.9 34.2 ms, maximum 1,019 ms; 21 frames over 100 ms |
|
||||
| Thermal warnings recorded by `pmset` before and after | none |
|
||||
|
||||
The frame intervals did not settle at a display refresh period despite `--vsync`: per-minute medians ranged from 8.1 to 16.6 ms. The cause of this, and of the 1 s frame, is unknown. The machine was not isolated from other use. GPU memory was not measured, and a longer or heavier scene was not tried.
|
||||
|
||||
## Security limits
|
||||
|
||||
A CrossOver bottle is **not** a sandbox: it maps the whole filesystem. Supervision limits runaway behaviour only. See the [security review](research/security-audit-2026-11-25.md).
|
||||
@@ -12,6 +12,7 @@ The workspace is GPL-3.0-or-later. The following is the lead's preliminary compa
|
||||
| bitflags | 2.13.2, `80ce9b545acb0bd42150695fc351889cac1d8eb4` | MIT from MIT OR Apache-2.0 | Runtime transitive dependency |
|
||||
| AMD RDNA 2 ISA XML | 2026-02-20, schema 1.1.1 | MIT | Source for generated decoder constants |
|
||||
| LLVM AMDGPU tools | 23.1.6 | Apache-2.0 WITH LLVM-exception | External fixture tool, not linked |
|
||||
| llvm-mingw | 20261117 (sha256 `98d340bb…446aa`) | Apache-2.0 WITH LLVM-exception, plus component licences in its LICENSE.TXT (mingw-w64 runtime and headers have their own terms; not audited line by line) | External build tool for original Windows test programs, not linked, not distributed |
|
||||
| Xcode and Metal tools | Xcode 27.2 | Apple proprietary terms | External host tools, not distributed |
|
||||
|
||||
## Runtime redistribution review
|
||||
@@ -113,3 +114,21 @@ These packages are resolved only by the isolated fuzz workspace. Use MIT when it
|
||||
| libfuzzer-sys | 0.4.13 | `719e4efb9b8857ebaa782ae59376c8cbb78fed0f` | MIT AND NCSA |
|
||||
| r-efi | 6.0.0 | `7e1b0322d31d625f81a5656096330934f9cd835d` | MIT |
|
||||
| shlex | 2.0.1 | `e82b1411beb7c92871c2c078c9ab415bbcf207ef` | MIT |
|
||||
|
||||
## External hybrid components (not distributed)
|
||||
|
||||
The hybrid direction relies on an externally installed CrossOver. Nothing below is bundled, linked or redistributed by BetterXen, and the licenses are the upstream texts read on 2026-11-25, not the revisions CodeWeavers ships in 26.3.0.
|
||||
|
||||
| Component | License read | Distribution model | Notes |
|
||||
|---|---|---|---|
|
||||
| CrossOver (product) | Proprietary EULA; FOSS components keep their licenses | External install | [EULA](https://www.codeweavers.com/crossover/eula) §2 permits building alternate Wine and does not supersede FOSS licenses; §3 restricts reverse engineering and redistribution. The source page lists Wine, Vkd3d, DXVK and MoltenVK, not DXMT or VKD3D-Proton |
|
||||
| Wine | LGPL-2.1-or-later | External | `either version 2.1 … or any later version` |
|
||||
| DXMT | LGPL-2.1-or-later; releases up to v0.80 were MIT (`LICENSE.OLD`) | External | Copyright 2023-2026 Feifan He for CodeWeavers |
|
||||
| DXVK | zlib | External | Retain the notice if ever distributed |
|
||||
| VKD3D-Proton | LGPL-2.1-or-later | External | Source headers carry the `or later` grant |
|
||||
| MoltenVK | Apache-2.0 | External | Compatible with GPL-3.0, not GPL-2.0; no `NOTICE` file at the pinned revision |
|
||||
| D3DMetal | Unverified: a third-party copy of the 4.0 `License.pdf` was reported; Apple's own copy was not read | User-supplied only; never bundled | The reported terms are non-commercial and no reverse engineering; the Apache-2.0 Game Porting Toolkit repository is not the D3DMetal license |
|
||||
| Rosetta 2 | Unknown; Apple's license text was not read | External OS component | Never redistributed |
|
||||
|
||||
Details, exact sources and the missing documents are in [research/crossover-licensing.md](research/crossover-licensing.md).
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Project board setup
|
||||
|
||||
Status: **not configured, and not an engineering blocker.** The token used so far lacks the GitHub `project` scope, and GitHub's API cannot create views. Tracked by [#346](https://github.com/MacosPorters/betterxen/issues/346).
|
||||
|
||||
One simple board for active work only:
|
||||
|
||||
1. `gh auth refresh -s project`, then create a project named "BetterXen Development".
|
||||
2. Status (single select): Backlog, Ready, In Progress, In Review, Blocked, Done.
|
||||
3. Fields: Priority (p1, p2, p3), Area (text), and the built-in Milestone, Assignees and Status. No other custom fields.
|
||||
4. Add the open issues and pull requests (`gh project item-add`). Closed native issues stay out; they are indexed in [the native issue archive](../research/native-issue-archive.md).
|
||||
5. Optional view in the web UI: a table filtered to the current milestone and sorted by Priority. No phase views and no native board.
|
||||
@@ -0,0 +1,692 @@
|
||||
path depth
|
||||
.editorconfig not read
|
||||
.github/CODEOWNERS not read
|
||||
.github/ISSUE_TEMPLATE/agent-task.yml not read
|
||||
.github/ISSUE_TEMPLATE/bug.yml not read
|
||||
.github/ISSUE_TEMPLATE/config.yml not read
|
||||
.github/ISSUE_TEMPLATE/documentation.yml not read
|
||||
.github/ISSUE_TEMPLATE/hybrid-task.yml not read
|
||||
.github/ISSUE_TEMPLATE/performance.yml not read
|
||||
.github/ISSUE_TEMPLATE/research.yml not read
|
||||
.github/ISSUE_TEMPLATE/validation.yml not read
|
||||
.github/agent-queue.json not read
|
||||
.github/pull_request_template.md not read
|
||||
.github/workflows/agent-claims.yml not read
|
||||
.github/workflows/ci.yml not read
|
||||
.github/workflows/hygiene.yml not read
|
||||
.gitignore not read
|
||||
AGENTS.md read in part
|
||||
CHANGELOG.md read in part
|
||||
CLAUDE.md not read
|
||||
CODE_OF_CONDUCT.md not read
|
||||
CONTRIBUTING.md not read
|
||||
Cargo.lock not read
|
||||
Cargo.toml not read
|
||||
LICENSE not read
|
||||
README.md not read
|
||||
SECURITY.md not read
|
||||
SUPPORT.md not read
|
||||
THIRD_PARTY_NOTICES.md not read
|
||||
app/Package.swift header and size only
|
||||
app/Sources/CXenora/module.modulemap not read
|
||||
app/Sources/Xenora/AudioMixFixture.swift header and size only
|
||||
app/Sources/Xenora/ControllerInput.swift header and size only
|
||||
app/Sources/Xenora/main.swift header and size only
|
||||
benchmarks/Cargo.toml not read
|
||||
benchmarks/benches/fixtures/gfx1030_mixed.s not read
|
||||
benchmarks/benches/gfx1030_identify.rs not read
|
||||
benchmarks/manifest.toml not read
|
||||
benchmarks/results/apple-m5/run-1795338391/metadata.json not read
|
||||
benchmarks/results/apple-m5/run-1795338391/report.md not read
|
||||
benchmarks/results/apple-m5/run-1795338391/results.json not read
|
||||
benchmarks/results/apple-m5/run-1795352394/metadata.json not read
|
||||
benchmarks/results/apple-m5/run-1795352394/report.md not read
|
||||
benchmarks/results/apple-m5/run-1795352394/results.json not read
|
||||
benchmarks/src/main.rs header and size only
|
||||
benchmarks/src/startup.rs header and size only
|
||||
benchmarks/src/startup_report.rs header and size only
|
||||
benchmarks/tests/gfx1030_identify.rs not read
|
||||
crates/cli/Cargo.toml not read
|
||||
crates/cli/src/demo.rs header and size only
|
||||
crates/cli/src/main.rs read in part
|
||||
crates/cli/src/runner.rs read in part
|
||||
crates/cli/src/shaders.rs header and size only
|
||||
crates/cli/src/startup_report.rs read in part
|
||||
crates/cli/tests/default_report.rs not read
|
||||
crates/cli/tests/imports_sync.rs not read
|
||||
crates/cli/tests/standard_services.rs not read
|
||||
crates/cli/tests/startup_report.rs not read
|
||||
crates/decoder/Cargo.toml not read
|
||||
crates/decoder/src/lib.rs header and size only
|
||||
crates/decoder/tests/gfx1030.rs not read
|
||||
crates/decoder/tests/graphics.rs not read
|
||||
crates/decoder/tests/semantic_forms.rs not read
|
||||
crates/ffi/Cargo.toml not read
|
||||
crates/ffi/include/xenora.h not read
|
||||
crates/ffi/src/frame_loop.rs header and size only
|
||||
crates/ffi/src/lib.rs read in part
|
||||
crates/ffi/tests/audio_vfs.rs not read
|
||||
crates/ffi/tests/frame_loop.rs not read
|
||||
crates/ffi/tests/interactive.rs not read
|
||||
crates/ffi/tests/native_frame.rs not read
|
||||
crates/ffi/tests/resources.rs not read
|
||||
crates/hybrid/Cargo.toml not read
|
||||
crates/hybrid/src/cli.rs read
|
||||
crates/hybrid/src/cmdutil.rs read
|
||||
crates/hybrid/src/crossover.rs read
|
||||
crates/hybrid/src/frames.rs not read
|
||||
crates/hybrid/src/host.rs not read
|
||||
crates/hybrid/src/json.rs read
|
||||
crates/hybrid/src/lib.rs read
|
||||
crates/hybrid/src/main.rs read
|
||||
crates/hybrid/src/memory.rs read
|
||||
crates/hybrid/src/pe.rs read
|
||||
crates/hybrid/src/preflight.rs read
|
||||
crates/hybrid/src/records.rs read
|
||||
crates/hybrid/src/run.rs read
|
||||
crates/hybrid/src/toolchain.rs not read
|
||||
crates/import-gen/Cargo.toml not read
|
||||
crates/import-gen/src/apiset.rs header and size only
|
||||
crates/import-gen/src/bin/xenora-runtime-gen.rs header and size only
|
||||
crates/import-gen/src/classify.rs header and size only
|
||||
crates/import-gen/src/codegen.rs header and size only
|
||||
crates/import-gen/src/demangle.rs header and size only
|
||||
crates/import-gen/src/ingest.rs header and size only
|
||||
crates/import-gen/src/lib.rs header and size only
|
||||
crates/import-gen/src/manifest.rs header and size only
|
||||
crates/import-gen/src/metadata.rs header and size only
|
||||
crates/import-gen/src/parse.rs header and size only
|
||||
crates/import-gen/src/typed.rs header and size only
|
||||
crates/import-gen/src/verify.rs header and size only
|
||||
crates/import-gen/tests/demangle.rs not read
|
||||
crates/import-gen/tests/pipeline.rs not read
|
||||
crates/isa/Cargo.toml not read
|
||||
crates/isa/LICENSE-AMD not read
|
||||
crates/isa/data/rdna2.jsonl not read
|
||||
crates/isa/generate_rdna2.py not read
|
||||
crates/isa/generate_rdna2_meta.py not read
|
||||
crates/isa/generate_semantics.py not read
|
||||
crates/isa/semantics/rdna2.toml not read
|
||||
crates/isa/semantics/rdna2/sop1.toml not read
|
||||
crates/isa/semantics/rdna2/sop2.toml not read
|
||||
crates/isa/semantics/rdna2/sopc.toml not read
|
||||
crates/isa/semantics/rdna2/sopk.toml not read
|
||||
crates/isa/semantics/rdna2/sopp.toml not read
|
||||
crates/isa/semantics/rdna2/vop1.toml not read
|
||||
crates/isa/semantics/rdna2/vop2.toml not read
|
||||
crates/isa/semantics/rdna2/vop3.toml not read
|
||||
crates/isa/semantics/rdna2/vopc.toml not read
|
||||
crates/isa/src/lib.rs header and size only
|
||||
crates/isa/src/meta.rs header and size only
|
||||
crates/isa/src/primitive.rs header and size only
|
||||
crates/isa/src/rdna2.rs header and size only
|
||||
crates/isa/src/rdna2_meta.rs header and size only
|
||||
crates/isa/src/semantics.rs header and size only
|
||||
crates/isa/src/semantics_gen.rs header and size only
|
||||
crates/isa/tests/extension_word_negative.rs not read
|
||||
crates/isa/tests/llvm/corpus.py not read
|
||||
crates/isa/tests/llvm/corpus.s not read
|
||||
crates/isa/tests/llvm/corpus.tsv not read
|
||||
crates/isa/tests/llvm/corpus_disagreements.txt not read
|
||||
crates/isa/tests/llvm/identify.s not read
|
||||
crates/isa/tests/meta.rs not read
|
||||
crates/isa/tests/meta_corpus.rs not read
|
||||
crates/isa/tests/meta_llvm.rs not read
|
||||
crates/isa/tests/semantics.rs not read
|
||||
crates/loader/Cargo.toml not read
|
||||
crates/loader/benches/dbt_bench.rs not read
|
||||
crates/loader/benches/service_dispatch.rs not read
|
||||
crates/loader/generate_x86.py not read
|
||||
crates/loader/runtime/services.txt not read
|
||||
crates/loader/src/arm64.rs header and size only
|
||||
crates/loader/src/cpu.rs header and size only
|
||||
crates/loader/src/dbt.rs header and size only
|
||||
crates/loader/src/graphics.rs header and size only
|
||||
crates/loader/src/import_table.rs header and size only
|
||||
crates/loader/src/imports.rs header and size only
|
||||
crates/loader/src/jit.rs header and size only
|
||||
crates/loader/src/lib.rs header and size only
|
||||
crates/loader/src/memory.rs header and size only
|
||||
crates/loader/src/pe.rs read in part
|
||||
crates/loader/src/probe.rs header and size only
|
||||
crates/loader/src/reloc.rs header and size only
|
||||
crates/loader/src/runtime.rs header and size only
|
||||
crates/loader/src/runtime_table.rs header and size only
|
||||
crates/loader/src/scheduler.rs header and size only
|
||||
crates/loader/src/services.rs header and size only
|
||||
crates/loader/src/services/crt.rs header and size only
|
||||
crates/loader/src/services/crt_arguments.rs header and size only
|
||||
crates/loader/src/services/crt_callbacks.rs header and size only
|
||||
crates/loader/src/services/crt_files.rs header and size only
|
||||
crates/loader/src/services/crt_format.rs header and size only
|
||||
crates/loader/src/services/crt_startup.rs header and size only
|
||||
crates/loader/src/services/crt_streams.rs header and size only
|
||||
crates/loader/src/services/events.rs header and size only
|
||||
crates/loader/src/services/files.rs header and size only
|
||||
crates/loader/src/services/gdk_queue.rs header and size only
|
||||
crates/loader/src/services/heap.rs header and size only
|
||||
crates/loader/src/services/modules.rs header and size only
|
||||
crates/loader/src/services/platform_fixture.rs header and size only
|
||||
crates/loader/src/services/process.rs header and size only
|
||||
crates/loader/src/services/synch.rs header and size only
|
||||
crates/loader/src/services/sysinfo.rs header and size only
|
||||
crates/loader/src/services/task_fixture.rs header and size only
|
||||
crates/loader/src/services/threads.rs header and size only
|
||||
crates/loader/src/services/winsock.rs header and size only
|
||||
crates/loader/src/softfloat.rs header and size only
|
||||
crates/loader/src/startup.rs header and size only
|
||||
crates/loader/src/tasks.rs header and size only
|
||||
crates/loader/src/tls.rs header and size only
|
||||
crates/loader/src/triage.rs header and size only
|
||||
crates/loader/src/x86_decode.rs header and size only
|
||||
crates/loader/src/x86_exec.rs header and size only
|
||||
crates/loader/src/x86_float.rs header and size only
|
||||
crates/loader/src/x86_simd.rs header and size only
|
||||
crates/loader/src/x86_table.rs header and size only
|
||||
crates/loader/tests/arm64_encodings.rs not read
|
||||
crates/loader/tests/bootstrap.rs not read
|
||||
crates/loader/tests/bswap.rs not read
|
||||
crates/loader/tests/cpu_differential.rs not read
|
||||
crates/loader/tests/cpu_features.rs not read
|
||||
crates/loader/tests/cpu_known_answers.rs not read
|
||||
crates/loader/tests/cpu_loop.rs not read
|
||||
crates/loader/tests/cpu_rep.rs not read
|
||||
crates/loader/tests/crt_exit.rs not read
|
||||
crates/loader/tests/crt_files.rs not read
|
||||
crates/loader/tests/dbt_benchmark_report.rs not read
|
||||
crates/loader/tests/dbt_render.rs not read
|
||||
crates/loader/tests/gate_a1.rs not read
|
||||
crates/loader/tests/gate_a2.rs not read
|
||||
crates/loader/tests/generated_conformance.rs not read
|
||||
crates/loader/tests/generated_runtime_integration.rs not read
|
||||
crates/loader/tests/graphics_d3d12.rs not read
|
||||
crates/loader/tests/graphics_textures.rs not read
|
||||
crates/loader/tests/imports_sync.rs not read
|
||||
crates/loader/tests/indirect_control.rs not read
|
||||
crates/loader/tests/memory_page_boundaries.rs not read
|
||||
crates/loader/tests/memory_validation.rs not read
|
||||
crates/loader/tests/movsxd.rs not read
|
||||
crates/loader/tests/pe_headers.rs not read
|
||||
crates/loader/tests/pe_mapping_limits.rs not read
|
||||
crates/loader/tests/pe_validation.rs not read
|
||||
crates/loader/tests/printf/reference.py not read
|
||||
crates/loader/tests/printf/vectors.txt not read
|
||||
crates/loader/tests/probe_cfg.rs not read
|
||||
crates/loader/tests/probe_delay_imports.rs not read
|
||||
crates/loader/tests/probe_static.rs not read
|
||||
crates/loader/tests/probe_truncation.rs not read
|
||||
crates/loader/tests/process_exit.rs not read
|
||||
crates/loader/tests/relocation_validation.rs not read
|
||||
crates/loader/tests/repeated_frames.rs not read
|
||||
crates/loader/tests/runtime_clock.rs not read
|
||||
crates/loader/tests/runtime_handle_lifetime.rs not read
|
||||
crates/loader/tests/runtime_robustness.rs not read
|
||||
crates/loader/tests/runtime_services.rs not read
|
||||
crates/loader/tests/runtime_synch.rs not read
|
||||
crates/loader/tests/runtime_sysinfo.rs not read
|
||||
crates/loader/tests/runtime_threads.rs not read
|
||||
crates/loader/tests/runtime_x15.rs not read
|
||||
crates/loader/tests/support/mod.rs not read
|
||||
crates/loader/tests/support/robustness.rs not read
|
||||
crates/loader/tests/threads/compile.py not read
|
||||
crates/loader/tests/threads/program.c not read
|
||||
crates/loader/tests/threads/program.txt not read
|
||||
crates/loader/tests/tls_layout.rs not read
|
||||
crates/loader/tests/x86/assemble.py not read
|
||||
crates/loader/tests/x86/float.txt not read
|
||||
crates/loader/tests/x86/float_reference.py not read
|
||||
crates/loader/tests/x86/float_vectors.txt not read
|
||||
crates/loader/tests/x86/integer.txt not read
|
||||
crates/loader/tests/x86/vector.txt not read
|
||||
crates/loader/tests/x86_atomic.rs not read
|
||||
crates/loader/tests/x86_carry_chain.rs not read
|
||||
crates/loader/tests/x86_float.rs not read
|
||||
crates/loader/tests/x86_integer.rs not read
|
||||
crates/loader/tests/x86_prefix_length.rs not read
|
||||
crates/loader/tests/x86_vector.rs not read
|
||||
crates/loader/x86/instructions.toml not read
|
||||
crates/metal/Cargo.toml not read
|
||||
crates/metal/src/compute.rs header and size only
|
||||
crates/metal/src/lib.rs header and size only
|
||||
crates/metal/src/render.rs header and size only
|
||||
crates/metal/src/sampler.rs header and size only
|
||||
crates/metal/src/texture_pipeline.rs header and size only
|
||||
crates/metal/tests/blend_reference.rs not read
|
||||
crates/metal/tests/depth_reference.rs not read
|
||||
crates/metal/tests/fixtures/blend_expected.txt not read
|
||||
crates/metal/tests/fixtures/depth_expected.txt not read
|
||||
crates/metal/tests/fixtures/guest-buffer-xor.bin not read
|
||||
crates/metal/tests/fixtures/guest-buffer-xor.s not read
|
||||
crates/metal/tests/fixtures/indexed_expected.txt not read
|
||||
crates/metal/tests/indexed_reference.rs not read
|
||||
crates/metal/tests/native/blend.rs not read
|
||||
crates/metal/tests/native/depth.rs not read
|
||||
crates/metal/tests/native/guest_buffer.rs not read
|
||||
crates/metal/tests/native/indexed.rs not read
|
||||
crates/metal/tests/native/offscreen.rs not read
|
||||
crates/metal/tests/native/submission.rs not read
|
||||
crates/metal/tests/native/texture.rs not read
|
||||
crates/metal/tests/native/texture_bc_alpha.rs not read
|
||||
crates/metal/tests/native/texture_bc_channel.rs not read
|
||||
crates/metal/tests/native/texture_sampling.rs not read
|
||||
crates/metal/tests/native/translated_bc1.rs not read
|
||||
crates/metal/tests/native/translated_render.rs not read
|
||||
crates/metal/tests/native_compute.rs not read
|
||||
crates/metal/tests/packed_bc_upload.rs not read
|
||||
crates/metal/tests/sampler_texture.rs not read
|
||||
crates/metal/tests/support/blend_cases.rs not read
|
||||
crates/metal/tests/support/depth_cases.rs not read
|
||||
crates/metal/tests/support/indexed_cases.rs not read
|
||||
crates/ref/Cargo.toml not read
|
||||
crates/ref/src/blend.rs header and size only
|
||||
crates/ref/src/depth.rs header and size only
|
||||
crates/ref/src/indexed.rs header and size only
|
||||
crates/ref/src/lib.rs header and size only
|
||||
crates/ref/src/texture_sampling.rs header and size only
|
||||
crates/ref/tests/gfx1030.rs not read
|
||||
crates/shader/Cargo.toml not read
|
||||
crates/shader/src/graphics.rs header and size only
|
||||
crates/shader/src/lib.rs header and size only
|
||||
crates/shader/tests/compiler.rs not read
|
||||
crates/shader/tests/graphics.rs not read
|
||||
crates/texture/Cargo.toml not read
|
||||
crates/texture/src/bc.rs header and size only
|
||||
crates/texture/src/bc6h.rs header and size only
|
||||
crates/texture/src/bc7.rs header and size only
|
||||
crates/texture/src/footprint.rs header and size only
|
||||
crates/texture/src/lib.rs header and size only
|
||||
crates/texture/src/sampler.rs header and size only
|
||||
crates/texture/src/upload.rs header and size only
|
||||
crates/texture/tests/bc6h.rs not read
|
||||
crates/texture/tests/bc7.rs not read
|
||||
crates/texture/tests/bc_footprint.rs not read
|
||||
crates/texture/tests/bc_formats.rs not read
|
||||
crates/texture/tests/fixtures/bc6h_vectors.txt not read
|
||||
crates/texture/tests/fixtures/bc7_vectors.txt not read
|
||||
docs/README.md read in part
|
||||
docs/adr/0003-demo-memory-model.md not read
|
||||
docs/adr/0004-cpu-boundary.md not read
|
||||
docs/adr/0005-crossover-hybrid-direction.md not read
|
||||
docs/archive/development-phases-native-first.md not read
|
||||
docs/archive/hybrid-phases-h0-h7.md not read
|
||||
docs/archive/native-first-milestones.json not read
|
||||
docs/archive/readme-native-milestones.md not read
|
||||
docs/assets/xenora-progress.svg not read
|
||||
docs/claims.toml not read
|
||||
docs/coordination/agent-queue-smoke.md not read
|
||||
docs/coordination/agent-tasks.md not read
|
||||
docs/coordination/cpu-campaign-ledger.md not read
|
||||
docs/coordination/infrastructure-qa-ledger.md not read
|
||||
docs/coordination/infrastructure-qa-ownership.md not read
|
||||
docs/cpu/avx-contract.md not read
|
||||
docs/cpu/instruction-registry.md not read
|
||||
docs/hybrid-execution.md not read
|
||||
docs/interfaces.md not read
|
||||
docs/legal.md not read
|
||||
docs/licenses.md not read
|
||||
docs/migration.md not read
|
||||
docs/planning/project-board.md not read
|
||||
docs/progress.md not read
|
||||
docs/research/apple-gpu.md not read
|
||||
docs/research/component-reuse-matrix.md not read
|
||||
docs/research/cpu-boundary.md not read
|
||||
docs/research/crossover-baseline-2026-11-25.md read in part
|
||||
docs/research/crossover-licensing.md read
|
||||
docs/research/d3dmetal-native-evaluation.md not read
|
||||
docs/research/directx12.md not read
|
||||
docs/research/host-lab.md not read
|
||||
docs/research/hybrid-backlog-research-2026-11-25.md not read
|
||||
docs/research/hybrid-runtime-audit-2026-11-25.md not read
|
||||
docs/research/hybrid-toolchain.md read in part
|
||||
docs/research/native-issue-archive.md not read
|
||||
docs/research/native-roadmap.md not read
|
||||
docs/research/phase02-collaboration.md not read
|
||||
docs/research/phase02-cpu-feasibility.md not read
|
||||
docs/research/phase02-ecosystem.md not read
|
||||
docs/research/portwatch-inventory-2026-11-25.json not read
|
||||
docs/research/portwatch-inventory-2026-11-25.md not read
|
||||
docs/research/portwatch-native-macos.md not read
|
||||
docs/research/primary-source-verification-2026-11-25.md not read
|
||||
docs/research/rdna2.md not read
|
||||
docs/research/shader-containers.md not read
|
||||
docs/research/sources.md not read
|
||||
docs/research/synthetic-integration.md not read
|
||||
docs/research/texture-formats.md not read
|
||||
docs/research/upstream-integration-audit.md read in part
|
||||
docs/research/upstream-registry.md not read
|
||||
docs/research/xbox-gdk.md not read
|
||||
docs/research/xbox-gpu.md not read
|
||||
docs/risk-register.md not read
|
||||
docs/roadmap.md read
|
||||
docs/runtime/registry.md not read
|
||||
docs/runtime/services.md not read
|
||||
docs/runtime/threads.md not read
|
||||
docs/shaders/instruction-coverage.md not read
|
||||
docs/shaders/msl.md not read
|
||||
docs/shaders/reference-interpreter.md not read
|
||||
docs/shaders/scalar-alu.md not read
|
||||
docs/shaders/scalar-immediate.md not read
|
||||
docs/shaders/semantic-coverage.md not read
|
||||
docs/shaders/semantic-registry.md not read
|
||||
docs/shaders/vector-compare.md not read
|
||||
docs/shaders/vector-unary.md not read
|
||||
docs/shaders/vector-vcc.md not read
|
||||
docs/status.toml not read
|
||||
docs/testing/README.md not read
|
||||
docs/testing/benchmarks.md not read
|
||||
docs/testing/cpu-coverage.md not read
|
||||
docs/testing/gate-a.md not read
|
||||
docs/testing/hybrid-workloads.md not read
|
||||
docs/testing/infrastructure/README.md not read
|
||||
docs/testing/infrastructure/phase3-compat-ledger.md not read
|
||||
docs/testing/migration-pr-review.md not read
|
||||
docs/testing/mutation.md not read
|
||||
docs/testing/phase-02-baseline.md not read
|
||||
docs/testing/phase01-assurance.md not read
|
||||
docs/testing/phase01-checkpoint.md not read
|
||||
docs/testing/review-log.md not read
|
||||
docs/testing/shader-form-acceptance.md not read
|
||||
docs/testing/test-inventory.md not read
|
||||
docs/testing/x9-acceptance.md not read
|
||||
docs/threat-model.md not read
|
||||
experiments/x1/Cargo.lock not read
|
||||
experiments/x1/Cargo.toml not read
|
||||
experiments/x1/README.md not read
|
||||
experiments/x1/fixtures/check.sh not read
|
||||
experiments/x1/fixtures/nonwrap.bin not read
|
||||
experiments/x1/fixtures/pe_fixture.py not read
|
||||
experiments/x1/fixtures/wrap.bin not read
|
||||
experiments/x1/fixtures/x1.s not read
|
||||
experiments/x1/fixtures/x2.exe not read
|
||||
experiments/x1/fixtures/x2.py not read
|
||||
experiments/x1/fixtures/x3.exe not read
|
||||
experiments/x1/fixtures/x3.py not read
|
||||
experiments/x1/fixtures/x4-17.exe not read
|
||||
experiments/x1/fixtures/x4-93.exe not read
|
||||
experiments/x1/fixtures/x4.py not read
|
||||
experiments/x1/fixtures/x5.exe not read
|
||||
experiments/x1/fixtures/x5.py not read
|
||||
experiments/x1/fixtures/x6.exe not read
|
||||
experiments/x1/fixtures/x6.py not read
|
||||
experiments/x1/src/cpu.rs header and size only
|
||||
experiments/x1/src/cpu/tests.rs header and size only
|
||||
experiments/x1/src/fixture.rs header and size only
|
||||
experiments/x1/src/graphics.rs header and size only
|
||||
experiments/x1/src/interp.rs header and size only
|
||||
experiments/x1/src/loader.rs header and size only
|
||||
experiments/x1/src/main.rs header and size only
|
||||
experiments/x1/src/mem.rs header and size only
|
||||
experiments/x1/src/pe.rs header and size only
|
||||
experiments/x1/src/pe/tests.rs header and size only
|
||||
experiments/x1/src/x3.metal not read
|
||||
experiments/x1/src/x3.rs header and size only
|
||||
experiments/x1/src/x4.rs header and size only
|
||||
experiments/x1/src/x5.rs header and size only
|
||||
experiments/x1/src/x6.rs header and size only
|
||||
experiments/x1/src/x7.rs header and size only
|
||||
experiments/x1/src/x8.rs header and size only
|
||||
experiments/x1/src/x9.rs header and size only
|
||||
experiments/x1/src/x9/draw.rs header and size only
|
||||
experiments/x1/src/x9/tests.rs header and size only
|
||||
experiments/x1/src/x9/texture.rs header and size only
|
||||
fixtures/assets/asset.bin not read
|
||||
fixtures/assets/generate.py not read
|
||||
fixtures/golden/add.ir not read
|
||||
fixtures/golden/add.metal not read
|
||||
fixtures/golden/bitwise-branch.ir not read
|
||||
fixtures/golden/bitwise-branch.metal not read
|
||||
fixtures/golden/float-exact.ir not read
|
||||
fixtures/golden/float-exact.metal not read
|
||||
fixtures/golden/scalar-alu.ir not read
|
||||
fixtures/golden/scalar-alu.metal not read
|
||||
fixtures/golden/scalar-arith.ir not read
|
||||
fixtures/golden/scalar-arith.metal not read
|
||||
fixtures/golden/scalar-compare.ir not read
|
||||
fixtures/golden/scalar-compare.metal not read
|
||||
fixtures/golden/scalar-immediate.ir not read
|
||||
fixtures/golden/scalar-immediate.metal not read
|
||||
fixtures/golden/scalar-logic.ir not read
|
||||
fixtures/golden/scalar-logic.metal not read
|
||||
fixtures/golden/scalar-unary.ir not read
|
||||
fixtures/golden/scalar-unary.metal not read
|
||||
fixtures/golden/vector-compare-ft.ir not read
|
||||
fixtures/golden/vector-compare-ft.metal not read
|
||||
fixtures/golden/vector-compare.ir not read
|
||||
fixtures/golden/vector-compare.metal not read
|
||||
fixtures/golden/vector-integer.ir not read
|
||||
fixtures/golden/vector-integer.metal not read
|
||||
fixtures/golden/vector-unary.ir not read
|
||||
fixtures/golden/vector-unary.metal not read
|
||||
fixtures/golden/vector-vcc.ir not read
|
||||
fixtures/golden/vector-vcc.metal not read
|
||||
fixtures/golden/vop3-compare.ir not read
|
||||
fixtures/golden/vop3-compare.metal not read
|
||||
fixtures/golden/vop3-integer.ir not read
|
||||
fixtures/golden/vop3-integer.metal not read
|
||||
fixtures/manifest.toml not read
|
||||
fixtures/pe/audio_vfs.exe not read
|
||||
fixtures/pe/audio_vfs.py not read
|
||||
fixtures/pe/delay-imports.exe not read
|
||||
fixtures/pe/delay-imports.py not read
|
||||
fixtures/pe/frame-loop.exe not read
|
||||
fixtures/pe/frame-loop.py not read
|
||||
fixtures/pe/interactive.exe not read
|
||||
fixtures/pe/interactive.py not read
|
||||
fixtures/pe/runtime-services.exe not read
|
||||
fixtures/pe/textured.exe not read
|
||||
fixtures/pe/textured.py not read
|
||||
fixtures/pe/trusted-runner.exe not read
|
||||
fixtures/pe/trusted-runner.py not read
|
||||
fixtures/rdna2/add.bin not read
|
||||
fixtures/rdna2/add.s not read
|
||||
fixtures/rdna2/ashr.bin not read
|
||||
fixtures/rdna2/ashr.md not read
|
||||
fixtures/rdna2/ashr.s not read
|
||||
fixtures/rdna2/bitwise-branch.bin not read
|
||||
fixtures/rdna2/bitwise-branch.s not read
|
||||
fixtures/rdna2/float-exact.bin not read
|
||||
fixtures/rdna2/float-exact.s not read
|
||||
fixtures/rdna2/or.bin not read
|
||||
fixtures/rdna2/or.s not read
|
||||
fixtures/rdna2/scalar-alu.bin not read
|
||||
fixtures/rdna2/scalar-alu.s not read
|
||||
fixtures/rdna2/scalar-arith.bin not read
|
||||
fixtures/rdna2/scalar-arith.s not read
|
||||
fixtures/rdna2/scalar-compare.bin not read
|
||||
fixtures/rdna2/scalar-compare.s not read
|
||||
fixtures/rdna2/scalar-immediate.bin not read
|
||||
fixtures/rdna2/scalar-immediate.s not read
|
||||
fixtures/rdna2/scalar-logic.bin not read
|
||||
fixtures/rdna2/scalar-logic.s not read
|
||||
fixtures/rdna2/scalar-unary.bin not read
|
||||
fixtures/rdna2/scalar-unary.s not read
|
||||
fixtures/rdna2/shifts.bin not read
|
||||
fixtures/rdna2/shifts.s not read
|
||||
fixtures/rdna2/vector-compare-16.bin not read
|
||||
fixtures/rdna2/vector-compare-16.s not read
|
||||
fixtures/rdna2/vector-compare-64.bin not read
|
||||
fixtures/rdna2/vector-compare-64.s not read
|
||||
fixtures/rdna2/vector-compare-ft.bin not read
|
||||
fixtures/rdna2/vector-compare-ft.s not read
|
||||
fixtures/rdna2/vector-compare.bin not read
|
||||
fixtures/rdna2/vector-compare.s not read
|
||||
fixtures/rdna2/vector-integer.bin not read
|
||||
fixtures/rdna2/vector-integer.s not read
|
||||
fixtures/rdna2/vector-unary.bin not read
|
||||
fixtures/rdna2/vector-unary.s not read
|
||||
fixtures/rdna2/vector-vcc.bin not read
|
||||
fixtures/rdna2/vector-vcc.s not read
|
||||
fixtures/rdna2/vop3-compare.bin not read
|
||||
fixtures/rdna2/vop3-compare.s not read
|
||||
fixtures/rdna2/vop3-integer.bin not read
|
||||
fixtures/rdna2/vop3-integer.s not read
|
||||
fixtures/rdna2/x9-constant-ps.bin not read
|
||||
fixtures/rdna2/x9-constant-ps.s not read
|
||||
fixtures/rdna2/x9-constant-vs.bin not read
|
||||
fixtures/rdna2/x9-constant-vs.s not read
|
||||
fixtures/rdna2/x9-transform-vs.bin not read
|
||||
fixtures/rdna2/x9-transform-vs.s not read
|
||||
fixtures/rdna2/x9-varying-ps.bin not read
|
||||
fixtures/rdna2/x9-varying-ps.s not read
|
||||
fixtures/rdna2/x9-varying-vs.bin not read
|
||||
fixtures/rdna2/x9-varying-vs.s not read
|
||||
fuzz/Cargo.lock not read
|
||||
fuzz/Cargo.toml not read
|
||||
fuzz/fuzz_targets/cpu_decode.rs header and size only
|
||||
fuzz/fuzz_targets/fixture.rs header and size only
|
||||
fuzz/fuzz_targets/instruction_stream.rs header and size only
|
||||
fuzz/fuzz_targets/pe_parse.rs header and size only
|
||||
fuzz/fuzz_targets/reference.rs header and size only
|
||||
fuzz/fuzz_targets/runtime_services.rs header and size only
|
||||
licenses/bitflags-LICENSE-MIT not read
|
||||
licenses/objc2-LICENSE-MIT.txt not read
|
||||
licenses/objc2-LICENSE.md not read
|
||||
scripts/agent-queue.sh not read
|
||||
scripts/agent-sync.sh not read
|
||||
scripts/agent_queue/__init__.py not read
|
||||
scripts/agent_queue/__main__.py not read
|
||||
scripts/agent_queue/cli.py not read
|
||||
scripts/agent_queue/config.py not read
|
||||
scripts/agent_queue/decide.py not read
|
||||
scripts/agent_queue/ghio.py not read
|
||||
scripts/agent_queue/lease.py not read
|
||||
scripts/agent_queue/patterns.py not read
|
||||
scripts/agent_queue/prcheck.py not read
|
||||
scripts/agent_queue/queue.py not read
|
||||
scripts/agent_queue/replay.py not read
|
||||
scripts/agent_queue/tasks.py not read
|
||||
scripts/assemble-fixture.sh read
|
||||
scripts/audit/claims.sh not read
|
||||
scripts/audit/dependencies.sh read
|
||||
scripts/audit/docs_hygiene.py not read
|
||||
scripts/audit/native.sh not read
|
||||
scripts/audit/semantic_coverage.py not read
|
||||
scripts/audit/status.py not read
|
||||
scripts/audit/test_inventory.py not read
|
||||
scripts/benchmark.sh not read
|
||||
scripts/bootstrap.sh not read
|
||||
scripts/build-app.sh not read
|
||||
scripts/cpu-tests.sh not read
|
||||
scripts/demo.sh not read
|
||||
scripts/fuzz.sh not read
|
||||
scripts/hybrid/accept-integrated.sh read
|
||||
scripts/hybrid/accept-lifecycle.py read
|
||||
scripts/hybrid/build-windows-workloads.sh read
|
||||
scripts/mutation.sh not read
|
||||
scripts/qa/__init__.py not read
|
||||
scripts/qa/__main__.py not read
|
||||
scripts/qa/bench_regress.py not read
|
||||
scripts/qa/bench_stats.py not read
|
||||
scripts/qa/claim_conflict.py not read
|
||||
scripts/qa/compat_gaps.py not read
|
||||
scripts/qa/coverage_history.py not read
|
||||
scripts/qa/cpu_coverage.py not read
|
||||
scripts/qa/cpu_inventory.py not read
|
||||
scripts/qa/env_check.py not read
|
||||
scripts/qa/exit_pipe.py not read
|
||||
scripts/qa/git_scope.py not read
|
||||
scripts/qa/handoff.py not read
|
||||
scripts/qa/orchestrate.py not read
|
||||
scripts/qa/pr_validate.py not read
|
||||
scripts/qa/rdna2_plan.py not read
|
||||
scripts/qa/rdna2_rank.py not read
|
||||
scripts/qa/regression.py not read
|
||||
scripts/qa/repo_health.py not read
|
||||
scripts/qa/runtime_inventory.py not read
|
||||
scripts/qa/stale_branch.py not read
|
||||
scripts/qa/verify.py not read
|
||||
scripts/release/__init__.py not read
|
||||
scripts/release/__main__.py not read
|
||||
scripts/release/bundle.py not read
|
||||
scripts/release/macho.py not read
|
||||
scripts/release/manifest.py not read
|
||||
scripts/release/readiness.py not read
|
||||
scripts/test-gpu.sh not read
|
||||
tests/agent_queue/helpers.py not read
|
||||
tests/agent_queue/test_apply_actions.py not read
|
||||
tests/agent_queue/test_conflict_predict.py not read
|
||||
tests/agent_queue/test_decide.py not read
|
||||
tests/agent_queue/test_lease_accept.py not read
|
||||
tests/agent_queue/test_patterns.py not read
|
||||
tests/agent_queue/test_prcheck_summary.py not read
|
||||
tests/agent_queue/test_replay.py not read
|
||||
tests/agent_queue/test_workflows_cli.py not read
|
||||
tests/audit/test_native_json.py not read
|
||||
tests/compat_fixtures/README.md not read
|
||||
tests/compat_fixtures/avx/README.md not read
|
||||
tests/compat_fixtures/build-gate-a1.sh not read
|
||||
tests/compat_fixtures/build-gate-a2.sh not read
|
||||
tests/compat_fixtures/build.sh not read
|
||||
tests/compat_fixtures/compute_guest.c not read
|
||||
tests/compat_fixtures/gate_a1.c not read
|
||||
tests/compat_fixtures/gate_a2.c not read
|
||||
tests/compat_fixtures/import_guest.c not read
|
||||
tests/compat_fixtures/resource_guest.c not read
|
||||
tests/compat_fixtures/verify-compute.sh not read
|
||||
tests/compat_fixtures/verify-resources.sh not read
|
||||
tests/compat_fixtures/verify.sh not read
|
||||
tests/mutation/README.md not read
|
||||
tests/mutation/semantic.rs not read
|
||||
tests/qa/test_bench_regress.py not read
|
||||
tests/qa/test_bench_stats.py not read
|
||||
tests/qa/test_claim_conflict.py not read
|
||||
tests/qa/test_cli_smoke.py not read
|
||||
tests/qa/test_compat_gaps.py not read
|
||||
tests/qa/test_coverage_history_stale_branch.py not read
|
||||
tests/qa/test_cpu_coverage.py not read
|
||||
tests/qa/test_cpu_inventory.py not read
|
||||
tests/qa/test_env_check.py not read
|
||||
tests/qa/test_exit_pipe.py not read
|
||||
tests/qa/test_git_scope.py not read
|
||||
tests/qa/test_orchestrate.py not read
|
||||
tests/qa/test_pr_validate.py not read
|
||||
tests/qa/test_rdna2_malformed_registry.py not read
|
||||
tests/qa/test_rdna2_plan.py not read
|
||||
tests/qa/test_rdna2_rank.py not read
|
||||
tests/qa/test_regression_handoff_health.py not read
|
||||
tests/qa/test_runtime_inventory.py not read
|
||||
tests/qa/test_verify.py not read
|
||||
tests/release/test_macho_bundle.py not read
|
||||
tests/release/test_manifest.py not read
|
||||
tests/release/test_readiness.py not read
|
||||
tests/semantic_coverage/test_semantic_coverage.py not read
|
||||
tests/semantics_generator/test_generate_semantics.py not read
|
||||
tests/validation/Cargo.toml not read
|
||||
tests/validation/README.md not read
|
||||
tests/validation/independent_ref.rs not read
|
||||
tests/validation/known_answers.rs not read
|
||||
tests/validation/tests/operand_domains.rs not read
|
||||
tests/validation/tests/operand_domains/harness.rs not read
|
||||
tests/validation/tests/operand_domains/oracle.rs not read
|
||||
tests/validation/tests/operand_domains/sop2.rs not read
|
||||
tests/validation/tests/operand_domains/vopc.rs not read
|
||||
tests/validation/tests/sop1_unary.rs not read
|
||||
tests/validation/tests/sop2_arith.rs not read
|
||||
tests/validation/tests/sop2_stage_c.rs not read
|
||||
tests/validation/tests/sopc_stage_d.rs not read
|
||||
tests/validation/tests/sopk.rs not read
|
||||
tests/validation/tests/vop1_integer.rs not read
|
||||
tests/validation/tests/vop2_integer.rs not read
|
||||
tests/validation/tests/vop2_vcc.rs not read
|
||||
tests/validation/tests/vop3_compare.rs not read
|
||||
tests/validation/tests/vop3_integer.rs not read
|
||||
tests/validation/tests/vopc_f_t.rs not read
|
||||
tests/validation/tests/vopc_wide.rs not read
|
||||
tests/validation/tests/wave64_limits.rs not read
|
||||
tests/x86_generator/test_generate_x86.py not read
|
||||
workloads/d3d11-clear/d3d11_clear.c not read
|
||||
workloads/d3d11-compute/README.md not read
|
||||
workloads/d3d11-compute/build.sh not read
|
||||
workloads/d3d11-compute/compute.c not read
|
||||
workloads/d3d11-compute/compute.hlsl not read
|
||||
workloads/d3d11-frameloop/frameloop.c read
|
||||
workloads/d3d11-integrated/build.sh not read
|
||||
workloads/d3d11-integrated/check_window.py read
|
||||
workloads/d3d11-integrated/integrated.c read
|
||||
workloads/d3d12-integrated/build.sh not read
|
||||
workloads/d3d12-integrated/integrated12.c read
|
||||
workloads/d3d12-integrated/send_keys.py read
|
||||
workloads/win-selfcheck-c/selfcheck.c not read
|
||||
workloads/win-selfcheck-rust/Cargo.lock not read
|
||||
workloads/win-selfcheck-rust/Cargo.toml not read
|
||||
workloads/win-selfcheck-rust/src/main.rs not read
|
||||
|
@@ -0,0 +1,31 @@
|
||||
# Component reuse matrix
|
||||
|
||||
Companion to the [upstream registry](upstream-registry.md); same evidence limits (class D, nothing run, not legal advice). "External" means installed or supplied by the user and invoked, never bundled or copied. GPL-3.0-or-later is BetterXen's license.
|
||||
|
||||
| Need | Candidate | Decision | Reason and condition |
|
||||
| --- | --- | --- | --- |
|
||||
| Windows runtime APIs | CrossOver (Wine-based) | **Adopt as external dependency** (strategic decision, ADR 0005) | Proprietary product; do not bundle or redistribute. Capabilities and interfaces unverified (#348, #350). |
|
||||
| Windows runtime APIs | Upstream Wine | Reference; source may be consulted | LGPL 2.1. Copying source would need per-file review and a recorded pin. Not needed for the current plan. |
|
||||
| x86-64 on ARM64 | Rosetta 2 | **Permitted where Apple supports it**; external | Apple component; support lifetime unknown (#349). BetterXen's own code stays ARM64. |
|
||||
| x86-64 on ARM64 | FEX | **Not applicable now** | README targets ARM64 Linux. Re-check only if a macOS host path appears. |
|
||||
| Direct3D 12 to Metal | D3DMetal | **Evaluate as external**, subject to license | Not in CodeWeavers' FOSS list; terms and availability to verify (#349, #354). Not redistributable until proven. |
|
||||
| Direct3D 11/10 to Metal | DXMT | **Evaluate** as external binary or build | LGPL 2.1-or-later; usable as a separate process or library under LGPL terms; linking or copying needs legal review (#354). |
|
||||
| Direct3D to Vulkan | DXVK | **Evaluate** only together with MoltenVK | zlib/libpng is permissive and GPL-compatible. Value on macOS unknown. |
|
||||
| Direct3D 12 to Vulkan | VKD3D-Proton | **Evaluate**; blocked on a Vulkan 1.3 provider | Depends on MoltenVK feature coverage, unknown. |
|
||||
| Vulkan on Metal | MoltenVK | **Evaluate** | Apache-2.0 (compatible with GPLv3). Subset of Vulkan; coverage vs consumers unknown. |
|
||||
| Shader compiler / runtime | VIctory, VIctory-macOS | **Rejected for reuse** | Built for a specific commercial game's Xbox Series build whose provenance is not established as authorized. Ideas only. |
|
||||
| Project discovery | PortWatch VI | Reference only | Editorial tracker; not engineering evidence; nothing imported. |
|
||||
| x86-64 decode and ARM64 translation, runtime, gfx1030 compiler, Metal backend | BetterXen native implementation | **Preserved, paused** | Reuse only where hybrid needs it and it shows a demonstrated advantage; not forced into the architecture. |
|
||||
| Test and diagnostics methodology | BetterXen existing audits, benchmark harness, claims registry | **Reuse** | Existing evidence classes, claims audit and benchmark gating apply to hybrid work (Phase 1 onward). |
|
||||
| Configuration, diagnostics, benchmarking around CrossOver | BetterXen | **Build** (Phase 2, provisional) | Only after Phase 1 shows what CrossOver does not already provide (#351). |
|
||||
| Host receipt, frame statistics, cross-toolchain probe | `crates/hybrid` | **Build** (original Rust, public system interfaces) | ossover and Whisky are Swift references; no code adapted. See [audit](upstream-integration-audit.md). |
|
||||
| Metal HUD log parsing | ossover `MetalHUDLog` | **Reference only** | Log format is documented only by third-party observation; implement after a real trace is captured (#145). |
|
||||
| Bottle and bundle internals (`cxbottle.conf`, SharedSupport layout) | ossover and others | **Do not depend** | Undocumented, derived from reverse engineering; #350 decides. |
|
||||
| Game-specific XCL layers | MacBox, ScarlettMac | **Rejected** | GPL-2.0-only and game-specific. |
|
||||
|
||||
| Memory-pressure guard for workloads | skakwy/victory-mac `mac/run-victory.sh` | **Adapted** into `crates/hybrid/src/memory.rs` | Contributor-authored, GPL-3.0, permission granted; reimplemented in Rust. |
|
||||
| Windows cross-linker wrapper | skakwy/victory-mac `tools/macos/gnullvm-cc.sh` | **Not used** | Failed with Homebrew `llvm@17`; llvm-mingw covers the need. |
|
||||
| Windows cross toolchain | llvm-mingw 20261117 | **External dependency**, not vendored | Apache-2.0 with LLVM exceptions; checksum recorded in [hybrid-toolchain.md](hybrid-toolchain.md). |
|
||||
| Zero-copy Metal swizzle, D3DMetal state fixes | skakwy/victory-mac `mac/unixlib`, `PROGRESS.md` | **Rejected** | Act on D3DMetal internals; Apple licence forbids reverse engineering. |
|
||||
|
||||
Open items: license text for every selected component must be read from the exact release used; DXMT, DXVK and Wine contributor and file-level notices are not reviewed.
|
||||
@@ -0,0 +1,69 @@
|
||||
# CrossOver baseline on the M4 reference machine (2026-11-25)
|
||||
|
||||
Evidence class: observed runs on one machine by one person (class B in the sense of [claims.toml](../claims.toml)); **not independently reproduced**, so #355 and #353 stay open. Every result is for original BetterXen workloads, never for a game. Nothing here shows Xbox compatibility.
|
||||
|
||||
## Environment
|
||||
|
||||
| Item | Value (source) |
|
||||
| --- | --- |
|
||||
| Machine | Apple M4, 10 cores (4 performance, 6 efficiency), 24 GiB, macOS 27.0 build 26A428 (`betterxen-hybrid host`) |
|
||||
| CrossOver | `/Applications/CrossOver.app`, 26.3, build 26.3.0.39832, bundle id `com.codeweavers.CrossOver`, main executable universal (x86_64, arm64) (`betterxen-hybrid crossover`). Licence or trial state not inspected; runs worked |
|
||||
| Wine host binaries | `wineloader` and `wineserver` are **x86_64 only** (`lipo -archs`), so CrossOver's Wine runs under Rosetta 2 on this Mac. `arch -x86_64 /usr/bin/true` executes |
|
||||
| Bottle | `betterxen-test`, template `win11_64`, created in 18.7 s with `cxbottle --bottle betterxen-test --create --template win11_64` |
|
||||
| Launch interface | `bin/wine --bottle B program` and `bin/wineserver -k`. `cxbottle --help` and `cxstart --help` exist in the bundle. **None of these command-line interfaces is documented by CodeWeavers for macOS**: the [Mac user guide](https://support.codeweavers.com/en_US/crossover-mac-user-guide) and [advanced configuration page](https://support.codeweavers.com/advanced-crossover-mac-configuration) cover the GUI and hook variables only. They are used here as observed vendor behaviour of this build |
|
||||
| Backend selection | `CX_GRAPHICS_BACKEND=<name>` in the environment. Undocumented (see #350). An unknown value (`bogus`) was **accepted silently** and gave the same result as the default |
|
||||
| Toolchain | llvm-mingw 20261117, Rust 1.100.0; see [hybrid-toolchain.md](hybrid-toolchain.md) |
|
||||
| Host noise | CrossOver's antivirus helper prints `LibClamAV Error` and `Can't open file or directory` because Homebrew's ClamAV has no database in `/opt/homebrew/var/lib/clamav`. Harmless to results; the run record reports it as a diagnostic |
|
||||
|
||||
## Workloads executed
|
||||
|
||||
Run with `betterxen-hybrid run --bottle betterxen-test --expect PASS -- <exe>`, default backend.
|
||||
|
||||
| Workload | x86-64 result | ARM64 result |
|
||||
| --- | --- | --- |
|
||||
| C self-check (CRC-32, four threads) | passed, exit 0, 1.4 s | `cannot_execute` |
|
||||
| Rust self-check (threads, TLS) | passed, exit 0, 0.6 s | `cannot_execute` |
|
||||
| D3D11 clear and readback | passed, exit 0, 1.1 s | `cannot_execute` |
|
||||
| D3D11 indexed triangle, shaders, frame loop | passed, exit 0, 0.8 s | `cannot_execute` |
|
||||
|
||||
CrossOver 26.3 here **rejects Windows ARM64 executables** with `winewrapper.exe:error: cannot execute`. The ARM64 builds exist and have the correct PE type, but cannot be run in this environment. Process memory sampled while running was about 325 MB (CrossOver's persistent processes, identical across workloads, so it says nothing about the workloads themselves); minimum system free memory stayed at 64 to 68 %.
|
||||
|
||||
Negative controls (#365): `d3d11-clear --negative-control` and `d3d11-frameloop --negative-control` expect a deliberately wrong colour and exit 1; the normal runs exit 0.
|
||||
|
||||
### Defects found in BetterXen's own workloads, not in CrossOver
|
||||
|
||||
1. **Clear test required exact bytes.** The first run read green as 127 where the program expected 128 (0.5 × 255 = 127.5, an exact tie). Re-derived from the primary source ([Direct3D data conversion rules](https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion)): the ideal conversion adds 0.5 and drops the fraction (128), but implementations are permitted a tolerance of 0.6 unit-last-place on the integer side (`D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP (0.6f)` in the mingw-w64 header; the D3D11 constant is described by the same page). 127 is 0.5 from 127.5 and is within tolerance. The workload now checks that tolerance and prints how many pixels differ from the ideal. This was a correction to match the specification, not a loosening to get a pass: the negative control still fails.
|
||||
2. **Triangle was culled.** The first frame-loop run left the centre black. The index order was counter-clockwise, which Direct3D 11 culls by default. Fixed to clockwise; the centre then read (51, 102, 204, 255) exactly.
|
||||
|
||||
## Graphics backend comparison
|
||||
|
||||
`betterxen-hybrid bench --backends default,d3dmetal,dxmt,dxvk,wined3d --repeat 5`, 2000 frames per run, workload `d3d11-frameloop`: a 640x360 offscreen RGBA8 target, one indexed triangle with a vertex and a pixel shader, an event query waited on every frame. **No window and no presentation.** All 25 runs passed. Medians across five runs:
|
||||
|
||||
| Backend (detected from workload output) | Adapter reported | Median frame | p95 | p99 | Frame rate | Startup + run, median |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| default | AMD Compatibility Mode | 0.281 ms | 0.448 ms | 0.929 ms | 3153 | 1.42 s |
|
||||
| d3dmetal | AMD Compatibility Mode | 0.282 ms | 0.558 ms | 1.805 ms | 2898 | 1.44 s |
|
||||
| dxmt | Apple M4 | 0.158 ms | 0.239 ms | 0.382 ms | 5896 | 1.13 s |
|
||||
| dxvk (via MoltenVK, "cxaddon-1.10.3") | Apple M4 | 0.150 ms | 0.263 ms | 0.478 ms | 5835 | 1.13 s |
|
||||
| wined3d | Apple M4 | 0.150 ms | 0.256 ms | 0.419 ms | 5788 | 1.13 s |
|
||||
|
||||
Observations, with their limits:
|
||||
|
||||
- **The default behaved like D3DMetal** (same adapter identity, same timings) for a bottle made from `win11_64` and an unknown executable. CodeWeavers' Advanced Settings page, as recorded in [primary-source-verification](primary-source-verification-2026-11-25.md), says Auto falls back to wined3d without a per-game database entry. The observation disagrees with that reading; why was not investigated.
|
||||
- D3DMetal's median per-frame submit-and-wait time was about 1.8 times that of the other three, with a larger tail. This is the cost of a trivial draw plus synchronisation, **not rendering throughput**, and shows nothing about real scenes. It identifies a candidate for investigation, not a bottleneck.
|
||||
- Sustained run, 200,000 frames: D3DMetal 64.1 s, median 0.283 ms, p99 0.987 ms, p99.9 2.07 ms, maximum 20.3 ms; DXMT 29.6 s, median 0.135 ms, p99 0.339 ms, p99.9 0.48 ms, maximum 7.4 ms. No failure, no hang, and free memory did not trend downward (minimum 64 % and 66 %).
|
||||
- Not measured: GPU utilization (no unprivileged documented source on this host), memory use of the workload itself, thermal behaviour under load (pmset reported no thermal, performance or CPU-power warning before and after; the workload loads the GPU too lightly for that to mean anything), presentation and frame pacing, texture sampling, depth testing, and Direct3D 12.
|
||||
|
||||
## What this does and does not establish
|
||||
|
||||
Established on this machine and build: CrossOver 26.3 runs original x86-64 console, threaded, Direct3D 11 clear and triangle programs under four graphics backends with correct pixels; it does not run ARM64 Windows programs; BetterXen can detect, supervise, classify and record such runs. Not established: anything about Direct3D 12, real-scene performance, other macOS or CrossOver versions, other machines, or any game. A second contributor still has to reproduce this.
|
||||
|
||||
## Saving new baseline evidence
|
||||
|
||||
The runner now writes `run-<nanoseconds>-<pid>-<sequence>.json` and
|
||||
`bench-<nanoseconds>-<pid>-<sequence>.json` when `--out` is supplied. Exclusive
|
||||
creation preserves existing reports, including older `bench.json` files. The
|
||||
selected path is printed to stderr; stdout retains the workload classification
|
||||
and report JSON. A directory, creation or write error returns a nonzero CLI
|
||||
status even if the workload itself passed. These persistence changes do not
|
||||
revalidate or replace the historical results above.
|
||||
@@ -0,0 +1,96 @@
|
||||
# CrossOver licensing and redistribution boundaries
|
||||
|
||||
Research note for the hybrid direction. It records what the public license
|
||||
texts say about the components a CrossOver-based BetterXen would rely on, and
|
||||
which documents are still missing. It is not legal advice.
|
||||
|
||||
Reviewed 2026-11-25 against public sources only. No CrossOver installation, no
|
||||
Apple license text and no proprietary component was downloaded for this note.
|
||||
|
||||
## Distribution model
|
||||
|
||||
BetterXen does not bundle, redistribute or modify CrossOver, D3DMetal, Rosetta 2
|
||||
or any of the open-source components listed below. The intended model is an
|
||||
externally installed CrossOver that BetterXen invokes as a separate program, with
|
||||
all third-party components supplied by their own distributors. This note records
|
||||
licenses so that any later decision to ship, link or copy a component has a
|
||||
starting point; it does not approve one.
|
||||
|
||||
## Components
|
||||
|
||||
| Component | Version or revision read | License read | Source | Redistribution in BetterXen | Notes |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| BetterXen | current `main` | GPL-3.0-or-later | [`LICENSE`](../../LICENSE) | The project itself | Compatibility baseline for every row below |
|
||||
| CrossOver (product) | 26.3.0, per CodeWeavers' source page | Proprietary EULA; FOSS components keep their own licenses | [EULA](https://www.codeweavers.com/crossover/eula), [FOSS source page](https://www.codeweavers.com/crossover/source) | Not bundled; externally installed | EULA §2 permits building alternate Wine for use with CrossOver and states that the EULA does not supersede the FOSS licenses; §3 forbids decompiling or reverse engineering and distribution or derivative works except where law or those licenses permit. The source page publishes the 26.3.0 tarball and lists Wine, Vkd3d, DXVK and MoltenVK; it does not list DXMT or VKD3D-Proton. Whether 26.3.0 ships them, and at which revisions, is **unknown** |
|
||||
| Wine | `a79470449d03`, master on 2026-11-25 | LGPL-2.1-or-later | [`LICENSE`](https://raw.githubusercontent.com/wine-mirror/wine/a79470449d03/LICENSE) | Not bundled or linked today | "either version 2.1 of the License, or (at your option) any later version" |
|
||||
| DXMT | `faa73e4a0686`, main on 2026-11-25 | LGPL-2.1-or-later; releases up to v0.80 were MIT | [`LICENSE`](https://raw.githubusercontent.com/3Shain/dxmt/faa73e4a0686/LICENSE), [`LICENSE.OLD`](https://raw.githubusercontent.com/3Shain/dxmt/faa73e4a0686/LICENSE.OLD) | Not bundled or linked today | Copyright 2023–2026 Feifan He for CodeWeavers. `LICENSE.OLD` records MIT for releases up to v0.80, so the licence of a shipped DXMT depends on its version |
|
||||
| DXVK | `57b2a7c1e87b`, master on 2026-11-25 | zlib | [`LICENSE`](https://raw.githubusercontent.com/doitsujin/dxvk/57b2a7c1e87b/LICENSE) | Not bundled or linked today | Permission to use, alter and redistribute freely; the notice must be retained |
|
||||
| VKD3D-Proton | `71cae091b065`, master on 2026-11-25 | LGPL-2.1-or-later | [`COPYING`](https://raw.githubusercontent.com/HansKristian-Work/vkd3d-proton/71cae091b065/COPYING) | Not bundled or linked today | `COPYING` grants "either version 2.1 … or any later version"; the `LICENSE` file is the LGPL 2.1 text |
|
||||
| MoltenVK | `5189f8de86ec`, main on 2026-11-25 | Apache-2.0 | [`LICENSE`](https://raw.githubusercontent.com/KhronosGroup/MoltenVK/5189f8de86ec/LICENSE) | Not bundled or linked today | Compatible with GPL-3.0, not GPL-2.0. There is no `NOTICE` file at this pin, so Apache-2.0 §4(d) does not apply; §4(a)–(c) (license copy, change notices, retained notices) do |
|
||||
| Apple Game Porting Toolkit repository | `main`, read 2026-11-25 | Apache-2.0 | [`LICENSE`](https://raw.githubusercontent.com/apple/game-porting-toolkit/main/LICENSE) | Not bundled | This is the repository's license for its porting resources. It is not the license for the separately distributed D3DMetal framework |
|
||||
| D3DMetal | Game Porting Toolkit 4.0, reported | Unconfirmed: a third-party copy of the 4.0 `License.pdf` was read outside this repository; Apple's own download was not read | Third-party copy: `Sikarugir-App/Sikarugir` at `5446b7d18072`, `D3DMetal/{1.1,2.0,2.1,3.0,4.0}/License.pdf` | User-supplied only; never bundled | Reported (evidence class D, not confirmed against Apple's copy): a personal licence to install, use and test for developing, testing or evaluating games on Apple hardware, distribution solely for non-commercial purposes, no use on non-Apple hardware, Framework and Redistributables not separable, and no reverse engineering (sections 2A, 2C, 2D). The missing document is Apple's own copy in the Game Porting Toolkit download. Do not treat the repository's Apache-2.0 license as D3DMetal's |
|
||||
| Rosetta 2 | macOS feature | Unknown: Apple's applicable software license was not read | [Apple Rosetta documentation](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) | External OS component; not bundled | The documentation describes the translation environment; it is not the license grant |
|
||||
|
||||
## Compatibility with GPL-3.0-or-later
|
||||
|
||||
LGPL-2.1-or-later, zlib and Apache-2.0 are generally compatible with a
|
||||
GPL-3.0-or-later work, subject to each license's notice and source-availability
|
||||
conditions. That compatibility matters only if BetterXen links to or copies the
|
||||
component. Invoking an externally installed CrossOver as a separate program does
|
||||
not make its components part of BetterXen's distributed work, and this note does
|
||||
not decide otherwise.
|
||||
|
||||
The CrossOver EULA is recorded above; D3DMetal's own text is not. Neither may be
|
||||
bundled, linked or copied on the strength of this note alone: the product terms
|
||||
are restrictive, and D3DMetal's authoritative licence is still unread.
|
||||
|
||||
GPL-2.0-only components cannot be combined into this GPL-3.0-or-later workspace.
|
||||
A comment on this issue identified MacBox and ScarlettMac as GPL-2.0; they are
|
||||
not part of the component list above and this note does not rely on them.
|
||||
|
||||
## Unknowns and the exact missing documents
|
||||
|
||||
- **CrossOver 26.3.0's FOSS inventory.** The EULA points to Appendix A for the
|
||||
full list, but that list was not included inline on the page read and was not
|
||||
located elsewhere. The source page lists Wine, Vkd3d, DXVK and MoltenVK and
|
||||
does not list DXMT or VKD3D-Proton. Whether 26.3.0 ships DXMT, FEX and
|
||||
VKD3D-Proton, and at which revisions, is unknown.
|
||||
- **D3DMetal license.** It ships with the Game Porting Toolkit download; that
|
||||
download was not made. A third-party copy of the 4.0 `License.pdf` (in
|
||||
`Sikarugir-App/Sikarugir` at `5446b7d18072`) was reported to this issue with a
|
||||
section-level summary, but it is not Apple's copy and stays evidence class D.
|
||||
The `apple/game-porting-toolkit` repository is Apache-2.0 and does not
|
||||
establish the framework's terms. Confirm the summary against Apple's own copy
|
||||
before relying on it; until then D3DMetal is user-supplied and never bundled.
|
||||
- **Rosetta 2 terms.** Apple's license text was not read. Rosetta 2 stays an
|
||||
external macOS component and is never redistributed by BetterXen.
|
||||
- **Exact revisions.** The files above were read at these pins on 2026-11-25:
|
||||
Wine `a79470449d03`, DXMT `faa73e4a0686`, DXVK `57b2a7c1e87b`,
|
||||
VKD3D-Proton `71cae091b065`, MoltenVK `5189f8de86ec`. The revisions CodeWeavers
|
||||
ships in 26.3.0 are still unknown; pin them before any reuse or notice work.
|
||||
- **Linking versus invocation.** Which components, if any, BetterXen would link
|
||||
against rather than invoke is an architecture decision that has not been made
|
||||
here.
|
||||
|
||||
## Sources
|
||||
|
||||
- CodeWeavers, "Free and Open Source Software Code for CrossOver", listing the
|
||||
26.3.0 source tarball and the open-source projects:
|
||||
<https://www.codeweavers.com/crossover/source> (accessed 2026-11-25).
|
||||
- Wine `LICENSE`, wine-mirror/wine at `a79470449d03`, accessed 2026-11-25.
|
||||
- DXMT `LICENSE` and `LICENSE.OLD`, 3Shain/dxmt at `faa73e4a0686`, accessed
|
||||
2026-11-25.
|
||||
- DXVK `LICENSE`, doitsujin/dxvk at `57b2a7c1e87b`, accessed 2026-11-25.
|
||||
- VKD3D-Proton `COPYING`, HansKristian-Work/vkd3d-proton at `71cae091b065`,
|
||||
accessed 2026-11-25.
|
||||
- MoltenVK `LICENSE`, KhronosGroup/MoltenVK at `5189f8de86ec`, and its file list
|
||||
at that pin for the absence of `NOTICE`, accessed 2026-11-25.
|
||||
- CodeWeavers, "CrossOver End User License Agreement", sections 2 and 3:
|
||||
<https://www.codeweavers.com/crossover/eula>, read in a browser 2026-11-25.
|
||||
- D3DMetal third-party copies: `Sikarugir-App/Sikarugir` at `5446b7d18072`,
|
||||
`D3DMetal/{1.1,2.0,2.1,3.0,4.0}/License.pdf`. Not Apple's copy.
|
||||
- Apple Game Porting Toolkit repository `LICENSE`, apple/game-porting-toolkit at
|
||||
`main`, accessed 2026-11-25. Repository license only; it is not the D3DMetal
|
||||
license.
|
||||
- Apple, "About the Rosetta translation environment", accessed 2026-11-25.
|
||||
Documentation only, not the license text.
|
||||
@@ -0,0 +1,88 @@
|
||||
# d3dmetal-native: evaluation as a possible graphics backend (2026-11-25)
|
||||
|
||||
[utmapp/d3dmetal-native](https://github.com/utmapp/d3dmetal-native) hosts Apple's `D3DMetal.framework` in an ordinary macOS process, without Wine, by implementing the host interface the framework expects. This record covers a source review and a build. **It was not run against D3DMetal**, so it contains no rendering, memory, frame-time or stability results. Maintainer request; no issue. Not an independent review and not legal advice.
|
||||
|
||||
**Disposition: reference only. No code adopted, no backend implemented.**
|
||||
|
||||
## Revisions and method
|
||||
|
||||
| Item | Value |
|
||||
| --- | --- |
|
||||
| d3dmetal-native | `af1ee1710711fadff41dead87960d0f1336c1047`; MIT, Turing Software LLC; test COM helpers and one demo adapted from DXVK (zlib) |
|
||||
| Dependency `directx-native` | `7258be1c56cdbf1e55c56b1bc4a866169c8ca0da`; Apache-2.0 licence file; fetched by the pinned wrap |
|
||||
| Vendored headers | MinGW-w64 DirectX and Windows headers; several are LGPL-2.1-or-later. Not audited file by file |
|
||||
| Host | Apple M4, macOS 27.0, meson 1.12.1, ninja 1.13.2 |
|
||||
| Reviewed | public header, README, build files, initialization, and the main parts of sharing, residency, sparse, fence, swapchain, hooking and allocation code |
|
||||
| Not reviewed line by line | about 15,000 lines of `src/`; most of `dmn_com_hooks.cpp`, `dmn_formats.mm`, `dmn_kmtx.cpp`, GFXT event, registry, path and monitor files, and test sources |
|
||||
|
||||
## Build and tests
|
||||
|
||||
`meson setup` with the repository's x86_64 cross file and `-Ddev_framework_path=/nonexistent`, with `D3DMETAL_FRAMEWORK_PATH` unset and no framework anywhere near the build, so Apple's binary could not be loaded.
|
||||
|
||||
- The library built: x86_64 Mach-O, linking Foundation, AppKit, Metal, QuartzCore, CoreGraphics, CoreFoundation, libc++, libobjc and libSystem. 96 compiler warnings, no errors.
|
||||
- `meson test --num-processes 1`: **4 passed, 51 failed.** Passed: `abi-check`, `dxil-container-bounds`, `shadow-heap-forward`, `event-api`. 50 failures report that the framework was not found; `lifecycle-churn` failed because its child control run produced no result.
|
||||
|
||||
None of the four passing tests renders anything or involves D3DMetal.
|
||||
|
||||
## Why it was not run against D3DMetal
|
||||
|
||||
The only copy on the test machine is version 3.0 inside CrossOver (`Contents/SharedSupport/CrossOver/lib64/apple_gptk/external`). The licence file in that framework covers the xxHash library only; no D3DMetal licence text was found beside it. CodeWeavers distributes the copy as part of CrossOver, and nothing read here permits loading it from another program. No Game Porting Toolkit download from Apple was present, and obtaining one requires a person to accept Apple's terms.
|
||||
|
||||
A copy from Apple would settle where the binary comes from. It would not by itself settle the following, which need a maintainer decision (and probably legal advice):
|
||||
|
||||
1. The reported Game Porting Toolkit 4.0 terms forbid reverse engineering and limit use ([licensing note](crossover-licensing.md): read from a third-party copy, unconfirmed).
|
||||
2. The host interface appears to be derived from the compiled framework: `src/d3dmetal_gfxt.h` documents registers, instructions such as `MOVDQU`, and structure offsets (lines 35 to 80).
|
||||
3. At run time the library changes the framework's behaviour: it writes private static flags found by mangled name (`src/dmn_init.cpp` lines 194 to 202, 296, 323), swizzles Metal methods (`dmn_share_install_swizzles`) and patches COM vtables (`src/dmn_hook.h`, `dmn_patch_slot`).
|
||||
4. `scripts/patch_d3dmetal_imports.py` rewrites the framework binary's import table and re-signs it. The engineering rules forbid modifying proprietary components without permission. It was not run.
|
||||
5. `dmn_set_executable_path` makes D3DMetal apply the per-program profile of a different executable name; a test passes the name of a commercial game.
|
||||
|
||||
## Assessment against BetterXen's questions
|
||||
|
||||
All statements in this table come from the source and its comments. None is measured here.
|
||||
|
||||
| Question | Finding |
|
||||
| --- | --- |
|
||||
| Can it replace the CrossOver backend? | No. It runs no Windows program. It offers Direct3D to a native macOS program compiled against it, so the loader, Windows API, threading, files and input that CrossOver provides are out of its scope |
|
||||
| ARM64 host | The whole process must be x86_64 (`meson.build` line 14). A BetterXen host linking it would be an x86_64 executable that BetterXen builds, which the engineering rules forbid. An arm64 process could only talk to a separate x86_64 helper, which meets the same rule |
|
||||
| Cross-process path for an arm64 peer | Shared textures, buffers and fences are described by plain structures plus a file descriptor over anonymous shared memory. An arm64 consumer looks possible in principle; no such consumer exists or was tried |
|
||||
| D3D11 and D3D12 | Whatever the loaded framework implements; the library forwards the entry points and adds sharing, tiled resources and format answers. Older toolkit releases lack some interfaces, including `D3DCompile` |
|
||||
| Shader compiler | D3DMetal consumes DXBC and DXIL. BetterXen's native compiler emits Metal Shading Language, so nothing connects them. The excluded `victory-shader` import emitted DXIL; this does not change its status |
|
||||
| Existing Metal research | `xenora-metal` runs trusted kernels and render stages for synthetic GFX10.3 programs. d3dmetal-native is a Direct3D host. They share only Metal presentation concerns |
|
||||
| Shared resource memory | Shared textures are substituted by linear `StorageModeShared` textures over shared memory, so producer and consumer map the same pages. Linear layout may cost GPU performance; not measured |
|
||||
| Sparse resources | The library says D3DMetal has none and adds tier 2 using sparse Metal heaps, which commit their whole size at first use (1024 MiB chunks; budget from 6144 MiB). On a 24 GiB machine this needs measurement |
|
||||
| Residency | A residency set on macOS 15 and later; a per-command-buffer `useResources:` batch for sparse textures |
|
||||
| Synchronization | Shared fence values live in shared memory. D3D12 producers store them from the GPU with a private flag forced on; D3D11 producers store them from the CPU after completion; consumers run watcher threads, which adds wake-up latency |
|
||||
| Presentation | `nextDrawable` on a caller's `NSView` or `CAMetalLayer`, on D3DMetal worker threads; 1x backing scale by default |
|
||||
| Executable memory | The host interface allocates pages and makes them executable with `mprotect`, relying on Rosetta behaviour |
|
||||
|
||||
## Comparison with the CrossOver backend
|
||||
|
||||
**Not performed.** Memory, correctness, frame times, allocation overhead and stability are all unmeasured.
|
||||
|
||||
When it can be run, an equal comparison needs the same HLSL, resources and expected pixels as `workloads/d3d11-integrated`, with the window, thread and input code replaced by native macOS equivalents. That is a different binary under a different runtime, so only the graphics results (pixel digest, frame intervals, graphics memory) would be comparable; the runtime-service gates would not apply.
|
||||
|
||||
## Is there a supported way to host D3DMetal outside Wine?
|
||||
|
||||
None was found. A web search on 2026-11-25 did not surface Apple's licence text or any Apple documentation of a native-process host interface; the supported route described is Apple's Wine-based evaluation environment. Secondary sources (for example the [holt-d3dmetal release notes](https://github.com/al0x99/holt-d3dmetal/releases/tag/4.0b3), [MaPC](https://mapc.games/opensource.html) and [D4Mac's notices](https://github.com/MichaelLod/D4Mac/blob/main/THIRD_PARTY_LICENSES.md)) report that use is granted for developing, testing or evaluating video games on Apple hardware and that redistribution is non-commercial and whole-framework only. These are not Apple's words and stay unconfirmed. The document that would settle it is the licence inside a Game Porting Toolkit download from Apple.
|
||||
|
||||
Requirements before any proposal to adopt:
|
||||
|
||||
| Area | Requirement |
|
||||
| --- | --- |
|
||||
| Licence | Apple's own licence text read; maintainer (and ideally legal) view that this use, in-process flag writes and a derived interface header are permitted |
|
||||
| Binary | Downloaded from Apple by the user; never copied from CrossOver, bundled or patched |
|
||||
| Architecture | Either an approved exception to the ARM64 host rule, or an arm64 host that talks to a separately licensed x86-64 helper |
|
||||
| Evidence | A demonstrated CrossOver limitation it removes, then the same scenes and expected pixels as the existing workloads |
|
||||
|
||||
## What would reopen this
|
||||
|
||||
All of:
|
||||
|
||||
1. A maintainer decision on the licensing and reverse-engineering questions above.
|
||||
2. A Game Porting Toolkit copy obtained from Apple by a person who accepted its terms.
|
||||
3. A recorded exception, or a design that satisfies the native ARM64 host rule.
|
||||
4. A demonstrated limitation of the CrossOver path that this would remove, as the engineering rules require before adding a second backend.
|
||||
|
||||
## Registry entry (proposed)
|
||||
|
||||
`upstream-registry.md` and `component-reuse-matrix.md` are under claimed review (#363, PR #381), so they were not edited. Proposed row: *utmapp/d3dmetal-native, `af1ee17`, MIT, native-process host for D3DMetal; reference only, not adopted: depends on reverse-engineered interfaces of a proprietary framework and an x86_64 host process.*
|
||||
@@ -0,0 +1,41 @@
|
||||
# Hybrid backlog research record (2026-11-25)
|
||||
|
||||
Evidence class D: public documentation and repository metadata, plus search summaries; see [primary-source-verification-2026-11-25.md](primary-source-verification-2026-11-25.md) for the re-check. Nothing was installed, built or run. Not legal advice. Candidate registry rows are listed here; merge them into [upstream-registry.md](upstream-registry.md) once that file's pending commit has landed.
|
||||
|
||||
## Findings that created issues
|
||||
|
||||
| Finding | Source | Consequence |
|
||||
| --- | --- | --- |
|
||||
| CrossOver 27 reportedly requires Apple silicon and macOS Sonoma+, drops 32-bit bottles, and an ARM64 build without Rosetta 2 is planned; Apple keeps Rosetta fully through macOS 27, a subset after | CodeWeavers blog 2026-06-11 and Apple WWDC 2025 (search summaries; primary pages not retrieved) | [#374](https://github.com/MacosPorters/betterxen/issues/374), comment on #349 |
|
||||
| Bottle backend is reportedly set by `CX_GRAPHICS_BACKEND` (d3dmetal, dxmt, dxvk, wined3d) in `cxbottle.conf`; no official documentation found | Third-party projects | Unverified; #350 must confirm before [#366](https://github.com/MacosPorters/betterxen/issues/366) relies on it |
|
||||
| Cross-building anything for Wine needs mingw-w64 or llvm-mingw | DXMT `docs/DEVELOPMENT.md` | [#364](https://github.com/MacosPorters/betterxen/issues/364) |
|
||||
| Wine and vkd3d-proton ship Direct3D conformance tests that can be built as standalone PE programs | `wine-mirror/wine` `dlls/d3d11/tests`, `vkd3d-proton` `tests/` | [#369](https://github.com/MacosPorters/betterxen/issues/369) |
|
||||
| DXMT offers Metal-coordinated frame pacing and MetalFX upscaling; DXMT is D3D11/10 only | DXMT `docs/CUSTOMIZATION.md`, README | [#370](https://github.com/MacosPorters/betterxen/issues/370) |
|
||||
| DXMT compiles shaders at runtime with an LLVM-based compiler | DXMT `src/airconv` | [#371](https://github.com/MacosPorters/betterxen/issues/371) (hypothesis to test) |
|
||||
| Metal HUD frame data is logged with `MTL_HUD_ENABLED`; logging variable name differs between sources; frame data may be redacted in the unified log | Apple tech talk, community tools | #145, [#372](https://github.com/MacosPorters/betterxen/issues/372) |
|
||||
| D3DMetal license reportedly limits use to evaluation and restricts redistribution | Secondary sources | #354 must read Apple's License.pdf; never bundle |
|
||||
|
||||
## Registry candidates
|
||||
|
||||
| Project | Pin / state observed | License as reported | Classification | Issue |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| llvm-mingw / mingw-w64 | not pinned yet | to read per release | External dependency | #364 |
|
||||
| Wine conformance tests | `wine-mirror/wine`, pushed 2026-11-24 | LGPL-2.1-or-later | Run as external programs, not copied | #369 |
|
||||
| vkd3d-proton tests | pushed 2026-11-25 | LGPL-2.1 | Requires feasibility validation (D3D12 path unconfirmed) | #369 |
|
||||
| DXMT | v0.80 (2026-04-23) | LGPL-2.1-or-later | Requires feasibility validation; external | #370, #371 |
|
||||
| Apple Game Porting Toolkit / D3DMetal | not retrieved | Apple license, reportedly restrictive | Requires licensing clarification; user-supplied only | #354 |
|
||||
| Whisky | archived 2025-05-11 | GPL-3.0 | Technical reference only | #366 |
|
||||
| Gcenx macOS Wine builds, Sikarugir | Sikarugir reports no license | unknown | Technical reference only; no reuse | none |
|
||||
| MetalHUDLogger and similar community tools | not reviewed | unknown | Technical reference only | #145 |
|
||||
| FEX, QEMU, LLVM, MoltenVK, DXVK, Xenia | see upstream registry | see registry | FEX: not applicable on macOS. Others: no change from existing registry | none |
|
||||
| VIctory family, PortWatch VI | see upstream registry | GPL-3.0 (repos) | Rejected for reuse: the tracker describes efforts built around a leaked Xbox Series build of a commercial game; PortWatch is used for discovery only | none |
|
||||
|
||||
Not investigated in depth: Xenia internals and QEMU, because neither runs Windows x86-64 programs on macOS ARM64 in a way relevant to the CrossOver architecture; this is a judgement, not a finding.
|
||||
|
||||
## Issues created
|
||||
|
||||
Existing hybrid issues #344 to #355, #363, #145, #204, #257, #303 were left to the other planning session. New: #364 to #374, and phase trackers #375 (H3), #376 (H4), #377 (H5). Dependencies are recorded as GitHub blocked-by and sub-issue relationships.
|
||||
|
||||
## Conditional work deliberately not filed
|
||||
|
||||
D3D12 workloads (after #349 confirms a path), input-injection tests, a compatibility matrix generator (after #368), upstream contributions to DXMT or Wine (after #369 and #370 produce concrete findings), and release engineering (H6).
|
||||
@@ -0,0 +1,136 @@
|
||||
# Hybrid runtime audit and integration record (2026-11-25)
|
||||
|
||||
What was inspected, what the integration branch contains, what to do with the open shader and runner work, and what remains. Execution evidence is in [hybrid-execution.md](../hybrid-execution.md). Written by the author of the changes it describes, so it is not an independent review.
|
||||
|
||||
## Revisions
|
||||
|
||||
| Item | Revision |
|
||||
| --- | --- |
|
||||
| `main` | `d9333d2` |
|
||||
| #384 hybrid runner | `e1b6a24` |
|
||||
| #388 stall detection | `8e5856b` |
|
||||
| #390 GPU wired-memory fields | `0427465` |
|
||||
| #402 compute workload | `ce9c10a` |
|
||||
| #394 shader import (excluded) | `d8c7a39` |
|
||||
| #395 shader test runner (excluded) | `2713c9e` |
|
||||
| skakwy/victory-mac and MacosPorters/victory-mac-new | both at `3ecbb8f96956` (one README commit after the previously reviewed `22b3f8e45a59`) |
|
||||
| MacosPorters/VIctory-macOS | `d6fc0620f53a` |
|
||||
|
||||
## Integration branch
|
||||
|
||||
`engineering/unified-hybrid-runtime` = `main` + merges of #384, #388, #390 and #402, then the changes described here. Conflicts were in `CHANGELOG.md` only; both sides were kept. It cannot be merged to `main` as an independent change: it contains other contributors' unmerged commits. It becomes a small diff once #384, #388, #390 and #402 land.
|
||||
|
||||
Mergeability checked with `git merge-tree` on 2026-11-25: #384 against `main` conflicts in `CHANGELOG.md` only; #388, #390 and #402 merge cleanly onto #384; this branch, #403 and #404 merge cleanly with `main`; #397 conflicts with its base in `component-reuse-matrix.md` and `victory-shader-integration.md`.
|
||||
|
||||
Baseline before changes (merged base): format, Clippy, workspace tests (1059 passed, 0 failed, 35 ignored), release build, status, claims, dependency-direction and documentation checks passed. `scripts/assemble-fixture.sh --check` failed because Homebrew `llvm` is not installed; with `llvm@17` one assembled fixture differs. This is a toolchain mismatch present before any change.
|
||||
|
||||
Final code: format, Clippy, 1073 tests passed (0 failed, 35 ignored), release build and the same audits passed, with the same fixture failure. `scripts/test-gpu.sh` (native research GPU suite, on revision `e6d614b`; later commits touch no native code) reported 124 passed, 0 failed, 2 ignored.
|
||||
|
||||
## Open pull requests and merge order
|
||||
|
||||
| PR | State seen | Disposition |
|
||||
| --- | --- | --- |
|
||||
| #384 | conflicts with `main` (changelog) | Merge first after resolving. Independent reproduction still missing |
|
||||
| #388 | clean on #384 | Merge after #384 |
|
||||
| #390 | approved, clean | Merge after #384 |
|
||||
| #402 | clean, workload not re-run here | Review and merge after #384 |
|
||||
| #392 | closed 2026-11-26 as superseded | Nothing to do. Its fix is `ca2fe15` on #394, so it is **not** on `main` |
|
||||
| #394 | draft, marked not approved | **Do not merge.** See below |
|
||||
| #395 | draft, stacked on #394 | **Do not merge as is**; it only runs #394's tests |
|
||||
| #397 | documentation, conflicts | Rewrite after the #394 decision; it describes the import |
|
||||
| #403 | draft ADR | Independent of this branch |
|
||||
| #404 | opened during this work, targets `main`, texture-sampling workload for #400 | Independent of this branch; not read or run here |
|
||||
|
||||
#398 and #399 are issues, not pull requests. Suggested order: #384, #388, #390, #402, then this branch.
|
||||
|
||||
### Why #394 is excluded
|
||||
|
||||
Its own provenance record and the independent review on [#399](https://github.com/MacosPorters/betterxen/issues/399) find title-driven behaviour in the imported files; the independent review recommends removing the import and keeping the original D3D12 probes. The engineering rules exclude game-specific code and source from projects built for leaked material. Contributor permission does not change that, and no maintainer policy decision is recorded. Consequence: the hybrid path has **no console shader translator**, and the wave-operation fixes have nowhere admissible to apply.
|
||||
|
||||
## Repository inventory and audit coverage
|
||||
|
||||
**The audit is not complete.** [audit-ledger.tsv](audit-ledger.tsv) lists every tracked file with the depth it received: of 691 files, 23 were read, 11 read in part, 119 summarised from their header comment, size and public item count only, and 538 not read (including tests, fixtures, most documentation and scripts).
|
||||
|
||||
Reuse in the hybrid path, judged from headers and interfaces, so provisional:
|
||||
|
||||
| Existing component | Possible hybrid use | Judgement |
|
||||
| --- | --- | --- |
|
||||
| `loader` PE parser and import parser | Executable identification | `crates/hybrid/src/pe.rs` **duplicates** part of it. The loader's parser accepts AMD64 only and its crate depends on the Metal and shader crates. Extracting a shared dependency-free parser would remove the duplication |
|
||||
| `loader` static probe, `import-gen` classification and demangling | "What does this program need" diagnostics | Candidate; not wired up |
|
||||
| `ref` (CPU depth, blend, indexed, sampling references) | Expected images computed independently of the workload author | Best candidate: would reduce self-verification in graphics workloads |
|
||||
| `texture` (BC2 to BC7 decoders, footprints) | Expected values for compressed-texture workloads | Candidate; compressed formats are untested on the hybrid path |
|
||||
| `loader` translator, services, scheduler, `shader`, `decoder`, `isa`, `metal` | None: Wine, Rosetta and CrossOver backends fill these roles | Keep as paused research |
|
||||
| `ffi` and `app/` | A graphical front end for `betterxen hybrid` | Possible later; no need shown |
|
||||
| `experiments/x1`, `fuzz`, `benchmarks` | The PE fuzz target could also cover the new parser | Not done |
|
||||
|
||||
Dependency graph: `betterxen-hybrid` depends on `libc`; `betterxen` depends on it and on the native crates. Marker search over Rust files found no `todo!`, `unimplemented!`, TODO or FIXME. Ignored tests (35): 27 need a Metal device, 5 an LLVM AMDGPU target, 3 are manual timing runs.
|
||||
|
||||
## Reference repositories
|
||||
|
||||
Inspected at documentation level only (commit, licence, file tree, README, and the earlier component review), because the engineering rules limit projects built for leaked material to discovery use. Their functions and types were not read in this audit. All are GPL-3.0 at repository level; per-file provenance is otherwise unestablished. The VIctory-macOS README states that it runs a console build of a commercial game.
|
||||
|
||||
| Component (path) | Responsibility | BetterXen equivalent | Disposition |
|
||||
| --- | --- | --- | --- |
|
||||
| `crates/victory-loader`, `victory-pe` | Load a console executable | native `loader` (paused) | Exclude: serves a console image; contains title patches |
|
||||
| `crates/victory-hle` | Console runtime services | none on the hybrid path; Wine serves Windows programs | Exclude: console and title behaviour |
|
||||
| `crates/victory-gpu` | Console Direct3D to desktop Direct3D 12 | none | Exclude: title-driven |
|
||||
| `crates/victory-shader` | GFX10 to DXIL | native `shader` (MSL, paused) | Exclude (#399). Any replacement is written from AMD's public ISA |
|
||||
| `crates/victory-formats`, `victory-game`, `victory-pipeline`, `mac/scan` | Asset and title handling | none | Exclude: game-specific |
|
||||
| `crates/victory-core`, `mac/run-victory.sh` | Supervision, memory guard, stall notes | `memory.rs`, stall detection in `run.rs` | Ideas already reimplemented in #384 and #388 and credited there |
|
||||
| `mac/unixlib` | Memory alias and Metal swizzle | none | Exclude: acts on D3DMetal internals |
|
||||
| `tools/macos/build-crossover-wine.sh`, `build-deps.sh` | Build Wine from CodeWeavers' published source | none | Candidate, tracked in #389; needs per-file review first |
|
||||
| `tools/macos/gnullvm-cc.sh` | Cross-link wrapper | pinned llvm-mingw | Not needed |
|
||||
| `crates/victory-shader/src/emit/f64.rs` | Integer emulation of fp64 | none | Deferred (#387); native work is paused |
|
||||
|
||||
[utmapp/d3dmetal-native](https://github.com/utmapp/d3dmetal-native) was reviewed later; see its [evaluation](d3dmetal-native-evaluation.md). It is not adopted.
|
||||
|
||||
Upstream infrastructure (Wine, DXVK, DXMT, VKD3D-Proton, MoltenVK) stays an external dependency delivered by CrossOver. Mesa, LLVM and DXC are not integrated and were not re-audited.
|
||||
|
||||
## Gaps found and changed here
|
||||
|
||||
| Gap | Effect | Change |
|
||||
| --- | --- | --- |
|
||||
| Inherited `CX_GRAPHICS_BACKEND` | Backend changed while the record said none | Removed from the child; recorded |
|
||||
| Mistyped backend ignored by CrossOver | Silent fallback to default | Refused |
|
||||
| No program check before launch | ARM64 or non-PE input failed late or obscurely | `pe.rs` |
|
||||
| Process matching missed the Windows program | Recorded memory never included the workload | Matched by drive-letter command line |
|
||||
| Exit 0 plus a marker counted as success | Partial initialization could pass | Gate lines and `--require-gates` |
|
||||
| Non-UTF-8 byte emptied the log; unbounded output | Lost evidence; disk growth | Lossy decode; 64 MiB limit |
|
||||
| `cannot execute` matched on success | Misclassification | Only on non-zero exit |
|
||||
| No program presented a frame | Gates F to I had no evidence | `workloads/d3d11-integrated` |
|
||||
|
||||
## Later work in this branch
|
||||
|
||||
`betterxen hybrid` with environment isolation, signal cleanup and `stop`; a Direct3D 12 workload; keyboard and lifecycle checks; [security review](security-audit-2026-11-25.md); [shader import decision proposal](shader-import-decision.md); [reference projects](reference-projects-2026-11-25.md) and [PortWatch inventory](portwatch-inventory-2026-11-25.md); [d3dmetal-native evaluation](d3dmetal-native-evaluation.md).
|
||||
|
||||
## Not done
|
||||
|
||||
- No second-person or second-machine reproduction.
|
||||
- No DXIL or shader model 6, audio, networking, controller, mouse, resize, full screen, device loss, MSAA, mip, blending or compressed-texture test on the hybrid path.
|
||||
- Shader and pipeline caches are CrossOver's; BetterXen manages none.
|
||||
- No GPU-memory or thermal data.
|
||||
- `README.md` and architecture documents were left to #397.
|
||||
|
||||
## Blockers
|
||||
|
||||
| Kind | Blocker |
|
||||
| --- | --- |
|
||||
| Decision | #394 / #399 ([proposal](shader-import-decision.md)) |
|
||||
| Review | No independent reproduction of #384, #388, #402 or this branch |
|
||||
| Coordination | The local worktree on #384's branch holds uncommitted edits and an unpushed merge of `main`, so its conflict was not resolved from here |
|
||||
| Upstream behaviour | D3DMetal D3D12 swapchain references; `vkd3d` stall under the `wined3d` and `dxvk` settings |
|
||||
| Documentation of interfaces | CrossOver launch and backend interfaces are undocumented (#350) |
|
||||
| Scope | Nothing here runs console software; Wine provides Windows interfaces, not Xbox ones |
|
||||
|
||||
## Next steps
|
||||
|
||||
1. Decide #394.
|
||||
2. Whoever owns the uncommitted #384 work finishes or discards it; then land #384, #388, #390, #402 and rebase this branch.
|
||||
3. A second contributor runs the acceptance script (gate J).
|
||||
4. Use `crates/ref` for expected images; add compressed-texture and shader model 6 coverage.
|
||||
5. Report the D3DMetal swapchain behaviour to CodeWeavers with the minimal program (needs a maintainer to send it).
|
||||
6. Finish the unread parts of the audit ledger.
|
||||
|
||||
## Continuation checkpoint
|
||||
|
||||
Branch `engineering/unified-hybrid-runtime`; local worktree `artifacts/unified-hybrid-runtime/worktree`; acceptance records under `artifacts/acceptance/` (ignored by Git). Claims posted on #355 and #365; notes on #390 (co-author trailer) and #397 (alignment). Resume from "Next steps"; the inventory rows marked listing only or not read are the unfinished audit.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Windows cross-toolchain for original workloads (issue #364)
|
||||
|
||||
Evidence class B for the build results (commands run on the reference machine, 2026-11-25), class D for licences. The x86-64 programs were later run under CrossOver 26.3; results are in [crossover-baseline-2026-11-25.md](crossover-baseline-2026-11-25.md).
|
||||
|
||||
## Pinned toolchain
|
||||
|
||||
| Item | Value |
|
||||
| --- | --- |
|
||||
| Toolchain | [llvm-mingw](https://github.com/mstorsjo/llvm-mingw) release `20261117`, asset `llvm-mingw-20261117-ucrt-macos-universal.tar.xz` |
|
||||
| SHA-256 | `98d340bbb8d46b09ad6886ffba88bd9d5415e131c316de48e6bd7647377446aa`, equal to the digest GitHub shows for the asset; computed locally with `shasum -a 256` after download |
|
||||
| Host binaries | Mach-O universal (x86_64, arm64); `codesign -dv` shows the clang driver is signed. Runs natively on Apple Silicon |
|
||||
| Targets used | `x86_64-w64-mingw32` and `aarch64-w64-mingw32` (clang), Rust `x86_64-pc-windows-gnullvm` and `aarch64-pc-windows-gnullvm` |
|
||||
| Licence | `LICENSE.TXT` in the release opens with "The LLVM Project is under the Apache License v2.0 with LLVM Exceptions" and then lists further component licences (the mingw-w64 runtime has its own terms). The full file was **not** audited line by line. It is an external build tool: nothing from it is shipped or copied into this repository |
|
||||
| Install | Download, check the digest, unpack outside the repository (for example `~/toolchains/`), pass the directory to the build script. It is not vendored |
|
||||
|
||||
Rust 1.100.0 with `rustup target add x86_64-pc-windows-gnullvm aarch64-pc-windows-gnullvm`.
|
||||
|
||||
## Build and result
|
||||
|
||||
`scripts/hybrid/build-windows-workloads.sh <llvm-mingw-dir>` builds three original programs for both architectures with `-Wall -Wextra -Werror` and then checks each output with `file`; it exits non-zero if a PE has the wrong machine type.
|
||||
|
||||
| Program | Source | x86-64 | ARM64 | Executed under CrossOver 26.3 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| C self-check: CRC-32 check value, four threads, interlocked counter | `workloads/win-selfcheck-c` | built; passed | built; rejected (`cannot execute`) | x86-64 yes, ARM64 no |
|
||||
| Rust self-check: thread-local storage across four threads | `workloads/win-selfcheck-rust` | built; passed | built; rejected | x86-64 yes, ARM64 no |
|
||||
| Direct3D 11 clear and readback of a 64x64 RGBA8 target (first step of #365) | `workloads/d3d11-clear` | built; passed within the specified tolerance | built; rejected | x86-64 yes, ARM64 no |
|
||||
|
||||
A fourth program, `workloads/d3d11-frameloop` (indexed triangle, shaders, sustained frame loop; needs `-ldxguid -ld3dcompiler`), builds the same way. The D3D11 programs exit 2 ("no device") rather than passing when no hardware device exists, so a missing GPU path cannot be mistaken for success.
|
||||
|
||||
## Alternative evaluated: skakwy's `gnullvm-cc.sh`
|
||||
|
||||
The contributor's `tools/macos/gnullvm-cc.sh` (victory-mac commit `22b3f8e45a59`) links `x86_64-pc-windows-gnullvm` with Homebrew clang and rustup's lld. On the reference machine, with Homebrew `llvm@17` as `LLVM_PREFIX`, it failed at link time: `clang-17` aborted with `dyld: Symbol not found: _LLVMInitializeLanaiAsmParser`, because the script sets `DYLD_LIBRARY_PATH` to the Rust toolchain's `libLLVM`. It probably expects a newer Homebrew LLVM; which version was not asked. llvm-mingw covers the same need without that dependency, so the script was **not integrated**. His note that the plain `x86_64-pc-windows-gnu` target aborts on thread start is unverified here, since no program was run.
|
||||
|
||||
## Reproducibility
|
||||
|
||||
Rebuilding twice on one machine and path gives byte-identical SHA-256 for all eight outputs, after adding `-Wl,--no-insert-timestamp` (the C programs differed before because of the PE timestamp). The Rust outputs were identical without it. A build in a different directory was not tested and may embed paths; the second-contributor reproduction that #364 requires has not happened. The `file` check shows the llvm-mingw host binaries are universal (x86_64 and arm64), so the issue's "arm64 only" criterion is not met by this release asset.
|
||||
@@ -0,0 +1,183 @@
|
||||
# Native issue archive
|
||||
|
||||
**Preserved history, not a backlog.** BetterXen's active direction is the CrossOver-based hybrid architecture ([roadmap](../roadmap.md)). The independent native implementation is paused indefinitely; this page replaces its GitHub issue backlog so the work can be found without occupying the active Issues tab. Native source code, tests, benchmarks, Git history and attribution are untouched. Resuming native work needs an explicit maintainer decision ([native roadmap](native-roadmap.md)).
|
||||
|
||||
Every issue below keeps its full text, comments and attribution on GitHub and can be reopened; closing used the reason "not planned". Issues imported from the earlier Xenora repository say so in their first lines, and their original author is recorded below. Excerpts are the first sentence of the issue's objective, not a summary of acceptance criteria.
|
||||
|
||||
## Active-work transitions
|
||||
|
||||
Four native issues stay open because a contributor is assigned and has an open pull request. They are the only open native-only issues and each carries a comment asking the contributor to say whether to continue as archived native research, re-scope, or withdraw:
|
||||
|
||||
| Issue | Assignee | Pull request |
|
||||
| --- | --- | --- |
|
||||
| [#247](https://github.com/MacosPorters/betterxen/issues/247) native app quick start | atesahmet0 | [#310](https://github.com/MacosPorters/betterxen/pull/310) |
|
||||
| [#291](https://github.com/MacosPorters/betterxen/issues/291) executable writes inside a translated block | maridogolpeador | [#327](https://github.com/MacosPorters/betterxen/pull/327) |
|
||||
| [#307](https://github.com/MacosPorters/betterxen/issues/307) CRT stdio follow-up | soggyramennoodle | [#263](https://github.com/MacosPorters/betterxen/pull/263), [#290](https://github.com/MacosPorters/betterxen/pull/290) |
|
||||
| [#313](https://github.com/MacosPorters/betterxen/issues/313) original compiled C guest | soggyramennoodle | [#330](https://github.com/MacosPorters/betterxen/pull/330) |
|
||||
|
||||
Open pull requests for issues that were closed (#308, #312, #328, #329, #339, #340, #341, #342) were left untouched; each received a comment explaining the transition so maintainers and authors can decide whether to merge them as research or close them.
|
||||
|
||||
## Native pieces hybrid development might use
|
||||
|
||||
Nothing in the native backlog is a prerequisite for the hybrid phases. One possible reuse is already noted: the original compiled C guest fixture of #313/#330 could serve as one authorized test workload for hybrid baselines ([#364](https://github.com/MacosPorters/betterxen/issues/364)). If hybrid work needs any other native component, it should be filed as a focused hybrid issue.
|
||||
|
||||
## Findings preserved from discussions
|
||||
|
||||
- **Remill evaluation ([#324](https://github.com/MacosPorters/betterxen/issues/324)).** An isolated, native ARM64 evaluation pinned Remill at `66c488c9911fd9b368e4d0c9647d74239f8bba8b`. Five original AMD64 traces lifted and ran with 32 passing case/path checks. A second pass recorded eight floating-point mismatches (guest rounding, MXCSR sticky flags, denormals-are-zeros, an unmasked precision exception) and a loop that needed external termination; the decision was to retain the existing CPU path, and the failing gate was left failing. An adapter design was written. Published on branch `research/remill-arm64` (commit `e50268d8723a29a365a36c6b665db6d4e3733f6b`; `experiments/remill/`). Local test results, not CI; no independent acceptance.
|
||||
- **VIctory shader-compiler feasibility ([#261](https://github.com/MacosPorters/betterxen/issues/261)).** Local experiments (`experiments/victory-native/`, uncommitted, on a local branch) built a pinned shader compiler natively, translated original gfx1030 fixtures to DXIL, converted them with Apple's Metal shader converter and checked native Metal readback (a 4x4 pixel probe and a 32-word buffer transform) on an M4, plus a review of an upstream Xenora snapshot (114 tests passed). Those materials depend on VIctory-family source whose input provenance the [upstream registry](upstream-registry.md) does not clear for reuse; they are not part of this branch and nothing from them is adopted.
|
||||
- **PortWatch review and native plan ([#298](https://github.com/MacosPorters/betterxen/issues/298), [PR #308](https://github.com/MacosPorters/betterxen/pull/308)).** Produced [portwatch-native-macos.md](portwatch-native-macos.md) and a seven-phase native plan (open PR #308, which replaces the README X1 to X25 table). The native plan is superseded by the hybrid roadmap; the PortWatch screening facts remain useful.
|
||||
- **Metal buffer pool ([#130](https://github.com/MacosPorters/betterxen/issues/130)).** A bounded completed-buffer pool imported from upstream Xenora commit `4f3d0ae1ca44ff5e01e569eab07f776af43d2f8e` (author Vedant Dadhich, GPL-3.0-or-later attribution retained) passed 58 native tests locally with a negative control; a pipeline-selection fixture was added under [#315](https://github.com/MacosPorters/betterxen/issues/315). Local branch `integration/xenora-metal-pool`, not pushed.
|
||||
- **C++ unwind prerequisite ([#343](https://github.com/MacosPorters/betterxen/issues/343)).** An isolated `experiments/cpp-unwind` workspace adapting restricted prolog-restoration logic from upstream Xenora (Swastick Chowdhury, SPDX notice retained); local branch `integration/cpp-unwind`, not pushed.
|
||||
|
||||
Local branches and worktrees named above are not on GitHub; their owners decide whether to publish them.
|
||||
|
||||
## Index
|
||||
|
||||
|
||||
### CPU correctness and translation
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#62](https://github.com/MacosPorters/betterxen/issues/62) [CPU] Verify RIP-relative effective-address computation | ranveersoni98 | 1 | - | closed, not planned | Audit the shared effective-address emitter for RIP-relative operands. Verify positive and negative displacements and instruction-end address |
|
||||
| [#63](https://github.com/MacosPorters/betterxen/issues/63) [CPU] Correct legacy high-byte register semantics | ranveersoni98 | 1 | - | closed, not planned | Verify AH, CH, DH and BH handling without REX and SPL, BPL, SIL and DIL with REX. Reject unsupported combinations explicitly. |
|
||||
| [#64](https://github.com/MacosPorters/betterxen/issues/64) [CPU] Implement bounded x86 instruction prefix decoding | ranveersoni98 | 1 | - | closed, not planned | Enforce architectural instruction-length limits and validate repeated or conflicting prefixes. Add truncated-input and boundary regression t |
|
||||
| [#65](https://github.com/MacosPorters/betterxen/issues/65) [CPU] Verify guest flags across translated block boundaries | ranveersoni98 | 1 | - | closed, not planned | Verify architectural flags survive translated block transitions, helper calls and subsequent conditional branches. Use independent expected |
|
||||
| [#66](https://github.com/MacosPorters/betterxen/issues/66) [CPU] Add parity flag and parity-dependent branch semantics | ranveersoni98 | 1 | - | closed, not planned | Implement a documented and tested parity-flag subset, including JP and JNP. Preserve existing CPU state layout contracts. |
|
||||
| [#68](https://github.com/MacosPorters/betterxen/issues/68) [CPU] Correct LEA effective-address semantics | ranveersoni98 | 1 | - | closed, not planned | Verify LEA operand widths, SIB calculations, RIP-relative addressing and the distinction between effective-address computation and segment-r |
|
||||
| [#113](https://github.com/MacosPorters/betterxen/issues/113) [CPU-NEXT] Add independently verified MOVSXD semantics | ranveersoni98 | 1 | - | closed, not planned | Verify signed 32-to-64 extension for register and memory operands, both signs, and fault-state preservation. |
|
||||
| [#114](https://github.com/MacosPorters/betterxen/issues/114) [CPU-NEXT] Add 16-bit operand-size semantics for bounded integer instr | ranveersoni98 | 1 | - | closed, not planned | Test low-word updates, preservation of upper bits, immediate length, and unsupported prefix combinations; compare native and independent exp |
|
||||
| [#115](https://github.com/MacosPorters/betterxen/issues/115) [CPU-NEXT] Implement CMP and TEST memory operand coverage | ranveersoni98 | 1 | - | closed, not planned | Verify 8/16/32/64-bit forms within the supported subset, taken and untaken branches, flags, no memory writes, and precise faults. |
|
||||
| [#116](https://github.com/MacosPorters/betterxen/issues/116) [CPU-NEXT] Implement memory operand integer ALU subset | ranveersoni98 | 1 | - | closed, not planned | Add independently verified ADD/SUB/AND/OR/XOR memory forms; verify read-modify-write boundaries, flags, widths and no partial side effects o |
|
||||
| [#118](https://github.com/MacosPorters/betterxen/issues/118) [CPU-NEXT] Implement integer multiply and divide semantics | ranveersoni98 | 1 | - | closed, not planned | Cover selected documented MUL/IMUL/DIV/IDIV forms, signedness, implicit registers, quotient overflow and divide-by-zero guest faults. |
|
||||
| [#119](https://github.com/MacosPorters/betterxen/issues/119) [CPU-NEXT] Implement conditional moves and SETcc | ranveersoni98 | 1 | - | closed, not planned | Test supported conditions across signed/unsigned boundaries, aliasing, byte register writes and documented memory-fault behavior. |
|
||||
| [#120](https://github.com/MacosPorters/betterxen/issues/120) [CPU-NEXT] Define and verify guest SIMD architectural state | ranveersoni98 | 1 | - | closed, not planned | Introduce a bounded, documented XMM state representation with layout assertions and correct save/preservation across helpers. No instruction |
|
||||
| [#121](https://github.com/MacosPorters/betterxen/issues/121) [CPU-NEXT] Implement bounded SSE2 vector move and bitwise operations | ranveersoni98 | 1 | - | closed, not planned | Verify selected aligned/unaligned vector moves and packed AND/OR/XOR against original known answers, including aliasing and memory faults. |
|
||||
| [#122](https://github.com/MacosPorters/betterxen/issues/122) [CPU-NEXT] Implement bounded SSE2 packed integer arithmetic | ranveersoni98 | 1 | - | closed, not planned | Verify selected packed adds/subtracts, comparisons and lane widths against independently derived vectors; no unsupported saturation behavior |
|
||||
| [#123](https://github.com/MacosPorters/betterxen/issues/123) [CPU-NEXT] Implement verified scalar SSE floating-point subset | ranveersoni98 | 1 | - | closed, not planned | Define rounding and supported FP domain before implementing selected scalar operations. Test signed zero, finite boundary values and explici |
|
||||
| [#124](https://github.com/MacosPorters/betterxen/issues/124) [CPU-NEXT] Define guest floating-point control and exception state | ranveersoni98 | 1 | - | closed, not planned | Verify documented MXCSR subset, reserved bits, reset state, preservation and unsupported-mode diagnostics; do not globally modify host FP mo |
|
||||
| [#127](https://github.com/MacosPorters/betterxen/issues/127) [CPU-NEXT] Audit ARM64 assembler encoding coverage for new CPU operati | ranveersoni98 | 1 | - | closed, not planned | Compare representative legal encodings with native LLVM assembler results; reject invalid ranges and preserve existing independently derived |
|
||||
| [#191](https://github.com/MacosPorters/betterxen/issues/191) [CPU] Model guest memory ordering and fence instructions | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#291](https://github.com/MacosPorters/betterxen/issues/291) Handle executable writes within an active translated block | Arths17 | 3 | #327 | open (active work) | PR #269 revalidates translated code at dispatch boundaries. A guest store that modifies a later instruction in the currently executing trans |
|
||||
| [#300](https://github.com/MacosPorters/betterxen/issues/300) [CPU RESEARCH] Specify bounded AMD64 unwind before guest exception dis | Arths17 | 2 | #329 | closed, not planned | Guest faults currently terminate execution; the hosted-C A2 fixture imports __C_specific_handler but never calls it. That stub traps. Window |
|
||||
| [#324](https://github.com/MacosPorters/betterxen/issues/324) [CPU RESEARCH] Evaluate Remill in an isolated native ARM64 experiment | Arths17 | 9 | - | closed, not planned | Evaluate Remill as an isolated native Apple Silicon CPU-backend experiment. Requested by the maintainer; do not replace the production DBT o |
|
||||
| [#343](https://github.com/MacosPorters/betterxen/issues/343) [C++ INTEGRATION] Add isolated bounded unwind prerequisite | Arths17 | 3 | - | closed, not planned | User-authorized first C++ integration slice: a bounded, read-only AMD64 unwind prerequisite, adapted from the pinned native Xenora implement |
|
||||
|
||||
### DBT performance
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#80](https://github.com/MacosPorters/betterxen/issues/80) [CPU] Add native DBT performance regression benchmarks | ranveersoni98 | 1 | #341 | closed, not planned | Expand original CPU benchmarks to measure cold translation, cached execution, branch-heavy workloads and checked memory operations. Report r |
|
||||
| [#82](https://github.com/MacosPorters/betterxen/issues/82) [PERF-CPU] Implement adaptive DBT basic-block sizing | ranveersoni98 | 1 | - | closed, not planned | Benchmark alternatives to the fixed 16-instruction block limit. Preserve instruction budgets, fault accounting and deterministic execution. |
|
||||
| [#84](https://github.com/MacosPorters/betterxen/issues/84) [PERF-CPU] Implement guest-to-host register allocation | ranveersoni98 | 1 | - | closed, not planned | Investigate keeping frequently accessed guest registers in ARM64 registers. Implement correct spilling, helper-call preservation and archite |
|
||||
| [#85](https://github.com/MacosPorters/betterxen/issues/85) [PERF-CPU] Eliminate redundant guest register loads and stores | ranveersoni98 | 1 | - | closed, not planned | Track register values within translated blocks and eliminate redundant CPU-state accesses without changing observable guest behavior. |
|
||||
| [#86](https://github.com/MacosPorters/betterxen/issues/86) [PERF-CPU] Implement conservative DBT dead-store elimination | ranveersoni98 | 1 | - | closed, not planned | Eliminate overwritten register assignments where safe. Preserve state at faults, service calls and block exits. |
|
||||
| [#87](https://github.com/MacosPorters/betterxen/issues/87) [PERF-CPU] Implement lightweight leaf-block generation | ranveersoni98 | 1 | - | closed, not planned | Avoid unnecessary stack-frame operations in translated blocks that do not call host helpers. Verify ARM64 ABI compliance. |
|
||||
| [#90](https://github.com/MacosPorters/betterxen/issues/90) [PERF-CPU] Investigate safe direct basic-block linking | ranveersoni98 | 1 | - | closed, not planned | Reduce dispatcher overhead through validated block linking. Preserve cache invalidation, instruction limits and executable-memory protection |
|
||||
| [#91](https://github.com/MacosPorters/betterxen/issues/91) [PERF-CPU] Implement hot-block execution profiling | ranveersoni98 | 1 | - | closed, not planned | Measure guest block execution frequencies and identify expensive frequently executed blocks. Keep instrumentation optional and bounded. |
|
||||
| [#92](https://github.com/MacosPorters/betterxen/issues/92) [PERF-CPU] Investigate tiered native translation | ranveersoni98 | 1 | - | closed, not planned | Design a lightweight first-tier translator and optional optimized translation for measured hot blocks. Implement only after profiling and co |
|
||||
| [#93](https://github.com/MacosPorters/betterxen/issues/93) [PERF-CPU] Implement fast DBT dispatch lookup cache | ranveersoni98 | 1 | - | closed, not planned | Benchmark a small front cache ahead of existing HashMap lookups. Preserve complete cache identity and invalidation. |
|
||||
| [#94](https://github.com/MacosPorters/betterxen/issues/94) [PERF-CPU] Reduce budget-limited translation duplication | ranveersoni98 | 1 | - | closed, not planned | Measure duplicate translations in limited_block_cache. Safely reuse compatible blocks only where instruction accounting remains exact. |
|
||||
| [#95](https://github.com/MacosPorters/betterxen/issues/95) [PERF-CPU] Implement bounded JIT cache reclamation | ranveersoni98 | 1 | - | closed, not planned | Design safe reclamation for exhausted code caches. Ensure no live translated pointer references reclaimed code. |
|
||||
| [#96](https://github.com/MacosPorters/betterxen/issues/96) [PERF-CPU] Measure and optimize JIT code publication | ranveersoni98 | 1 | - | closed, not planned | Measure code-copy and instruction-cache synchronization costs. Investigate bounded batching while retaining all macOS JIT protections. |
|
||||
| [#97](https://github.com/MacosPorters/betterxen/issues/97) [PERF-CPU] Reuse DBT fault-guard scratch storage | ranveersoni98 | 1 | - | closed, not planned | Measure allocation overhead from per-block fault_guards vectors. Reuse bounded scratch storage without retaining stale patch locations. |
|
||||
| [#98](https://github.com/MacosPorters/betterxen/issues/98) [PERF-CPU] Replace linear guest memory lookup with indexed regions | ranveersoni98 | 1 | - | closed, not planned | Compare sorted-region binary search with the current linear region scan. Preserve permissions, overflow checks and exact fault behavior. |
|
||||
| [#99](https://github.com/MacosPorters/betterxen/issues/99) [PERF-CPU] Implement checked guest memory locality cache | ranveersoni98 | 1 | - | closed, not planned | Cache recently accessed guest region identities. Invalidate on mapping changes and revalidate permissions and access bounds. |
|
||||
| [#100](https://github.com/MacosPorters/betterxen/issues/100) [PERF-CPU] Optimize guest instruction-byte fetch | ranveersoni98 | 1 | - | closed, not planned | Reduce repeated region lookups during sequential instruction decoding using bounded, execute-permission-checked fetch windows. |
|
||||
| [#102](https://github.com/MacosPorters/betterxen/issues/102) [PERF-CPU] Optimize mapped-region insertion and removal | ranveersoni98 | 1 | - | closed, not planned | Benchmark mapping operations across realistic synthetic region counts. Improve lookup and maintenance costs while preserving overlap rejecti |
|
||||
| [#103](https://github.com/MacosPorters/betterxen/issues/103) [PERF-CPU] Measure guest memory allocation and copying costs | ranveersoni98 | 1 | - | closed, not planned | Identify avoidable allocations and copies in original memory workloads. Preserve zero initialization and guest isolation. |
|
||||
| [#104](https://github.com/MacosPorters/betterxen/issues/104) [PERF-CPU] Optimize repeated PE RVA resolution | ranveersoni98 | 1 | - | closed, not planned | Benchmark section lookup and introduce a validated indexed representation where beneficial. Depend on checked PE range validation. |
|
||||
| [#106](https://github.com/MacosPorters/betterxen/issues/106) [PERF-CPU] Profile PE loading and startup stages | ranveersoni98 | 1 | - | closed, not planned | Measure parsing, mapping, relocation, import binding, TLS setup and entry execution separately. Use original fixtures only. |
|
||||
| [#111](https://github.com/MacosPorters/betterxen/issues/111) [PERF-CPU] Expand DBT performance instrumentation | ranveersoni98 | 1 | - | closed, not planned | Track translation time, dispatch time, guest-memory helper calls, cache-hit ratios, emitted bytes per guest instruction and code-cache utili |
|
||||
| [#169](https://github.com/MacosPorters/betterxen/issues/169) [CPU] Measure native code expansion by guest instruction family | ranveersoni98 | 1 | #342 | closed, not planned | criteria |
|
||||
|
||||
### GPU, shader and Metal
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#129](https://github.com/MacosPorters/betterxen/issues/129) [GPU-NEXT] Benchmark Metal render pipeline reuse | ranveersoni98 | 1 | - | closed, not planned | Measure repeated render setup separately from GPU time; verify complete pipeline identity, output pixels and cache lifetime. |
|
||||
| [#130](https://github.com/MacosPorters/betterxen/issues/130) [GPU-NEXT] Reduce verified Metal buffer allocation churn | ranveersoni98 | 4 | - | closed, not planned | Profile allocation count and latency in repeated original compute/render fixtures; implement bounded reuse with initialization and completio |
|
||||
| [#132](https://github.com/MacosPorters/betterxen/issues/132) [GPU-NEXT] Measure and reduce synchronous GPU readback overhead | ranveersoni98 | 1 | - | closed, not planned | Separate submission, completion and readback timings. Add a bounded opt-in asynchronous original-fixture path only if justified; verify outp |
|
||||
| [#133](https://github.com/MacosPorters/betterxen/issues/133) [GPU-NEXT] Benchmark multi-command Metal submission batching | ranveersoni98 | 1 | - | closed, not planned | Compare individual versus batched independent original commands; verify barriers, ordering, bounded queue depth and matching outputs. |
|
||||
| [#135](https://github.com/MacosPorters/betterxen/issues/135) [GPU-NEXT] Separate shader translation validation from reusable compil | ranveersoni98 | 1 | - | closed, not planned | Measure repeated translation of identical original inputs; define complete validated artifact identity including architecture and semantic o |
|
||||
| [#136](https://github.com/MacosPorters/betterxen/issues/136) [GPU-NEXT] Measure shader IR allocation and MSL emission costs | ranveersoni98 | 1 | - | closed, not planned | Profile decode, lift, analysis and emission separately on original workloads; reduce demonstrated temporary allocation costs without changin |
|
||||
| [#139](https://github.com/MacosPorters/betterxen/issues/139) [GPU-NEXT] Benchmark bounded BC1 linearization and upload paths | ranveersoni98 | 1 | - | closed, not planned | Measure untile, staging and upload costs on original texture patterns across sizes, mips and layers; verify pixel equality and malformed-inp |
|
||||
| [#141](https://github.com/MacosPorters/betterxen/issues/141) [GPU-NEXT] Benchmark partial mip updates and upload coalescing | ranveersoni98 | 1 | - | closed, not planned | Compare whole and selected-mip updates; verify dimensions, row pitch, unchanged neighboring mips and completion semantics. |
|
||||
| [#142](https://github.com/MacosPorters/betterxen/issues/142) [GPU-NEXT] Measure shader and graphics resource budget scaling | ranveersoni98 | 1 | - | closed, not planned | Characterize existing 4096-scale fixture limits and resource use. If justified, add configurable bounded synthetic workload tiers with check |
|
||||
| [#179](https://github.com/MacosPorters/betterxen/issues/179) [GPU] Implement runtime-dependent uniform shader branches | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#180](https://github.com/MacosPorters/betterxen/issues/180) [GPU] Add bounded shader loop semantics and termination checks | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#181](https://github.com/MacosPorters/betterxen/issues/181) [GPU] Implement typed scalar buffer reads with checked resource ranges | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#182](https://github.com/MacosPorters/betterxen/issues/182) [GPU] Add vector multiply-add and explicit floating-point rounding con | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#205](https://github.com/MacosPorters/betterxen/issues/205) [GPU] Build a metadata-driven RDNA2 semantic expansion pipeline | ranveersoni98 | 1 | - | closed, not planned | Xenora currently identifies approximately 1,460 RDNA2 instruction forms but semantically decodes only 25. |
|
||||
| [#208](https://github.com/MacosPorters/betterxen/issues/208) [GPU] Decode BC6H two-region modes (CPU) | elforeign | 1 | - | closed, not planned | criteria |
|
||||
| [#209](https://github.com/MacosPorters/betterxen/issues/209) [GPU] Native Metal upload and readback of BC6H and BC7 | elforeign | 1 | - | closed, not planned | criteria |
|
||||
| [#224](https://github.com/MacosPorters/betterxen/issues/224) [GPU] Guest graphics fences with Metal shared events | elforeign | 1 | - | closed, not planned | ## Goal Give the guest graphics runtime (`crates/loader/src/graphics.rs`) a fence object with the publicly documented D3D12 contract: a que |
|
||||
| [#225](https://github.com/MacosPorters/betterxen/issues/225) [QA] Define and run acceptance for the 86 locally verified gfx1030 for | elforeign | 1 | - | closed, not planned | ## Area QA / GPU ## Problem `docs/status.toml` at `eb85731` lists 104 gfx1030 forms. Only 18 count as accepted (`gpu = "fixture verified"`) |
|
||||
| [#258](https://github.com/MacosPorters/betterxen/issues/258) [PERF] Evaluate bounded Metal cache prewarming and persistence after s | Arths17 | 1 | - | closed, not planned | Xenora already has a [bounded context-local compute cache](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046 |
|
||||
| [#302](https://github.com/MacosPorters/betterxen/issues/302) [GPU RESEARCH] Define explicit shader entry and resource bindings beyo | Arths17 | 1 | #340 | closed, not planned | graphics.rs already translates image_sample_lz and #226 added guest texture/sampler descriptor tables. The remaining gap is not “add texture |
|
||||
|
||||
### Integration workloads and shared accounting
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#143](https://github.com/MacosPorters/betterxen/issues/143) [INTEGRATION-NEXT] Add original CPU-to-GPU mixed workload benchmark | ranveersoni98 | 1 | - | closed, not planned | Create a small original synthetic workload that executes verified CPU arithmetic, checked buffer updates and native rendering; validate know |
|
||||
| [#146](https://github.com/MacosPorters/betterxen/issues/146) [INTEGRATION-NEXT] Add deterministic synthetic transform workload | ranveersoni98 | 1 | - | closed, not planned | Use independently authored integer and supported finite FP transforms with known expected outputs; compare supported CPU and GPU implementat |
|
||||
| [#147](https://github.com/MacosPorters/betterxen/issues/147) [INTEGRATION-NEXT] Add original texture-update and draw workload | ranveersoni98 | 1 | - | closed, not planned | Build an original multi-frame texture update/draw case with known texels and pixels, bounded resources and explicit native verification. |
|
||||
| [#148](https://github.com/MacosPorters/betterxen/issues/148) [INTEGRATION-NEXT] Verify CPU and GPU shared resource ownership under | ranveersoni98 | 1 | - | closed, not planned | Use synthetic resources to verify permitted transitions, stale-handle rejection, completion-aware cleanup and deterministic failure without |
|
||||
| [#149](https://github.com/MacosPorters/betterxen/issues/149) [INTEGRATION-NEXT] Add long-running bounded original workload soak tes | ranveersoni98 | 1 | - | closed, not planned | Run a fixed number of validated synthetic iterations; report peak memory, cache growth, handles and deterministic outputs. Enforce time/reso |
|
||||
| [#150](https://github.com/MacosPorters/betterxen/issues/150) [INTEGRATION-NEXT] Add replayable original workload input corpus | ranveersoni98 | 1 | - | closed, not planned | Define versioned independently authored fixture inputs, deterministic seeds and expected outcomes. Replay only original data; verify limits |
|
||||
| [#159](https://github.com/MacosPorters/betterxen/issues/159) [SHARED-NEXT] Define shared CPU/GPU frame workload and timing interfac | ranveersoni98 | 1 | #328 | closed, not planned | Agree on bounded original workload inputs, frame completion, metrics units, resource lifetime and deterministic failure contracts before any |
|
||||
| [#160](https://github.com/MacosPorters/betterxen/issues/160) [SHARED-NEXT] Define bounded native GPU workload resource budget contr | ranveersoni98 | 1 | - | closed, not planned | Document limits for buffers, textures, queued work, compilation and staging; define explicit resource-exhaustion behavior and compatibility |
|
||||
| [#199](https://github.com/MacosPorters/betterxen/issues/199) [SHARED] Define unified CPU JIT and GPU allocation accounting | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
|
||||
### Runtime and loader
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#195](https://github.com/MacosPorters/betterxen/issues/195) [RUNTIME] Add virtual memory reserve commit decommit state tests | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#198](https://github.com/MacosPorters/betterxen/issues/198) [RUNTIME] Add CRT overlapping memory move and bounded string edge case | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#211](https://github.com/MacosPorters/betterxen/issues/211) feat: Add a read-only dependency census for PE packages | elforeign | 1 | - | closed, not planned | The static probe takes one PE file at a time. With an EXE and companion DLLs, it takes a separate manual pass to tell which symbols the pack |
|
||||
| [#212](https://github.com/MacosPorters/betterxen/issues/212) [SHARED] Decide whether to relax the CLI runner's exact-bytes trust ga | Swastickc | 1 | - | closed, not planned | ## Question for the maintainer Should the CLI runner's exact-bytes trust gate be relaxed? A contributor asked for this error to be removed: |
|
||||
| [#227](https://github.com/MacosPorters/betterxen/issues/227) Audio: native PCM mixer and CoreAudio output (location and Gate 6 brid | elforeign | 1 | - | closed, not planned | ### Area audio ### Summary I have a standalone prototype of a native PCM mixer with opt-in CoreAudio output for Apple Silicon: a bounded co |
|
||||
| [#228](https://github.com/MacosPorters/betterxen/issues/228) [RUNTIME] Deterministic guest thread scheduler | jelly013 | 1 | - | closed, not planned | guest threads do not exist yet: CreateThread is absent and, as synch.rs states, a call that would block another guest thread stops the gues |
|
||||
| [#301](https://github.com/MacosPorters/betterxen/issues/301) [LOADER] Specify and test an original two-DLL startup graph | Arths17 | 1 | - | closed, not planned | run_synthetic_startup accepts one image, and services/modules.rs exposes built-in service modules. Those are not general guest DLL mapping, |
|
||||
| [#304](https://github.com/MacosPorters/betterxen/issues/304) [RUNTIME] Make guest Sleep yield without blocking other scheduled thre | Arths17 | 1 | - | closed, not planned | docs/runtime/threads.md explicitly says Sleep delays every guest thread. A deterministic single-host-thread scheduler is already implemented |
|
||||
| [#305](https://github.com/MacosPorters/betterxen/issues/305) [RUNTIME RESEARCH] Specify static TLS and callback lifecycle for sched | Arths17 | 1 | #312 | closed, not planned | the scheduler already gives each worker a TEB, stack, dynamic TLS/FLS values and cleanup, but docs/runtime/threads.md explicitly excludes PE |
|
||||
| [#307](https://github.com/MacosPorters/betterxen/issues/307) [RUNTIME] CRT stdio follow-up: fread/fseek/ftell, fgetc/ungetc and hos | soggyramennoodle | 1 | #263, #290 | open (active work) | PR #290 took its own CRT stdio module (`crt_stdio.rs`) out in `e1f7176`, because `main` gained its own `fopen`/`fclose`/`fwrite`/`__acrt_iob |
|
||||
| [#322](https://github.com/MacosPorters/betterxen/issues/322) [RUNTIME] Replace the VirtualQuery trap for a documented guest-memory | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for memory-query contract and failing guest tests. Production metadata changes coordinate #195 and memory.rs |
|
||||
| [#323](https://github.com/MacosPorters/betterxen/issues/323) [RUNTIME] Implement a bounded data-page VirtualProtect subset with tra | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for protection contract/failing-test design. Implementation follows the agreed memory metadata model in #322/ |
|
||||
| [#331](https://github.com/MacosPorters/betterxen/issues/331) Keep host-mounted file opens nonblocking | soggyramennoodle | 1 | - | closed, not planned | Follow-up from the review of #290. Harden regular-file opens so a host-side file type change cannot leave a BetterXen host thread waiting in |
|
||||
| [#332](https://github.com/MacosPorters/betterxen/issues/332) Bound the cost of lookups in large host-mounted directories | soggyramennoodle | 1 | - | closed, not planned | Follow-up from the review of #290. Host-backed drive lookup currently enumerates an entire directory and refuses directories exceeding 4,096 |
|
||||
| [#333](https://github.com/MacosPorters/betterxen/issues/333) Runtime compatibility follow-ups from PR #290 | soggyramennoodle | 1 | - | closed, not planned | Track the remaining nonblocking review items from #290. - Invalidate aligned-allocation tracking in shared guest heap free paths and test ow |
|
||||
| [#336](https://github.com/MacosPorters/betterxen/issues/336) [RUNTIME] SetFilePointerEx should fail a negative distance from FILE_B | Arths17 | 1 | #339 | closed, not planned | Found while auditing #290. This behaviour already exists on `main` (`crates/loader/src/services/files.rs`), so it is not part of that PR. Th |
|
||||
|
||||
### Compiled launch milestone and native app
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#247](https://github.com/MacosPorters/betterxen/issues/247) [DOCS] Add a native app quick start ending in a synthetic frame | Arths17 | 2 | #310 | open (active work) | The [README build section](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/README.md#building-xenora) |
|
||||
| [#249](https://github.com/MacosPorters/betterxen/issues/249) [APP] Avoid unchanged-frame image copies and reduce paused polling | Arths17 | 1 | - | closed, not planned | [`FrameLoopModel.startPolling`](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/app/Sources/Xenora/mai |
|
||||
| [#250](https://github.com/MacosPorters/betterxen/issues/250) [APP] Surface session command failures and centralize loop lifecycle | Arths17 | 1 | - | closed, not planned | [`FrameLoopModel`](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/app/Sources/Xenora/main.swift#L441) |
|
||||
| [#253](https://github.com/MacosPorters/betterxen/issues/253) [APP] Audit inspector and fixture controls with keyboard and VoiceOver | Arths17 | 1 | - | closed, not planned | The comparison found native controls and frame accessibility labels, but VoiceOver, keyboard navigation, text scaling and dark-mode behavior |
|
||||
| [#254](https://github.com/MacosPorters/betterxen/issues/254) [DIAGNOSTICS] Share a versioned static compatibility report across CLI | Arths17 | 1 | - | closed, not planned | Xenora already exposes metadata, loader validation, imports, relocations, TLS and a bounded first-unsupported-instruction finding through it |
|
||||
| [#256](https://github.com/MacosPorters/betterxen/issues/256) [INTEGRATION] Prove a multi-module synthetic startup through a checked | Arths17 | 1 | - | closed, not planned | Existing trusted startup and app fixtures establish bounded pieces. The comparison proposes one original integration scenario connecting exe |
|
||||
| [#259](https://github.com/MacosPorters/betterxen/issues/259) [RELEASE] Prepare versioned, signed and notarized contributor previews | Arths17 | 1 | - | closed, not planned | The [app build script](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/scripts/build-app.sh) hardcodes |
|
||||
| [#311](https://github.com/MacosPorters/betterxen/issues/311) [LAUNCH TRACKER] First compiled guest application through native ARM64 | Arths17 | 2 | - | closed, not planned | / --- / / Build and admit / Source/tool/file-license identity, native host tools, exact admitted profile; unsupported input refused. / / En |
|
||||
| [#313](https://github.com/MacosPorters/betterxen/issues/313) [LAUNCH] Build an original compiled C guest for the launch milestone | Arths17 | 3 | #330 | open (active work) | ## Outcome and readiness Ready for fixture specification and native build-recipe work. Runtime execution waits for the agreed frame/service |
|
||||
| [#314](https://github.com/MacosPorters/betterxen/issues/314) [GPU] Add bounded creation and explicit release for guest graphics obj | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for a narrow lifetime/budget design and failing tests. Agree budget values through #160 and coordinate graphi |
|
||||
| [#315](https://github.com/MacosPorters/betterxen/issues/315) [GPU] Let a bounded guest pipeline select original translated vertex a | Arths17 | 4 | - | closed, not planned | ## Outcome and readiness Design/fixture work can start. Production changes follow #159 contract agreement and #314; serialize graphics.rs ed |
|
||||
| [#316](https://github.com/MacosPorters/betterxen/issues/316) [RUNTIME/GPU] Expose the minimal typed graphics command bridge to comp | Arths17 | 2 | - | closed, not planned | ## Outcome and readiness ABI review and original failing guest tests can start. Implementation waits for #159 plus #315/#314 and coordinatio |
|
||||
| [#317](https://github.com/MacosPorters/betterxen/issues/317) [SESSION] Run the compiled launch fixture through a bounded built-in w | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Profile design can begin. Worker execution integration is blocked on #313/#316, the required #212 maintainer admiss |
|
||||
| [#318](https://github.com/MacosPorters/betterxen/issues/318) [SESSION] Bound stop and failure recovery when the compiled guest does | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Design and hostile-original-fixture specifications can start; implementation follows #317 and coordination with its |
|
||||
| [#319](https://github.com/MacosPorters/betterxen/issues/319) [INPUT] Verify compiled guest input snapshots change guest state and r | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Original C test/expected-state design can start after the fixture/header contract is agreed. End-to-end execution w |
|
||||
| [#320](https://github.com/MacosPorters/betterxen/issues/320) [APP] Present actual compiled-guest frames in a native launch session | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness UI acceptance specification can start. Swift implementation waits for #317/#318, #250 lifecycle agreement and overl |
|
||||
| [#321](https://github.com/MacosPorters/betterxen/issues/321) [QA] Independently gate first compiled launch from source build throug | Arths17 | 1 | #328 | closed, not planned | ## Outcome and readiness Ready for acceptance-protocol/independent expected-value work. The executable harness runs only after #313/#316/#31 |
|
||||
|
||||
### Roadmap and ecosystem research
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#261](https://github.com/MacosPorters/betterxen/issues/261) [ROADMAP] Native workflow and runtime integration improvements from th | Arths17 | 9 | - | closed, not planned | Turn the supplied Victory for macOS teardown and integration map into actionable Xenora improvements, preserving original implementation, na |
|
||||
| [#298](https://github.com/MacosPorters/betterxen/issues/298) [RESEARCH] Review PortWatch projects and revise the native macOS execu | Arths17 | 7 | #308 | closed, not planned | / --- / --- / / CPU / Guest x86-64 runs on a matching x86-64 CPU; several projects require AVX2 / Decode/execute or translate each supporte |
|
||||
| [#306](https://github.com/MacosPorters/betterxen/issues/306) [RESEARCH] Track public evidence for console launch and graphics ABI b | Arths17 | 1 | - | closed, not planned | BetterXen's tested contracts are synthetic PE32+/gfx1030 contracts. They do not establish the Xbox launch environment, shader entry state, d |
|
||||
|
||||
#158 (native optimization evidence audit) was also closed as obsolete and belongs with DBT performance. The seven earlier "[Deferred native research]" umbrella issues were replaced by one closed index issue.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Native research roadmap
|
||||
|
||||
**Deferred — not part of the active development roadmap, and paused indefinitely.** The active direction is the [CrossOver-based hybrid roadmap](../roadmap.md). Native work resumes only after an explicit maintainer decision, with no date. Native tasks needed by hybrid work are filed as focused hybrid issues instead.
|
||||
|
||||
## Existing implementation (preserved in the workspace)
|
||||
|
||||
Rust crates under `crates/` and `app/`, tests under `tests/`, fixtures, fuzz targets and benchmarks. The last `main` commit before the hybrid transition is tagged `native-first-final`. Contributor history is untouched.
|
||||
|
||||
## Verified achievements (synthetic evidence only)
|
||||
|
||||
Per [docs/progress.md](../progress.md) and the [status registry](../status.toml): translated gfx1030 shaders executing on native Metal on Apple M5 for synthetic fixtures, bounded x86-64 guest execution, an ARM64 dynamic binary translator for supported instruction subsets, a deterministic scheduler running guest threads serially on one host thread. No Xbox title runs. These are the original evidence classes, not new verification.
|
||||
|
||||
## Known limitations
|
||||
|
||||
See the archived [native-first plan](../archive/development-phases-native-first.md) and [README current limitations](../../README.md#current-limitations): serial guest threading, partial runtime services, partial RDNA2 coverage, unknown console launch ABI.
|
||||
|
||||
## Previously planned work
|
||||
|
||||
The native-first phases 1 to 6 (trustworthy baseline, hosted C application, threaded behavior, translated rendering, integrated interactive application, measured bottlenecks) and the X1 to X25 capability map, kept in the archive. The issue backlog was closed as not planned and is indexed, with preserved findings, in the [native issue archive](native-issue-archive.md).
|
||||
|
||||
## Potential future architecture
|
||||
|
||||
Independent CPU translation and Metal components that could replace or complement CrossOver, Rosetta 2 or D3DMetal where a demonstrated limitation or availability risk justifies it.
|
||||
|
||||
## Conditions for resuming (maintainer decision, not automatic)
|
||||
|
||||
Hybrid reaches verified maturity; reliable baselines exist; a native component solves a demonstrated hybrid limitation; a dependency imposes an unavoidable constraint or becomes unavailable; or resources allow it without slowing hybrid work.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,120 @@
|
||||
# PortWatch VI tracker inventory (retrieved 2026-11-25)
|
||||
|
||||
Metadata snapshot of [tracker.json](https://portwatch-vi.xyz/data/tracker.json), updated `2026-11-26T01:31:36.865Z`, SHA-256 `c8a32748928e6a76cdaec4c439381961c849f2693217630ad16b225f6cc73178`. The full records are in [portwatch-inventory-2026-11-25.json](portwatch-inventory-2026-11-25.json).
|
||||
|
||||
**These projects target a console build of a commercial game that this repository's registry records as leaked.** They are discovery references only. Nothing here was cloned, run or adopted. Stages, frame rates and verification levels are the tracker's reports and are not verified by BetterXen.
|
||||
|
||||
## Totals
|
||||
|
||||
Collections: efforts 43, tools 22, candidates 20, flagged 6, dmca 2, ignored 563. `flagged` (the tracker calls these likely malware), `dmca` and `ignored` entries are counted only.
|
||||
|
||||
Distinct entries from efforts, tools and candidates: 84. Availability: available: 69, not queried: no GitHub repository identifier: 6, unavailable (HTTP 404): 6, not queried: tracker reports it removed: 3.
|
||||
|
||||
Licences GitHub reports for available repositories: GPL-3.0 26, MIT 16, none 11, NOASSERTION 7, GPL-2.0 3, Apache-2.0 3, AGPL-3.0 1, CC0-1.0 1, LGPL-2.1 1. `none` means no reuse right at all; `NOASSERTION` means GitHub could not identify the licence.
|
||||
|
||||
## GitHub fork relationships
|
||||
|
||||
Only GitHub's own fork links are shown. Copies pushed as new repositories do not appear here; the tracker's `basedOn` and `related` fields are in the JSON.
|
||||
|
||||
| Source | Forks in the tracker |
|
||||
| --- | --- |
|
||||
| Marvisak/VIctory | DexNom/VIctory |
|
||||
|
||||
## Efforts (43)
|
||||
|
||||
| Repository | Kind or approach | Branch | Licence | Language | Fork of | Last push | Availability |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| anrq0/SeriesX-Emulator | Emulator | main | MIT | C++ | | 2026-11-25 | available |
|
||||
| avatarmanz/VIctory-7900XTX | Compatibility layer | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| Belobug/VIctory-Belobug-AMD | Compatibility layer | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| brcly/TuxBox | Compatibility layer | main | Apache-2.0 | Rust | | 2026-11-26 | available |
|
||||
| californiaAlmonds/OpenScarlett | Compatibility layer | main | MIT | C++ | | 2026-11-26 | available |
|
||||
| Dark3581/AnyBox | Relinker | main | | | | 2026-11-23 | unavailable (HTTP 404) |
|
||||
| DexNom/VIctory | Compatibility layer | main | GPL-3.0 | Rust | Marvisak/VIctory | 2026-11-26 | available |
|
||||
| edupode/anyxboxseries | Compatibility layer | main | NOASSERTION | Rust | | 2026-11-25 | available |
|
||||
| ethan00013/keylime | Compatibility layer | main | | | | 2026-11-25 | unavailable (HTTP 404) |
|
||||
| Freminet/ScarlettX | HLE emulator | main | none | C++ | | 2026-11-22 | available |
|
||||
| fxceless/victory-fork | Compatibility layer | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| Hylanderry/DedSec | Static recompilation (DX12) | dedsec-clean | MIT | Python | | 2026-11-23 | available |
|
||||
| ItsNotRexed/Leonida | Static recompilation | main | | | | 2026-11-23 | tracker reports it removed |
|
||||
| jadeowaowa/scarlett-layer | Compatibility layer | main | Apache-2.0 | C++ | | 2026-11-24 | available |
|
||||
| JamesCicada/GTAVI-Recomp | Relinker (PS5 route) | main | GPL-2.0 | Python | | 2026-11-25 | available |
|
||||
| JPTuba9/xlaunch-vi | Compatibility layer | main | | | | 2026-11-25 | unavailable (HTTP 404) |
|
||||
| Kajcsi/G6Recomp | Compatibility layer | main | GPL-3.0 | C++ | | 2026-11-24 | available |
|
||||
| ljm-233/Xbgtasix | Compatibility layer | main | GPL-3.0 | C++ | | 2026-11-25 | available |
|
||||
| LooperSalty/AnyXboxX | HLE emulator | main | GPL-3.0 | Python | | 2026-11-26 | available |
|
||||
| luizwidmer/palmetto | Static recompilation | main | GPL-3.0 | Python | | 2026-11-26 | available |
|
||||
| Marvisak/VIctory | Compatibility layer | main | GPL-3.0 | Rust | | 2026-11-25 | available |
|
||||
| omonkeyz/xbox-emulator | Compatibility runtime | main | GPL-3.0 | Rust | | 2026-11-25 | available |
|
||||
| OnlyMoisties/GTA6-BootTest | Compatibility layer | main | none | C | | 2026-11-24 | available |
|
||||
| OpenCommunityEdition/OpenScarlett | Compatibility layer | main | AGPL-3.0 | C++ | | 2026-11-25 | available |
|
||||
| p-portela/SCARAB | API bridge | main | GPL-3.0 | C++ | | 2026-11-23 | available |
|
||||
| ProhorovIlja/NativeX-Runtime | Research probes | main | MIT | C++ | | 2026-11-25 | available |
|
||||
| R0Y00/Xbox2Windows | Static recompilation | main | MIT | Python | | 2026-11-26 | available |
|
||||
| realdody/americas-recomp | Relinker + shader recompiler | xbox-series | | | | 2026-11-23 | tracker reports it removed |
|
||||
| rpatty-dev/PercyScarlett | Compatibility layer | main | GPL-2.0 | Rust | | 2026-11-25 | available |
|
||||
| sammwyy/xvalkyrie | Compatibility layer | main | GPL-3.0 | C++ | | 2026-11-26 | available |
|
||||
| SSTGxf/ScarlettCompat | Compatibility layer | main | MIT | C++ | | 2026-11-26 | available |
|
||||
| Steinkoloss/port-of-the-americas | Compatibility layer | main | none | C++ | | 2026-11-25 | available |
|
||||
| ThatRecompDev/five-star-recomp | Compatibility layer | main | GPL-3.0 | C# | | 2026-11-26 | available |
|
||||
| uiliannn/VItoriaBr | Compatibility layer | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| xcl-dev/xcl | Compatibility layer | main | GPL-2.0 | Rust | | 2026-11-26 | available |
|
||||
| Zettrox/ztrx | Compatibility layer | main | | | | 2026-11-25 | tracker reports it removed |
|
||||
| zohaiblazuli/GrandTheftXbox | Compatibility layer | main | | | | 2026-11-20 | unavailable (HTTP 404) |
|
||||
| NotNozy | tracked | | | | | | no GitHub repository identifier |
|
||||
| Doomsday | tracked | | | | | | no GitHub repository identifier |
|
||||
| darkworldhm | tracked | | | | | | no GitHub repository identifier |
|
||||
| suri | tracked | | | | | | no GitHub repository identifier |
|
||||
| omonkey | tracked | | | | | | no GitHub repository identifier |
|
||||
| CGBJ | Compatibility layer | | | | | | no GitHub repository identifier |
|
||||
|
||||
## Tools (22)
|
||||
|
||||
| Repository | Kind or approach | Branch | Licence | Language | Fork of | Last push | Availability |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| Ahmet-Dedeler/awesome-gta6-reverse-engineering | Curated list | main | NOASSERTION | HTML | | 2026-11-26 | available |
|
||||
| Ahmet-Dedeler/bcpack-rs | Texture codec | master | NOASSERTION | Rust | | 2026-11-26 | available |
|
||||
| Ahmet-Dedeler/rage9-re | Data decoder | master | NOASSERTION | Rust | | 2026-11-24 | available |
|
||||
| Albotterin/AWC_from_RPF9_Extractor | Audio extractor | main | MIT | Java | | 2026-11-25 | available |
|
||||
| batatinhafcbatatinha-pixel/xseriesrecomp | Front end | | | | | 2026-11-23 | unavailable (HTTP 404) |
|
||||
| breadbbbb/rpf9-explorer | Archive explorer | main | none | C# | | 2026-11-24 | available |
|
||||
| fishingpvalues/gta6-pc-port-hub | Coordination hub | main | CC0-1.0 | Python | | 2026-11-22 | available |
|
||||
| holdmysocks/SixNG | Asset extractor | master | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| HolyRoses/gta6-explorer | Asset explorer | main | MIT | Python | | 2026-11-26 | available |
|
||||
| JoshRob297/rpf9-research | Format research | main | GPL-3.0 | Python | | 2026-11-24 | available |
|
||||
| kry-vex-gta/XBOX-Inspector | Build inspector | main | MIT | Rust | | 2026-11-23 | available |
|
||||
| Librett0/vice-lens | Asset explorer | main | MIT | Rust | | 2026-11-22 | available |
|
||||
| lynxnathan/rage-tools-vi | Archive toolkit | main | MIT | Python | | 2026-11-25 | available |
|
||||
| meetox80/6stars | World viewer | main | none | C++ | | 2026-11-22 | available |
|
||||
| nineforge0/forge9 | Archive toolkit | main | MIT | Rust | | 2026-11-25 | available |
|
||||
| nullbrik/RageForge | RE toolkit | | | | | 2026-11-23 | unavailable (HTTP 404) |
|
||||
| rpatty-dev/PercyStar | Archive explorer | main | NOASSERTION | Rust | | 2026-11-25 | available |
|
||||
| SentinelInteractive/0x52504639 | Format research | main | MIT | Python | | 2026-11-24 | available |
|
||||
| sub-north/xbox-hle-lab | Test tools | main | MIT | C++ | | 2026-11-24 | available |
|
||||
| TheoBIET/OpenVI | Archive explorer | main | GPL-3.0 | TypeScript | | 2026-11-25 | available |
|
||||
| walkthestars/GTA6-Asset-Info | Format notes | main | GPL-3.0 | | | 2026-11-20 | available |
|
||||
| woreksami/ttpf-studio | Texture tool | main | MIT | Python | | 2026-11-23 | available |
|
||||
|
||||
## Unreviewed candidates (19)
|
||||
|
||||
| Repository | Kind or approach | Branch | Licence | Language | Fork of | Last push | Availability |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| Archivist-Atlas/gta-vi-astral | unreviewed candidate | main | none | Go | | 2026-11-25 | available |
|
||||
| baummarder/xHoly | unreviewed candidate | main | Apache-2.0 | Rust | | 2026-11-25 | available |
|
||||
| decantlabs/decant | unreviewed candidate | main | MIT | Rust | | 2026-11-26 | available |
|
||||
| deepdev237/victory-mac | unreviewed candidate | main | GPL-3.0 | | | 2026-11-25 | available |
|
||||
| DesignWithTommy/i95 | unreviewed candidate | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| ExCorvus/gta-pipeline-reconstruction | unreviewed candidate | master | NOASSERTION | C++ | | 2026-11-26 | available |
|
||||
| ihaterockstargames/sixth-star | unreviewed candidate | main | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| JozefDeTremmerie/CCS03 | unreviewed candidate | ccs03 | GPL-3.0 | Rust | | 2026-11-26 | available |
|
||||
| Linox-IDK/LNX-victory | unreviewed candidate | main | GPL-3.0 | Rust | | 2026-11-25 | available |
|
||||
| lukinhasnojento/gta6-port-knowledge | unreviewed candidate | main | GPL-3.0 | | | 2026-11-26 | available |
|
||||
| POMXARK/bcpack-gpu-hlsl | unreviewed candidate | main | NOASSERTION | Rust | | 2026-11-26 | available |
|
||||
| RandomSkelly/Series0nLinux | unreviewed candidate | main | none | C++ | | 2026-11-25 | available |
|
||||
| RKouchoo/rdna4rage | unreviewed candidate | main | none | C++ | | 2026-11-26 | available |
|
||||
| Ryanabcraft/scarlett-victory-bench | unreviewed candidate | main | GPL-3.0 | Rust | | 2026-11-25 | available |
|
||||
| sefaalcn/half-step-game-project | unreviewed candidate | main | GPL-3.0 | Rust | | 2026-11-25 | available |
|
||||
| viper-community/viper | unreviewed candidate | main | LGPL-2.1 | Rust | | 2026-11-26 | available |
|
||||
| x6j1ZiqfbxA3u12HVk/Project-Americas | unreviewed candidate | main | none | C++ | | 2026-11-26 | available |
|
||||
| Zarexdevs/GMAC | unreviewed candidate | main | none | | | 2026-11-26 | available |
|
||||
| zsy-miao/ScarlettVI | unreviewed candidate | main | none | C++ | | 2026-11-25 | available |
|
||||
@@ -1,3 +1,5 @@
|
||||
> **Superseded in part (2026-11-25).** This review recommended against Rosetta, Wine and CrossOver under the native-first plan. BetterXen's direction is now the CrossOver-based hybrid architecture ([roadmap](../roadmap.md), [ADR 0005](../adr/0005-crossover-hybrid-direction.md)); the screening facts below remain useful, the native-first recommendations do not. See the [upstream registry](upstream-registry.md) for the current provenance decision on VIctory-family projects.
|
||||
|
||||
# PortWatch review and a native macOS execution plan
|
||||
|
||||
Reviewed November 24, 2026 (America/Chicago). This is a public-documentation and
|
||||
@@ -199,7 +201,7 @@ texture inventory respectively. Runtime PRs #263/#290 overlap substantially;
|
||||
their author/maintainer must resolve them before new runtime edits. These
|
||||
references are destination-repository numbers, not imported source numbers.
|
||||
|
||||
The replacement [development phases](../development-phases.md) define the sole
|
||||
The replacement [development phases](../archive/development-phases-native-first.md) define the sole
|
||||
active work order, from compiled guest boot through modular workers, a
|
||||
guest-controlled Metal scene, an interactive application, a compatibility
|
||||
corpus, sustained native execution and conditional Xbox experiments.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Primary-source verification (2026-11-25)
|
||||
|
||||
Re-checks claims first taken from search summaries in [hybrid-backlog-research-2026-11-25.md](hybrid-backlog-research-2026-11-25.md). Evidence class D (public documentation read; nothing installed or run). Not legal advice. #363 still has to re-derive these independently.
|
||||
|
||||
| Claim | Result | Primary source read |
|
||||
| --- | --- | --- |
|
||||
| CrossOver offers the backends Auto, D3DMetal, DXMT, DXVK and Wine | **Confirmed.** Auto uses CodeWeavers' per-game database and wined3d if none is given; D3DMetal covers DirectX 11 and 12; DXMT is Metal-based Direct3D 11; DXVK is Vulkan-based Direct3D 10 and 11; DLSS via MetalFX applies to D3DMetal and DXMT only | support.codeweavers.com "Advanced Settings in CrossOver Mac 26" (modified 2026-02-10). That page is for CrossOver 26 and does not name MoltenVK |
|
||||
| `CX_GRAPHICS_BACKEND` in `cxbottle.conf` is a supported interface | **Not confirmed.** Neither CodeWeavers page read mentions it or `cxbottle`, `cxstart` or `cxrun`. It appears only in third-party projects. Treat as undocumented; #350 decides | Same page and support.codeweavers.com "Advanced CrossOver Mac Configuration" |
|
||||
| Documented configuration surfaces | The second page documents `defaults` keys in `~/Library/Preferences/com.codeweavers.CrossOver.plist` (BottleDir, ManagedBottleDirs) and bottle hooks run with `CX_ROOT`, `CX_BOTTLE` and `WINEPREFIX` set | Same |
|
||||
| CrossOver needs Rosetta 2; ARM64 build without it planned; CrossOver 27 requirements | **Unverified.** The CodeWeavers blog returned HTTP 403 to automated fetches, and the documentation pages above do not cover it. Read it in a browser for #348 | CodeWeavers blog (blocked) |
|
||||
| Rosetta after macOS 27 | **Sources conflict.** Apple developer news of 2026-09-01 says macOS 27 is the final release supporting Rosetta, with continued support for older unmaintained games that rely on Intel-based frameworks. News of 2026-09-09 says macOS 26 is the final release supporting Intel Macs and Rosetta, and 27 is Apple silicon only. Record both until Apple clarifies | developer.apple.com/news (ids w5ngl9k2, k1mtkt1k) |
|
||||
| D3DMetal license | **Not located.** The `apple/game-porting-toolkit` repository is Apache-2.0 and never mentions D3DMetal; D3DMetal ships in the separate Game Porting Toolkit download whose license was not read. Secondary sources describe evaluation-only use and restricted redistribution. Stays user-supplied and unbundled | github.com/apple/game-porting-toolkit, LICENSE |
|
||||
| DXMT license and scope | **Confirmed.** LGPL-2.1-or-later (copyright 2023-2026 Feifan He for CodeWeavers). README: Direct3D 11 and 10 on Metal using Wine. Wiki: macOS 14 or later, Apple silicon supported, Intel GPUs experimental and planned for removal once macOS 28 is released, Wine 8+ required, DXMT needs symbols from `winemac.so`. Cross builds need LLVM 15 and a mingw cross-compiler. Latest release v0.80 (2026-04-23) | github.com/3Shain/dxmt (LICENSE, README, wiki, docs/DEVELOPMENT.md) |
|
||||
| Wine conformance tests exist as standalone Windows programs | **Confirmed in tree.** `dlls/d3d11/tests/Makefile.in` defines a `d3d11.dll` test target from `d3d11.c`. The Wine conformance-test documentation page loaded (HTTP 200) but its requirements were not read; build and run requirements remain unverified | wine-mirror/wine |
|
||||
|
||||
## Dependencies observed
|
||||
|
||||
DXMT lists Meson 1.3+, LLVM 15, Xcode 16+ with the Metal toolchain and a Windows cross-compiler as build requirements. The Rust workspace requires `rustc` 1.100 (`rust-version` in `Cargo.toml`).
|
||||
|
||||
## Rust toolchain
|
||||
|
||||
The default `stable` on the reference machine was rustc 1.94.1, which cannot build the workspace. rustc 1.100.0 is the current official stable (channel manifest dated 2026-11-12, release 2026-11-09) and was already installed as toolchain `1.100.0-aarch64-apple-darwin`, so nothing was installed. Run `rustup run 1.100.0 cargo ...` or update `stable`. With it, `cargo test --locked -p xenora-loader --test generated_runtime_integration --test runtime_x15` passed (3 and 35 tests, 1 ignored). These native tests are not needed for hybrid development; the full workspace suite was not run.
|
||||
|
||||
## Not verified
|
||||
|
||||
CrossOver's CPU-translation internals and ARM64 plans, CrossOver 27 requirements, D3DMetal license text, `cxbottle`/`cxstart` command-line syntax, Wine conformance-test requirements, and whether D3D12 is usable under any backend on the installed version. These belong to #348, #350 and #354.
|
||||
@@ -0,0 +1,82 @@
|
||||
# Reference projects: what may be used, and what would have to change (2026-11-25)
|
||||
|
||||
Covers the named reference repositories and the [PortWatch VI tracker inventory](portwatch-inventory-2026-11-25.md). Evidence is repository metadata, licences, READMEs and file trees. **No reference repository's implementation source was read for this record, nothing was cloned for it except `d3dmetal-native`, and nothing was compiled or run from any project but that one.** Portability statements are therefore inferences from what the projects say about themselves. Not legal advice.
|
||||
|
||||
## The restrictions that apply
|
||||
|
||||
All from the engineering rules ([AGENTS.md](../../AGENTS.md)):
|
||||
|
||||
| Rule | Why it exists | Effect here |
|
||||
| --- | --- | --- |
|
||||
| "Provenance first: exclude anything derived from leaked proprietary material or unauthorized software. A project's license being GPL does not clear material it was built from or for." | A licence cannot grant rights its author never had | Covers every project developed against the leaked build |
|
||||
| "Projects whose stated purpose depends on leaked or unauthorized builds ... are discovery references at documentation level; adopt nothing from them without a per-file provenance and license review recorded in the registry." | Contamination risk | Documentation-level reading only |
|
||||
| "Never copy, port, translate or adapt source from emulator projects built for leaked or unauthorized material." | Same, for ideas carried as code | No porting, even of generic-looking parts |
|
||||
| "Game-specific, asset-specific and decryption-related code is never adopted." | Third-party rights, anti-circumvention law | Excludes archive, texture-codec and key tooling |
|
||||
| "Before integrating or copying anything: verify the exact license ... If licensing is uncertain, do not use it." | Licence compliance | No licence file means no reuse; GPL-2.0-only cannot be combined |
|
||||
| BetterXen host binaries are ARM64; no x86-64 host executables | Native Apple Silicon host | Rules out linking x86-64-only libraries |
|
||||
|
||||
The first four are provenance and clean-room rules; the last two are ordinary dependency rules. Access granted by a maintainer to a private repository changes none of them: access is not a right to redistribute material that belongs to someone else.
|
||||
|
||||
## Named repositories
|
||||
|
||||
| Repository (head) | Licence | What it is | Disposition |
|
||||
| --- | --- | --- | --- |
|
||||
| MacosPorters/victory-mac-new and skakwy/victory-mac (`3ecbb8f96956`, identical) | GPL-3.0 | VIctory fork with a Mac build | Discovery only |
|
||||
| MacosPorters/VIctory-macOS (`d6fc0620f53a`) | GPL-3.0 | VIctory fork for macOS | Discovery only |
|
||||
| prex-xo/VIctory-7900XTX (`e2a28ec70632`) | GPL-3.0 | Fork of avatarmanz/VIctory-7900XTX with no commits of its own when compared | Discovery only; Windows and AMD RDNA 3 specific by its README (mesh shaders, shader model 6.6, 40 to 46 GB of memory) |
|
||||
| meetox80/6stars (`480d9a4d00ed`) | **none** | Swift and Metal engine that reads the game's archives | Excluded: no licence, asset-specific |
|
||||
| utmapp/d3dmetal-native (`af1ee17`) | MIT | Wine-free D3DMetal host | Reference only; see [evaluation](d3dmetal-native-evaluation.md) |
|
||||
|
||||
### Independently developed parts a different policy could evaluate
|
||||
|
||||
Listed so a maintainer can decide with specifics. None is approved.
|
||||
|
||||
| Part | Author as recorded | Would address | Prerequisite |
|
||||
| --- | --- | --- | --- |
|
||||
| `tools/macos/build-crossover-wine.sh`, `build-deps.sh` (VIctory-macOS) | mostly Pragyaan Gaur | A Wine built from CodeWeavers' published source, for comparison ([#389](https://github.com/MacosPorters/betterxen/issues/389)) | Per-file review; these build upstream Wine and do not touch title code |
|
||||
| `mac/run-victory.sh` supervision ideas (victory-mac) | skakwy | Memory guard and stall handling | Already reimplemented in #384 and #388 |
|
||||
| fp64 integer emulation (`emit/f64.rs`) | skakwy | Native shader compiler fp64 ([#387](https://github.com/MacosPorters/betterxen/issues/387)) | The #399 review says exclude the imported file; rewrite from IEEE 754 instead |
|
||||
|
||||
## Architecture: these projects and BetterXen
|
||||
|
||||
| Subject | Console-title layers (by their READMEs) | BetterXen hybrid | Portable to Apple Silicon? |
|
||||
| --- | --- | --- | --- |
|
||||
| CPU | Console x86-64 run natively in a Windows process | Windows x86-64 under CrossOver and Rosetta 2 | Only through Rosetta; AVX2 behaviour must be checked |
|
||||
| Executable loading | Own PE loader and relinking | Wine's loader; BetterXen only identifies the file | Their loaders assume Windows or Wine |
|
||||
| Runtime services | Reimplemented console and GDK libraries | Wine's Windows API | Console APIs have no counterpart here |
|
||||
| Graphics | Direct3D 12 or Vulkan, often with NVIDIA or AMD requirements | D3D11 and D3D12 through CrossOver backends | Vendor-specific paths are not; plain D3D12 is, as far as the backend supports it |
|
||||
| Shaders | RDNA 2 recompiled to DXIL, HLSL or SPIR-V | Ordinary DXBC from the program | A recompiler's output still needs a backend that accepts it; D3DMetal reports no double support |
|
||||
| Resource and memory model | Windows virtual memory and placeholders; large discrete VRAM | Unified memory, 24 GB on the test machine | Reported needs of 22 to 46 GB do not fit it |
|
||||
| Synchronization, threading | Win32 and D3D12 primitives | Same, provided by Wine and the backend | Yes at the API level |
|
||||
| Testing | Mostly the target title | Original workloads with CPU-computed expectations | n/a |
|
||||
|
||||
## PortWatch candidates
|
||||
|
||||
From 84 distinct entries. Most target the console title, are unlicensed, GPL-2.0-only, AGPL-3.0 or removed.
|
||||
|
||||
| Candidate | Licence | Why it might be eligible | What it could add | Status |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| ProhorovIlja/NativeX-Runtime | MIT | README describes original test programs, a source and licence review, and no proprietary material; Windows and Linux | Original D3D12 compute, raster and tiled-resource tests; BetterXen has no tiled-resource coverage | Candidate for a per-file review; not read |
|
||||
| anrq0/SeriesX-Emulator | MIT | README says it never decrypts or unpacks and tests with its own guest programs | Little: BetterXen already identifies executables | Not pursued |
|
||||
|
||||
Other entries describing themselves as clean-room or "any title" layers target running dumped console games. Whether that purpose is admissible is a policy question this record does not settle.
|
||||
|
||||
**No component from any tracked project addresses a deficiency BetterXen has demonstrated**, so none was integrated. The deficiencies found so far (see [hybrid execution](../hybrid-execution.md)) are in CrossOver backends, in verification coverage and in missing independent reproduction.
|
||||
|
||||
## Relationships
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
V["Marvisak/VIctory"] --> VF["fxceless/victory-fork"]
|
||||
V --> VM["skakwy/victory-mac = MacosPorters/victory-mac-new"]
|
||||
V --> VMO["pragyaangaur/VIctory-macOS → MacosPorters/VIctory-macOS"]
|
||||
V --> A["avatarmanz/VIctory-7900XTX"] --> P["prex-xo fork"]
|
||||
X["xcl-dev/xcl (GPL-2.0)"] -.basedOn, per tracker.-> D["dependent forks"]
|
||||
AP["boykopovar/AnyPS5"] -.related.-> AR["realdody/americas-recomp (removed)"]
|
||||
```
|
||||
|
||||
Solid arrows from VIctory come from READMEs and the earlier audits; dotted ones from the tracker's `basedOn` and `related` fields. GitHub's own fork data links few of them.
|
||||
|
||||
## Maintainer decision
|
||||
|
||||
Keep the rules as they are and treat all of the above as documentation (recommended), or commission a per-file review of NativeX-Runtime if tiled-resource validation becomes a goal. Relaxing the provenance rules for the title-derived projects is not recommended.
|
||||
@@ -0,0 +1,29 @@
|
||||
# Security review of the hybrid path and native boundaries (2026-11-25)
|
||||
|
||||
Written by the author of the hybrid changes; not an independent review, and not a penetration test.
|
||||
|
||||
## A CrossOver bottle is not a security boundary
|
||||
|
||||
In the `betterxen-test` bottle, `Z:` maps to `/`, `Y:` to the user's home directory, and `D:` and `E:` to other mounted volumes, including raw device nodes in `dosdevices`. A Windows program run this way executes as the user, with the user's files and network. Removing drive letters would not make it a sandbox, because Wine is not designed to confine hostile code. **Process supervision (memory, time, output, signals) limits runaway behaviour only.** Run only programs you trust. Untrusted programs need a separate user account or a virtual machine, neither of which BetterXen provides.
|
||||
|
||||
## Findings
|
||||
|
||||
| Area | Finding | State |
|
||||
| --- | --- | --- |
|
||||
| Environment | The child inherited every host variable; a probe saw an arbitrary secret and `SSH_AUTH_SOCK` | **Fixed**: allowlist plus explicit `--env`; `DYLD_*` and backend variables refused; `--inherit-env` restores the old behaviour deliberately. Verified with a gate that fails when the variable is visible |
|
||||
| Filesystem | See above | Open by nature |
|
||||
| Command injection | The runner starts processes with argument vectors, no shell. Bottle names that are paths or options are refused; program paths starting with `-` are refused; arguments after `--` are passed through to the program | No injection found. CrossOver's `wine` launcher is a Perl script that was not reviewed |
|
||||
| Executable input | PE headers are parsed with bounds checks and tested with truncated and corrupted input. Not fuzzed. The file is launched by path after identification, so it can be swapped in between | Open |
|
||||
| Resource exhaustion | Free-memory floor, wall-clock and stall limits, 64 MiB output limit. No limit on CPU, GPU memory, disk writes by the guest or process count | Open |
|
||||
| Cleanup | SIGINT, SIGTERM, SIGHUP stop the process group and bottle; leftovers are recorded and killed | Verified on CrossOver. SIGKILL of the supervisor leaves the program running until `betterxen hybrid stop` |
|
||||
| Concurrency | Stopping a run stops every process in its bottle, including another run's. Memory sampling and leftover detection match by executable name | Open: one run per bottle |
|
||||
| Evidence files | Reports are created exclusively and never overwrite; records contain program paths, `--env` names (not values) and output tails, which may include whatever the program printed | Do not publish records unread |
|
||||
| Dependencies | 25 third-party packages across four lock files queried against OSV: no advisories on 2026-11-25. `cargo-deny` licence and source policy was not run | Point in time |
|
||||
| `unsafe` in the hybrid crate | Five sites: signal installation, `kill`, `killpg` (two) and a test; each has a safety comment | Reviewed by the author only |
|
||||
| FFI (`crates/ffi`) | Exports catch panics and check null pointers and sizes at the sites sampled. 71 of 91 `unsafe` blocks have no comment nearby (some rely on a function-level `# Safety` section). A panic while the global session lock is held poisons it, after which every call returns an internal error | Sampled, **not reviewed block by block**; native code is paused |
|
||||
| Translator and JIT (`loader`) | No nearby safety comment on any of the 16 blocks in `dbt.rs` or the 9 in `jit.rs` | **Not reviewed** |
|
||||
| Metal (`metal`) | All but one `unsafe` block carry a safety comment | Comments not verified |
|
||||
|
||||
## Not covered
|
||||
|
||||
CrossOver, Wine, Rosetta, D3DMetal and the graphics backends are closed or external and were not assessed. No fuzzing campaign was run in this review.
|
||||
@@ -0,0 +1,46 @@
|
||||
# Decision proposal: the victory-shader import (#394, #395, #399)
|
||||
|
||||
For the maintainer. Prepared 2026-11-25 from the provenance record in #394 (`d8c7a39`), the independent review on [#399](https://github.com/MacosPorters/betterxen/issues/399) and the pull-request reviews. It changes no branch and closes nothing. The author of this proposal also worked on the original import, so it is not an independent review. Not legal advice.
|
||||
|
||||
## The concerns, by kind
|
||||
|
||||
| Concern | Kind | State of evidence | Can engineering fix it? |
|
||||
| --- | --- | --- | --- |
|
||||
| "Game-specific, asset-specific and decryption-related code is never adopted"; handling written for one title is present (17 of 36 files mention it; the review dispositions all 36 upstream paths as exclude) | Repository policy | Recorded with file and line | No. Deleting the comments does not change how the code was developed |
|
||||
| "Never copy ... source from emulator projects built for leaked or unauthorized material" | Repository policy | The upstream project states that purpose | No |
|
||||
| Layouts "as observed in shipped titles", behaviour tuned to the title's programs | Third-party rights (possible) | Plausible, **not established**; no title binaries, assets or keys were found in the crate | Only by independent re-derivation |
|
||||
| `src/gfx10/opcodes.rs` carries Valve's MIT notice (Mesa-derived names) mixed with later edits | Third-party licence | Notice present; compatible with GPL-3.0-or-later | Yes: take names from AMD or re-audit Mesa directly |
|
||||
| Up to 26 authors on one file; permission relayed covers two maintainers' own lines | Provenance | `git blame`; other lines rest on the repository licence | Not for the origin question |
|
||||
| Whether apparently generic code originated independently | Provenance | **Unknown** | Only by a clean-room rewrite |
|
||||
| Static samplers dropped; wave f64 sum used native doubles; folded probe; test runner could run a stale binary | Technical correctness | Found in review and fixed on the branches | Done, but moot if the code is excluded |
|
||||
| Balanced-tree f64 sum order, wave64 behaviour, console equivalence | Technical correctness | **Unverified**; no console hardware | No |
|
||||
|
||||
Technical quality is not the blocker. The policy exclusions would remain if every test passed.
|
||||
|
||||
## What can be kept independently
|
||||
|
||||
| Item | Origin | Check made |
|
||||
| --- | --- | --- |
|
||||
| `workloads/d3d12-wave-probe/` (7 files) | BetterXen | Rated admissible by the #399 review, which also built and ran them on a second machine. Rebuilt here from `d8c7a39` with `-ld3d12 -ldxgi -ldxguid`, with no other file from the branch; no reference to the imported crate. The documented command is missing `-ldxguid` |
|
||||
| Probe findings: D3DMetal reports no double-precision shader support; shaders using `double` write nothing; wave width 32 | Observations | Reproduced by the #399 review on an M2 Pro |
|
||||
| `fixtures/rdna2/*` and their manifest expectations | BetterXen, already on `main` | Unaffected |
|
||||
| Idea of #395's runner: execute only the binary named by the build that just succeeded, with a stale-binary regression test | BetterXen script | Generic; no need until another cross-built test exists |
|
||||
| `betterxen.rs`, `betterxen_tests.rs` | BetterXen, but written against imported types | Review says exclude; keep the intent as notes |
|
||||
|
||||
## Is a clean-room replacement needed?
|
||||
|
||||
**Not for the active direction.** Authorized Windows programs under CrossOver bring ordinary DXBC or DXIL shaders, which CrossOver's backends already translate; the D3D11 and D3D12 workloads confirm that path for shader model 5.0. A console-code translator has no input in the hybrid path.
|
||||
|
||||
If one is ever wanted: derive encodings from AMD's public RDNA 2 documents and DXIL from Microsoft's public specification; have it written by someone who has not read the imported source (people and agents who vendored or reviewed it should not); and start from the existing native `crates/shader`, which already follows those rules and is paused.
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Effect | Cost |
|
||||
| --- | --- | --- |
|
||||
| **A. Exclude the import, keep the probes (recommended)** | New small PR with the seven probe files and the observations; #394 and #395 stay as closed-unmerged history or draft reference, branches kept; #397 is rewritten without the import; the registry and matrix record the decision | Small. No policy change |
|
||||
| B. Change the policy | Edit the engineering rules to permit this class of code, with legal review, then decide file by file | Weakens the rule that protects contributors and the project; the origin of much of the code stays unknown |
|
||||
| C. Leave undecided | #394, #395 and #397 stay blocked | Documentation keeps drifting |
|
||||
|
||||
## What to record if you choose A
|
||||
|
||||
> The victory-shader snapshot at `22b3f8e45a59` is not admitted (provenance review #399). It is a documentation-level reference only. The standalone BetterXen D3D12 probes are retained. No branch is deleted.
|
||||
@@ -0,0 +1,114 @@
|
||||
# Upstream integration audit (2026-11-25)
|
||||
|
||||
Companion to the [upstream registry](upstream-registry.md) and [component reuse matrix](component-reuse-matrix.md); those two hold the canonical rows, this file holds the audit evidence behind the new ones. Evidence class D unless stated: public repository metadata, file trees and files read through the GitHub API, plus one Apple license read as text. **No upstream script, installer, binary or build hook was executed and no upstream code was copied.** Not legal advice. CrossOver is **not installed** on the reference machine (Apple M4, 24 GB, macOS 27.0 build 26A428), so nothing below was validated against CrossOver.
|
||||
|
||||
## Contributor-reported progress (unverified)
|
||||
|
||||
skakwy (a BetterXen contributor) maintains [skakwy/victory-mac](https://github.com/skakwy/victory-mac) (GPL-3.0 per GitHub; head `main` pushed 2026-11-25). Reports received: about 1 frame per second with a commercial game, and later "two rendered frames". Both are contributor statements. No hardware, macOS or CrossOver version, workload, instrumentation or raw data has been shared, and the repository's own README gives only build and run commands. Treat both as **unverified**; neither is a compatibility claim. The repository describes itself as a fork of VIctory, a project whose purpose is a leaked Xbox Series build of a commercial game (see the registry), so it is a discovery reference at documentation level only. Information worth requesting from skakwy is listed under "Contributor request" below.
|
||||
|
||||
## Projects reviewed
|
||||
|
||||
Pins are the default-branch head or the commit read on 2026-11-25. "Equivalent" is what BetterXen has or lacks. Status values: **implemented** (code and tests on this branch), **reference** (read, nothing taken), **rejected**.
|
||||
|
||||
| Project | URL | Pin | Licence (file read where stated) | Verified facts | BetterXen equivalent | Provenance | Classification | Status |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| victory-mac | github.com/skakwy/victory-mac | not pinned (not reviewed past README and tree) | GPL-3.0 (GitHub) | Rust workspace with `mac/` build and run scripts for CrossOver, D3DMetal, Rosetta 2; README says "VIctory fork with a Mac build" | none needed | Built on a game-specific upstream whose inputs are unauthorized; file-level review not done | Technical reference only | reference |
|
||||
| VIctory-macOS | github.com/pragyaangaur/VIctory-macOS | see registry | GPL-3.0 (GitHub) | Described as an attempt to run one commercial game | none needed | Same concern | Rejected for reuse | rejected |
|
||||
| MacBox | github.com/aykhanium/MacBox | not pinned | **GPL-2.0** (GitHub) | README is candid: "not playable", "retail gameplay is unverified", test suite "known failures"; layers on XCL, an Xbox Series runtime for unpacked console executables | none | Game-specific; also **GPL-2.0-only is not combinable with GPL-3.0-or-later** (see decisions) | Rejected for reuse | rejected |
|
||||
| ScarlettMac | github.com/paveledits/ScarlettMac | not pinned | GPL-2.0 (GitHub); also `LICENSE-silicon-rans`, `SOURCE-NOTICES.md` | Patch set and shell scripts for XCL on CrossOver; README states game screenshots and a game-specific status | none | Game-specific; mixed licences | Rejected for reuse | rejected |
|
||||
| PortWatch VI | portwatch-vi.xyz | see registry | NOASSERTION | Editorial tracker | none | Not engineering evidence | Reference only | reference |
|
||||
| ossover | github.com/hemkum/ossover | `5c11bd7be8da` | GPL-3.0-or-later (README, `ATTRIBUTION.md` lists per-file adaptations from Whisky and highball) | Swift package: `SysInfo` (macOS, chip, memory, Rosetta probe), `Bench/MetalHUDLog` (parser for `metal-HUD:` log lines), `Bench/Harness`, `Store/EngineProbe`, `Renderer/CrossOverBottleConfig`, `doctor` command. README: alpha, one game verified on one machine, "no benchmark numbers have been published". Its design was derived from reverse engineering a CrossOver 26.3.0 bundle | Host receipt, frame statistics (this branch) | Clean, attribution explicit. Reverse-engineered CrossOver internals are **not** a supported interface | Technical reference; ideas re-implemented independently | reference |
|
||||
| Whisky | github.com/Whisky-App/Whisky | `fd5480a76b3e` | GPL-3.0-or-later (file header read: "version 3 ... or (at your option) any later version") | Archived 2025-05-11. `WhiskyKit`: bottle settings, Wine process control, PE parser, Rosetta 2 check | Rust host receipt covers the Rosetta check | Clear | Technical reference only (Swift; no reuse path) | reference |
|
||||
| rum | github.com/lunguini/rum | `657461b194e1` | GPL-3.0 (GitHub) | Active Whisky fork: DXMT/DXVK setup, run history, graphics settings views | none needed | Fork of Whisky | Technical reference only | reference |
|
||||
| Sikarugir | github.com/Sikarugir-App/Sikarugir | `5446b7d18072` | none reported | 23 files; hosts copies of Apple's Game Porting Toolkit documents (`D3DMetal/<ver>/License.pdf`) | none | Redistributes Apple documents; no licence of its own | Reference only; no reuse | reference |
|
||||
| Sikarugir-foss-sources | github.com/Sikarugir-App/Sikarugir-foss-sources | not reviewed | LGPL-2.1 (GitHub) | Fork of Wineskin sources | none | Unreviewed | Reference only | reference |
|
||||
| Mythic | github.com/MythicApp/Mythic | see registry | GPL-3.0 | Launcher using a custom GPTK implementation | none | Not reviewed | Reference only | reference |
|
||||
| DXMT | github.com/3Shain/dxmt | see registry | LGPL-2.1-or-later (LICENSE read by prior pass); GitHub shows NOASSERTION | D3D11/10 on Metal under Wine | Selected by CrossOver as a backend | Clear | External dependency (via CrossOver) | reference |
|
||||
| DXVK, VKD3D-Proton, MoltenVK | see registry | see registry | zlib, LGPL-2.1, Apache-2.0 | No change from registry | none | Clear | External (via CrossOver) | reference |
|
||||
| Gcenx macOS Wine builds | github.com/Gcenx/macOS_Wine_builds | `72f8915f2d01` | none reported | Community Wine packages | none | Binary provenance unreviewed | Reference only | reference |
|
||||
| llvm-mingw | github.com/mstorsjo/llvm-mingw | `903f4cf7faa2` | NOASSERTION per GitHub; LICENSE not yet read | ARM64-capable mingw toolchain | `toolchain` probe (this branch) finds it if installed | Clear | External dependency (candidate for #364) | reference |
|
||||
| Wine | github.com/wine-mirror/wine | see registry | LGPL-2.1 | Upstream of CrossOver's runtime | none | Clear | Reference | reference |
|
||||
| Apple Game Porting Toolkit licence | text of `D3DMetal/4.0/License.pdf`, copy hosted by Sikarugir | document read, 6 pages | Apple proprietary agreement | See next section | none | Third-party copy of an Apple document; the original download was not read | Proprietary; user-supplied only | reference |
|
||||
|
||||
## Apple Game Porting Toolkit licence (for #354)
|
||||
|
||||
Read from the 4.0 `License.pdf` copy in the Sikarugir repository (not from Apple's site; confirm against Apple's download before relying on it). Section 2A grants a limited, personal licence to install, internally use and test the software "for the sole purpose of developing, testing, or evaluating video games for use on Apple-branded products", and to distribute it "solely for non-commercial purposes". Section 2C forbids use on non-Apple hardware, says components may not be separated from the bundle except that the Framework and Redistributables may be distributed separately (still non-commercial only), and section 2D forbids reverse engineering. Consequence for BetterXen: D3DMetal stays a user-supplied external component and is never bundled or redistributed by this repository. Whether running unrelated Windows software through it fits "evaluating video games for use on Apple-branded products" is a question for a lawyer, not answered here.
|
||||
|
||||
## Decisions
|
||||
|
||||
1. **No external code was incorporated.** The useful general-purpose ideas (host receipt, frame statistics, toolchain probe) are small, and the closest implementations are Swift, so they were written independently in Rust from public system interfaces. ossover and Whisky are credited as technical references in this file; nothing is adapted.
|
||||
2. **GPL-2.0-only projects (MacBox, ScarlettMac) cannot be combined into this GPL-3.0-or-later workspace** regardless of provenance. Both are also game-specific.
|
||||
3. **Undocumented CrossOver internals are not a stable interface.** ossover reads `cxbottle.conf` and bundle internals derived from reverse engineering. The new CrossOver module reads only `Info.plist`, `lipo -archs` and the `defaults` keys CodeWeavers documents, and states so in its output.
|
||||
4. **The Metal HUD log parser in ossover was not ported.** Its line format (`metal-HUD: …`) is documented only by that project's observation; it was not verified against Apple documentation or a real trace here. Frame statistics therefore take plain intervals. A HUD parser can be added when a real trace is captured (#145).
|
||||
|
||||
## Implemented on this branch
|
||||
|
||||
New crate `crates/hybrid` (`betterxen-hybrid`, no third-party dependencies, native arm64 verified with `lipo -archs`: `arm64`).
|
||||
|
||||
| Command | Purpose | Issue | Validated |
|
||||
| --- | --- | --- | --- |
|
||||
| `host` | macOS version and build, chip, memory, core split, whether an x86_64 binary executes (Rosetta), GPU and Metal family from `system_profiler`, and the GPU wired-memory sysctls `iogpu.wired_limit_mb` and `iogpu.wired_lwm_mb` as raw integers (also written into every run record; read-only; `null` when a key is absent; Apple does not document what `0` means, so it is never interpreted) | #353, #386 | Run on the M4 reference machine; unit tests parse a GPU fixture and inject sysctl values. Apple M5, 32 GiB, macOS 27.2.1 (26B131) reported `0` and `0` for the two keys (2026-11-25), as did the M4 for `iogpu.wired_limit_mb` |
|
||||
| `crossover` | Finds `CrossOver.app` in standard locations and by Spotlight bundle identifier; reads version, build, executable architectures, minimum macOS, and the documented `BottleDir` and `ManagedBottleDirs` preferences | #350, #355 | Unit test on a **synthetic** bundle only. On the reference machine it reports `installed: false`. It has never inspected a real CrossOver |
|
||||
| `toolchain` | Lists mingw-w64 and llvm-mingw cross-compilers on `PATH` with version and target | #364 | Stub-compiler unit test; on the reference machine it found Homebrew `x86_64-w64-mingw32-gcc` 16.2.0 and `i686-w64-mingw32-gcc`. No ARM64 Windows target is installed. No program was compiled or run |
|
||||
| `frames <file>` | Frame-time statistics: mean, FPS, nearest-rank p50/p95/p99/p99.9, 1 % and 0.1 % lows, stutter count | #145 | Hand-derived known-answer tests, rejection of non-positive or non-finite intervals |
|
||||
| `receipt` | The above as one JSON document, `betterxen-hybrid-receipt/0` | #353 | Run once; no second contributor has reproduced it |
|
||||
|
||||
Not implemented: launching programs, bottle management, graphics-backend selection or detection, GPU or thermal sampling, a HUD parser, any rendering workload. None is justified yet by Phase 1 evidence.
|
||||
|
||||
## Contributor request (to send, not sent)
|
||||
|
||||
Ask skakwy only for shareable, general information: Mac model, macOS and CrossOver versions, how frame rate was measured and over what duration, whether the two frames were presented or merely rendered, and any general-purpose tooling and authorized test workloads he wrote himself. Do not ask for game files, traces or instructions for running the leaked build.
|
||||
|
||||
## Remaining blockers
|
||||
|
||||
CrossOver is not installed here, so criteria 2 and 6 of Phase 1 cannot progress on this machine; `docs/research/primary-source-verification-2026-11-25.md` lists documents still to read. The Rust toolchain default (`stable`, 1.94.1) is older than the workspace's 1.100; use `rustup run 1.100.0 cargo`.
|
||||
|
||||
## skakwy/victory-mac: component-level review (second pass)
|
||||
|
||||
skakwy, the repository's maintainer and a BetterXen contributor, authorized integrating his independently developed work. His permission cannot cover third-party material, and the repository's purpose fixes what most of it is. Reviewed: full history (302 commits, 65 by skakwy, 194 tracked files at `22b3f8e45a59`, `main` on 2026-11-25), every file he authored under `mac/` and `tools/macos/`, and the headers and authorship of the game-facing crates. Nothing was executed; the checkout stayed outside this repository with git hooks disabled.
|
||||
|
||||
### What the reported result is
|
||||
|
||||
From his own `mac/PROGRESS.md` and `mac/run-victory.sh` (his statements, unverified): the workload is an unpacked Xbox Series X dump of a commercial game, about 209 GB, run through VIctory under a CrossOver Preview bottle with Rosetta 2 and D3DMetal 4.0b2 on an Apple M3 Max with 36 GB and macOS 27.2.1. "About 1 fps" is 1 to 1.9 seconds per frame in the game world over a 17-minute run ("run 31, ~1.1 fps"), with 5,000 to 7,000 draws per frame and a GPU share of 0.15 to 0.5 s of each frame, taken from VIctory's own per-frame log line. So it is real presented frames from a program VIctory drives, measured by that program, on an input that BetterXen's rules forbid. It is **not** reproducible here, was not measured with independent instrumentation, and says nothing about authorized workloads. It does indicate, as an unverified observation, that a Rust-built Windows x86-64 program using D3D12 can reach D3DMetal under CrossOver on macOS 27. BetterXen has no evidence of that yet; the original D3D11 workload built on this branch is the authorized way to test it once CrossOver is installed.
|
||||
|
||||
### Component record
|
||||
|
||||
Original repository for every row: https://github.com/skakwy/victory-mac (GPL-3.0, file `LICENSE`). Author: skakwy unless stated. Permission: granted by skakwy through the maintainer, not recorded in the repository itself.
|
||||
|
||||
| Component | Source path (commit) | Provenance | Classification | BetterXen destination and method | Validation | Limits |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| Memory guard: do not start below N % free, stop a workload below M % | `mac/run-victory.sh` (`22b3f8e45a59`) | skakwy only; logic is general | **Integrated, adapted** | `crates/hybrid/src/memory.rs` and the `guard` command, reimplemented in Rust, SIGTERM then SIGKILL, unreadable memory is an error | 6 unit tests including a child stopped on a simulated drop; end-to-end runs of refuse, pass-through and stop; real `memory_pressure -Q` parsed on macOS 27.0 | Output format of `memory_pressure -Q` is not a documented stable interface; one machine |
|
||||
| Windows cross-link wrapper for the gnullvm target | `tools/macos/gnullvm-cc.sh` (`22b3f8e45a59`) | skakwy only | **Unnecessary here** | Evaluated; not functional with Homebrew `llvm@17`; superseded by llvm-mingw (see hybrid-toolchain.md). Awaiting clarification of the LLVM version he uses | Link failure reproduced | Not integrated |
|
||||
| Build wrapper for the victory exe | `mac/build.sh` | skakwy only | Unnecessary | Three lines around `cargo build`; `scripts/hybrid/build-windows-workloads.sh` replaces the idea | n/a | n/a |
|
||||
| CrossOver launch conventions: `bin/wine --bottle B --cx-app EXE run`, `wineserver -k`, prefix at `~/Library/Application Support/CrossOver/Bottles/B`, `CX_GRAPHICS_BACKEND` and `_VERSION` | `mac/run-victory.sh` | skakwy only; observations of "CrossOver Preview" | **Awaiting clarification** / reference | Recorded for #350 as undocumented third-party observations. Not coded: they are not documented interfaces. His note that backend version 3 gave a black screen and 4 worked is game-specific evidence | none | Undocumented; version unknown beyond "Preview" |
|
||||
| Rosetta observations: AVX masked stores and `vcvtps2ph` stores to write-watched memory hung on macOS 26, handled on 27; `ROSETTA_ADVERTISE_AVX` | `mac/PROGRESS.md`, `mac/run-victory.sh` | skakwy only | Reference | Hypotheses to test with an original workload; no code adopted | none | Unverified; tied to his loader |
|
||||
| Native helpers: `mach_vm_remap` aliases as a Wine unixlib (`valias`), Metal zero-copy swizzle | `mac/unixlib/*` | skakwy only; the swizzle credits UTM's d3dmetal-native | **Rejected** | The swizzle acts on D3DMetal internals; Apple's licence section 2D forbids reverse engineering and his notes give D3DMetal struct offsets (`+0x58`, `+0x28c`) found that way. The alias code serves game-memory copy-back | none | Awaiting clarification only for `valias` as a generic Wine unixlib example |
|
||||
| Instruction and shader scanner | `mac/scan/*` | skakwy only | **Rejected** | Parses the game's shader pack format and a Rosetta-unsafe instruction census of its image | none | Game-specific |
|
||||
| Game-specific loader patches: watchdog stepping, masked-store and MWAIT patching, BCPack placeholder fills | `crates/victory-loader/*`, `mac/PROGRESS.md` | skakwy and others | **Rejected** | Defeats a title's own self-protection and patches a leaked image; never adopted | none | n/a |
|
||||
| GPU layer, shader emitters, HLE (`victory-gpu`, `victory-shader`, `victory-hle`, `victory-loader`, `victory-core`) | skakwy commits `ea9da87` to `22b3f8e45a59` on top of Marvis, fxceless, Duff and others (about 260 inherited commits) | Mixed: inherited files carry other authors, and the content is console-game recompilation | **Rejected / requires provenance** | His share is real but inseparable from a runtime whose input is unauthorized; the console-shader work is also native-paused scope | none | File-level provenance would be needed for any future reuse |
|
||||
| Run notes (`mac/PROGRESS.md`, `mac/new_agent.md`) | same | skakwy only | Reference | Source of the context above; not copied | none | Contains game-specific detail, not republished |
|
||||
|
||||
Counts for this pass: 11 component groups reviewed; 1 integrated (adapted); 0 integrated verbatim; 3 reference or awaiting clarification; 2 unnecessary; 5 rejected (some groups overlap categories above).
|
||||
|
||||
### Other repositories, completed
|
||||
|
||||
- **VIctory-macOS** (`pragyaangaur/VIctory-macOS`, 215 files): a fork whose README describes running "the Xbox Series build" of one game; PortWatch calls the efforts it tracks builds of a "leaked Xbox Series build". Workflow files `fleet-*.yml` orchestrate an agent fleet, not build or test infrastructure of value here. Its README says it was built "with Claude on a free Claude Pro plan" and asks for sponsorship; irrelevant to reuse. Rejected, unchanged.
|
||||
- **PortWatch VI** (portwatch-vi.xyz): its own description says "leaked Xbox Series build of GTA VI". Reference for discovery only, unchanged.
|
||||
- **MacBox, ScarlettMac:** see above; unchanged.
|
||||
- **ossover CI** (`.github/workflows/ci.yml`): a macOS arm64 runner running `bash -n` over shell scripts, a standard-library Python manifest check with `python3 -I`, and `swift build`/`test`. The two cheap ideas (shell syntax check, isolated-interpreter script) match what `docs_hygiene.py` already does; a `bash -n` step for `scripts/hybrid/*.sh` is a candidate follow-up, not added.
|
||||
|
||||
### Per-file authorship of victory-mac (measured with `git blame` at `22b3f8e45a59`)
|
||||
|
||||
"Owned" means every line is attributed to skakwy. His permission covers these; it cannot cover lines written by others, and some owned files still carry other restrictions.
|
||||
|
||||
| File (lines, all his) | What it is | Decision |
|
||||
| --- | --- | --- |
|
||||
| `crates/victory-shader/src/emit/f64.rs` (409) | fp64 by 64-bit integer operations, with tests against the CPU's `f64` | General-purpose. Candidate for the native shader compiler; native work is paused, so it waits for a maintainer decision (#387) |
|
||||
| `mac/run-victory.sh` (139), `crates/victory-core/src/notes.rs` (135) | Run script with memory guard; stall bookkeeping | Memory guard adapted (`guard`); stall detection and settle adapted in #385; the rest is game-specific launch configuration |
|
||||
| `mac/unixlib/*`, `crates/victory-gpu/src/alias.rs` (369), `zerocopy.rs` (365), `crates/victory-hle/src/modules/vmem.rs` (208) | Alias mappings and a Metal swizzle over game memory | Not integrated: they act on D3DMetal internals and game memory (Apple's licence section 2D forbids reverse engineering; his notes give D3DMetal struct offsets) |
|
||||
| `crates/victory-loader/src/maskmov.rs` (830), `masked_stores.rs` (243) | Rewrites masked AVX stores in a console title's image for Rosetta | Not integrated: the header says it follows XCL's `maskmov.rs`, which is GPL-2.0-only (incompatible with GPL-3.0-or-later), and it patches a title image |
|
||||
| `crates/victory-gpu/src/ambient.rs` (193), `mac/scan/*` | Replaces one game's lighting output; scans its shader pack | Not integrated: game-specific |
|
||||
| `crates/victory-gpu/src/dxc.rs` (110) | Loads Microsoft's `dxcompiler.dll` to compile HLSL under Wine | General-purpose. Not needed yet: D3D12 minimal tests can use SM 5.1 through `d3dcompiler_47`. Revisit when a workload needs SM 6 |
|
||||
| `tools/macos/gnullvm-cc.sh`, `mac/build.sh` | Windows cross-link wrapper, build wrapper | Evaluated; failed with Homebrew `llvm@17`; superseded by llvm-mingw |
|
||||
|
||||
Everything else in the repository is mostly or entirely other authors' work (for example `victory-gpu/src/host.rs` is 8 % his, `victory-shader/src/emit/lower.rs` 1 %).
|
||||
@@ -0,0 +1,51 @@
|
||||
# Upstream research registry
|
||||
|
||||
Reviewed 2026-11-25. Every entry is **evidence class D** (non-normative official or project material) in the sense used by the issue templates and [claims.toml](../claims.toml): a review of public documentation and repository metadata. Nothing here was installed, built or run, so none of it is a statement that a project works for BetterXen's goals. Licenses are what the repository's own license file or GitHub's license detection reported; they still need the per-file check in the [reuse matrix](component-reuse-matrix.md) and are not legal advice. Pins are the default-branch head observed with `git ls-remote` on the review date. Independent re-derivation of this table is tracked in issue #363.
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Role for BetterXen | Findings |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| CrossOver (CodeWeavers) | [source page](https://www.codeweavers.com/crossover/source) | CrossOver 26.3.0 source listed | Proprietary product; page lists GPL/LGPL and other FOSS components it uses | Primary compatibility foundation (external install) | The page offers FOSS source for CrossOver 26.3.0 and lists Wine, Vkd3d, DXVK, MoltenVK, FAudio, SDL, LLVM, GMP and others. It says users should prefer each project's own home page. D3DMetal and Rosetta 2 are not in that list. What else is proprietary, the supported integration interfaces and redistribution terms are **unknown** (#348, #350, #354). |
|
||||
| Wine | [wine-mirror/wine](https://github.com/wine-mirror/wine) | `a79470449d03` | LGPL 2.1 (repository LICENSE and COPYING.LIB); GitHub reports NOASSERTION | Runtime APIs, via CrossOver | Upstream of CrossOver's runtime. CrossOver's exact delta from upstream is not reviewed. |
|
||||
| DXMT | [3Shain/dxmt](https://github.com/3Shain/dxmt) | `faa73e4a0686` | LGPL, version 2.1 or any later version (LICENSE text); copyright notice "for CodeWeavers" | Direct3D 11/10 to Metal under Wine; candidate backend | README: Metal-based D3D11/D3D10 layer for macOS using Wine. Status is on the project wiki (not reviewed). D3D12 is not claimed. |
|
||||
| DXVK | [doitsujin/dxvk](https://github.com/doitsujin/dxvk) | `57b2a7c1e87b` | zlib/libpng (LICENSE; GitHub: Zlib) | Direct3D to Vulkan; candidate backend only with MoltenVK | Listed among CrossOver's FOSS components. Whether it is used for any macOS path is unknown. |
|
||||
| VKD3D-Proton | [HansKristian-Work/vkd3d-proton](https://github.com/HansKristian-Work/vkd3d-proton) | `71cae091b065` | LGPL 2.1 (GitHub) | Direct3D 12 to Vulkan; candidate for evaluation | README requires Vulkan 1.3 and modern extensions. Whether MoltenVK exposes what it needs is **unknown**. CrossOver's page lists "Vkd3d" from source.winehq.org, which is the Wine vkd3d, not necessarily this fork. |
|
||||
| MoltenVK | [KhronosGroup/MoltenVK](https://github.com/KhronosGroup/MoltenVK) | `5189f8de86ec` | Apache-2.0 | Vulkan on Metal; candidate under DXVK/VKD3D-Proton | A Vulkan Portability layer, a subset of Vulkan. Listed among CrossOver's FOSS components. Last push observed 2026-10-13. |
|
||||
| FEX | [FEX-Emu/FEX](https://github.com/FEX-Emu/FEX) | `3ee25399232a` | MIT (GitHub) | x86/x86-64 emulation reference | README describes ARM64 **Linux**; tested distributions listed are Linux. No macOS host support is stated. Not a macOS option on this evidence; useful as design reference. |
|
||||
| VIctory | [Marvisak/VIctory](https://github.com/Marvisak/VIctory) | `13f91caee25f` | GPL-3.0 (GitHub); a prior local review found per-file notices (see `experiments/victory-native/licenses.md`, local, untracked) | Discovery reference only | Described as an attempt at running one commercial game on PC. Its inputs are an Xbox Series build of that game. PortWatch describes the efforts it tracks as targeting a "leaked Xbox Series build". |
|
||||
| VIctory-macOS | [pragyaangaur/VIctory-macOS](https://github.com/pragyaangaur/VIctory-macOS) | `485b230ef596` | GPL-3.0 (GitHub) | Discovery reference only | A macOS port of VIctory using Rosetta, CrossOver Wine and D3DMetal per its README (also noted in [portwatch-native-macos.md](portwatch-native-macos.md)). Same input concern. Its test and "works" claims are self-reported and not verified here. The repository has no parent fork, so the "canonical upstream" is VIctory. |
|
||||
| PortWatch VI | [portwatch-vi.xyz](https://portwatch-vi.xyz/), [4lwayz/portwatch-vi](https://github.com/4lwayz/portwatch-vi) | `ed00263cc0c9` | NOASSERTION | Project discovery reference | A tracker of community efforts; progress figures are editorial, with self-reported claims labelled. Not engineering evidence; flagged and ignored queues are not endorsed. |
|
||||
|
||||
## Additional candidates found by search (not reviewed)
|
||||
|
||||
Found by GitHub search on 2026-11-25. Only repository metadata was read; none was evaluated, installed or run, and none is a recommendation. Licenses are what GitHub reported.
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Why listed |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| llvm-mingw | [mstorsjo/llvm-mingw](https://github.com/mstorsjo/llvm-mingw) | `903f4cf7faa2` | GitHub: other (read LICENSE before use) | Cross-compiler candidate for building original Windows test programs (#364). README says its compilers come in x86_64 and aarch64 builds, built on Ubuntu; availability and behaviour on a macOS host are **unknown**. |
|
||||
| Sikarugir | [Sikarugir-App/Sikarugir](https://github.com/Sikarugir-App/Sikarugir) | `5446b7d18072` | not reported | Wine-wrapper project (successor to Wineskin per its README, macOS 14.6+): a reference for bottle and wrapper management. |
|
||||
| macOS Wine builds | [Gcenx/macOS_Wine_builds](https://github.com/Gcenx/macOS_Wine_builds) | `72f8915f2d01` | not reported | Community Wine builds for macOS: possible Wine reference builds. Provenance of the binaries is unreviewed. |
|
||||
| Mythic | [MythicApp/Mythic](https://github.com/MythicApp/Mythic) | `754223978e61` | GPL-3.0 | Open-source macOS launcher that runs Windows games through Wine: an architecture reference for configuration and launching. |
|
||||
| Playdock | [Jasonilization/Playdock](https://github.com/Jasonilization/Playdock) | `f58b8ef7fb70` | MIT | Describes itself as a free alternative to CrossOver; unreviewed. |
|
||||
|
||||
## Reviewed in the integration audit (2026-11-25)
|
||||
|
||||
Source read through the GitHub API; nothing executed. Detail and decisions are in [upstream-integration-audit.md](upstream-integration-audit.md).
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Role for BetterXen | Findings |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| victory-mac | [skakwy/victory-mac](https://github.com/skakwy/victory-mac) | `22b3f8e45a59` | GPL-3.0 (LICENSE file read) | Per-component review with contributor permission; one memory-guard idea adapted | The maintainer authorized integration of his own work. His runtime targets a leaked console-game dump, so game-facing code is not adopted. Component table in [upstream-integration-audit.md](upstream-integration-audit.md). Reported frame rates are his unverified statements. |
|
||||
| llvm-mingw | [mstorsjo/llvm-mingw](https://github.com/mstorsjo/llvm-mingw) | release `20261117` | Apache-2.0 with LLVM exceptions plus component licences (LICENSE.TXT; not audited line by line) | External build tool for #364 | Digest verified, used to build original workloads for x86-64 and ARM64; see [hybrid-toolchain.md](hybrid-toolchain.md). |
|
||||
| MacBox | [aykhanium/MacBox](https://github.com/aykhanium/MacBox) | not pinned | GPL-2.0 (GitHub) | Rejected for reuse | Game-specific XCL layer; GPL-2.0-only is not combinable with GPL-3.0-or-later. Its README states gameplay is unverified. |
|
||||
| ScarlettMac | [paveledits/ScarlettMac](https://github.com/paveledits/ScarlettMac) | not pinned | GPL-2.0 (GitHub), extra licence files | Rejected for reuse | Game-specific patches and scripts. |
|
||||
| ossover | [hemkum/ossover](https://github.com/hemkum/ossover) | `5c11bd7be8da` | GPL-3.0-or-later (README, attribution file) | Technical reference | Swift CLI with system-info, Metal HUD log parsing and benchmark harness. Uses reverse-engineered CrossOver internals, which BetterXen does not treat as an interface. |
|
||||
| Whisky | [Whisky-App/Whisky](https://github.com/Whisky-App/Whisky) | `fd5480a76b3e` | GPL-3.0-or-later (file header read) | Technical reference | Archived 2025-05-11. |
|
||||
| rum | [lunguini/rum](https://github.com/lunguini/rum) | `657461b194e1` | GPL-3.0 (GitHub) | Technical reference | Active Whisky fork. |
|
||||
| Game Porting Toolkit licence | copy of `D3DMetal/4.0/License.pdf` in Sikarugir | read | Apple proprietary | User-supplied only | Non-commercial distribution, evaluation purpose, no reverse engineering. See audit file. |
|
||||
|
||||
## Not yet researched
|
||||
|
||||
Apple's Game Porting Toolkit documentation and license (D3DMetal's actual terms), Rosetta 2's support lifetime, CrossOver's documented command-line interfaces and bottle management, and other established projects. These are issues #349, #350 and #354; nothing is claimed about them here.
|
||||
|
||||
## Provenance decision
|
||||
|
||||
VIctory-family projects are not adopted. Their GPL grants apply to their own source; they do not establish that the material they were built for is authorized. The registry records them for architecture ideas visible in public documentation (cache identity, upload visibility, test structure). No code, shader corpus, asset or tooling from them enters BetterXen without a recorded per-file review, and anything game-specific or decryption-related is excluded.
|
||||
@@ -0,0 +1,96 @@
|
||||
# BetterXen roadmap
|
||||
|
||||
**This is the single authoritative active roadmap.** GitHub Issues hold the current phase's tasks, the open milestone names the current phase, and this file explains strategy, phase order, parked work and completion criteria. If another document disagrees, this one governs, except [ADR 0005](adr/0005-crossover-hybrid-direction.md) for the decision itself.
|
||||
|
||||
## Direction
|
||||
|
||||
BetterXen's active direction is a **CrossOver-based hybrid architecture for Apple Silicon**. CrossOver is the intended compatibility foundation and is an **externally installed dependency**, never bundled or redistributed. BetterXen's own work is the layer around it: integration, configuration, diagnostics, reproducible testing, benchmarking and measured optimization. The independent native implementation (x86-64 decoder, ARM64 translator, runtime, gfx1030 shader compiler, Metal backend) is **preserved but paused**; see the [native roadmap](research/native-roadmap.md) and the [native issue archive](research/native-issue-archive.md).
|
||||
|
||||
This is the intended architecture, **not a verified Xbox compatibility stack**. Nothing in this repository demonstrates that CrossOver, Rosetta 2 or D3DMetal run any Xbox title, and CrossOver is not assumed to provide Xbox runtime compatibility. All workloads must be independently authored, publicly licensed or otherwise authorized.
|
||||
|
||||
```
|
||||
BetterXen: integration, configuration, diagnostics, benchmarking, optimization
|
||||
|
|
||||
CrossOver (external): Wine-based runtime APIs | Rosetta 2 CPU translation | D3DMetal / DXMT graphics
|
||||
|
|
||||
Apple Silicon: ARM64, Metal, unified memory
|
||||
```
|
||||
|
||||
Priorities, in order: practical compatibility, functional integrated execution, rendering correctness, stability, performance, Apple Silicon-specific optimization, long-term independence. Reuse before reinvention; measure before optimizing; evidence before claims.
|
||||
|
||||
## Rolling planning
|
||||
|
||||
Only the current phase has a GitHub milestone and detailed issues. Later phases are described below and become milestones and issues only when the evidence from the current phase makes their requirements clear. Work that was specified early but depends on unverified assumptions is listed under [Parked ideas](#parked-ideas) with its closed issue, so it can be reopened rather than rewritten. Phase numbers are provisional. The earlier eight-phase plan (H0 to H7) is archived in [archive/hybrid-phases-h0-h7.md](archive/hybrid-phases-h0-h7.md).
|
||||
|
||||
## Engineering rules
|
||||
|
||||
[AGENTS.md](../AGENTS.md) (`CLAUDE.md` is a symlink to it) was rewritten to permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal subject to licensing; ADR 0005 records the decision. The honesty, verification, provenance and clean-room rules are unchanged. Both are on the local branch `planning/hybrid-first-transition` and await maintainer review; nothing has been pushed.
|
||||
|
||||
## How progress is reported
|
||||
|
||||
Phase status is one of: Not started, Researching, In development, Blocked, In validation, Verified complete, Retired. A phase is Verified complete only with the evidence its completion criteria name. Progress is not derived from commits, lines of code, closed issues, instruction counts or passing isolated fixtures. No phase is currently Verified complete.
|
||||
|
||||
## Phase 1 — CrossOver Research, Feasibility and Baseline (active)
|
||||
|
||||
**Status:** Researching. **Milestone:** `Phase 1 - CrossOver Research, Feasibility and Baseline`.
|
||||
|
||||
**Objective:** Establish what the installed CrossOver version actually provides, which interfaces are supported, what may be reused or redistributed, and a reproducible baseline on authorized workloads.
|
||||
|
||||
**Completion criteria** (all required, each with recorded evidence):
|
||||
|
||||
1. CrossOver architecture, platform support, CPU translation and graphics backends documented from primary sources, with unknowns listed ([#348](https://github.com/MacosPorters/betterxen/issues/348)).
|
||||
2. Supported integration interfaces separated from undocumented behavior ([#350](https://github.com/MacosPorters/betterxen/issues/350)).
|
||||
3. Licensing and redistribution boundaries documented ([#354](https://github.com/MacosPorters/betterxen/issues/354)); the registry independently re-derived ([#363](https://github.com/MacosPorters/betterxen/issues/363)).
|
||||
4. A reproducible way to build original Windows test programs ([#364](https://github.com/MacosPorters/betterxen/issues/364)) and original graphics workloads with self-verifying output ([#365](https://github.com/MacosPorters/betterxen/issues/365)).
|
||||
5. Workload set, measurement protocol and host receipt defined ([#353](https://github.com/MacosPorters/betterxen/issues/353)) and a frame-time capture method ([#145](https://github.com/MacosPorters/betterxen/issues/145)).
|
||||
6. A reproducible CrossOver environment and a recorded baseline of CPU, GPU, memory and stability, reproduced by a second contributor ([#355](https://github.com/MacosPorters/betterxen/issues/355)).
|
||||
7. BetterXen's responsibilities versus CrossOver's recorded in an ADR a maintainer accepts ([#351](https://github.com/MacosPorters/betterxen/issues/351)).
|
||||
|
||||
**Open issues:** #145, #348, #350, #351, #353, #354, #355, #363, #364, #365, plus #346 (project board, needs the GitHub `project` token scope; does not block engineering).
|
||||
|
||||
**Known risks:** CrossOver is proprietary, so bundling or modifying may be prohibited; integration interfaces may be undocumented (see below); Xbox titles may not run at all.
|
||||
|
||||
### Critical path
|
||||
|
||||
1. Desk research needs nothing installed and can start now: #348, #350, #354, #364 (build only), #353.
|
||||
2. #363 re-derives the registry independently of its author.
|
||||
3. #365 needs #364 and #353.
|
||||
4. #355 needs #364, #353 and the interface findings of #350.
|
||||
5. #351 needs #348, #350, #354 and #355.
|
||||
|
||||
Hard dependencies are recorded as GitHub blocked-by relationships; everything else is preferred order.
|
||||
|
||||
### Verified and unverified (2026-11-25)
|
||||
|
||||
Details and sources are in [primary-source-verification-2026-11-25.md](research/primary-source-verification-2026-11-25.md). In short: CodeWeavers' public documentation names the backends Auto, D3DMetal, DXMT, DXVK and Wine, but **`CX_GRAPHICS_BACKEND` and `cxbottle.conf` are not documented there and must not be treated as a supported interface** until #350 resolves it. Apple's two September 2026 developer news items about Rosetta disagree with each other. D3DMetal's license text was not located; it stays user-supplied and unbundled.
|
||||
|
||||
## Provisional later phases (no milestone yet)
|
||||
|
||||
| Phase | Purpose | Starts when |
|
||||
| --- | --- | --- |
|
||||
| 2. Integration foundation | Only the tooling Phase 1 shows is missing: environment inspection, workload runner and run records, output-path policy | Phase 1 criteria 2 and 6 are met |
|
||||
| 3. Compatibility validation | Run authorized workloads and upstream conformance tests, record reproducible failures | A runner exists and a baseline is recorded |
|
||||
| 4. Graphics and performance | Backend comparison and measured bottleneck work; no improvement promised before measurement | Phase 3 shows what to measure |
|
||||
| 5. Stability and maturity | Soak, memory pressure, thermals, version matrices, dependency maintenance, upstream contributions | Phase 4 results exist |
|
||||
|
||||
Independent native reassessment is separate and deferred: it needs an explicit maintainer decision.
|
||||
|
||||
## Parked ideas
|
||||
|
||||
Specified in detail on 2026-11-25, then closed as premature for Phase 1 with the text preserved. Reopen when the stated prerequisite is met. Parking is not rejection.
|
||||
|
||||
| Issue | Subject | Reopen when |
|
||||
| --- | --- | --- |
|
||||
| [#366](https://github.com/MacosPorters/betterxen/issues/366) | Read-only CrossOver inspection command | The #353 receipt script proves insufficient |
|
||||
| [#367](https://github.com/MacosPorters/betterxen/issues/367) (absorbs #368) | Workload runner and run records | Phase 1 finds #350 supports scripted launches (Phase 2) |
|
||||
| [#257](https://github.com/MacosPorters/betterxen/issues/257) | Output-path policy for exports and caches | A tool that writes exports exists (Phase 2) |
|
||||
| [#369](https://github.com/MacosPorters/betterxen/issues/369) | Upstream Wine conformance subset in a bottle | Runner and baseline exist (Phase 3) |
|
||||
| [#370](https://github.com/MacosPorters/betterxen/issues/370) | Backend comparison on equal workloads | Baseline and workloads exist (Phase 4) |
|
||||
| [#371](https://github.com/MacosPorters/betterxen/issues/371), [#372](https://github.com/MacosPorters/betterxen/issues/372) | Shader-compile latency; Metal System Trace recipe | Baseline names a bottleneck (Phase 4) |
|
||||
| [#373](https://github.com/MacosPorters/betterxen/issues/373), [#204](https://github.com/MacosPorters/betterxen/issues/204) | Soak and thermal drift; memory-pressure benchmark | Workloads and baseline exist (Phase 5) |
|
||||
| [#374](https://github.com/MacosPorters/betterxen/issues/374) | Re-baseline on a Rosetta-free CrossOver build | Such a build ships (Phase 5); facts folded into #348 |
|
||||
| #173, #174, #219 | Contributor-workflow administration | A concrete need appears |
|
||||
|
||||
## Native work
|
||||
|
||||
About 110 native issues were consolidated. All are closed with their text, comments and attribution intact except four with an assignee and an open pull request (#247, #291, #307, #313), which stay open until their authors decide. See the [native issue archive](research/native-issue-archive.md). Source code, tests, benchmarks and history are untouched.
|
||||
@@ -0,0 +1,262 @@
|
||||
# Hybrid workloads and measurement protocol
|
||||
|
||||
This is the Phase 1 protocol for [issue #353](https://github.com/MacosPorters/betterxen/issues/353).
|
||||
It defines workload selection, measurement boundaries and the evidence a contributor
|
||||
must retain for the [CrossOver baseline task](https://github.com/MacosPorters/betterxen/issues/355).
|
||||
It adds no runner and reports no new Windows or GPU execution results.
|
||||
|
||||
## Implementation checkpoint
|
||||
|
||||
The commands below refer to [PR #384](https://github.com/MacosPorters/betterxen/pull/384),
|
||||
reviewed at commit `566272082a74d8b45fcec37edd00f4f6703df3ab` on 2026-11-25.
|
||||
Its `betterxen-hybrid` command, build script and Windows workloads are not on
|
||||
`main` at this document's base revision. Use a separate checkout of that exact
|
||||
candidate to review the recipe; after it merges, record the actual merged SHA
|
||||
and recheck the command options. A missing command is an unavailable prerequisite.
|
||||
Do not substitute the preserved native benchmark suite for a CrossOver run.
|
||||
|
||||
The implementation links in this document are pinned to that candidate. They
|
||||
describe source inspection, not independent acceptance of the author's recorded
|
||||
M4 results. Those results remain in the candidate's
|
||||
[baseline record](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/docs/research/crossover-baseline-2026-11-25.md).
|
||||
Use the [roadmap](../roadmap.md) for phase completion and
|
||||
[benchmark protocol](benchmarks.md) for the existing native benchmark's separate scope.
|
||||
|
||||
## Selected workloads and provenance
|
||||
|
||||
All four initial workloads are original BetterXen source. Each source below has
|
||||
an `SPDX-License-Identifier: GPL-3.0-or-later` header at the pinned revision.
|
||||
Use the repository [license](../../LICENSE); no external test source, shader,
|
||||
texture, game binary or asset is added by this selection. The C programs use
|
||||
external mingw-w64 headers; the Rust program uses the Rust standard library.
|
||||
Those build dependencies retain their own terms and are not relicensed by the
|
||||
workload headers. The build's exact dependency review belongs to
|
||||
[#364](https://github.com/MacosPorters/betterxen/issues/364) and
|
||||
[#354](https://github.com/MacosPorters/betterxen/issues/354).
|
||||
|
||||
| Workload and source at the candidate | Purpose and expected result | Limits |
|
||||
| --- | --- | --- |
|
||||
| [C self-check](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/workloads/win-selfcheck-c/selfcheck.c) | CRC-32 of `123456789` is `0xCBF43926`; four threads increment a shared counter to 400,000; stdout ends in `PASS`, exit 0. | CPU/runtime smoke check; no GPU work. The thread wait result is not checked separately. |
|
||||
| [Rust self-check](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/workloads/win-selfcheck-rust/src/main.rs) | Four thread-local counters give 1,000, 2,000, 3,000 and 4,000; their total is 10,000; the main thread's counter stays zero; `PASS`, exit 0. | One small threads/TLS case, not general Wine conformance. TLS means thread-local storage. |
|
||||
| [Direct3D 11 clear](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/workloads/d3d11-clear/d3d11_clear.c) | Clear a 64×64 RGBA8 target, read all 4,096 pixels, `PASS`, exit 0. Each channel must be within 0.6 of `(0.25, 0.5, 0.75, 1) × 255`; ideal bytes are `(64,128,191,255)`. | The specified conversion tolerance permits green 127 or 128. No shader, texture sampling or presentation. |
|
||||
| [Direct3D 11 indexed triangle/frame loop](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/workloads/d3d11-frameloop/frameloop.c) | A 640×360 target, one indexed triangle, vertex/pixel shaders and an event-query wait per iteration. First-frame readback checks corner `(0,0,0,255)` and centre `(51,102,204,255)` within the source's tolerance; `PASS frames=N`, exit 0. | Only two pixels of the first frame are checked. HLSL is compiled at runtime with `D3DCompile`, a deviation from #365's requested build-time compilation. No window, swapchain or presented frames. |
|
||||
|
||||
For both graphics programs, `--negative-control` deliberately changes the
|
||||
expected colour: require a mismatch and exit 1, not a missing-device result.
|
||||
Exit 2 with `NO DEVICE` is unsupported/unavailable graphics, never a pass; exit 3
|
||||
is an API failure. Re-derive pixel expectations from geometry and Microsoft's
|
||||
[data conversion rules](https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion)
|
||||
before accepting the output. Do not change tolerances after seeing a failure.
|
||||
|
||||
The x86-64 Windows PE builds are the initial execution set. ARM64 Windows builds
|
||||
are a separate admission experiment: record what the installed runtime does,
|
||||
including refusal, without treating it as x86-64 success or assuming every
|
||||
CrossOver release behaves alike. PE denotes Portable Executable, the Windows
|
||||
executable format; it is guest input, not the host executable architecture.
|
||||
|
||||
Texture sampling and compute workloads are still required by
|
||||
[#365](https://github.com/MacosPorters/betterxen/issues/365). Depth, presentation,
|
||||
Direct3D 12 and upstream Wine conformance runs are not established by these four
|
||||
programs. External test candidates need an exact revision and per-file license
|
||||
review before admission; none is selected here.
|
||||
|
||||
## Preparation and correctness run
|
||||
|
||||
Use an Apple Silicon Mac and record its actual chip and memory. The initial
|
||||
reference is an M4 with 24 GiB; another configuration is another observation,
|
||||
not a replacement for that host's acceptance. CrossOver and any required Rosetta
|
||||
installation must already be supplied by the contributor under their own terms.
|
||||
Nothing in this protocol installs, bundles or activates proprietary software.
|
||||
|
||||
1. Record the full candidate SHA, dirty state, Rust/compiler versions, build
|
||||
flags and target. Use native ARM64 host tools; retain `file`, `lipo -archs`
|
||||
and `otool -L` evidence for the tools and executable actually used. A universal
|
||||
tool's ARM64 slice and its Windows output target are different facts.
|
||||
2. Verify the llvm-mingw archive version and checksum against the pinned
|
||||
[toolchain note](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/docs/research/hybrid-toolchain.md).
|
||||
At this checkpoint the build script accepts an unpacked directory and does
|
||||
not enforce the pin. Rebuild twice, retain output hashes and report any
|
||||
directory-dependent differences; do not claim reproducibility from one build.
|
||||
3. Create a disposable, dedicated bottle through CrossOver's UI. Record its
|
||||
template, configuration and name locally. Keep unrelated programs out of it:
|
||||
stopping the runtime can stop every process in that bottle.
|
||||
4. Keep raw evidence under ignored `artifacts/`. Use a new directory per attempt;
|
||||
the candidate overwrites `bench.json` and names individual run JSON by seconds.
|
||||
Record setup, correctness and timing as separate attempts.
|
||||
|
||||
In the checkout containing the candidate implementation, with `LLVM_MINGW_DIR`
|
||||
set to the already verified toolchain directory:
|
||||
|
||||
```sh
|
||||
test -f crates/hybrid/Cargo.toml || exit 1
|
||||
: "${LLVM_MINGW_DIR:?Set the verified llvm-mingw directory}"
|
||||
export CARGO_BUILD_JOBS=2
|
||||
cargo +1.100.0 build --locked --release --target aarch64-apple-darwin -p betterxen-hybrid
|
||||
B=target/aarch64-apple-darwin/release/betterxen-hybrid
|
||||
OUT=artifacts/hybrid-protocol/correctness-01
|
||||
mkdir -p "$OUT"
|
||||
git rev-parse HEAD > "$OUT/candidate.txt"
|
||||
git status --porcelain > "$OUT/dirty.txt"
|
||||
"$B" receipt > "$OUT/receipt.json"
|
||||
scripts/hybrid/build-windows-workloads.sh "$LLVM_MINGW_DIR"
|
||||
shasum -a 256 artifacts/hybrid-workloads/x86_64/*.exe > "$OUT/workload-sha256.txt"
|
||||
|
||||
for p in selfcheck-c selfcheck-rust d3d11-clear d3d11-frameloop; do
|
||||
"$B" run --bottle betterxen-protocol --timeout 60 --expect PASS \
|
||||
--out "$OUT/$p" -- "$PWD/artifacts/hybrid-workloads/x86_64/$p.exe" \
|
||||
> "$OUT/$p.json" || exit 1
|
||||
done
|
||||
|
||||
"$B" run --bottle betterxen-protocol --timeout 60 \
|
||||
--out "$OUT/clear-negative" -- \
|
||||
"$PWD/artifacts/hybrid-workloads/x86_64/d3d11-clear.exe" --negative-control \
|
||||
> "$OUT/clear-negative.json"
|
||||
```
|
||||
|
||||
Create the bottle `betterxen-protocol` before this recipe. For the last command,
|
||||
require runner exit 1 **and** JSON `classification: failed_exit_1`, workload
|
||||
`exit_code: 1` and the pixel-mismatch diagnostic. Also run the triangle negative
|
||||
control with the same option. A runner error, timeout or `no_graphics_device`
|
||||
does not satisfy a negative control. The positive runs need their expected
|
||||
checks, not just a zero supervisor exit or the substring `PASS`.
|
||||
|
||||
At the pinned checkpoint, #384's stop path can leave a workload running because
|
||||
it selects the bottle incorrectly for `wineserver -k`. The correction is in
|
||||
[PR #388](https://github.com/MacosPorters/betterxen/pull/388); inspect the actual
|
||||
revision under test rather than assuming the correction merged. After any timeout
|
||||
or low-memory stop, stop the dedicated bottle in CrossOver and confirm the workload
|
||||
is gone before another run. A classification alone is not proof of cleanup.
|
||||
|
||||
## Receipt and run-record sources
|
||||
|
||||
`receipt` emits `betterxen-hybrid-receipt/0` with `host`, `crossover` and
|
||||
`windows_cross_compilers`. A `run` record (`betterxen-hybrid-run/0`) does **not**
|
||||
embed that host receipt at the pinned revision; keep the sibling `receipt.json`
|
||||
with each attempt. `bench` embeds `host` once. Supplement these records with
|
||||
candidate/workload hashes, build options, source commands and measurement settings;
|
||||
they are not all emitted by the current tool. Do not invent an implemented schema.
|
||||
|
||||
| Fact | Source at this checkpoint | Interpretation and missing data |
|
||||
| --- | --- | --- |
|
||||
| macOS version/build | `sw_vers -productVersion`; `sysctl -n kern.osversion` | Retain both; a marketing version alone is insufficient. |
|
||||
| Chip, memory and CPUs | `sysctl -n machdep.cpu.brand_string`, `hw.memsize`, `hw.logicalcpu`, `hw.perflevel0.physicalcpu`, `hw.perflevel1.physicalcpu` | Bytes for memory; failed or absent keys are unknown. Preserve raw perflevel values; their P/E labels are the collector's interpretation. |
|
||||
| Collector architecture and Rosetta execution probe | `receipt_binary_arch` comes from Rust's build target; `arch -x86_64 /usr/bin/true` supplies `rosetta_executes_x86_64` | The latter deliberately executes a system binary's Intel slice. Failure does not distinguish absence from disabled/unusable translation; it does not establish the Wine process's architecture. |
|
||||
| GPU and Metal description | `system_profiler SPDisplaysDataType -json`, first matching `sppci_model`, `sppci_cores`, `spdisplays_mtlgpufamilysupport` | Inventory strings, not runtime `MTLDevice` capability queries or execution proof. Capability queries not collected are unknown. |
|
||||
| CrossOver build and bundle architecture | `Contents/Info.plist` via `plutil`; `lipo -archs` on `Contents/MacOS/<CFBundleExecutable>` | Record the selected installation; the GUI executable's slices do not establish `wineloader`/`wineserver` architecture. Multiple installations need explicit reconciliation with the runner's first-discovered selection. |
|
||||
| Bottle search/preferences | `defaults read com.codeweavers.CrossOver BottleDir` and `ManagedBottleDirs`; candidate locations and `mdfind` | Unset/unreadable preferences are not proof of no bottles or no installation. |
|
||||
| Windows compiler identity | Resolved compiler path, `--version`, `-dumpmachine`; retain archive hash separately | Inspect native executables before running them. The receipt's probe does not establish the archive pin or inspect every helper. |
|
||||
| Requested/detected backend | CLI selection and `CX_GRAPHICS_BACKEND`; stdout/stderr banners or adapter-name heuristic in `run.rs` | The variable is undocumented for macOS in the reviewed sources (#350). Preserve `unknown` and `inferred` labels; `default` is not proof of a particular backend. |
|
||||
| Run outcome and lifetime | Child status/output; supervisor monotonic clock from spawn through completion/stop | Require correctness diagnostics and expected exit as well as classification. `duration_ms` includes startup and workload time, not isolated startup latency. |
|
||||
|
||||
Field definitions come from the candidate's
|
||||
[host collector](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/crates/hybrid/src/host.rs),
|
||||
[CrossOver discovery](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/crates/hybrid/src/crossover.rs),
|
||||
[CLI](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/crates/hybrid/src/main.rs)
|
||||
and [runner](https://github.com/MacosPorters/betterxen/blob/566272082a74d8b45fcec37edd00f4f6703df3ab/crates/hybrid/src/run.rs).
|
||||
This describes their implementation, not a guarantee that every probe works on
|
||||
every macOS version. Preserve JSON `null` and explain absent fields as unknown;
|
||||
never replace them with zero or a nearby machine's values.
|
||||
|
||||
## Metric definitions and collection limits
|
||||
|
||||
| Metric | Definition / collection | Required qualification |
|
||||
| --- | --- | --- |
|
||||
| Average rate and frame-time percentiles | Positive finite intervals `t[i]` in milliseconds; rate = `1000 × n / sum(t)`. Sort intervals; percentile p is rank `ceil(p × n / 100)`, one-based. Report n, p50, p95, p99, p99.9 and maximum. | The hybrid analyzer uses nearest rank; the preserved native startup benchmark uses interpolation. Do not combine them. Report sample count; a small sample's p99.9 can be its maximum. |
|
||||
| 1% and 0.1% lows | `1000/p99_ms` and `1000/p99.9_ms`, respectively. | These are reciprocal percentiles, not averages of the slowest 1% or 0.1%. Keep that definition in reports. |
|
||||
| Stutters | Count intervals strictly greater than twice p50. | A protocol convention, not a universal perceptual threshold. Intervals equal to twice p50 do not count. |
|
||||
| CPU | Sample `/bin/ps -axo rss=,pcpu=,command=`; sum matched CrossOver/bottle processes and average the samples. | Percent of one core, can exceed 100%. Path matching is heuristic and can include unrelated CrossOver processes. This is not CPU time divided by the run's wall time. Zero samples means unavailable, not zero usage. |
|
||||
| Unified memory / memory pressure | `memory_pressure -Q` free-percentage line; retain starting and minimum observed percent plus poll interval. `ps` provides sampled peak summed resident set size (RSS, KB). | The free-percentage text format is observed, not a stable documented API. System free percentage and process RSS are not total unified/GPU allocation. RSS can double-count shared pages; failed `ps` currently also yields zeros, so do not accept those as measured zero. |
|
||||
| GPU utilization | Not collected by the candidate. | Unknown; do not infer it from FPS, RSS or elapsed time. A future collector must name its source and overhead. |
|
||||
| Startup and shader compilation | Current `duration_ms` covers the whole supervised process. D3D11 HLSL compilation occurs before the loop. | Separate spawn-to-first-result and compile durations are not instrumented. Mark them uncollected; a first run is not necessarily a cold-cache run. |
|
||||
| Thermals | `pmset -g therm` before/after; retain raw warnings and power-source/idle notes (`pmset -g batt`, `uptime`). | No warning is not a temperature reading, proof of no throttling or a sustained-load result. |
|
||||
| Long-duration stability | Predeclare wall-time/iteration budget, timeout, sampling interval and stop conditions; retain every failure, memory trend and repeat. | The tiny triangle is not representative load. Its only pixel readback is at the beginning, so successful exit does not establish correctness of all later frames. |
|
||||
|
||||
The frame loop uses
|
||||
[QueryPerformanceCounter](https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter)
|
||||
around submission and a
|
||||
[GetData event-query wait](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-getdata).
|
||||
It measures CPU-observed offscreen iteration intervals, including wait, loop and
|
||||
logging overhead. It does not measure GPU timestamp duration or displayed FPS.
|
||||
The first interval starts before first submission; after the first readback the
|
||||
clock is reset. Preserve that boundary when describing the series. The busy wait
|
||||
also affects CPU and thermal observations.
|
||||
|
||||
The runner computes statistics from `frame_ms` lines but deletes its full raw
|
||||
stdout/stderr files, retaining only tails without the frame lines in JSON.
|
||||
Consequently its summary alone cannot be independently reanalyzed. Full trace
|
||||
retention, presented-frame capture per backend and capture-overhead measurement
|
||||
remain [#145](https://github.com/MacosPorters/betterxen/issues/145) work. Until they
|
||||
exist, label these runs exploratory offscreen summaries. Do not present them as
|
||||
validated frame-pacing or capture-overhead results.
|
||||
|
||||
## Repetition and analysis check
|
||||
|
||||
Run correctness and both graphics negative controls for each backend before
|
||||
using its timing. Use release builds, AC power, an otherwise idle machine and
|
||||
one GPU job at a time. Record validation variables and toolchain settings;
|
||||
keep correctness with validation enabled separate from timing with it disabled.
|
||||
Reuse the [native protocol's](benchmarks.md#protocol) environment discipline.
|
||||
|
||||
Declare iteration count (for example 2,000), two untimed warm-up processes and
|
||||
five measured processes per backend before starting. Record the exact backend
|
||||
order and reverse/rotate it for a repeated comparison. Do not silently discard
|
||||
failed attempts, outliers, the first interval or additional warm-ups. The
|
||||
candidate does not implement within-process warm-up exclusion; report the full
|
||||
series it actually summarizes. Keep first-run and warmed observations separate
|
||||
without claiming to have cleared any driver cache.
|
||||
|
||||
After correctness passes, a measured block on the candidate can use:
|
||||
|
||||
```sh
|
||||
OUT=artifacts/hybrid-protocol/timing-01
|
||||
mkdir -p "$OUT"
|
||||
MTL_DEBUG_LAYER=0 MTL_SHADER_VALIDATION=0 "$B" bench \
|
||||
--bottle betterxen-protocol --backends d3dmetal,dxmt --repeat 5 \
|
||||
--timeout 60 --min-start-free 50 --min-free 15 --expect PASS --out "$OUT" \
|
||||
-- "$PWD/artifacts/hybrid-workloads/x86_64/d3d11-frameloop.exe" 2000 \
|
||||
> "$OUT/bench-stdout.json"
|
||||
```
|
||||
|
||||
Run the declared warm-ups separately before that block. These backend names are
|
||||
candidates, not promises of availability; retain refusals and unknown identity.
|
||||
Report each process's statistics and the median/range across processes. Do not
|
||||
pool intervals across processes or call a median of p99 values the pooled p99.
|
||||
Do not subtract an assumed capture overhead; it has not been measured.
|
||||
|
||||
Check the analyzer independently with 100 synthetic intervals: 98 at 10 ms,
|
||||
one at 20 ms and one at 100 ms. Their sum is 1,100 ms, mean 11 ms and rate
|
||||
`1000/11` per second. Nearest ranks 50, 95, 99 and 100 give p50=10, p95=10,
|
||||
p99=20 and p99.9=100 ms. The lows are 50 and 10 per second; exactly one
|
||||
interval exceeds twice the median. In the implementation checkout:
|
||||
|
||||
```sh
|
||||
mkdir -p artifacts/hybrid-protocol
|
||||
python3 -c 'print("\n".join(["10"] * 98 + ["20", "100"]))' \
|
||||
> artifacts/hybrid-protocol/known-intervals.txt
|
||||
"$B" frames artifacts/hybrid-protocol/known-intervals.txt
|
||||
```
|
||||
|
||||
This arithmetic is a check of analysis conventions, not Windows/GPU evidence or
|
||||
a new performance measurement. An independent reviewer must re-derive it rather
|
||||
than use the analyzer to generate its own expected answers.
|
||||
|
||||
## Evidence and independent acceptance
|
||||
|
||||
Attach the candidate identity, workload hashes, receipt, settings, command exit
|
||||
statuses, output checks and run records to each local attempt. Classify CPU,
|
||||
graphics readback, runtime admission and timing separately. Record `passed`,
|
||||
failed, unavailable, unsupported and not-run outcomes explicitly. Missing
|
||||
tooling, a skipped test or a timeout cannot establish GPU support.
|
||||
|
||||
Keep source review (class D), local original-fixture execution and independent
|
||||
reproduction distinct under the repository's [claims registry](../claims.toml)
|
||||
and [review records](review-log.md). Do not promote one machine's observation to
|
||||
M1–M5 compatibility, Xbox-hardware verification or game compatibility. A second
|
||||
contributor records their own candidate, hardware, commands and disagreements;
|
||||
the implementer cannot independently accept their result.
|
||||
|
||||
Before posting evidence, review a separate redacted copy: remove personal paths,
|
||||
email addresses, unrelated process data and private bottle/program names, while
|
||||
retaining versions, units, outcomes and hashes needed to understand the run.
|
||||
Use repository-relative paths and a pseudonym. Raw receipts can contain local
|
||||
compiler/application paths and stdout tails; this protocol never uploads them.
|
||||
Executable
+140
@@ -0,0 +1,140 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Run the integrated-workload acceptance sequence through `betterxen hybrid` on this Mac.
|
||||
# Every line printed is "ok <check>" or "FAIL <check>"; the exit status is non-zero if any
|
||||
# check failed. Raw JSON records and logs are kept under the output directory.
|
||||
#
|
||||
# scripts/hybrid/accept-integrated.sh <llvm-mingw-dir> <bottle> [soak-frames] [repeats]
|
||||
#
|
||||
# Needs CrossOver, an existing win11_64 bottle, Rust 1.100.0, the pinned llvm-mingw
|
||||
# (docs/research/hybrid-toolchain.md), and for the on-screen check a GUI session with the
|
||||
# Screen Recording and Accessibility permissions (the latter for the keyboard check, which
|
||||
# brings the test window to the front: do not type while it runs). Opens small windows; do not
|
||||
# run on a busy machine or alongside anything else using the same bottle.
|
||||
set -u
|
||||
TC=${1:?usage: $0 <llvm-mingw-dir> <bottle> [soak-frames] [repeats]}
|
||||
BOTTLE=${2:?name an existing bottle}
|
||||
SOAK=${3:-20000}
|
||||
REPEATS=${4:-5}
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
export RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-1.100.0-aarch64-apple-darwin}
|
||||
OUT="$ROOT/artifacts/acceptance/$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
mkdir -p "$OUT" || exit 1
|
||||
failed=0
|
||||
ok() { echo "ok $1"; }
|
||||
bad() { echo "FAIL $1"; failed=1; }
|
||||
|
||||
(cd "$ROOT" && cargo build --locked --release -p betterxen -p betterxen-hybrid) >"$OUT/build-runner.log" 2>&1 ||
|
||||
{ bad "build runner"; exit 1; }
|
||||
"$ROOT/workloads/d3d11-integrated/build.sh" "$TC" "$OUT/bin" >"$OUT/build-workload.log" 2>&1 ||
|
||||
{ bad "build workload"; exit 1; }
|
||||
"$ROOT/workloads/d3d12-integrated/build.sh" "$TC" "$OUT/bin" >"$OUT/build-workload12.log" 2>&1 ||
|
||||
{ bad "build D3D12 workload"; exit 1; }
|
||||
BX="${CARGO_TARGET_DIR:-$ROOT/target}/release/betterxen"
|
||||
EXE12="$OUT/bin/d3d12-integrated.exe"
|
||||
EXE="$OUT/bin/d3d11-integrated.exe"
|
||||
git -C "$ROOT" rev-parse HEAD >"$OUT/commit.txt"
|
||||
git -C "$ROOT" status --porcelain >>"$OUT/commit.txt"
|
||||
"$BX" hybrid receipt >"$OUT/receipt.json" 2>&1
|
||||
|
||||
if "$BX" hybrid doctor --bottle "$BOTTLE" >"$OUT/doctor.json" 2>&1; then ok "A environment"; else
|
||||
bad "A environment (see doctor.json)"; exit 1; fi
|
||||
if "$BX" hybrid inspect "$EXE" >"$OUT/inspect.json" 2>&1; then ok "B executable identified"; else bad "B inspect"; fi
|
||||
|
||||
GATES=runtime.threads,runtime.memory,runtime.exceptions,runtime.time,runtime.files,graphics.init,shader.compile,frame.first,frame.continuous,resources.churn,input,memory.bounded,shutdown
|
||||
|
||||
# run <name> <expected-classification> [runner options...] -- [workload args...]
|
||||
run() {
|
||||
name=$1; want=$2; shift 2
|
||||
opts=""
|
||||
while [ $# -gt 0 ] && [ "$1" != -- ]; do opts="$opts $1"; shift; done
|
||||
shift
|
||||
# shellcheck disable=SC2086 # options are fixed words from this script
|
||||
"$BX" hybrid run --bottle "$BOTTLE" --expect "PASS integrated" $opts -- "$EXE" "$@" \
|
||||
>"$OUT/$name.json" 2>"$OUT/$name.log"
|
||||
got=$(sed -n 's/^ "classification": "\(.*\)",$/\1/p' "$OUT/$name.json")
|
||||
case "$got" in
|
||||
$want) ok "$name ($got)" ;;
|
||||
*) bad "$name: expected $want, got ${got:-no record}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
run C-F-G-H-full passed --require-gates "$GATES" --timeout 180 --stall-timeout 60 -- --frames 600
|
||||
for fault in color blank stale input depth; do
|
||||
run "negative-$fault" failed_exit_1 --timeout 120 -- --frames 128 --fault "$fault"
|
||||
done
|
||||
run negative-crash 'failed_exit_*' --timeout 60 -- --frames 128 --fault crash
|
||||
run recovery-after-crash passed --require-gates "$GATES" --timeout 120 -- --frames 128
|
||||
run negative-hang stalled --timeout 90 --stall-timeout 15 -- --frames 128 --fault hang
|
||||
if pgrep -f 'd3d11-integrated\.exe' >/dev/null; then bad "hung workload still running after stop";
|
||||
else ok "hung workload removed"; fi
|
||||
run recovery-after-hang passed --require-gates "$GATES" --timeout 120 -- --frames 128
|
||||
|
||||
if python3 "$ROOT/workloads/d3d11-integrated/check_window.py" "${CARGO_TARGET_DIR:-$ROOT/target}/release/betterxen-hybrid" "$BOTTLE" "$EXE" \
|
||||
--keep "$OUT/window.png" >"$OUT/window.log" 2>&1; then ok "F on-screen frame"; else
|
||||
bad "F on-screen frame: $(cat "$OUT/window.log")"; fi
|
||||
if python3 "$ROOT/workloads/d3d11-integrated/check_window.py" "${CARGO_TARGET_DIR:-$ROOT/target}/release/betterxen-hybrid" "$BOTTLE" "$EXE" \
|
||||
--fault depth >"$OUT/window-negative.log" 2>&1; then bad "on-screen check accepted a wrong image";
|
||||
else
|
||||
if grep -q 'samples differ' "$OUT/window-negative.log"; then ok "on-screen negative control";
|
||||
else bad "on-screen negative control did not reach comparison"; fi
|
||||
fi
|
||||
|
||||
i=1
|
||||
while [ "$i" -le "$REPEATS" ]; do
|
||||
run "I-repeat-$i" passed --require-gates "$GATES" --timeout 180 -- --frames 600
|
||||
i=$((i + 1))
|
||||
done
|
||||
# Direct3D 12. Under D3DMetal (CrossOver 26.3) a destroyed D3D12 swapchain leaves a device
|
||||
# reference, so the `shutdown` gate fails. That is reported as KNOWN only when it is the sole
|
||||
# failing gate; any other failure is a failure.
|
||||
d12_summary() {
|
||||
python3 - "$1" <<'PY'
|
||||
import json, re, sys
|
||||
j = json.load(open(sys.argv[1]))
|
||||
failed = sorted(g["name"] for g in j["gates"] if not g["passed"])
|
||||
digest = "".join(re.findall(r"digest=([0-9a-f]+)", " ".join(g["detail"] for g in j["gates"])))
|
||||
backend = j["backend_detected"].split(" ")[0]
|
||||
print(j["classification"], backend, ",".join(failed) or "-", digest or "-")
|
||||
PY
|
||||
}
|
||||
digest11=$(sed -n 's/.*digest=\([0-9a-f]*\).*/\1/p' "$OUT/C-F-G-H-full.json" | head -1)
|
||||
BX_SECRET_PROBE=1 "$BX" hybrid run --bottle "$BOTTLE" --timeout 180 --stall-timeout 60 -- "$EXE12" \
|
||||
--expect-absent-env BX_SECRET_PROBE >"$OUT/d3d12-full.json" 2>"$OUT/d3d12-full.log"
|
||||
read -r class backend failed12 digest12 <<EOT
|
||||
$(d12_summary "$OUT/d3d12-full.json")
|
||||
EOT
|
||||
case "$class:$backend:$failed12" in
|
||||
passed:*:-) ok "D3D12 all gates (backend $backend)" ;;
|
||||
failed_exit_1:d3dmetal:shutdown)
|
||||
ok "D3D12 all gates but shutdown"
|
||||
echo "KNOWN D3D12 shutdown: D3DMetal retains a device reference per swapchain" ;;
|
||||
*) bad "D3D12: $class backend=$backend failed=$failed12" ;;
|
||||
esac
|
||||
if [ -n "$digest11" ] && [ "$digest11" = "$digest12" ]; then ok "D3D11 and D3D12 pixel digests equal ($digest12)";
|
||||
else bad "pixel digests differ: d3d11=$digest11 d3d12=$digest12"; fi
|
||||
for fault in color blank stale input depth upload; do
|
||||
"$BX" hybrid run --bottle "$BOTTLE" --timeout 90 -- "$EXE12" --frames 128 --fault "$fault" \
|
||||
>"$OUT/d3d12-negative-$fault.json" 2>/dev/null
|
||||
read -r class backend failed12 digest12 <<EOT
|
||||
$(d12_summary "$OUT/d3d12-negative-$fault.json")
|
||||
EOT
|
||||
# the fault must break a gate other than the known shutdown one
|
||||
case "$class:${failed12%shutdown}" in
|
||||
failed_exit_1:?*) ok "D3D12 negative-$fault ($failed12)" ;;
|
||||
*) bad "D3D12 negative-$fault: $class failed=$failed12" ;;
|
||||
esac
|
||||
done
|
||||
if python3 "$ROOT/workloads/d3d12-integrated/send_keys.py" "$BX" "$BOTTLE" "$EXE12" >"$OUT/keys.log" 2>&1;
|
||||
then ok "H macOS keyboard events"; else bad "H keyboard: $(tail -1 "$OUT/keys.log")"; fi
|
||||
if python3 "$ROOT/workloads/d3d12-integrated/send_keys.py" "$BX" "$BOTTLE" "$EXE12" --keys up,up \
|
||||
--expect fail >"$OUT/keys-negative.log" 2>&1; then ok "keyboard negative control";
|
||||
else bad "keyboard negative control"; fi
|
||||
if python3 "$ROOT/scripts/hybrid/accept-lifecycle.py" "$BX" "$BOTTLE" "$EXE" >"$OUT/lifecycle.log" 2>&1;
|
||||
then ok "lifecycle: signals, kill and stop, repeated launch"; else
|
||||
bad "lifecycle (see lifecycle.log)"; grep FAIL "$OUT/lifecycle.log"; fi
|
||||
|
||||
run I-soak passed --require-gates "$GATES" --timeout 1800 --stall-timeout 60 -- --frames "$SOAK" --verify-every 500
|
||||
|
||||
echo "records: $OUT"
|
||||
exit $failed
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Process lifecycle checks for the hybrid runner against an installed CrossOver.
|
||||
|
||||
Uses the Direct3D 11 workload: `--fault hang` makes a program that never exits, and a normal
|
||||
run shows recovery. Prints "ok"/"FAIL" per check and exits non-zero on any failure. Do not
|
||||
run anything else in the same bottle meanwhile: stopping a run stops the whole bottle.
|
||||
|
||||
usage: accept-lifecycle.py RUNNER BOTTLE D3D11_EXE [--launches N]
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
failed = False
|
||||
|
||||
|
||||
def check(ok, what):
|
||||
global failed
|
||||
failed |= not ok
|
||||
print(("ok " if ok else "FAIL ") + what, flush=True)
|
||||
|
||||
|
||||
def workload_pids(exe_name):
|
||||
out = subprocess.run(["/bin/ps", "-axo", "pid=,command="], capture_output=True, text=True).stdout
|
||||
pids = []
|
||||
for line in out.splitlines():
|
||||
pid, _, command = line.strip().partition(" ")
|
||||
command = command.strip()
|
||||
# the Windows program appears with a drive-letter command line
|
||||
if command[1:3] == ":\\" and exe_name.lower() in command.lower():
|
||||
pids.append(int(pid))
|
||||
return pids
|
||||
|
||||
|
||||
def wait_for(predicate, seconds):
|
||||
end = time.time() + seconds
|
||||
while time.time() < end:
|
||||
if predicate():
|
||||
return True
|
||||
time.sleep(0.2)
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("runner")
|
||||
p.add_argument("bottle")
|
||||
p.add_argument("exe")
|
||||
p.add_argument("--launches", type=int, default=20)
|
||||
a = p.parse_args()
|
||||
name = os.path.basename(a.exe)
|
||||
base = [a.runner, "hybrid", "run", "--bottle", a.bottle, "--timeout", "120"]
|
||||
if workload_pids(name):
|
||||
print(f"FAIL precondition: {name} is already running")
|
||||
return 1
|
||||
|
||||
def start(extra, out):
|
||||
return subprocess.Popen(base + ["--", a.exe] + extra, stdout=out, stderr=subprocess.DEVNULL,
|
||||
start_new_session=True)
|
||||
|
||||
def healthy(label):
|
||||
with tempfile.TemporaryFile("w+") as out:
|
||||
run = start(["--frames", "64"], out)
|
||||
code = run.wait(timeout=150)
|
||||
check(code == 0, f"{label}: next run passes")
|
||||
check(not workload_pids(name), f"{label}: nothing left running")
|
||||
|
||||
for sig, to_group in ((signal.SIGINT, True), (signal.SIGTERM, False), (signal.SIGHUP, False)):
|
||||
label = sig.name + (" to the process group" if to_group else "")
|
||||
with tempfile.TemporaryFile("w+") as out:
|
||||
run = start(["--frames", "64", "--fault", "hang"], out)
|
||||
if not wait_for(lambda: workload_pids(name), 60):
|
||||
check(False, f"{label}: workload never started")
|
||||
run.kill()
|
||||
continue
|
||||
time.sleep(2)
|
||||
began = time.time()
|
||||
(os.killpg if to_group else os.kill)(run.pid, sig)
|
||||
try:
|
||||
code = run.wait(timeout=40)
|
||||
except subprocess.TimeoutExpired:
|
||||
run.kill()
|
||||
check(False, f"{label}: supervisor did not exit")
|
||||
continue
|
||||
out.seek(0)
|
||||
try:
|
||||
record = json.load(out)
|
||||
except json.JSONDecodeError:
|
||||
record = {}
|
||||
check(code == 1 and record.get("classification") == "interrupted",
|
||||
f"{label}: classified {record.get('classification')} in {time.time() - began:.1f}s")
|
||||
check(wait_for(lambda: not workload_pids(name), 10), f"{label}: workload stopped")
|
||||
healthy(label)
|
||||
|
||||
with tempfile.TemporaryFile("w+") as out:
|
||||
run = start(["--frames", "64", "--fault", "hang"], out)
|
||||
started = wait_for(lambda: workload_pids(name), 60)
|
||||
time.sleep(2)
|
||||
run.kill()
|
||||
run.wait()
|
||||
# SIGKILL cannot be handled: the program is expected to survive until `stop`.
|
||||
check(started and bool(workload_pids(name)), "SIGKILL: program survives, as documented")
|
||||
subprocess.run([a.runner, "hybrid", "stop", "--bottle", a.bottle], timeout=60)
|
||||
check(wait_for(lambda: not workload_pids(name), 15), "SIGKILL: `hybrid stop` removes it")
|
||||
healthy("after stop")
|
||||
|
||||
passed = 0
|
||||
for _ in range(a.launches):
|
||||
with tempfile.TemporaryFile("w+") as out:
|
||||
passed += start(["--frames", "64"], out).wait(timeout=150) == 0
|
||||
check(passed == a.launches, f"repeated launch: {passed} of {a.launches} passed")
|
||||
check(not workload_pids(name), "repeated launch: nothing left running")
|
||||
return 1 if failed else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Build BetterXen's original Windows workloads (issue #364) with a pinned cross toolchain and
|
||||
# write the results to artifacts/hybrid-workloads/<arch>/. Nothing is executed; the script ends
|
||||
# by printing `file` and the PE machine type of every output so a build that produced the wrong
|
||||
# architecture fails here.
|
||||
#
|
||||
# scripts/hybrid/build-windows-workloads.sh <llvm-mingw-dir>
|
||||
#
|
||||
# <llvm-mingw-dir> is an unpacked llvm-mingw release (https://github.com/mstorsjo/llvm-mingw,
|
||||
# Apache-2.0 with LLVM exceptions); see docs/research/hybrid-toolchain.md for the pinned
|
||||
# release and checksum. Rust workloads use the x86_64-pc-windows-gnullvm and
|
||||
# aarch64-pc-windows-gnullvm targets (rustup target add ...) linked with that toolchain.
|
||||
set -eu
|
||||
TC=${1:?usage: $0 <llvm-mingw-dir>}
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
OUT="$ROOT/artifacts/hybrid-workloads"
|
||||
RUSTC_TC=${RUSTUP_TOOLCHAIN_FOR_WORKLOADS:-1.100.0}
|
||||
[ -x "$TC/bin/x86_64-w64-mingw32-clang" ] || { echo "no llvm-mingw at $TC" >&2; exit 1; }
|
||||
|
||||
for arch in x86_64 aarch64; do
|
||||
d="$OUT/$arch"; mkdir -p "$d"
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/selfcheck-c.exe" "$ROOT/workloads/win-selfcheck-c/selfcheck.c"
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/d3d11-clear.exe" "$ROOT/workloads/d3d11-clear/d3d11_clear.c" -ld3d11 -ldxgi
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/d3d11-frameloop.exe" "$ROOT/workloads/d3d11-frameloop/frameloop.c" -ld3d11 -ldxgi -ldxguid -ld3dcompiler -lm
|
||||
env_arch=$(echo "$arch" | tr a-z A-Z)
|
||||
(
|
||||
export PATH="$TC/bin:$PATH"
|
||||
export "CARGO_TARGET_${env_arch}_PC_WINDOWS_GNULLVM_LINKER=$TC/bin/$arch-w64-mingw32-clang"
|
||||
cd "$ROOT/workloads/win-selfcheck-rust"
|
||||
CARGO_TARGET_DIR="$OUT/rust-target" rustup run "$RUSTC_TC" cargo build --release --target "$arch-pc-windows-gnullvm" -q
|
||||
)
|
||||
cp "$OUT/rust-target/$arch-pc-windows-gnullvm/release/win-selfcheck-rust.exe" "$d/selfcheck-rust.exe"
|
||||
done
|
||||
|
||||
fail=0
|
||||
for f in "$OUT"/x86_64/*.exe "$OUT"/aarch64/*.exe; do
|
||||
want=$(basename "$(dirname "$f")")
|
||||
desc=$(file -b "$f")
|
||||
case "$want:$desc" in
|
||||
x86_64:*"PE32+"*"x86-64"*) ok=ok ;;
|
||||
aarch64:*"PE32+"*"Aarch64"*|aarch64:*"PE32+"*"ARM64"*) ok=ok ;;
|
||||
*) ok=WRONG; fail=1 ;;
|
||||
esac
|
||||
echo "$ok $f: $desc"
|
||||
done
|
||||
exit $fail
|
||||
@@ -15,7 +15,7 @@ def dump(obj, path):
|
||||
|
||||
|
||||
WF = os.path.join(ROOT, ".github", "workflows")
|
||||
QUEUE_WORKFLOWS = ["agent-claims.yml", "agent-pr-checks.yml"]
|
||||
QUEUE_WORKFLOWS = ["agent-claims.yml"]
|
||||
USER_TEXT = re.compile(r"\$\{\{\s*github\.event\.(comment|issue|pull_request)\.(body|title)|github\.head_ref")
|
||||
|
||||
|
||||
@@ -58,11 +58,6 @@ class Workflows(unittest.TestCase):
|
||||
bad = "jobs:\n a:\n steps:\n - run: |\n echo ${{ github.event.comment.body }}\n"
|
||||
self.assertTrue(any(re.search(r"\$\{\{", b) for b in run_blocks(bad)))
|
||||
|
||||
def test_pr_workflow_never_checks_out_pr_code(self):
|
||||
text = self.read("agent-pr-checks.yml")
|
||||
self.assertNotRegex(text, r"github\.event\.pull_request\.head|ref:\s*\$\{\{")
|
||||
self.assertIn("pull_request_target", text)
|
||||
|
||||
def job(self, name, job):
|
||||
"""Text of one job block: from ` <job>:` to the next two-space-indented key."""
|
||||
m = re.search(r"(?ms)^ %s:\n(.*?)(?=^ \S|\Z)" % re.escape(job), self.read(name))
|
||||
@@ -74,9 +69,7 @@ class Workflows(unittest.TestCase):
|
||||
|
||||
def test_only_command_comments_start_runs(self):
|
||||
# Ordinary comments must not start a claim run or a verification re-run.
|
||||
self.assertIn("startsWith(github.event.comment.body, '/verified')", self.job_if("agent-pr-checks.yml", "verify"))
|
||||
self.assertIn("startsWith(github.event.comment.body, '/')", self.job_if("agent-claims.yml", "command"))
|
||||
self.assertNotIn("issue_comment", self.job_if("agent-pr-checks.yml", "check"))
|
||||
|
||||
def test_claim_jobs_share_one_group_and_replay(self):
|
||||
for job in ("command", "audit"):
|
||||
@@ -87,15 +80,6 @@ class Workflows(unittest.TestCase):
|
||||
self.assertIn("--recent-commands", text, job)
|
||||
self.assertNotIn("agent_queue decide", self.job("agent-claims.yml", "command"))
|
||||
|
||||
def test_rerun_needs_an_accepted_verification(self):
|
||||
text = self.job("agent-pr-checks.yml", "verify")
|
||||
self.assertIn('if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi', text)
|
||||
self.assertLess(text.index("agent_queue should-rerun"), text.index("agent_queue pr-check"))
|
||||
# The check is evaluated in this job: pull_request_target runs cannot be found by head SHA.
|
||||
self.assertNotIn("gh run", text)
|
||||
self.assertNotIn("actions: write", text)
|
||||
self.assertIn("::warning title=Agent PR check (advisory)::", text)
|
||||
|
||||
def test_should_rerun_exit_codes(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p = os.path.join(d, "a.json")
|
||||
@@ -104,19 +88,6 @@ class Workflows(unittest.TestCase):
|
||||
dump(actions, p)
|
||||
self.assertEqual(Cli.run_cli(self, "should-rerun", "--actions", p).returncode, code, actions)
|
||||
|
||||
def test_verify_runs_one_at_a_time_per_pull_request(self):
|
||||
text = self.job("agent-pr-checks.yml", "verify")
|
||||
self.assertRegex(text, r"group: agent-verify-\$\{\{ github\.event\.issue\.number \}\}\n\s+cancel-in-progress: false")
|
||||
|
||||
def test_pr_check_is_advisory(self):
|
||||
# Exit status 1 (problems found) only warns until the live smoke test and issue migration.
|
||||
text = self.job("agent-pr-checks.yml", "check")
|
||||
found = re.search(r'if \[ "\$status" -eq 1 \]; then\n(.*?)\n\s+elif \[ "\$status" -ne 0 \]; then\n\s+exit "\$status"', text, re.S)
|
||||
self.assertIsNotNone(found, text)
|
||||
self.assertIn("::warning title=Agent PR check (advisory)::", found.group(1))
|
||||
self.assertNotIn("exit", found.group(1))
|
||||
self.assertEqual(text.count("exit "), 1)
|
||||
|
||||
def test_actions_pinned_by_sha(self):
|
||||
for name in QUEUE_WORKFLOWS:
|
||||
for use in re.findall(r"uses:\s*(\S+)", self.read(name)):
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #365, first step): Direct3D 11 clear and readback.
|
||||
// Creates a hardware device, clears a 64x64 RGBA8 render target to (0.25, 0.5, 0.75, 1.0),
|
||||
// copies it to a staging texture, maps it, and checks every pixel. Expected bytes by the ideal
|
||||
// FLOAT->UNORM rule (c*255, add 0.5, drop the fraction): 64, 128, 191, 255. The Direct3D data
|
||||
// conversion rules also permit a tolerance of 0.6 unit-last-place on the integer side
|
||||
// (D3D11/D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6f), so a byte passes when it is
|
||||
// within 0.6 of c*255. 0.5*255 = 127.5 is an exact tie, so both 127 and 128 are permitted.
|
||||
// The program prints whether the result matched the ideal exactly. This corrects an earlier
|
||||
// version that required exact equality, which was stricter than the specification.
|
||||
// Exit codes: 0 pass, 1 wrong pixel, 2 no device (reported, not a pass), 3 other API failure.
|
||||
#define COBJMACROS
|
||||
#include <d3d11.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// `--negative-control` expects a deliberately wrong colour; the program must then exit 1.
|
||||
int main(int argc, char **argv) {
|
||||
const int negative = argc > 1 && !strcmp(argv[1], "--negative-control");
|
||||
ID3D11Device *dev = NULL;
|
||||
ID3D11DeviceContext *ctx = NULL;
|
||||
D3D_FEATURE_LEVEL got;
|
||||
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0,
|
||||
D3D11_SDK_VERSION, &dev, &got, &ctx);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
printf("device ok feature_level=0x%x\n", (unsigned)got);
|
||||
|
||||
D3D11_TEXTURE2D_DESC d = {0};
|
||||
d.Width = 64; d.Height = 64; d.MipLevels = 1; d.ArraySize = 1;
|
||||
d.Format = DXGI_FORMAT_R8G8B8A8_UNORM; d.SampleDesc.Count = 1;
|
||||
d.Usage = D3D11_USAGE_DEFAULT; d.BindFlags = D3D11_BIND_RENDER_TARGET;
|
||||
ID3D11Texture2D *rt = NULL, *st = NULL;
|
||||
if (FAILED(ID3D11Device_CreateTexture2D(dev, &d, NULL, &rt))) { printf("FAIL create rt\n"); return 3; }
|
||||
d.Usage = D3D11_USAGE_STAGING; d.BindFlags = 0; d.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
if (FAILED(ID3D11Device_CreateTexture2D(dev, &d, NULL, &st))) { printf("FAIL create staging\n"); return 3; }
|
||||
ID3D11RenderTargetView *rtv = NULL;
|
||||
if (FAILED(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)rt, NULL, &rtv))) {
|
||||
printf("FAIL create rtv\n"); return 3;
|
||||
}
|
||||
const float color[4] = {0.25f, 0.5f, 0.75f, 1.0f};
|
||||
ID3D11DeviceContext_ClearRenderTargetView(ctx, rtv, color);
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)st, (ID3D11Resource *)rt);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
if (FAILED(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)st, 0, D3D11_MAP_READ, 0, &m))) {
|
||||
printf("FAIL map\n"); return 3;
|
||||
}
|
||||
const unsigned char ideal[4] = {64, 128, 191, 255};
|
||||
const float tol = 0.6f;
|
||||
int bad = 0, inexact = 0;
|
||||
for (UINT y = 0; y < 64; y++) {
|
||||
const unsigned char *row = (const unsigned char *)m.pData + (size_t)y * m.RowPitch;
|
||||
for (UINT x = 0; x < 64; x++) {
|
||||
const unsigned char *p = row + x * 4;
|
||||
int off_ideal = 0, off_tol = 0;
|
||||
for (int ch = 0; ch < 4; ch++) {
|
||||
if (p[ch] != ideal[ch] + (negative ? 100 : 0)) off_ideal = 1;
|
||||
if (fabsf(color[ch] * 255.0f + (negative ? 100.0f : 0.0f) - (float)p[ch]) > tol) off_tol = 1;
|
||||
}
|
||||
if (off_ideal) inexact++;
|
||||
if (off_tol) {
|
||||
if (bad < 3) printf("pixel (%u,%u) = %u %u %u %u\n", x, y, p[0], p[1], p[2], p[3]);
|
||||
bad++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)st, 0);
|
||||
if (bad) { printf("FAIL %d wrong pixels\n", bad); return 1; }
|
||||
printf("PASS 4096 pixels within tolerance; %d differ from the ideal rounding\n", inexact);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
# D3D11 compute-buffer workload
|
||||
|
||||
This original fixture submits an unsigned 32-bit addition in a Direct3D 11 compute shader and verifies the GPU output through CPU staging readback. It requires a hardware device at feature level 11.0 and uses no game data.
|
||||
|
||||
## Expected output
|
||||
|
||||
The shader adds one plus the lane's position within a repeating 16-word sequence. Write an output index as `16b + r` with `0 ≤ r < 16`. Pattern 0 starts its block at `4096 + 65536b`. Pattern 1 starts at `−16 − 65536b`, represented modulo 2³². Each input is its block's base plus `r`. The expected output is the corresponding odd-number progression from base plus 1 to base plus 31, reduced modulo 2³². The C code lists both first-block progressions as constants. Subsequent blocks shift the expected progression by the signed block offset. The block tags distinguish writes whose indices differ by a multiple of 16. The second pattern exercises unsigned wraparound in its first block.
|
||||
|
||||
Each pattern runs with counts 0, 1, 63, 64, 65, 127, 128, 129, and 191. A zero count skips dispatch and checks that the entire buffer retains its initial sentinel. The other cases dispatch groups of 64. The structured buffers physically hold 192 words, so an erroneous write from a rounded-up tail would overwrite a sentinel inside the allocated buffer. Every run compares all 192 words, including undispatched slots. The negative control changes only the expected word for pattern 0, count 65, index 64 from `00041001` to `00041000`.
|
||||
|
||||
The digest is 32-bit FNV-1a over all 3,456 readback words, each fed as four bytes in little-endian order. Pattern 0 comes first, each pattern uses the count order above, and each buffer is traversed by ascending index. The analytic result is `6ce404b5`. The negative control should give exactly one mismatch with the same digest because it leaves the GPU inputs and work unchanged.
|
||||
|
||||
The executable returns 0 for a matching readback, 1 for mismatches, 2 for no feature-level-11.0 hardware device, 3 for another API failure, and 4 for invalid arguments.
|
||||
|
||||
## Build and run
|
||||
|
||||
Use the external llvm-mingw 20261117 UCRT macOS universal release pinned by the candidate in #384. Its archive SHA-256 is `98d340bbb8d46b09ad6886ffba88bd9d5415e131c316de48e6bd7647377446aa`. Clang and LLD are 23.1.6. The package ships both host slices and the recipe explicitly runs Clang as ARM64. The release includes LLVM's Apache-2.0 license with LLVM exceptions and dependency notices. See the archive's `LICENSE.TXT`. It is a build dependency and is supplied separately.
|
||||
|
||||
```sh
|
||||
workloads/d3d11-compute/build.sh /absolute/path/to/llvm-mingw /absolute/path/to/vkd3d-compiler
|
||||
```
|
||||
|
||||
The second dependency is WineHQ vkd3d-compiler 2.2 with libvkd3d-shader 2.2 (LGPL-2.1-or-later). The WineHQ 2.2 source archive used locally had SHA-256 `6f8cdbfc52e36eb74ab6aff42b1e958c3d9af912ab8f23d16d63711f2bab051b`. Use a native ARM64 build. The recipe compiles HLSL entry `main` to the `cs_5_0` profile in a tokenized DXBC container and embeds the resulting bytes in the executable. The guest gives those bytes directly to `CreateComputeShader`. Neither compiler is bundled or invoked by the guest.
|
||||
|
||||
Local compiler build inputs were the WineHQ release, Xcode Command Line Tools, pkgconf 2.5.1, Bison 3.8.2, system Flex, Vulkan-Headers `d4a196d8c84e032d27f999adcea3075517c1c97f` and SPIRV-Headers `3f17b2af6784bfa2c5aa5dbb8e0e74a607dd8b3b`. From the extracted vkd3d source, the local ARM64 build used:
|
||||
|
||||
```sh
|
||||
PKG_CONFIG=/absolute/path/to/pkgconf SONAME_LIBVULKAN=libMoltenVK.dylib \
|
||||
CPPFLAGS="-I$VULKAN_HEADERS/include -I$SPIRV_HEADERS/include" \
|
||||
./configure --disable-tests --disable-demos
|
||||
for grammar in hlsl preproc; do
|
||||
bison -d -o "libs/vkd3d-shader/$grammar.tab.c" "libs/vkd3d-shader/$grammar.y"
|
||||
done
|
||||
make include/private/vkd3d_version.h
|
||||
make -j2 vkd3d-compiler
|
||||
```
|
||||
|
||||
The Vulkan soname satisfies configure's runtime-library setting for the broader vkd3d project. The compiler target links libvkd3d-shader and does not link Vulkan or MoltenVK. The default guest build output is `artifacts/hybrid-workloads/x86_64/d3d11-compute.exe`.
|
||||
|
||||
Use a fresh dedicated Windows 11 64-bit bottle and the evidence-saving runner from #398. The runner's backend selector is observed CrossOver behavior. Record the backend evidence from each run.
|
||||
|
||||
```sh
|
||||
betterxen-hybrid run --bottle betterxen-issue-401 --backend dxvk \
|
||||
--timeout 45 --expect 'PASS cases=' --out artifacts/issue-401/run-records \
|
||||
-- "$PWD/artifacts/hybrid-workloads/x86_64/d3d11-compute.exe"
|
||||
betterxen-hybrid run --bottle betterxen-issue-401 --backend dxvk \
|
||||
--timeout 45 --expect 'PASS cases=' --out artifacts/issue-401/run-records \
|
||||
-- "$PWD/artifacts/hybrid-workloads/x86_64/d3d11-compute.exe" --negative-control
|
||||
```
|
||||
|
||||
The second command should return 1 and report one mismatch. A result without a guest exit code or completed readback is unavailable.
|
||||
|
||||
## Local evidence
|
||||
|
||||
Workload branch base: `566272082a74d8b45fcec37edd00f4f6703df3ab` (#384). The separate Rust 1.100.0 runner checkout used `e1b6a24a4f37360abb1f5c77bedbfd470cf1c720` (#398's persistence fix on #384). Host was an ARM64 Apple M2 Pro with 16 GiB and macOS 27.3 (26C5035r). CrossOver Preview was 20261111 (27.0.0.41303). The pinned archive checksum matched. Separate source and output directories produced identical DXBC (SHA-256 `af046791dce24119b0452d50cd30f69a2735de649161101cb5d0626625eebee0`) and x86-64 PE32+ executables (SHA-256 `2f92cd68266592039cdc4860a2c3896a15ddabb83dbecd0d1ed928599009095f`).
|
||||
|
||||
The default memory guard refused the first request at 49% free. Subsequent local runs used the runner's `--min-start-free 45` option with the default during-run floor. Run records are under ignored `artifacts/issue-401/precompiled-records/`. This is author-side verification. Independent derivation and CrossOver reproduction are pending.
|
||||
|
||||
| Requested backend | Evidence in the run record | Normal run | Negative control |
|
||||
| --- | --- | --- | --- |
|
||||
| D3DMetal | Inferred from the `AMD Compatibility Mode` adapter | Exit 0, zero mismatches | Exit 1, one mismatch |
|
||||
| DXVK | DXVK banner and `Apple M2 Pro` adapter | Exit 0, zero mismatches | Exit 1, one mismatch |
|
||||
|
||||
All four completed runs read back 3,456 words and matched the independently calculated digest `6ce404b5`. The initial memory refusal was the only unavailable run in the final evidence set. The runner intentionally classifies a negative-control exit 1 as a workload failure.
|
||||
|
||||
## References
|
||||
|
||||
- [llvm-mingw 20261117 release](https://github.com/mstorsjo/llvm-mingw/releases/tag/20261117)
|
||||
- [WineHQ vkd3d 2.2 release](https://list.winehq.org/hyperkitty/list/wine-announce%40list.winehq.org/thread/QBVNHPS2PLCJXA67ESIEY3XZP7BV4KRA/)
|
||||
- [Microsoft compute shader creation and profile example](https://learn.microsoft.com/en-us/windows/win32/direct3d11/direct3d-11-advanced-stages-compute-create)
|
||||
- [Microsoft structured-buffer resource](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-object-structuredbuffer)
|
||||
- [Microsoft thread-group size and dispatch IDs](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-attributes-numthreads)
|
||||
- [Microsoft CopyResource reference](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-copyresource)
|
||||
- [Microsoft Map reference](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-map)
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
set -eu
|
||||
toolchain=${1:?usage: build.sh LLVM_MINGW_DIR VKD3D_COMPILER [OUTPUT_DIR]}
|
||||
shader_compiler=${2:?supply the native vkd3d-compiler 2.2 executable}
|
||||
src=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
||||
out=${3:-"$src/../../artifacts/hybrid-workloads/x86_64"}
|
||||
mkdir -p "$out"
|
||||
|
||||
version=$(arch -arm64 "$shader_compiler" --version)
|
||||
case "$version" in
|
||||
'vkd3d shader compiler version 2.2 using vkd3d-shader 2.2'*) ;;
|
||||
*) printf 'Expected vkd3d-compiler and vkd3d-shader 2.2, got %s\n' "$version" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Compile original HLSL to D3D11-compatible shader model 5 tokenized bytecode.
|
||||
arch -arm64 "$shader_compiler" -x hlsl -b dxbc-tpf -p cs_5_0 -e main \
|
||||
-o "$out/compute.dxbc" "$src/compute.hlsl"
|
||||
xxd -i < "$out/compute.dxbc" > "$out/compute_dxbc.inc"
|
||||
arch -arm64 "$toolchain/bin/x86_64-w64-mingw32-clang" \
|
||||
-std=c11 -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-I "$out" "$src/compute.c" -o "$out/d3d11-compute.exe" -ld3d11 -ldxguid
|
||||
description=$(file -b "$out/d3d11-compute.exe")
|
||||
echo "$description"
|
||||
case "$description" in
|
||||
*PE32+*x86-64*) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
@@ -0,0 +1,198 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#define COBJMACROS
|
||||
#include <d3d11.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static const unsigned char shader_bytecode[] = {
|
||||
#include "compute_dxbc.inc"
|
||||
};
|
||||
|
||||
enum { GROUP_WIDTH = 64, CAPACITY = 3 * GROUP_WIDTH, PATTERNS = 2 };
|
||||
static const uint32_t sentinel = UINT32_C(0xcafef00d);
|
||||
|
||||
// Authored as base + residue. The second row crosses the 32-bit wrap boundary.
|
||||
static const uint32_t inputs[PATTERNS][16] = {
|
||||
{0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007,
|
||||
0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x100e, 0x100f},
|
||||
{0xfffffff0, 0xfffffff1, 0xfffffff2, 0xfffffff3,
|
||||
0xfffffff4, 0xfffffff5, 0xfffffff6, 0xfffffff7,
|
||||
0xfffffff8, 0xfffffff9, 0xfffffffa, 0xfffffffb,
|
||||
0xfffffffc, 0xfffffffd, 0xfffffffe, 0xffffffff},
|
||||
};
|
||||
|
||||
static const uint32_t expected[PATTERNS][16] = {
|
||||
{0x1001, 0x1003, 0x1005, 0x1007, 0x1009, 0x100b, 0x100d, 0x100f,
|
||||
0x1011, 0x1013, 0x1015, 0x1017, 0x1019, 0x101b, 0x101d, 0x101f},
|
||||
{0xfffffff1, 0xfffffff3, 0xfffffff5, 0xfffffff7, 0xfffffff9, 0xfffffffb,
|
||||
0xfffffffd, 0xffffffff, 1, 3, 5, 7, 9, 11, 13, 15},
|
||||
};
|
||||
|
||||
#define CHECK(operation) do { \
|
||||
HRESULT result = (operation); \
|
||||
if (FAILED(result)) { \
|
||||
printf("API_ERROR operation=%s hr=0x%08lx\n", #operation, (unsigned long)result); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static int run_case(ID3D11Device *device, ID3D11DeviceContext *context,
|
||||
UINT pattern, UINT count, int negative, uint32_t *digest,
|
||||
UINT *mismatches) {
|
||||
uint32_t input[CAPACITY], initial[CAPACITY];
|
||||
const uint32_t params[4] = {count, 0, 0, 0};
|
||||
ID3D11Buffer *source = NULL, *destination = NULL, *staging = NULL, *constants = NULL;
|
||||
ID3D11ShaderResourceView *srv = NULL;
|
||||
ID3D11UnorderedAccessView *uav = NULL;
|
||||
int status = 3;
|
||||
for (UINT i = 0; i < CAPACITY; ++i) {
|
||||
input[i] = inputs[pattern][i % 16] ^ ((i / 16) << 16);
|
||||
initial[i] = sentinel;
|
||||
}
|
||||
|
||||
D3D11_BUFFER_DESC desc = {
|
||||
.ByteWidth = sizeof input, .Usage = D3D11_USAGE_DEFAULT,
|
||||
.BindFlags = D3D11_BIND_SHADER_RESOURCE,
|
||||
.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED,
|
||||
.StructureByteStride = sizeof(uint32_t),
|
||||
};
|
||||
D3D11_SUBRESOURCE_DATA data = {.pSysMem = input};
|
||||
CHECK(ID3D11Device_CreateBuffer(device, &desc, &data, &source));
|
||||
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
|
||||
data.pSysMem = initial;
|
||||
CHECK(ID3D11Device_CreateBuffer(device, &desc, &data, &destination));
|
||||
|
||||
desc = (D3D11_BUFFER_DESC){
|
||||
.ByteWidth = sizeof initial, .Usage = D3D11_USAGE_STAGING,
|
||||
.CPUAccessFlags = D3D11_CPU_ACCESS_READ,
|
||||
};
|
||||
CHECK(ID3D11Device_CreateBuffer(device, &desc, NULL, &staging));
|
||||
desc = (D3D11_BUFFER_DESC){
|
||||
.ByteWidth = sizeof params, .Usage = D3D11_USAGE_IMMUTABLE,
|
||||
.BindFlags = D3D11_BIND_CONSTANT_BUFFER,
|
||||
};
|
||||
data.pSysMem = params;
|
||||
CHECK(ID3D11Device_CreateBuffer(device, &desc, &data, &constants));
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC read_view = {
|
||||
.Format = DXGI_FORMAT_UNKNOWN, .ViewDimension = D3D11_SRV_DIMENSION_BUFFER,
|
||||
.Buffer = {.NumElements = CAPACITY},
|
||||
};
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC write_view = {
|
||||
.Format = DXGI_FORMAT_UNKNOWN, .ViewDimension = D3D11_UAV_DIMENSION_BUFFER,
|
||||
.Buffer = {.NumElements = CAPACITY},
|
||||
};
|
||||
CHECK(ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)source, &read_view, &srv));
|
||||
CHECK(ID3D11Device_CreateUnorderedAccessView(device, (ID3D11Resource *)destination, &write_view, &uav));
|
||||
|
||||
if (count) {
|
||||
ID3D11DeviceContext_CSSetShaderResources(context, 0, 1, &srv);
|
||||
ID3D11DeviceContext_CSSetUnorderedAccessViews(context, 0, 1, &uav, NULL);
|
||||
ID3D11DeviceContext_CSSetConstantBuffers(context, 0, 1, &constants);
|
||||
ID3D11DeviceContext_Dispatch(context, (count + GROUP_WIDTH - 1) / GROUP_WIDTH, 1, 1);
|
||||
ID3D11ShaderResourceView *no_srv = NULL;
|
||||
ID3D11UnorderedAccessView *no_uav = NULL;
|
||||
ID3D11Buffer *no_buffer = NULL;
|
||||
ID3D11DeviceContext_CSSetShaderResources(context, 0, 1, &no_srv);
|
||||
ID3D11DeviceContext_CSSetUnorderedAccessViews(context, 0, 1, &no_uav, NULL);
|
||||
ID3D11DeviceContext_CSSetConstantBuffers(context, 0, 1, &no_buffer);
|
||||
}
|
||||
ID3D11DeviceContext_CopyResource(context, (ID3D11Resource *)staging, (ID3D11Resource *)destination);
|
||||
D3D11_MAPPED_SUBRESOURCE map;
|
||||
CHECK(ID3D11DeviceContext_Map(context, (ID3D11Resource *)staging, 0, D3D11_MAP_READ, 0, &map));
|
||||
const uint32_t *words = map.pData;
|
||||
for (UINT i = 0; i < CAPACITY; ++i) {
|
||||
uint32_t want = sentinel;
|
||||
if (i < count) {
|
||||
want = expected[pattern][i % 16];
|
||||
// Input tags increase pattern 0 and decrease pattern 1 by whole 65536s.
|
||||
want += pattern == 0 ? (i / 16) << 16 : 0u - ((i / 16) << 16);
|
||||
if (negative && pattern == 0 && count == GROUP_WIDTH + 1 && i == GROUP_WIDTH)
|
||||
want ^= 1u;
|
||||
}
|
||||
if (words[i] != want) {
|
||||
if (*mismatches < 8)
|
||||
printf("MISMATCH pattern=%u count=%u index=%u expected=%08" PRIx32
|
||||
" actual=%08" PRIx32 "\n", pattern, count, i, want, words[i]);
|
||||
++*mismatches;
|
||||
}
|
||||
for (unsigned shift = 0; shift < 32; shift += 8) {
|
||||
*digest ^= (words[i] >> shift) & 0xffu;
|
||||
*digest *= UINT32_C(16777619);
|
||||
}
|
||||
}
|
||||
ID3D11DeviceContext_Unmap(context, (ID3D11Resource *)staging, 0);
|
||||
status = 0;
|
||||
|
||||
cleanup:
|
||||
if (uav) ID3D11UnorderedAccessView_Release(uav);
|
||||
if (srv) ID3D11ShaderResourceView_Release(srv);
|
||||
if (constants) ID3D11Buffer_Release(constants);
|
||||
if (staging) ID3D11Buffer_Release(staging);
|
||||
if (destination) ID3D11Buffer_Release(destination);
|
||||
if (source) ID3D11Buffer_Release(source);
|
||||
return status;
|
||||
}
|
||||
|
||||
static void report_adapter(ID3D11Device *device) {
|
||||
IDXGIDevice *dxgi = NULL;
|
||||
IDXGIAdapter *adapter = NULL;
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi))) {
|
||||
if (SUCCEEDED(IDXGIDevice_GetAdapter(dxgi, &adapter))) {
|
||||
if (SUCCEEDED(IDXGIAdapter_GetDesc(adapter, &desc)))
|
||||
printf("adapter=%.127ls vendor=0x%x\n", desc.Description, desc.VendorId);
|
||||
IDXGIAdapter_Release(adapter);
|
||||
}
|
||||
IDXGIDevice_Release(dxgi);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const int negative = argc == 2 && strcmp(argv[1], "--negative-control") == 0;
|
||||
if (argc != 1 && !negative) {
|
||||
puts("USAGE d3d11-compute.exe [--negative-control]");
|
||||
return 4;
|
||||
}
|
||||
|
||||
ID3D11Device *device = NULL;
|
||||
ID3D11DeviceContext *context = NULL;
|
||||
const D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_0;
|
||||
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &level, 1,
|
||||
D3D11_SDK_VERSION, &device, NULL, &context);
|
||||
if (FAILED(hr)) {
|
||||
printf("NO_DEVICE hr=0x%08lx\n", (unsigned long)hr);
|
||||
return 2;
|
||||
}
|
||||
|
||||
report_adapter(device);
|
||||
|
||||
ID3D11ComputeShader *shader = NULL;
|
||||
int status = 3;
|
||||
CHECK(ID3D11Device_CreateComputeShader(device, shader_bytecode,
|
||||
sizeof shader_bytecode, NULL, &shader));
|
||||
ID3D11DeviceContext_CSSetShader(context, shader, NULL, 0);
|
||||
|
||||
const UINT counts[] = {0, 1, 63, 64, 65, 127, 128, 129, 191};
|
||||
const UINT count_cases = sizeof counts / sizeof counts[0];
|
||||
uint32_t digest = UINT32_C(2166136261);
|
||||
UINT mismatches = 0;
|
||||
for (UINT pattern = 0; pattern < PATTERNS; ++pattern) {
|
||||
for (UINT i = 0; i < count_cases; ++i) {
|
||||
status = run_case(device, context, pattern, counts[i], negative, &digest, &mismatches);
|
||||
if (status) goto cleanup;
|
||||
}
|
||||
}
|
||||
printf("%s cases=%u words=%u mismatches=%u digest=%08" PRIx32 "\n",
|
||||
mismatches ? "FAIL" : "PASS", PATTERNS * count_cases,
|
||||
PATTERNS * count_cases * CAPACITY, mismatches, digest);
|
||||
status = mismatches ? 1 : 0;
|
||||
|
||||
cleanup:
|
||||
ID3D11DeviceContext_ClearState(context);
|
||||
if (shader) ID3D11ComputeShader_Release(shader);
|
||||
ID3D11DeviceContext_Release(context);
|
||||
ID3D11Device_Release(device);
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
StructuredBuffer<uint> inputWords : register(t0);
|
||||
RWStructuredBuffer<uint> outputWords : register(u0);
|
||||
|
||||
cbuffer Parameters : register(b0)
|
||||
{
|
||||
uint count;
|
||||
};
|
||||
|
||||
[numthreads(64, 1, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
if (id.x < count)
|
||||
outputWords[id.x] = inputWords[id.x] + (id.x & 15u) + 1u;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #365, #145): Direct3D 11 indexed triangle, shaders,
|
||||
// offscreen render target and a sustained frame loop with per-frame GPU-completion timing.
|
||||
//
|
||||
// Pipeline: HLSL vertex and pixel shaders compiled at run time with D3DCompile, a vertex
|
||||
// buffer (3 vertices), an index buffer (3 indices), a 640x360 RGBA8 render target, no window
|
||||
// and no presentation. Each frame clears, draws, issues an event query and waits for it to
|
||||
// complete; the interval between consecutive completions is printed as `frame_ms <value>`,
|
||||
// one line per frame, so `betterxen-hybrid frames` can summarise them. This measures
|
||||
// submit-to-completion of a trivial draw plus synchronisation, NOT presentation or realistic
|
||||
// rendering cost.
|
||||
//
|
||||
// Correctness (read back once after the first frame): pixel (0,0) lies outside the triangle
|
||||
// and must be the clear colour (0,0,0,255) exactly; the centre pixel must be the triangle
|
||||
// colour (0.2, 0.4, 0.8, 1.0) within 0.6 of c*255 (the Direct3D float-to-UNORM tolerance).
|
||||
// Usage: frameloop.exe [--negative-control] [frames] (default 300). Exit 0 pass, 1 wrong pixel, 2 no device,
|
||||
// 3 other API failure.
|
||||
#define COBJMACROS
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgi.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *VS =
|
||||
"struct V { float2 p : POSITION; };\n"
|
||||
"float4 main(V v) : SV_Position { return float4(v.p, 0, 1); }\n";
|
||||
static const char *PS =
|
||||
"float4 main() : SV_Target { return float4(0.2, 0.4, 0.8, 1.0); }\n";
|
||||
|
||||
#define CHECK(x, what) do { HRESULT hr_ = (x); if (FAILED(hr_)) { \
|
||||
printf("FAIL %s hr=0x%08lx\n", what, (unsigned long)hr_); return 3; } } while (0)
|
||||
|
||||
static ID3DBlob *compile(const char *src, const char *target) {
|
||||
ID3DBlob *code = NULL, *err = NULL;
|
||||
HRESULT hr = D3DCompile(src, strlen(src), NULL, NULL, NULL, "main", target, 0, 0, &code, &err);
|
||||
if (FAILED(hr)) {
|
||||
printf("FAIL D3DCompile %s hr=0x%08lx %s\n", target, (unsigned long)hr,
|
||||
err ? (const char *)ID3D10Blob_GetBufferPointer(err) : "");
|
||||
return NULL;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// `--negative-control [frames]` expects a deliberately wrong centre colour and must exit 1.
|
||||
const int negative = argc > 1 && !strcmp(argv[1], "--negative-control");
|
||||
int frames = argc > 1 + negative ? atoi(argv[1 + negative]) : 300;
|
||||
if (frames < 1) frames = 1;
|
||||
ID3D11Device *dev = NULL;
|
||||
ID3D11DeviceContext *ctx = NULL;
|
||||
D3D_FEATURE_LEVEL fl;
|
||||
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0,
|
||||
D3D11_SDK_VERSION, &dev, &fl, &ctx);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
printf("device ok feature_level=0x%x\n", (unsigned)fl);
|
||||
{
|
||||
IDXGIDevice *dd = NULL; IDXGIAdapter *ad = NULL; DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(ID3D11Device_QueryInterface(dev, &IID_IDXGIDevice, (void **)&dd)) &&
|
||||
SUCCEEDED(IDXGIDevice_GetAdapter(dd, &ad)) && SUCCEEDED(IDXGIAdapter_GetDesc(ad, &desc))) {
|
||||
char name[128]; size_t i = 0;
|
||||
for (; desc.Description[i] && i < 127; i++) name[i] = (char)desc.Description[i];
|
||||
name[i] = 0;
|
||||
printf("adapter=%s vendor=0x%x dedicated_vram_mb=%u\n", name, desc.VendorId,
|
||||
(unsigned)(desc.DedicatedVideoMemory >> 20));
|
||||
}
|
||||
}
|
||||
|
||||
ID3DBlob *vsb = compile(VS, "vs_4_0"), *psb = compile(PS, "ps_4_0");
|
||||
if (!vsb || !psb) return 3;
|
||||
ID3D11VertexShader *vs; ID3D11PixelShader *ps; ID3D11InputLayout *il;
|
||||
CHECK(ID3D11Device_CreateVertexShader(dev, ID3D10Blob_GetBufferPointer(vsb), ID3D10Blob_GetBufferSize(vsb), NULL, &vs), "vs");
|
||||
CHECK(ID3D11Device_CreatePixelShader(dev, ID3D10Blob_GetBufferPointer(psb), ID3D10Blob_GetBufferSize(psb), NULL, &ps), "ps");
|
||||
D3D11_INPUT_ELEMENT_DESC ied = {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0};
|
||||
CHECK(ID3D11Device_CreateInputLayout(dev, &ied, 1, ID3D10Blob_GetBufferPointer(vsb), ID3D10Blob_GetBufferSize(vsb), &il), "layout");
|
||||
|
||||
// A triangle that covers the centre of the target and not the (0,0) corner pixel.
|
||||
const float verts[6] = {-0.5f, -0.5f, 0.0f, 0.6f, 0.5f, -0.5f};
|
||||
const unsigned short idx[3] = {0, 1, 2}; // clockwise in clip space (y up) = front face; D3D11 culls back faces by default
|
||||
ID3D11Buffer *vb, *ib;
|
||||
D3D11_BUFFER_DESC bd = {0}; D3D11_SUBRESOURCE_DATA sd = {0};
|
||||
bd.ByteWidth = sizeof verts; bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; sd.pSysMem = verts;
|
||||
CHECK(ID3D11Device_CreateBuffer(dev, &bd, &sd, &vb), "vb");
|
||||
bd.ByteWidth = sizeof idx; bd.BindFlags = D3D11_BIND_INDEX_BUFFER; sd.pSysMem = idx;
|
||||
CHECK(ID3D11Device_CreateBuffer(dev, &bd, &sd, &ib), "ib");
|
||||
|
||||
const UINT W = 640, H = 360;
|
||||
D3D11_TEXTURE2D_DESC td = {0};
|
||||
td.Width = W; td.Height = H; td.MipLevels = 1; td.ArraySize = 1;
|
||||
td.Format = DXGI_FORMAT_R8G8B8A8_UNORM; td.SampleDesc.Count = 1;
|
||||
td.Usage = D3D11_USAGE_DEFAULT; td.BindFlags = D3D11_BIND_RENDER_TARGET;
|
||||
ID3D11Texture2D *rt, *st; ID3D11RenderTargetView *rtv;
|
||||
CHECK(ID3D11Device_CreateTexture2D(dev, &td, NULL, &rt), "rt");
|
||||
td.Usage = D3D11_USAGE_STAGING; td.BindFlags = 0; td.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
CHECK(ID3D11Device_CreateTexture2D(dev, &td, NULL, &st), "staging");
|
||||
CHECK(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)rt, NULL, &rtv), "rtv");
|
||||
|
||||
D3D11_QUERY_DESC qd = {D3D11_QUERY_EVENT, 0};
|
||||
ID3D11Query *q; CHECK(ID3D11Device_CreateQuery(dev, &qd, &q), "query");
|
||||
|
||||
D3D11_VIEWPORT vp = {0, 0, (float)W, (float)H, 0, 1};
|
||||
const float clear[4] = {0, 0, 0, 1};
|
||||
UINT stride = 8, off = 0;
|
||||
LARGE_INTEGER freq, prev, now; QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&prev);
|
||||
for (int f = 0; f < frames; f++) {
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &rtv, NULL);
|
||||
ID3D11DeviceContext_RSSetViewports(ctx, 1, &vp);
|
||||
ID3D11DeviceContext_ClearRenderTargetView(ctx, rtv, clear);
|
||||
ID3D11DeviceContext_IASetInputLayout(ctx, il);
|
||||
ID3D11DeviceContext_IASetPrimitiveTopology(ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ID3D11DeviceContext_IASetVertexBuffers(ctx, 0, 1, &vb, &stride, &off);
|
||||
ID3D11DeviceContext_IASetIndexBuffer(ctx, ib, DXGI_FORMAT_R16_UINT, 0);
|
||||
ID3D11DeviceContext_VSSetShader(ctx, vs, NULL, 0);
|
||||
ID3D11DeviceContext_PSSetShader(ctx, ps, NULL, 0);
|
||||
ID3D11DeviceContext_DrawIndexed(ctx, 3, 0, 0);
|
||||
ID3D11DeviceContext_End(ctx, (ID3D11Asynchronous *)q);
|
||||
ID3D11DeviceContext_Flush(ctx);
|
||||
BOOL done = FALSE;
|
||||
while (ID3D11DeviceContext_GetData(ctx, (ID3D11Asynchronous *)q, &done, sizeof done, 0) != S_OK || !done) { }
|
||||
QueryPerformanceCounter(&now);
|
||||
printf("frame_ms %.4f\n", (double)(now.QuadPart - prev.QuadPart) * 1000.0 / (double)freq.QuadPart);
|
||||
prev = now;
|
||||
if (f == 0) {
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)st, (ID3D11Resource *)rt);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
CHECK(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)st, 0, D3D11_MAP_READ, 0, &m), "map");
|
||||
const unsigned char *c = (const unsigned char *)m.pData;
|
||||
const unsigned char *k = c + (size_t)(H / 2) * m.RowPitch + (W / 2) * 4;
|
||||
const float want[4] = {0.2f, 0.4f, 0.8f, 1.0f};
|
||||
int bad = 0;
|
||||
if (c[0] != 0 || c[1] != 0 || c[2] != 0 || c[3] != 255) {
|
||||
printf("FAIL corner pixel = %u %u %u %u, want 0 0 0 255\n", c[0], c[1], c[2], c[3]); bad = 1;
|
||||
}
|
||||
for (int ch = 0; ch < 4; ch++)
|
||||
if (fabsf(want[ch] * 255.0f + (negative ? 100.0f : 0.0f) - (float)k[ch]) > 0.6f) bad = 1;
|
||||
printf("centre pixel = %u %u %u %u\n", k[0], k[1], k[2], k[3]);
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)st, 0);
|
||||
if (bad) { printf("FAIL pixels\n"); return 1; }
|
||||
QueryPerformanceCounter(&prev);
|
||||
}
|
||||
}
|
||||
printf("PASS frames=%d\n", frames);
|
||||
return 0;
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Build the integrated workload with the pinned llvm-mingw (docs/research/hybrid-toolchain.md).
|
||||
# workloads/d3d11-integrated/build.sh <llvm-mingw-dir> [output-dir]
|
||||
set -eu
|
||||
TC=${1:?usage: build.sh LLVM_MINGW_DIR [OUTPUT_DIR]}
|
||||
src=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
||||
out=${2:-"$src/../../artifacts/hybrid-workloads/x86_64"}
|
||||
mkdir -p "$out"
|
||||
"$TC/bin/x86_64-w64-mingw32-clang" -std=c11 -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$out/d3d11-integrated.exe" "$src/integrated.c" \
|
||||
-ld3d11 -ldxgi -ldxguid -ld3dcompiler -lpsapi -luser32
|
||||
description=$(file -b "$out/d3d11-integrated.exe")
|
||||
echo "$description"
|
||||
case "$description" in
|
||||
*PE32+*x86-64*) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
Executable
+145
@@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Observe the integrated workload's window from macOS and compare what is on screen.
|
||||
|
||||
Runs the workload through `betterxen-hybrid run` with a hold period, finds its window with
|
||||
CGWindowList, captures only that window with `screencapture -l`, converts the capture to sRGB
|
||||
and samples the client area on a grid. This is evidence from outside the Windows program that
|
||||
the final frame reached the macOS compositor; the program's own read-back cannot show that.
|
||||
Needs the Screen Recording permission, `swift` and a logged-in GUI session. A missing
|
||||
permission or window is a failure, never a pass.
|
||||
|
||||
usage: check_window.py RUNNER BOTTLE EXE [--fault NAME] [--keep PNG]
|
||||
"""
|
||||
import argparse
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
TITLE = "BetterXen integrated workload"
|
||||
FRAMES = 128
|
||||
WINDOW_ID_SWIFT = """
|
||||
import CoreGraphics
|
||||
let all = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID) as? [[String: Any]] ?? []
|
||||
for w in all where (w[kCGWindowName as String] as? String) == "%s" {
|
||||
print(w[kCGWindowNumber as String]!)
|
||||
break
|
||||
}
|
||||
""" % TITLE
|
||||
|
||||
TEX_A = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 255)]
|
||||
TEX_B = [(255, 255, 0), (0, 255, 255), (255, 0, 255), (128, 128, 128)]
|
||||
|
||||
|
||||
def expected(x, y):
|
||||
"""Final frame after FRAMES frames and the scripted input (quad B moved by +16, +32)."""
|
||||
if y < 16:
|
||||
return (FRAMES & 255, FRAMES >> 8, 77)
|
||||
bx, by = 96 + 16, 96 + 32
|
||||
colour = None
|
||||
if bx <= x < bx + 128 and by <= y < by + 128:
|
||||
colour = TEX_B[(y - by) // 64 * 2 + (x - bx) // 64]
|
||||
elif 32 <= x < 160 and 32 <= y < 160:
|
||||
colour = TEX_A[(y - 32) // 64 * 2 + (x - 32) // 64]
|
||||
if colour is None:
|
||||
return (0, 0, 0)
|
||||
r, g, b = colour
|
||||
return (b, r, g)
|
||||
|
||||
|
||||
def read_bmp(path):
|
||||
data = path.read_bytes()
|
||||
if data[:2] != b"BM":
|
||||
raise ValueError("not a BMP")
|
||||
offset = struct.unpack_from("<I", data, 10)[0]
|
||||
width, height = struct.unpack_from("<ii", data, 18)
|
||||
bpp = struct.unpack_from("<H", data, 28)[0]
|
||||
if bpp not in (24, 32):
|
||||
raise ValueError(f"unsupported BMP depth {bpp}")
|
||||
step = bpp // 8
|
||||
stride = (width * step + 3) & ~3
|
||||
|
||||
def pixel(x, y):
|
||||
row = height - 1 - y if height > 0 else y
|
||||
at = offset + row * stride + x * step
|
||||
return (data[at + 2], data[at + 1], data[at])
|
||||
|
||||
return width, abs(height), pixel
|
||||
|
||||
|
||||
def compare(png, scratch):
|
||||
"""Return (samples, mismatches, first mismatch) for one capture."""
|
||||
bmp = scratch / "capture.bmp"
|
||||
subprocess.run(["/usr/bin/sips", "--matchTo", "/System/Library/ColorSync/Profiles/sRGB Profile.icc",
|
||||
"-s", "format", "bmp", str(png), "--out", str(bmp)],
|
||||
check=True, capture_output=True)
|
||||
width, height, pixel = read_bmp(bmp)
|
||||
scale = width / 256
|
||||
top = height - round(256 * scale) # the title bar is above the client area
|
||||
if scale < 1 or top < 0:
|
||||
raise ValueError(f"unexpected capture size {width}x{height}")
|
||||
samples, bad, first = 0, 0, None
|
||||
for y in range(4, 256, 8):
|
||||
for x in range(4, 256, 8):
|
||||
if y > 236 and (x < 20 or x > 236):
|
||||
continue # rounded window corners
|
||||
got = pixel(int((x + 0.5) * scale), top + int((y + 0.5) * scale))
|
||||
want = expected(x, y)
|
||||
samples += 1
|
||||
if any(abs(g - w) > 6 for g, w in zip(got, want)):
|
||||
bad += 1
|
||||
first = first or (x, y, got, want)
|
||||
return samples, bad, first
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("runner")
|
||||
p.add_argument("bottle")
|
||||
p.add_argument("exe")
|
||||
# only faults that change the rendered image are meaningful here; "color" corrupts the
|
||||
# program's expectation and leaves the screen correct
|
||||
p.add_argument("--fault", choices=["blank", "depth", "stale"])
|
||||
p.add_argument("--keep")
|
||||
a = p.parse_args()
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
scratch = Path(tmp)
|
||||
script = scratch / "window_id.swift"
|
||||
script.write_text(WINDOW_ID_SWIFT)
|
||||
workload = [a.exe, "--frames", str(FRAMES), "--hold-ms", "12000"]
|
||||
if a.fault:
|
||||
workload += ["--fault", a.fault]
|
||||
log = open(scratch / "run.json", "w+")
|
||||
run = subprocess.Popen([a.runner, "run", "--bottle", a.bottle, "--timeout", "90", "--"] + workload,
|
||||
stdout=log, stderr=subprocess.DEVNULL)
|
||||
result = None
|
||||
deadline = time.time() + 60
|
||||
while time.time() < deadline and run.poll() is None:
|
||||
wid = subprocess.run(["swift", str(script)], capture_output=True, text=True).stdout.strip()
|
||||
if wid.isdigit():
|
||||
png = scratch / "window.png"
|
||||
if subprocess.run(["/usr/sbin/screencapture", "-x", "-o", "-l" + wid, str(png)],
|
||||
capture_output=True).returncode == 0 and png.exists():
|
||||
result = compare(png, scratch)
|
||||
if a.keep:
|
||||
Path(a.keep).write_bytes(png.read_bytes())
|
||||
if result[1] == 0:
|
||||
break
|
||||
time.sleep(0.5)
|
||||
run.wait(timeout=120)
|
||||
if result is None:
|
||||
print("FAIL window: no window was captured (permission, GUI session or window missing)")
|
||||
return 1
|
||||
samples, bad, first = result
|
||||
if bad:
|
||||
print(f"FAIL window: {bad} of {samples} samples differ, first (x, y, got, want) = {first}")
|
||||
return 1
|
||||
print(f"PASS window: {samples} of {samples} on-screen samples match the expected final frame")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,720 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #365): one Windows program that exercises runtime
|
||||
// services and a presenting Direct3D 11 pipeline together, and verifies its own output.
|
||||
//
|
||||
// It is meant to be launched through `betterxen-hybrid run`. Every stage prints one line
|
||||
// gate <name> pass|FAIL <detail>
|
||||
// and the final line is `PASS integrated ...` only if every stage passed.
|
||||
//
|
||||
// Rendering, per frame:
|
||||
// pass 1 two textured quads into an offscreen target with a depth buffer. The near quad B
|
||||
// is drawn FIRST, so the far quad A is visible in the overlap only if depth is
|
||||
// ignored. Arrow keys move quad B in 16-pixel steps.
|
||||
// pass 2 a compute shader rotates the colour channels (r,g,b) -> (b,r,g) into a UAV and
|
||||
// writes a 16-row band that encodes the frame number produced by a second thread.
|
||||
// pass 3 a full-screen triangle copies that texture to the swapchain back buffer.
|
||||
// The back buffer is read back before Present and compared, pixel by pixel and with zero
|
||||
// tolerance, with an image computed here on the CPU from the authored texels and rectangles.
|
||||
// All colour channels are 0, 128, 255 or an integer/255 value, so no rounding is involved.
|
||||
//
|
||||
// Limits of what this shows: the read-back proves the content handed to Present, and Present
|
||||
// returning success proves the call was accepted. Neither proves what reached the screen.
|
||||
// Input is delivered with PostMessage inside the Windows environment; it does not test the
|
||||
// macOS keyboard path unless a person runs `--interactive`.
|
||||
//
|
||||
// usage: integrated.exe [--frames N] [--verify-every N] [--vsync] [--interactive]
|
||||
// [--hold-ms N] [--max-growth-mb N]
|
||||
// [--fault color|blank|stale|input|depth|crash|hang]
|
||||
// crash and hang are for testing the supervisor: they happen after the first verified frame.
|
||||
// Exit: 0 pass, 1 a verification failed, 2 no graphics device, 3 an API call failed.
|
||||
#define COBJMACROS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define W 256
|
||||
#define H 256
|
||||
#define BAND 16
|
||||
#define STEP 16
|
||||
#define WORKERS 4
|
||||
#define RELEASE(p, vt) do { if (p) { vt##_Release(p); (p) = NULL; } } while (0)
|
||||
|
||||
static int failures;
|
||||
static LARGE_INTEGER qpc_freq, qpc_start;
|
||||
|
||||
static double now_ms(void) {
|
||||
LARGE_INTEGER t;
|
||||
QueryPerformanceCounter(&t);
|
||||
return (double)(t.QuadPart - qpc_start.QuadPart) * 1000.0 / (double)qpc_freq.QuadPart;
|
||||
}
|
||||
|
||||
static void gate(const char *name, int ok, const char *detail) {
|
||||
printf("gate %s %s %s t_ms=%.1f\n", name, ok ? "pass" : "FAIL", detail, now_ms());
|
||||
if (!ok) failures++;
|
||||
}
|
||||
|
||||
#define API(x, what) do { HRESULT hr_ = (x); if (FAILED(hr_)) { \
|
||||
printf("FAIL api %s hr=0x%08lx\n", what, (unsigned long)hr_); exit(3); } } while (0)
|
||||
#define WIN(x, what) do { if (!(x)) { \
|
||||
printf("FAIL api %s error=%lu\n", what, (unsigned long)GetLastError()); exit(3); } } while (0)
|
||||
|
||||
/* ---- runtime services ------------------------------------------------------------------ */
|
||||
|
||||
static DWORD tls_slot;
|
||||
static CRITICAL_SECTION lock;
|
||||
static volatile LONG interlocked_total;
|
||||
static unsigned long long locked_total;
|
||||
|
||||
static DWORD WINAPI worker(LPVOID arg) {
|
||||
const unsigned id = (unsigned)(uintptr_t)arg;
|
||||
TlsSetValue(tls_slot, (LPVOID)(uintptr_t)(id + 1));
|
||||
unsigned long long local = 0;
|
||||
for (unsigned i = 1; i <= 10000; i++) {
|
||||
local += i;
|
||||
InterlockedIncrement(&interlocked_total);
|
||||
Sleep(0);
|
||||
}
|
||||
EnterCriticalSection(&lock);
|
||||
locked_total += local * (uintptr_t)TlsGetValue(tls_slot);
|
||||
LeaveCriticalSection(&lock);
|
||||
return (uintptr_t)TlsGetValue(tls_slot) == id + 1 ? 0 : 1;
|
||||
}
|
||||
|
||||
static void check_threads(void) {
|
||||
HANDLE t[WORKERS];
|
||||
InitializeCriticalSection(&lock);
|
||||
tls_slot = TlsAlloc();
|
||||
WIN(tls_slot != TLS_OUT_OF_INDEXES, "TlsAlloc");
|
||||
for (unsigned i = 0; i < WORKERS; i++) {
|
||||
t[i] = CreateThread(NULL, 0, worker, (LPVOID)(uintptr_t)i, 0, NULL);
|
||||
WIN(t[i], "CreateThread");
|
||||
}
|
||||
int ok = WaitForMultipleObjects(WORKERS, t, TRUE, 60000) == WAIT_OBJECT_0;
|
||||
for (unsigned i = 0; i < WORKERS; i++) {
|
||||
DWORD code = 99;
|
||||
ok = ok && GetExitCodeThread(t[i], &code) && code == 0;
|
||||
CloseHandle(t[i]);
|
||||
}
|
||||
/* each worker sums 1..10000 = 50005000, weighted by id+1: 1+2+3+4 = 10 */
|
||||
ok = ok && locked_total == 500050000ULL && interlocked_total == WORKERS * 10000;
|
||||
TlsFree(tls_slot);
|
||||
DeleteCriticalSection(&lock);
|
||||
gate("runtime.threads", ok, "workers=4 tls critical_section interlocked wait");
|
||||
}
|
||||
|
||||
static volatile LONG faults_seen;
|
||||
static unsigned char *fault_page;
|
||||
|
||||
static LONG CALLBACK on_fault(EXCEPTION_POINTERS *e) {
|
||||
const EXCEPTION_RECORD *r = e->ExceptionRecord;
|
||||
if (r->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && r->NumberParameters >= 2 &&
|
||||
r->ExceptionInformation[0] == 1 && r->ExceptionInformation[1] == (ULONG_PTR)fault_page) {
|
||||
DWORD old;
|
||||
InterlockedIncrement(&faults_seen);
|
||||
if (VirtualProtect(fault_page, 4096, PAGE_READWRITE, &old)) return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
static void check_memory(void) {
|
||||
const size_t n = 16u << 20;
|
||||
unsigned char *p = VirtualAlloc(NULL, n, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
WIN(p, "VirtualAlloc");
|
||||
for (size_t i = 0; i < n; i += 997) p[i] = (unsigned char)(i * 31);
|
||||
int ok = 1;
|
||||
for (size_t i = 0; i < n; i += 997) ok = ok && p[i] == (unsigned char)(i * 31);
|
||||
MEMORY_BASIC_INFORMATION mi;
|
||||
DWORD old = 0;
|
||||
ok = ok && VirtualProtect(p, 4096, PAGE_READONLY, &old) && old == PAGE_READWRITE;
|
||||
ok = ok && VirtualQuery(p, &mi, sizeof mi) == sizeof mi && mi.Protect == PAGE_READONLY;
|
||||
gate("runtime.memory", ok, "alloc=16MiB protect query");
|
||||
|
||||
fault_page = p;
|
||||
PVOID h = AddVectoredExceptionHandler(1, on_fault);
|
||||
WIN(h, "AddVectoredExceptionHandler");
|
||||
*(volatile unsigned char *)p = 0x5a; /* faults once, handler makes the page writable */
|
||||
const int caught = faults_seen == 1 && p[0] == 0x5a;
|
||||
RemoveVectoredExceptionHandler(h);
|
||||
gate("runtime.exceptions", caught, "write to read-only page handled and resumed");
|
||||
VirtualFree(p, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
static void check_time(void) {
|
||||
const double a = now_ms();
|
||||
const ULONGLONG ta = GetTickCount64();
|
||||
Sleep(50);
|
||||
const double d = now_ms() - a;
|
||||
const ULONGLONG td = GetTickCount64() - ta;
|
||||
char msg[96];
|
||||
snprintf(msg, sizeof msg, "sleep=50ms qpc=%.1fms tick=%llums", d, td);
|
||||
/* timer granularity may shorten by a tick; a loaded host may lengthen a lot */
|
||||
gate("runtime.time", d >= 45.0 && d < 5000.0 && td >= 30, msg);
|
||||
}
|
||||
|
||||
static void check_files(void) {
|
||||
char tmp[MAX_PATH], dir[MAX_PATH], a[MAX_PATH], b[MAX_PATH];
|
||||
WIN(GetTempPathA(sizeof tmp, tmp), "GetTempPath");
|
||||
snprintf(dir, sizeof dir, "%sbx-integrated-%lu", tmp, (unsigned long)GetCurrentProcessId());
|
||||
WIN(CreateDirectoryA(dir, NULL), "CreateDirectory");
|
||||
snprintf(a, sizeof a, "%s\\a.bin", dir);
|
||||
snprintf(b, sizeof b, "%s\\b.bin", dir);
|
||||
static unsigned char out[65536], in[65536];
|
||||
for (size_t i = 0; i < sizeof out; i++) out[i] = (unsigned char)(i ^ (i >> 7));
|
||||
DWORD n = 0;
|
||||
HANDLE f = CreateFileA(a, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
WIN(f != INVALID_HANDLE_VALUE, "CreateFile write");
|
||||
int ok = WriteFile(f, out, sizeof out, &n, NULL) && n == sizeof out && FlushFileBuffers(f);
|
||||
CloseHandle(f);
|
||||
ok = ok && MoveFileA(a, b) && GetFileAttributesA(a) == INVALID_FILE_ATTRIBUTES;
|
||||
f = CreateFileA(b, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
ok = ok && f != INVALID_HANDLE_VALUE;
|
||||
if (f != INVALID_HANDLE_VALUE) {
|
||||
LARGE_INTEGER pos = {.QuadPart = 4096};
|
||||
ok = ok && ReadFile(f, in, sizeof in, &n, NULL) && n == sizeof in && !memcmp(in, out, sizeof in);
|
||||
ok = ok && SetFilePointerEx(f, pos, NULL, FILE_BEGIN) && ReadFile(f, in, 16, &n, NULL) &&
|
||||
n == 16 && !memcmp(in, out + 4096, 16);
|
||||
CloseHandle(f);
|
||||
}
|
||||
ok = DeleteFileA(b) && ok;
|
||||
ok = RemoveDirectoryA(dir) && ok;
|
||||
gate("runtime.files", ok, "create write flush rename read seek delete in GetTempPath");
|
||||
}
|
||||
|
||||
/* ---- window, input and the frame producer thread --------------------------------------- */
|
||||
|
||||
static int off_x, off_y, keys_seen, quit_requested;
|
||||
|
||||
static LRESULT CALLBACK wndproc(HWND h, UINT m, WPARAM w, LPARAM l) {
|
||||
if (m == WM_KEYDOWN) {
|
||||
if (w == VK_ESCAPE) quit_requested = 1;
|
||||
else {
|
||||
int dx = w == VK_RIGHT ? STEP : w == VK_LEFT ? -STEP : 0;
|
||||
int dy = w == VK_DOWN ? STEP : w == VK_UP ? -STEP : 0;
|
||||
if (dx || dy) {
|
||||
keys_seen++;
|
||||
off_x += dx;
|
||||
off_y += dy;
|
||||
if (off_x < -64) off_x = -64;
|
||||
if (off_x > 32) off_x = 32;
|
||||
if (off_y < -64) off_y = -64;
|
||||
if (off_y > 32) off_y = 32;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (m == WM_CLOSE) { quit_requested = 1; return 0; }
|
||||
return DefWindowProcA(h, m, w, l);
|
||||
}
|
||||
|
||||
static void pump(void) {
|
||||
MSG msg;
|
||||
while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
static HANDLE ev_request, ev_ready;
|
||||
static volatile LONG producer_stop;
|
||||
static unsigned requested_frame, produced_value;
|
||||
|
||||
static DWORD WINAPI producer(LPVOID unused) {
|
||||
(void)unused;
|
||||
for (;;) {
|
||||
if (WaitForSingleObject(ev_request, INFINITE) != WAIT_OBJECT_0) return 1;
|
||||
if (producer_stop) return 0;
|
||||
produced_value = (requested_frame + 1) & 0xffff; /* never 0, so a stale 0 is visible */
|
||||
SetEvent(ev_ready);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- expected image (CPU, independent of the shaders) ---------------------------------- */
|
||||
|
||||
static const unsigned char TEX_A[4][4] = {
|
||||
{255, 0, 0, 255}, {0, 255, 0, 255}, {0, 0, 255, 255}, {255, 255, 255, 255}};
|
||||
static const unsigned char TEX_B[4][4] = {
|
||||
{255, 255, 0, 255}, {0, 255, 255, 255}, {255, 0, 255, 255}, {128, 128, 128, 255}};
|
||||
|
||||
static void expected_pixel(int x, int y, unsigned marker, int bx, int by, int wrong, unsigned char out[4]) {
|
||||
if (y < BAND) {
|
||||
out[0] = (unsigned char)(marker & 255);
|
||||
out[1] = (unsigned char)(marker >> 8);
|
||||
out[2] = 77;
|
||||
out[3] = 255;
|
||||
return;
|
||||
}
|
||||
const unsigned char *c = NULL;
|
||||
/* quad B is nearer, so it wins wherever it covers the pixel */
|
||||
if (x >= bx && x < bx + 128 && y >= by && y < by + 128)
|
||||
c = TEX_B[((y - by) / 64) * 2 + (x - bx) / 64];
|
||||
else if (x >= 32 && x < 160 && y >= 32 && y < 160)
|
||||
c = TEX_A[((y - 32) / 64) * 2 + (x - 32) / 64];
|
||||
out[0] = c ? c[2] : 0;
|
||||
out[1] = c ? c[0] : 0;
|
||||
out[2] = c ? c[1] : 0;
|
||||
out[3] = 255;
|
||||
if (wrong && c == TEX_A[0]) out[0] ^= 255; /* negative control: one texel region */
|
||||
}
|
||||
|
||||
/* ---- Direct3D -------------------------------------------------------------------------- */
|
||||
|
||||
static const char *HLSL =
|
||||
"cbuffer C : register(b0) { float2 offset; uint marker; uint pad; };\n"
|
||||
"Texture2D tex : register(t0); SamplerState smp : register(s0);\n"
|
||||
"struct VI { float3 p : POSITION; float2 uv : TEXCOORD; };\n"
|
||||
"struct VO { float4 p : SV_Position; float2 uv : TEXCOORD; };\n"
|
||||
"VO vs_quad(VI v) { VO o; o.p = float4(v.p.xy + offset, v.p.z, 1); o.uv = v.uv; return o; }\n"
|
||||
"float4 ps_quad(VO i) : SV_Target { return tex.Sample(smp, i.uv); }\n"
|
||||
"float4 vs_full(uint id : SV_VertexID) : SV_Position {\n"
|
||||
" float2 uv = float2((id << 1) & 2, id & 2);\n"
|
||||
" return float4(uv * float2(2, -2) + float2(-1, 1), 0, 1); }\n"
|
||||
"float4 ps_full(float4 p : SV_Position) : SV_Target { return tex.Load(int3(p.xy, 0)); }\n"
|
||||
"RWTexture2D<unorm float4> dst : register(u0);\n"
|
||||
"[numthreads(8, 8, 1)] void cs_main(uint3 id : SV_DispatchThreadID) {\n"
|
||||
" if (id.y < 16) { dst[id.xy] = float4((marker & 255) / 255.0, (marker >> 8) / 255.0, 77 / 255.0, 1); return; }\n"
|
||||
" float4 c = tex.Load(int3(id.xy, 0));\n"
|
||||
" dst[id.xy] = float4(c.b, c.r, c.g, 1); }\n";
|
||||
|
||||
static ID3DBlob *compile(const char *entry, const char *target) {
|
||||
ID3DBlob *code = NULL, *err = NULL;
|
||||
HRESULT hr = D3DCompile(HLSL, strlen(HLSL), NULL, NULL, NULL, entry, target, 0, 0, &code, &err);
|
||||
if (FAILED(hr)) {
|
||||
printf("FAIL api D3DCompile %s hr=0x%08lx %s\n", entry, (unsigned long)hr,
|
||||
err ? (const char *)ID3D10Blob_GetBufferPointer(err) : "");
|
||||
exit(3);
|
||||
}
|
||||
if (err) ID3D10Blob_Release(err);
|
||||
return code;
|
||||
}
|
||||
|
||||
typedef struct { float x, y, z, u, v; } Vertex;
|
||||
typedef struct { float ox, oy; unsigned marker, pad; } Constants;
|
||||
|
||||
static void quad(Vertex *v, int x0, int y0, float z) {
|
||||
const float l = x0 / 128.0f - 1.0f, r = (x0 + 128) / 128.0f - 1.0f;
|
||||
const float t = 1.0f - y0 / 128.0f, b = 1.0f - (y0 + 128) / 128.0f;
|
||||
v[0] = (Vertex){l, t, z, 0, 0};
|
||||
v[1] = (Vertex){r, t, z, 1, 0};
|
||||
v[2] = (Vertex){l, b, z, 0, 1};
|
||||
v[3] = (Vertex){r, b, z, 1, 1};
|
||||
}
|
||||
|
||||
/* Working set in MiB. Wine on macOS (CrossOver 26.3) returns PrivateUsage = 0 and an implausible
|
||||
* PagefileUsage, so only the working set is used; a zero reading is "unavailable", never "no growth". */
|
||||
static double working_set_mb(void) {
|
||||
PROCESS_MEMORY_COUNTERS m;
|
||||
memset(&m, 0, sizeof m);
|
||||
if (!GetProcessMemoryInfo(GetCurrentProcess(), &m, sizeof m) || !m.WorkingSetSize) return -1.0;
|
||||
return (double)m.WorkingSetSize / (1024.0 * 1024.0);
|
||||
}
|
||||
|
||||
static ID3D11Texture2D *texture(ID3D11Device *dev, UINT w, UINT h, DXGI_FORMAT fmt, UINT bind,
|
||||
D3D11_USAGE usage, UINT cpu, const void *init) {
|
||||
D3D11_TEXTURE2D_DESC d = {.Width = w, .Height = h, .MipLevels = 1, .ArraySize = 1, .Format = fmt,
|
||||
.SampleDesc = {1, 0}, .Usage = usage, .BindFlags = bind,
|
||||
.CPUAccessFlags = cpu};
|
||||
D3D11_SUBRESOURCE_DATA s = {.pSysMem = init, .SysMemPitch = w * 4};
|
||||
ID3D11Texture2D *t = NULL;
|
||||
API(ID3D11Device_CreateTexture2D(dev, &d, init ? &s : NULL, &t), "CreateTexture2D");
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Create, fill, copy, read back and release resources; returns 1 if the contents survived. */
|
||||
static int churn(ID3D11Device *dev, ID3D11DeviceContext *ctx, unsigned seed) {
|
||||
static unsigned data[256 * 256];
|
||||
for (unsigned i = 0; i < 256 * 256; i++) data[i] = i * 2654435761u + seed;
|
||||
ID3D11Texture2D *src = texture(dev, 256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_USAGE_DEFAULT, 0, data);
|
||||
ID3D11Texture2D *dst = texture(dev, 256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_USAGE_STAGING,
|
||||
D3D11_CPU_ACCESS_READ, NULL);
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)dst, (ID3D11Resource *)src);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
API(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)dst, 0, D3D11_MAP_READ, 0, &m), "Map churn");
|
||||
int ok = 1;
|
||||
for (unsigned y = 0; y < 256; y++)
|
||||
ok = ok && !memcmp((const char *)m.pData + (size_t)y * m.RowPitch, data + y * 256, 1024);
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)dst, 0);
|
||||
ID3D11Texture2D_Release(src);
|
||||
ID3D11Texture2D_Release(dst);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int frames = 600, verify_every = 30, vsync = 0, interactive = 0, hold_ms = 0, max_growth = 64;
|
||||
const char *fault = "";
|
||||
setvbuf(stdout, NULL, _IONBF, 0); /* the supervisor detects stalls from output growth */
|
||||
QueryPerformanceFrequency(&qpc_freq);
|
||||
QueryPerformanceCounter(&qpc_start);
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *a = argv[i], *v = i + 1 < argc ? argv[i + 1] : NULL;
|
||||
if (!strcmp(a, "--vsync")) vsync = 1;
|
||||
else if (!strcmp(a, "--interactive")) interactive = 1;
|
||||
else if (!strcmp(a, "--frames") && v) frames = atoi(v), i++;
|
||||
else if (!strcmp(a, "--verify-every") && v) verify_every = atoi(v), i++;
|
||||
else if (!strcmp(a, "--hold-ms") && v) hold_ms = atoi(v), i++;
|
||||
else if (!strcmp(a, "--max-growth-mb") && v) max_growth = atoi(v), i++;
|
||||
else if (!strcmp(a, "--fault") && v &&
|
||||
(!strcmp(v, "color") || !strcmp(v, "blank") || !strcmp(v, "stale") ||
|
||||
!strcmp(v, "input") || !strcmp(v, "depth") || !strcmp(v, "crash") || !strcmp(v, "hang")))
|
||||
fault = v, i++;
|
||||
else { printf("FAIL usage: unknown or incomplete argument %s\n", a); return 3; }
|
||||
}
|
||||
if (frames < 64 || verify_every < 1) { printf("FAIL usage: --frames >= 64, --verify-every >= 1\n"); return 3; }
|
||||
|
||||
check_threads();
|
||||
check_memory();
|
||||
check_time();
|
||||
check_files();
|
||||
|
||||
WNDCLASSA wc = {.lpfnWndProc = wndproc, .hInstance = GetModuleHandleA(NULL),
|
||||
.lpszClassName = "BetterXenIntegrated"};
|
||||
WIN(RegisterClassA(&wc), "RegisterClass");
|
||||
RECT r = {0, 0, W, H};
|
||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
HWND hwnd = CreateWindowA(wc.lpszClassName, "BetterXen integrated workload",
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 64, 64, r.right - r.left,
|
||||
r.bottom - r.top, NULL, NULL, wc.hInstance, NULL);
|
||||
WIN(hwnd, "CreateWindow");
|
||||
pump();
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC sd = {.BufferDesc = {.Width = W, .Height = H, .Format = DXGI_FORMAT_R8G8B8A8_UNORM},
|
||||
.SampleDesc = {1, 0}, .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT,
|
||||
.BufferCount = 2, .OutputWindow = hwnd, .Windowed = TRUE,
|
||||
.SwapEffect = DXGI_SWAP_EFFECT_DISCARD};
|
||||
ID3D11Device *dev = NULL;
|
||||
ID3D11DeviceContext *ctx = NULL;
|
||||
IDXGISwapChain *swap = NULL;
|
||||
D3D_FEATURE_LEVEL fl, want = D3D_FEATURE_LEVEL_11_0;
|
||||
HRESULT hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &want, 1,
|
||||
D3D11_SDK_VERSION, &sd, &swap, &dev, &fl, &ctx);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
{
|
||||
IDXGIDevice *dd = NULL;
|
||||
IDXGIAdapter *ad = NULL;
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(ID3D11Device_QueryInterface(dev, &IID_IDXGIDevice, (void **)&dd)) &&
|
||||
SUCCEEDED(IDXGIDevice_GetAdapter(dd, &ad)) && SUCCEEDED(IDXGIAdapter_GetDesc(ad, &desc))) {
|
||||
char name[128];
|
||||
size_t i = 0;
|
||||
for (; i < 127 && desc.Description[i]; i++) name[i] = (char)desc.Description[i];
|
||||
name[i] = 0;
|
||||
printf("adapter=%s vendor=0x%x\n", name, desc.VendorId);
|
||||
}
|
||||
RELEASE(ad, IDXGIAdapter);
|
||||
RELEASE(dd, IDXGIDevice);
|
||||
}
|
||||
|
||||
ID3D11Texture2D *back = NULL;
|
||||
API(IDXGISwapChain_GetBuffer(swap, 0, &IID_ID3D11Texture2D, (void **)&back), "GetBuffer");
|
||||
ID3D11RenderTargetView *back_rtv = NULL, *off_rtv = NULL;
|
||||
API(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)back, NULL, &back_rtv), "back rtv");
|
||||
ID3D11Texture2D *off = texture(dev, W, H, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_USAGE_DEFAULT, 0, NULL);
|
||||
ID3D11Texture2D *post = texture(dev, W, H, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_USAGE_DEFAULT, 0, NULL);
|
||||
ID3D11Texture2D *depth = texture(dev, W, H, DXGI_FORMAT_D32_FLOAT, D3D11_BIND_DEPTH_STENCIL,
|
||||
D3D11_USAGE_DEFAULT, 0, NULL);
|
||||
ID3D11Texture2D *staging = texture(dev, W, H, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_USAGE_STAGING,
|
||||
D3D11_CPU_ACCESS_READ, NULL);
|
||||
ID3D11Texture2D *ta = texture(dev, 2, 2, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_USAGE_IMMUTABLE, 0, TEX_A);
|
||||
ID3D11Texture2D *tb = texture(dev, 2, 2, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_USAGE_IMMUTABLE, 0, TEX_B);
|
||||
ID3D11DepthStencilView *dsv = NULL;
|
||||
ID3D11ShaderResourceView *off_srv, *post_srv, *ta_srv, *tb_srv;
|
||||
ID3D11UnorderedAccessView *post_uav = NULL;
|
||||
API(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)off, NULL, &off_rtv), "off rtv");
|
||||
API(ID3D11Device_CreateDepthStencilView(dev, (ID3D11Resource *)depth, NULL, &dsv), "dsv");
|
||||
API(ID3D11Device_CreateShaderResourceView(dev, (ID3D11Resource *)off, NULL, &off_srv), "off srv");
|
||||
API(ID3D11Device_CreateShaderResourceView(dev, (ID3D11Resource *)post, NULL, &post_srv), "post srv");
|
||||
API(ID3D11Device_CreateShaderResourceView(dev, (ID3D11Resource *)ta, NULL, &ta_srv), "a srv");
|
||||
API(ID3D11Device_CreateShaderResourceView(dev, (ID3D11Resource *)tb, NULL, &tb_srv), "b srv");
|
||||
API(ID3D11Device_CreateUnorderedAccessView(dev, (ID3D11Resource *)post, NULL, &post_uav), "uav");
|
||||
|
||||
Vertex verts[8];
|
||||
quad(verts, 96, 96, 0.25f); /* B, near, vertices 0..3 */
|
||||
quad(verts + 4, 32, 32, 0.5f); /* A, far, vertices 4..7 */
|
||||
const unsigned short indices[6] = {0, 1, 2, 2, 1, 3};
|
||||
ID3D11Buffer *vb, *ib, *cb;
|
||||
D3D11_BUFFER_DESC bd = {.ByteWidth = sizeof verts, .BindFlags = D3D11_BIND_VERTEX_BUFFER};
|
||||
D3D11_SUBRESOURCE_DATA init = {.pSysMem = verts};
|
||||
API(ID3D11Device_CreateBuffer(dev, &bd, &init, &vb), "vb");
|
||||
bd.ByteWidth = sizeof indices;
|
||||
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
init.pSysMem = indices;
|
||||
API(ID3D11Device_CreateBuffer(dev, &bd, &init, &ib), "ib");
|
||||
bd.ByteWidth = sizeof(Constants);
|
||||
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
API(ID3D11Device_CreateBuffer(dev, &bd, NULL, &cb), "cb");
|
||||
|
||||
D3D11_SAMPLER_DESC smpd = {.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT,
|
||||
.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP,
|
||||
.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP,
|
||||
.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP,
|
||||
.ComparisonFunc = D3D11_COMPARISON_NEVER, .MaxLOD = D3D11_FLOAT32_MAX};
|
||||
ID3D11SamplerState *sampler;
|
||||
API(ID3D11Device_CreateSamplerState(dev, &smpd, &sampler), "sampler");
|
||||
D3D11_DEPTH_STENCIL_DESC dsd = {.DepthEnable = strcmp(fault, "depth") != 0,
|
||||
.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL,
|
||||
.DepthFunc = D3D11_COMPARISON_LESS};
|
||||
ID3D11DepthStencilState *depth_state;
|
||||
API(ID3D11Device_CreateDepthStencilState(dev, &dsd, &depth_state), "depth state");
|
||||
D3D11_QUERY_DESC qd = {D3D11_QUERY_EVENT, 0};
|
||||
ID3D11Query *query;
|
||||
API(ID3D11Device_CreateQuery(dev, &qd, &query), "query");
|
||||
gate("graphics.init", 1, "window swapchain targets depth textures buffers views states");
|
||||
|
||||
ID3DBlob *b_vsq = compile("vs_quad", "vs_5_0"), *b_psq = compile("ps_quad", "ps_5_0");
|
||||
ID3DBlob *b_vsf = compile("vs_full", "vs_5_0"), *b_psf = compile("ps_full", "ps_5_0");
|
||||
ID3DBlob *b_cs = compile("cs_main", "cs_5_0");
|
||||
#define PTR(b) ID3D10Blob_GetBufferPointer(b)
|
||||
#define LEN(b) ID3D10Blob_GetBufferSize(b)
|
||||
ID3D11VertexShader *vsq, *vsf;
|
||||
ID3D11PixelShader *psq, *psf;
|
||||
ID3D11ComputeShader *cs;
|
||||
ID3D11InputLayout *layout;
|
||||
API(ID3D11Device_CreateVertexShader(dev, PTR(b_vsq), LEN(b_vsq), NULL, &vsq), "vs quad");
|
||||
API(ID3D11Device_CreatePixelShader(dev, PTR(b_psq), LEN(b_psq), NULL, &psq), "ps quad");
|
||||
API(ID3D11Device_CreateVertexShader(dev, PTR(b_vsf), LEN(b_vsf), NULL, &vsf), "vs full");
|
||||
API(ID3D11Device_CreatePixelShader(dev, PTR(b_psf), LEN(b_psf), NULL, &psf), "ps full");
|
||||
API(ID3D11Device_CreateComputeShader(dev, PTR(b_cs), LEN(b_cs), NULL, &cs), "cs");
|
||||
const D3D11_INPUT_ELEMENT_DESC ied[2] = {
|
||||
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}};
|
||||
API(ID3D11Device_CreateInputLayout(dev, ied, 2, PTR(b_vsq), LEN(b_vsq), &layout), "input layout");
|
||||
ID3D10Blob_Release(b_vsq);
|
||||
ID3D10Blob_Release(b_psq);
|
||||
ID3D10Blob_Release(b_vsf);
|
||||
ID3D10Blob_Release(b_psf);
|
||||
ID3D10Blob_Release(b_cs);
|
||||
gate("shader.compile", 1, "vs ps cs compiled and created (shader model 5.0)");
|
||||
|
||||
ev_request = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
ev_ready = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
WIN(ev_request && ev_ready, "CreateEvent");
|
||||
HANDLE prod = CreateThread(NULL, 0, producer, NULL, 0, NULL);
|
||||
WIN(prod, "CreateThread producer");
|
||||
|
||||
/* Scripted input: right, right, down, left, down, delivered at fixed frames. */
|
||||
static const WPARAM script[5] = {VK_RIGHT, VK_RIGHT, VK_DOWN, VK_LEFT, VK_DOWN};
|
||||
int injected = 0, verified = 0, bad_frames = 0, presented = 0, churns = 0, churn_ok = 1;
|
||||
unsigned long long digest = 1469598103934665603ULL; /* FNV-1a over verified pixels */
|
||||
double mem_warm = -1.0, mem_peak = 0.0, prev = now_ms();
|
||||
const int warmup = frames / 5;
|
||||
const D3D11_VIEWPORT vp = {0, 0, W, H, 0, 1};
|
||||
const float black[4] = {0, 0, 0, 1};
|
||||
const UINT stride = sizeof(Vertex), zero = 0;
|
||||
ID3D11ShaderResourceView *no_srv = NULL;
|
||||
ID3D11UnorderedAccessView *no_uav = NULL;
|
||||
ID3D11RenderTargetView *no_rtv = NULL;
|
||||
|
||||
int f = 0;
|
||||
for (; f < frames && !quit_requested; f++) {
|
||||
if (!interactive && strcmp(fault, "input") && injected < 5 && f == (injected + 1) * (frames / 8)) {
|
||||
WIN(PostMessageA(hwnd, WM_KEYDOWN, script[injected], 0), "PostMessage");
|
||||
injected++;
|
||||
}
|
||||
pump();
|
||||
requested_frame = (unsigned)f;
|
||||
SetEvent(ev_request);
|
||||
WIN(WaitForSingleObject(ev_ready, 10000) == WAIT_OBJECT_0, "producer handoff");
|
||||
const unsigned marker = produced_value;
|
||||
const int bx = 96 + off_x, by = 96 + off_y;
|
||||
|
||||
Constants k = {off_x / 128.0f, -off_y / 128.0f, strcmp(fault, "stale") ? marker : 1u, 0};
|
||||
ID3D11DeviceContext_UpdateSubresource(ctx, (ID3D11Resource *)cb, 0, NULL, &k, 0, 0);
|
||||
|
||||
/* pass 1 */
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &off_rtv, dsv);
|
||||
ID3D11DeviceContext_OMSetDepthStencilState(ctx, depth_state, 0);
|
||||
ID3D11DeviceContext_ClearRenderTargetView(ctx, off_rtv, black);
|
||||
ID3D11DeviceContext_ClearDepthStencilView(ctx, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0);
|
||||
ID3D11DeviceContext_RSSetViewports(ctx, 1, &vp);
|
||||
ID3D11DeviceContext_IASetInputLayout(ctx, layout);
|
||||
ID3D11DeviceContext_IASetPrimitiveTopology(ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ID3D11DeviceContext_IASetVertexBuffers(ctx, 0, 1, &vb, &stride, &zero);
|
||||
ID3D11DeviceContext_IASetIndexBuffer(ctx, ib, DXGI_FORMAT_R16_UINT, 0);
|
||||
ID3D11DeviceContext_VSSetShader(ctx, vsq, NULL, 0);
|
||||
ID3D11DeviceContext_VSSetConstantBuffers(ctx, 0, 1, &cb);
|
||||
ID3D11DeviceContext_PSSetShader(ctx, psq, NULL, 0);
|
||||
ID3D11DeviceContext_PSSetSamplers(ctx, 0, 1, &sampler);
|
||||
if (strcmp(fault, "blank")) {
|
||||
ID3D11DeviceContext_PSSetShaderResources(ctx, 0, 1, &tb_srv);
|
||||
ID3D11DeviceContext_DrawIndexed(ctx, 6, 0, 0); /* B first, with the input offset */
|
||||
Constants fixed = k;
|
||||
fixed.ox = fixed.oy = 0.0f;
|
||||
ID3D11DeviceContext_UpdateSubresource(ctx, (ID3D11Resource *)cb, 0, NULL, &fixed, 0, 0);
|
||||
ID3D11DeviceContext_PSSetShaderResources(ctx, 0, 1, &ta_srv);
|
||||
ID3D11DeviceContext_DrawIndexed(ctx, 6, 0, 4);
|
||||
}
|
||||
|
||||
/* pass 2 */
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &no_rtv, NULL);
|
||||
ID3D11DeviceContext_CSSetShader(ctx, cs, NULL, 0);
|
||||
ID3D11DeviceContext_CSSetConstantBuffers(ctx, 0, 1, &cb);
|
||||
ID3D11DeviceContext_CSSetShaderResources(ctx, 0, 1, &off_srv);
|
||||
ID3D11DeviceContext_CSSetUnorderedAccessViews(ctx, 0, 1, &post_uav, NULL);
|
||||
ID3D11DeviceContext_Dispatch(ctx, W / 8, H / 8, 1);
|
||||
ID3D11DeviceContext_CSSetUnorderedAccessViews(ctx, 0, 1, &no_uav, NULL);
|
||||
ID3D11DeviceContext_CSSetShaderResources(ctx, 0, 1, &no_srv);
|
||||
|
||||
/* pass 3 */
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &back_rtv, NULL);
|
||||
ID3D11DeviceContext_IASetInputLayout(ctx, NULL);
|
||||
ID3D11DeviceContext_VSSetShader(ctx, vsf, NULL, 0);
|
||||
ID3D11DeviceContext_PSSetShader(ctx, psf, NULL, 0);
|
||||
ID3D11DeviceContext_PSSetShaderResources(ctx, 0, 1, &post_srv);
|
||||
ID3D11DeviceContext_Draw(ctx, 3, 0);
|
||||
ID3D11DeviceContext_PSSetShaderResources(ctx, 0, 1, &no_srv);
|
||||
|
||||
const int check = f == 0 || f == frames - 1 || f % verify_every == 0 ||
|
||||
(injected && f == injected * (frames / 8) + 1);
|
||||
if (check) {
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)staging, (ID3D11Resource *)back);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
API(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)staging, 0, D3D11_MAP_READ, 0, &m), "Map");
|
||||
int mismatches = 0;
|
||||
for (int y = 0; y < H; y++) {
|
||||
const unsigned char *row = (const unsigned char *)m.pData + (size_t)y * m.RowPitch;
|
||||
for (int x = 0; x < W; x++) {
|
||||
unsigned char e[4];
|
||||
expected_pixel(x, y, marker, bx, by, !strcmp(fault, "color"), e);
|
||||
if (memcmp(row + x * 4, e, 4)) {
|
||||
if (!mismatches++)
|
||||
printf("mismatch frame=%d x=%d y=%d got=%u,%u,%u,%u want=%u,%u,%u,%u\n", f, x, y,
|
||||
row[x * 4], row[x * 4 + 1], row[x * 4 + 2], row[x * 4 + 3], e[0], e[1], e[2], e[3]);
|
||||
}
|
||||
for (int c = 0; c < 4; c++) digest = (digest ^ row[x * 4 + c]) * 1099511628211ULL;
|
||||
}
|
||||
}
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)staging, 0);
|
||||
verified++;
|
||||
if (mismatches) bad_frames++;
|
||||
}
|
||||
|
||||
ID3D11DeviceContext_End(ctx, (ID3D11Asynchronous *)query);
|
||||
API(IDXGISwapChain_Present(swap, (UINT)vsync, 0), "Present");
|
||||
presented++;
|
||||
BOOL done = FALSE;
|
||||
const double wait_start = now_ms();
|
||||
while (ID3D11DeviceContext_GetData(ctx, (ID3D11Asynchronous *)query, &done, sizeof done, 0) != S_OK || !done) {
|
||||
WIN(now_ms() - wait_start < 10000.0, "GPU completion within 10 s");
|
||||
Sleep(0);
|
||||
}
|
||||
if (f == 0) {
|
||||
char msg[96];
|
||||
snprintf(msg, sizeof msg, "pixels=%d mismatched_frames=%d present=ok", W * H, bad_frames);
|
||||
gate("frame.first", bad_frames == 0, msg);
|
||||
if (!strcmp(fault, "crash")) *(volatile int *)0 = 1;
|
||||
if (!strcmp(fault, "hang")) Sleep(INFINITE);
|
||||
}
|
||||
if (f % 100 == 50) {
|
||||
churn_ok = churn(dev, ctx, (unsigned)f) && churn_ok;
|
||||
churns++;
|
||||
}
|
||||
const double t = now_ms();
|
||||
printf("frame_ms %.4f\n", t - prev);
|
||||
prev = t;
|
||||
if (f == warmup) mem_warm = working_set_mb();
|
||||
if (f % 50 == 0) {
|
||||
const double mb = working_set_mb();
|
||||
if (mb > mem_peak) mem_peak = mb;
|
||||
}
|
||||
}
|
||||
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof msg, "presented=%d verified=%d mismatched=%d digest=%016llx", presented, verified,
|
||||
bad_frames, digest);
|
||||
gate("frame.continuous", presented == f && (interactive || presented == frames) && bad_frames == 0, msg);
|
||||
snprintf(msg, sizeof msg, "cycles=%d", churns);
|
||||
gate("resources.churn", churn_ok && (interactive || churns > 0 || frames <= 50), msg);
|
||||
|
||||
if (interactive) {
|
||||
snprintf(msg, sizeof msg, "keys_seen=%d offset=%d,%d (person-driven, not scripted)", keys_seen, off_x, off_y);
|
||||
gate("input", keys_seen > 0 && bad_frames == 0, msg);
|
||||
} else {
|
||||
/* by hand: right,right,down,left,down = (+16, +32) */
|
||||
snprintf(msg, sizeof msg, "posted=%d received=%d offset=%d,%d want=16,32 (PostMessage)", injected,
|
||||
keys_seen, off_x, off_y);
|
||||
gate("input", injected == 5 && keys_seen == 5 && off_x == 16 && off_y == 32 && bad_frames == 0, msg);
|
||||
}
|
||||
|
||||
const double mem_end = working_set_mb();
|
||||
if (mem_end > mem_peak) mem_peak = mem_end;
|
||||
snprintf(msg, sizeof msg, "working_set_mb_after_warmup=%.1f end=%.1f peak_sampled=%.1f bound_growth=%d", mem_warm,
|
||||
mem_end, mem_peak, max_growth);
|
||||
gate("memory.bounded", mem_warm > 0 && mem_end > 0 && mem_end - mem_warm <= max_growth, msg);
|
||||
|
||||
/* keep presenting the last image so an outside observer can capture the window */
|
||||
if (hold_ms > 0) {
|
||||
printf("holding hold_ms=%d\n", hold_ms);
|
||||
const double until = now_ms() + hold_ms;
|
||||
while (now_ms() < until && !quit_requested) {
|
||||
pump();
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &back_rtv, NULL);
|
||||
ID3D11DeviceContext_PSSetShaderResources(ctx, 0, 1, &post_srv);
|
||||
ID3D11DeviceContext_Draw(ctx, 3, 0);
|
||||
API(IDXGISwapChain_Present(swap, 1, 0), "Present hold");
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
producer_stop = 1;
|
||||
SetEvent(ev_request);
|
||||
int clean = WaitForSingleObject(prod, 10000) == WAIT_OBJECT_0;
|
||||
CloseHandle(prod);
|
||||
CloseHandle(ev_request);
|
||||
CloseHandle(ev_ready);
|
||||
|
||||
ID3D11DeviceContext_ClearState(ctx);
|
||||
ID3D11DeviceContext_Flush(ctx);
|
||||
RELEASE(query, ID3D11Query);
|
||||
RELEASE(depth_state, ID3D11DepthStencilState);
|
||||
RELEASE(sampler, ID3D11SamplerState);
|
||||
RELEASE(layout, ID3D11InputLayout);
|
||||
RELEASE(cs, ID3D11ComputeShader);
|
||||
RELEASE(psf, ID3D11PixelShader);
|
||||
RELEASE(vsf, ID3D11VertexShader);
|
||||
RELEASE(psq, ID3D11PixelShader);
|
||||
RELEASE(vsq, ID3D11VertexShader);
|
||||
RELEASE(cb, ID3D11Buffer);
|
||||
RELEASE(ib, ID3D11Buffer);
|
||||
RELEASE(vb, ID3D11Buffer);
|
||||
RELEASE(post_uav, ID3D11UnorderedAccessView);
|
||||
RELEASE(tb_srv, ID3D11ShaderResourceView);
|
||||
RELEASE(ta_srv, ID3D11ShaderResourceView);
|
||||
RELEASE(post_srv, ID3D11ShaderResourceView);
|
||||
RELEASE(off_srv, ID3D11ShaderResourceView);
|
||||
RELEASE(dsv, ID3D11DepthStencilView);
|
||||
RELEASE(off_rtv, ID3D11RenderTargetView);
|
||||
RELEASE(back_rtv, ID3D11RenderTargetView);
|
||||
RELEASE(tb, ID3D11Texture2D);
|
||||
RELEASE(ta, ID3D11Texture2D);
|
||||
RELEASE(staging, ID3D11Texture2D);
|
||||
RELEASE(depth, ID3D11Texture2D);
|
||||
RELEASE(post, ID3D11Texture2D);
|
||||
RELEASE(off, ID3D11Texture2D);
|
||||
RELEASE(back, ID3D11Texture2D);
|
||||
RELEASE(swap, IDXGISwapChain);
|
||||
RELEASE(ctx, ID3D11DeviceContext);
|
||||
const ULONG refs = ID3D11Device_Release(dev);
|
||||
clean = DestroyWindow(hwnd) && clean;
|
||||
pump();
|
||||
snprintf(msg, sizeof msg, "producer_joined window_destroyed device_refs_after_release=%lu", (unsigned long)refs);
|
||||
gate("shutdown", clean && refs == 0, msg);
|
||||
|
||||
if (failures) {
|
||||
printf("FAIL integrated failed_gates=%d\n", failures);
|
||||
return 1;
|
||||
}
|
||||
printf("PASS integrated frames=%d verified=%d\n", presented, verified);
|
||||
return 0;
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Build the Direct3D 12 workload with the pinned llvm-mingw (docs/research/hybrid-toolchain.md).
|
||||
# workloads/d3d12-integrated/build.sh <llvm-mingw-dir> [output-dir]
|
||||
set -eu
|
||||
TC=${1:?usage: build.sh LLVM_MINGW_DIR [OUTPUT_DIR]}
|
||||
src=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
||||
out=${2:-"$src/../../artifacts/hybrid-workloads/x86_64"}
|
||||
mkdir -p "$out"
|
||||
"$TC/bin/x86_64-w64-mingw32-clang" -std=c11 -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$out/d3d12-integrated.exe" "$src/integrated12.c" \
|
||||
-ld3d12 -ldxgi -ldxguid -ld3dcompiler -lpsapi -luser32
|
||||
description=$(file -b "$out/d3d12-integrated.exe")
|
||||
echo "$description"
|
||||
case "$description" in
|
||||
*PE32+*x86-64*) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
@@ -0,0 +1,762 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload: Direct3D 12 graphics and compute with presentation and
|
||||
// self-verification, run through `betterxen hybrid run`. Written from Microsoft's public
|
||||
// Direct3D 12 documentation.
|
||||
//
|
||||
// The scene is deliberately the same as workloads/d3d11-integrated, with the same
|
||||
// verification schedule, so the two APIs must produce the same pixel digest:
|
||||
// pass 1 two textured quads with a depth buffer into an offscreen target; near quad B is
|
||||
// drawn first and moves with the arrow keys
|
||||
// pass 2 compute: rotate channels into a UAV and write a 16-row frame-number band
|
||||
// pass 3 full-screen triangle into the swapchain back buffer
|
||||
// The back buffer is copied to a READBACK buffer and compared, with zero tolerance, with an
|
||||
// image computed on the CPU. Two frames are in flight; each has its own command allocator,
|
||||
// constant-buffer slice and fence value.
|
||||
//
|
||||
// Limits: read-back proves what was handed to Present, not what reached the screen. No debug
|
||||
// layer is used, so a missing barrier that happens to work is not detected.
|
||||
//
|
||||
// usage: integrated12.exe [--frames N] [--duration-s N] [--verify-every N] [--vsync]
|
||||
// [--external-input] [--input-timeout-s N] [--hold-ms N] [--max-growth-mb N]
|
||||
// [--expect-absent-env NAME] [--fault color|blank|stale|input|depth|upload|crash|hang]
|
||||
// Exit: 0 pass, 1 a verification failed, 2 no Direct3D 12 device, 3 an API call failed.
|
||||
#define COBJMACROS
|
||||
#define WIDL_C_INLINE_WRAPPERS /* struct-returning D3D12 methods in C (mingw-w64) */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <d3d12.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgi1_4.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define W 256
|
||||
#define H 256
|
||||
#define BAND 16
|
||||
#define STEP 16
|
||||
#define SLOTS 2
|
||||
#define ROW_PITCH (W * 4) /* 1024, a multiple of D3D12_TEXTURE_DATA_PITCH_ALIGNMENT */
|
||||
|
||||
static int failures;
|
||||
static LARGE_INTEGER qpc_freq, qpc_start;
|
||||
|
||||
static double now_ms(void) {
|
||||
LARGE_INTEGER t;
|
||||
QueryPerformanceCounter(&t);
|
||||
return (double)(t.QuadPart - qpc_start.QuadPart) * 1000.0 / (double)qpc_freq.QuadPart;
|
||||
}
|
||||
|
||||
static void gate(const char *name, int ok, const char *detail) {
|
||||
printf("gate %s %s %s t_ms=%.1f\n", name, ok ? "pass" : "FAIL", detail, now_ms());
|
||||
if (!ok) failures++;
|
||||
}
|
||||
|
||||
#define API(x, what) do { HRESULT hr_ = (x); if (FAILED(hr_)) { \
|
||||
printf("FAIL api %s hr=0x%08lx\n", what, (unsigned long)hr_); exit(3); } } while (0)
|
||||
#define WIN(x, what) do { if (!(x)) { \
|
||||
printf("FAIL api %s error=%lu\n", what, (unsigned long)GetLastError()); exit(3); } } while (0)
|
||||
|
||||
/* ---- window and input ------------------------------------------------------------------ */
|
||||
|
||||
static int off_x, off_y, keys_seen, quit_requested;
|
||||
|
||||
static LRESULT CALLBACK wndproc(HWND h, UINT m, WPARAM w, LPARAM l) {
|
||||
if (m == WM_KEYDOWN) {
|
||||
if (w == VK_ESCAPE) quit_requested = 1;
|
||||
else {
|
||||
int dx = w == VK_RIGHT ? STEP : w == VK_LEFT ? -STEP : 0;
|
||||
int dy = w == VK_DOWN ? STEP : w == VK_UP ? -STEP : 0;
|
||||
if (dx || dy) {
|
||||
keys_seen++;
|
||||
off_x += dx;
|
||||
off_y += dy;
|
||||
if (off_x < -64) off_x = -64;
|
||||
if (off_x > 32) off_x = 32;
|
||||
if (off_y < -64) off_y = -64;
|
||||
if (off_y > 32) off_y = 32;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (m == WM_CLOSE) { quit_requested = 1; return 0; }
|
||||
return DefWindowProcA(h, m, w, l);
|
||||
}
|
||||
|
||||
static void pump(void) {
|
||||
MSG msg;
|
||||
while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- expected image (CPU, independent of the shaders) ---------------------------------- */
|
||||
|
||||
static const unsigned char TEX_A[4][4] = {
|
||||
{255, 0, 0, 255}, {0, 255, 0, 255}, {0, 0, 255, 255}, {255, 255, 255, 255}};
|
||||
static const unsigned char TEX_B[4][4] = {
|
||||
{255, 255, 0, 255}, {0, 255, 255, 255}, {255, 0, 255, 255}, {128, 128, 128, 255}};
|
||||
|
||||
static void expected_pixel(int x, int y, unsigned marker, int bx, int by, int wrong, unsigned char out[4]) {
|
||||
if (y < BAND) {
|
||||
out[0] = (unsigned char)(marker & 255);
|
||||
out[1] = (unsigned char)(marker >> 8);
|
||||
out[2] = 77;
|
||||
out[3] = 255;
|
||||
return;
|
||||
}
|
||||
const unsigned char *c = NULL;
|
||||
if (x >= bx && x < bx + 128 && y >= by && y < by + 128)
|
||||
c = TEX_B[((y - by) / 64) * 2 + (x - bx) / 64];
|
||||
else if (x >= 32 && x < 160 && y >= 32 && y < 160)
|
||||
c = TEX_A[((y - 32) / 64) * 2 + (x - 32) / 64];
|
||||
out[0] = c ? c[2] : 0;
|
||||
out[1] = c ? c[0] : 0;
|
||||
out[2] = c ? c[1] : 0;
|
||||
out[3] = 255;
|
||||
if (wrong && c == TEX_A[0]) out[0] ^= 255;
|
||||
}
|
||||
|
||||
/* ---- Direct3D 12 ----------------------------------------------------------------------- */
|
||||
|
||||
static const char *HLSL =
|
||||
"cbuffer C : register(b0) { float2 offset; uint marker; uint pad; };\n"
|
||||
"Texture2D tex : register(t0); SamplerState smp : register(s0);\n"
|
||||
"struct VI { float3 p : POSITION; float2 uv : TEXCOORD; };\n"
|
||||
"struct VO { float4 p : SV_Position; float2 uv : TEXCOORD; };\n"
|
||||
"VO vs_quad(VI v) { VO o; o.p = float4(v.p.xy + offset, v.p.z, 1); o.uv = v.uv; return o; }\n"
|
||||
"float4 ps_quad(VO i) : SV_Target { return tex.Sample(smp, i.uv); }\n"
|
||||
"float4 vs_full(uint id : SV_VertexID) : SV_Position {\n"
|
||||
" float2 uv = float2((id << 1) & 2, id & 2);\n"
|
||||
" return float4(uv * float2(2, -2) + float2(-1, 1), 0, 1); }\n"
|
||||
"float4 ps_full(float4 p : SV_Position) : SV_Target { return tex.Load(int3(p.xy, 0)); }\n"
|
||||
"RWTexture2D<unorm float4> dst : register(u0);\n"
|
||||
"[numthreads(8, 8, 1)] void cs_main(uint3 id : SV_DispatchThreadID) {\n"
|
||||
" if (id.y < 16) { dst[id.xy] = float4((marker & 255) / 255.0, (marker >> 8) / 255.0, 77 / 255.0, 1); return; }\n"
|
||||
" float4 c = tex.Load(int3(id.xy, 0));\n"
|
||||
" dst[id.xy] = float4(c.b, c.r, c.g, 1); }\n";
|
||||
|
||||
typedef struct { float x, y, z, u, v; } Vertex;
|
||||
typedef struct { float ox, oy; unsigned marker, pad; } Constants;
|
||||
|
||||
static ID3D12Device *dev;
|
||||
static ID3D12CommandQueue *queue;
|
||||
static ID3D12Fence *fence;
|
||||
static HANDLE fence_event;
|
||||
static UINT64 fence_next = 1;
|
||||
|
||||
static ID3DBlob *compile(const char *entry, const char *target) {
|
||||
ID3DBlob *code = NULL, *err = NULL;
|
||||
HRESULT hr = D3DCompile(HLSL, strlen(HLSL), NULL, NULL, NULL, entry, target, 0, 0, &code, &err);
|
||||
if (FAILED(hr)) {
|
||||
printf("FAIL api D3DCompile %s hr=0x%08lx %s\n", entry, (unsigned long)hr,
|
||||
err ? (const char *)ID3D10Blob_GetBufferPointer(err) : "");
|
||||
exit(3);
|
||||
}
|
||||
if (err) ID3D10Blob_Release(err);
|
||||
return code;
|
||||
}
|
||||
|
||||
static ID3D12Resource *resource(D3D12_HEAP_TYPE heap, const D3D12_RESOURCE_DESC *d,
|
||||
D3D12_RESOURCE_STATES state, const D3D12_CLEAR_VALUE *clear) {
|
||||
D3D12_HEAP_PROPERTIES hp = {.Type = heap};
|
||||
ID3D12Resource *r = NULL;
|
||||
API(ID3D12Device_CreateCommittedResource(dev, &hp, D3D12_HEAP_FLAG_NONE, d, state, clear,
|
||||
&IID_ID3D12Resource, (void **)&r), "CreateCommittedResource");
|
||||
return r;
|
||||
}
|
||||
|
||||
static ID3D12Resource *buffer(D3D12_HEAP_TYPE heap, UINT64 bytes, D3D12_RESOURCE_STATES state) {
|
||||
D3D12_RESOURCE_DESC d = {.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, .Width = bytes, .Height = 1,
|
||||
.DepthOrArraySize = 1, .MipLevels = 1, .SampleDesc = {1, 0},
|
||||
.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR};
|
||||
return resource(heap, &d, state, NULL);
|
||||
}
|
||||
|
||||
static ID3D12Resource *texture(UINT w, UINT h, DXGI_FORMAT fmt, D3D12_RESOURCE_FLAGS flags,
|
||||
D3D12_RESOURCE_STATES state, const D3D12_CLEAR_VALUE *clear) {
|
||||
D3D12_RESOURCE_DESC d = {.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D, .Width = w, .Height = h,
|
||||
.DepthOrArraySize = 1, .MipLevels = 1, .Format = fmt, .SampleDesc = {1, 0},
|
||||
.Flags = flags};
|
||||
return resource(D3D12_HEAP_TYPE_DEFAULT, &d, state, clear);
|
||||
}
|
||||
|
||||
static void barrier(ID3D12GraphicsCommandList *list, ID3D12Resource *r, D3D12_RESOURCE_STATES from,
|
||||
D3D12_RESOURCE_STATES to) {
|
||||
D3D12_RESOURCE_BARRIER b = {.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION};
|
||||
b.Transition.pResource = r;
|
||||
b.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
b.Transition.StateBefore = from;
|
||||
b.Transition.StateAfter = to;
|
||||
ID3D12GraphicsCommandList_ResourceBarrier(list, 1, &b);
|
||||
}
|
||||
|
||||
static void wait_for(UINT64 value) {
|
||||
if (ID3D12Fence_GetCompletedValue(fence) < value) {
|
||||
API(ID3D12Fence_SetEventOnCompletion(fence, value, fence_event), "SetEventOnCompletion");
|
||||
WIN(WaitForSingleObject(fence_event, 10000) == WAIT_OBJECT_0, "GPU completion within 10 s");
|
||||
}
|
||||
}
|
||||
|
||||
static UINT64 submit(ID3D12GraphicsCommandList *list) {
|
||||
API(ID3D12GraphicsCommandList_Close(list), "Close");
|
||||
ID3D12CommandList *lists[1] = {(ID3D12CommandList *)list};
|
||||
ID3D12CommandQueue_ExecuteCommandLists(queue, 1, lists);
|
||||
const UINT64 value = fence_next++;
|
||||
API(ID3D12CommandQueue_Signal(queue, fence, value), "Signal");
|
||||
return value;
|
||||
}
|
||||
|
||||
static void copy_texture(ID3D12GraphicsCommandList *list, ID3D12Resource *tex, ID3D12Resource *buf,
|
||||
UINT w, UINT h, UINT pitch, int to_texture) {
|
||||
D3D12_TEXTURE_COPY_LOCATION t = {.pResource = tex, .Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX};
|
||||
D3D12_TEXTURE_COPY_LOCATION b = {.pResource = buf, .Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT};
|
||||
b.PlacedFootprint.Footprint = (D3D12_SUBRESOURCE_FOOTPRINT){DXGI_FORMAT_R8G8B8A8_UNORM, w, h, 1, pitch};
|
||||
if (to_texture) ID3D12GraphicsCommandList_CopyTextureRegion(list, &t, 0, 0, 0, &b, NULL);
|
||||
else ID3D12GraphicsCommandList_CopyTextureRegion(list, &b, 0, 0, 0, &t, NULL);
|
||||
}
|
||||
|
||||
static void fill(ID3D12Resource *upload, const void *data, size_t bytes) {
|
||||
void *p = NULL;
|
||||
D3D12_RANGE none = {0, 0};
|
||||
API(ID3D12Resource_Map(upload, 0, &none, &p), "Map upload");
|
||||
memcpy(p, data, bytes);
|
||||
ID3D12Resource_Unmap(upload, 0, NULL);
|
||||
}
|
||||
|
||||
static ID3D12DescriptorHeap *heap_of(D3D12_DESCRIPTOR_HEAP_TYPE type, UINT n, int visible) {
|
||||
D3D12_DESCRIPTOR_HEAP_DESC d = {.Type = type, .NumDescriptors = n,
|
||||
.Flags = visible ? D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE
|
||||
: D3D12_DESCRIPTOR_HEAP_FLAG_NONE};
|
||||
ID3D12DescriptorHeap *h = NULL;
|
||||
API(ID3D12Device_CreateDescriptorHeap(dev, &d, &IID_ID3D12DescriptorHeap, (void **)&h), "descriptor heap");
|
||||
return h;
|
||||
}
|
||||
|
||||
static ID3D12RootSignature *root_signature(int compute) {
|
||||
D3D12_DESCRIPTOR_RANGE srv = {D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0, 0, 0};
|
||||
D3D12_DESCRIPTOR_RANGE other = {compute ? D3D12_DESCRIPTOR_RANGE_TYPE_UAV : D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER,
|
||||
1, 0, 0, 0};
|
||||
D3D12_ROOT_PARAMETER p[3];
|
||||
memset(p, 0, sizeof p);
|
||||
p[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
|
||||
p[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
||||
p[1].DescriptorTable.NumDescriptorRanges = 1;
|
||||
p[1].DescriptorTable.pDescriptorRanges = &srv;
|
||||
p[2] = p[1];
|
||||
p[2].DescriptorTable.pDescriptorRanges = &other;
|
||||
D3D12_ROOT_SIGNATURE_DESC d = {.NumParameters = 3, .pParameters = p,
|
||||
.Flags = compute ? D3D12_ROOT_SIGNATURE_FLAG_NONE
|
||||
: D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT};
|
||||
ID3DBlob *blob = NULL, *err = NULL;
|
||||
API(D3D12SerializeRootSignature(&d, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &err), "serialize root signature");
|
||||
ID3D12RootSignature *rs = NULL;
|
||||
API(ID3D12Device_CreateRootSignature(dev, 0, ID3D10Blob_GetBufferPointer(blob), ID3D10Blob_GetBufferSize(blob),
|
||||
&IID_ID3D12RootSignature, (void **)&rs), "root signature");
|
||||
ID3D10Blob_Release(blob);
|
||||
return rs;
|
||||
}
|
||||
|
||||
static ID3D12PipelineState *graphics_pipeline(ID3D12RootSignature *rs, ID3DBlob *vs, ID3DBlob *ps,
|
||||
int quad, int depth_test) {
|
||||
static const D3D12_INPUT_ELEMENT_DESC ied[2] = {
|
||||
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
|
||||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0}};
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC d;
|
||||
memset(&d, 0, sizeof d);
|
||||
d.pRootSignature = rs;
|
||||
d.VS = (D3D12_SHADER_BYTECODE){ID3D10Blob_GetBufferPointer(vs), ID3D10Blob_GetBufferSize(vs)};
|
||||
d.PS = (D3D12_SHADER_BYTECODE){ID3D10Blob_GetBufferPointer(ps), ID3D10Blob_GetBufferSize(ps)};
|
||||
d.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
|
||||
d.SampleMask = UINT_MAX;
|
||||
d.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
|
||||
d.RasterizerState.CullMode = D3D12_CULL_MODE_BACK;
|
||||
d.RasterizerState.DepthClipEnable = TRUE;
|
||||
if (quad) {
|
||||
d.InputLayout = (D3D12_INPUT_LAYOUT_DESC){ied, 2};
|
||||
d.DepthStencilState.DepthEnable = depth_test;
|
||||
d.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
|
||||
d.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS;
|
||||
d.DSVFormat = DXGI_FORMAT_D32_FLOAT;
|
||||
}
|
||||
d.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
d.NumRenderTargets = 1;
|
||||
d.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
d.SampleDesc.Count = 1;
|
||||
ID3D12PipelineState *p = NULL;
|
||||
API(ID3D12Device_CreateGraphicsPipelineState(dev, &d, &IID_ID3D12PipelineState, (void **)&p), "graphics PSO");
|
||||
return p;
|
||||
}
|
||||
|
||||
static void quad_vertices(Vertex *v, int x0, int y0, float z) {
|
||||
const float l = x0 / 128.0f - 1.0f, r = (x0 + 128) / 128.0f - 1.0f;
|
||||
const float t = 1.0f - y0 / 128.0f, b = 1.0f - (y0 + 128) / 128.0f;
|
||||
v[0] = (Vertex){l, t, z, 0, 0};
|
||||
v[1] = (Vertex){r, t, z, 1, 0};
|
||||
v[2] = (Vertex){l, b, z, 0, 1};
|
||||
v[3] = (Vertex){r, b, z, 1, 1};
|
||||
}
|
||||
|
||||
static double working_set_mb(void) {
|
||||
PROCESS_MEMORY_COUNTERS m;
|
||||
memset(&m, 0, sizeof m);
|
||||
if (!GetProcessMemoryInfo(GetCurrentProcess(), &m, sizeof m) || !m.WorkingSetSize) return -1.0;
|
||||
return (double)m.WorkingSetSize / (1024.0 * 1024.0);
|
||||
}
|
||||
|
||||
/* Create, upload, copy back, compare and destroy a texture on the GPU; 1 if it survived. */
|
||||
static int churn(ID3D12CommandAllocator *alloc, ID3D12GraphicsCommandList *list, unsigned seed) {
|
||||
static unsigned data[256 * 256];
|
||||
for (unsigned i = 0; i < 256 * 256; i++) data[i] = i * 2654435761u + seed;
|
||||
ID3D12Resource *up = buffer(D3D12_HEAP_TYPE_UPLOAD, sizeof data, D3D12_RESOURCE_STATE_GENERIC_READ);
|
||||
ID3D12Resource *down = buffer(D3D12_HEAP_TYPE_READBACK, sizeof data, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
ID3D12Resource *tex = texture(256, 256, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_NONE,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST, NULL);
|
||||
fill(up, data, sizeof data);
|
||||
API(ID3D12CommandAllocator_Reset(alloc), "churn allocator reset");
|
||||
API(ID3D12GraphicsCommandList_Reset(list, alloc, NULL), "churn list reset");
|
||||
copy_texture(list, tex, up, 256, 256, 1024, 1);
|
||||
barrier(list, tex, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
copy_texture(list, tex, down, 256, 256, 1024, 0);
|
||||
wait_for(submit(list));
|
||||
void *p = NULL;
|
||||
API(ID3D12Resource_Map(down, 0, NULL, &p), "Map readback churn");
|
||||
const int ok = !memcmp(p, data, sizeof data);
|
||||
D3D12_RANGE none = {0, 0};
|
||||
ID3D12Resource_Unmap(down, 0, &none);
|
||||
ID3D12Resource_Release(tex);
|
||||
ID3D12Resource_Release(down);
|
||||
ID3D12Resource_Release(up);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int frames = 600, verify_every = 30, vsync = 0, external = 0, input_timeout_s = 60;
|
||||
int duration_s = 0, hold_ms = 0, max_growth = 64;
|
||||
const char *fault = "", *absent_env = NULL;
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
QueryPerformanceFrequency(&qpc_freq);
|
||||
QueryPerformanceCounter(&qpc_start);
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *a = argv[i], *v = i + 1 < argc ? argv[i + 1] : NULL;
|
||||
if (!strcmp(a, "--vsync")) vsync = 1;
|
||||
else if (!strcmp(a, "--external-input")) external = 1;
|
||||
else if (!strcmp(a, "--frames") && v) frames = atoi(v), i++;
|
||||
else if (!strcmp(a, "--duration-s") && v) duration_s = atoi(v), i++;
|
||||
else if (!strcmp(a, "--verify-every") && v) verify_every = atoi(v), i++;
|
||||
else if (!strcmp(a, "--input-timeout-s") && v) input_timeout_s = atoi(v), i++;
|
||||
else if (!strcmp(a, "--hold-ms") && v) hold_ms = atoi(v), i++;
|
||||
else if (!strcmp(a, "--max-growth-mb") && v) max_growth = atoi(v), i++;
|
||||
else if (!strcmp(a, "--expect-absent-env") && v) absent_env = v, i++;
|
||||
else if (!strcmp(a, "--fault") && v &&
|
||||
(!strcmp(v, "color") || !strcmp(v, "blank") || !strcmp(v, "stale") || !strcmp(v, "input") ||
|
||||
!strcmp(v, "depth") || !strcmp(v, "upload") || !strcmp(v, "crash") || !strcmp(v, "hang")))
|
||||
fault = v, i++;
|
||||
else { printf("FAIL usage: unknown or incomplete argument %s\n", a); return 3; }
|
||||
}
|
||||
if (frames < 64 || verify_every < 1) { printf("FAIL usage: --frames >= 64, --verify-every >= 1\n"); return 3; }
|
||||
|
||||
if (absent_env) {
|
||||
char tmp[2];
|
||||
SetLastError(0);
|
||||
const DWORD n = GetEnvironmentVariableA(absent_env, tmp, sizeof tmp);
|
||||
const int absent = n == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND;
|
||||
char msg[128];
|
||||
snprintf(msg, sizeof msg, "%.64s %s", absent_env, absent ? "is not visible" : "is visible");
|
||||
gate("runtime.env", absent, msg);
|
||||
}
|
||||
|
||||
WNDCLASSA wc = {.lpfnWndProc = wndproc, .hInstance = GetModuleHandleA(NULL),
|
||||
.lpszClassName = "BetterXenIntegrated12"};
|
||||
WIN(RegisterClassA(&wc), "RegisterClass");
|
||||
RECT r = {0, 0, W, H};
|
||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
HWND hwnd = CreateWindowA(wc.lpszClassName, "BetterXen D3D12 workload", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
64, 64, r.right - r.left, r.bottom - r.top, NULL, NULL, wc.hInstance, NULL);
|
||||
WIN(hwnd, "CreateWindow");
|
||||
pump();
|
||||
|
||||
HRESULT hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&dev);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
IDXGIFactory4 *factory = NULL;
|
||||
API(CreateDXGIFactory1(&IID_IDXGIFactory4, (void **)&factory), "factory");
|
||||
D3D12_COMMAND_QUEUE_DESC qd = {.Type = D3D12_COMMAND_LIST_TYPE_DIRECT};
|
||||
API(ID3D12Device_CreateCommandQueue(dev, &qd, &IID_ID3D12CommandQueue, (void **)&queue), "queue");
|
||||
{
|
||||
IDXGIAdapter1 *ad = NULL;
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
for (UINT i = 0; i < 1 && SUCCEEDED(IDXGIFactory4_EnumAdapters1(factory, i, &ad)); i++) {
|
||||
if (SUCCEEDED(IDXGIAdapter1_GetDesc1(ad, &desc))) {
|
||||
char name[128];
|
||||
size_t k = 0;
|
||||
for (; k < 127 && desc.Description[k]; k++) name[k] = (char)desc.Description[k];
|
||||
name[k] = 0;
|
||||
printf("adapter=%s vendor=0x%x\n", name, desc.VendorId);
|
||||
}
|
||||
IDXGIAdapter1_Release(ad);
|
||||
}
|
||||
}
|
||||
API(ID3D12Device_CreateFence(dev, 0, D3D12_FENCE_FLAG_NONE, &IID_ID3D12Fence, (void **)&fence), "fence");
|
||||
fence_event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
WIN(fence_event, "CreateEvent");
|
||||
DXGI_SWAP_CHAIN_DESC1 sd = {.Width = W, .Height = H, .Format = DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
.SampleDesc = {1, 0}, .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT,
|
||||
.BufferCount = 2, .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD};
|
||||
IDXGISwapChain1 *swap1 = NULL;
|
||||
IDXGISwapChain3 *swap = NULL;
|
||||
API(IDXGIFactory4_CreateSwapChainForHwnd(factory, (IUnknown *)queue, hwnd, &sd, NULL, NULL, &swap1), "swapchain");
|
||||
API(IDXGISwapChain1_QueryInterface(swap1, &IID_IDXGISwapChain3, (void **)&swap), "swapchain3");
|
||||
|
||||
ID3D12CommandAllocator *alloc[SLOTS], *aux_alloc = NULL;
|
||||
ID3D12GraphicsCommandList *list = NULL, *aux = NULL;
|
||||
UINT64 slot_value[SLOTS] = {0};
|
||||
for (int i = 0; i < SLOTS; i++)
|
||||
API(ID3D12Device_CreateCommandAllocator(dev, D3D12_COMMAND_LIST_TYPE_DIRECT, &IID_ID3D12CommandAllocator,
|
||||
(void **)&alloc[i]), "allocator");
|
||||
API(ID3D12Device_CreateCommandAllocator(dev, D3D12_COMMAND_LIST_TYPE_DIRECT, &IID_ID3D12CommandAllocator,
|
||||
(void **)&aux_alloc), "aux allocator");
|
||||
API(ID3D12Device_CreateCommandList(dev, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, alloc[0], NULL,
|
||||
&IID_ID3D12GraphicsCommandList, (void **)&list), "list");
|
||||
API(ID3D12Device_CreateCommandList(dev, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, aux_alloc, NULL,
|
||||
&IID_ID3D12GraphicsCommandList, (void **)&aux), "aux list");
|
||||
API(ID3D12GraphicsCommandList_Close(aux), "close aux");
|
||||
|
||||
/* resources */
|
||||
const D3D12_CLEAR_VALUE black_clear = {.Format = DXGI_FORMAT_R8G8B8A8_UNORM, .Color = {0, 0, 0, 1}};
|
||||
const D3D12_CLEAR_VALUE depth_clear = {.Format = DXGI_FORMAT_D32_FLOAT, .DepthStencil = {1.0f, 0}};
|
||||
ID3D12Resource *back[2];
|
||||
for (UINT i = 0; i < 2; i++)
|
||||
API(IDXGISwapChain3_GetBuffer(swap, i, &IID_ID3D12Resource, (void **)&back[i]), "GetBuffer");
|
||||
ID3D12Resource *off = texture(W, H, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, &black_clear);
|
||||
ID3D12Resource *post = texture(W, H, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL);
|
||||
ID3D12Resource *depth = texture(W, H, DXGI_FORMAT_D32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL,
|
||||
D3D12_RESOURCE_STATE_DEPTH_WRITE, &depth_clear);
|
||||
ID3D12Resource *ta = texture(2, 2, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_NONE,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST, NULL);
|
||||
ID3D12Resource *tb = texture(2, 2, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_NONE,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST, NULL);
|
||||
|
||||
Vertex verts[8];
|
||||
quad_vertices(verts, 96, 96, 0.25f); /* B, near */
|
||||
quad_vertices(verts + 4, 32, 32, 0.5f); /* A, far */
|
||||
const unsigned short indices[6] = {0, 1, 2, 2, 1, 3};
|
||||
ID3D12Resource *vb = buffer(D3D12_HEAP_TYPE_DEFAULT, sizeof verts, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
ID3D12Resource *ib = buffer(D3D12_HEAP_TYPE_DEFAULT, sizeof indices, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
|
||||
/* one upload buffer: vertices, indices, then the two textures at 512-byte offsets */
|
||||
unsigned char staging[2048];
|
||||
memset(staging, 0, sizeof staging);
|
||||
memcpy(staging, verts, sizeof verts);
|
||||
memcpy(staging + 256, indices, sizeof indices);
|
||||
for (int row = 0; row < 2; row++) {
|
||||
memcpy(staging + 512 + row * 256, TEX_A[row * 2], 8);
|
||||
memcpy(staging + 1024 + row * 256, TEX_B[row * 2], 8);
|
||||
}
|
||||
if (!strcmp(fault, "upload")) staging[512] ^= 255; /* wrong texel data reaches the GPU */
|
||||
ID3D12Resource *up = buffer(D3D12_HEAP_TYPE_UPLOAD, sizeof staging, D3D12_RESOURCE_STATE_GENERIC_READ);
|
||||
fill(up, staging, sizeof staging);
|
||||
ID3D12GraphicsCommandList_CopyBufferRegion(list, vb, 0, up, 0, sizeof verts);
|
||||
ID3D12GraphicsCommandList_CopyBufferRegion(list, ib, 0, up, 256, sizeof indices);
|
||||
for (int t = 0; t < 2; t++) {
|
||||
D3D12_TEXTURE_COPY_LOCATION dst = {.pResource = t ? tb : ta,
|
||||
.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX};
|
||||
D3D12_TEXTURE_COPY_LOCATION src = {.pResource = up, .Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT};
|
||||
src.PlacedFootprint.Offset = 512 + 512 * (UINT64)t;
|
||||
src.PlacedFootprint.Footprint = (D3D12_SUBRESOURCE_FOOTPRINT){DXGI_FORMAT_R8G8B8A8_UNORM, 2, 2, 1, 256};
|
||||
ID3D12GraphicsCommandList_CopyTextureRegion(list, &dst, 0, 0, 0, &src, NULL);
|
||||
barrier(list, t ? tb : ta, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
barrier(list, vb, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
|
||||
barrier(list, ib, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDEX_BUFFER);
|
||||
wait_for(submit(list));
|
||||
ID3D12Resource_Release(up);
|
||||
|
||||
/* constant buffer: per slot, one 256-byte entry for quad B and one for quad A */
|
||||
ID3D12Resource *cb = buffer(D3D12_HEAP_TYPE_UPLOAD, SLOTS * 2 * 256, D3D12_RESOURCE_STATE_GENERIC_READ);
|
||||
unsigned char *cb_ptr = NULL;
|
||||
{
|
||||
D3D12_RANGE none = {0, 0};
|
||||
API(ID3D12Resource_Map(cb, 0, &none, (void **)&cb_ptr), "map constants");
|
||||
}
|
||||
ID3D12Resource *readback = buffer(D3D12_HEAP_TYPE_READBACK, ROW_PITCH * H, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
|
||||
/* descriptors */
|
||||
ID3D12DescriptorHeap *rtv_heap = heap_of(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 3, 0);
|
||||
ID3D12DescriptorHeap *dsv_heap = heap_of(D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 1, 0);
|
||||
ID3D12DescriptorHeap *srv_heap = heap_of(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 5, 1);
|
||||
ID3D12DescriptorHeap *smp_heap = heap_of(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, 1, 1);
|
||||
const UINT rtv_step = ID3D12Device_GetDescriptorHandleIncrementSize(dev, D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
||||
const UINT srv_step = ID3D12Device_GetDescriptorHandleIncrementSize(dev, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtv0 = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rtv_heap);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE dsv = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(dsv_heap);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE srv0 = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(srv_heap);
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE gpu0 = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(srv_heap);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtv[3];
|
||||
for (UINT i = 0; i < 3; i++) {
|
||||
rtv[i].ptr = rtv0.ptr + (SIZE_T)i * rtv_step;
|
||||
ID3D12Device_CreateRenderTargetView(dev, i < 2 ? back[i] : off, NULL, rtv[i]);
|
||||
}
|
||||
ID3D12Device_CreateDepthStencilView(dev, depth, NULL, dsv);
|
||||
ID3D12Resource *srv_res[5] = {ta, tb, off, NULL, post};
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE table[5];
|
||||
for (UINT i = 0; i < 5; i++) {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE h = {srv0.ptr + (SIZE_T)i * srv_step};
|
||||
table[i].ptr = gpu0.ptr + (UINT64)i * srv_step;
|
||||
if (srv_res[i]) ID3D12Device_CreateShaderResourceView(dev, srv_res[i], NULL, h);
|
||||
else ID3D12Device_CreateUnorderedAccessView(dev, post, NULL, NULL, h);
|
||||
}
|
||||
D3D12_SAMPLER_DESC smp = {.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT,
|
||||
.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP,
|
||||
.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP,
|
||||
.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP,
|
||||
.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER, .MaxLOD = D3D12_FLOAT32_MAX};
|
||||
ID3D12Device_CreateSampler(dev, &smp, ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(smp_heap));
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE smp_table = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(smp_heap);
|
||||
gate("graphics.init", 1, "device queue allocators lists fence swapchain resources descriptor heaps");
|
||||
|
||||
ID3DBlob *vsq = compile("vs_quad", "vs_5_0"), *psq = compile("ps_quad", "ps_5_0");
|
||||
ID3DBlob *vsf = compile("vs_full", "vs_5_0"), *psf = compile("ps_full", "ps_5_0");
|
||||
ID3DBlob *csb = compile("cs_main", "cs_5_0");
|
||||
ID3D12RootSignature *rs_gfx = root_signature(0), *rs_cs = root_signature(1);
|
||||
ID3D12PipelineState *pso_quad = graphics_pipeline(rs_gfx, vsq, psq, 1, strcmp(fault, "depth") != 0);
|
||||
ID3D12PipelineState *pso_full = graphics_pipeline(rs_gfx, vsf, psf, 0, 0);
|
||||
ID3D12PipelineState *pso_cs = NULL;
|
||||
D3D12_COMPUTE_PIPELINE_STATE_DESC cd = {.pRootSignature = rs_cs,
|
||||
.CS = {ID3D10Blob_GetBufferPointer(csb), ID3D10Blob_GetBufferSize(csb)}};
|
||||
API(ID3D12Device_CreateComputePipelineState(dev, &cd, &IID_ID3D12PipelineState, (void **)&pso_cs), "compute PSO");
|
||||
ID3D10Blob_Release(vsq);
|
||||
ID3D10Blob_Release(psq);
|
||||
ID3D10Blob_Release(vsf);
|
||||
ID3D10Blob_Release(psf);
|
||||
ID3D10Blob_Release(csb);
|
||||
gate("shader.compile", 1, "root signatures, two graphics and one compute pipeline (shader model 5.0)");
|
||||
|
||||
static const WPARAM script[5] = {VK_RIGHT, VK_RIGHT, VK_DOWN, VK_LEFT, VK_DOWN};
|
||||
int injected = 0, verified = 0, bad_frames = 0, presented = 0, churns = 0, churn_ok = 1;
|
||||
unsigned long long digest = 1469598103934665603ULL;
|
||||
double mem_warm = -1.0, mem_peak = 0.0, prev = now_ms(), next_sample = 60000.0;
|
||||
int last_keys = 0, after_keys = 0;
|
||||
const int warmup = frames / 5;
|
||||
const D3D12_VIEWPORT vp = {0, 0, W, H, 0, 1};
|
||||
const D3D12_RECT scissor = {0, 0, W, H};
|
||||
const float black[4] = {0, 0, 0, 1};
|
||||
const D3D12_VERTEX_BUFFER_VIEW vbv = {ID3D12Resource_GetGPUVirtualAddress(vb), sizeof verts, sizeof(Vertex)};
|
||||
const D3D12_INDEX_BUFFER_VIEW ibv = {ID3D12Resource_GetGPUVirtualAddress(ib), sizeof indices,
|
||||
DXGI_FORMAT_R16_UINT};
|
||||
ID3D12DescriptorHeap *heaps[2] = {srv_heap, smp_heap};
|
||||
const double loop_start = now_ms();
|
||||
if (external) printf("ready for input: right right down left down\n");
|
||||
|
||||
int f = 0, last = 0;
|
||||
for (; !last && !quit_requested; f++) {
|
||||
if (!external && strcmp(fault, "input") && injected < 5 && f == (injected + 1) * (frames / 8)) {
|
||||
WIN(PostMessageA(hwnd, WM_KEYDOWN, script[injected], 0), "PostMessage");
|
||||
injected++;
|
||||
}
|
||||
pump();
|
||||
const int keys_changed = keys_seen != last_keys;
|
||||
last_keys = keys_seen;
|
||||
if (external) {
|
||||
if (keys_seen >= 5) after_keys++;
|
||||
last = after_keys >= 30 || now_ms() - loop_start > input_timeout_s * 1000.0;
|
||||
} else if (duration_s) {
|
||||
last = f >= frames - 1 && now_ms() - loop_start >= duration_s * 1000.0;
|
||||
} else {
|
||||
last = f == frames - 1;
|
||||
}
|
||||
const unsigned marker = (unsigned)(f + 1) & 0xffff;
|
||||
const int bx = 96 + off_x, by = 96 + off_y;
|
||||
const int slot = f % SLOTS;
|
||||
wait_for(slot_value[slot]);
|
||||
Constants moved = {off_x / 128.0f, -off_y / 128.0f, strcmp(fault, "stale") ? marker : 1u, 0};
|
||||
Constants fixed = {0.0f, 0.0f, moved.marker, 0};
|
||||
memcpy(cb_ptr + slot * 512, &moved, sizeof moved);
|
||||
memcpy(cb_ptr + slot * 512 + 256, &fixed, sizeof fixed);
|
||||
const D3D12_GPU_VIRTUAL_ADDRESS cb_va = ID3D12Resource_GetGPUVirtualAddress(cb) + (UINT64)slot * 512;
|
||||
const UINT bb = IDXGISwapChain3_GetCurrentBackBufferIndex(swap);
|
||||
const int check = f == 0 || last || f % verify_every == 0 ||
|
||||
(injected && f == injected * (frames / 8) + 1) || (external && keys_changed);
|
||||
|
||||
API(ID3D12CommandAllocator_Reset(alloc[slot]), "allocator reset");
|
||||
API(ID3D12GraphicsCommandList_Reset(list, alloc[slot], NULL), "list reset");
|
||||
ID3D12GraphicsCommandList_SetDescriptorHeaps(list, 2, heaps);
|
||||
ID3D12GraphicsCommandList_RSSetViewports(list, 1, &vp);
|
||||
ID3D12GraphicsCommandList_RSSetScissorRects(list, 1, &scissor);
|
||||
|
||||
/* pass 1 */
|
||||
barrier(list, off, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
ID3D12GraphicsCommandList_OMSetRenderTargets(list, 1, &rtv[2], FALSE, &dsv);
|
||||
ID3D12GraphicsCommandList_ClearRenderTargetView(list, rtv[2], black, 0, NULL);
|
||||
ID3D12GraphicsCommandList_ClearDepthStencilView(list, dsv, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, NULL);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootSignature(list, rs_gfx);
|
||||
ID3D12GraphicsCommandList_SetPipelineState(list, pso_quad);
|
||||
ID3D12GraphicsCommandList_IASetPrimitiveTopology(list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ID3D12GraphicsCommandList_IASetVertexBuffers(list, 0, 1, &vbv);
|
||||
ID3D12GraphicsCommandList_IASetIndexBuffer(list, &ibv);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(list, 2, smp_table);
|
||||
if (strcmp(fault, "blank")) {
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(list, 0, cb_va);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(list, 1, table[1]);
|
||||
ID3D12GraphicsCommandList_DrawIndexedInstanced(list, 6, 1, 0, 0, 0);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(list, 0, cb_va + 256);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(list, 1, table[0]);
|
||||
ID3D12GraphicsCommandList_DrawIndexedInstanced(list, 6, 1, 0, 4, 0);
|
||||
}
|
||||
barrier(list, off, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
|
||||
/* pass 2 */
|
||||
barrier(list, post, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
ID3D12GraphicsCommandList_SetComputeRootSignature(list, rs_cs);
|
||||
ID3D12GraphicsCommandList_SetPipelineState(list, pso_cs);
|
||||
ID3D12GraphicsCommandList_SetComputeRootConstantBufferView(list, 0, cb_va);
|
||||
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(list, 1, table[2]);
|
||||
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(list, 2, table[3]);
|
||||
ID3D12GraphicsCommandList_Dispatch(list, W / 8, H / 8, 1);
|
||||
barrier(list, post, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
|
||||
/* pass 3 */
|
||||
barrier(list, back[bb], D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
ID3D12GraphicsCommandList_OMSetRenderTargets(list, 1, &rtv[bb], FALSE, NULL);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootSignature(list, rs_gfx);
|
||||
ID3D12GraphicsCommandList_SetPipelineState(list, pso_full);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(list, 0, cb_va);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(list, 1, table[4]);
|
||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(list, 2, smp_table);
|
||||
ID3D12GraphicsCommandList_DrawInstanced(list, 3, 1, 0, 0);
|
||||
if (check) {
|
||||
barrier(list, back[bb], D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
copy_texture(list, back[bb], readback, W, H, ROW_PITCH, 0);
|
||||
barrier(list, back[bb], D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_PRESENT);
|
||||
} else {
|
||||
barrier(list, back[bb], D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
|
||||
}
|
||||
slot_value[slot] = submit(list);
|
||||
|
||||
if (check) {
|
||||
wait_for(slot_value[slot]);
|
||||
const unsigned char *mapped = NULL;
|
||||
API(ID3D12Resource_Map(readback, 0, NULL, (void **)&mapped), "map readback");
|
||||
int mismatches = 0;
|
||||
for (int y = 0; y < H; y++) {
|
||||
const unsigned char *row = mapped + (size_t)y * ROW_PITCH;
|
||||
for (int x = 0; x < W; x++) {
|
||||
unsigned char e[4];
|
||||
expected_pixel(x, y, marker, bx, by, !strcmp(fault, "color"), e);
|
||||
if (memcmp(row + x * 4, e, 4) && !mismatches++)
|
||||
printf("mismatch frame=%d x=%d y=%d got=%u,%u,%u,%u want=%u,%u,%u,%u\n", f, x, y,
|
||||
row[x * 4], row[x * 4 + 1], row[x * 4 + 2], row[x * 4 + 3], e[0], e[1], e[2], e[3]);
|
||||
for (int c = 0; c < 4; c++) digest = (digest ^ row[x * 4 + c]) * 1099511628211ULL;
|
||||
}
|
||||
}
|
||||
D3D12_RANGE none = {0, 0};
|
||||
ID3D12Resource_Unmap(readback, 0, &none);
|
||||
verified++;
|
||||
if (mismatches) bad_frames++;
|
||||
}
|
||||
API(IDXGISwapChain3_Present(swap, (UINT)vsync, 0), "Present");
|
||||
presented++;
|
||||
if (f == 0) {
|
||||
char msg[96];
|
||||
snprintf(msg, sizeof msg, "pixels=%d mismatched_frames=%d present=ok", W * H, bad_frames);
|
||||
gate("frame.first", bad_frames == 0, msg);
|
||||
if (!strcmp(fault, "crash")) *(volatile int *)0 = 1;
|
||||
if (!strcmp(fault, "hang")) Sleep(INFINITE);
|
||||
}
|
||||
if (f % 100 == 50) {
|
||||
churn_ok = churn(aux_alloc, aux, (unsigned)f) && churn_ok;
|
||||
churns++;
|
||||
}
|
||||
const double t = now_ms();
|
||||
printf("frame_ms %.4f\n", t - prev);
|
||||
prev = t;
|
||||
if (f == warmup) mem_warm = working_set_mb();
|
||||
if (f % 50 == 0) {
|
||||
const double mb = working_set_mb();
|
||||
if (mb > mem_peak) mem_peak = mb;
|
||||
}
|
||||
if (t - loop_start >= next_sample) {
|
||||
printf("sample t_s=%.0f frame=%d working_set_mb=%.1f verified=%d mismatched=%d\n",
|
||||
(t - loop_start) / 1000.0, f, working_set_mb(), verified, bad_frames);
|
||||
next_sample += 60000.0;
|
||||
}
|
||||
}
|
||||
/* signal after the last Present so the final wait covers it */
|
||||
const UINT64 idle = fence_next++;
|
||||
API(ID3D12CommandQueue_Signal(queue, fence, idle), "final signal");
|
||||
wait_for(idle);
|
||||
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof msg, "presented=%d verified=%d mismatched=%d digest=%016llx", presented, verified,
|
||||
bad_frames, digest);
|
||||
gate("frame.continuous", presented == f && bad_frames == 0 && (external || duration_s || presented == frames), msg);
|
||||
snprintf(msg, sizeof msg, "cycles=%d", churns);
|
||||
gate("resources.churn", churn_ok && (churns > 0 || presented <= 50), msg);
|
||||
if (external) {
|
||||
snprintf(msg, sizeof msg, "keys_seen=%d offset=%d,%d want=16,32 (delivered from outside)", keys_seen,
|
||||
off_x, off_y);
|
||||
gate("input", keys_seen == 5 && off_x == 16 && off_y == 32 && bad_frames == 0, msg);
|
||||
} else {
|
||||
snprintf(msg, sizeof msg, "posted=%d received=%d offset=%d,%d want=16,32 (PostMessage)", injected,
|
||||
keys_seen, off_x, off_y);
|
||||
gate("input", injected == 5 && keys_seen == 5 && off_x == 16 && off_y == 32 && bad_frames == 0, msg);
|
||||
}
|
||||
const double mem_end = working_set_mb();
|
||||
if (mem_end > mem_peak) mem_peak = mem_end;
|
||||
if (mem_warm < 0 && f <= warmup) mem_warm = mem_end; /* run ended before warm-up */
|
||||
snprintf(msg, sizeof msg, "working_set_mb_after_warmup=%.1f end=%.1f peak_sampled=%.1f bound_growth=%d",
|
||||
mem_warm, mem_end, mem_peak, max_growth);
|
||||
gate("memory.bounded", mem_warm > 0 && mem_end > 0 && mem_end - mem_warm <= max_growth, msg);
|
||||
const HRESULT removed = ID3D12Device_GetDeviceRemovedReason(dev);
|
||||
snprintf(msg, sizeof msg, "device_removed_reason=0x%08lx", (unsigned long)removed);
|
||||
gate("device.healthy", removed == S_OK, msg);
|
||||
|
||||
if (hold_ms > 0) {
|
||||
/* the last presented image stays in the window; keep handling messages */
|
||||
printf("holding hold_ms=%d\n", hold_ms);
|
||||
const double until = now_ms() + hold_ms;
|
||||
while (now_ms() < until && !quit_requested) {
|
||||
pump();
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
ID3D12Resource_Unmap(cb, 0, NULL);
|
||||
#define DROP(p, vt) vt##_Release(p)
|
||||
DROP(pso_cs, ID3D12PipelineState);
|
||||
DROP(pso_full, ID3D12PipelineState);
|
||||
DROP(pso_quad, ID3D12PipelineState);
|
||||
DROP(rs_cs, ID3D12RootSignature);
|
||||
DROP(rs_gfx, ID3D12RootSignature);
|
||||
DROP(smp_heap, ID3D12DescriptorHeap);
|
||||
DROP(srv_heap, ID3D12DescriptorHeap);
|
||||
DROP(dsv_heap, ID3D12DescriptorHeap);
|
||||
DROP(rtv_heap, ID3D12DescriptorHeap);
|
||||
ID3D12Resource *owned[] = {readback, cb, ib, vb, tb, ta, depth, post, off, back[0], back[1]};
|
||||
for (size_t i = 0; i < sizeof owned / sizeof owned[0]; i++) ID3D12Resource_Release(owned[i]);
|
||||
DROP(aux, ID3D12GraphicsCommandList);
|
||||
DROP(list, ID3D12GraphicsCommandList);
|
||||
DROP(aux_alloc, ID3D12CommandAllocator);
|
||||
for (int i = 0; i < SLOTS; i++) DROP(alloc[i], ID3D12CommandAllocator);
|
||||
DROP(swap, IDXGISwapChain3);
|
||||
DROP(swap1, IDXGISwapChain1);
|
||||
DROP(factory, IDXGIFactory4);
|
||||
DROP(fence, ID3D12Fence);
|
||||
DROP(queue, ID3D12CommandQueue);
|
||||
const ULONG refs = ID3D12Device_Release(dev);
|
||||
int clean = CloseHandle(fence_event) != 0;
|
||||
clean = DestroyWindow(hwnd) && clean;
|
||||
pump();
|
||||
snprintf(msg, sizeof msg, "window_destroyed device_refs_after_release=%lu", (unsigned long)refs);
|
||||
gate("shutdown", clean && refs == 0, msg);
|
||||
|
||||
if (failures) {
|
||||
printf("FAIL integrated12 failed_gates=%d\n", failures);
|
||||
return 1;
|
||||
}
|
||||
printf("PASS integrated12 frames=%d verified=%d\n", presented, verified);
|
||||
return 0;
|
||||
}
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Drive the D3D12 workload with macOS keyboard events.
|
||||
|
||||
Starts the workload through `betterxen hybrid run` with `--external-input`, finds its window,
|
||||
brings that process to the front and posts key events to that process only
|
||||
(CGEventPostToPid), so nothing is typed into any other application. The events travel macOS
|
||||
-> Wine's Mac driver -> the Windows message queue. They are synthesized, not typed on a
|
||||
keyboard. Needs the Accessibility permission, `swiftc` and a logged-in GUI session.
|
||||
|
||||
usage: send_keys.py RUNNER BOTTLE EXE [--keys right,right,down,left,down] [--expect pass|fail]
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
CODES = {"left": 123, "right": 124, "down": 125, "up": 126}
|
||||
SENDER = r"""
|
||||
import AppKit
|
||||
let title = "BetterXen D3D12 workload"
|
||||
guard CGPreflightPostEventAccess() else { print("no event-posting permission"); exit(3) }
|
||||
var pid: pid_t = 0
|
||||
for _ in 0..<120 {
|
||||
let all = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID) as? [[String: Any]] ?? []
|
||||
if let w = all.first(where: { ($0[kCGWindowName as String] as? String) == title }) {
|
||||
pid = pid_t(w[kCGWindowOwnerPID as String] as! Int32); break
|
||||
}
|
||||
usleep(250_000)
|
||||
}
|
||||
guard pid > 0 else { print("window not found"); exit(4) }
|
||||
sleep(2)
|
||||
NSRunningApplication(processIdentifier: pid)?.activate(options: [])
|
||||
sleep(1)
|
||||
for code in CommandLine.arguments.dropFirst().compactMap({ UInt16($0) }) {
|
||||
for down in [true, false] {
|
||||
CGEvent(keyboardEventSource: nil, virtualKey: code, keyDown: down)?.postToPid(pid)
|
||||
usleep(60_000)
|
||||
}
|
||||
usleep(250_000)
|
||||
}
|
||||
print("posted to pid \(pid)")
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("runner")
|
||||
p.add_argument("bottle")
|
||||
p.add_argument("exe")
|
||||
p.add_argument("--keys", default="right,right,down,left,down")
|
||||
p.add_argument("--expect", choices=["pass", "fail"], default="pass")
|
||||
a = p.parse_args()
|
||||
codes = [str(CODES[k]) for k in a.keys.split(",") if k]
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
source, binary = Path(tmp) / "send.swift", Path(tmp) / "send"
|
||||
source.write_text(SENDER)
|
||||
subprocess.run(["swiftc", "-O", str(source), "-o", str(binary)], check=True)
|
||||
record = open(Path(tmp) / "run.json", "w+")
|
||||
run = subprocess.Popen(
|
||||
[a.runner, "hybrid", "run", "--bottle", a.bottle, "--timeout", "90", "--",
|
||||
a.exe, "--external-input", "--input-timeout-s", "20"],
|
||||
stdout=record, stderr=subprocess.DEVNULL)
|
||||
sent = subprocess.run([str(binary)] + codes, capture_output=True, text=True, timeout=60)
|
||||
print(sent.stdout.strip())
|
||||
run.wait(timeout=120)
|
||||
record.seek(0)
|
||||
gates = {g["name"]: g for g in json.load(record)["gates"]}
|
||||
if sent.returncode != 0 or "input" not in gates:
|
||||
print("FAIL keyboard: the events were not sent or the workload reported no input gate")
|
||||
return 1
|
||||
print("workload:", gates["input"]["detail"])
|
||||
passed = gates["input"]["passed"]
|
||||
if passed == (a.expect == "pass"):
|
||||
print(f"PASS keyboard: input gate {'passed' if passed else 'failed'} as expected")
|
||||
return 0
|
||||
print(f"FAIL keyboard: input gate {'passed' if passed else 'failed'}, expected {a.expect}")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #364): a Windows console program that checks itself.
|
||||
// It computes CRC-32 over "123456789" (the standard check value is 0xCBF43926), runs a
|
||||
// threaded counter, and prints the architecture it was compiled for. Exit code 0 means every
|
||||
// check passed; non-zero names the failing check. It touches no game data and no graphics.
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
static uint32_t crc32(const unsigned char *p, size_t n) {
|
||||
uint32_t c = 0xFFFFFFFFu;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
c ^= p[i];
|
||||
for (int k = 0; k < 8; k++) c = (c >> 1) ^ (0xEDB88320u & (0u - (c & 1u)));
|
||||
}
|
||||
return ~c;
|
||||
}
|
||||
|
||||
static volatile LONG counter;
|
||||
static DWORD WINAPI bump(LPVOID arg) {
|
||||
(void)arg;
|
||||
for (int i = 0; i < 100000; i++) InterlockedIncrement(&counter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// `--sleep-silent <seconds>` sleeps before printing anything, to exercise stall detection in
|
||||
// the supervisor; the checks still run afterwards.
|
||||
int main(int argc, char **argv) {
|
||||
if (argc > 2 && !strcmp(argv[1], "--sleep-silent")) Sleep((DWORD)atoi(argv[2]) * 1000u);
|
||||
#if defined(__x86_64__)
|
||||
const char *arch = "x86_64";
|
||||
#elif defined(__aarch64__)
|
||||
const char *arch = "aarch64";
|
||||
#else
|
||||
const char *arch = "other";
|
||||
#endif
|
||||
printf("selfcheck arch=%s pointer_bits=%zu\n", arch, sizeof(void *) * 8);
|
||||
uint32_t c = crc32((const unsigned char *)"123456789", 9);
|
||||
if (c != 0xCBF43926u) { printf("FAIL crc32 got %08x\n", (unsigned)c); return 1; }
|
||||
HANDLE t[4];
|
||||
for (int i = 0; i < 4; i++) t[i] = CreateThread(NULL, 0, bump, NULL, 0, NULL);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!t[i]) { printf("FAIL CreateThread\n"); return 2; }
|
||||
}
|
||||
WaitForMultipleObjects(4, t, TRUE, 30000);
|
||||
if (counter != 400000) { printf("FAIL counter=%ld\n", (long)counter); return 3; }
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "win-selfcheck-rust"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "win-selfcheck-rust"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-or-later"
|
||||
publish = false
|
||||
|
||||
# Standalone: built for a Windows target by scripts/hybrid/build-windows-workloads.sh, not a
|
||||
# member of the BetterXen workspace.
|
||||
[workspace]
|
||||
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #364): a Rust Windows console program that checks itself.
|
||||
// Exercises thread-local storage and threads, which the contributor notes in
|
||||
// docs/research/upstream-integration-audit.md report as the failure point of the plain
|
||||
// `-gnu` Windows target. Exit 0 means every check passed.
|
||||
use std::cell::Cell;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::thread;
|
||||
|
||||
thread_local! { static TLS: Cell<u64> = const { Cell::new(0) }; }
|
||||
static TOTAL: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
fn main() {
|
||||
println!("selfcheck-rust arch={} os={}", std::env::consts::ARCH, std::env::consts::OS);
|
||||
let handles: Vec<_> = (1..=4u64)
|
||||
.map(|n| {
|
||||
thread::spawn(move || {
|
||||
for _ in 0..1000 {
|
||||
TLS.with(|c| c.set(c.get() + n));
|
||||
}
|
||||
let v = TLS.with(Cell::get);
|
||||
TOTAL.fetch_add(v, Ordering::SeqCst);
|
||||
v
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
for (i, h) in handles.into_iter().enumerate() {
|
||||
let got = h.join().expect("thread panicked");
|
||||
let want = 1000 * (i as u64 + 1);
|
||||
if got != want {
|
||||
println!("FAIL tls thread {i}: got {got}, want {want}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
if TOTAL.load(Ordering::SeqCst) != 10_000 {
|
||||
println!("FAIL total");
|
||||
std::process::exit(2);
|
||||
}
|
||||
if TLS.with(Cell::get) != 0 {
|
||||
println!("FAIL main-thread TLS was modified by other threads");
|
||||
std::process::exit(3);
|
||||
}
|
||||
println!("PASS");
|
||||
}
|
||||
Reference in new issue
Block a user