React Native WebGPU

Overview

How this API Reference relates to the standard WebGPU API.

WebGPU API

React Native WebGPU implements the standard WebGPU API. Types such as GPUDevice, GPUBuffer, GPUTexture, and GPURenderPipeline behave exactly as they do on the web, so any code or tutorial written against the WebGPU specification works here unchanged.

To learn the core API, use the resources below:

Core WebGPU concepts

Understanding the foundational WebGPU objects and how they interact is essential to WebGPU development. Each concept below links to its reference on MDN.

ConceptDescription
InstanceThe entry point to WebGPU, exposed as navigator.gpu, granting access to adapters
AdapterRepresents a specific GPU on the device
DeviceYour logical connection to the GPU where resources are created
QueueThe mechanism used to submit commands to the GPU
Shader ModuleYour GPU code, written in the WebGPU Shading Language (WGSL)
PipelinesObjects describing the entire GPU state (shaders, blending) for a task
Bind GroupsTies data buffers (ex: textures) to shaders
Command EncoderAn object used to build a sequence of GPU commands into a command buffer

What this reference covers

This section documents only the additions that are specific to React Native, the surface you will not find in the WebGPU specification:

  • Canvas: the React component that gives you a WebGPU rendering surface.
  • GPUDeviceProvider: provides a GPUDevice to your component tree.
  • warnIfNotHardwareAccelerated: warns when the device falls back to software rendering.
  • installWebGPU: installs the WebGPU globals on a worklet runtime.
  • Native Extensions: native buffer and frame import, createImageBitmap, high bit depth formats, and other additions to the WebGPU globals.
  • Native Buffer: NativeBuffer, createNativeBuffer and NativeBufferView, the view that displays a native buffer.
  • drawElementImageToTexture: copies the pixels of a React Native view into a GPUTexture.
  • requestAnimationFrame: a requestAnimationFrame paced by the display, on every runtime.
  • Video Player: decodes a video into native buffers, for tests and examples.

Also covered in the guides: GPUOffscreenCanvas for headless rendering, and importDevice / adoptTexture for sharing devices and textures with other libraries.