attachmentView method

GPUTextureView attachmentView({
  1. int face = 0,
  2. int level = 0,
})

The view a pass attaches: one face of one level, always as a flat image.

A cube face and a mip level are the same mechanism here, which is the one place this API is simpler than the two the other hardware backends sit on: baseArrayLayer picks the face, baseMipLevel picks the level, and the result is an ordinary 2D attachment either way.

Implementation

GPUTextureView attachmentView({int face = 0, int level = 0}) =>
    _attachmentViews.putIfAbsent(
      face * 64 + level,
      () => texture.createView(
        GPUTextureViewDescriptor(
          dimension: '2d',
          aspect: 'all',
          baseMipLevel: level,
          mipLevelCount: 1,
          baseArrayLayer: face,
          arrayLayerCount: 1,
        ),
      ),
    );