Raxol.Terminal.Rendering.GPUAccelerator (Raxol v2.0.1)
View SourceGPU-accelerated rendering backend for Raxol terminals using Metal (macOS) and Vulkan.
This module provides high-performance GPU-accelerated terminal rendering with:
- Metal API integration for macOS (optimal performance on Apple Silicon)
- Vulkan API support for cross-platform GPU acceleration
- Compute shaders for text rendering and effects
- Hardware-accelerated glyph rasterization
- GPU-based scrolling and animation
- Memory-efficient texture atlases for fonts
- Parallel rendering pipelines
- Adaptive quality scaling based on performance
Features
Performance Optimizations
- GPU-based glyph rendering with subpixel precision
- Texture atlas caching for font glyphs
- Instanced rendering for repeated characters
- Compute shader-based text layout
- Hardware scrolling without CPU intervention
- Parallel processing of multiple terminal sessions
Visual Enhancements
- Hardware anti-aliasing (MSAA/FXAA)
- GPU-based text effects (shadows, outlines, glows)
- Real-time blur and transparency effects
- Smooth animations with GPU interpolation
- High-DPI rendering with pixel-perfect scaling
- Color space management and HDR support
Usage
# Initialize GPU acceleration
{:ok, context} = GPUAccelerator.init(backend: :metal)
# Create rendering surface
surface = GPUAccelerator.create_surface(context, width: 1920, height: 1080)
# Render terminal content
terminal_buffer = get_terminal_buffer()
GPUAccelerator.render(context, surface, terminal_buffer)
# Enable effects
GPUAccelerator.enable_effect(context, :blur, intensity: 0.5)
GPUAccelerator.enable_effect(context, :glow, color: {0, 255, 128})
Summary
Functions
Checks if GPU acceleration is available on the current system.
Gets the backend's capabilities and supported features.
Returns a specification to start this module under a supervisor.
Creates and manages a GPU texture atlas for font glyphs.
Creates a rendering surface for the specified dimensions.
Destroys a rendering surface and releases its resources.
Disables a visual effect.
Enables a visual effect on the rendering context.
Gets rendering performance statistics.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Initializes GPU acceleration with the specified configuration.
Profiles GPU performance and suggests optimizations.
Renders terminal content to the specified surface.
Updates the GPU acceleration configuration.
Types
@type backend_type() :: :metal | :vulkan | :auto
@type config() :: %{ backend: backend_type(), vsync: boolean(), msaa_samples: 1 | 2 | 4 | 8 | 16, max_texture_size: integer(), enable_compute_shaders: boolean(), debug_mode: boolean(), performance_profile: :battery | :balanced | :performance }
@type gpu_device() :: term()
@type render_surface() :: term()
@type shader_program() :: term()
@type texture_atlas() :: term()
Functions
Checks if GPU acceleration is available on the current system.
Gets the backend's capabilities and supported features.
Returns a specification to start this module under a supervisor.
See Supervisor.
Creates and manages a GPU texture atlas for font glyphs.
Creates a rendering surface for the specified dimensions.
Destroys a rendering surface and releases its resources.
Disables a visual effect.
Enables a visual effect on the rendering context.
Gets rendering performance statistics.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Initializes GPU acceleration with the specified configuration.
Profiles GPU performance and suggests optimizations.
Renders terminal content to the specified surface.
Updates the GPU acceleration configuration.