/** * Pex-gpu: WebGPU rendering for PEX. * * One flat entry point, grouped in layers: * * - **commands** — declarative plain-object rendering: draws, compute dispatches * and render bundles described as data and submitted inside a frame loop; * pipelines, bind groups and uniform buffers are derived from WGSL reflection * and cached automatically. * - **core** — thin, typed, tree-shakeable helpers over raw WebGPU; you drive * command encoders yourself. The commands layer is built entirely on top of * it, and both share the same resource objects. * * Allocators, caches, reflection and byte-math utilities are exported * separately from `"pex-gpu/internals"` for advanced use. * * The namespace import is the recommended style — one import line, and the * whole API discoverable behind `gpu.`; named imports work identically and * tree-shake the same: * * ```js * import * as gpu from "pex-gpu"; * * const ctx = await gpu.createContext(); * gpu.frame(ctx, () => { * gpu.submit(ctx, drawCmd); * }); * ``` * * @module pex-gpu */ // ─── Commands: declarative plain-object rendering ──────────────────────────── export { frame, beginFrame, endFrame, flush } from "./context.js"; export type { FrameOptions } from "./context.js"; export { submit, pipelineFailed } from "./submit.js"; export { defineCommand, definePass, definePipeline } from "./define.js"; export type { Command, RenderCommand, ComputeCommand, BundleCommand, RenderPassDescriptor, ComputePassDescriptor, ColorAttachment, DepthStencilAttachment, RenderPipeline, RenderPipelineShaders, ComputePipeline, Uniforms, UniformValue, Attributes, VertexAttribute, } from "./types.js"; // ─── Core: thin helpers over raw WebGPU ────────────────────────────────────── export { createContext, resize } from "./context.js"; export type { CreateContextOptions } from "./context.js"; export { createBuffer, updateBuffer, isGpuBuffer, BUFFER_USAGE_PRESETS, } from "./buffer.js"; export type { CreateBufferOptions } from "./buffer.js"; export { createTexture, updateTexture, copyExternalImage, generateMipmaps, isGpuTexture, } from "./texture.js"; export type { CreateTextureOptions, UpdateTextureOptions, CopyExternalImageOptions, GenerateMipmapsOptions, ExternalImageSource, } from "./texture.js"; export { createSampler } from "./sampler.js"; export type { CreateSamplerOptions } from "./sampler.js"; export { readTexture, readBuffer } from "./readback.js"; export type { ReadTextureOptions } from "./readback.js"; export { createTimestampQuery } from "./query.js"; export type { TimestampQuery, CreateTimestampQueryOptions } from "./query.js"; export { debug, debugStats } from "./debug.js"; export type { DebugOptions, DebugStats, DebugTimings, PassTiming, DebugCounters, DebugLogLevel, DebugResources, ResourceEntry, BufferEntry, TextureEntry, QuerySetEntry, ResourceCounts, ResourceCountsKey, CacheCounts, CacheCountsKey, LifetimeCounts, FrameCounts, } from "./debug.js"; export { createRenderBundle } from "./bundle.js"; export type { RenderBundleFormats } from "./bundle.js"; // ─── Shared types ──────────────────────────────────────────────────────────── export type { GpuContext, FrameInfo, FrameSegment, GpuBuffer, GpuTexture, BufferUsagePreset, BufferData, TypedArray, } from "./types.js";