Skip to content

fix: Compile Android resizer shaders on AGP 9 - #4190

Open
mrousavy wants to merge 2 commits into
mainfrom
fix/resizer-shader-compilation-agp9
Open

fix: Compile Android resizer shaders on AGP 9#4190
mrousavy wants to merge 2 commits into
mainfrom
fix/resizer-shader-compilation-agp9

Conversation

@mrousavy

@mrousavy mrousavy commented Sep 10, 2026

Copy link
Copy Markdown
Member

On AGP 9, the resizer's shader can be omitted from app assets, causing the first resize() call to fail. Shader compilation is disabled by default, and enabling AGP's built-in task requires a compiler path in the consuming app's local.properties.

Compile Resizer.comp during the consumer's build using glslc from the selected NDK, and register its output with AGP's generated-assets API. The task tracks the shader directory and compiler as inputs, including changes to shader includes. Disable the built-in shader task to avoid duplicate compilation on AGP 8.

Include the new Gradle script in the npm package. Existing debug Harness CI builds the consumer app and exercises the resizer on supported devices.

Fixes #4183.

Validated on macOS with NDK 29 and compile SDK 36:

  • AGP 8.12 / Gradle 9.3.1: debug and release AARs and consuming test-app APKs contain matching shaders that pass spirv-val.
  • AGP 9.2.1 / Gradle 9.4.1: reproduced the missing asset, then verified valid shaders in patched debug and release AARs.
  • Configuration-cache reuse, up-to-date builds, include-only edits, invalid GLSL failures, and build-cache restoration.
  • npm pack --dry-run includes the Gradle script and shader source.

GPU execution on a device was not tested.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-native-vision-camera-docs Ready Ready Preview Sep 10, 2026 3:45pm UTC

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resizer: Vulkan shader is not packaged with AGP 9 (shader sourceSet compilation removed)

1 participant