← Back to docs

Core · spatial

Portal Warp — Perspective Correction (DEAD CODE)

Homography-based GLSL shaders for mapping compositor output onto AR glasses with head-tracking correction. Currently dead code — Wayfire's built-in perspective-warp is used instead.

portal-warpv0.2.0spatial
1.6K
Lines of Code
65
Tests
9
Files

Architecture

Three modules: error (WarpError type), homography (matrix operations shared with portal-spatial), shader (GLSL compilation and GL state management). The WarpRenderer manages vertex buffers, shader programs, and framebuffer objects for offscreen rendering. Uses ffi_boundary_guard to catch Rust panics at the C ABI boundary (preventing UB from panic unwinding across extern C).

Overview

portal-warp was designed to provide perspective correction for the AR glasses display — mapping the compositor's flat output onto the glasses' curved field of view with head-tracking compensation. It includes a WarpRenderer that manages OpenGL state, compiles custom GLSL shaders, and applies homography-based transforms. However, the crate is currently dead code: the C++ Wayfire shim uses Wayfire's built-in perspective-warp rendering pipeline instead of calling into these functions. The crate is retained because removal would require touching the CMake build and the C++ shim's dlopen path. Scheduled for removal once the C++ shim is fully excised.

Key Types

WarpRendererOpenGL renderer for perspective warp — manages shaders, VBOs, FBOs. Currently unused in production.
WarpErrorError type for warp operations — shader compilation failures, GL errors, invalid matrices.

Modules

error

WarpError enum — shader compilation errors, GL errors, invalid homography matrices.

homography

Homography matrix operations shared with portal-spatial — DLT solver, point transformation.

shader

GLSL shader compilation and GL state management — vertex/fragment shaders, uniform setting, texture binding.

renderer

WarpRenderer — manages the complete rendering pipeline: VBO setup, shader program, FBO for offscreen rendering, draw calls.

Data Flow

UNUSED — would have been: compositor output → WarpRenderer applies homography shader → warped texture → glasses display

Dependencies

External (3)

nalgebra 0.33thiserror workspacetracing workspace

DEAD CODE — 6 P0/P1 security findings accepted as documented risk. See .omo/plans/audit-remediation.md Wave 5.B / todo 76.