Skip to content

Android: Crash when configuring context #407

Description

@nickw1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions