import { MaterialBinding, MaterialBindingError } from "../rendering/index.js";
export class MaterialDiagnostics {
    inspect(material, shader) {
        const binding = new MaterialBinding();
        const materialName = "baseMaterial" in material ? material.baseMaterial.name : material.name;
        try {
            const result = binding.bind(material, shader);
            return {
                materialName,
                shaderLabel: shader.label,
                valid: true,
                diagnostics: [],
                uniforms: [...result.uniforms.keys()]
            };
        }
        catch (error) {
            if (error instanceof MaterialBindingError) {
                return {
                    materialName,
                    shaderLabel: shader.label,
                    valid: false,
                    diagnostics: error.diagnostics,
                    uniforms: []
                };
            }
            throw error;
        }
    }
    assertValid(report) {
        if (!report.valid) {
            throw new MaterialDiagnosticError("Material diagnostics reported invalid binding", report);
        }
    }
}
export class MaterialDiagnosticError extends Error {
    report;
    constructor(message, report) {
        super(message);
        this.report = report;
        this.name = "MaterialDiagnosticError";
    }
}
//# sourceMappingURL=MaterialDiagnostics.js.map