Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require all supported WebGPU limits when creating a device #6255

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/platform/graphics/webgpu/webgpu-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
// temporarily disabled functionality which is not supported to avoid errors
this.disableParticleSystem = true;

const limits = this.gpuAdapter.limits;
const limits = this.wgpu?.limits;
this.limits = limits;

this.precision = 'highp';
Expand Down Expand Up @@ -234,13 +234,19 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
this.textureRG11B10Renderable = requireFeature('rg11b10ufloat-renderable');
Debug.log(`WEBGPU features: ${requiredFeatures.join(', ')}`);

// copy all adapter limits to the requiredLimits object - to created a device with the best feature sets available
const adapterLimits = this.gpuAdapter?.limits;
const requiredLimits = {};
if (adapterLimits) {
for (const limitName in adapterLimits) {
requiredLimits[limitName] = adapterLimits[limitName];
}
}

/** @type {GPUDeviceDescriptor} */
const deviceDescr = {
requiredFeatures,

// Note that we can request limits, but it does not seem to be supported at the moment
requiredLimits: {
},
requiredLimits,

defaultQueue: {
label: 'Default Queue'
Expand Down