Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,41 @@ jobs:
echo "::warning::E5-substrate: FAIL or no output — see log above (warn-only)"
fi

# ── D3D11→Metal bridge smoke — E5 r11 (F-NSWINDOW-E5 r11).
# Builds native/d3d11_metal_bridge.m + test.c and runs the native driver:
# CreateDeviceAndSwapChain → GetBuffer → CreateRenderTargetView →
# OMSetRenderTargets → ClearRenderTargetView(blue) → Draw(triangle,red) →
# Present → readback → pixel assertions (px_clear=0x0000FFFF,
# px_triangle=0xFF0000FF, nonuniform=1).
# own1: gamebox's own D3D11 *interface shape* over Apple Metal — NOT Wine,
# NOT DXVK, NOT d3d11.dll source. No DRM, no game asset.
# 구현됨·미배선 (dead-until-wired) — proven native but not yet driven
# through the i386 interpreter (r12 target).
# validated_manjeom stays 0; this is a bridge proof, not a game frame.
#
# Warn-only: no-GPU runner → __D3D11_BRIDGE__ SKIP (exit 0).
# compile-fail or pixel assertion fail → ::warning:: (never ::error::).
# Same pattern as r10 Metal substrate step.
- name: Smoke — D3D11→Metal bridge (E5 r11)
shell: bash
run: |
set -uo pipefail
SDK="$(xcrun --sdk macosx --show-sdk-path)"
clang -arch arm64 -isysroot "$SDK" -fobjc-arc -O2 -Wall -Wextra \
-framework Metal -framework Foundation \
-o "$RUNNER_TEMP/d3d11_bridge_test" \
native/d3d11_metal_bridge_test.c native/d3d11_metal_bridge.m \
|| { echo "::warning::d3d11_bridge_test compile failed (E5 r11 — warn-only)"; exit 0; }
out="$("$RUNNER_TEMP/d3d11_bridge_test" 2>&1)" || true
echo "$out"
if echo "$out" | grep -q "__D3D11_BRIDGE__ PASS"; then
echo "E5-r11-bridge: PASS — D3D11→Metal bridge native test confirmed on this runner"
elif echo "$out" | grep -q "__D3D11_BRIDGE__ SKIP"; then
echo "::warning::E5-r11-bridge: SKIP — no GPU/Metal session on this runner (ground-truth finding, not a failure)"
else
echo "::warning::E5-r11-bridge: FAIL or no output — see log above (warn-only)"
fi

# ── CLI smoke — own2 PASS/FAIL/PARTIAL subcommands compile + run.
- name: Smoke — gamebox CLI subcommands
shell: bash
Expand Down
6 changes: 5 additions & 1 deletion ARCHITECTURE.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
},
{
"name": "E5 r10 measured (2026-06-26·#32) — 헤드리스 Metal 오프스크린 렌더+readback 로컬 PASS (서브스트레이트 증명)",
"summary": "native/metal_offscreen_smoke.m (ObjC+Metal+Foundation): 64×64 MTLPixelFormatBGRA8Unorm 오프스크린 텍스처·인라인 MSL(newLibraryWithSource:)·blue 클리어+red 삼각형 1 드로우·waitUntilCompleted·getBytes readback·픽셀 어서션 (px_clear=0x0000FFFF·px_triangle=0xFF0000FF·nonuniform=1). 로컬 M4 결과: __METAL_SMOKE__ PASS device=Apple M4. CI(blacksmith-6vcpu-macos-15·실 Apple-Silicon·GPU) 결과: 확인 예정(warn-only step). own1: 순수 Apple Metal·Wine 0·게임 애셋 0. 서브스트레이트 증명 — 게임 프레임 아님·validated_manjeom=0. break-walls+verify-done: \"디스플레이 불필요·Metal 헤드리스 렌더 가능\" 어서션을 실행·CI-게이트 사실로 전환. r11 표적: D3D11 device/swapchain 셰임(lib/loader/dx_d3d11.hexa 실 Metal 배선) → CreateDevice/CreateSwapChain → 이 증명된 오프스크린 경로 라우팅 + 최소 D3D11 테스트 PE 인터프리터 실행."
"summary": "native/metal_offscreen_smoke.m (ObjC+Metal+Foundation): 64×64 MTLPixelFormatBGRA8Unorm 오프스크린 텍스처·인라인 MSL(newLibraryWithSource:)·blue 클리어+red 삼각형 1 드로우·waitUntilCompleted·getBytes readback·픽셀 어서션 (px_clear=0x0000FFFF·px_triangle=0xFF0000FF·nonuniform=1). 로컬 M4 결과: __METAL_SMOKE__ PASS device=Apple M4. CI(blacksmith-6vcpu-macos-15·실 Apple-Silicon·GPU) 결과: 확인 예정(warn-only step). own1: 순수 Apple Metal·Wine 0·게임 애셋 0. 서브스트레이트 증명 — 게임 프레임 아님·validated_manjeom=0. break-walls+verify-done: \"디스플레이 불필요·Metal 헤드리스 렌더 가능\" 어서션을 실행·CI-게이트 사실로 전환. r11 표적: D3D11 device/swapchain 셰임 → Metal 오프스크린 경로 배선."
},
{
"name": "E5 r11 measured (2026-06-26) — D3D11→Metal 브리지 네이티브 증명 (구현됨·미배선)",
"summary": "native/d3d11_metal_bridge.{h,m} (C헤더+ObjC+Metal+Foundation): D3D11-인터페이스-형상 COM 오브젝트(ID3D11Device·ID3D11DeviceContext·IDXGISwapChain·ID3D11RenderTargetView·ID3D11Texture2D) + 컴팩트 vtable(구현 메서드만; IUnknown 스텁 [0-2] 포함). gamebox_D3D11CreateDeviceAndSwapChain → MTLDevice+오프스크린 64×64 BGRA8 backBuffer+인라인 MSL PSO. ClearRenderTargetView=loadAction:Clear 독립 패스; Draw=loadAction:Load+삼각형; Present=no-op(헤드리스). gamebox_d3d11_readback=[MTLTexture getBytes:]. native/d3d11_metal_bridge_test.c(순수 C): vtable 포인터 경로로 CreateDeviceAndSwapChain→GetBuffer→CreateRenderTargetView→OMSetRenderTargets→ClearRenderTargetView(blue)→Draw(3,0)→Present→readback→픽셀 어서션. 로컬 M4 결과(빌드 clean·-Wall -Wextra 경고 없음): __D3D11_BRIDGE__ PASS px_clear=0x0000FFFF px_triangle=0xFF0000FF nonuniform=1. CI warn-only 스텝 추가(r10 패턴). own1: Wine 0·DXVK 0·d3d11.dll 소스 0·DRM 0. 구현됨·미배선 dead-until-wired — 인터프리터를 통한 PE 구동은 r12. validated_manjeom=0(네이티브 테스트·게임 프레임 아님). 다음 r12: 최소 D3D11 테스트 PE(own1 자작 i386 PE) + 인터프리터 IAT autobind 배선 → 이 브리지 shim → Metal 오프스크린 → readback = validated_manjeom>0 게이트."
},
{
"name": "🧱 E5 게이트 재분류 (2026-06-26 실측 — substrate/투자 프론티어, 하드웨어 천장 아님)",
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,51 @@ All notable changes to `gamebox` are documented in this file.

### Added

- feat(F-NSWINDOW-E5 r11): **D3D11→Metal 브리지 + 네이티브 드라이버 테스트 (구현됨·미배선)**
— r10 이 증명한 헤드리스 Metal 오프스크린 렌더 서브스트레이트 위에, D3D11-인터페이스-형상의
Metal 브리지를 구축하고 네이티브 드라이버 테스트로 검증한다.
**own1**: gamebox 자체 D3D11 인터페이스 형상 → Apple Metal 라우팅. Wine 0·DXVK 0·
d3d11.dll 소스 0·DRM 0·Warden 0·게임 애셋 0. **validated_manjeom 여전히 0** — 브리지는
네이티브 테스트로 증명됐으나 아직 i386 인터프리터를 통해 PE가 구동하지 않음.
**구현됨·미배선 (dead-until-wired)** 라벨: r12에서 인터프리터 IAT autobind 배선 예정.
(1) **`native/d3d11_metal_bridge.h`** — COM 형상 C 헤더: `ID3D11Device`·
`ID3D11DeviceContext`·`IDXGISwapChain`·`ID3D11RenderTargetView`·`ID3D11Texture2D`
각 COM 오브젝트를 앞단 vtable 포인터(`lpVtbl`) + `_impl`(opaque bridge-retained
GBMetalContext\*)로 정의. vtable은 구현된 메서드 부분집합만(컴팩트): Device[0-2]=
IUnknown 스텁/Release·[3]=CreateRenderTargetView(실 d3d11.dll 인덱스:9);
Context[3]=OMSetRenderTargets(33)·[4]=ClearRenderTargetView(50)·[5]=Draw(13);
SwapChain[3]=GetBuffer(9)·[4]=Present(8). `gamebox_D3D11CreateDeviceAndSwapChain`
(12-파라미터 실 시그니처를 width+height로 단순화·매핑 문서화) + 픽셀 readback 헬퍼
`gamebox_d3d11_readback`. Win32 타입(HRESULT·UINT·FLOAT 등) gamebox-local 정의
(windows.h 의존 없음). r12 wiring 노트: vtable 인덱스가 실 d3d11.dll과 다름(컴팩트);
자작 r12 테스트 PE는 이 인덱스를 써야 함.
(2) **`native/d3d11_metal_bridge.m`** (Objective-C + Metal + Foundation, ARC):
`GBMetalContext`(ObjC 클래스) — MTLDevice·queue·library·PSO·backBuffer(64×64
MTLPixelFormatBGRA8Unorm·RenderTarget|ShaderRead·StorageModeShared)·triColorBuf
(red=1,0,0,1) 보유. 각 COM 오브젝트 `_impl` = `CFBridgingRetain(ctx)`(공유 컨텍스트
에 대한 명시적 strong ref; Release() 시 CFBridgingRelease + free). MSL 인라인 소스
(r10 smoke와 동일 셰이더). ClearRenderTargetView → loadAction=Clear 독립 렌더 패스
(CallerRGBA 색상, 0 드로우); Draw → loadAction=Load 렌더 패스(클리어 보존 + 삼각형 드로우);
Present → no-op(헤드리스); gamebox_d3d11_readback → [MTLTexture getBytes:].
(3) **`native/d3d11_metal_bridge_test.c`** (순수 C) — D3D11 앱이 호출하는 것과 동일한
vtable 포인터 경로: CreateDeviceAndSwapChain → sc→GetBuffer → dev→CreateRenderTargetView
→ ctx→OMSetRenderTargets → ctx→ClearRenderTargetView(blue) → ctx→Draw(3,0) →
sc→Present → readback → 픽셀 어서션. MTLDevice nil → `__D3D11_BRIDGE__ SKIP
reason=no_device` + exit 0(정직·warn-only). 통과 시 `__D3D11_BRIDGE__ PASS
px_clear=0x0000FFFF px_triangle=0xFF0000FF nonuniform=1` + exit 0. 어서션 실패 시
`__D3D11_BRIDGE__ FAIL reason=...` + exit 1. **로컬 M4 결과(빌드 clean·-Wall -Wextra
경고 없음)**: `__D3D11_BRIDGE__ PASS px_clear=0x0000FFFF px_triangle=0xFF0000FF
nonuniform=1`. (4) **`native/build.sh`** — `d3d11_bridge_test` 타깃 추가(ObjC ARC·
Metal/Foundation; `-std=c11`·`-Wpedantic` 제외). ad-hoc codesign. (5)
**`.github/workflows/ci.yml`** — `Smoke — D3D11→Metal bridge (E5 r11)` 스텝 추가:
r10 Metal 서브스트레이트 스텝 직후·CLI smoke 직전. compile+run → `__D3D11_BRIDGE__`
파싱 → PASS/SKIP/FAIL 각 로그. **warn-only**(컴파일 실패·GPU 없음·어서션 실패 모두
`::warning::`, 빌드 red 없음). r10과 동일 패턴.
**r12 정의**: 최소 D3D11 테스트 PE(own1 자작 i386 PE·own2 클린·게임 애셋 0) + 인터프리터
IAT autobind 배선 → D3D11 import(CreateDeviceAndSwapChain·Present 등)를 이 브리지 shim에
바인딩 → PE가 vtable 호출 → Metal 오프스크린 렌더 → readback 픽셀 어서션 =
**validated_manjeom>0 달성 게이트**. r12 이름: `feat(F-NSWINDOW-E5 r12): 최소 D3D11 테스트 PE + 인터프리터 end-to-end 배선 (validated_manjeom>0 게이트)`.

- feat(F-NSWINDOW-E5 r10): **헤드리스 Metal 오프스크린 렌더 + 픽셀 readback 스모크 (E5 서브스트레이트 증명)**
— r9 가 명시한 다음 과제(`r10 표적 = DX→Metal 브리지(헤드리스 Metal 오프스크린 readback smoke 먼저 CI 검증)`)를
완료한다. **서브스트레이트 증명 — 게임 프레임 아님; `validated_manjeom` 여전히 0.** (1) **`native/metal_offscreen_smoke.m`**
Expand Down
15 changes: 14 additions & 1 deletion native/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,17 @@ codesign -d --entitlements - pe_to_macho_shim 2>&1 | head -10 || true
codesign --verify --verbose=2 i386_cpu_test || true
codesign --verify --verbose=2 metal_offscreen_smoke || true

echo "[build] done — ./pe_to_macho_shim <pe.exe> / ./i386_decode_test <pe.exe> [count] / ./i386_cpu_test [pe.exe] / ./metal_offscreen_smoke"
# d3d11_metal_bridge_test — D3D11-interface-shaped Metal bridge test (E5 r11).
# own1: gamebox's own D3D11 *interface shape* over Apple Metal.
# No Wine, no DXVK, no d3d11.dll source. Plain Metal backend.
# 구현됨·미배선 (dead-until-wired to PE via interpreter, r12 target).
echo "[build] compiling d3d11_metal_bridge_test (arch=arm64, sdk=macosx, ObjC+Metal)"
"$CC" -arch arm64 -isysroot "$SDK" -fobjc-arc -O2 -Wall -Wextra \
-framework Metal -framework Foundation \
-o d3d11_bridge_test \
d3d11_metal_bridge_test.c d3d11_metal_bridge.m
echo "[build] codesigning d3d11_bridge_test (ad-hoc)"
codesign --force --sign - --timestamp=none d3d11_bridge_test
codesign --verify --verbose=2 d3d11_bridge_test || true

echo "[build] done — ./pe_to_macho_shim <pe.exe> / ./i386_decode_test <pe.exe> [count] / ./i386_cpu_test [pe.exe] / ./metal_offscreen_smoke / ./d3d11_bridge_test"
Loading
Loading