import '../../../../assert/js/assert.js';
import '../../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * TODO: doc
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow, webgpu } from '../../imports.js';
export default class PipelineLayout {
    constructor(deviceContext, bindGroupLayouts) {
        this.deviceContext = deviceContext;
        this.bindGroupLayouts = bindGroupLayouts;
        this.layout = webgpu.deviceCreatePipelineLayout(deviceContext.device, {
            bindGroupLayouts: bindGroupLayouts.map(bindGroupLayout => bindGroupLayout.layout)
        });
    }
    hasBindingWithSlot(slot) {
        for (let i = 0; i < this.bindGroupLayouts.length; i++) {
            if (this.bindGroupLayouts[i].hasBindingWithSlot(slot)) {
                return true;
            }
        }
        return false;
    }
    getBindingFromSlot(slot) {
        let binding = null;
        for (let i = 0; i < this.bindGroupLayouts.length; i++) {
            binding = this.bindGroupLayouts[i].getBindingFromSlot(slot);
            if (binding) {
                break;
            }
        }
        assert && assert(binding);
        return binding;
    }
}
alpenglow.register('PipelineLayout', PipelineLayout);
//# sourceMappingURL=PipelineLayout.js.map