search
/
·
Intro
expand_more
Guides
·
Getting started
·
WebGPU canvas
·
Drawing and animation
·
Scene geometry
·
2D and 3D plot
·
Data-driven geometry
·
Live vs React
·
Memoization
·
WGSL Shaders
·
Renderers and Passes
·
Layout and UI
·
Background
·
Roadmap
·
Contributing
Reference
chevron_right
Components
expand_more
Libraries
chevron_right
@use-gpu/core
chevron_right
@use-gpu/glyph
chevron_right
@use-gpu/parse
expand_more
@use-gpu/shader
east
bindBundle
east
bindEntryPoint
east
bindingsToLinks
east
bindingToModule
east
bindModule
east
bundleToAttribute
east
bundleToAttributes
east
castTo
east
chainTo
east
compressAST
east
decompressAST
east
decompressString
east
defineConstants
east
diffBy
east
explode
east
extractBindings
east
f32
east
getBundleEntry
east
getBundleHash
east
getBundleKey
east
getBundleLabel
east
i32
east
instanceWith
east
linkBundle
east
linkCode
east
linkModule
east
loadModule
east
loadModuleWithCache
east
loadStaticModule
east
makeASTParser
east
makeModuleCache
east
rewriteUsingAST
east
sourceToModule
east
structType
east
swizzleTo
east
toBundle
east
toModule
east
transpileWGSL
east
u32
east
wgsl
data_object
GLSLLinker
data_object
parser
data_object
resolveBindings
data_object
symbolDictionary
data_object
WGSLLinker
title
AnnotatedTypeRef
title
ASTParser
title
AttributeRef
title
AttributesRef
title
BundleSummary
title
CompressedNode
title
DataBinding
title
DeclarationRef
title
EnableRef
title
FormatLike
title
FunctionHeaderRef
title
FunctionRef
title
IdentifiersRef
title
ImportRef
title
InferrableRef
title
InferRef
title
LambdaSource
title
ModuleRef
title
ParameterLike
title
ParameterRef
title
ParsedBundle
title
ParsedModule
title
ParsedModuleCache
title
QualifiedTypeAliasRef
title
ReturnTypeRef
title
ShaderDefine
title
ShaderModule
title
ShaderSource
title
ShakeOp
title
ShakeTable
title
StorageSource
title
StructMemberRef
title
StructRef
title
SymbolTable
title
SymbolTableT
title
TextureSource
title
TranspileOptions
title
TranspileOutput
title
TypeAliasRef
title
TypeLike
title
TypeRef
title
UniformAttribute
title
UniformFormat
title
UniformShaderAttribute
title
VariableDeclarationRef
title
VariableRef
title
VirtualRender
title
VirtualTable
format_list_bulleted
RefFlags
inventory_2
@use-gpu/wgsl
chevron_right
Live/React
chevron_right
Loaders
chevron_right
Development

data_object Constant – GLSLLinker

const GLSLLinker: {
  loadModule:
  (
    code: string,
    name?: string,
    entry?: string,
    compressed?: boolean,
  ) => ParsedModule,
  loadModuleWithCache:
  (
    code: string,
    name?: string,
    entry?: string,
    cache?: ParsedModuleCache | null,
  ) => ParsedModule,
  loadStaticModule:
  (
    code: string,
    name: string,
    entry?: string,
  ) => {
    name: string,
    code: string,
    hash: number,
    table: any,
    label: string,
  },
  transpileGLSL:
  (
    source: string,
    resourcePath: string,
    options?: TranspileOptions,
  ) => TranspileOutput,
  bindEntryPoint:
  <T extends ParsedModule | ParsedBundle>(
    bundle: T,
    entry?: string,
  ) => T,
  bundleToAttribute:
  (
    shader: ShaderModule,
    name?: string,
  ) => UniformAttribute,
  bundleToAttributes: (
    shader: ShaderModule,
  ) => UniformAttribute[],
  glsl:
  (
    literals: TemplateStringsArray,
    ...tokens: string[],
  ) => ParsedModule,
  float: (x: number) => string | 0,
  int: (x: number) => string,
  uint: (x: number) => string,
  defineConstants: (
    defs: Record<string, ShaderDefine>,
  ) => string,
  linkBundle:
  (
    source: ShaderModule,
    links?: Record<string,
    ParsedModule<any> | ParsedBundle<any> | null | undefined>,
    defines?: Record<string, ShaderDefine>,
  ) => string,
  linkModule:
  (
    source: ParsedModule,
    libraries?: Record<string, ShaderModule>,
    links?: Record<string,
    ParsedModule<any> | ParsedBundle<any> | null | undefined>,
    defines?: Record<string, ShaderDefine>,
  ) => string,
  linkCode:
  (
    code: string,
    libraries?: Record<string, string>,
    links?: Record<string, string | null>,
    defines?: Record<string, ShaderDefine>,
    cache?: ParsedModuleCache | null,
  ) => string,
  getPreamble: () => string,
  setPreamble: (s: string) => string,
  bindBundle:
  (
    subject: ShaderModule,
    links?: 
    | Record<string, ParsedModule<any> | ParsedBundle<any> | null | undefined>
    | null,
    defines?: Record<string, ShaderDefine> | null,
  ) => ParsedBundle,
  bindModule:
  (
    subject: ShaderModule,
    links?: 
    | Record<string, ParsedModule<any> | ParsedBundle<any> | null | undefined>
    | null,
    defines?: Record<string, ShaderDefine> | null,
  ) => ParsedBundle,
  bindingsToLinks:
  (
    bindings: ({
        uniform: UniformAttribute,
        storage?: StorageSource,
        texture?: TextureSource,
        lambda?:
        LambdaSource<ShaderModule<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>>,
        constant?: any,
    })[],
  ) => Record<string,
   | ParsedBundle<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }> | ParsedModule<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>>,
  bindingToModule:
  (
    binding: {
      uniform: UniformAttribute,
      storage?: StorageSource,
      texture?: TextureSource,
      lambda?:
      LambdaSource<ShaderModule<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>>,
      constant?: any,
    },
  ) => 
  | ParsedBundle<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>
  | ParsedModule<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>,
  sourceToModule:
  <T>(
    source: any,
  ) => 
  | ParsedBundle<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>
  | ParsedModule<{ modules?: ({ at: number, symbols: string[] } & { name: string, imports: ImportRef[] })[], declarations?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], externals?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], exports?: ({ at: number, symbols: string[] } & { func?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, parameters: string[] }, variable?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, locals: ({ name: string, expr: any })[] }, struct?: { type: { name: string, qualifiers?: string[], members?: ({ type: { }, name: string })[] }, name: string, struct: { members: ({ type: { name: string, qualifiers?: string[], members?: ({ })[] }, name: string })[] } }, identifiers?: string[], flags: RefFlags })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>
  | null,
  resolveBindings: any,
  castTo:
  (
    source: ShaderModule,
    type: string,
    swizzle?: string | { basis: string, signs?: string, gain?: number } | null,
  ) => ParsedBundle,
  chainTo: (
    from: ShaderModule,
    to: ShaderModule,
  ) => ParsedBundle,
  diffBy:
  (
    source: ShaderModule,
    offset: number | string | (string | number | null)[] | null,
    size: 
    | ShaderModule
    | (ParsedModule<any> | ParsedBundle<any> | null)[]
    | null,
  ) => ParsedBundle,
  explode:
  (
    struct: ShaderModule,
    source: ShaderModule,
  ) => ParsedBundle,
  swizzleTo:
  (
    from: string,
    to: string,
    swizzle: string | { basis: string, signs?: string, gain?: number },
  ) => ParsedBundle,
  structType:
  (
    fields: UniformAttribute[],
    name?: string,
  ) => ParsedBundle,
  makeASTParser:
  (
    code: string,
    tree: Tree,
    name?: string,
  ) => {
    getImports:
    () => ({
        at: number,
        symbols: string[],
        } & {
        name: string,
        imports: ImportRef[],
    })[],
    getFunctions:
    () => ({
        at: number,
        symbols: string[],
        } & {
        func: {
          type: {
            name: string,
            qualifiers?: string[],
            members?: ({ type: {
            }, name: string })[],
          },
          name: string,
          parameters: string[],
        },
        identifiers?: string[],
        flags: RefFlags,
    })[],
    getDeclarations:
    () => ({
        at: number,
        symbols: string[],
        } & {
        func?: {
          type: {
            name: string,
            qualifiers?: string[],
            members?: ({ type: {
            }, name: string })[],
          },
          name: string,
          parameters: string[],
        },
        variable?: {
          type: {
            name: string,
            qualifiers?: string[],
            members?: ({ type: {
            }, name: string })[],
          },
          locals: ({ name: string, expr: any })[],
        },
        struct?: {
          type: {
            name: string,
            qualifiers?: string[],
            members?: ({ type: {
            }, name: string })[],
          },
          name: string,
          struct: {
            members:
            ({
                type: {
                  name: string,
                  qualifiers?: string[],
                  members?: ({ })[],
                },
                name: string,
            })[],
          },
        },
        identifiers?: string[],
        flags: RefFlags,
    })[],
    getSymbolTable:
    () => {
      modules?:
      ({
          at: number,
          symbols: string[],
          } & {
          name: string,
          imports: ImportRef[],
      })[],
      declarations?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      externals?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      exports?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      symbols?: string[],
      types?: string[],
      visibles?: string[],
      globals?: string[],
      linkable?: Record<string, true>,
    },
    getShakeTable:
    (
      table?: {
        modules?:
        ({
            at: number,
            symbols: string[],
            } & {
            name: string,
            imports: ImportRef[],
        })[],
        declarations?:
        ({
            at: number,
            symbols: string[],
            } & {
            func?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              parameters: string[],
            },
            variable?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              locals: ({ name: string, expr: any })[],
            },
            struct?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              struct: {
                members:
                ({
                    type: {
                      name: string,
                      qualifiers?: string[],
                      members?: ({ })[],
                    },
                    name: string,
                })[],
              },
            },
            identifiers?: string[],
            flags: RefFlags,
        })[],
        externals?:
        ({
            at: number,
            symbols: string[],
            } & {
            func?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              parameters: string[],
            },
            variable?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              locals: ({ name: string, expr: any })[],
            },
            struct?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              struct: {
                members:
                ({
                    type: {
                      name: string,
                      qualifiers?: string[],
                      members?: ({ })[],
                    },
                    name: string,
                })[],
              },
            },
            identifiers?: string[],
            flags: RefFlags,
        })[],
        exports?:
        ({
            at: number,
            symbols: string[],
            } & {
            func?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              parameters: string[],
            },
            variable?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              locals: ({ name: string, expr: any })[],
            },
            struct?: {
              type: {
                name: string,
                qualifiers?: string[],
                members?: ({ type: {
                }, name: string })[],
              },
              name: string,
              struct: {
                members:
                ({
                    type: {
                      name: string,
                      qualifiers?: string[],
                      members?: ({ })[],
                    },
                    name: string,
                })[],
              },
            },
            identifiers?: string[],
            flags: RefFlags,
        })[],
        symbols?: string[],
        types?: string[],
        visibles?: string[],
        globals?: string[],
        linkable?: Record<string, true>,
      },
    ) => ShakeTable | undefined,
  },
  compressAST:
  (
    code: string,
    tree: Tree,
    symbols?: string[],
    modules?: ({
        at: number,
        symbols: string[],
        } & {
        name: string,
        imports: ImportRef[],
    })[],
  ) => CompressedNode[],
  decompressAST:
  (
    nodes: CompressedNode[],
    symbols?: string[],
  ) => Tree,
  rewriteUsingAST:
  (
    code: string,
    tree: Tree,
    rename: Map<string, string>,
    shake?: number[],
  ) => string,
  makeModuleCache:
  (
    options?: Record<string, any>,
  ) => LRUCache<number,
  { name: string, code: string, hash: number, table: {
      modules?:
      ({
          at: number,
          symbols: string[],
          } & {
          name: string,
          imports: ImportRef[],
      })[],
      declarations?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      externals?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      exports?:
      ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
      })[],
      symbols?: string[],
      types?: string[],
      visibles?: string[],
      globals?: string[],
      linkable?: Record<string, true>,
      }, tree?: Tree, shake?: ShakeTable, virtual?: VirtualTable<{ modules?: ({
          at: number,
          symbols: string[],
          } & {
          name: string,
          imports: ImportRef[],
          })[], declarations?: ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
          })[], externals?: ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
          })[], exports?: ({
          at: number,
          symbols: string[],
          } & {
          func?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            parameters: string[],
          },
          variable?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            locals: ({ name: string, expr: any })[],
          },
          struct?: {
            type: {
              name: string,
              qualifiers?: string[],
              members?: ({ type: {
              }, name: string })[],
            },
            name: string,
            struct: {
              members:
              ({
                  type: {
                    name: string,
                    qualifiers?: string[],
                    members?: ({ })[],
                  },
                  name: string,
              })[],
            },
          },
          identifiers?: string[],
          flags: RefFlags,
  })[], symbols?: string[], types?: string[], visibles?: string[], globals?: string[], linkable?: Record<string, true> }>, entry?: string, label?: string, key?: number }>,
  getBundleEntry: (
    bundle: ShaderModule,
  ) => string | undefined,
  getBundleHash: (bundle: ShaderModule) => number,
  getBundleKey: (bundle: ShaderModule) => number,
  getBundleLabel: (bundle: ShaderModule) => string,
  decompressString:
  (
    symbols: string[],
  ) => (s: (string | number)[]) => string[]
  (s: string | number) => string,
  symbolDictionary: {
    A: "at",
    B: "bindings",
    E: "exports",
    F: "func",
    G: "flags",
    H: "inferred",
    I: "identifiers",
    J: "imported",
    K: "imports",
    L: "linkable",
    M: "members",
    N: "name",
    O: "modules",
    P: "parameters",
    Q: "qual",
    R: "symbol",
    S: "symbols",
    T: "type",
    U: "struct",
    V: "variable",
    W: "visibles",
    X: "externals",
    Y: "types",
    Z: "attr",
  },
  parser: LRParser,
}

Source

packages / shader / src / index.ts

Sections
Source  
menu
format_list_numbered