0.1.2 • Published 8 months ago

react-webgpu-context v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-webgpu-context

React context and hook to use WebGPU with customizable loading and not supported messages.

Installation

  pnpm install react-webgpu-context

App.tsx

import { WebGPUDeviceContextProvider } from 'react-webgpu-context';
import {MyWebGPUApp} from './MyWebGpuApp'
export const App = ()=>{
  return (
    <WebGPUDeviceContextProvider
      loadingMessage={(<p>Loading...</p>)}
      notSupportedMessage={(<p>WebGPU is not supported on this browser.</p>)}>
      <MyWebGPUApp />
    </WebGPUDeviceContextProvider>
  );
}

MyWebGpuApp.tsx

import { useWebGPUDevice } from 'react-webgpu-context';

export const MyWebGPUApp = ()=>{
  const device: GPUDevice = useWebGPUDevice();
  // use device to create render pipeline, buffers, etc.
}

Author

License

MIT

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago