feat: add native Dawn debug toggle configuration & Expo Config Plugin#1
Draft
feat: add native Dawn debug toggle configuration & Expo Config Plugin#1
Conversation
d04cfae to
ee70196
Compare
Allow enabling/disabling Dawn debug toggles (e.g. dump_shaders, use_user_defined_labels_in_backend) from JS via requestDevice(). Added as a non-standard extension field to GPUDeviceDescriptor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add dawnToggles option tests to Device.spec.ts (covers enable/disable/both/empty cases) - Fix Dawn API naming in GPUAdapter.cpp: enabledTogglesCount → enabledToggleCount disabledTogglesCount → disabledToggleCount Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ee70196 to
1a06e19
Compare
…tions
Dawn toggles are now specified at the Instance level via installWebGPU(),
matching node-webgpu's create() design. This avoids polluting the standard
GPUDeviceDescriptor type with a non-standard Dawn-specific field.
- Add RNWebGPUInstallOptions / DawnTogglesDescriptor types (exported)
- Export installWebGPU(options?) from the package entry point
- Remove declare global extension of GPUDeviceDescriptor
- Remove GPUDawnTogglesDescriptor.h and dawnToggles from GPUDeviceDescriptor
- Pass toggles through install() → RNWebGPUManager → GPU constructor
- Apply DawnTogglesDescriptor to both CreateInstance and RequestAdapter
- Remove dawnToggles handling from GPUAdapter::requestDevice()
- Update iOS/Android native install() to accept and parse options
- Web entry point exports a no-op installWebGPU() that ignores toggles
BREAKING CHANGE: requestDevice({ dawnToggles }) is no longer supported.
Use installWebGPU({ dawnToggles }) instead.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expo managed/bare workflow ユーザーが app.json の plugins フィールドから enableToggles / disableToggles を設定できる Config Plugin を追加。 plugin/src/app.plugin.ts → app.plugin.js にコンパイルして配布。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
enableToggles/disableToggles) をネイティブ初期化パスへ移動AndroidManifest.xmlの<meta-data>エントリで設定Info.plistのキーで設定app.jsonのpluginsフィールドから設定可能)Changes
Native (Android / iOS)
RNWebGPUManagerに enable/disable toggle リストをプラグインcom.webgpu.enable_toggles/com.webgpu.disable_togglesmeta-data を読み取り(カンマ区切り、空エントリは無視)RNWebGPUEnableToggles/RNWebGPUDisableTogglesInfo.plist キーを読み取りExpo Config Plugin
packages/webgpu/plugin/src/app.plugin.ts追加yarn workspace react-native-wgpu build:pluginでapp.plugin.jsを生成package.jsonにexpo.pluginフィールドとbuild:pluginスクリプトを追加Usage
RN CLI (manual)
iOS – Info.plist:
Android – AndroidManifest.xml:
Expo (app.json)
{ "expo": { "plugins": [ ["react-native-wgpu", { "enableToggles": ["allow_unsafe_apis"], "disableToggles": ["disallow_spirv"] }] ] } }Notes
requestDevice()/installWebGPU()トグル API は廃止し、ネイティブ設定に一本化Test plan
yarn --cwd packages/webgpu tscyarn workspace react-native-wgpu build:pluginでapp.plugin.jsが生成されることInfo.plistからトグルが読み取られることAndroidManifest.xmlからトグルが読み取られることnpx expo prebuild後にネイティブファイルへの挿入を確認dump_shadersなど観測可能なトグルで動作確認