import '../../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * TODO: doc
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow, BindingType } from '../../imports.js';
class BufferBindingType extends BindingType {
    constructor(type
    // public readonly hasDynamicOffset: boolean = false,
    // public readonly minBindingSize = 0
    ) {
        super();
        this.type = type;
    }
    combined(other) {
        if (other instanceof BufferBindingType) {
            if (this.type === other.type) {
                return this;
            }
            else if (this.type !== 'uniform' && other.type !== 'uniform') {
                // e.g. read-write and write
                return BufferBindingType.STORAGE;
            }
            else {
                return null;
            }
        }
        else {
            return null;
        }
    }
    toDebugString() {
        return `BufferBindingType[${this.type}]`;
        // return `BufferBindingType(${this.type}, ${this.hasDynamicOffset}, ${this.minBindingSize})`;
    }
    mutateBindGroupLayoutEntry(entry) {
        entry.buffer = {
            type: this.type
            // hasDynamicOffset: this.hasDynamicOffset,
            // minBindingSize: this.minBindingSize // TODO: see if we get better performance by skipping validation?
        };
    }
}
BufferBindingType.UNIFORM = new BufferBindingType('uniform');
BufferBindingType.READ_ONLY_STORAGE = new BufferBindingType('read-only-storage');
BufferBindingType.STORAGE = new BufferBindingType('storage');
export default BufferBindingType;
alpenglow.register('BufferBindingType', BufferBindingType);
//# sourceMappingURL=BufferBindingType.js.map