Commit Graph
199 Commits
Author SHA1 Message Date
atharvranjan ec2170d480 Merge main into track-f/453-d3dmetal-gpu-limits
Bring in main at cc5ce59 and resolve three documentation conflicts:

- CHANGELOG.md: keep the #453 entry above the entries added on main.
- docs/README.md: keep both new research links (swapchain references
  and D3DMetal GPU limits).
- docs/roadmap.md: take main's milestone table, including the verified
  M0/M1 status and the expanded M2 row, and append only the two
  measured-constraint links from this branch to the M2 and M3 rows.

No source, shader, header or research-note content changes relative to
either parent.

Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-26 13:16:44 -06:00
ates cda66a57f2 Merge remote-tracking branch 'origin/main' into track-e/456-query-api-impl-dispatch
Signed-off-by: ates <ahmetrizaates@hotmail.com>

# Conflicts:
#	CHANGELOG.md
2026-11-26 21:31:48 +03:00
ates 39baf092a3 Wire offline IXUser change-event and query slots in com_dispatch
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 21:17:41 +03:00
ates 0a30562cde Implement public GDK COM QueryApiImpl dispatch in xgameruntime.dll (#456)
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 21:15:21 +03:00
Vicente Abarca fb56805459 Stage xgameruntime.dll and its shim imports into system32 (#457)
GDK titles load the runtime with LoadLibraryExW(L"xgameruntime.dll",
NULL, LOAD_LIBRARY_SEARCH_SYSTEM32), which never searches WINEPATH, so
the bootstrap failed with E_GAMERUNTIME_DLL_NOT_FOUND before the #441
loader exports were reached.

bx-cli run now copies xgameruntime.dll into the environment's
drive_c/windows/system32 before launch. It also copies every BetterXen
shim that DLL imports, found with bx-probe (today bx_runtime_veh.dll),
because the restricted search also applies to a DLL's own imports.
Copies are idempotent and replaced through a rename, and bx-cli prints
what it staged. A bare --prefix with no system32 is initialized with
wineboot --init under the same isolated environment. A bottle with no
system32 fails with a hint.

Adds 8 unit tests for staging and the dependency walk, and
tests/conformance/test_system32_staging with a --expect-missing
negative control.

Signed-off-by: Vicente Abarca <135478656+Scarlet-Noble@users.noreply.github.com>
2026-11-26 15:00:38 -03:00
Vicente Abarca 1eb963d883 Address review of test_d3dmetal_gpu_limits and its note (#453)
Fixture:
- check_lock64 keeps its upload buffer alive until the list that copies
  from it has run.
- The spin lock takes an acquire DeviceMemoryBarrier after winning the
  lock, before reading the data, as well as the release barrier.
- A check that fails partway through recording closes and resets the
  list (abandon) instead of leaving stale commands for the next check.
- wave.control checks what D3D12 guarantees: one wave width for every
  thread, and lane indices forming a permutation within each wave, with
  waves identified by WaveReadLaneFirst(id.x). It no longer assumes
  lane == i % width.
- Skips with exit 77 when shader model 6.6 is unavailable or the query
  fails.
- submit checks Signal, SetEventOnCompletion and the Reset calls.
  Resources the GPU may still use are leaked rather than released after
  a hung or removed queue.

Note: the measured constraints are separated from the reports taken
from a commercial title. The reports move to an "Unverified reports
(not evidence)" section, each with the synthetic workload that would
verify it. The M2-gate inference is dropped, and the roadmap rows link
only the measured section. The results are re-measured after the fixes:
with the acquire fence, the 64-try cap drops 96-108 of 512 updates. The
1024-try cap is still exact.

Signed-off-by: Vicente Abarca <135478656+Scarlet-Noble@users.noreply.github.com>
2026-11-26 14:53:44 -03:00
Ateş 4333a7cc5e Merge pull request #452 from skakwy/track-a/437-api-set-shims
Add API-set resolution fixture and ADR 0007 (#437)
2026-11-26 20:42:35 +03:00
ates 66e9351410 Require valid module lookups in test_apiset_resolution and accept ADR 0007
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 20:42:05 +03:00
Ateş 060083cc56 Merge pull request #441 from devil8blade/track-e/439-xgameruntime-dynamic-api-impl
[M1-E3][ABI] Dynamic GDK loader exports in xgameruntime.dll
2026-11-26 20:36:09 +03:00
Vicente Abarca 120a5ec5f6 Document D3DMetal GPU limits and add test_d3dmetal_gpu_limits (#453)
Adds docs/research/d3dmetal-gpu-limits.md: the D3DMetal and Apple GPU
constraints a shader translator has to handle (wave64 splitting, 64-bit
atomics and lock emulation, the 32 KiB mesh output limit, an Apple
shader compiler crash on early-merged output stores, and
OpenExistingHeapFromAddress). Each item is marked as either measured by
the new fixture or reported from local builds of a commercial title. It
is linked from the M2 and M3 roadmap rows and from the docs index.

Adds tests/conformance/test_d3dmetal_gpu_limits: an original D3D12
compute fixture that talks to the host d3d12.dll directly. It has four
original HLSL kernels with committed DXC 1.9.2609 output, and
shaders/compile.sh regenerates them. Expected values are computed on
the CPU.

On an Apple M3 Pro (macOS 27.2.1, CodeWeavers Wine 11.0 built from
source, D3DMetal 4.0b3) the WaveSize(64) pipeline and the kernels using
SM 6.6 64-bit atomics are created but never run. The bounded lock
emulation is exact at a 1024-try cap and drops updates at 64 tries.

Signed-off-by: Vicente Abarca <135478656+Scarlet-Noble@users.noreply.github.com>
2026-11-26 14:32:09 -03:00
skakwyandClaude Sonnet 5.5 2eb59e033b Add API-set resolution fixture and ADR 0007 (#437)
test_apiset_resolution imports one export from each of the six win32_bridge
API-set DLLs through the PE import directory and reports, per name, whether a
BetterXen shim file or a host module serves it, and which module the import
address table slot is bound to. --expect host (default) or --expect shim
selects the outcome that passes.

On CrossOver 26.0 all six names are served by the host (twinapi.appcore.dll
for PSM, user32.dll for ntuser) and +loaddll shows no Loaded record for any
shim file. ADR 0007 proposes relying on Wine's built-ins and records that
evidence; a CrossOver 26.3 re-run is still needed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: skakwy <nils_0805@icloud.com>
2026-11-26 17:53:14 +01:00
devil8blade e7899574ab Keep XErrorReport logs valid UTF-8 and record loader provenance
Invalid bytes are written as \u00XX and a multi-byte character is not
split when the detail buffer fills. The six loader prototypes are
recorded as BetterXen-defined. The two changelog notes are one entry.

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 16:25:51 +00:00
atharvranjan 486f7b197f Check full footprints and keep one Fixed changelog section
Also verify footprint format, width, height and depth, call Release through
the computer's own vtable, and state the release check precisely.

Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-26 10:11:04 -06:00
atharvranjan 390e85fc8d Exercise the texture computer in test_integration_boot
The fixture passed a null descriptor to XGCreateTextureComputer and reported
the stage as pending, although #415 implemented it. Create a 100x50 two-mip
RGBA8 computer, check its layout against hand-computed values, require the
suggested layout to be linear and require release to free the object.

Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-26 10:09:10 -06:00
devil8blade 18178da12c Address review: surface unsupported QueryApiImpl in trace, null out on failure
Unsupported and mismatched QueryApiImpl queries keep their structured log
and also call BX_STUB_LOG so bx-cli trace lists them. Failure paths clear
the output pointer. XErrorReport uses the public void signature.

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 16:05:11 +00:00
devil8blade 2e895e0f9b Export GDK dynamic loader entry points from xgameruntime.dll
The static loader resolves InitializeApiImpl, InitializeApiImplEx,
InitializeApiImplEx2, UninitializeApiImpl, QueryApiImpl, and XErrorReport
with GetProcAddress. Those initialize entry points share the existing
runtime refcount with XGameRuntimeInitialize and
XGameRuntimeInitializeWithOptions. UninitializeApiImpl releases that same
state. QueryApiImpl dispatches the offline families this DLL already
implements and logs any other class or interface. XErrorReport records
the code and message and does not terminate the process.

Closes #439

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 15:38:34 +00:00
ates 925311e852 Merge main and address PR #427 review findings
- Wire physical-page accounting into xmem.cpp via shims/xmem/xmem_accounting.h so XMemGetWorkingSetStatistics and bx_xmem_get_internal_stats report allocated_physical_bytes and enforce one shared title memory budget across heap, virtual, and physical allocations.
- Require exact full-span coverage in unmap_span; empty or partially mapped spans now fail with ERROR_INVALID_PARAMETER without disturbing existing views.
- Document Win32 AWE-modeled synthetic signatures (AllocateUserPhysicalPages / FreeUserPhysicalPages in memoryapi.h) and intra-span duplicate-tag aliasing vs duplicate-tag free rejection.
- Expand test_xmem_physical to cover working-set stats, shared cap enforcement, invalid flags, intra-span duplicate-tag aliasing, duplicate and stale free non-mutation, and partial/empty unmap rejection.
- Resolve CHANGELOG.md conflict with origin/main.

Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 18:30:37 +03:00
ates 7ea4f1f6ca Merge main and address PR #431 review findings
- Replace std::mutex/std::unordered_set + -fexceptions in psm_appnotify.cpp with a Win32 SRWLOCK and HeapAlloc open-addressed token set, keeping -fno-exceptions and reducing both PSM DLLs from ~2.4 MB back to 118 KB.
- Tag state (PSM1) and constrained (PSM2) tokens so cross-family unregisters log foreign_token while duplicate, null, or arbitrary invalid tokens log unknown_token.
- Fix load_bridge to call FreeLibrary on path mismatch or path-query failure without leaking the module handle or reporting a stale GetLastError().
- Verify exact per-(event, detail) JSONL counts inside test_win32_bridge (both with caller-provided BX_LOG_FILE and a self-managed temp log).
- Resolve CHANGELOG.md conflict with origin/main.

Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 18:19:30 +03:00
ates 058bc981dc Merge main and address PR #429 review findings
- Reject ApuAlloc before ApuCreateHeap is called and reset used=0 explicitly on heap creation
- Validate max_streams > 0 and record it on DSP connections in XDspConnectWithMaximumStreamLimit
- Expand test_audio_input to cover pre-heap ApuAlloc failure, single-output ApuAlloc, zero max_streams rejection, and GameInput v0 QueryInterface/method dispatch
- Resolve CHANGELOG.md merge conflict with main

Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 18:08:53 +03:00
ates 0a2544cd51 Merge main and address review feedback on REX decoding, crash write isolation, and marker constant
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 18:01:41 +03:00
ates 4c7f1c5aff Merge main, sanitize console memory attributes in XMemVirtualAlloc, and zero larger stats tail
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 17:19:52 +03:00
ates 035c93e4d6 Merge main, guard closed handle in GetFileInformation, reject ambiguous requests, and expand tests
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 17:17:19 +03:00
ates e79b0b9648 Merge branch 'main' into track-e/418-offline-gdk-runtime
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 17:13:52 +03:00
ates 044f2b628b Merge main and accept E_POINTER for null descriptor probe in test_integration_boot
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 17:04:09 +03:00
devil8blade f9ecde4e95 xg_xs: stage overlapping copies and split the size contract
Stage a source span before an in-place pitch change so later rows stay
intact. Report a D3D12 copy_end beside the aligned allocation span, and
look up mip offsets from a table built at creation.

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 13:45:46 +00:00
ates 8d7f856a83 Merge main, guard shaderless DXBC for D3DMetal 3.0, and log feature level
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 16:16:03 +03:00
ates 3f90a73deb Chain unhandled exception filter and clarify clwb form count
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 16:10:47 +03:00
devil8blade ce5a0a6e43 xg_xs: log unimplemented layouts and round BC footprints
Name TEXTURE1D, TEXTURE3D, and MSAA in the unimplemented log, and
include the SW_64KB mode in tiled vtable traces. Footprints now use
D3D12 block-rounded dimensions, and tiled CopyFromSubresource is tested.

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 10:44:47 +00:00
devil8blade d7cd155924 xg_xs: add linear 2D texture address computer
Implement XGCreateTextureComputer and XGSuggestSwizzleMode for
linear RGBA8 and BC1 through BC7 layouts. RDNA 2 SW_64KB_S/D/R
modes return E_NOTIMPL and do not write addresses.

Closes #415

Signed-off-by: devil8blade <360741796+devil8blade@users.noreply.github.com>
2026-11-26 10:32:22 +00:00
sahib453 c70e544660 Implement D3D12XboxCreateDevice as a logging COM proxy over host d3d12.dll
d3d12_xs.dll (M1-C1, #414) now creates a device through the host
D3D12CreateDevice and returns a proxy covering ID3D12Device through
ID3D12Device10, ID3D12CommandQueue, ID3D12CommandAllocator and
ID3D12GraphicsCommandList through 7 (the levels the mingw-w64 d3d12.h
declares). Child objects are returned as proxies and translated back
for the host; pipeline-state creation logs shader container metadata;
unsupported interface levels and slots past the public vtable log via
BX_VTABLE_STUB_LOG. Pass-through methods are generated by
shims/d3d12_xs/tools/gen_proxy.py. Adds tests/conformance/test_d3d12_xs.

Signed-off-by: sahib453 <sahibsingh4533@gmail.com>
2026-11-26 13:28:05 +05:30
ates cee636193a Cover Win32 bridges and track offline PSM registrations
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 10:13:12 +03:00
ates 134eee3a28 Cover CLWB addressing and log unhandled guest exceptions
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 10:13:12 +03:00
ates 43f32acb82 Implement bounded audio queues and GameInput COM stub
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 10:06:36 +03:00
sahib453 d186440216 Add test_integration_boot synthetic boot fixture linking all 16 shims
Adds tests/conformance/test_integration_boot (M1-F1, #420): an original
x86-64 PE32+ program whose import directory names every BetterXen shim
DLL and which walks a startup-shaped sequence through reverse-order
shutdown, emitting one JSON checkpoint and one bx_log_emit record per
stage with status pass, pending or fail. Pending marks an M0 stub or a
host-answered import, never counts as a pass, and fails under --strict.

Signed-off-by: sahib453 <sahibsingh4533@gmail.com>
2026-11-26 12:26:30 +05:30
ates 88fa2d1a99 Deliver queued callbacks on xgameruntime shutdown
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 09:53:14 +03:00
ates ab696f1f07 Map xmem physical pages into shared aliases
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 09:52:04 +03:00
ates 0b0e23e10a Exercise asynchronous storage through XCRDAPI
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 09:49:04 +03:00
ates 19c240edd5 Enforce xmem title memory budgets
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 09:38:59 +03:00
ates 8742734a0a Implement offline xgameruntime task queues and services
Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 09:18:48 +03:00
ates 30e551a161 Overhaul repo into clean 6-track hybrid M0 workspace and retire legacy native files
Rebases onto origin/main and retires the paused in-tree native-first workspace, legacy scripts, legacy CI, and native-only docs per ADR 0006 (preserving full history permanently at Git tag native-first-final).

Addresses all maintainer review findings on PR #406:
- Isolate CrossOver/Wine child process environment in bx-cli (env_clear + minimal allowlist + opt-in --inherit-env, with unit tests)
- Replace naive objdump grep in scripts/build-shims.sh with strict PE Export Directory verification (exact names, ordinals, forwarders, 0 extra exports, 0 forbidden MinGW imports across all 16 DLLs / 102 exports)
- Restore global * @MacosPorters/maintainers fallback in .github/CODEOWNERS alongside per-track rules
- Restore independent-verification, claims/evidence-class, provenance-first, and contributor clean-room protections in AGENTS.md
- Unify docs/roadmap.md, CONTRIBUTING.md, README.md, docs/README.md, THIRD_PARTY_NOTICES.md, and CHANGELOG.md around Milestones M0-M6 and ADR 0006

Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-26 07:59:27 +03:00
atharvranjan 9b20f78a06 Remove agent-pr-checks tests and docs 2026-11-25 14:41:35 -06:00
Thilo Schaeffer d486d21813 docs: clarify AVX exception policy and Intel references
Signed-off-by: Thilo Schaeffer <38328877+Thxlx@users.noreply.github.com>
2026-11-25 17:45:04 +01:00
Thilo Schaeffer 478e9218ac docs: specify the guest AVX and AVX2 contract
Signed-off-by: Thilo Schaeffer <38328877+Thxlx@users.noreply.github.com>
2026-11-25 17:21:18 +01:00
atharvranjan 566f803111 Remove the PR template check
Delete the pr-template workflow, its checker script and tests, and the
CI step that ran those tests. Update CONTRIBUTING.md and the changelog.

Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-25 04:18:06 -06:00
atharvranjan d71efe0495 Integrate Gate A2 and verify native compiler architecture before execution
Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-24 22:09:39 -06:00
atharvranjan 522560d0a2 Integrate PR #271 while preserving BetterXen terminology
Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-24 21:48:34 -06:00
atharvranjan bfe0bbfaf7 Rename project and native applications to BetterXen
Update active repository links and coordination settings while retaining upstream history, notices, legacy library names and guest interfaces. Document the independent-copy migration and its limits.

Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-24 20:51:08 -06:00
zachdoxsee 0a17f0cb73 loader: add the Gate A2 hosted C program and its test (#419)
An original C program, tests/compat_fixtures/gate_a2.c, is built from
source with the mingw-w64 C runtime (UCRT) and run through the loader, the
standard services and the ARM64 DBT. The runtime's own startup code runs
before main; the program uses argc and argv, the heap, qsort, printf, a file
written with fprintf and read back with fgets, atexit, and a return from
main. Expected output is recomputed in Rust, not read back from a run.
Control variants end in a failed check, in exit(42) and in abort().

The test fails, and does not skip, when the compiler is missing, so the CI
workflow installs mingw-w64. Nothing from mingw-w64 is stored in the
repository.

Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
2026-11-25 02:25:26 +01:00
zachdoxsee e32c85ff12 Merge task/378-fninit into task/419-gate-a2
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
2026-11-25 02:14:51 +01:00
zachdoxsee 47a819e05b loader: add FNINIT and the x87 control, status and tag words (#378)
The decoder refused FNINIT (DB E3), which the mingw-w64 C runtime runs
once before main. Guest state gains the x87 control, status and tag
words, and FNINIT sets them to the Intel SDM values 037F, 0 and FFFF.
Both engines run the shared semantics.

The registry gains a form key, rm, that pins a register-only form to one
ModRM byte: the other bytes of DB /4 are different instructions. No other
x87 instruction is added and CPUID still reports no FPU.

Part of Gate A2.

Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
2026-11-24 23:01:33 +01:00