You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add deviceTypes API for WebGPU support and update documentation
- Introduced a new `deviceTypes` prop in the Application component to specify graphics device types, allowing for fallback options between WebGPU and WebGL2.
- Updated the Application documentation to include details on the new `deviceTypes` prop and its usage.
- Enhanced the Application component to initialize the graphics device based on the specified device types.
* changeset
* Refactor Application tests to include deviceTypes prop
- Updated Application component tests to pass the new deviceTypes prop, ensuring compatibility with the latest graphics device initialization.
- Modified Container, Entity, Screen, and Script component tests to include deviceTypes for consistent testing across components.
- Cleaned up unused code and improved test structure for better readability and maintainability.
* Fix import path for GraphicsDeviceOptions in create-graphics-device.ts
* Update Application component to default deviceTypes to WebGL2 and optimize graphics device initialization
- Set default value for deviceTypes to [DEVICETYPE_WEBGL2] in the ApplicationWithoutCanvas component.
- Introduced memoization for deviceTypes to enhance performance during graphics device creation.
- Updated graphics device initialization to use memoized deviceTypes for improved consistency.
* Enhance Application component with deviceTypes validation and testing
- Added a test case to warn when an invalid deviceTypes prop is provided, ensuring proper validation.
- Refactored the Application component to improve graphics device initialization and memoization of deviceTypes.
- Updated the create-graphics-device utility to allow explicit device type specification without injecting additional devices.
- Adjusted validation error messages for deviceTypes to provide clearer feedback on incorrect usage.
* Update documentation for deviceTypes prop in Application component
- Clarified the description of the deviceTypes prop to specify its role in determining the graphics device order.
- Added information about the "null" device type for testing purposes, enhancing the documentation's comprehensiveness.
Copy file name to clipboardExpand all lines: packages/docs/content/docs/api/application.mdx
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,15 @@ Enables physics for the application. Learn more about [Physics in Playcanvas](ht
55
55
Type: `boolean`
56
56
Default: `false`
57
57
58
+
### `deviceTypes`
59
+
The `deviceTypes` prop determines the graphics device to use. It accepts an array of strings, each representing a different device which sets an order of fallback devices. The first device that gets successfully created, will be used.
60
+
61
+
For example, if you want to use WebGPU first, but fall back to WebGL2 when WebGPU is not supported, you can use `<Application deviceTypes={["webgpu", "webgl2"]} />`.
62
+
63
+
-`"webgpu"` - Use the WebGPU device type
64
+
-`"webgl2"` - Use the WebGL2 device type
65
+
-`"null"` - Use the Null device type. Useful for testing.
66
+
58
67
### `fillMode`
59
68
This prop determines how the canvas fills its container. It accepts one of the following values from PlayCanvas:
return`deviceTypes must be an array containing one or more of: '${DEVICETYPE_WEBGPU}', '${DEVICETYPE_WEBGL2}', '${DEVICETYPE_NULL}'. Received: ['${value}']`
279
+
},
280
+
/**
281
+
* In test environments, we default to a Null device, because we don't cant use WebGL2/WebGPU.
282
+
* This is just for testing purposes so we can test the fallback logic, without initializing WebGL2/WebGPU.
0 commit comments