pushinbr/pam-native-gpu

Native Metal and OpenGL ES GPU surfaces for PAM Native.

Maintainers

Package info

github.com/push-in/pam-native-gpu

Language:Kotlin

Type:pam-native-plugin

pkg:composer/pushinbr/pam-native-gpu

Transparency log

Statistics

Installs: 44

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-23 19:02 UTC

This package is auto-updated.

Last update: 2026-08-25 22:04:17 UTC


README

PAM Native GPU

Own the pixels when ordinary components are not enough.

Host native GPU surfaces and compiled shaders while command submission stays outside the PHP event loop.

Latest version CI PHP Android iOS

Documentation · Quick start · What you can build · PAM ecosystem · Issues

Why PAM Native GPU

Host native GPU surfaces and compiled shaders while command submission stays outside the PHP event loop. The public API is strictly typed for PHP 8.5; expensive or frame-sensitive work stays in Rust or the platform SDK instead of crossing the application boundary every frame.

Best for A focused capability you can add to any PAM Native application
Native path OpenGL ES · Metal
Application model Composer package + generated native integration
Design rule Independent module; no feed, vertical, or application template bundled

What you can build

  • Realtime visual effects and shader-driven UI
  • Scientific and high-volume data visualization
  • Custom renderers and GPU-accelerated creative tools

Quick start

Already have a PAM Native project? Add only this capability:

pam composer require pushinbr/pam-native-gpu
pam doctor --fix

New to PAM? Follow the five-minute PAM Native setup once, then return here. Your application stays a normal Composer project with a committed lockfile.

See it in action

This package provides a horizontal GPU surface, not a canvas, 3D engine, game framework, or app template. OpenGL ES 3 executes on Android and Metal executes on iOS. PHP supplies immutable shader programs and scalar uniforms; the native render loop never crosses the PHP boundary per frame.

use Pam\Native\Gpu\GpuProgram;
use Pam\Native\Gpu\GpuView;

$program = new GpuProgram(
    glsl: <<<'GLSL'
#version 300 es
precision highp float;
in vec2 v_uv;
uniform vec2 u_resolution;
uniform float u_time;
uniform float intensity;
out vec4 outColor;
void main() { outColor = vec4(v_uv, 0.5 + sin(u_time) * intensity * 0.5, 1.0); }
GLSL,
    metal: <<<'METAL'
fragment float4 pam_fragment(PamVertexOut in [[stage_in]], constant PamBuiltins& builtins [[buffer(0)]], constant float* values [[buffer(1)]]) {
    return float4(in.uv, 0.5 + sin(builtins.time) * values[0] * 0.5, 1.0);
}
METAL,
    uniforms: ['intensity' => 0.8],
);

return GpuView::make($program);

Shader sources are capped at 64 KiB and uniforms at 64 finite scalars. Uniforms on Metal are packed in lexicographically sorted name order. Platform support: Android API 26+, iOS 15+, PHP 8.5+, and PAM Native 0.8.x.

The render path is allocation-stable after a program revision: Android parses uniform JSON and resolves every OpenGL location during configuration, while iOS sorts/ packs uniforms once and reuses one Metal command queue. Neither platform parses JSON, sorts maps, looks up shader locations, creates a command queue, or re-enters PHP inside draw. Shader/program resources are released after both successful and failed compilation, and diagnostic payloads are bounded.

This package depends only on PAM Native's public module and binary-wire capabilities. PAM Native UI, 3D, media, sync, and backend packages remain fully optional and independent.