Skip to content

Commit

Permalink
Require all supported WebGPU limits when creating a device (#6255)
Browse files Browse the repository at this point in the history
* Require all supported WebGPU limits when creating a device

* use the actual device limits, and not adapter limits - as that is what is available on the device

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Apr 16, 2024
1 parent 024e091 commit 4f87dd2
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit 4f87dd2

Please sign in to comment.