Skip to content

Feature: Add OpenGL 1.0 - 2.1 / ddraw / directx 7, 8, 9 webgpu acceleration via a custom virtio device - #1629

Open
speedyHKjournalist wants to merge 62 commits into
copy:masterfrom
speedyHKjournalist:glbridgetest
Open

Feature: Add OpenGL 1.0 - 2.1 / ddraw / directx 7, 8, 9 webgpu acceleration via a custom virtio device #1629
speedyHKjournalist wants to merge 62 commits into
copy:masterfrom
speedyHKjournalist:glbridgetest

Conversation

@speedyHKjournalist

@speedyHKjournalist speedyHKjournalist commented Sep 6, 2026

Copy link
Copy Markdown

Architecture:

image

Tested games and applications include:

  • OpenGL: GLView 2.6.0, Warcraft III (OpenGL mode), Cube 2: Sauerbraten.
  • DirectDraw: 3DMark 99 MAX, Diablo II.
  • Direct3D 7: 3DMark 2000.
  • Direct3D 8: 3DMark 2001 SE, 3DMark 03, MapleStory v083.
  • Direct3D 9: 3DMark05, 3DMark06, KartRider, Warcraft III, GTA: San Andreas, Need for Speed: Most Wanted (2005).

Theoretically this approach should also work for win9x if v86gl.sys and others dlls are recompiled.

Not sure how this PR can be merged ...

speedyHKjournalist and others added 30 commits June 16, 2026 07:09
Returns the host's wall-clock time: EAX = seconds since the Unix epoch
(UTC), EBX = remaining microseconds, ECX = maximum time lag in
microseconds, EDX = host offset from UTC in minutes (east positive).

Guests only read the RTC at boot, so a VM resumed from a saved state
keeps running with the clock it was saved with. With this command a
small guest agent can periodically compare its clock against the host
and correct it without a reboot.
copy and others added 27 commits July 1, 2026 18:48
When a POST or PUT request body spans multiple TCP segments (~1460 bytes
each), only the first segment's body bytes were used — subsequent segments
were silently dropped because this.read was cleared after the first
\r\n\r\n delimiter match, and no more headers trigger re-processing.

This caused "Invalid JSON" errors for any request body larger than
approximately one MTU.

Fix:
- On the first segment: if Content-Length is present and the body is
  incomplete, store the partial body in this._xb with a deferred callback
  instead of firing fetch() immediately.
- On subsequent segments: accumulate incoming data into this._xb.buf.
  Once Content-Length is satisfied, decode and invoke the deferred
  fetch.
- Extract the fetch+response handling into _dispatch_fetch() to avoid
  duplicating it in both the normal and deferred code paths.
Addresses reviewer feedback on PR copy#1567:

- Buffer incoming TCP data as raw bytes (Uint8Array) instead of
  text-decoding everything.  Search for \r\n\r\n in binary,
  text-decode only the header portion.  This prevents corruption of
  binary POST bodies and ensures the first \r\n\r\n in headers
  (not in body) is used as the separator.

- Replace ad-hoc new TextEncoder()/new TextDecoder() with module-scoped
  singletons (textEncoder, textDecoder).

- Refactor _dispatch_fetch into a standalone dispatch_fetch(conn, ...)
  helper that takes the connection explicitly, avoiding incorrect
   binding between the connection and adapter objects.

- Add comment noting that Transfer-Encoding: chunked is unsupported.

- Add unit tests (tests/devices/fetch_network_post.js):
  * Small POST body in one segment
  * Large POST body split across 3 segments
  * Binary body containing embedded CRLFCRLF bytes
  * GET request (no body)
  * Headers split across 2 segments
Add a POST handler to the test server that echoes the received body
length, and a test case that POSTs 3000 bytes (> ~1460 byte MTU) from
the buildroot guest via curl + dd. Verifies the full body reaches the
server after the binary-safe buffering fix.
Replace generic indexOfBytes helper with inline function that
directly checks bytes against CR=0x0D and LF=0x0A values.
Remove pre-encoded CRLFCRLF separator — \r\n\r\n is always
4 bytes, so use the literal length.

Per @copy review.
Per @copy review: project doesn't use underscore prefix.
Per @SuperMaxusa review on copy#1567 — fetch_url was constructed twice
(in buffering branch and normal path). Hoist to before the if/else.
Per @copy review — revert to inline new TextEncoder()/TextDecoder()
calls to minimize diff.
…h rule

- findCrLfCrLf -> find_crlfcrlf
- headerBytes, bodyBytes, headerText, headerLines -> snake_case
- textEncoder, bigBody, hdrBytes, binBody -> snake_case (tests)
CI was failing with Permission denied when running via make devices-test.
@speedyHKjournalist

speedyHKjournalist commented Sep 6, 2026

Copy link
Copy Markdown
Author

I will upload windows xp and 3dmark image for testing asap, still need to verify 3dmark 03 and 05.

@speedyHKjournalist

speedyHKjournalist commented Sep 6, 2026

Copy link
Copy Markdown
Author

Hi @copy , as you can see from the 3DMark 06 CPU result, it scores only 179 compared to old Althon 64 700 - 1000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants