import type { MetalUniform } from "./uniforms.js"; export interface MetalUniformSlot { readonly stage: "vertex" | "fragment"; readonly index: number; } export declare function hasUniformBindings(uniforms: readonly MetalUniform[]): boolean; export declare function validateUniformSlots(uniforms: readonly MetalUniform[], selectedStages: readonly string[], label: string): void; export declare function generateUniformSlots(uniform: MetalUniform): string; export declare function generateBindingsDeclaration(uniforms: readonly MetalUniform[]): string; export declare function generateBindingMethods(uniforms: readonly MetalUniform[]): string; export declare const bindingSupport = "public enum ShaderBindingError: Error {\n case invalidRange(binding: String, offset: Int, length: Int, bufferLength: Int)\n case insufficientRange(binding: String, required: Int, actual: Int)\n case misalignedOffset(binding: String, required: Int, actual: Int)\n case resourceDeviceMismatch(binding: String)\n case encoderDeviceMismatch\n case unrepresentableLength(binding: String, maximum: Int, actual: Int)\n case preparedDeviceMismatch\n}\n\npublic struct ShaderBufferRange {\n public let buffer: any MTLBuffer\n public let offset: Int\n public let length: Int\n\n public init(buffer: any MTLBuffer, offset: Int, length: Int) {\n self.buffer = buffer\n self.offset = offset\n self.length = length\n }\n}\n\npublic struct ShaderBufferSlot: Sendable {\n public let stage: ShaderStage\n public let index: Int\n}\n\nprivate enum _ShaderBinding {\n static func validate(_ range: ShaderBufferRange, name: String, byteCount: Int, alignment: Int, device: any MTLDevice, constantBuffer: Bool = true) throws {\n guard range.offset >= 0, range.length >= 0,\n range.offset <= range.buffer.length,\n range.length <= range.buffer.length - range.offset else {\n throw ShaderBindingError.invalidRange(binding: name, offset: range.offset, length: range.length, bufferLength: range.buffer.length)\n }\n guard range.length >= byteCount else {\n throw ShaderBindingError.insufficientRange(binding: name, required: byteCount, actual: range.length)\n }\n // Apple GPU constant buffers require 4-byte offsets. The 256-byte fallback\n // is a conservative compatibility policy for devices outside this release's\n // tested Apple-family matrix, not a universal Metal requirement.\n let requiredAlignment = constantBuffer ? Swift.max(alignment, device.supportsFamily(.apple1) ? 4 : 256) : alignment\n guard range.offset % requiredAlignment == 0 else {\n throw ShaderBindingError.misalignedOffset(binding: name, required: requiredAlignment, actual: range.offset)\n }\n guard range.buffer.device === device else {\n throw ShaderBindingError.resourceDeviceMismatch(binding: name)\n }\n }\n}\n"; //# sourceMappingURL=bindings.d.ts.map