phpolygon / php-vio
PHP extension for GPU rendering (OpenGL, Vulkan, Metal), audio, video recording, streaming, and input
Package info
Language:C
Type:php-ext
Ext name:ext-vio
pkg:composer/phpolygon/php-vio
Requires
- php: >=8.5
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 2.45.0
- 2.44.2
- 2.44.1
- 2.44.0
- 2.43.1
- 2.43.0
- 2.42.1
- 2.42.0
- 2.41.1
- 2.41.0
- 2.40.3
- 2.40.2
- 2.40.1
- 2.40.0
- 2.39.0
- 2.38.1
- 2.38.0
- 2.37.0
- 2.36.1
- 2.36.0
- 2.35.0
- 2.34.1
- 2.34.0
- 2.33.0
- 2.32.2
- 2.32.1
- 2.32.0
- 2.31.4
- 2.31.3
- 2.31.2
- 2.31.1
- 2.31.0
- 2.30.0
- 2.29.1
- 2.29.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.4
- 2.25.3
- 2.25.2
- 2.25.1
- 2.25.0
- 2.24.3
- 2.24.2
- 2.24.1
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.1
- 2.6.0
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.23.0
- 1.22.0
- 1.21.1
- 1.21.0
- 1.20.1
- 1.20.0
- 1.19.1
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.0
- 1.16.2
- 1.16.1
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.9
- 1.10.8
- 1.10.7
- 1.10.6
- 1.10.5
- 1.10.4
- 1.10.2
- 1.10.1
- 1.10.0
- 1.9.0
- 1.8.15
- 1.8.14
- 1.8.13
- 1.8.10
- 1.8.9
- 1.8.8
- 1.8.7
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.7.0
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.5
- 1.2.1
- 1.2.0
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-fix/php86-offsetof
- dev-fix/test-249-audio-cursor-wait
- dev-feat/desktop-webview
- dev-docs/perf-windows
- dev-fix/gl-default-uniform-block-name
- dev-docs/refresh
- dev-fix/cocoa-press-and-hold
- dev-ci/macos-intel-cache
- dev-fix/d3d-hull-patch-constant
- dev-fix/macos-intel-ci
- dev-fix/gl-program-cache-lifetime
- dev-fix/d3d12-srv-generation
- dev-ci/macos-intel-runner
- dev-fix/d3d12-srv-descriptors
- dev-feat/adapter-select
- dev-fix/uniform-limits
- dev-feat/backend-sampler-limits
- dev-fix/d3d11-instance-buffer-gl-rt-binding
- dev-ci/release-pr-comments
- dev-feat/desktop-a11y-macos
- dev-feat/desktop-a11y-windows
- dev-feat/desktop-a11y
- dev-feat/desktop-window-parent
- dev-feat/desktop-ime-linux
- dev-feat/desktop-multi-window
- dev-feat/desktop-multi-window-d3d12
- dev-feat/desktop-multi-window-gl
- dev-feat/desktop-multi-window-vulkan
- dev-feat/desktop-ime
- dev-feat/desktop-dbus-notify-progress
- dev-feat/desktop-tray
- dev-feat/desktop-drop-dialogs
- dev-feat/desktop-menus
- dev-feat/desktop-window-details
- dev-feat/desktop-event-loop
- dev-fix/sampler-default-unit
- dev-fix/vulkan-cubemap-unit
- dev-fix/vulkan-pending-swapchain-clear
- dev-feat/sampler-present-conventions
- dev-feat/upscaler-prepare
- dev-fix/d3d12-release-in-frame
- dev-feat/agility-1620
- dev-feat/hdr-composite
- dev-fix/d3d12-upload-ring
- dev-feat/audio-live-controls
- dev-fix/stub-constants-gpu-flush
- dev-fix/test-172-gpu-timings-sum
- dev-fix/miniaudio-version-mismatch
- dev-feat/audio-opus-vorbis
- dev-feat/clipboard
- dev-fix/d3d12-mipgen-descriptor-ring
- dev-fix/d3d12-compute-descriptor-ring
- dev-feat/temporal-dlss-plugin
- dev-fix/static-metalfx-link
- dev-fix/static-multiview-loader
- dev-fix/d3d12-capture-crash
- dev-fix/static-build-includes
- dev-feat/mesh-shaders
- dev-feat/sampler-feedback
- dev-feat/neural-shading
- dev-feat/rt-pipeline
- dev-feat/work-graphs
- dev-fix/windows-stack-findings
- dev-feat/open-items-batch1
- dev-feat/open-items-batch2
- dev-feat/open-items-batch3
- dev-feat/open-items-batch4
- dev-feat/open-items-batch5
- dev-feat/open-items-batch6
- dev-feat/open-items-batch7
- dev-feat/sm69
- dev-fix/d3d12-pso-release
- dev-chore/windows-verification
- dev-feat/ray-query
- dev-feat/bindless
- dev-feat/vrs-image
- dev-feat/vrs-tier2
- dev-feat/multiview
- dev-feat/phase1-rest
- dev-feat/atomic64
- dev-feat/quad-barycentrics
- dev-feat/subgroups
- dev-feat/d3d12-shader-model-6
- dev-feat/metal-version-ladder
- dev-fix/code-rescue-findings
- dev-feat/d3d-tessellation
- dev-feat/geometry-tessellation-stages
- dev-docs/spirv-cross-fix-merged
- dev-feat/input-injection
- dev-feat/bindable-pipeline-and-packed-uniforms
- dev-fix/gl-s3tc-enums
- dev-fix/compute-buffer-bindings
- dev-feat/gap-phase5-vulkan-hdr
- dev-feat/gap-phase5-vulkan-texarray-vrs
- dev-feat/gap-phase5-vulkan-rt
- dev-feat/gap-phase5-vulkan-3d
- dev-feat/gap-phase5-shading-rate
- dev-feat/gap-phase5-texture-arrays
- dev-feat/gap-phase5-gpu-mipmaps
- dev-feat/gap-phase5-indirect-draw
- dev-feat/gap-phase5-shader-model-6
- dev-feat/gap-phase5-hdr-output
- dev-feat/gap-phase5-shader-cache
- dev-feat/gap-phase5-gpu-timestamps
- dev-feat/gap-phase5-uint16-indices
- dev-feat/gap-phase5-pso-state
- dev-feat/per-attachment-blend
- dev-fix/pending-texture-lifetime
- dev-fix/opengl-spirv-uniform-names
- dev-fix/opengl-context-generation
- dev-feat/d3d-vulkan-gap-plan
- dev-feat/vertex-storage-buffers
- dev-feat/texture-3d
- dev-fix/window-fullscreen-exit
- dev-feat/cross-platform-thermal
- dev-feat/ios-support
- dev-fix/d3d12-clearvalue-noise
- dev-fix/d3d11-warm-offscreen
- dev-feat/vulkan-2d
- dev-dx11_dx12
This package is auto-updated.
Last update: 2026-11-13 08:53:41 UTC
README
A PHP extension that brings GPU rendering, audio, video recording, streaming, and input handling to PHP. Foundation layer for the PHPolygon game engine.
Features
- Multi-backend GPU rendering — Direct3D 12, Direct3D 11, Metal, Vulkan, OpenGL 3.0–4.6;
vio_create('auto')picks one per platform or ranks the adapters (prefer,require, optional calibration run) - 2D batch renderer — rects, rounded rects, circles, lines, sprites, text; z-sorted, transform and scissor stacks, the batch grows on demand
- Text — TrueType atlas filled on demand, HarfBuzz + SheenBidi shaping (Arabic, Thai, ligatures, bidirectional text), word wrap, vertical text
- 3D pipeline — meshes, GLSL shaders, pipelines with blend / depth / stencil state, instancing, indirect draws, recorded draw sequences (
vio_bundle) - Shader stages — vertex, fragment, geometry, tessellation, mesh and task shaders, compute; multiview; HLSL and MSL overrides per stage
- Render targets — HDR, depth-only, MSAA, up to 8 colour attachments, cube and array targets, mip chains, readback in the target's own format
- Textures — 2D, 3D, arrays, cubemaps, BC and ASTC compression, KTX2, a bindless texture table
- Compute — storage buffers and storage images, dispatch inside the frame, vertex and fragment stages reading storage buffers
- Ray tracing — acceleration structures, inline ray queries, ray tracing pipelines, opacity micromaps (Direct3D 12, Vulkan; ray queries also on Metal)
- Upscaling — portable spatial and temporal upscaler (
vio_upscale), AMD FSR 3.1 and, through a plugin, NVIDIA DLSS (vio_upscaler_*; Direct3D 12 and Vulkan) - Shader toolchain — GLSL to SPIR-V (glslang), reflection and translation to HLSL / MSL / GLSL (SPIRV-Cross), on-disk shader cache
- Desktop applications — several windows, child and modal windows, menu bar and context menus, file dialogs, message boxes, notifications, tray icon, taskbar progress, file drop, IME composition, cursors, screen-reader support (AccessKit), an event loop that waits instead of polling
- Input — keyboard, mouse, gamepads, touch, clipboard; injection, virtual gamepads and record / replay for tests
- Audio — playback via miniaudio (MP3, WAV, FLAC, Ogg Vorbis, Ogg Opus), Opus / Vorbis encoding and decoding, 3D audio with live pitch / pan, distance attenuation models, Doppler, cones, 2D / 3D switch per sound, offline rendering
- Video recording — H.264 via FFmpeg with the platform's hardware encoders (NVENC, AMF, QSV, Media Foundation, VideoToolbox) and libx264 as the fallback
- Network streaming — RTMP and SRT via FFmpeg
- System Webview — WKWebView inside a vio window, served by PHP in the same process over a custom scheme (no HTTP server), JS ↔ PHP messages; runs Laravel apps (
examples/webview_laravel.php). macOS (WKWebView) and Linux (WPE WebKit or WebKitGTK) today, Windows (WebView2) next - Headless mode — offscreen rendering, pixel readback, screenshots and image comparison for visual regression tests
- Plugin system — output / input / filter plugins and a versioned C ABI for upscaler plugins
- Cross-platform — Windows, macOS, Linux (X11 and Wayland) with native window layers; GLFW is optional
Which of these a context has depends on the backend, the GPU and the libraries the extension was built with. Ask at run time: vio_supports_feature($ctx, VIO_FEATURE_*), vio_feature_info(), vio_backend_info() and, for the window system, vio_platform_info().
Gallery
Every image below is rendered headless by examples/gallery.php
(php -d extension=vio examples/gallery.php [backend]); the PNGs live in docs/gallery/.
They double as a smoke test of each feature path on a real backend.
php examples/gallery.php [backend] [outdir] [scene,…] renders all scenes or a comma-separated selection. A scene whose feature the
backend does not report is skipped: ray queries, mesh shaders and bindless textures need Direct3D 12, Vulkan or Metal with a GPU and driver
that support them, variable rate shading Direct3D 12 or Vulkan, opacity micromaps Vulkan or Direct3D 12 with the Agility SDK
(VIO_D3D12_AGILITY_SDK) and DXC (VIO_DXC_DIR).
The gallery covers rendering only: the native upscalers (FSR 3.1, DLSS), the remaining ray-tracing features, work graphs, audio, video
and the desktop-application APIs (windows, menus, dialogs, tray) have no scene yet.
Requirements
- PHP >= 8.5
All native libraries are optional — the extension compiles and runs without them, features are simply unavailable at runtime:
| Library | Feature | Build Flag |
|---|---|---|
| GLFW 3.4 | Windowing, input, gamepad where no native window layer is built (optional on Windows, macOS, X11, Wayland) | --with-glfw |
| Xlib + XRandR | X11 window layer (Linux) | --with-x11 (on by default when found) |
| wayland-client, wayland-cursor, xkbcommon, wayland-scanner, wayland-protocols | Wayland window layer (Linux) | --with-wayland (on by default when found) |
| glslang | GLSL to SPIR-V compilation | --with-glslang |
| SPIRV-Cross | Shader reflection & translation (required for shaders on Direct3D, Metal and Vulkan) | --with-spirv-cross |
| Vulkan SDK | Vulkan backend (Vulkan 1.3, or 1.2 with dynamic rendering and synchronization2) | --with-vulkan |
| FFmpeg | Video recording & streaming | --with-ffmpeg |
| HarfBuzz | Text shaping (Arabic, Thai, ligatures, vertical text); VIO_HAS_SHAPING |
--with-harfbuzz |
| AccessKit (C release package) | Screen readers (vio_a11y_update) |
--with-accesskit=DIR |
| Metal (macOS framework) | Metal backend | --with-metal |
| Direct3D 11 (Windows SDK) | Direct3D 11 backend | --with-d3d11 (Windows, on by default) |
| Direct3D 12 (Windows SDK) | Direct3D 12 backend | --with-d3d12 (Windows, on by default) |
| AMD FidelityFX API headers (vendored) | FSR 3.1 upscaler; the FidelityFX DLLs are loaded at run time, not linked | --with-ffx (on by default on Windows) |
Vendored and always built: GLAD, stb, Vulkan Memory Allocator, miniaudio, SheenBidi, libopus / libogg / opusfile / libvorbis.
Installation
Via PIE (PHP Installer for Extensions)
pie install phpolygon/php-vio
Pre-built Binaries
Download platform-specific binaries from the Releases page. Available for:
- Linux x86_64 / ARM64
- macOS x86_64 (Intel) / ARM64 (Apple Silicon)
- Windows x64
From Source (macOS)
brew install php glfw glslang spirv-cross ffmpeg harfbuzz vulkan-loader vulkan-headers molten-vk
phpize
./configure --enable-vio --with-glfw --with-glslang --with-spirv-cross \
--with-vulkan --with-ffmpeg --with-metal --with-harfbuzz
make -j$(sysctl -n hw.ncpu)
sudo make install
Use SPIRV-Cross vulkan-sdk-1.4.363.0 or newer: older versions lay out arrays of structs in a uniform block with the wrong stride on Metal.
From Source (Linux)
# Ubuntu/Debian sudo apt install php-dev libglfw3-dev glslang-dev libvulkan-dev \ libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \ spirv-cross libspirv-cross-c-shared-dev libharfbuzz-dev libx11-dev libxrandr-dev \ libwayland-dev wayland-protocols libxkbcommon-dev phpize ./configure --enable-vio --with-glfw --with-glslang --with-spirv-cross \ --with-vulkan --with-ffmpeg --with-harfbuzz make -j$(nproc) sudo make install
Windows
On Windows, no build toolchain is needed — PHP extensions are distributed as pre-compiled DLLs. Download the matching DLL from the Releases page (match your PHP version and thread-safety mode), then:
- Copy
php_vio.dllinto your PHPext\directory - Add
extension=vioto yourphp.ini - Restart PHP / your web server
To build it yourself, use the PHP SDK with the Visual Studio 2022 build tools; config.w32 takes --with-glfw, --with-vulkan, --with-glslang, --with-spirv-cross, --with-ffmpeg, --with-harfbuzz and --with-accesskit with the directory of each dependency.
All backends use conditional compilation (#ifdef HAVE_*), so builds without certain dependencies compile fine — those features are simply unavailable at runtime.
Quick Start
<?php // Open a window on the platform's preferred backend $ctx = vio_create("auto", [ "width" => 800, "height" => 600, "title" => "Hello VIO", ]); while (!vio_should_close($ctx)) { vio_begin($ctx); vio_clear($ctx, 0.1, 0.1, 0.1); // 2D drawing; colours are 0xAARRGGBB vio_rect($ctx, 50, 50, 200, 100, ["color" => 0xFFFF0000]); vio_circle($ctx, 400, 300, 60, ["color" => 0xFF00FF00]); vio_draw_2d($ctx); vio_end($ctx); vio_poll_events($ctx); } vio_close($ctx); vio_destroy($ctx);
More scripts are in examples/: a window, a triangle, input, a custom shader, 2D drawing, the gallery renderer and three benchmarks (bench_backends.php compares the backends, see Performance).
API Overview
273 functions and 20 classes. A selection by category:
| Category | Functions |
|---|---|
| Context | vio_create, vio_begin, vio_end, vio_clear, vio_close, vio_destroy, vio_poll_events, vio_wait_events, vio_wake |
| Window | vio_window_size, vio_framebuffer_size, vio_set_title, vio_set_window_size, vio_set_fullscreen, vio_set_borderless, vio_monitors, vio_on_resize, vio_on_close, vio_on_focus, vio_on_refresh |
| Desktop | vio_window, vio_menu_bar, vio_popup_menu, vio_file_dialog, vio_message_box, vio_notify, vio_tray, vio_set_progress, vio_on_drop, vio_set_cursor, vio_set_window_icon, vio_open_url, vio_a11y_update, vio_platform_info |
| Input | vio_key_pressed, vio_mouse_position, vio_mouse_button, vio_on_key, vio_on_char, vio_on_preedit, vio_gamepads, vio_touch_count, vio_clipboard_get, vio_inject_key, vio_input_replay |
| 2D | vio_rect, vio_rounded_rect, vio_circle, vio_line, vio_sprite, vio_text, vio_push_transform, vio_push_scissor, vio_draw_2d |
| 3D | vio_mesh, vio_shader, vio_pipeline, vio_bind_pipeline, vio_set_uniform, vio_draw, vio_draw_instanced, vio_draw_indirect, vio_submit_batch, vio_bundle, vio_draw_mesh_tasks |
| Render targets | vio_render_target, vio_bind_render_target, vio_render_target_texture, vio_read_render_target, vio_generate_mipmaps, vio_viewports |
| Textures | vio_texture, vio_texture_3d, vio_texture_ktx2, vio_cubemap, vio_bind_texture, vio_texture_update, vio_texture_index, vio_texture_load_async |
| Fonts | vio_font, vio_text, vio_text_measure, vio_font_has_glyph, vio_font_load_async |
| Buffers & compute | vio_uniform_buffer, vio_storage_buffer, vio_update_buffer, vio_compute_pipeline, vio_compute_dispatch, vio_storage_buffer_read |
| Ray tracing | vio_acceleration_structure, vio_rt_pipeline, vio_trace_rays, vio_opacity_micromap_bake |
| Upscaling | vio_upscale, vio_upscale_jitter, vio_upscaler_create, vio_upscaler_dispatch, vio_upscaler_prepare |
| Audio | vio_audio_load, vio_audio_play, vio_audio_pause, vio_audio_stop, vio_audio_pitch, vio_audio_pan, vio_audio_spatial, vio_audio_attenuation, vio_audio_velocity, vio_audio_doppler, vio_audio_listener, vio_audio_encode, vio_audio_decode, vio_audio_render |
| Recording | vio_recorder, vio_recorder_capture, vio_recorder_info, vio_recorder_stop, vio_video_info, vio_video_frame |
| Streaming | vio_stream, vio_stream_push, vio_stream_stop |
| Headless | vio_read_pixels, vio_save_screenshot, vio_compare_images, vio_save_diff_image |
| Shaders | vio_shader_reflect, vio_shader_cache_stats, shader compilation via glslang |
| Introspection | vio_backends, vio_backend_name, vio_backend_info, vio_adapters, vio_rank_backends, vio_supports_feature, vio_feature_info, vio_gpu_info, vio_gpu_frame_time |
| Webview | vio_webview, vio_webview_navigate, vio_webview_eval, vio_webview_on_message, vio_webview_on_event, vio_webview_bounds |
| Plugins | vio_plugins, vio_plugin_info |
Every signature with its options is in vio.stub.php; guides and the API reference are on the documentation site.
Backends
| Backend | Status | Platforms |
|---|---|---|
| Direct3D 12 | Stable | Windows only |
| Direct3D 11 | Stable | Windows only |
| Metal | Stable | macOS only |
| OpenGL 3.0–4.6 | Stable | macOS (up to 4.1), Linux, Windows |
| Vulkan | Stable | Linux, Windows, macOS (MoltenVK, opt-in) |
| Null | Stable | All (for unit testing) |
Backend auto-selection is platform-specific:
- Windows: Direct3D 12 → Direct3D 11 → Vulkan → OpenGL
- macOS: Metal → OpenGL (Vulkan via MoltenVK is opt-in, not auto)
- Linux: Vulkan → OpenGL
Null is never auto-selected; request it explicitly with vio_create("null") for headless tests. Override auto-selection per call (vio_create("d3d11")) or globally via the vio.default_backend INI setting. With vio_create('auto', ['prefer' => 'performance' | 'quality' | 'compat', 'require' => [VIO_FEATURE_*, …]]) the choice follows a ranking of the installed adapters instead (vio_rank_backends(), vio_adapters()); vio_backend_info($ctx)['selected_by'] tells how the backend was chosen.
Features differ per backend and GPU — for example variable rate shading, ray tracing pipelines and the native upscalers exist on Direct3D 12 and Vulkan only, and geometry shaders run through compute emulation on Metal. Check vio_supports_feature() before relying on one.
Performance
examples/bench_backends.php draws the same five scenes on every backend the build can open: 1280x720, headless, vsync off, 600 frames after 60 warm-up frames. The Mac tables give the frame time from vio_begin() to the return of vio_end() in microseconds, as median / 99th percentile. Measured with php-vio 2.44.1 and PHP 8.5.
Apple M5 (macOS 27.2)
| Scene | Metal | OpenGL 4.1 |
|---|---|---|
| 2D: 500 rects | 66 / 188 | 142 / 258 |
| 2D: 200 rects + 200 rounded rects + 50 texts | 185 / 211 | 284 / 325 |
| 2D: 1000 rects + 100 texts | 277 / 296 | 468 / 593 |
| 3D: 1000 draws, 2 uniforms each | 231 / 249 | 616 / 675 |
| 3D: 10 000 instances, 1 draw | 130 / 146 | 113 / 189 |
MacBook Pro, Intel Core i9-9880H (macOS 26.7) — Metal on either GPU (VIO_METAL_ADAPTER); OpenGL runs on the integrated GPU.
| Scene | Metal, Radeon Pro 5500M | Metal, UHD 630 | OpenGL 4.1, UHD 630 |
|---|---|---|---|
| 2D: 500 rects | 158 / 286 | 279 / 439 | 441 / 1145 |
| 2D: 200 rects + 200 rounded rects + 50 texts | 542 / 706 | 574 / 749 | 878 / 1542 |
| 2D: 1000 rects + 100 texts | 836 / 1165 | 937 / 1262 | 666 / 854 |
| 3D: 1000 draws, 2 uniforms each | 574 / 800 | 703 / 877 | 1194 / 1496 |
| 3D: 10 000 instances, 1 draw | 170 / 273 | 743 / 842 | 1290 / 1429 |
Windows 11, NVIDIA GeForce RTX 2080 — here the table gives the time to issue the frame (vio_begin() to vio_draw_2d()), median in microseconds. Headless Vulkan and OpenGL contexts copy every presented frame back to the host, which makes their vio_end() take longer than on Direct3D, so the frame time would not compare the backends.
| Scene | Direct3D 12 | Direct3D 11 | Vulkan 1.3 | OpenGL 4.6 |
|---|---|---|---|---|
| 2D: 500 rects | 139 | 126 | 180 | 672 |
| 2D: 200 rects + 200 rounded rects + 50 texts | 491 | 453 | 669 | 941 |
| 2D: 1000 rects + 100 texts | 634 | 601 | 825 | 986 |
| 3D: 1000 draws, 2 uniforms each | 831 | 434 | 1146 | 1028 |
| 3D: 10 000 instances, 1 draw | 44 | 123 | 122 | 92 |
| On both Macs Metal is the faster backend in most scenes and has the steadier frame times; OpenGL is ahead in two cells (10 000 instances on the M5 by the median, the text-heavy 2D scene on the Intel Mac). On the RTX 2080 Direct3D 11 issues a frame fastest in four of the five scenes and Direct3D 12 when one draw covers 10 000 instances; Vulkan and OpenGL spend more CPU time per frame. These numbers are CPU-side times of small scenes, each from one run on a desktop machine: they compare the cost of issuing draws, not GPU throughput. Run the script on your own machine before choosing a backend: |
php -d extension=vio examples/bench_backends.php # every backend
php -d extension=vio examples/bench_backends.php metal,opengl 600 --json=bench.json
Testing
NO_INTERACTION=1 TEST_PHP_EXECUTABLE=$(which php) \ php run-tests.php -d extension=$PWD/modules/vio.so tests/
run-tests.php is placed in the build directory by phpize.
294 PHPT tests, grouped by topic under tests/ (core/, backends/, render3d/, render2d/, input/, window/, media/) — headless rendering with pixel verification, 2D/3D pipelines, shaders, compute, ray tracing, upscaling, audio, input, windows and desktop APIs, and the per-backend capability matrix. run-tests.php recurses into the folders; pass a single folder to run one area.
























