@hology/webgpu-renderer 0.1.17 → 0.1.19

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.
package/dist/index.d.ts CHANGED
@@ -2,18 +2,12 @@ import * as three from 'three';
2
2
  import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, PointLight, SpotLight, Object3D, PerspectiveCamera, OrthographicCamera, BufferGeometry, Scene } from 'three';
3
3
  export { AmbientLight, BackSide, BatchedMesh, Bone, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, Color, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedArrayTexture as CompressedTextureArray, CubeTexture, Data3DTexture, DataArrayTexture, DataTexture, DepthTexture, DirectionalLight, DoubleSide, FrontSide, Group, HemisphereLight, InstancedMesh, MathUtils, Matrix4, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, PlaneGeometry, PointLight, RepeatWrapping, Scene, Skeleton, SkinnedMesh, SphereGeometry, SpotLight, Texture, Vector2, Vector3, Vector4 } from 'three';
4
4
 
5
- interface ComputeKernelDescriptor {
6
- label?: string;
7
- code: string;
8
- entryPoint?: string;
9
- bindGroupLayoutEntries: GPUBindGroupLayoutEntry[];
10
- }
11
- declare class ComputeKernel {
12
- readonly layout: GPUBindGroupLayout;
13
- readonly pipeline: GPUComputePipeline;
14
- constructor(device: GPUDevice, descriptor: ComputeKernelDescriptor);
15
- createBindGroup(device: GPUDevice, entries: GPUBindGroupEntry[], label?: string): GPUBindGroup;
5
+ interface PipelineDiagnosticOrigin {
6
+ key: string;
7
+ [detail: string]: unknown;
16
8
  }
9
+ declare function setPipelineDiagnosticLoading(device: GPUDevice, loading: boolean, phase: string): void;
10
+ declare function registerPipelineDiagnosticOrigin(device: GPUDevice, label: string, origin: PipelineDiagnosticOrigin): void;
17
11
 
18
12
  type ShaderDefineValue = string | number | boolean;
19
13
  type ShaderDefines = Record<string, ShaderDefineValue | null | undefined>;
@@ -151,6 +145,31 @@ declare class WGSLShaderMaterial extends Material {
151
145
  private invalidateBindingCache;
152
146
  }
153
147
 
148
+ /**
149
+ * Lighting and post-processing stay in linear HDR until the present pass.
150
+ * The canvas format is intentionally kept separate because it is a display
151
+ * target, not an intermediate scene-color target.
152
+ */
153
+ declare const SCENE_COLOR_FORMAT: GPUTextureFormat;
154
+
155
+ declare function createRenderPipelineAsync(device: GPUDevice, descriptor: GPURenderPipelineDescriptor): Promise<GPURenderPipeline>;
156
+ declare function createComputePipelineAsync(device: GPUDevice, descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>;
157
+
158
+ interface ComputeKernelDescriptor {
159
+ label?: string;
160
+ code: string;
161
+ entryPoint?: string;
162
+ bindGroupLayoutEntries: GPUBindGroupLayoutEntry[];
163
+ }
164
+ declare class ComputeKernel {
165
+ readonly layout: GPUBindGroupLayout;
166
+ readonly pipeline: GPUComputePipeline;
167
+ static createAsync(device: GPUDevice, descriptor: ComputeKernelDescriptor): Promise<ComputeKernel>;
168
+ /** The optional pipeline allows adopting an already compiled kernel. */
169
+ constructor(device: GPUDevice, descriptor: ComputeKernelDescriptor, pipeline?: GPUComputePipeline);
170
+ createBindGroup(device: GPUDevice, entries: GPUBindGroupEntry[], label?: string): GPUBindGroup;
171
+ }
172
+
154
173
  interface RenderGraphContext {
155
174
  readonly device: GPUDevice;
156
175
  readonly encoder: GPUCommandEncoder;
@@ -450,6 +469,8 @@ interface RendererCustomPassContext {
450
469
  };
451
470
  /** Resolves the current renderer-owned vertex buffer for a geometry. */
452
471
  getGeometryVertexBuffer(geometry: BufferGeometry, attribute: "position" | "normal"): GPUBuffer;
472
+ /** Shared current bone-world * inverse-bind palette; renderer owns its lifetime. */
473
+ getSkeletonBoneBuffer(skeleton: three.Skeleton): GPUBuffer;
453
474
  getColorFormat(name: string): GPUTextureFormat;
454
475
  getShadowMapDebugInfo(): RendererShadowMapDebugInfo;
455
476
  /** Shared light uniforms and shadow arrays used by the forward renderer. */
@@ -494,6 +515,10 @@ interface RendererFrameProfile {
494
515
  triangleCount: number;
495
516
  cpuPhases: {
496
517
  extractSceneMs: number;
518
+ /** Included in extractSceneMs; covers key updates, ordering and result consumption. */
519
+ opaqueSortMs?: number;
520
+ /** Mean of the last 120 profiled frames, smoothing timer quantization. */
521
+ opaqueSortAverageMs?: number;
497
522
  uploadMs: number;
498
523
  renderGraphMs: number;
499
524
  };
@@ -545,6 +570,7 @@ interface CompiledNodeFullscreenShader {
545
570
  }>): void;
546
571
  }
547
572
  interface FrameGraphNodeFullscreenPassDescriptor {
573
+ readonly diagnosticOrigin?: PipelineDiagnosticOrigin;
548
574
  readonly name: string;
549
575
  readonly shader: CompiledNodeFullscreenShader;
550
576
  /** Overrides frame-graph resources for named compiled graph/scene texture bindings. */
@@ -813,6 +839,7 @@ type ToonOutlineParameters = {
813
839
  visible?: boolean;
814
840
  };
815
841
  declare class WebGpuRenderer {
842
+ private pipelineCompilationDiagnostics?;
816
843
  readonly canvas: HTMLCanvasElement;
817
844
  private readonly clearColor;
818
845
  private readonly powerPreference;
@@ -923,6 +950,7 @@ declare class WebGpuRenderer {
923
950
  private readonly vertexAttributeGroupCache;
924
951
  private readonly materialVertexAttributeCache;
925
952
  private readonly vertexBufferBindingPlanCache;
953
+ private readonly preparedVertexBufferCache;
926
954
  private readonly vertexAttributeGroupBufferKeyCache;
927
955
  private readonly compileDrawScratch;
928
956
  private readonly dynamicIndirectSubmissionCache;
@@ -1003,6 +1031,16 @@ declare class WebGpuRenderer {
1003
1031
  private createExtractedHemisphereLightScratch;
1004
1032
  private createExtractedPointLightScratch;
1005
1033
  private createExtractedSpotLightScratch;
1034
+ private readonly skinnedDrawKeys;
1035
+ private readonly skeletonPalettes;
1036
+ private readonly getSkeletonBoneBufferForPass;
1037
+ private readonly outlineResolvedFrameCache;
1038
+ private opaqueSortMs;
1039
+ private readonly opaqueSortSamples;
1040
+ private opaqueSortSampleIndex;
1041
+ private opaqueSortSampleCount;
1042
+ private opaqueSortSampleTotal;
1043
+ private sortOpaqueDraws;
1006
1044
  constructor(options: RendererOptions);
1007
1045
  private resolveMaterial;
1008
1046
  private resolveLineMaterial;
@@ -1197,6 +1235,7 @@ declare class WebGpuRenderer {
1197
1235
  private getSkinningPalette;
1198
1236
  private refreshSkinningPalette;
1199
1237
  private refreshSkinningBindMatrices;
1238
+ private uploadSkinningPalette;
1200
1239
  private uploadSkinningResources;
1201
1240
  private createSkinningBoneBounds;
1202
1241
  private updateSkinnedBounds;
@@ -1217,6 +1256,7 @@ declare class WebGpuRenderer {
1217
1256
  private getInterleavedGeometryVertexBuffer;
1218
1257
  private ensureWireframeIndex;
1219
1258
  private bindGeometryVertexBuffers;
1259
+ private prepareGeometryVertexBuffers;
1220
1260
  private getStandardVertexAttribute;
1221
1261
  private prepareDrawGeometryVertexBuffers;
1222
1262
  private getDefaultInstanceAttributeBuffer;
@@ -1725,4 +1765,4 @@ declare class OutlineEffect {
1725
1765
  dispose(): void;
1726
1766
  }
1727
1767
 
1728
- export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial };
1768
+ export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, type PipelineDiagnosticOrigin, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, SCENE_COLOR_FORMAT, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, setPipelineDiagnosticLoading };