limits property

  1. @override
DeviceLimits limits
latefinal

The device's own limits, as granted — open asks for no raised ones, so these are what the adapter gives every device by default — with three answers of this backend's own:

  • maxColorAttachments is four — gfx-50n. The specification's guaranteed floor, which no device may report below. A constant rather than the device's number, because here the floor is the promise and it is what maxColorAttachments has always answered: a WebGPU device that offered fewer would not be a WebGPU device.
  • maxSamplerAnisotropy is sixteen, which is what this API's maxAnisotropy tops out at. A sampler asking for more is clamped by _samplerFor rather than refused.
  • maxSampleCount is four, the only count above one WebGPU offers.

Implementation

@override
late final DeviceLimits limits = () {
  final l = _gpuDevice.limits;
  return DeviceLimits(
    maxTextureDimension1D: l.maxTextureDimension1D,
    maxTextureDimension2D: l.maxTextureDimension2D,
    maxTextureDimension3D: l.maxTextureDimension3D,
    maxTextureArrayLayers: l.maxTextureArrayLayers,
    maxColorAttachments: 4,
    maxColorAttachmentBytesPerSample: l.maxColorAttachmentBytesPerSample,
    maxSampleCount: 4,
    maxSamplerAnisotropy: 16,
    maxBindGroups: l.maxBindGroups,
    maxSampledTexturesPerShaderStage: l.maxSampledTexturesPerShaderStage,
    maxSamplersPerShaderStage: l.maxSamplersPerShaderStage,
    maxStorageBuffersPerShaderStage: l.maxStorageBuffersPerShaderStage,
    maxStorageTexturesPerShaderStage: l.maxStorageTexturesPerShaderStage,
    maxUniformBuffersPerShaderStage: l.maxUniformBuffersPerShaderStage,
    maxUniformBufferBindingSize: l.maxUniformBufferBindingSize,
    maxStorageBufferBindingSize: l.maxStorageBufferBindingSize,
    maxBufferSize: l.maxBufferSize,
    minUniformBufferOffsetAlignment: l.minUniformBufferOffsetAlignment,
    minStorageBufferOffsetAlignment: l.minStorageBufferOffsetAlignment,
    maxVertexBuffers: l.maxVertexBuffers,
    maxVertexAttributes: l.maxVertexAttributes,
    maxVertexBufferArrayStride: l.maxVertexBufferArrayStride,
    maxInterStageShaderVariables: l.maxInterStageShaderVariables,
    maxComputeWorkgroupStorageSize: l.maxComputeWorkgroupStorageSize,
    maxComputeInvocationsPerWorkgroup: l.maxComputeInvocationsPerWorkgroup,
    maxComputeWorkgroupSizeX: l.maxComputeWorkgroupSizeX,
    maxComputeWorkgroupSizeY: l.maxComputeWorkgroupSizeY,
    maxComputeWorkgroupSizeZ: l.maxComputeWorkgroupSizeZ,
    maxComputeWorkgroupsPerDimension: l.maxComputeWorkgroupsPerDimension,
  );
}();