webgpuCacheBindGroups.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import type { WebGPUCacheSampler } from "./webgpuCacheSampler";
  2. import type { WebGPUMaterialContext } from "./webgpuMaterialContext";
  3. import type { WebGPUPipelineContext } from "./webgpuPipelineContext";
  4. import type { WebGPUEngine } from "../webgpuEngine";
  5. import type { WebGPUDrawContext } from "./webgpuDrawContext";
  6. /** @internal */
  7. export declare class WebGPUCacheBindGroups {
  8. static NumBindGroupsCreatedTotal: number;
  9. static NumBindGroupsCreatedLastFrame: number;
  10. static NumBindGroupsLookupLastFrame: number;
  11. static NumBindGroupsNoLookupLastFrame: number;
  12. private static _Cache;
  13. private static _NumBindGroupsCreatedCurrentFrame;
  14. private static _NumBindGroupsLookupCurrentFrame;
  15. private static _NumBindGroupsNoLookupCurrentFrame;
  16. private _device;
  17. private _cacheSampler;
  18. private _engine;
  19. disabled: boolean;
  20. static get Statistics(): {
  21. totalCreated: number;
  22. lastFrameCreated: number;
  23. lookupLastFrame: number;
  24. noLookupLastFrame: number;
  25. };
  26. static ResetCache(): void;
  27. constructor(device: GPUDevice, cacheSampler: WebGPUCacheSampler, engine: WebGPUEngine);
  28. endFrame(): void;
  29. /**
  30. * Cache is currently based on the uniform/storage buffers, samplers and textures used by the binding groups.
  31. * Note that all uniform buffers have an offset of 0 in Babylon and we don't have a use case where we would have the same buffer used with different capacity values:
  32. * that means we don't need to factor in the offset/size of the buffer in the cache, only the id
  33. * @param webgpuPipelineContext
  34. * @param drawContext
  35. * @param materialContext
  36. * @returns a bind group array
  37. */
  38. getBindGroups(webgpuPipelineContext: WebGPUPipelineContext, drawContext: WebGPUDrawContext, materialContext: WebGPUMaterialContext): GPUBindGroup[];
  39. }