Add WebGPU Bare device type for testing without optional features#8555
Merged
mvaligursky merged 3 commits intomainfrom Mar 25, 2026
Merged
Add WebGPU Bare device type for testing without optional features#8555mvaligursky merged 3 commits intomainfrom
mvaligursky merged 3 commits intomainfrom
Conversation
Adds DEVICETYPE_WEBGPU_BARE ('webgpu:bare') — a WebGPU device mode that
requests no optional features and uses default spec limits, simulating
the most constrained WebGPU environment.
Also fixes @config parser regex bug where \s+ matched newlines, causing
value-less flags to swallow the next @config line as their value.
Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “bare” WebGPU device selection (DEVICETYPE_WEBGPU_BARE / 'webgpu:bare') to help test the engine and examples under a constrained WebGPU configuration (no optional features; default limits behavior), plus updates the examples UI/config parsing to support selecting and disabling this mode.
Changes:
- Introduces
DEVICETYPE_WEBGPU_BAREin the engine and routes it throughcreateGraphicsDeviceto initialize WebGPU in “bare” mode. - Updates WebGPU device creation to optionally skip requesting optional adapter features / copying adapter limits.
- Extends the examples device selector and
@configparsing/handling to supportWEBGPU_BARE_DISABLED, and fixes the@configregex newline swallowing issue.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/platform/graphics/webgpu/webgpu-graphics-device.js | Adds “bare” feature-level handling to skip optional features/limits during WebGPU device creation. |
| src/platform/graphics/graphics-device-create.js | Recognizes 'webgpu:bare' in deviceTypes and passes a feature-level option into WebGPU initialization. |
| src/platform/graphics/constants.js | Exposes the new DEVICETYPE_WEBGPU_BARE constant in the public graphics constants. |
| examples/utils/utils.mjs | Fixes @config parsing regex to avoid \\s+ consuming newlines. |
| examples/src/examples/test/radix-sort.example.mjs | Marks radix-sort example as incompatible with bare WebGPU via WEBGPU_BARE_DISABLED. |
| examples/src/app/constants.mjs | Adds 'webgpu:bare' constant for the examples app. |
| examples/src/app/components/DeviceSelector.mjs | Adds “WebGPU Bare” option (dev-only) and improves WebGPU-family fallback handling. |
| examples/iframe/utils.mjs | Fixes @config parsing regex; adds webgpu:bare selection and WEBGPU_BARE_DISABLED handling. |
| examples/iframe/loader.mjs | Reports the selected WebGPU variant back to the UI when the engine is still in the WebGPU family. |
Comments suppressed due to low confidence (2)
examples/utils/utils.mjs:52
- While adding support for
WEBGPU_BARE_DISABLED, theExampleConfigtypedef aboveparseConfigisn't updated to include this flag. Updating the typedef will keep generated metadata / editor IntelliSense in sync with the supported@configkeys.
export const parseConfig = (script) => {
const regex = /\/\/ @config (\S+)(?:[ \t]+([^\n]+))?/g;
let match;
/** @type {Record<string, any>} */
const config = {};
while ((match = regex.exec(script)) !== null) {
const key = match[1].trim();
const val = match[2]?.trim();
config[key] = /true|false/.test(val) ? val === 'true' : val ?? true;
}
examples/iframe/utils.mjs:113
updateDeviceTypenow also readsconfig.WEBGPU_BARE_DISABLED, but the JSDoc type forconfigonly listsWEBGPU_DISABLED/WEBGL_DISABLED. Please update the JSDoc shape so the supported config flags are accurately documented.
/**
* @param {{ WEBGPU_DISABLED: boolean; WEBGL_DISABLED: boolean; }} config - The configuration object.
*/
export function updateDeviceType(config) {
const savedDevice = localStorage.getItem('preferredGraphicsDevice') ?? 'webgl2';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
DEVICETYPE_WEBGPU_BARE('webgpu:bare') — a WebGPU device mode that requests no optional features and uses default spec limits, simulating the most constrained WebGPU environment (e.g. iOS devices without float32-filterable or compressed textures).Changes:
DEVICETYPE_WEBGPU_BAREconstant to the engine public APIcreateGraphicsDevicerecognizeswebgpu:barein thedeviceTypesarray and creates a bare WebGPU device accordinglyWebgpuGraphicsDevice.createDevice()skips all optional feature requests and uses default spec limits when in bare mode@config WEBGPU_BARE_DISABLEDtag support for examples incompatible with bare mode@configparser regex bug where\s+matched newlines, causing value-less flags (e.g.HIDDEN,WEBGL_DISABLED) to swallow the next@configline as their valueAPI Changes:
DEVICETYPE_WEBGPU_BARE('webgpu:bare')