Skip to content

About

Cross-platform AGSL, SkSL & Pure Canvas shader engine for Jetpack Compose Multiplatform. Craft GPU screen transitions, generative shader backgrounds, and optical UI lens effects on Android, Desktop, iOS & Web.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Compose Shader Engine

Maven Central Kotlin Compose Multiplatform License

A high-performance, real-time AGSL, SkSL, and Pure Canvas shader engine for Jetpack Compose Multiplatform.

Empowers Compose developers to craft GPU-accelerated visual effects, dual-input screen transitions, procedural generative art, and optical lenses across Android, Desktop (JVM), iOS, and Web (Wasm/JS) with a unified, zero-recomposition declarative API.


Features

  • ⚡ Dual-Tier Graphics Architecture:
    • Hardware Tier (Android 13+ / Desktop Skia): Direct GPU fragment shader execution using AGSL and SkSL (RuntimeShader / RuntimeEffect).
    • Pure Canvas Tier (Android 5.0+ API 21, iOS, Web): 100% shader-free mathematical emulation using Compose DrawScope, 2D triangle mesh deformation (drawVertices), 2.5D perspective scaling, and channel-isolation ColorMatrix filters.
  • 🎨 Unified Declarative API: Use Modifier.generativeShaderCanvas(controller) and ShaderTransitionLayout without managing low-level render passes or JNI bindings.
  • 🚀 Zero-Recomposition Snapshot Pipeline: Captures live Composable hierarchies into hardware GraphicsLayer surfaces and pumps GPU uniforms every frame without triggering Compose recomposition passes.
  • 🎛️ Dual-Input Transition Layouts: High-performance transitions with interactive horizontal drag scrubbing and spring snap physics.
  • 📦 Multiplatform Ready: Supports Android (API 21+), Desktop JVM (macOS, Linux, Windows), iOS, and Web (Wasm/JS).

Installation

Add the dependency to your module's build.gradle.kts:

dependencies {
    implementation("pro.jayeshseth.shaderengine:compose-shader-engine:1.0.0-alpha01")
}

Quick Start

// 1. Declare your AGSL / SkSL shader
val MyShader = """
    uniform float2 resolution;
    uniform float time;
    uniform float progress;

    half4 main(float2 fragCoord) {
        float2 uv = fragCoord / resolution;
        return half4(uv.x, uv.y, sin(time) * 0.5 + 0.5, 1.0);
    }
"""

// 2. Drive it with ShaderController in Compose
@Composable
fun ShaderDemoScreen() {
    val controller = rememberShaderController(MyShader)

    Box(
        modifier = Modifier
            .fillMaxSize()
            .generativeShaderCanvas(controller) {
                float("progress", 0.5f)
            }
    )
}

Screenshots

Compose Shader Engine Feature Graphic

Phone

Home Transitions (Water Droplets) Canvas (Quantum Core 3D) Content (Liquid Glass) About

Tablet

Home Transitions (Water Droplets) Canvas (Quantum Core 3D) Content (Liquid Glass) About

Desktop

Home Transitions (Water Droplets) Canvas (Quantum Core 3D) Content (Liquid Glass) About

Supported Platforms

Platform Graphics Engine Tier Support
Android (API 33+) Hardware AGSL (RuntimeShader) Full Hardware Tier + Pure Canvas
Android (API 21–32) Compose DrawScope & Skia Canvas Pure Canvas Tier (drawVertices)
Desktop (macOS/Win/Linux) Skiko / Skia RuntimeEffect Full Hardware Tier + Pure Canvas
iOS / Web (Wasm & JS) Skiko / Canvas Rendering Pure Canvas Tier

Roadmap

See ROADMAP.md for milestone goals and planned features.

License

Copyright 2026 Jayesh Seth (MadFlasher)

Licensed under the Apache License, Version 2.0.

About

Cross-platform AGSL, SkSL & Pure Canvas shader engine for Jetpack Compose Multiplatform. Craft GPU screen transitions, generative shader backgrounds, and optical UI lens effects on Android, Desktop, iOS & Web.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages