@motion-core/motion-gpu 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/advanced.d.ts +1 -0
  2. package/dist/advanced.d.ts.map +1 -0
  3. package/dist/advanced.js +12 -6
  4. package/dist/core/advanced.d.ts +1 -0
  5. package/dist/core/advanced.d.ts.map +1 -0
  6. package/dist/core/advanced.js +12 -5
  7. package/dist/core/current-value.d.ts +1 -0
  8. package/dist/core/current-value.d.ts.map +1 -0
  9. package/dist/core/current-value.js +35 -34
  10. package/dist/core/current-value.js.map +1 -0
  11. package/dist/core/error-diagnostics.d.ts +1 -0
  12. package/dist/core/error-diagnostics.d.ts.map +1 -0
  13. package/dist/core/error-diagnostics.js +70 -137
  14. package/dist/core/error-diagnostics.js.map +1 -0
  15. package/dist/core/error-report.d.ts +1 -0
  16. package/dist/core/error-report.d.ts.map +1 -0
  17. package/dist/core/error-report.js +184 -233
  18. package/dist/core/error-report.js.map +1 -0
  19. package/dist/core/frame-registry.d.ts +1 -0
  20. package/dist/core/frame-registry.d.ts.map +1 -0
  21. package/dist/core/frame-registry.js +546 -662
  22. package/dist/core/frame-registry.js.map +1 -0
  23. package/dist/core/index.d.ts +1 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +11 -12
  26. package/dist/core/material-preprocess.d.ts +1 -0
  27. package/dist/core/material-preprocess.d.ts.map +1 -0
  28. package/dist/core/material-preprocess.js +128 -151
  29. package/dist/core/material-preprocess.js.map +1 -0
  30. package/dist/core/material.d.ts +1 -0
  31. package/dist/core/material.d.ts.map +1 -0
  32. package/dist/core/material.js +263 -317
  33. package/dist/core/material.js.map +1 -0
  34. package/dist/core/recompile-policy.d.ts +1 -0
  35. package/dist/core/recompile-policy.d.ts.map +1 -0
  36. package/dist/core/recompile-policy.js +18 -13
  37. package/dist/core/recompile-policy.js.map +1 -0
  38. package/dist/core/render-graph.d.ts +1 -0
  39. package/dist/core/render-graph.d.ts.map +1 -0
  40. package/dist/core/render-graph.js +61 -68
  41. package/dist/core/render-graph.js.map +1 -0
  42. package/dist/core/render-targets.d.ts +2 -0
  43. package/dist/core/render-targets.d.ts.map +1 -0
  44. package/dist/core/render-targets.js +52 -53
  45. package/dist/core/render-targets.js.map +1 -0
  46. package/dist/core/renderer.d.ts +1 -0
  47. package/dist/core/renderer.d.ts.map +1 -0
  48. package/dist/core/renderer.js +942 -1081
  49. package/dist/core/renderer.js.map +1 -0
  50. package/dist/core/runtime-loop.d.ts +2 -0
  51. package/dist/core/runtime-loop.d.ts.map +1 -0
  52. package/dist/core/runtime-loop.js +305 -362
  53. package/dist/core/runtime-loop.js.map +1 -0
  54. package/dist/core/scheduler-helpers.d.ts +1 -0
  55. package/dist/core/scheduler-helpers.d.ts.map +1 -0
  56. package/dist/core/scheduler-helpers.js +52 -51
  57. package/dist/core/scheduler-helpers.js.map +1 -0
  58. package/dist/core/shader.d.ts +1 -0
  59. package/dist/core/shader.d.ts.map +1 -0
  60. package/dist/core/shader.js +92 -117
  61. package/dist/core/shader.js.map +1 -0
  62. package/dist/core/texture-loader.d.ts +1 -0
  63. package/dist/core/texture-loader.d.ts.map +1 -0
  64. package/dist/core/texture-loader.js +205 -273
  65. package/dist/core/texture-loader.js.map +1 -0
  66. package/dist/core/textures.d.ts +2 -0
  67. package/dist/core/textures.d.ts.map +1 -0
  68. package/dist/core/textures.js +106 -116
  69. package/dist/core/textures.js.map +1 -0
  70. package/dist/core/types.d.ts +2 -0
  71. package/dist/core/types.d.ts.map +1 -0
  72. package/dist/core/types.js +0 -4
  73. package/dist/core/uniforms.d.ts +1 -0
  74. package/dist/core/uniforms.d.ts.map +1 -0
  75. package/dist/core/uniforms.js +170 -191
  76. package/dist/core/uniforms.js.map +1 -0
  77. package/dist/index.d.ts +1 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +11 -6
  80. package/dist/passes/BlitPass.d.ts +1 -0
  81. package/dist/passes/BlitPass.d.ts.map +1 -0
  82. package/dist/passes/BlitPass.js +23 -18
  83. package/dist/passes/BlitPass.js.map +1 -0
  84. package/dist/passes/CopyPass.d.ts +2 -0
  85. package/dist/passes/CopyPass.d.ts.map +1 -0
  86. package/dist/passes/CopyPass.js +58 -52
  87. package/dist/passes/CopyPass.js.map +1 -0
  88. package/dist/passes/FullscreenPass.d.ts +2 -0
  89. package/dist/passes/FullscreenPass.d.ts.map +1 -0
  90. package/dist/passes/FullscreenPass.js +127 -130
  91. package/dist/passes/FullscreenPass.js.map +1 -0
  92. package/dist/passes/ShaderPass.d.ts +1 -0
  93. package/dist/passes/ShaderPass.d.ts.map +1 -0
  94. package/dist/passes/ShaderPass.js +40 -37
  95. package/dist/passes/ShaderPass.js.map +1 -0
  96. package/dist/passes/index.d.ts +1 -0
  97. package/dist/passes/index.d.ts.map +1 -0
  98. package/dist/passes/index.js +4 -3
  99. package/dist/react/FragCanvas.d.ts +2 -0
  100. package/dist/react/FragCanvas.d.ts.map +1 -0
  101. package/dist/react/FragCanvas.js +234 -211
  102. package/dist/react/FragCanvas.js.map +1 -0
  103. package/dist/react/MotionGPUErrorOverlay.d.ts +1 -0
  104. package/dist/react/MotionGPUErrorOverlay.d.ts.map +1 -0
  105. package/dist/react/MotionGPUErrorOverlay.js +384 -48
  106. package/dist/react/MotionGPUErrorOverlay.js.map +1 -0
  107. package/dist/react/Portal.d.ts +1 -0
  108. package/dist/react/Portal.d.ts.map +1 -0
  109. package/dist/react/Portal.js +18 -21
  110. package/dist/react/Portal.js.map +1 -0
  111. package/dist/react/advanced.d.ts +1 -0
  112. package/dist/react/advanced.d.ts.map +1 -0
  113. package/dist/react/advanced.js +12 -6
  114. package/dist/react/frame-context.d.ts +1 -0
  115. package/dist/react/frame-context.d.ts.map +1 -0
  116. package/dist/react/frame-context.js +88 -94
  117. package/dist/react/frame-context.js.map +1 -0
  118. package/dist/react/index.d.ts +1 -0
  119. package/dist/react/index.d.ts.map +1 -0
  120. package/dist/react/index.js +10 -9
  121. package/dist/react/motiongpu-context.d.ts +1 -0
  122. package/dist/react/motiongpu-context.d.ts.map +1 -0
  123. package/dist/react/motiongpu-context.js +18 -15
  124. package/dist/react/motiongpu-context.js.map +1 -0
  125. package/dist/react/use-motiongpu-user-context.d.ts +1 -0
  126. package/dist/react/use-motiongpu-user-context.d.ts.map +1 -0
  127. package/dist/react/use-motiongpu-user-context.js +83 -82
  128. package/dist/react/use-motiongpu-user-context.js.map +1 -0
  129. package/dist/react/use-texture.d.ts +1 -0
  130. package/dist/react/use-texture.d.ts.map +1 -0
  131. package/dist/react/use-texture.js +132 -152
  132. package/dist/react/use-texture.js.map +1 -0
  133. package/dist/svelte/FragCanvas.svelte.d.ts +2 -0
  134. package/dist/svelte/FragCanvas.svelte.d.ts.map +1 -0
  135. package/dist/svelte/MotionGPUErrorOverlay.svelte +17 -20
  136. package/dist/svelte/MotionGPUErrorOverlay.svelte.d.ts +1 -0
  137. package/dist/svelte/MotionGPUErrorOverlay.svelte.d.ts.map +1 -0
  138. package/dist/svelte/Portal.svelte.d.ts +1 -0
  139. package/dist/svelte/Portal.svelte.d.ts.map +1 -0
  140. package/dist/svelte/advanced.d.ts +1 -0
  141. package/dist/svelte/advanced.d.ts.map +1 -0
  142. package/dist/svelte/advanced.js +11 -6
  143. package/dist/svelte/frame-context.d.ts +1 -0
  144. package/dist/svelte/frame-context.d.ts.map +1 -0
  145. package/dist/svelte/frame-context.js +27 -27
  146. package/dist/svelte/frame-context.js.map +1 -0
  147. package/dist/svelte/index.d.ts +1 -0
  148. package/dist/svelte/index.d.ts.map +1 -0
  149. package/dist/svelte/index.js +10 -9
  150. package/dist/svelte/motiongpu-context.d.ts +1 -0
  151. package/dist/svelte/motiongpu-context.d.ts.map +1 -0
  152. package/dist/svelte/motiongpu-context.js +24 -21
  153. package/dist/svelte/motiongpu-context.js.map +1 -0
  154. package/dist/svelte/use-motiongpu-user-context.d.ts +1 -0
  155. package/dist/svelte/use-motiongpu-user-context.d.ts.map +1 -0
  156. package/dist/svelte/use-motiongpu-user-context.js +69 -70
  157. package/dist/svelte/use-motiongpu-user-context.js.map +1 -0
  158. package/dist/svelte/use-texture.d.ts +1 -0
  159. package/dist/svelte/use-texture.d.ts.map +1 -0
  160. package/dist/svelte/use-texture.js +125 -147
  161. package/dist/svelte/use-texture.js.map +1 -0
  162. package/package.json +15 -7
  163. package/src/lib/advanced.ts +6 -0
  164. package/src/lib/core/advanced.ts +12 -0
  165. package/src/lib/core/current-value.ts +64 -0
  166. package/src/lib/core/error-diagnostics.ts +236 -0
  167. package/src/lib/core/error-report.ts +406 -0
  168. package/src/lib/core/frame-registry.ts +1189 -0
  169. package/src/lib/core/index.ts +77 -0
  170. package/src/lib/core/material-preprocess.ts +284 -0
  171. package/src/lib/core/material.ts +667 -0
  172. package/src/lib/core/recompile-policy.ts +31 -0
  173. package/src/lib/core/render-graph.ts +143 -0
  174. package/src/lib/core/render-targets.ts +107 -0
  175. package/src/lib/core/renderer.ts +1547 -0
  176. package/src/lib/core/runtime-loop.ts +458 -0
  177. package/src/lib/core/scheduler-helpers.ts +136 -0
  178. package/src/lib/core/shader.ts +258 -0
  179. package/src/lib/core/texture-loader.ts +476 -0
  180. package/src/lib/core/textures.ts +235 -0
  181. package/src/lib/core/types.ts +582 -0
  182. package/src/lib/core/uniforms.ts +282 -0
  183. package/src/lib/index.ts +6 -0
  184. package/src/lib/passes/BlitPass.ts +54 -0
  185. package/src/lib/passes/CopyPass.ts +80 -0
  186. package/src/lib/passes/FullscreenPass.ts +173 -0
  187. package/src/lib/passes/ShaderPass.ts +88 -0
  188. package/src/lib/passes/index.ts +3 -0
  189. package/src/lib/react/MotionGPUErrorOverlay.tsx +392 -0
  190. package/src/lib/react/advanced.ts +36 -0
  191. package/src/lib/react/frame-context.ts +169 -0
  192. package/src/lib/react/index.ts +51 -0
  193. package/src/lib/react/motiongpu-context.ts +88 -0
  194. package/src/lib/react/use-motiongpu-user-context.ts +186 -0
  195. package/src/lib/react/use-texture.ts +233 -0
  196. package/src/lib/svelte/FragCanvas.svelte +249 -0
  197. package/src/lib/svelte/MotionGPUErrorOverlay.svelte +382 -0
  198. package/src/lib/svelte/Portal.svelte +31 -0
  199. package/src/lib/svelte/advanced.ts +32 -0
  200. package/src/lib/svelte/frame-context.ts +87 -0
  201. package/src/lib/svelte/index.ts +51 -0
  202. package/src/lib/svelte/motiongpu-context.ts +97 -0
  203. package/src/lib/svelte/use-motiongpu-user-context.ts +145 -0
  204. package/src/lib/svelte/use-texture.ts +232 -0
  205. package/dist/react/MotionGPUErrorOverlay.tsx +0 -129
  206. /package/{dist → src/lib}/react/FragCanvas.tsx +0 -0
  207. /package/{dist → src/lib}/react/Portal.tsx +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","names":[],"sources":["../../src/lib/core/renderer.ts"],"sourcesContent":["import { buildRenderTargetSignature, resolveRenderTargetDefinitions } from './render-targets.js';\nimport { planRenderGraph, type RenderGraphPlan } from './render-graph.js';\nimport {\n\tbuildShaderSourceWithMap,\n\tformatShaderSourceLocation,\n\ttype ShaderLineMap\n} from './shader.js';\nimport {\n\tattachShaderCompilationDiagnostics,\n\ttype ShaderCompilationRuntimeContext\n} from './error-diagnostics.js';\nimport {\n\tgetTextureMipLevelCount,\n\tnormalizeTextureDefinitions,\n\tresolveTextureUpdateMode,\n\tresolveTextureSize,\n\ttoTextureData\n} from './textures.js';\nimport { packUniformsInto } from './uniforms.js';\nimport type {\n\tRenderPass,\n\tRenderPassInputSlot,\n\tRenderPassOutputSlot,\n\tRenderMode,\n\tRenderTarget,\n\tRenderer,\n\tRendererOptions,\n\tTextureSource,\n\tTextureUpdateMode,\n\tTextureValue\n} from './types.js';\n\n/**\n * Binding index for frame uniforms (`time`, `delta`, `resolution`).\n */\nconst FRAME_BINDING = 0;\n\n/**\n * Binding index for material uniform buffer.\n */\nconst UNIFORM_BINDING = 1;\n\n/**\n * First binding index used for texture sampler/texture pairs.\n */\nconst FIRST_TEXTURE_BINDING = 2;\n\n/**\n * Runtime texture binding state associated with a single texture key.\n */\ninterface RuntimeTextureBinding {\n\tkey: string;\n\tsamplerBinding: number;\n\ttextureBinding: number;\n\tsampler: GPUSampler;\n\tfallbackTexture: GPUTexture;\n\tfallbackView: GPUTextureView;\n\ttexture: GPUTexture | null;\n\tview: GPUTextureView;\n\tsource: TextureSource | null;\n\twidth: number | undefined;\n\theight: number | undefined;\n\tmipLevelCount: number;\n\tformat: GPUTextureFormat;\n\tcolorSpace: 'srgb' | 'linear';\n\tdefaultColorSpace: 'srgb' | 'linear';\n\tflipY: boolean;\n\tdefaultFlipY: boolean;\n\tgenerateMipmaps: boolean;\n\tdefaultGenerateMipmaps: boolean;\n\tpremultipliedAlpha: boolean;\n\tdefaultPremultipliedAlpha: boolean;\n\tupdate: TextureUpdateMode;\n\tdefaultUpdate?: TextureUpdateMode;\n\tlastToken: TextureValue;\n}\n\n/**\n * Runtime render target allocation metadata.\n */\ninterface RuntimeRenderTarget {\n\ttexture: GPUTexture;\n\tview: GPUTextureView;\n\twidth: number;\n\theight: number;\n\tformat: GPUTextureFormat;\n}\n\n/**\n * Cached pass properties used to validate render-graph cache correctness.\n */\ninterface RenderGraphPassSnapshot {\n\tpass: RenderPass;\n\tenabled: RenderPass['enabled'];\n\tneedsSwap: RenderPass['needsSwap'];\n\tinput: RenderPass['input'];\n\toutput: RenderPass['output'];\n\tclear: RenderPass['clear'];\n\tpreserve: RenderPass['preserve'];\n\thasClearColor: boolean;\n\tclearColor0: number;\n\tclearColor1: number;\n\tclearColor2: number;\n\tclearColor3: number;\n}\n\n/**\n * Returns sampler/texture binding slots for a texture index.\n */\nfunction getTextureBindings(index: number): {\n\tsamplerBinding: number;\n\ttextureBinding: number;\n} {\n\tconst samplerBinding = FIRST_TEXTURE_BINDING + index * 2;\n\treturn {\n\t\tsamplerBinding,\n\t\ttextureBinding: samplerBinding + 1\n\t};\n}\n\n/**\n * Resizes canvas backing store to match client size and DPR.\n */\nfunction resizeCanvas(\n\tcanvas: HTMLCanvasElement,\n\tdprInput: number,\n\tcssSize?: { width: number; height: number }\n): { width: number; height: number } {\n\tconst dpr = Number.isFinite(dprInput) && dprInput > 0 ? dprInput : 1;\n\tconst rect = cssSize ? null : canvas.getBoundingClientRect();\n\tconst cssWidth = Math.max(0, cssSize?.width ?? rect?.width ?? 0);\n\tconst cssHeight = Math.max(0, cssSize?.height ?? rect?.height ?? 0);\n\tconst width = Math.max(1, Math.floor((cssWidth || 1) * dpr));\n\tconst height = Math.max(1, Math.floor((cssHeight || 1) * dpr));\n\n\tif (canvas.width !== width || canvas.height !== height) {\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\t}\n\n\treturn { width, height };\n}\n\n/**\n * Throws when a shader module contains WGSL compilation errors.\n */\nasync function assertCompilation(\n\tmodule: GPUShaderModule,\n\toptions?: {\n\t\tlineMap?: ShaderLineMap;\n\t\tfragmentSource?: string;\n\t\tincludeSources?: Record<string, string>;\n\t\tdefineBlockSource?: string;\n\t\tmaterialSource?: {\n\t\t\tcomponent?: string;\n\t\t\tfile?: string;\n\t\t\tline?: number;\n\t\t\tcolumn?: number;\n\t\t\tfunctionName?: string;\n\t\t} | null;\n\t\truntimeContext?: ShaderCompilationRuntimeContext;\n\t}\n): Promise<void> {\n\tconst info = await module.getCompilationInfo();\n\tconst errors = info.messages.filter((message: GPUCompilationMessage) => message.type === 'error');\n\n\tif (errors.length === 0) {\n\t\treturn;\n\t}\n\n\tconst diagnostics = errors.map((message: GPUCompilationMessage) => ({\n\t\tgeneratedLine: message.lineNum,\n\t\tmessage: message.message,\n\t\tlinePos: message.linePos,\n\t\tlineLength: message.length,\n\t\tsourceLocation: options?.lineMap?.[message.lineNum] ?? null\n\t}));\n\n\tconst summary = diagnostics\n\t\t.map((diagnostic) => {\n\t\t\tconst sourceLabel = formatShaderSourceLocation(diagnostic.sourceLocation);\n\t\t\tconst generatedLineLabel =\n\t\t\t\tdiagnostic.generatedLine > 0 ? `generated WGSL line ${diagnostic.generatedLine}` : null;\n\t\t\tconst contextLabel = [sourceLabel, generatedLineLabel].filter((value) => Boolean(value));\n\t\t\tif (contextLabel.length === 0) {\n\t\t\t\treturn diagnostic.message;\n\t\t\t}\n\n\t\t\treturn `[${contextLabel.join(' | ')}] ${diagnostic.message}`;\n\t\t})\n\t\t.join('\\n');\n\tconst error = new Error(`WGSL compilation failed:\\n${summary}`);\n\tthrow attachShaderCompilationDiagnostics(error, {\n\t\tkind: 'shader-compilation',\n\t\tdiagnostics,\n\t\tfragmentSource: options?.fragmentSource ?? '',\n\t\tincludeSources: options?.includeSources ?? {},\n\t\t...(options?.defineBlockSource !== undefined\n\t\t\t? { defineBlockSource: options.defineBlockSource }\n\t\t\t: {}),\n\t\tmaterialSource: options?.materialSource ?? null,\n\t\t...(options?.runtimeContext !== undefined ? { runtimeContext: options.runtimeContext } : {})\n\t});\n}\n\nfunction toSortedUniqueStrings(values: string[]): string[] {\n\treturn Array.from(new Set(values)).sort((a, b) => a.localeCompare(b));\n}\n\nfunction buildPassGraphSnapshot(\n\tpasses: RenderPass[] | undefined\n): NonNullable<ShaderCompilationRuntimeContext['passGraph']> {\n\tconst declaredPasses = passes ?? [];\n\tlet enabledPassCount = 0;\n\tconst inputs: string[] = [];\n\tconst outputs: string[] = [];\n\n\tfor (const pass of declaredPasses) {\n\t\tif (pass.enabled === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tenabledPassCount += 1;\n\t\tconst needsSwap = pass.needsSwap ?? true;\n\t\tconst input = pass.input ?? 'source';\n\t\tconst output = pass.output ?? (needsSwap ? 'target' : 'source');\n\t\tinputs.push(input);\n\t\toutputs.push(output);\n\t}\n\n\treturn {\n\t\tpassCount: declaredPasses.length,\n\t\tenabledPassCount,\n\t\tinputs: toSortedUniqueStrings(inputs),\n\t\toutputs: toSortedUniqueStrings(outputs)\n\t};\n}\n\nfunction buildShaderCompilationRuntimeContext(\n\toptions: RendererOptions\n): ShaderCompilationRuntimeContext {\n\tconst passList = options.getPasses?.() ?? options.passes;\n\tconst renderTargetMap = options.getRenderTargets?.() ?? options.renderTargets;\n\n\treturn {\n\t\t...(options.materialSignature ? { materialSignature: options.materialSignature } : {}),\n\t\tpassGraph: buildPassGraphSnapshot(passList),\n\t\tactiveRenderTargets: Object.keys(renderTargetMap ?? {}).sort((a, b) => a.localeCompare(b))\n\t};\n}\n\n/**\n * Creates a 1x1 white fallback texture used before user textures become available.\n */\nfunction createFallbackTexture(device: GPUDevice, format: GPUTextureFormat): GPUTexture {\n\tconst texture = device.createTexture({\n\t\tsize: { width: 1, height: 1, depthOrArrayLayers: 1 },\n\t\tformat,\n\t\tusage:\n\t\t\tGPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT\n\t});\n\n\tconst pixel = new Uint8Array([255, 255, 255, 255]);\n\tdevice.queue.writeTexture(\n\t\t{ texture },\n\t\tpixel,\n\t\t{ offset: 0, bytesPerRow: 4, rowsPerImage: 1 },\n\t\t{ width: 1, height: 1, depthOrArrayLayers: 1 }\n\t);\n\n\treturn texture;\n}\n\n/**\n * Creates an offscreen canvas used for CPU mipmap generation.\n */\nfunction createMipmapCanvas(width: number, height: number): OffscreenCanvas | HTMLCanvasElement {\n\tif (typeof OffscreenCanvas !== 'undefined') {\n\t\treturn new OffscreenCanvas(width, height);\n\t}\n\n\tconst canvas = document.createElement('canvas');\n\tcanvas.width = width;\n\tcanvas.height = height;\n\treturn canvas;\n}\n\n/**\n * Creates typed descriptor for `copyExternalImageToTexture`.\n */\nfunction createExternalCopySource(\n\tsource: CanvasImageSource,\n\toptions: { flipY?: boolean; premultipliedAlpha?: boolean }\n): GPUCopyExternalImageSourceInfo {\n\tconst descriptor = {\n\t\tsource,\n\t\t...(options.flipY ? { flipY: true } : {}),\n\t\t...(options.premultipliedAlpha ? { premultipliedAlpha: true } : {})\n\t};\n\n\treturn descriptor as GPUCopyExternalImageSourceInfo;\n}\n\n/**\n * Uploads source content to a GPU texture and optionally generates mip chain on CPU.\n */\nfunction uploadTexture(\n\tdevice: GPUDevice,\n\ttexture: GPUTexture,\n\tbinding: Pick<RuntimeTextureBinding, 'flipY' | 'premultipliedAlpha' | 'generateMipmaps'>,\n\tsource: TextureSource,\n\twidth: number,\n\theight: number,\n\tmipLevelCount: number\n): void {\n\tdevice.queue.copyExternalImageToTexture(\n\t\tcreateExternalCopySource(source, {\n\t\t\tflipY: binding.flipY,\n\t\t\tpremultipliedAlpha: binding.premultipliedAlpha\n\t\t}),\n\t\t{ texture, mipLevel: 0 },\n\t\t{ width, height, depthOrArrayLayers: 1 }\n\t);\n\n\tif (!binding.generateMipmaps || mipLevelCount <= 1) {\n\t\treturn;\n\t}\n\n\tlet previousSource: CanvasImageSource = source;\n\tlet previousWidth = width;\n\tlet previousHeight = height;\n\n\tfor (let level = 1; level < mipLevelCount; level += 1) {\n\t\tconst nextWidth = Math.max(1, Math.floor(previousWidth / 2));\n\t\tconst nextHeight = Math.max(1, Math.floor(previousHeight / 2));\n\t\tconst canvas = createMipmapCanvas(nextWidth, nextHeight);\n\t\tconst context = canvas.getContext('2d');\n\t\tif (!context) {\n\t\t\tthrow new Error('Unable to create 2D context for mipmap generation');\n\t\t}\n\n\t\tcontext.drawImage(\n\t\t\tpreviousSource,\n\t\t\t0,\n\t\t\t0,\n\t\t\tpreviousWidth,\n\t\t\tpreviousHeight,\n\t\t\t0,\n\t\t\t0,\n\t\t\tnextWidth,\n\t\t\tnextHeight\n\t\t);\n\n\t\tdevice.queue.copyExternalImageToTexture(\n\t\t\tcreateExternalCopySource(canvas, {\n\t\t\t\tpremultipliedAlpha: binding.premultipliedAlpha\n\t\t\t}),\n\t\t\t{ texture, mipLevel: level },\n\t\t\t{ width: nextWidth, height: nextHeight, depthOrArrayLayers: 1 }\n\t\t);\n\n\t\tpreviousSource = canvas;\n\t\tpreviousWidth = nextWidth;\n\t\tpreviousHeight = nextHeight;\n\t}\n}\n\n/**\n * Creates bind group layout entries for frame/uniform buffers plus texture bindings.\n */\nfunction createBindGroupLayoutEntries(\n\ttextureBindings: RuntimeTextureBinding[]\n): GPUBindGroupLayoutEntry[] {\n\tconst entries: GPUBindGroupLayoutEntry[] = [\n\t\t{\n\t\t\tbinding: FRAME_BINDING,\n\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\tbuffer: { type: 'uniform', minBindingSize: 16 }\n\t\t},\n\t\t{\n\t\t\tbinding: UNIFORM_BINDING,\n\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\tbuffer: { type: 'uniform' }\n\t\t}\n\t];\n\n\tfor (const binding of textureBindings) {\n\t\tentries.push({\n\t\t\tbinding: binding.samplerBinding,\n\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\tsampler: { type: 'filtering' }\n\t\t});\n\n\t\tentries.push({\n\t\t\tbinding: binding.textureBinding,\n\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\ttexture: {\n\t\t\t\tsampleType: 'float',\n\t\t\t\tviewDimension: '2d',\n\t\t\t\tmultisampled: false\n\t\t\t}\n\t\t});\n\t}\n\n\treturn entries;\n}\n\n/**\n * Maximum gap (in floats) between two dirty ranges that triggers merge.\n *\n * Set to 4 (16 bytes) which covers one vec4f alignment slot.\n */\nconst DIRTY_RANGE_MERGE_GAP = 4;\n\n/**\n * Computes dirty float ranges between two uniform snapshots.\n *\n * Adjacent dirty ranges separated by a gap smaller than or equal to\n * {@link DIRTY_RANGE_MERGE_GAP} are merged to reduce `writeBuffer` calls.\n */\nexport function findDirtyFloatRanges(\n\tprevious: Float32Array,\n\tnext: Float32Array,\n\tmergeGapThreshold = DIRTY_RANGE_MERGE_GAP\n): Array<{ start: number; count: number }> {\n\tconst ranges: Array<{ start: number; count: number }> = [];\n\tlet start = -1;\n\n\tfor (let index = 0; index < next.length; index += 1) {\n\t\tif (previous[index] !== next[index]) {\n\t\t\tif (start === -1) {\n\t\t\t\tstart = index;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (start !== -1) {\n\t\t\tranges.push({ start, count: index - start });\n\t\t\tstart = -1;\n\t\t}\n\t}\n\n\tif (start !== -1) {\n\t\tranges.push({ start, count: next.length - start });\n\t}\n\n\tif (ranges.length <= 1) {\n\t\treturn ranges;\n\t}\n\n\tconst merged: Array<{ start: number; count: number }> = [ranges[0]!];\n\tfor (let index = 1; index < ranges.length; index += 1) {\n\t\tconst prev = merged[merged.length - 1]!;\n\t\tconst curr = ranges[index]!;\n\t\tconst gap = curr.start - (prev.start + prev.count);\n\n\t\tif (gap <= mergeGapThreshold) {\n\t\t\tprev.count = curr.start + curr.count - prev.start;\n\t\t} else {\n\t\t\tmerged.push(curr);\n\t\t}\n\t}\n\n\treturn merged;\n}\n\n/**\n * Determines whether shader output should perform linear-to-sRGB conversion.\n */\nfunction shouldConvertLinearToSrgb(\n\toutputColorSpace: 'srgb' | 'linear',\n\tcanvasFormat: GPUTextureFormat\n): boolean {\n\tif (outputColorSpace !== 'srgb') {\n\t\treturn false;\n\t}\n\n\treturn !canvasFormat.endsWith('-srgb');\n}\n\n/**\n * WGSL shader used to blit an offscreen texture to the canvas.\n */\nfunction createFullscreenBlitShader(): string {\n\treturn `\nstruct MotionGPUVertexOut {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n};\n\n@group(0) @binding(0) var motiongpuBlitSampler: sampler;\n@group(0) @binding(1) var motiongpuBlitTexture: texture_2d<f32>;\n\n@vertex\nfn motiongpuBlitVertex(@builtin(vertex_index) index: u32) -> MotionGPUVertexOut {\n\tvar positions = array<vec2f, 3>(\n\t\tvec2f(-1.0, -3.0),\n\t\tvec2f(-1.0, 1.0),\n\t\tvec2f(3.0, 1.0)\n\t);\n\n\tlet position = positions[index];\n\tvar out: MotionGPUVertexOut;\n\tout.position = vec4f(position, 0.0, 1.0);\n\tout.uv = (position + vec2f(1.0, 1.0)) * 0.5;\n\treturn out;\n}\n\n@fragment\nfn motiongpuBlitFragment(in: MotionGPUVertexOut) -> @location(0) vec4f {\n\treturn textureSample(motiongpuBlitTexture, motiongpuBlitSampler, in.uv);\n}\n`;\n}\n\n/**\n * Allocates a render target texture with usage flags suitable for passes/blits.\n */\nfunction createRenderTexture(\n\tdevice: GPUDevice,\n\twidth: number,\n\theight: number,\n\tformat: GPUTextureFormat\n): RuntimeRenderTarget {\n\tconst texture = device.createTexture({\n\t\tsize: { width, height, depthOrArrayLayers: 1 },\n\t\tformat,\n\t\tusage:\n\t\t\tGPUTextureUsage.TEXTURE_BINDING |\n\t\t\tGPUTextureUsage.RENDER_ATTACHMENT |\n\t\t\tGPUTextureUsage.COPY_DST |\n\t\t\tGPUTextureUsage.COPY_SRC\n\t});\n\n\treturn {\n\t\ttexture,\n\t\tview: texture.createView(),\n\t\twidth,\n\t\theight,\n\t\tformat\n\t};\n}\n\n/**\n * Destroys a render target texture if present.\n */\nfunction destroyRenderTexture(target: RuntimeRenderTarget | null): void {\n\ttarget?.texture.destroy();\n}\n\n/**\n * Creates the WebGPU renderer used by `FragCanvas`.\n *\n * @param options - Renderer creation options resolved from material/context state.\n * @returns Renderer instance with `render` and `destroy`.\n * @throws {Error} On WebGPU unavailability, shader compilation issues, or runtime setup failures.\n */\nexport async function createRenderer(options: RendererOptions): Promise<Renderer> {\n\tif (!navigator.gpu) {\n\t\tthrow new Error('WebGPU is not available in this browser');\n\t}\n\n\tconst context = options.canvas.getContext('webgpu') as GPUCanvasContext | null;\n\tif (!context) {\n\t\tthrow new Error('Canvas does not support webgpu context');\n\t}\n\n\tconst format = navigator.gpu.getPreferredCanvasFormat();\n\tconst adapter = await navigator.gpu.requestAdapter(options.adapterOptions);\n\tif (!adapter) {\n\t\tthrow new Error('Unable to acquire WebGPU adapter');\n\t}\n\n\tconst device = await adapter.requestDevice(options.deviceDescriptor);\n\tlet isDestroyed = false;\n\tlet deviceLostMessage: string | null = null;\n\tlet uncapturedErrorMessage: string | null = null;\n\tconst initializationCleanups: Array<() => void> = [];\n\tlet acceptInitializationCleanups = true;\n\n\tconst registerInitializationCleanup = (cleanup: () => void): void => {\n\t\tif (!acceptInitializationCleanups) {\n\t\t\treturn;\n\t\t}\n\t\toptions.__onInitializationCleanupRegistered?.();\n\t\tinitializationCleanups.push(cleanup);\n\t};\n\n\tconst runInitializationCleanups = (): void => {\n\t\tfor (let index = initializationCleanups.length - 1; index >= 0; index -= 1) {\n\t\t\ttry {\n\t\t\t\tinitializationCleanups[index]?.();\n\t\t\t} catch {\n\t\t\t\t// Best-effort cleanup on failed renderer initialization.\n\t\t\t}\n\t\t}\n\t\tinitializationCleanups.length = 0;\n\t};\n\n\tvoid device.lost.then((info) => {\n\t\tif (isDestroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst reason = info.reason ? ` (${info.reason})` : '';\n\t\tconst details = info.message?.trim();\n\t\tdeviceLostMessage = details\n\t\t\t? `WebGPU device lost: ${details}${reason}`\n\t\t\t: `WebGPU device lost${reason}`;\n\t});\n\n\tconst handleUncapturedError = (event: GPUUncapturedErrorEvent): void => {\n\t\tif (isDestroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst message =\n\t\t\tevent.error instanceof Error\n\t\t\t\t? event.error.message\n\t\t\t\t: String((event.error as { message?: string })?.message ?? event.error);\n\t\tuncapturedErrorMessage = `WebGPU uncaptured error: ${message}`;\n\t};\n\n\tdevice.addEventListener('uncapturederror', handleUncapturedError);\n\ttry {\n\t\tconst runtimeContext = buildShaderCompilationRuntimeContext(options);\n\t\tconst convertLinearToSrgb = shouldConvertLinearToSrgb(options.outputColorSpace, format);\n\t\tconst builtShader = buildShaderSourceWithMap(\n\t\t\toptions.fragmentWgsl,\n\t\t\toptions.uniformLayout,\n\t\t\toptions.textureKeys,\n\t\t\t{\n\t\t\t\tconvertLinearToSrgb,\n\t\t\t\tfragmentLineMap: options.fragmentLineMap\n\t\t\t}\n\t\t);\n\t\tconst shaderModule = device.createShaderModule({ code: builtShader.code });\n\t\tawait assertCompilation(shaderModule, {\n\t\t\tlineMap: builtShader.lineMap,\n\t\t\tfragmentSource: options.fragmentSource,\n\t\t\tincludeSources: options.includeSources,\n\t\t\t...(options.defineBlockSource !== undefined\n\t\t\t\t? { defineBlockSource: options.defineBlockSource }\n\t\t\t\t: {}),\n\t\t\tmaterialSource: options.materialSource ?? null,\n\t\t\truntimeContext\n\t\t});\n\n\t\tconst normalizedTextureDefinitions = normalizeTextureDefinitions(\n\t\t\toptions.textureDefinitions,\n\t\t\toptions.textureKeys\n\t\t);\n\t\tconst textureBindings = options.textureKeys.map((key, index): RuntimeTextureBinding => {\n\t\t\tconst config = normalizedTextureDefinitions[key];\n\t\t\tif (!config) {\n\t\t\t\tthrow new Error(`Missing texture definition for \"${key}\"`);\n\t\t\t}\n\n\t\t\tconst { samplerBinding, textureBinding } = getTextureBindings(index);\n\t\t\tconst sampler = device.createSampler({\n\t\t\t\tmagFilter: config.filter,\n\t\t\t\tminFilter: config.filter,\n\t\t\t\tmipmapFilter: config.generateMipmaps ? config.filter : 'nearest',\n\t\t\t\taddressModeU: config.addressModeU,\n\t\t\t\taddressModeV: config.addressModeV,\n\t\t\t\tmaxAnisotropy: config.filter === 'linear' ? config.anisotropy : 1\n\t\t\t});\n\t\t\tconst fallbackTexture = createFallbackTexture(device, config.format);\n\t\t\tregisterInitializationCleanup(() => {\n\t\t\t\tfallbackTexture.destroy();\n\t\t\t});\n\t\t\tconst fallbackView = fallbackTexture.createView();\n\n\t\t\tconst runtimeBinding: RuntimeTextureBinding = {\n\t\t\t\tkey,\n\t\t\t\tsamplerBinding,\n\t\t\t\ttextureBinding,\n\t\t\t\tsampler,\n\t\t\t\tfallbackTexture,\n\t\t\t\tfallbackView,\n\t\t\t\ttexture: null,\n\t\t\t\tview: fallbackView,\n\t\t\t\tsource: null,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t\tmipLevelCount: 1,\n\t\t\t\tformat: config.format,\n\t\t\t\tcolorSpace: config.colorSpace,\n\t\t\t\tdefaultColorSpace: config.colorSpace,\n\t\t\t\tflipY: config.flipY,\n\t\t\t\tdefaultFlipY: config.flipY,\n\t\t\t\tgenerateMipmaps: config.generateMipmaps,\n\t\t\t\tdefaultGenerateMipmaps: config.generateMipmaps,\n\t\t\t\tpremultipliedAlpha: config.premultipliedAlpha,\n\t\t\t\tdefaultPremultipliedAlpha: config.premultipliedAlpha,\n\t\t\t\tupdate: config.update ?? 'once',\n\t\t\t\tlastToken: null\n\t\t\t};\n\n\t\t\tif (config.update !== undefined) {\n\t\t\t\truntimeBinding.defaultUpdate = config.update;\n\t\t\t}\n\n\t\t\treturn runtimeBinding;\n\t\t});\n\n\t\tconst bindGroupLayout = device.createBindGroupLayout({\n\t\t\tentries: createBindGroupLayoutEntries(textureBindings)\n\t\t});\n\t\tconst pipelineLayout = device.createPipelineLayout({\n\t\t\tbindGroupLayouts: [bindGroupLayout]\n\t\t});\n\n\t\tconst pipeline = device.createRenderPipeline({\n\t\t\tlayout: pipelineLayout,\n\t\t\tvertex: {\n\t\t\t\tmodule: shaderModule,\n\t\t\t\tentryPoint: 'motiongpuVertex'\n\t\t\t},\n\t\t\tfragment: {\n\t\t\t\tmodule: shaderModule,\n\t\t\t\tentryPoint: 'motiongpuFragment',\n\t\t\t\ttargets: [{ format }]\n\t\t\t},\n\t\t\tprimitive: {\n\t\t\t\ttopology: 'triangle-list'\n\t\t\t}\n\t\t});\n\n\t\tconst blitShaderModule = device.createShaderModule({\n\t\t\tcode: createFullscreenBlitShader()\n\t\t});\n\t\tawait assertCompilation(blitShaderModule);\n\n\t\tconst blitBindGroupLayout = device.createBindGroupLayout({\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tbinding: 0,\n\t\t\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\t\t\tsampler: { type: 'filtering' }\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tbinding: 1,\n\t\t\t\t\tvisibility: GPUShaderStage.FRAGMENT,\n\t\t\t\t\ttexture: {\n\t\t\t\t\t\tsampleType: 'float',\n\t\t\t\t\t\tviewDimension: '2d',\n\t\t\t\t\t\tmultisampled: false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t});\n\t\tconst blitPipelineLayout = device.createPipelineLayout({\n\t\t\tbindGroupLayouts: [blitBindGroupLayout]\n\t\t});\n\t\tconst blitPipeline = device.createRenderPipeline({\n\t\t\tlayout: blitPipelineLayout,\n\t\t\tvertex: { module: blitShaderModule, entryPoint: 'motiongpuBlitVertex' },\n\t\t\tfragment: {\n\t\t\t\tmodule: blitShaderModule,\n\t\t\t\tentryPoint: 'motiongpuBlitFragment',\n\t\t\t\ttargets: [{ format }]\n\t\t\t},\n\t\t\tprimitive: {\n\t\t\t\ttopology: 'triangle-list'\n\t\t\t}\n\t\t});\n\t\tconst blitSampler = device.createSampler({\n\t\t\tmagFilter: 'linear',\n\t\t\tminFilter: 'linear',\n\t\t\taddressModeU: 'clamp-to-edge',\n\t\t\taddressModeV: 'clamp-to-edge'\n\t\t});\n\t\tlet blitBindGroupByView = new WeakMap<GPUTextureView, GPUBindGroup>();\n\n\t\tconst frameBuffer = device.createBuffer({\n\t\t\tsize: 16,\n\t\t\tusage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST\n\t\t});\n\t\tregisterInitializationCleanup(() => {\n\t\t\tframeBuffer.destroy();\n\t\t});\n\n\t\tconst uniformBuffer = device.createBuffer({\n\t\t\tsize: options.uniformLayout.byteLength,\n\t\t\tusage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST\n\t\t});\n\t\tregisterInitializationCleanup(() => {\n\t\t\tuniformBuffer.destroy();\n\t\t});\n\t\tconst frameScratch = new Float32Array(4);\n\t\tconst uniformScratch = new Float32Array(options.uniformLayout.byteLength / 4);\n\t\tconst uniformPrevious = new Float32Array(options.uniformLayout.byteLength / 4);\n\t\tlet hasUniformSnapshot = false;\n\n\t\t/**\n\t\t * Rebuilds bind group using current texture views.\n\t\t */\n\t\tconst createBindGroup = (): GPUBindGroup => {\n\t\t\tconst entries: GPUBindGroupEntry[] = [\n\t\t\t\t{ binding: FRAME_BINDING, resource: { buffer: frameBuffer } },\n\t\t\t\t{ binding: UNIFORM_BINDING, resource: { buffer: uniformBuffer } }\n\t\t\t];\n\n\t\t\tfor (const binding of textureBindings) {\n\t\t\t\tentries.push({\n\t\t\t\t\tbinding: binding.samplerBinding,\n\t\t\t\t\tresource: binding.sampler\n\t\t\t\t});\n\t\t\t\tentries.push({\n\t\t\t\t\tbinding: binding.textureBinding,\n\t\t\t\t\tresource: binding.view\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn device.createBindGroup({\n\t\t\t\tlayout: bindGroupLayout,\n\t\t\t\tentries\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Synchronizes one runtime texture binding with incoming texture value.\n\t\t *\n\t\t * @returns `true` when bind group must be rebuilt.\n\t\t */\n\t\tconst updateTextureBinding = (\n\t\t\tbinding: RuntimeTextureBinding,\n\t\t\tvalue: TextureValue,\n\t\t\trenderMode: RenderMode\n\t\t): boolean => {\n\t\t\tconst nextData = toTextureData(value);\n\n\t\t\tif (!nextData) {\n\t\t\t\tif (binding.source === null && binding.texture === null) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tbinding.texture?.destroy();\n\t\t\t\tbinding.texture = null;\n\t\t\t\tbinding.view = binding.fallbackView;\n\t\t\t\tbinding.source = null;\n\t\t\t\tbinding.width = undefined;\n\t\t\t\tbinding.height = undefined;\n\t\t\t\tbinding.lastToken = null;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst source = nextData.source;\n\t\t\tconst colorSpace = nextData.colorSpace ?? binding.defaultColorSpace;\n\t\t\tconst format = colorSpace === 'linear' ? 'rgba8unorm' : 'rgba8unorm-srgb';\n\t\t\tconst flipY = nextData.flipY ?? binding.defaultFlipY;\n\t\t\tconst premultipliedAlpha = nextData.premultipliedAlpha ?? binding.defaultPremultipliedAlpha;\n\t\t\tconst generateMipmaps = nextData.generateMipmaps ?? binding.defaultGenerateMipmaps;\n\t\t\tconst update = resolveTextureUpdateMode({\n\t\t\t\tsource,\n\t\t\t\t...(nextData.update !== undefined ? { override: nextData.update } : {}),\n\t\t\t\t...(binding.defaultUpdate !== undefined ? { defaultMode: binding.defaultUpdate } : {})\n\t\t\t});\n\t\t\tconst { width, height } = resolveTextureSize(nextData);\n\t\t\tconst mipLevelCount = generateMipmaps ? getTextureMipLevelCount(width, height) : 1;\n\t\t\tconst sourceChanged = binding.source !== source;\n\t\t\tconst tokenChanged = binding.lastToken !== value;\n\t\t\tconst requiresReallocation =\n\t\t\t\tbinding.texture === null ||\n\t\t\t\tbinding.width !== width ||\n\t\t\t\tbinding.height !== height ||\n\t\t\t\tbinding.mipLevelCount !== mipLevelCount ||\n\t\t\t\tbinding.format !== format;\n\n\t\t\tif (!requiresReallocation) {\n\t\t\t\tconst shouldUpload =\n\t\t\t\t\tsourceChanged ||\n\t\t\t\t\tupdate === 'perFrame' ||\n\t\t\t\t\t(update === 'onInvalidate' && (renderMode !== 'always' || tokenChanged));\n\n\t\t\t\tif (shouldUpload && binding.texture) {\n\t\t\t\t\tbinding.flipY = flipY;\n\t\t\t\t\tbinding.generateMipmaps = generateMipmaps;\n\t\t\t\t\tbinding.premultipliedAlpha = premultipliedAlpha;\n\t\t\t\t\tbinding.colorSpace = colorSpace;\n\t\t\t\t\tuploadTexture(device, binding.texture, binding, source, width, height, mipLevelCount);\n\t\t\t\t}\n\n\t\t\t\tbinding.source = source;\n\t\t\t\tbinding.width = width;\n\t\t\t\tbinding.height = height;\n\t\t\t\tbinding.mipLevelCount = mipLevelCount;\n\t\t\t\tbinding.update = update;\n\t\t\t\tbinding.lastToken = value;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst texture = device.createTexture({\n\t\t\t\tsize: { width, height, depthOrArrayLayers: 1 },\n\t\t\t\tformat,\n\t\t\t\tmipLevelCount,\n\t\t\t\tusage:\n\t\t\t\t\tGPUTextureUsage.TEXTURE_BINDING |\n\t\t\t\t\tGPUTextureUsage.COPY_DST |\n\t\t\t\t\tGPUTextureUsage.RENDER_ATTACHMENT\n\t\t\t});\n\t\t\tregisterInitializationCleanup(() => {\n\t\t\t\ttexture.destroy();\n\t\t\t});\n\n\t\t\tbinding.flipY = flipY;\n\t\t\tbinding.generateMipmaps = generateMipmaps;\n\t\t\tbinding.premultipliedAlpha = premultipliedAlpha;\n\t\t\tbinding.colorSpace = colorSpace;\n\t\t\tbinding.format = format;\n\t\t\tuploadTexture(device, texture, binding, source, width, height, mipLevelCount);\n\n\t\t\tbinding.texture?.destroy();\n\t\t\tbinding.texture = texture;\n\t\t\tbinding.view = texture.createView();\n\t\t\tbinding.source = source;\n\t\t\tbinding.width = width;\n\t\t\tbinding.height = height;\n\t\t\tbinding.mipLevelCount = mipLevelCount;\n\t\t\tbinding.update = update;\n\t\t\tbinding.lastToken = value;\n\t\t\treturn true;\n\t\t};\n\n\t\tfor (const binding of textureBindings) {\n\t\t\tconst defaultSource = normalizedTextureDefinitions[binding.key]?.source ?? null;\n\t\t\tupdateTextureBinding(binding, defaultSource, 'always');\n\t\t}\n\n\t\tlet bindGroup = createBindGroup();\n\t\tlet sourceSlotTarget: RuntimeRenderTarget | null = null;\n\t\tlet targetSlotTarget: RuntimeRenderTarget | null = null;\n\t\tlet renderTargetSignature = '';\n\t\tlet renderTargetSnapshot: Readonly<Record<string, RenderTarget>> = {};\n\t\tlet renderTargetKeys: string[] = [];\n\t\tlet cachedGraphPlan: RenderGraphPlan | null = null;\n\t\tlet cachedGraphRenderTargetSignature = '';\n\t\tconst cachedGraphClearColor: [number, number, number, number] = [NaN, NaN, NaN, NaN];\n\t\tconst cachedGraphPasses: RenderGraphPassSnapshot[] = [];\n\t\tlet contextConfigured = false;\n\t\tlet configuredWidth = 0;\n\t\tlet configuredHeight = 0;\n\t\tconst runtimeRenderTargets = new Map<string, RuntimeRenderTarget>();\n\t\tconst activePasses: RenderPass[] = [];\n\t\tconst lifecyclePreviousSet = new Set<RenderPass>();\n\t\tconst lifecycleNextSet = new Set<RenderPass>();\n\t\tconst lifecycleUniquePasses: RenderPass[] = [];\n\t\tlet lifecyclePassesRef: RenderPass[] | null = null;\n\t\tlet passWidth = 0;\n\t\tlet passHeight = 0;\n\n\t\t/**\n\t\t * Resolves active render pass list for current frame.\n\t\t */\n\t\tconst resolvePasses = (): RenderPass[] => {\n\t\t\treturn options.getPasses?.() ?? options.passes ?? [];\n\t\t};\n\n\t\t/**\n\t\t * Resolves active render target declarations for current frame.\n\t\t */\n\t\tconst resolveRenderTargets = () => {\n\t\t\treturn options.getRenderTargets?.() ?? options.renderTargets;\n\t\t};\n\n\t\t/**\n\t\t * Checks whether cached render-graph plan can be reused for this frame.\n\t\t */\n\t\tconst isGraphPlanCacheValid = (\n\t\t\tpasses: RenderPass[],\n\t\t\tclearColor: [number, number, number, number]\n\t\t): boolean => {\n\t\t\tif (!cachedGraphPlan) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (cachedGraphRenderTargetSignature !== renderTargetSignature) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcachedGraphClearColor[0] !== clearColor[0] ||\n\t\t\t\tcachedGraphClearColor[1] !== clearColor[1] ||\n\t\t\t\tcachedGraphClearColor[2] !== clearColor[2] ||\n\t\t\t\tcachedGraphClearColor[3] !== clearColor[3]\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (cachedGraphPasses.length !== passes.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tfor (let index = 0; index < passes.length; index += 1) {\n\t\t\t\tconst pass = passes[index];\n\t\t\t\tconst snapshot = cachedGraphPasses[index];\n\t\t\t\tif (!pass || !snapshot || snapshot.pass !== pass) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tsnapshot.enabled !== pass.enabled ||\n\t\t\t\t\tsnapshot.needsSwap !== pass.needsSwap ||\n\t\t\t\t\tsnapshot.input !== pass.input ||\n\t\t\t\t\tsnapshot.output !== pass.output ||\n\t\t\t\t\tsnapshot.clear !== pass.clear ||\n\t\t\t\t\tsnapshot.preserve !== pass.preserve\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst passClearColor = pass.clearColor;\n\t\t\t\tconst hasPassClearColor = passClearColor !== undefined;\n\t\t\t\tif (snapshot.hasClearColor !== hasPassClearColor) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (passClearColor) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsnapshot.clearColor0 !== passClearColor[0] ||\n\t\t\t\t\t\tsnapshot.clearColor1 !== passClearColor[1] ||\n\t\t\t\t\t\tsnapshot.clearColor2 !== passClearColor[2] ||\n\t\t\t\t\t\tsnapshot.clearColor3 !== passClearColor[3]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t};\n\n\t\t/**\n\t\t * Updates render-graph cache with current pass set.\n\t\t */\n\t\tconst updateGraphPlanCache = (\n\t\t\tpasses: RenderPass[],\n\t\t\tclearColor: [number, number, number, number],\n\t\t\tgraphPlan: RenderGraphPlan\n\t\t): void => {\n\t\t\tcachedGraphPlan = graphPlan;\n\t\t\tcachedGraphRenderTargetSignature = renderTargetSignature;\n\t\t\tcachedGraphClearColor[0] = clearColor[0];\n\t\t\tcachedGraphClearColor[1] = clearColor[1];\n\t\t\tcachedGraphClearColor[2] = clearColor[2];\n\t\t\tcachedGraphClearColor[3] = clearColor[3];\n\t\t\tcachedGraphPasses.length = passes.length;\n\n\t\t\tlet index = 0;\n\t\t\tfor (const pass of passes) {\n\t\t\t\tconst passClearColor = pass.clearColor;\n\t\t\t\tconst hasPassClearColor = passClearColor !== undefined;\n\t\t\t\tconst snapshot = cachedGraphPasses[index];\n\t\t\t\tif (!snapshot) {\n\t\t\t\t\tcachedGraphPasses[index] = {\n\t\t\t\t\t\tpass,\n\t\t\t\t\t\tenabled: pass.enabled,\n\t\t\t\t\t\tneedsSwap: pass.needsSwap,\n\t\t\t\t\t\tinput: pass.input,\n\t\t\t\t\t\toutput: pass.output,\n\t\t\t\t\t\tclear: pass.clear,\n\t\t\t\t\t\tpreserve: pass.preserve,\n\t\t\t\t\t\thasClearColor: hasPassClearColor,\n\t\t\t\t\t\tclearColor0: passClearColor?.[0] ?? 0,\n\t\t\t\t\t\tclearColor1: passClearColor?.[1] ?? 0,\n\t\t\t\t\t\tclearColor2: passClearColor?.[2] ?? 0,\n\t\t\t\t\t\tclearColor3: passClearColor?.[3] ?? 0\n\t\t\t\t\t};\n\t\t\t\t\tindex += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tsnapshot.pass = pass;\n\t\t\t\tsnapshot.enabled = pass.enabled;\n\t\t\t\tsnapshot.needsSwap = pass.needsSwap;\n\t\t\t\tsnapshot.input = pass.input;\n\t\t\t\tsnapshot.output = pass.output;\n\t\t\t\tsnapshot.clear = pass.clear;\n\t\t\t\tsnapshot.preserve = pass.preserve;\n\t\t\t\tsnapshot.hasClearColor = hasPassClearColor;\n\t\t\t\tsnapshot.clearColor0 = passClearColor?.[0] ?? 0;\n\t\t\t\tsnapshot.clearColor1 = passClearColor?.[1] ?? 0;\n\t\t\t\tsnapshot.clearColor2 = passClearColor?.[2] ?? 0;\n\t\t\t\tsnapshot.clearColor3 = passClearColor?.[3] ?? 0;\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Synchronizes pass lifecycle callbacks and resize notifications.\n\t\t */\n\t\tconst syncPassLifecycle = (passes: RenderPass[], width: number, height: number): void => {\n\t\t\tconst resized = passWidth !== width || passHeight !== height;\n\t\t\tif (!resized && lifecyclePassesRef === passes && passes.length === activePasses.length) {\n\t\t\t\tlet isSameOrder = true;\n\t\t\t\tfor (let index = 0; index < passes.length; index += 1) {\n\t\t\t\t\tif (activePasses[index] !== passes[index]) {\n\t\t\t\t\t\tisSameOrder = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isSameOrder) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlifecycleNextSet.clear();\n\t\t\tlifecycleUniquePasses.length = 0;\n\t\t\tfor (const pass of passes) {\n\t\t\t\tif (lifecycleNextSet.has(pass)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlifecycleNextSet.add(pass);\n\t\t\t\tlifecycleUniquePasses.push(pass);\n\t\t\t}\n\t\t\tlifecyclePreviousSet.clear();\n\t\t\tfor (const pass of activePasses) {\n\t\t\t\tlifecyclePreviousSet.add(pass);\n\t\t\t}\n\n\t\t\tfor (const pass of activePasses) {\n\t\t\t\tif (!lifecycleNextSet.has(pass)) {\n\t\t\t\t\tpass.dispose?.();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const pass of lifecycleUniquePasses) {\n\t\t\t\tif (resized || !lifecyclePreviousSet.has(pass)) {\n\t\t\t\t\tpass.setSize?.(width, height);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tactivePasses.length = 0;\n\t\t\tfor (const pass of lifecycleUniquePasses) {\n\t\t\t\tactivePasses.push(pass);\n\t\t\t}\n\t\t\tlifecyclePassesRef = passes;\n\t\t\tpassWidth = width;\n\t\t\tpassHeight = height;\n\t\t};\n\n\t\t/**\n\t\t * Ensures internal ping-pong slot texture matches current canvas size/format.\n\t\t */\n\t\tconst ensureSlotTarget = (\n\t\t\tslot: RenderPassInputSlot,\n\t\t\twidth: number,\n\t\t\theight: number\n\t\t): RuntimeRenderTarget => {\n\t\t\tconst current = slot === 'source' ? sourceSlotTarget : targetSlotTarget;\n\t\t\tif (\n\t\t\t\tcurrent &&\n\t\t\t\tcurrent.width === width &&\n\t\t\t\tcurrent.height === height &&\n\t\t\t\tcurrent.format === format\n\t\t\t) {\n\t\t\t\treturn current;\n\t\t\t}\n\n\t\t\tdestroyRenderTexture(current);\n\t\t\tconst next = createRenderTexture(device, width, height, format);\n\t\t\tif (slot === 'source') {\n\t\t\t\tsourceSlotTarget = next;\n\t\t\t} else {\n\t\t\t\ttargetSlotTarget = next;\n\t\t\t}\n\n\t\t\treturn next;\n\t\t};\n\n\t\t/**\n\t\t * Creates/updates runtime render targets and returns immutable pass snapshot.\n\t\t */\n\t\tconst syncRenderTargets = (\n\t\t\tcanvasWidth: number,\n\t\t\tcanvasHeight: number\n\t\t): Readonly<Record<string, RenderTarget>> => {\n\t\t\tconst resolvedDefinitions = resolveRenderTargetDefinitions(\n\t\t\t\tresolveRenderTargets(),\n\t\t\t\tcanvasWidth,\n\t\t\t\tcanvasHeight,\n\t\t\t\tformat\n\t\t\t);\n\t\t\tconst nextSignature = buildRenderTargetSignature(resolvedDefinitions);\n\n\t\t\tif (nextSignature !== renderTargetSignature) {\n\t\t\t\tconst activeKeys = new Set(resolvedDefinitions.map((definition) => definition.key));\n\n\t\t\t\tfor (const [key, target] of runtimeRenderTargets.entries()) {\n\t\t\t\t\tif (!activeKeys.has(key)) {\n\t\t\t\t\t\ttarget.texture.destroy();\n\t\t\t\t\t\truntimeRenderTargets.delete(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const definition of resolvedDefinitions) {\n\t\t\t\t\tconst current = runtimeRenderTargets.get(definition.key);\n\t\t\t\t\tif (\n\t\t\t\t\t\tcurrent &&\n\t\t\t\t\t\tcurrent.width === definition.width &&\n\t\t\t\t\t\tcurrent.height === definition.height &&\n\t\t\t\t\t\tcurrent.format === definition.format\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent?.texture.destroy();\n\t\t\t\t\truntimeRenderTargets.set(\n\t\t\t\t\t\tdefinition.key,\n\t\t\t\t\t\tcreateRenderTexture(device, definition.width, definition.height, definition.format)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\trenderTargetSignature = nextSignature;\n\t\t\t\tconst nextSnapshot: Record<string, RenderTarget> = {};\n\t\t\t\tconst nextKeys: string[] = [];\n\t\t\t\tfor (const definition of resolvedDefinitions) {\n\t\t\t\t\tconst target = runtimeRenderTargets.get(definition.key);\n\t\t\t\t\tif (!target) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tnextKeys.push(definition.key);\n\t\t\t\t\tnextSnapshot[definition.key] = {\n\t\t\t\t\t\ttexture: target.texture,\n\t\t\t\t\t\tview: target.view,\n\t\t\t\t\t\twidth: target.width,\n\t\t\t\t\t\theight: target.height,\n\t\t\t\t\t\tformat: target.format\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\trenderTargetSnapshot = nextSnapshot;\n\t\t\t\trenderTargetKeys = nextKeys;\n\t\t\t}\n\n\t\t\treturn renderTargetSnapshot;\n\t\t};\n\n\t\t/**\n\t\t * Blits a texture view to the current canvas texture.\n\t\t */\n\t\tconst blitToCanvas = (\n\t\t\tcommandEncoder: GPUCommandEncoder,\n\t\t\tsourceView: GPUTextureView,\n\t\t\tcanvasView: GPUTextureView,\n\t\t\tclearColor: [number, number, number, number]\n\t\t): void => {\n\t\t\tlet bindGroup = blitBindGroupByView.get(sourceView);\n\t\t\tif (!bindGroup) {\n\t\t\t\tbindGroup = device.createBindGroup({\n\t\t\t\t\tlayout: blitBindGroupLayout,\n\t\t\t\t\tentries: [\n\t\t\t\t\t\t{ binding: 0, resource: blitSampler },\n\t\t\t\t\t\t{ binding: 1, resource: sourceView }\n\t\t\t\t\t]\n\t\t\t\t});\n\t\t\t\tblitBindGroupByView.set(sourceView, bindGroup);\n\t\t\t}\n\n\t\t\tconst pass = commandEncoder.beginRenderPass({\n\t\t\t\tcolorAttachments: [\n\t\t\t\t\t{\n\t\t\t\t\t\tview: canvasView,\n\t\t\t\t\t\tclearValue: {\n\t\t\t\t\t\t\tr: clearColor[0],\n\t\t\t\t\t\t\tg: clearColor[1],\n\t\t\t\t\t\t\tb: clearColor[2],\n\t\t\t\t\t\t\ta: clearColor[3]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tloadOp: 'clear',\n\t\t\t\t\t\tstoreOp: 'store'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t});\n\n\t\t\tpass.setPipeline(blitPipeline);\n\t\t\tpass.setBindGroup(0, bindGroup);\n\t\t\tpass.draw(3);\n\t\t\tpass.end();\n\t\t};\n\n\t\t/**\n\t\t * Executes a full frame render.\n\t\t */\n\t\tconst render: Renderer['render'] = ({\n\t\t\ttime,\n\t\t\tdelta,\n\t\t\trenderMode,\n\t\t\tuniforms,\n\t\t\ttextures,\n\t\t\tcanvasSize\n\t\t}) => {\n\t\t\tif (deviceLostMessage) {\n\t\t\t\tthrow new Error(deviceLostMessage);\n\t\t\t}\n\n\t\t\tif (uncapturedErrorMessage) {\n\t\t\t\tconst message = uncapturedErrorMessage;\n\t\t\t\tuncapturedErrorMessage = null;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\n\t\t\tconst { width, height } = resizeCanvas(options.canvas, options.getDpr(), canvasSize);\n\n\t\t\tif (!contextConfigured || configuredWidth !== width || configuredHeight !== height) {\n\t\t\t\tcontext.configure({\n\t\t\t\t\tdevice,\n\t\t\t\t\tformat,\n\t\t\t\t\talphaMode: 'premultiplied'\n\t\t\t\t});\n\t\t\t\tcontextConfigured = true;\n\t\t\t\tconfiguredWidth = width;\n\t\t\t\tconfiguredHeight = height;\n\t\t\t}\n\n\t\t\tframeScratch[0] = time;\n\t\t\tframeScratch[1] = delta;\n\t\t\tframeScratch[2] = width;\n\t\t\tframeScratch[3] = height;\n\t\t\tdevice.queue.writeBuffer(\n\t\t\t\tframeBuffer,\n\t\t\t\t0,\n\t\t\t\tframeScratch.buffer as ArrayBuffer,\n\t\t\t\tframeScratch.byteOffset,\n\t\t\t\tframeScratch.byteLength\n\t\t\t);\n\n\t\t\tpackUniformsInto(uniforms, options.uniformLayout, uniformScratch);\n\t\t\tif (!hasUniformSnapshot) {\n\t\t\t\tdevice.queue.writeBuffer(\n\t\t\t\t\tuniformBuffer,\n\t\t\t\t\t0,\n\t\t\t\t\tuniformScratch.buffer as ArrayBuffer,\n\t\t\t\t\tuniformScratch.byteOffset,\n\t\t\t\t\tuniformScratch.byteLength\n\t\t\t\t);\n\t\t\t\tuniformPrevious.set(uniformScratch);\n\t\t\t\thasUniformSnapshot = true;\n\t\t\t} else {\n\t\t\t\tconst dirtyRanges = findDirtyFloatRanges(uniformPrevious, uniformScratch);\n\t\t\t\tfor (const range of dirtyRanges) {\n\t\t\t\t\tconst byteOffset = range.start * 4;\n\t\t\t\t\tconst byteLength = range.count * 4;\n\t\t\t\t\tdevice.queue.writeBuffer(\n\t\t\t\t\t\tuniformBuffer,\n\t\t\t\t\t\tbyteOffset,\n\t\t\t\t\t\tuniformScratch.buffer as ArrayBuffer,\n\t\t\t\t\t\tuniformScratch.byteOffset + byteOffset,\n\t\t\t\t\t\tbyteLength\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (dirtyRanges.length > 0) {\n\t\t\t\t\tuniformPrevious.set(uniformScratch);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet bindGroupDirty = false;\n\t\t\tfor (const binding of textureBindings) {\n\t\t\t\tconst nextTexture =\n\t\t\t\t\ttextures[binding.key] ?? normalizedTextureDefinitions[binding.key]?.source ?? null;\n\t\t\t\tif (updateTextureBinding(binding, nextTexture, renderMode)) {\n\t\t\t\t\tbindGroupDirty = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (bindGroupDirty) {\n\t\t\t\tbindGroup = createBindGroup();\n\t\t\t}\n\n\t\t\tconst commandEncoder = device.createCommandEncoder();\n\t\t\tconst passes = resolvePasses();\n\t\t\tconst clearColor = options.getClearColor();\n\t\t\tsyncPassLifecycle(passes, width, height);\n\t\t\tconst runtimeTargets = syncRenderTargets(width, height);\n\t\t\tconst graphPlan = isGraphPlanCacheValid(passes, clearColor)\n\t\t\t\t? cachedGraphPlan!\n\t\t\t\t: (() => {\n\t\t\t\t\t\tconst nextPlan = planRenderGraph(passes, clearColor, renderTargetKeys);\n\t\t\t\t\t\tupdateGraphPlanCache(passes, clearColor, nextPlan);\n\t\t\t\t\t\treturn nextPlan;\n\t\t\t\t\t})();\n\t\t\tconst canvasTexture = context.getCurrentTexture();\n\t\t\tconst canvasSurface: RenderTarget = {\n\t\t\t\ttexture: canvasTexture,\n\t\t\t\tview: canvasTexture.createView(),\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tformat\n\t\t\t};\n\t\t\tconst slots =\n\t\t\t\tgraphPlan.steps.length > 0\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tsource: ensureSlotTarget('source', width, height),\n\t\t\t\t\t\t\ttarget: ensureSlotTarget('target', width, height),\n\t\t\t\t\t\t\tcanvas: canvasSurface\n\t\t\t\t\t\t}\n\t\t\t\t\t: null;\n\t\t\tconst sceneOutput = slots ? slots.source : canvasSurface;\n\n\t\t\tconst scenePass = commandEncoder.beginRenderPass({\n\t\t\t\tcolorAttachments: [\n\t\t\t\t\t{\n\t\t\t\t\t\tview: sceneOutput.view,\n\t\t\t\t\t\tclearValue: {\n\t\t\t\t\t\t\tr: clearColor[0],\n\t\t\t\t\t\t\tg: clearColor[1],\n\t\t\t\t\t\t\tb: clearColor[2],\n\t\t\t\t\t\t\ta: clearColor[3]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tloadOp: 'clear',\n\t\t\t\t\t\tstoreOp: 'store'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t});\n\n\t\t\tscenePass.setPipeline(pipeline);\n\t\t\tscenePass.setBindGroup(0, bindGroup);\n\t\t\tscenePass.draw(3);\n\t\t\tscenePass.end();\n\n\t\t\tif (slots) {\n\t\t\t\tconst resolveStepSurface = (\n\t\t\t\t\tslot: RenderPassInputSlot | RenderPassOutputSlot\n\t\t\t\t): RenderTarget => {\n\t\t\t\t\tif (slot === 'source') {\n\t\t\t\t\t\treturn slots.source;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (slot === 'target') {\n\t\t\t\t\t\treturn slots.target;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (slot === 'canvas') {\n\t\t\t\t\t\treturn slots.canvas;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst named = runtimeTargets[slot];\n\t\t\t\t\tif (!named) {\n\t\t\t\t\t\tthrow new Error(`Render graph references unknown runtime target \"${slot}\".`);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn named;\n\t\t\t\t};\n\n\t\t\t\tfor (const step of graphPlan.steps) {\n\t\t\t\t\tconst input = resolveStepSurface(step.input);\n\t\t\t\t\tconst output = resolveStepSurface(step.output);\n\n\t\t\t\t\tstep.pass.render({\n\t\t\t\t\t\tdevice,\n\t\t\t\t\t\tcommandEncoder,\n\t\t\t\t\t\tsource: slots.source,\n\t\t\t\t\t\ttarget: slots.target,\n\t\t\t\t\t\tcanvas: slots.canvas,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\ttargets: runtimeTargets,\n\t\t\t\t\t\ttime,\n\t\t\t\t\t\tdelta,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\tclear: step.clear,\n\t\t\t\t\t\tclearColor: step.clearColor,\n\t\t\t\t\t\tpreserve: step.preserve,\n\t\t\t\t\t\tbeginRenderPass: (passOptions) => {\n\t\t\t\t\t\t\tconst clear = passOptions?.clear ?? step.clear;\n\t\t\t\t\t\t\tconst clearColor = passOptions?.clearColor ?? step.clearColor;\n\t\t\t\t\t\t\tconst preserve = passOptions?.preserve ?? step.preserve;\n\n\t\t\t\t\t\t\treturn commandEncoder.beginRenderPass({\n\t\t\t\t\t\t\t\tcolorAttachments: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tview: passOptions?.view ?? output.view,\n\t\t\t\t\t\t\t\t\t\tclearValue: {\n\t\t\t\t\t\t\t\t\t\t\tr: clearColor[0],\n\t\t\t\t\t\t\t\t\t\t\tg: clearColor[1],\n\t\t\t\t\t\t\t\t\t\t\tb: clearColor[2],\n\t\t\t\t\t\t\t\t\t\t\ta: clearColor[3]\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tloadOp: clear ? 'clear' : 'load',\n\t\t\t\t\t\t\t\t\t\tstoreOp: preserve ? 'store' : 'discard'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tif (step.needsSwap) {\n\t\t\t\t\t\tconst previousSource = slots.source;\n\t\t\t\t\t\tslots.source = slots.target;\n\t\t\t\t\t\tslots.target = previousSource;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (graphPlan.finalOutput !== 'canvas') {\n\t\t\t\t\tconst finalSurface = resolveStepSurface(graphPlan.finalOutput);\n\t\t\t\t\tblitToCanvas(commandEncoder, finalSurface.view, slots.canvas.view, clearColor);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdevice.queue.submit([commandEncoder.finish()]);\n\t\t};\n\n\t\tacceptInitializationCleanups = false;\n\t\tinitializationCleanups.length = 0;\n\t\treturn {\n\t\t\trender,\n\t\t\tdestroy: () => {\n\t\t\t\tisDestroyed = true;\n\t\t\t\tdevice.removeEventListener('uncapturederror', handleUncapturedError);\n\t\t\t\tframeBuffer.destroy();\n\t\t\t\tuniformBuffer.destroy();\n\t\t\t\tdestroyRenderTexture(sourceSlotTarget);\n\t\t\t\tdestroyRenderTexture(targetSlotTarget);\n\t\t\t\tfor (const target of runtimeRenderTargets.values()) {\n\t\t\t\t\ttarget.texture.destroy();\n\t\t\t\t}\n\t\t\t\truntimeRenderTargets.clear();\n\t\t\t\tfor (const pass of activePasses) {\n\t\t\t\t\tpass.dispose?.();\n\t\t\t\t}\n\t\t\t\tactivePasses.length = 0;\n\t\t\t\tlifecyclePassesRef = null;\n\t\t\t\tfor (const binding of textureBindings) {\n\t\t\t\t\tbinding.texture?.destroy();\n\t\t\t\t\tbinding.fallbackTexture.destroy();\n\t\t\t\t}\n\t\t\t\tblitBindGroupByView = new WeakMap();\n\t\t\t\tcachedGraphPlan = null;\n\t\t\t\tcachedGraphPasses.length = 0;\n\t\t\t\trenderTargetSnapshot = {};\n\t\t\t\trenderTargetKeys = [];\n\t\t\t}\n\t\t};\n\t} catch (error) {\n\t\tisDestroyed = true;\n\t\tacceptInitializationCleanups = false;\n\t\tdevice.removeEventListener('uncapturederror', handleUncapturedError);\n\t\trunInitializationCleanups();\n\t\tthrow error;\n\t}\n}\n"],"mappings":";;;;;;;;;;AAmCA,IAAM,gBAAgB;;;;AAKtB,IAAM,kBAAkB;;;;AAKxB,IAAM,wBAAwB;;;;AAgE9B,SAAS,mBAAmB,OAG1B;CACD,MAAM,iBAAiB,wBAAwB,QAAQ;AACvD,QAAO;EACN;EACA,gBAAgB,iBAAiB;EACjC;;;;;AAMF,SAAS,aACR,QACA,UACA,SACoC;CACpC,MAAM,MAAM,OAAO,SAAS,SAAS,IAAI,WAAW,IAAI,WAAW;CACnE,MAAM,OAAO,UAAU,OAAO,OAAO,uBAAuB;CAC5D,MAAM,WAAW,KAAK,IAAI,GAAG,SAAS,SAAS,MAAM,SAAS,EAAE;CAChE,MAAM,YAAY,KAAK,IAAI,GAAG,SAAS,UAAU,MAAM,UAAU,EAAE;CACnE,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,OAAO,YAAY,KAAK,IAAI,CAAC;CAC5D,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,OAAO,aAAa,KAAK,IAAI,CAAC;AAE9D,KAAI,OAAO,UAAU,SAAS,OAAO,WAAW,QAAQ;AACvD,SAAO,QAAQ;AACf,SAAO,SAAS;;AAGjB,QAAO;EAAE;EAAO;EAAQ;;;;;AAMzB,eAAe,kB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AsB;AACpE,6BAA2B;AAC3B,QAAM"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { CurrentReadable, CurrentWritable } from './current-value.js';
2
3
  import { type FragMaterial } from './material.js';
3
4
  import { type MotionGPUErrorReport } from './error-report.js';
@@ -32,3 +33,4 @@ export interface MotionGPURuntimeLoop {
32
33
  destroy: () => void;
33
34
  }
34
35
  export declare function createMotionGPURuntimeLoop(options: MotionGPURuntimeLoopOptions): MotionGPURuntimeLoop;
36
+ //# sourceMappingURL=runtime-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-loop.d.ts","sourceRoot":"","sources":["../../src/lib/core/runtime-loop.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAmB,KAAK,YAAY,EAAyB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAGN,KAAK,oBAAoB,EACzB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACX,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EAEV,yBAAyB,EAKzB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,2BAA2B;IAC3C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,WAAW,EAAE,MAAM,YAAY,CAAC;IAChC,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;IAClD,SAAS,EAAE,MAAM,UAAU,EAAE,CAAC;IAC9B,aAAa,EAAE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