UNPKG

wgsl_reflect

Version:
87 lines (86 loc) 4.32 kB
import * as AST from "./wgsl_ast.js"; import { WgslExec } from "./wgsl_exec.js"; import { ExecContext, FunctionRef } from "./exec/exec_context.js"; import { Command } from "./exec/command.js"; import { StackFrame } from "./exec/stack_frame.js"; import { ExecStack } from "./exec/exec_stack.js"; import { Data } from "./wgsl_ast.js"; import { StructInfo, TypeInfo, FunctionInfo } from "./reflect/info.js"; type RuntimeStateCallbackType = () => void; export declare const DERIVATIVE_BUILTINS: Set<string>; export declare const IMPLICIT_LOD_BUILTINS: Set<string>; export declare const QUAD_RENDEZVOUS_BUILTINS: Set<string>; interface BindingEntry { texture?: { view?: unknown; }; descriptor?: unknown; uniform?: ArrayBuffer; sampler?: Record<string, unknown>; } type StageInputs = Record<string, number | number[] | Float32Array | Uint32Array | Int32Array>; export declare class WgslDebug { private _code; private _exec; private _execStack; private _dispatchId; private _returnValue; private _discarded; private _quadRendezvous; private _runTimer; runSliceSize: number; readonly breakpoints: Set<number>; runStateCallback: RuntimeStateCallbackType | null; private _commandCache; constructor(code: string, runStateCallback?: RuntimeStateCallbackType); getVariableValue(name: string): number | number[] | null; reset(): void; startDebug(): void; get context(): ExecContext; private _resolveState; private _resolveCurrentState; get currentState(): StackFrame | null; get currentCommand(): Command | null; toggleBreakpoint(line: number): void; clearBreakpoints(): void; get isRunning(): boolean; private _stopRunning; run(): void; pause(): void; _setOverrides(constants: Record<string, unknown>, context: ExecContext): void; debugWorkgroup(kernel: string, dispatchId: number[], dispatchCount: number | number[], bindGroups: Record<string, Record<string, BindingEntry>>, config?: Record<string, unknown>): boolean; _bindResources(bindGroups: Record<string, Record<string, BindingEntry>>, refl: FunctionInfo, context: ExecContext): void; debugVertex(entry: string, inputs: StageInputs, bindGroups: Record<string, Record<string, BindingEntry>>, config?: Record<string, unknown>): boolean; debugFragment(entry: string, inputs: StageInputs, bindGroups: Record<string, Record<string, BindingEntry>>, config?: Record<string, unknown>): boolean; _debugStage(entry: string, stage: string, inputs: StageInputs, bindGroups: Record<string, Record<string, BindingEntry>>, config?: Record<string, unknown>): boolean; _bindStageInputs(fn: FunctionRef, inputs: StageInputs, context: ExecContext): void; _inputSemantic(attributes: AST.Attribute[] | null): { builtin: string | null; location: string | null; }; _makeStageValue(typeInfo: TypeInfo | null, value: number | number[] | Float32Array | Uint32Array | Int32Array): Data | null; _makeStructInput(typeInfo: StructInfo, inputs: StageInputs, context: ExecContext): Data; get returnValue(): Data | null; takeReturnValue(): Data | null; get discarded(): boolean; takeDiscarded(): boolean; dataToJS(v: Data | null): number | number[] | Record<string, unknown> | null; get quadRendezvous(): boolean; set quadRendezvous(v: boolean); getReturnValue(): number | number[] | Record<string, unknown> | null; _dataToJS(v: Data | null): number | number[] | Record<string, unknown> | null; _shouldExecuteNextCommand(stack?: ExecStack): boolean; stepInto(): void; stepOver(): void; stepOut(): void; stepNext(stepInto?: boolean): boolean; stepStack(stack: ExecStack, stepInto?: boolean): boolean; get exec(): WgslExec; applyOverrides(constants: Record<string, unknown>, context: ExecContext): void; createStackFrame(body: AST.Node[], context: ExecContext, parent?: StackFrame): StackFrame; _dispatchWorkgroup(f: FunctionRef, workgroup_id: number[], context: ExecContext): boolean; _dispatchExec(f: FunctionRef, context: ExecContext): void; _createState(ast: AST.Node[], context: ExecContext, parent?: StackFrame): StackFrame; _collectFunctionCalls(node: AST.Expression, functionCalls: AST.CallExpr[]): void; } export {};