13 Commits

Author SHA1 Message Date
pi0x
8c9ec09477 gl: give the guest all 12 uniform blocks on hosts that offer only 12 per stage (#74)
WebGL2 on ANGLE's D3D11 backend (Chrome on Windows) has exactly 12
uniform blocks per stage. vrend keeps one for its VirglBlock, so Mesa's
virgl driver saw 11 uniform buffers, turned uniform buffer objects off
and with them GLES 3.0: the guest got OpenGL ES 2.0.

virglrenderer patch 21 declares the system values as plain uniforms
instead when 24 blocks and bindings fit and the ordinary uniform limits
have room for them, so the guest gets all 12 blocks. test/gl/kwgl-ubo12.c
(vtest-check.sh ubo12) draws with twelve distinct buffers in each stage;
bridge-check.sh --ubo N has the page cap the limits the wasm renderer
sees, which reproduces the D3D11 host on SwiftShader (14 per stage).

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Niklas Olsson <niklas.olsson@hotmail.co.uk>
2026-11-28 22:21:04 +01:00
Pooya Parsa
c5ec8fdd97 gl: keep textures that WebGL refuses off used sampler units, so that such a draw lands (#27)
virglrenderer patch 0020: on a WebGL host a used sampler unit holds no texture rather than one attached to the draw framebuffer or of another base type than its sampler. unkernel-check.mjs --drm gains step t (test/gpu/feedback.c).
2026-11-24 18:56:21 +00:00
Pooya Parsa
0da40f0a35 gl: let a WebGL error drop one call instead of putting the guest's context in error (#27)
virglrenderer builds with -Dcheck-gl-errors=false and patch 0019: a host GL error is logged and counted (stats.glErrors) and the context goes on; GL_OUT_OF_MEMORY stays fatal.
2026-11-24 18:12:50 +00:00
Pooya Parsa
b916d273dd gl: pad uniform buffer ranges and buffers to 16 bytes, so a range short of its std140 block's trailing padding draws on WebGL (SuperTuxKart 1.4) 2026-11-22 22:29:33 +00:00
Pooya Parsa
47a0202a64 guest, js: one program for the guest tools, and a Debian boot read from the image's front: kwbox (/usr/bin/kwbox, guest/src/kwbox.c) links kwtty, kw9p, kwvsock, kwshm, kwwasi, kwcmd and vtest-bridge into one static binary, called as kwbox tty|9p|vsock|shm|wasi|cmd|vtest (the per-tool paths are gone but binfmt's interpreter /usr/lib/kw/kwwasi; any other name it is called by is a host command, and kwbox is a reserved command name); /init sends an image or upper whose init still runs /usr/bin/kwtty to the base shell or safe mode; the traced boot that lays out an image is the page's (kwshm, kw.gl=1 kw.wayland=1), so wlandr is in Debian's boot set; HttpBase's background tier waits for the first read of the image before its quiet second (an image opened while its kernel loads fetched it during the boot) 2026-11-22 16:11:20 +00:00
Pooya Parsa
e35e8a8f60 gl: a hash table deleted-key marker that no guest id can equal (virglrenderer patch 18): the renderer's object tables key Mesa's hash table by the handle cast to a pointer, and its deleted-slot marker, a static variable's address, is a small number on wasm32 (62592), so the object with that handle was never found and a long-running GL program's context went into error (glmark2-es2-drm's full run in its 31st scene: Illegal surface 62592, then every draw refused) 2026-11-22 14:33:53 +00:00
Pooya Parsa
9d9581a1f1 gl: multisampling on WebGL2 (virglrenderer patch 17): multisample resources become multisample renderbuffers on a host without multisample textures, so Mesa offers 4 samples, ANGLE in the guest's Chromium gets its ES 3.0 context and Chromium composites and runs WebGL on the GPU (it exited its GPU process and fell back to software); the chromium hook names Mesa's EGL packages where they are missing 2026-11-22 12:17:33 +00:00
Pooya Parsa
cdb3ddc467 gl: window images and WebGL2 fixes in the renderer: vm.gl.gpu.image() gives a resource as an ImageBitmap with alpha, without readback (kw_vgpu_blit; the context now has alpha and presentation writes it opaque), for a page compositor showing guest dmabufs by resource id; snapshots are refused only while a 3D resource exists or a context has submitted commands, and a restored device recreates an idle context; a failed 3D command records its reason (stats.lastError), a lost WebGL context fails every command at once, and the blit clears the GL errors it leaves; virglrenderer patches 14 to 16: border clamp maps to edge clamp, vertex inputs and colour outputs are typed on WebGL2 (Firefox's WebRender draws with integer attributes: its context went into error and its window stayed transparent), integer colour buffers are cleared with glClearBuffer 2026-11-22 09:38:49 +00:00
Pooya Parsa
84d70b9b83 gl: load the renderer on the guest's first GL use (the device advertises virgl's capsets from fixed sizes; gl.eager, ?glload=eager load before boot) and turn guest GL on by default for Debian in the page, with the virtio-gpu device (?gpu=0: the vtest link only); the kw layer ships /etc/X11/kw-kms.conf (modesetting with glamor on /dev/dri/card0) and sets the vtest variables only without the device; virtio-gpu waits up to 30 s, killably, for a capset; a suspend while a program uses the GPU is refused at once with a message 2026-11-21 22:57:45 +00:00
Pooya Parsa
4d20370925 Give the guest /dev/dri: kwvirtio, a virtio transport over host imports, with the stock virtio_gpu driver (createKernel({ gpu }), --gpu); the SDK's device model shows dumb-buffer scanouts on the host display and, with gl, runs virgl 3D on the page's renderer through virglrenderer's API (patch 13), presents a KMS scanout from the renderer's texture without readback and gives host code a resource's texture (vm.gl.gpu.texture); the kernel leaves out I2C, the HDMI infoframe library, the panel bridge and NET_DEVMEM (four generic switches) and backports the virtio-gpu damage-clip fix 2026-11-21 20:27:49 +00:00
Pooya Parsa
199211ae8f gl: answer Mesa's busy waits ahead of the GPU (at most one per client, never after a readback of the same resource), mark a query's result pending when the guest asks for it (virglrenderer patch 12), and count parks, readbacks, GL and upload time per frame (vm.gl.stats.renderer, the page's Guest GL row); ?glwait=strict or gl.strictWaits restores vtest's waits 2026-11-21 18:43:31 +00:00
Pooya Parsa
ff792f6121 gl: guest GL in unkernel behind createKernel({ gl }): the SDK loads the wasm renderer from dist (virgl.mjs, virgl.wasm), listens on vsock port 1019 and starts the vtest forwarder shipped in the base's kw layer; a prepared Debian disk and an end-to-end check in headless Chromium (eglinfo, frame checksums, glmark2 against llvmpipe) 2026-11-21 17:38:25 +00:00
Pooya Parsa
e26f9711fc gl: run virglrenderer on one WebGL2 context for guest GL, checked headless on the host: a patch series on virglrenderer 1.3.0 (single GL context mode, GLES 3.0 and WebGL2 fixes, emscripten build, shared-server fixes), the wasm module and its GL shim, a vtest bridge that terminates memfds (WebSocket for the test page, byte stream for the guest), and a check suite of unmodified Mesa clients against the native and the wasm renderer 2026-11-21 16:06:54 +00:00