signatureFor method

WebGpuPipelineSignature signatureFor(
  1. WebGpuPipeline pipeline
)

The signature this draw's state makes, which is what the cache is consulted with.

Public because webgpu_encoder_test.dart asserts on it directly: the question "do these two draws want two pipelines" is answerable without counting what the browser built, and a test that could only count would pass on a backend that had stopped honouring the key and happened to build two anyway.

Implementation

WebGpuPipelineSignature signatureFor(WebGpuPipeline pipeline) {
  final strip =
      _primitive == PrimitiveType.triangleStrip ||
      _primitive == PrimitiveType.lineStrip;
  return WebGpuPipelineSignature(
    pipeline: pipeline.name,
    vertexLayout: webgpuVertexLayoutFingerprint(pipeline.layout),
    topology: gpuPrimitiveTopology(_primitive),
    stripIndexFormat: strip ? gpuIndexFormat(_indexType) : null,
    cullMode: gpuCullMode(_cull),
    frontFace: gpuFrontFace(_winding),
    depthCompare: gpuCompareFunction(_depthCompare),
    depthWrite: _depthWrite,
    stencil: webgpuStencilFingerprint(_stencilFront, _stencilBack),
    blends: _blends,
    colorFormats: _colorFormats,
    depthFormat: _depthFormat,
    sampleCount: _sampleCount,
  );
}