setLabel method

  1. @override
void setLabel(
  1. Object resource,
  2. String label
)
override

Passed through, and written into the trace for a texture, a geometry buffer, a pipeline or a storage buffer the trace made, so a replay gives it the same label. Any other resource is passed through and listed in unrecorded.

Implementation

@override
void setLabel(Object resource, String label) {
  final named = switch (resource) {
    final TextureHandle texture => (
      TraceLabeled.texture,
      _textureIds[texture],
    ),
    final GeometryBuffer buffer => (
      TraceLabeled.geometry,
      _geometryIds[buffer.backend],
    ),
    final PipelineHandle pipeline => (
      TraceLabeled.pipeline,
      _pipelineIds[pipeline],
    ),
    final StorageBuffer buffer => (TraceLabeled.storage, _storageIds[buffer]),
    _ => null,
  };
  switch (named) {
    case (final kind, final int id):
      events.add(TraceSetLabel(resource: kind, id: id, label: label));
    default:
      _unrecorded('setLabel');
  }
  inner.setLabel(resource, label);
}