Download the PHP package jovian/venusian-ogx without Composer
On this page you can find all versions of the php package jovian/venusian-ogx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jovian/venusian-ogx
More information about jovian/venusian-ogx
Files in jovian/venusian-ogx
Package venusian-ogx
Short Description The 'opengl' rendering engine for Venusian Surface: a GpuDevice over ext-opengl that draws Surface's draw lists in an OpenGL 4.1 core or OpenGL ES 3.1 context, its own offscreen or one a canvas lends.
License MIT
Homepage https://venusian.projectsaturnstudios.com/ecosystem/jovian/venusian-opengl/0.11.x
Informations about the package venusian-ogx
jovian/venusian-opengl
The opengl graphics engine for Venusian Topside. OpenGL 4.1 core through CGL on the Mac, through ext-opengl. It hands out the four resources Graphics knows, on the GPU: framebuffers, a rasterizer, a raycaster and a painter.
Where it sits
Each resource is the engine's own version of a Graphics type: OpenGLFramebuffer is a GEFramebuffer, OpenGLRasterizer a GERasterizer, OpenGLRaycaster a GERaycaster, OpenGLGEPainter a GEPainter. Resources from one engine work only with each other.
Requirements
- macOS: OpenGL 4.1 core through CGL. Apple deprecates it; SDK 15.4 still ships it.
- PHP
~8.4.27||^8.5.12, ext-opengl ^0.11 (uniform blocks and the integer and float texture formats),venusian/topside^0.11.5. - ext-appkit, when loaded, for two things only: reading pixels back (GL writes them to an address, and ext-appkit's
CFDatais the memory there) and showing frames in a view a stage lends. It is not declared: the package installs anywhere. - Linux: the engine opens a CGL context; an EGL one is not built yet, and constructing the engine on Linux throws saying so.
Install
The provider is discovered through extra.venusian.providers. It registers opengl with Graphics on the GPU backend when ext-opengl is loaded.
Usage
In an application, ask Graphics for it: Gfx::engine('opengl'). Standalone, make it yourself. Run as a script; printed values are its output (Apple M1 Pro):
What it does
- Framebuffer: an RGBA8 texture of premultiplied colour, with a four-sample twin antialiased shapes are drawn into.
read()andwrite()take straight colour. The texture is resolved from the samples when something reads it (a read, a write, a scroll, being shown, being drawn as an image, a backdrop or glass reading it), not after every draw: a resolve is a blit of its own in GL. - Rasterizer: a path is stencilled, then covered; a path of one convex contour is drawn in one step with no stencil. Hard edges come from the pixel's centre, antialiased ones from four samples a pixel.
- Painter: recording and damage are Topside's shared painter's. A pass uploads its vertices once and its uniform blocks once, then draws each command with its scissor. Curved shapes and shadows are one rectangle each; gradients read a 256-colour ramp kept by its bytes; images read another of the engine's framebuffers. Layers are drawn into sheets rounded up to 64; filters, backdrops and glass run on the GPU, with Velvet's integer arithmetic where Velvet's is integer.
- Raycaster: rays are walked by a pass over a hits target, one pixel a ray's row (OpenGL 4.1 has no compute). A view painted on a framebuffer stays on the GPU; what comes back to PHP (
cast,casts,fan, a view as bytes) is one pass and one read.
Showing frames
On a stage that lends an NSView, attach() adds a child NSOpenGLView of the engine's, the stage's size, at full resolution, drawn by a context that shares the engine's textures. Showing a frame draws its texture into the view's back buffer and swaps; nothing comes back to the CPU. The stage paces showing. release() takes the view away. A stage that lends nothing is shown as pixels, through display().
Measured
Apple M1 Pro, ms, with no window; the timings end with a read, so unfinished GPU work counts.
| OpenGL | Metal | Vulkan | Velvet (C) | |
|---|---|---|---|---|
| Kitchen sink shapes scene, 1100 × 360, a frame | 0.40 | 0.40 | 0.43 | 1.20 |
| The same, every frame resolved | 0.48 | |||
| Stroked wave, 1024 × 768, a call | 0.76 | 0.78 | 0.80 | 3.68 |
| A layer, added to a frame | 0.08 | 0.025 | 0.06 | |
| Paint a raycast view, 1100 × 360 | 0.077 | 0.106 | 0.158 | |
90 rays back to PHP (casts) |
0.36–0.38 | 0.36 | 0.35–0.36 |
A layer costs one resolve blit of the sheet it is drawn in (0.048 ms of CPU whatever its size), since the frame reads it straight away.
Testing
Real GPU, no window. Each script takes the path to a venusian/topside checkout and uses its vendor/ and test helpers:
Runbook: .okf/runbooks/testing.md.
Security
See SECURITY.md.
License
MIT.
All versions of venusian-ogx with dependencies
ext-fb Version ^0.11.1
ext-opengl Version ^0.11.0
venusian-surface/contracts Version ^0.11.0
venusian-surface/drawing Version ^0.11.0
venusian-surface/framebuffers Version ^0.11.0
venusian-voyager/nuts-and-bolts Version ^0.11.0