wcandillon / wcandillon/react-native-webgpu

Android: Crash when configuring context

Open
#407 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
70
Avg merge
1d 6h
Merged PRs (30d)
23

Description

Thanks once again for this great project!

As mentioned on #406 I have attempted to create an absolute basic hello world example using three.js, which has been further refactored since I opened that issue.

However one thing that I have discovered in my environment (Expo-based project using Expo 56, Pixel 3 running Android 15 (LineageOS) and running an Expo development build) is that I cannot configure the context.

Specifically the code (mentioned in the docs) to do this fails:

context.configure({
      device,
      format: navigator.gpu.getPreferredCanvasFormat(),
      alphaMode: "premultiplied"
})

with this error:

THREE.THREE.WebGPURenderer: WebGPU Device Lost:
Message: CreateAndroidSurfaceKHR failed with VK_ERROR_NATIVE_WINDOW_IN_USE_KHR

A bit of digging suggests that this is because the window is already associated with a Vulkan instance and you're trying to re-associate it with another.

If I remove the configure, my example works absolutely fine.

The example is the [hello world example at https://github.com/nickw1/react-native-webgpu-hello-world] (https://github.com/nickw1/react-native-webgpu-hello-world) mentioned in my previous issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure in the linked hello world example and inspect the documented context.configure call with the Expo development build on Android. Compare the behavior with configure removed, then verify that context configuration no longer causes the WebGPU device-loss error while the example continues to render.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native, typescript
Domain
computer-graphics, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.