limits property

  1. @override
DeviceLimits get limits
override

inner's limits, with what a removed feature takes along: the compute limits without compute, one sample without offscreenMultisample, no views without multiview.

Implementation

@override
DeviceLimits get limits {
  final l = inner.limits;
  final map = l.toMap();
  final noCompute = _off(DeviceFeature.compute);
  int pick(String name, {required bool zero, int to = 0}) =>
      zero ? to : map[name]!;
  return DeviceLimits(
    maxTextureDimension1D: l.maxTextureDimension1D,
    maxTextureDimension2D: l.maxTextureDimension2D,
    maxTextureDimension3D: l.maxTextureDimension3D,
    maxTextureArrayLayers: l.maxTextureArrayLayers,
    maxColorAttachments: l.maxColorAttachments,
    maxColorAttachmentBytesPerSample: l.maxColorAttachmentBytesPerSample,
    maxSampleCount: pick(
      'maxSampleCount',
      zero: _off(DeviceFeature.offscreenMultisample),
      to: 1,
    ),
    maxSamplerAnisotropy: l.maxSamplerAnisotropy,
    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: pick(
      'maxComputeWorkgroupStorageSize',
      zero: noCompute,
    ),
    maxComputeInvocationsPerWorkgroup: pick(
      'maxComputeInvocationsPerWorkgroup',
      zero: noCompute,
    ),
    maxComputeWorkgroupSizeX: pick(
      'maxComputeWorkgroupSizeX',
      zero: noCompute,
    ),
    maxComputeWorkgroupSizeY: pick(
      'maxComputeWorkgroupSizeY',
      zero: noCompute,
    ),
    maxComputeWorkgroupSizeZ: pick(
      'maxComputeWorkgroupSizeZ',
      zero: noCompute,
    ),
    maxComputeWorkgroupsPerDimension: pick(
      'maxComputeWorkgroupsPerDimension',
      zero: noCompute,
    ),
    maxImmediateDataSize: l.maxImmediateDataSize,
    maxMultiviewViews: pick(
      'maxMultiviewViews',
      zero: _off(DeviceFeature.multiview),
    ),
  );
}