@luma.gl/core 9.0.0-alpha.45 → 9.0.0-alpha.46
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/adapter/device.d.ts +6 -2
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js.map +1 -1
- package/dist/adapter/resources/buffer.d.ts +1 -1
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js.map +1 -1
- package/dist/adapter/resources/command-buffer.d.ts +2 -1
- package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/command-buffer.js +2 -2
- package/dist/adapter/resources/command-buffer.js.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +3 -0
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js.map +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts +25 -0
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -0
- package/dist/adapter/resources/transform-feedback.js +17 -0
- package/dist/adapter/resources/transform-feedback.js.map +1 -0
- package/dist/adapter/types/shader-layout.d.ts +1 -1
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.js.map +1 -1
- package/dist/dist.dev.js +29 -10
- package/dist/index.cjs +23 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist.min.js +10 -10
- package/package.json +2 -2
- package/src/adapter/device.ts +14 -9
- package/src/adapter/resources/buffer.ts +1 -1
- package/src/adapter/resources/command-buffer.ts +3 -3
- package/src/adapter/resources/render-pipeline.ts +17 -12
- package/src/adapter/resources/transform-feedback.ts +37 -0
- package/src/adapter/types/shader-layout.ts +6 -6
- package/src/index.ts +4 -6
- package/src/lib/uniforms/.uniform-store.ts.swp +0 -0
package/dist/adapter/device.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { RenderPass, RenderPassProps } from './resources/render-pass';
|
|
|
14
14
|
import type { ComputePass, ComputePassProps } from './resources/compute-pass';
|
|
15
15
|
import type { CommandEncoder, CommandEncoderProps } from './resources/command-encoder';
|
|
16
16
|
import type { VertexArray, VertexArrayProps } from './resources/vertex-array';
|
|
17
|
+
import type { TransformFeedback, TransformFeedbackProps } from './resources/transform-feedback';
|
|
17
18
|
/** Device properties */
|
|
18
19
|
export type DeviceProps = {
|
|
19
20
|
id?: string;
|
|
@@ -77,7 +78,7 @@ export type DeviceLimits = {
|
|
|
77
78
|
readonly maxComputeWorkgroupsPerDimension?: number;
|
|
78
79
|
};
|
|
79
80
|
export type WebGPUDeviceFeature = 'depth-clip-control' | 'depth24unorm-stencil8' | 'depth32float-stencil8' | 'timestamp-query' | 'indirect-first-instance' | 'texture-compression-bc' | 'texture-compression-etc2' | 'texture-compression-astc';
|
|
80
|
-
export type WebGLDeviceFeature = 'webgpu' | 'webgl2' | 'webgl' | 'timer-query-webgl' | 'uniform-buffers-webgl' | 'uniforms-webgl' | 'texture-filter-linear-float32-webgl' | 'texture-filter-linear-float16-webgl' | 'texture-filter-anisotropic-webgl' | 'texture-renderable-float32-webgl' | 'texture-renderable-float16-webgl' | 'texture-renderable-rgba32float-webgl' | 'texture-blend-float-webgl1' | 'texture-formats-norm16-webgl' | 'texture-formats-srgb-webgl1' | 'texture-formats-depth-webgl1' | 'texture-formats-float32-webgl1' | 'texture-formats-float16-webgl1' | 'vertex-array-object-webgl1' | 'instanced-rendering-webgl1' | 'multiple-render-targets-webgl1' | 'index-uint32-webgl1' | 'blend-minmax-webgl1' | 'glsl-frag-data' | 'glsl-frag-depth' | 'glsl-derivatives' | 'glsl-texture-lod';
|
|
81
|
+
export type WebGLDeviceFeature = 'webgpu' | 'webgl2' | 'webgl' | 'timer-query-webgl' | 'uniform-buffers-webgl' | 'uniforms-webgl' | 'texture-filter-linear-float32-webgl' | 'texture-filter-linear-float16-webgl' | 'texture-filter-anisotropic-webgl' | 'texture-renderable-float32-webgl' | 'texture-renderable-float16-webgl' | 'texture-renderable-rgba32float-webgl' | 'texture-blend-float-webgl1' | 'texture-formats-norm16-webgl' | 'texture-formats-srgb-webgl1' | 'texture-formats-depth-webgl1' | 'texture-formats-float32-webgl1' | 'texture-formats-float16-webgl1' | 'vertex-array-object-webgl1' | 'instanced-rendering-webgl1' | 'multiple-render-targets-webgl1' | 'index-uint32-webgl1' | 'blend-minmax-webgl1' | 'transform-feedback-webgl2' | 'glsl-frag-data' | 'glsl-frag-depth' | 'glsl-derivatives' | 'glsl-texture-lod';
|
|
81
82
|
type WebGLCompressedTextureFeatures = 'texture-compression-bc5-webgl' | 'texture-compression-etc1-webgl' | 'texture-compression-pvrtc-webgl' | 'texture-compression-atc-webgl';
|
|
82
83
|
/** Valid feature strings */
|
|
83
84
|
export type DeviceFeature = WebGPUDeviceFeature | WebGLDeviceFeature | WebGLCompressedTextureFeatures;
|
|
@@ -146,12 +147,13 @@ export declare abstract class Device {
|
|
|
146
147
|
abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;
|
|
147
148
|
/** Create a sampler */
|
|
148
149
|
abstract createSampler(props: SamplerProps): Sampler;
|
|
150
|
+
/** Create a Framebuffer. Must have at least one attachment. */
|
|
149
151
|
abstract createFramebuffer(props: FramebufferProps): Framebuffer;
|
|
150
152
|
/** Create a shader */
|
|
151
153
|
abstract createShader(props: ShaderProps): Shader;
|
|
152
154
|
/** Create a render pipeline (aka program) */
|
|
153
155
|
abstract createRenderPipeline(props: RenderPipelineProps): RenderPipeline;
|
|
154
|
-
/** Create a compute pipeline (aka program) */
|
|
156
|
+
/** Create a compute pipeline (aka program). WebGPU only. */
|
|
155
157
|
abstract createComputePipeline(props: ComputePipelineProps): ComputePipeline;
|
|
156
158
|
createCommandEncoder(props?: CommandEncoderProps): CommandEncoder;
|
|
157
159
|
/** Create a vertex array */
|
|
@@ -162,6 +164,8 @@ export declare abstract class Device {
|
|
|
162
164
|
abstract beginComputePass(props?: ComputePassProps): ComputePass;
|
|
163
165
|
/** Get a renderpass that is set up to render to the primary CanvasContext */
|
|
164
166
|
abstract getDefaultRenderPass(): RenderPass;
|
|
167
|
+
/** Create a transform feedback (immutable set of output buffer bindings). WebGL 2 only. */
|
|
168
|
+
abstract createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;
|
|
165
169
|
protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps;
|
|
166
170
|
}
|
|
167
171
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter/device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAY,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACrF,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAC,UAAU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AAU;IAE7D,2BAA2B;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,WAAW;IAEhE,6EAA6E;IAC7E,QAAQ,CAAC,oBAAoB,IAAI,UAAU;IAE3C,2FAA2F;IAC3F,QAAQ,CAAC,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB;IAIlF,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW;CAqB3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","DEFAULT_DEVICE_PROPS","id","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","statsManager","userData","_lumaData","info","lost","canvasContext","toLowerCase","loseDevice","getCanvasContext","Error","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array","warn"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../lib/utils/stats-manager';\nimport {log} from '../lib/utils/log';\nimport {uid} from '../lib/utils/utils';\nimport type {TextureFormat} from './types/texture-formats';\nimport type {CanvasContext, CanvasContextProps} from './canvas-context';\nimport type {BufferProps} from './resources/buffer';\nimport {Buffer} from './resources/buffer';\nimport type {RenderPipeline, RenderPipelineProps} from './resources/render-pipeline';\nimport type {ComputePipeline, ComputePipelineProps} from './resources/compute-pipeline';\nimport type {Sampler, SamplerProps} from './resources/sampler';\nimport type {Shader, ShaderProps} from './resources/shader';\nimport type {Texture, TextureProps, TextureData} from './resources/texture';\nimport type {ExternalTexture, ExternalTextureProps} from './resources/external-texture';\nimport type {Framebuffer, FramebufferProps} from './resources/framebuffer';\nimport type {RenderPass, RenderPassProps} from './resources/render-pass';\nimport type {ComputePass, ComputePassProps} from './resources/compute-pass';\nimport type {CommandEncoder, CommandEncoderProps} from './resources/command-encoder';\nimport type {VertexArray, VertexArrayProps} from './resources/vertex-array';\n\n/** Device properties */\nexport type DeviceProps = {\n id?: string;\n\n type?: 'webgl' | 'webgl1' | 'webgl2' | 'webgpu' | 'best-available';\n\n // Common parameters\n canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id\n container?: HTMLElement | string | null;\n width?: number /** width is only used when creating a new canvas */;\n height?: number /** height is only used when creating a new canvas */;\n\n // WebGLDevice parameters\n webgl2?: boolean; // Set to false to not create a WebGL2 context (force webgl1)\n webgl1?: boolean; // set to false to not create a WebGL1 context (fails if webgl2 not available)\n\n // WebGLContext PARAMETERS - Can only be set on context creation...\n // alpha?: boolean; // Default render target has an alpha buffer.\n // depth?: boolean; // Default render target has a depth buffer of at least 16 bits.\n // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits.\n // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing.\n // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low.\n\n // Unclear if these are still supported\n debug?: boolean; // Instrument context (at the expense of performance)\n manageState?: boolean; // Set to false to disable WebGL state management instrumentation\n break?: string[]; // TODO: types\n\n // @deprecated Attach to existing context\n gl?: WebGLRenderingContext | WebGL2RenderingContext | null;\n};\n\nexport const DEFAULT_DEVICE_PROPS: Required<DeviceProps> = {\n id: null!,\n type: 'best-available',\n canvas: null,\n container: null,\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n break: [],\n\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n\n gl: null\n};\n\nexport type ShadingLanguage = 'glsl' | 'wgsl';\n\n/**\n * Identifies the GPU vendor and driver.\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n * @note Current WebGPU support is very limited\n */\nexport type DeviceInfo = {\n type: 'webgl' | 'webgl2' | 'webgpu';\n vendor: string;\n renderer: string;\n version: string;\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n shadingLanguages: ShadingLanguage[];\n shadingLanguageVersions: Record<string, string>;\n vendorMasked?: string;\n rendererMasked?: string;\n};\n\n/** Limits for a device */\nexport type DeviceLimits = {\n readonly maxTextureDimension1D?: number;\n readonly maxTextureDimension2D?: number;\n readonly maxTextureDimension3D?: number;\n readonly maxTextureArrayLayers?: number;\n readonly maxBindGroups: number;\n readonly maxDynamicUniformBuffersPerPipelineLayout: number;\n readonly maxDynamicStorageBuffersPerPipelineLayout: number;\n readonly maxSampledTexturesPerShaderStage: number;\n readonly maxSamplersPerShaderStage: number;\n readonly maxStorageBuffersPerShaderStage: number;\n readonly maxStorageTexturesPerShaderStage: number;\n readonly maxUniformBuffersPerShaderStage: number;\n readonly maxUniformBufferBindingSize: number;\n readonly maxStorageBufferBindingSize?: number;\n readonly minUniformBufferOffsetAlignment?: number;\n readonly minStorageBufferOffsetAlignment?: number;\n readonly maxVertexBuffers?: number;\n readonly maxVertexAttributes: number;\n readonly maxVertexBufferArrayStride?: number;\n readonly maxInterStageShaderComponents?: number;\n readonly maxComputeWorkgroupStorageSize?: number;\n readonly maxComputeInvocationsPerWorkgroup?: number;\n readonly maxComputeWorkgroupSizeX?: number;\n readonly maxComputeWorkgroupSizeY?: number;\n readonly maxComputeWorkgroupSizeZ?: number;\n readonly maxComputeWorkgroupsPerDimension?: number;\n};\n\nexport type WebGPUDeviceFeature =\n | 'depth-clip-control'\n | 'depth24unorm-stencil8'\n | 'depth32float-stencil8'\n | 'timestamp-query'\n | 'indirect-first-instance'\n | 'texture-compression-bc'\n | 'texture-compression-etc2'\n | 'texture-compression-astc';\n\n// obsolete...\n// 'depth-clamping' |\n// 'depth24unorm-stencil8' |\n// 'depth32float-stencil8' |\n// 'pipeline-statistics-query' |\n// 'timestamp-query' |\n// 'texture-compression-bc'\n\nexport type WebGLDeviceFeature =\n | 'webgpu'\n | 'webgl2'\n | 'webgl'\n\n // api support (unify with WebGPU timestamp-query?)\n | 'timer-query-webgl'\n | 'uniform-buffers-webgl'\n | 'uniforms-webgl'\n\n // texture filtering\n | 'texture-filter-linear-float32-webgl'\n | 'texture-filter-linear-float16-webgl'\n | 'texture-filter-anisotropic-webgl'\n\n // texture rendering\n | 'texture-renderable-float32-webgl'\n | 'texture-renderable-float16-webgl'\n | 'texture-renderable-rgba32float-webgl' // TODO - remove\n\n // texture blending\n | 'texture-blend-float-webgl1'\n\n // texture format support\n | 'texture-formats-norm16-webgl'\n | 'texture-formats-srgb-webgl1'\n | 'texture-formats-depth-webgl1'\n | 'texture-formats-float32-webgl1'\n | 'texture-formats-float16-webgl1'\n\n // api support\n | 'vertex-array-object-webgl1'\n | 'instanced-rendering-webgl1'\n | 'multiple-render-targets-webgl1'\n | 'index-uint32-webgl1'\n | 'blend-minmax-webgl1'\n\n // glsl extensions\n | 'glsl-frag-data'\n | 'glsl-frag-depth'\n | 'glsl-derivatives'\n | 'glsl-texture-lod';\n\ntype WebGLCompressedTextureFeatures =\n | 'texture-compression-bc5-webgl'\n | 'texture-compression-etc1-webgl'\n | 'texture-compression-pvrtc-webgl'\n | 'texture-compression-atc-webgl';\n\n/** Valid feature strings */\nexport type DeviceFeature =\n | WebGPUDeviceFeature\n | WebGLDeviceFeature\n | WebGLCompressedTextureFeatures;\n\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport abstract class Device {\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...DEFAULT_DEVICE_PROPS, ...props};\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n\n /** id of this device, primarily for debugging */\n readonly id: string;\n /** stats */\n readonly statsManager: StatsManager = lumaStats;\n /** A copy of the device props */\n readonly props: Required<DeviceProps>;\n /** Available for the application to store data on the device */\n userData: {[key: string]: unknown} = {};\n /** Used by other luma.gl modules to store data on the device */\n _lumaData: {[key: string]: unknown} = {};\n\n // Capabilities\n\n /** Information about the device (vendor, versions etc) */\n abstract info: DeviceInfo;\n\n /** Optional capability discovery */\n abstract get features(): Set<DeviceFeature>;\n\n /** WebGPU style device limits */\n abstract get limits(): DeviceLimits;\n\n /** Check if device supports a specific texture format (creation and `nearest` sampling) */\n abstract isTextureFormatSupported(format: TextureFormat): boolean;\n\n /** Check if linear filtering (sampler interpolation) is supported for a specific texture format */\n abstract isTextureFormatFilterable(format: TextureFormat): boolean;\n\n /** Check if device supports rendering to a specific texture format */\n abstract isTextureFormatRenderable(format: TextureFormat): boolean;\n\n // Device loss\n\n /** `true` if device is already lost */\n abstract get isLost(): boolean;\n\n /** Promise that resolves when device is lost */\n abstract readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n /** \n * Trigger device loss. \n * @returns `true` if context loss could actually be triggered. \n * @note primarily intended for testing how application reacts to device loss \n */\n loseDevice(): boolean {\n return false;\n }\n\n // Canvas context\n\n /** Default / primary canvas context. Can be null as WebGPU devices can be created without a CanvasContext */\n abstract canvasContext: CanvasContext | null;\n\n /** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */\n getCanvasContext(): CanvasContext {\n if (!this.canvasContext) {\n throw new Error('Device has no CanvasContext');\n }\n return this.canvasContext\n }\n\n /** Creates a new CanvasContext (WebGPU only) */\n abstract createCanvasContext(props?: CanvasContextProps): CanvasContext;\n\n /** Call after rendering a frame (necessary e.g. on WebGL OffscreenCanvas) */\n abstract submit(): void;\n\n // Resource creation\n\n /** Create a buffer */\n abstract createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): Buffer;\n\n /** Create a texture */\n abstract _createTexture(props: TextureProps): Texture;\n createTexture(props: TextureProps): Texture;\n createTexture(data: Promise<TextureData>): Texture;\n createTexture(url: string): Texture;\n\n createTexture(props: TextureProps | Promise<TextureData> | string): Texture {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = {data: props};\n }\n return this._createTexture(props);\n }\n\n /** Create a temporary texture view of a video source */\n abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;\n\n /** Create a sampler */\n abstract createSampler(props: SamplerProps): Sampler;\n\n abstract createFramebuffer(props: FramebufferProps): Framebuffer;\n\n /** Create a shader */\n abstract createShader(props: ShaderProps): Shader;\n\n /** Create a render pipeline (aka program) */\n abstract createRenderPipeline(props: RenderPipelineProps): RenderPipeline;\n\n /** Create a compute pipeline (aka program) */\n abstract createComputePipeline(props: ComputePipelineProps): ComputePipeline;\n\n createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n /** Create a vertex array */\n abstract createVertexArray(props: VertexArrayProps): VertexArray;\n\n /** Create a RenderPass */\n abstract beginRenderPass(props?: RenderPassProps): RenderPass;\n\n /** Create a ComputePass */\n abstract beginComputePass(props?: ComputePassProps): ComputePass;\n\n /** Get a renderpass that is set up to render to the primary CanvasContext */\n abstract getDefaultRenderPass(): RenderPass;\n\n // Resource creation helpers\n\n protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps {\n\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n\n const newProps = {...props};\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n } else {\n log.warn('indices buffer content must be of integer type')();\n }\n }\n return newProps; \n }\n}\n"],"mappings":";SACQA,OAAO;AAAA,SACOC,SAAS;AAAA,SACvBC,GAAG;AAAA,SACHC,GAAG;AAAA,SAIHC,MAAM;AA+Cd,OAAO,MAAMC,oBAA2C,GAAG;EACzDC,EAAE,EAAE,IAAK;EACTC,IAAI,EAAE,gBAAgB;EACtBC,MAAM,EAAE,IAAI;EACZC,SAAS,EAAE,IAAI;EACfC,MAAM,EAAE,IAAI;EACZC,MAAM,EAAE,IAAI;EACZC,WAAW,EAAE,IAAI;EACjBC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,GAAG;EACXC,KAAK,EAAEC,OAAO,CAACd,GAAG,CAACe,GAAG,CAAC,OAAO,CAAC,CAAC;EAChCC,KAAK,EAAE,EAAE;EAUTC,EAAE,EAAE;AACN,CAAC;AAACC,mBAAA,GAgIKC,MAAM,CAACC,WAAW;AADzB,OAAO,MAAeC,MAAM,CAAC;EAC3B,KAAAH,mBAAA,IAAmC;IACjC,OAAO,QAAQ;EACjB;EAIAI,WAAWA,CAACC,KAAkB,EAAE;IAAA,KAMvBnB,EAAE;IAAA,KAEFoB,YAAY,GAAiBzB,SAAS;IAAA,KAEtCwB,KAAK;IAAA,KAEdE,QAAQ,GAA6B,CAAC,CAAC;IAAA,KAEvCC,SAAS,GAA6B,CAAC,CAAC;IAAA,KAK/BC,IAAI;IAAA,KAuBKC,IAAI;IAAA,KAcbC,aAAa;IAvDpB,IAAI,CAACN,KAAK,GAAG;MAAC,GAAGpB,oBAAoB;MAAE,GAAGoB;IAAK,CAAC;IAChD,IAAI,CAACnB,EAAE,GAAG,IAAI,CAACmB,KAAK,CAACnB,EAAE,IAAIH,GAAG,CAAC,IAAI,CAACkB,MAAM,CAACC,WAAW,CAAC,CAACU,WAAW,CAAC,CAAC,CAAC;EACxE;EA8CAC,UAAUA,CAAA,EA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F;IACA,OAAON,QAAQ;EACjB;AACF;AA3JsBxB,MAAM,CAKnBvB,OAAO,GAAGA,OAAO"}
|
|
1
|
+
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","DEFAULT_DEVICE_PROPS","id","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","statsManager","userData","_lumaData","info","lost","canvasContext","toLowerCase","loseDevice","getCanvasContext","Error","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array","warn"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../lib/utils/stats-manager';\nimport {log} from '../lib/utils/log';\nimport {uid} from '../lib/utils/utils';\nimport type {TextureFormat} from './types/texture-formats';\nimport type {CanvasContext, CanvasContextProps} from './canvas-context';\nimport type {BufferProps} from './resources/buffer';\nimport {Buffer} from './resources/buffer';\nimport type {RenderPipeline, RenderPipelineProps} from './resources/render-pipeline';\nimport type {ComputePipeline, ComputePipelineProps} from './resources/compute-pipeline';\nimport type {Sampler, SamplerProps} from './resources/sampler';\nimport type {Shader, ShaderProps} from './resources/shader';\nimport type {Texture, TextureProps, TextureData} from './resources/texture';\nimport type {ExternalTexture, ExternalTextureProps} from './resources/external-texture';\nimport type {Framebuffer, FramebufferProps} from './resources/framebuffer';\nimport type {RenderPass, RenderPassProps} from './resources/render-pass';\nimport type {ComputePass, ComputePassProps} from './resources/compute-pass';\nimport type {CommandEncoder, CommandEncoderProps} from './resources/command-encoder';\nimport type {VertexArray, VertexArrayProps} from './resources/vertex-array';\nimport type {TransformFeedback, TransformFeedbackProps} from './resources/transform-feedback';\n\n/** Device properties */\nexport type DeviceProps = {\n id?: string;\n\n type?: 'webgl' | 'webgl1' | 'webgl2' | 'webgpu' | 'best-available';\n\n // Common parameters\n canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id\n container?: HTMLElement | string | null;\n width?: number /** width is only used when creating a new canvas */;\n height?: number /** height is only used when creating a new canvas */;\n\n // WebGLDevice parameters\n webgl2?: boolean; // Set to false to not create a WebGL2 context (force webgl1)\n webgl1?: boolean; // set to false to not create a WebGL1 context (fails if webgl2 not available)\n\n // WebGLContext PARAMETERS - Can only be set on context creation...\n // alpha?: boolean; // Default render target has an alpha buffer.\n // depth?: boolean; // Default render target has a depth buffer of at least 16 bits.\n // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits.\n // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing.\n // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low.\n\n // Unclear if these are still supported\n debug?: boolean; // Instrument context (at the expense of performance)\n manageState?: boolean; // Set to false to disable WebGL state management instrumentation\n break?: string[]; // TODO: types\n\n // @deprecated Attach to existing context\n gl?: WebGLRenderingContext | WebGL2RenderingContext | null;\n};\n\nexport const DEFAULT_DEVICE_PROPS: Required<DeviceProps> = {\n id: null!,\n type: 'best-available',\n canvas: null,\n container: null,\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n break: [],\n\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n\n gl: null\n};\n\nexport type ShadingLanguage = 'glsl' | 'wgsl';\n\n/**\n * Identifies the GPU vendor and driver.\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n * @note Current WebGPU support is very limited\n */\nexport type DeviceInfo = {\n type: 'webgl' | 'webgl2' | 'webgpu';\n vendor: string;\n renderer: string;\n version: string;\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n shadingLanguages: ShadingLanguage[];\n shadingLanguageVersions: Record<string, string>;\n vendorMasked?: string;\n rendererMasked?: string;\n};\n\n/** Limits for a device */\nexport type DeviceLimits = {\n readonly maxTextureDimension1D?: number;\n readonly maxTextureDimension2D?: number;\n readonly maxTextureDimension3D?: number;\n readonly maxTextureArrayLayers?: number;\n readonly maxBindGroups: number;\n readonly maxDynamicUniformBuffersPerPipelineLayout: number;\n readonly maxDynamicStorageBuffersPerPipelineLayout: number;\n readonly maxSampledTexturesPerShaderStage: number;\n readonly maxSamplersPerShaderStage: number;\n readonly maxStorageBuffersPerShaderStage: number;\n readonly maxStorageTexturesPerShaderStage: number;\n readonly maxUniformBuffersPerShaderStage: number;\n readonly maxUniformBufferBindingSize: number;\n readonly maxStorageBufferBindingSize?: number;\n readonly minUniformBufferOffsetAlignment?: number;\n readonly minStorageBufferOffsetAlignment?: number;\n readonly maxVertexBuffers?: number;\n readonly maxVertexAttributes: number;\n readonly maxVertexBufferArrayStride?: number;\n readonly maxInterStageShaderComponents?: number;\n readonly maxComputeWorkgroupStorageSize?: number;\n readonly maxComputeInvocationsPerWorkgroup?: number;\n readonly maxComputeWorkgroupSizeX?: number;\n readonly maxComputeWorkgroupSizeY?: number;\n readonly maxComputeWorkgroupSizeZ?: number;\n readonly maxComputeWorkgroupsPerDimension?: number;\n};\n\nexport type WebGPUDeviceFeature =\n | 'depth-clip-control'\n | 'depth24unorm-stencil8'\n | 'depth32float-stencil8'\n | 'timestamp-query'\n | 'indirect-first-instance'\n | 'texture-compression-bc'\n | 'texture-compression-etc2'\n | 'texture-compression-astc';\n\n// obsolete...\n// 'depth-clamping' |\n// 'depth24unorm-stencil8' |\n// 'depth32float-stencil8' |\n// 'pipeline-statistics-query' |\n// 'timestamp-query' |\n// 'texture-compression-bc'\n\nexport type WebGLDeviceFeature =\n | 'webgpu'\n | 'webgl2'\n | 'webgl'\n\n // api support (unify with WebGPU timestamp-query?)\n | 'timer-query-webgl'\n | 'uniform-buffers-webgl'\n | 'uniforms-webgl'\n\n // texture filtering\n | 'texture-filter-linear-float32-webgl'\n | 'texture-filter-linear-float16-webgl'\n | 'texture-filter-anisotropic-webgl'\n\n // texture rendering\n | 'texture-renderable-float32-webgl'\n | 'texture-renderable-float16-webgl'\n | 'texture-renderable-rgba32float-webgl' // TODO - remove\n\n // texture blending\n | 'texture-blend-float-webgl1'\n\n // texture format support\n | 'texture-formats-norm16-webgl'\n | 'texture-formats-srgb-webgl1'\n | 'texture-formats-depth-webgl1'\n | 'texture-formats-float32-webgl1'\n | 'texture-formats-float16-webgl1'\n\n // api support\n | 'vertex-array-object-webgl1'\n | 'instanced-rendering-webgl1'\n | 'multiple-render-targets-webgl1'\n | 'index-uint32-webgl1'\n | 'blend-minmax-webgl1'\n | 'transform-feedback-webgl2'\n\n // glsl extensions\n | 'glsl-frag-data'\n | 'glsl-frag-depth'\n | 'glsl-derivatives'\n | 'glsl-texture-lod';\n\ntype WebGLCompressedTextureFeatures =\n | 'texture-compression-bc5-webgl'\n | 'texture-compression-etc1-webgl'\n | 'texture-compression-pvrtc-webgl'\n | 'texture-compression-atc-webgl';\n\n/** Valid feature strings */\nexport type DeviceFeature =\n | WebGPUDeviceFeature\n | WebGLDeviceFeature\n | WebGLCompressedTextureFeatures;\n\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport abstract class Device {\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...DEFAULT_DEVICE_PROPS, ...props};\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n\n /** id of this device, primarily for debugging */\n readonly id: string;\n /** stats */\n readonly statsManager: StatsManager = lumaStats;\n /** A copy of the device props */\n readonly props: Required<DeviceProps>;\n /** Available for the application to store data on the device */\n userData: {[key: string]: unknown} = {};\n /** Used by other luma.gl modules to store data on the device */\n _lumaData: {[key: string]: unknown} = {};\n\n // Capabilities\n\n /** Information about the device (vendor, versions etc) */\n abstract info: DeviceInfo;\n\n /** Optional capability discovery */\n abstract get features(): Set<DeviceFeature>;\n\n /** WebGPU style device limits */\n abstract get limits(): DeviceLimits;\n\n /** Check if device supports a specific texture format (creation and `nearest` sampling) */\n abstract isTextureFormatSupported(format: TextureFormat): boolean;\n\n /** Check if linear filtering (sampler interpolation) is supported for a specific texture format */\n abstract isTextureFormatFilterable(format: TextureFormat): boolean;\n\n /** Check if device supports rendering to a specific texture format */\n abstract isTextureFormatRenderable(format: TextureFormat): boolean;\n\n // Device loss\n\n /** `true` if device is already lost */\n abstract get isLost(): boolean;\n\n /** Promise that resolves when device is lost */\n abstract readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n /**\n * Trigger device loss.\n * @returns `true` if context loss could actually be triggered.\n * @note primarily intended for testing how application reacts to device loss\n */\n loseDevice(): boolean {\n return false;\n }\n\n // Canvas context\n\n /** Default / primary canvas context. Can be null as WebGPU devices can be created without a CanvasContext */\n abstract canvasContext: CanvasContext | null;\n\n /** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */\n getCanvasContext(): CanvasContext {\n if (!this.canvasContext) {\n throw new Error('Device has no CanvasContext');\n }\n return this.canvasContext;\n }\n\n /** Creates a new CanvasContext (WebGPU only) */\n abstract createCanvasContext(props?: CanvasContextProps): CanvasContext;\n\n /** Call after rendering a frame (necessary e.g. on WebGL OffscreenCanvas) */\n abstract submit(): void;\n\n // Resource creation\n\n /** Create a buffer */\n abstract createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): Buffer;\n\n /** Create a texture */\n abstract _createTexture(props: TextureProps): Texture;\n createTexture(props: TextureProps): Texture;\n createTexture(data: Promise<TextureData>): Texture;\n createTexture(url: string): Texture;\n\n createTexture(props: TextureProps | Promise<TextureData> | string): Texture {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = {data: props};\n }\n return this._createTexture(props);\n }\n\n /** Create a temporary texture view of a video source */\n abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;\n\n /** Create a sampler */\n abstract createSampler(props: SamplerProps): Sampler;\n\n /** Create a Framebuffer. Must have at least one attachment. */\n abstract createFramebuffer(props: FramebufferProps): Framebuffer;\n\n /** Create a shader */\n abstract createShader(props: ShaderProps): Shader;\n\n /** Create a render pipeline (aka program) */\n abstract createRenderPipeline(props: RenderPipelineProps): RenderPipeline;\n\n /** Create a compute pipeline (aka program). WebGPU only. */\n abstract createComputePipeline(props: ComputePipelineProps): ComputePipeline;\n\n createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n /** Create a vertex array */\n abstract createVertexArray(props: VertexArrayProps): VertexArray;\n\n /** Create a RenderPass */\n abstract beginRenderPass(props?: RenderPassProps): RenderPass;\n\n /** Create a ComputePass */\n abstract beginComputePass(props?: ComputePassProps): ComputePass;\n\n /** Get a renderpass that is set up to render to the primary CanvasContext */\n abstract getDefaultRenderPass(): RenderPass;\n\n /** Create a transform feedback (immutable set of output buffer bindings). WebGL 2 only. */\n abstract createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;\n\n // Implementation\n\n protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps {\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n\n const newProps = {...props};\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n } else {\n log.warn('indices buffer content must be of integer type')();\n }\n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7 +42,7 @@ export declare abstract class Buffer extends Resource<BufferProps> {
|
|
|
42
42
|
abstract byteLength: number;
|
|
43
43
|
constructor(device: Device, props: BufferProps);
|
|
44
44
|
write(data: ArrayBufferView, byteOffset?: number): void;
|
|
45
|
-
readAsync(byteOffset?: number, byteLength?: number): Promise<
|
|
45
|
+
readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;
|
|
46
46
|
getData(): TypedArray;
|
|
47
47
|
}
|
|
48
48
|
//# sourceMappingURL=buffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,CAAC;IAC5C,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAGhC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAED,0BAA0B;AAC1B,8BAAsB,MAAO,SAAQ,QAAQ,CAAC,WAAW,CAAC;IACxD,OAAgB,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,CAQjD;IAGF,MAAM,CAAC,QAAQ,SAAQ;IACvB,MAAM,CAAC,SAAS,SAAQ;IACxB,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,IAAI,UAAU;CAoDtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","Buffer","constructor","device","props","deducedProps","usage","INDEX","indexType","data","Uint32Array","Uint16Array","defaultProps","byteLength","write","byteOffset","Error","readAsync","getData","mappedAtCreation","MAP_READ","MAP_WRITE","COPY_SRC","COPY_DST","VERTEX","UNIFORM","STORAGE","INDIRECT","QUERY_RESOLVE"],"sources":["../../../src/adapter/resources/buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {TypedArray} from '../..';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n\nexport type BufferProps = ResourceProps & {\n /** Supply a handle to connect to an existing device-specific buffer */\n handle?: WebGLBuffer;\n /** Specifies how this buffer can be used */\n usage?: number;\n /** Length in bytes of memory to be allocated. If not specified, `byteLength` of `props.data` will be used. */\n byteLength?: number;\n /** Data to initialize the buffer with. */\n data?: ArrayBuffer | ArrayBufferView | null;\n /** Byte offset into the newly created Buffer to store data at */\n byteOffset?: number;\n /** If props.usage includes Buffer.INDEX */\n indexType?: 'uint16' | 'uint32';\n\n // TBD\n mappedAtCreation?: boolean;\n}\n\n/** Abstract GPU buffer */\nexport abstract class Buffer extends Resource<BufferProps> {\n static override defaultProps: Required<BufferProps> = {\n ...Resource.defaultProps,\n usage: 0, // Buffer.COPY_DST | Buffer.COPY_SRC\n byteLength: 0,\n byteOffset: 0,\n data: null,\n indexType: 'uint16',\n mappedAtCreation: false\n };\n\n // Usage Flags\n static MAP_READ = 0x01;\n static MAP_WRITE = 0x02;\n static COPY_SRC = 0x0004;\n static COPY_DST = 0x0008;\n /** Index buffer */\n static INDEX = 0x0010;\n /** Vertex buffer */\n static VERTEX = 0x0020;\n /** Uniform buffer */\n static UNIFORM = 0x0040;\n /** Storage buffer */\n static STORAGE = 0x0080;\n static INDIRECT = 0x0100;\n static QUERY_RESOLVE = 0x0200;\n\n override get [Symbol.toStringTag](): string { return 'Buffer'; }\n\n /** The usage with which this buffer was created */\n readonly usage: number;\n /** For index buffers, whether indices are 16 or 32 bit */\n readonly indexType?: 'uint16' | 'uint32';\n /** Length of buffer in bytes */\n abstract byteLength: number;\n\n constructor(device: Device, props: BufferProps) {\n const deducedProps = {...props};\n\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n deducedProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n deducedProps.indexType = 'uint16';\n }\n }\n\n super(device, deducedProps, Buffer.defaultProps);\n\n this.usage = props.usage || 0;\n this.indexType = deducedProps.indexType;\n }\n\n write(data: ArrayBufferView, byteOffset?: number): void { throw new Error('not implemented'); }\n readAsync(byteOffset?: number, byteLength?: number): Promise<
|
|
1
|
+
{"version":3,"file":"buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","Buffer","constructor","device","props","deducedProps","usage","INDEX","indexType","data","Uint32Array","Uint16Array","defaultProps","byteLength","write","byteOffset","Error","readAsync","getData","mappedAtCreation","MAP_READ","MAP_WRITE","COPY_SRC","COPY_DST","VERTEX","UNIFORM","STORAGE","INDIRECT","QUERY_RESOLVE"],"sources":["../../../src/adapter/resources/buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {TypedArray} from '../..';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n\nexport type BufferProps = ResourceProps & {\n /** Supply a handle to connect to an existing device-specific buffer */\n handle?: WebGLBuffer;\n /** Specifies how this buffer can be used */\n usage?: number;\n /** Length in bytes of memory to be allocated. If not specified, `byteLength` of `props.data` will be used. */\n byteLength?: number;\n /** Data to initialize the buffer with. */\n data?: ArrayBuffer | ArrayBufferView | null;\n /** Byte offset into the newly created Buffer to store data at */\n byteOffset?: number;\n /** If props.usage includes Buffer.INDEX */\n indexType?: 'uint16' | 'uint32';\n\n // TBD\n mappedAtCreation?: boolean;\n}\n\n/** Abstract GPU buffer */\nexport abstract class Buffer extends Resource<BufferProps> {\n static override defaultProps: Required<BufferProps> = {\n ...Resource.defaultProps,\n usage: 0, // Buffer.COPY_DST | Buffer.COPY_SRC\n byteLength: 0,\n byteOffset: 0,\n data: null,\n indexType: 'uint16',\n mappedAtCreation: false\n };\n\n // Usage Flags\n static MAP_READ = 0x01;\n static MAP_WRITE = 0x02;\n static COPY_SRC = 0x0004;\n static COPY_DST = 0x0008;\n /** Index buffer */\n static INDEX = 0x0010;\n /** Vertex buffer */\n static VERTEX = 0x0020;\n /** Uniform buffer */\n static UNIFORM = 0x0040;\n /** Storage buffer */\n static STORAGE = 0x0080;\n static INDIRECT = 0x0100;\n static QUERY_RESOLVE = 0x0200;\n\n override get [Symbol.toStringTag](): string { return 'Buffer'; }\n\n /** The usage with which this buffer was created */\n readonly usage: number;\n /** For index buffers, whether indices are 16 or 32 bit */\n readonly indexType?: 'uint16' | 'uint32';\n /** Length of buffer in bytes */\n abstract byteLength: number;\n\n constructor(device: Device, props: BufferProps) {\n const deducedProps = {...props};\n\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n deducedProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n deducedProps.indexType = 'uint16';\n }\n }\n\n super(device, deducedProps, Buffer.defaultProps);\n\n this.usage = props.usage || 0;\n this.indexType = deducedProps.indexType;\n }\n\n write(data: ArrayBufferView, byteOffset?: number): void { throw new Error('not implemented'); }\n readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array> { throw new Error('not implemented'); }\n // TODO - can sync read be supported in WebGPU?\n getData(): TypedArray { throw new Error('not implemented'); }\n\n // Convenience API\n\n /** Read data from the buffer *\n async readAsync(options: {\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<ArrayBuffer> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n if (options.unmap ?? true) {\n this.unmap();\n }\n return arrayBuffer;\n }\n\n /** Write data to the buffer *\n async writeAsync(options: {\n data: ArrayBuffer,\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<void> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n const destArray = new Uint8Array(arrayBuffer);\n const srcArray = new Uint8Array(options.data);\n destArray.set(srcArray);\n if (options.unmap ?? true) {\n this.unmap();\n }\n }\n */\n\n // Mapped API (WebGPU)\n\n /** Maps the memory so that it can be read */\n // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>\n\n /** Get the mapped range of data for reading or writing */\n // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;\n\n /** unmap makes the contents of the buffer available to the GPU again */\n // abstract unmap(): void;\n}\n"],"mappings":";SAGQA,QAAQ;AAAAC,mBAAA,GAgDAC,MAAM,CAACC,WAAW;AA3BlC,OAAO,MAAeC,MAAM,SAASJ,QAAQ,CAAc;EA2BzD,KAAAC,mBAAA,IAA4C;IAAE,OAAO,QAAQ;EAAE;EAS/DI,WAAWA,CAACC,MAAc,EAAEC,KAAkB,EAAE;IAC9C,MAAMC,YAAY,GAAG;MAAC,GAAGD;IAAK,CAAC;IAG/B,IAAI,CAACA,KAAK,CAACE,KAAK,IAAI,CAAC,IAAIL,MAAM,CAACM,KAAK,IAAI,CAACH,KAAK,CAACI,SAAS,EAAE;MACzD,IAAIJ,KAAK,CAACK,IAAI,YAAYC,WAAW,EAAE;QACrCL,YAAY,CAACG,SAAS,GAAG,QAAQ;MACnC,CAAC,MAAM,IAAIJ,KAAK,CAACK,IAAI,YAAYE,WAAW,EAAE;QAC5CN,YAAY,CAACG,SAAS,GAAG,QAAQ;MACnC;IACF;IAEA,KAAK,CAACL,MAAM,EAAEE,YAAY,EAAEJ,MAAM,CAACW,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
3
|
export type CommandBufferProps = ResourceProps & {};
|
|
3
4
|
/**
|
|
@@ -6,6 +7,6 @@ export type CommandBufferProps = ResourceProps & {};
|
|
|
6
7
|
export declare abstract class CommandBuffer extends Resource<CommandBufferProps> {
|
|
7
8
|
static defaultProps: Required<CommandBufferProps>;
|
|
8
9
|
get [Symbol.toStringTag](): string;
|
|
9
|
-
constructor(props: CommandBufferProps);
|
|
10
|
+
constructor(device: Device, props: CommandBufferProps);
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=command-buffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAiBnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,EAChD,CAAC;AAEF;;GAEG;AACH,8BAAsB,aAAc,SAAQ,QAAQ,CAAC,kBAAkB,CAAC;IACtE,OAAgB,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAExD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,KAAK,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAiBnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,EAChD,CAAC;AAEF;;GAEG;AACH,8BAAsB,aAAc,SAAQ,QAAQ,CAAC,kBAAkB,CAAC;IACtE,OAAgB,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAExD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAGtD"}
|
|
@@ -5,8 +5,8 @@ export class CommandBuffer extends Resource {
|
|
|
5
5
|
get [_Symbol$toStringTag]() {
|
|
6
6
|
return 'CommandBuffer';
|
|
7
7
|
}
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props, CommandBuffer.defaultProps);
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, CommandBuffer.defaultProps);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
CommandBuffer.defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","CommandBuffer","constructor","props","defaultProps"],"sources":["../../../src/adapter/resources/command-buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Resource, ResourceProps} from './resource';\n\n// interface Queue {\n// submit(commandBuffers);\n\n// // onSubmittedWorkDone(): Promise<undefined>;\n\n// writeBuffer(options: WriteBufferOptions): void;\n// writeTexture(options: WriteTextureOptions): void;\n\n// // copyExternalImageToTexture(\n// // GPUImageCopyExternalImage source,\n// // GPUImageCopyTextureTagged destination,\n// // GPUExtent3D copySize\n// // ): void;\n// }\n\nexport type CommandBufferProps = ResourceProps & {\n};\n\n/**\n * Encodes commands to queue that can be executed later\n */\nexport abstract class CommandBuffer extends Resource<CommandBufferProps> {\n static override defaultProps: Required<CommandBufferProps> = {\n ...Resource.defaultProps\n };\n \n override get [Symbol.toStringTag](): string {\n return 'CommandBuffer';\n }\n\n constructor(props: CommandBufferProps) {\n
|
|
1
|
+
{"version":3,"file":"command-buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","CommandBuffer","constructor","device","props","defaultProps"],"sources":["../../../src/adapter/resources/command-buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport { Device } from '../device';\nimport {Resource, ResourceProps} from './resource';\n\n// interface Queue {\n// submit(commandBuffers);\n\n// // onSubmittedWorkDone(): Promise<undefined>;\n\n// writeBuffer(options: WriteBufferOptions): void;\n// writeTexture(options: WriteTextureOptions): void;\n\n// // copyExternalImageToTexture(\n// // GPUImageCopyExternalImage source,\n// // GPUImageCopyTextureTagged destination,\n// // GPUExtent3D copySize\n// // ): void;\n// }\n\nexport type CommandBufferProps = ResourceProps & {\n};\n\n/**\n * Encodes commands to queue that can be executed later\n */\nexport abstract class CommandBuffer extends Resource<CommandBufferProps> {\n static override defaultProps: Required<CommandBufferProps> = {\n ...Resource.defaultProps\n };\n \n override get [Symbol.toStringTag](): string {\n return 'CommandBuffer';\n }\n\n constructor(device: Device, props: CommandBufferProps) {\n super(device, props, CommandBuffer.defaultProps);\n }\n}\n"],"mappings":";SAEQA,QAAQ;AAAAC,mBAAA,GA4BAC,MAAM,CAACC,WAAW;AALlC,OAAO,MAAeC,aAAa,SAASJ,QAAQ,CAAqB;EAKvE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,eAAe;EACxB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAAyB,EAAE;IACrD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,aAAa,CAACI,YAAY,CAAC;EAClD;AACF;AAZsBJ,aAAa,CACjBI,YAAY,GAAiC;EAC3D,GAAGR,QAAQ,CAACQ;AACd,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Resource, ResourceProps } from './resource';
|
|
|
7
7
|
import type { Shader } from './shader';
|
|
8
8
|
import type { RenderPass } from './render-pass';
|
|
9
9
|
import { VertexArray } from './vertex-array';
|
|
10
|
+
import { TransformFeedback } from './transform-feedback';
|
|
10
11
|
export type RenderPipelineProps = ResourceProps & {
|
|
11
12
|
/** Compiled vertex shader */
|
|
12
13
|
vs?: Shader | null;
|
|
@@ -79,6 +80,8 @@ export declare abstract class RenderPipeline extends Resource<RenderPipelineProp
|
|
|
79
80
|
/** First instance to draw from */
|
|
80
81
|
firstInstance?: number;
|
|
81
82
|
baseVertex?: number;
|
|
83
|
+
/** Transform feedback. WebGL 2 only. */
|
|
84
|
+
transformFeedback?: TransformFeedback;
|
|
82
85
|
}): void;
|
|
83
86
|
}
|
|
84
87
|
//# sourceMappingURL=render-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AACrF,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AACrF,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAC,QAAQ,EAAE,aAA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
1
|
-
{"version":3,"file":"render-pipeline.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","RenderPipeline","constructor","device","props","defaultProps","hash","vs","fs","shaderLayout","bufferLayout","vsEntryPoint","vsConstants","fsEntryPoint","fsConstants","topology","parameters","vertexCount","instanceCount","bindings","uniforms"],"sources":["../../../src/adapter/resources/render-pipeline.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport type {UniformValue} from '../types/types';\nimport type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters';\nimport type {ShaderLayout, Binding} from '../types/shader-layout';\nimport type {BufferLayout} from '../types/buffer-layout';\n// import {normalizeAttributeMap} from '../helpers/attribute-bindings';\nimport {Resource, ResourceProps} from './resource';\nimport type {Shader} from './shader';\nimport type {RenderPass} from './render-pass';\nimport {VertexArray} from './vertex-array';\n\nexport type RenderPipelineProps = ResourceProps & {\n // Shaders and shader layout\n\n /** Compiled vertex shader */\n vs?: Shader | null;\n /** Vertex shader entry point (defaults to 'main'). WGSL only */\n vsEntryPoint?: string; //\n /** Constants to apply to compiled vertex shader (WGSL only) */\n vsConstants?: Record<string, number>; // WGSL only\n /** Compiled fragment shader */\n fs?: Shader | null;\n /** Fragment shader entry point (defaults to 'main'). WGSL only */\n fsEntryPoint?: string; // WGSL only\n /** Constants to apply to compiled fragment shader (WGSL only) */\n fsConstants?: Record<string, number>;\n\n /** Describes the attributes and bindings exposed by the pipeline shader(s). */\n shaderLayout?: ShaderLayout | null;\n /**\n * Describes the buffers accepted by this pipeline and how they are mapped to shader attributes.\n * A default mapping of one buffer per attribute is always created.\n */\n bufferLayout?: BufferLayout[]
|
|
1
|
+
{"version":3,"file":"render-pipeline.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","RenderPipeline","constructor","device","props","defaultProps","hash","vs","fs","shaderLayout","bufferLayout","vsEntryPoint","vsConstants","fsEntryPoint","fsConstants","topology","parameters","vertexCount","instanceCount","bindings","uniforms"],"sources":["../../../src/adapter/resources/render-pipeline.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport type {UniformValue} from '../types/types';\nimport type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters';\nimport type {ShaderLayout, Binding} from '../types/shader-layout';\nimport type {BufferLayout} from '../types/buffer-layout';\n// import {normalizeAttributeMap} from '../helpers/attribute-bindings';\nimport {Resource, ResourceProps} from './resource';\nimport type {Shader} from './shader';\nimport type {RenderPass} from './render-pass';\nimport {VertexArray} from './vertex-array';\nimport {TransformFeedback} from './transform-feedback';\n\nexport type RenderPipelineProps = ResourceProps & {\n // Shaders and shader layout\n\n /** Compiled vertex shader */\n vs?: Shader | null;\n /** Vertex shader entry point (defaults to 'main'). WGSL only */\n vsEntryPoint?: string; //\n /** Constants to apply to compiled vertex shader (WGSL only) */\n vsConstants?: Record<string, number>; // WGSL only\n /** Compiled fragment shader */\n fs?: Shader | null;\n /** Fragment shader entry point (defaults to 'main'). WGSL only */\n fsEntryPoint?: string; // WGSL only\n /** Constants to apply to compiled fragment shader (WGSL only) */\n fsConstants?: Record<string, number>;\n\n /** Describes the attributes and bindings exposed by the pipeline shader(s). */\n shaderLayout?: ShaderLayout | null;\n /**\n * Describes the buffers accepted by this pipeline and how they are mapped to shader attributes.\n * A default mapping of one buffer per attribute is always created.\n */\n bufferLayout?: BufferLayout[]; // Record<string, Omit<BufferLayout, 'name'>\n\n /** Determines how vertices are read from the 'vertex' attributes */\n topology?: PrimitiveTopology;\n /** Parameters that are controlled by pipeline */\n parameters?: RenderPipelineParameters;\n\n // Can be changed after creation\n // TODO make pipeline immutable? these could be supplied to draw as parameters, in WebGPU they are set on the render pass\n\n /** Number of vertices */\n vertexCount?: number;\n /** Number of instances */\n instanceCount?: number;\n\n /** Buffers, Textures, Samplers for the shader bindings */\n bindings?: Record<string, Binding>;\n /** @deprecated uniforms (WebGL only) */\n uniforms?: Record<string, UniformValue>;\n};\n\n/**\n * A compiled and linked shader program\n */\nexport abstract class RenderPipeline extends Resource<RenderPipelineProps> {\n static override defaultProps: Required<RenderPipelineProps> = {\n ...Resource.defaultProps,\n\n vs: null,\n vsEntryPoint: '', // main\n vsConstants: {},\n\n fs: null,\n fsEntryPoint: '', // main\n fsConstants: {},\n\n shaderLayout: null,\n bufferLayout: [],\n topology: 'triangle-list',\n parameters: {},\n\n vertexCount: 0,\n instanceCount: 0,\n\n bindings: {},\n uniforms: {}\n };\n\n override get [Symbol.toStringTag](): string {\n return 'RenderPipeline';\n }\n\n hash: string = '';\n abstract readonly vs: Shader;\n abstract readonly fs: Shader | null;\n /** The merged layout */\n shaderLayout: ShaderLayout;\n /** Buffer map describing buffer interleaving etc */\n readonly bufferLayout: BufferLayout[];\n\n constructor(device: Device, props: RenderPipelineProps) {\n super(device, props, RenderPipeline.defaultProps);\n this.shaderLayout = this.props.shaderLayout;\n this.bufferLayout = this.props.bufferLayout || [];\n }\n\n /** Set bindings (stored on pipeline and set before each call) */\n abstract setBindings(bindings: Record<string, Binding>): void;\n /** Uniforms\n * @deprecated Only supported on WebGL devices.\n * @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.\n * @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.\n */\n abstract setUniforms(bindings: Record<string, UniformValue>): void;\n\n /** Draw call */\n abstract draw(options: {\n /** Render pass to draw into (targeting screen or framebuffer) */\n renderPass?: RenderPass;\n /** vertex attributes */\n vertexArray: VertexArray;\n /** Number of \"rows\" in 'vertex' buffers */\n vertexCount?: number;\n /** Number of \"rows\" in 'instance' buffers */\n instanceCount?: number;\n /** First vertex to draw from */\n firstVertex?: number;\n /** First index to draw from */\n firstIndex?: number;\n /** First instance to draw from */\n firstInstance?: number;\n baseVertex?: number;\n /** Transform feedback. WebGL 2 only. */\n transformFeedback?: TransformFeedback;\n }): void;\n}\n"],"mappings":";SAOQA,QAAQ;AAAAC,mBAAA,GA4EAC,MAAM,CAACC,WAAW;AAxBlC,OAAO,MAAeC,cAAc,SAASJ,QAAQ,CAAsB;EAwBzE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,gBAAgB;EACzB;EAUAI,WAAWA,CAACC,MAAc,EAAEC,KAA0B,EAAE;IACtD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,cAAc,CAACI,YAAY,CAAC;IAAC,KATpDC,IAAI,GAAW,EAAE;IAAA,KACCC,EAAE;IAAA,KACFC,EAAE;IAAA,KAEpBC,YAAY;IAAA,KAEHC,YAAY;IAInB,IAAI,CAACD,YAAY,GAAG,IAAI,CAACL,KAAK,CAACK,YAAY;IAC3C,IAAI,CAACC,YAAY,GAAG,IAAI,CAACN,KAAK,CAACM,YAAY,IAAI,EAAE;EACnD;AA+BF;AAvEsBT,cAAc,CAClBI,YAAY,GAAkC;EAC5D,GAAGR,QAAQ,CAACQ,YAAY;EAExBE,EAAE,EAAE,IAAI;EACRI,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,CAAC,CAAC;EAEfJ,EAAE,EAAE,IAAI;EACRK,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,CAAC,CAAC;EAEfL,YAAY,EAAE,IAAI;EAClBC,YAAY,EAAE,EAAE;EAChBK,QAAQ,EAAE,eAAe;EACzBC,UAAU,EAAE,CAAC,CAAC;EAEdC,WAAW,EAAE,CAAC;EACdC,aAAa,EAAE,CAAC;EAEhBC,QAAQ,EAAE,CAAC,CAAC;EACZC,QAAQ,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Device } from '../device';
|
|
2
|
+
import { ShaderLayout } from '../types/shader-layout';
|
|
3
|
+
import type { Buffer } from './buffer';
|
|
4
|
+
import { Resource, ResourceProps } from './resource';
|
|
5
|
+
/** For bindRange */
|
|
6
|
+
type BufferRange = {
|
|
7
|
+
buffer: Buffer;
|
|
8
|
+
byteOffset?: number;
|
|
9
|
+
byteLength?: number;
|
|
10
|
+
};
|
|
11
|
+
/** Configures a set of output buffers for pipeline (WebGL 2 only) */
|
|
12
|
+
export type TransformFeedbackProps = ResourceProps & {
|
|
13
|
+
/** Layout of shader (for varyings) */
|
|
14
|
+
layout: ShaderLayout;
|
|
15
|
+
/** Buffer bindings (for varyings) */
|
|
16
|
+
buffers: Record<string, Buffer | BufferRange>;
|
|
17
|
+
};
|
|
18
|
+
/** Holds a set of output buffers for pipeline (WebGL 2 only) */
|
|
19
|
+
export declare abstract class TransformFeedback extends Resource<TransformFeedbackProps> {
|
|
20
|
+
static defaultProps: Required<TransformFeedbackProps>;
|
|
21
|
+
get [Symbol.toStringTag](): string;
|
|
22
|
+
constructor(device: Device, props?: TransformFeedbackProps);
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=transform-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/transform-feedback.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEnD,oBAAoB;AACpB,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF,gEAAgE;AAChE,8BAAsB,iBAAkB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAC9E,OAAgB,YAAY,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAI5D;IAEF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,sBAAsB;CAG3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let _Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4
|
+
export class TransformFeedback extends Resource {
|
|
5
|
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'TransformFeedback';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, TransformFeedback.defaultProps);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
TransformFeedback.defaultProps = {
|
|
13
|
+
...Resource.defaultProps,
|
|
14
|
+
layout: undefined,
|
|
15
|
+
buffers: {}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=transform-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-feedback.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","TransformFeedback","constructor","device","props","defaultProps","layout","undefined","buffers"],"sources":["../../../src/adapter/resources/transform-feedback.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {ShaderLayout} from '../types/shader-layout';\nimport type {Buffer} from './buffer';\nimport {Resource, ResourceProps} from './resource';\n\n/** For bindRange */\ntype BufferRange = {\n buffer: Buffer;\n byteOffset?: number;\n byteLength?: number;\n};\n\n/** Configures a set of output buffers for pipeline (WebGL 2 only) */\nexport type TransformFeedbackProps = ResourceProps & {\n /** Layout of shader (for varyings) */\n layout: ShaderLayout;\n /** Buffer bindings (for varyings) */\n buffers: Record<string, Buffer | BufferRange>;\n};\n\n/** Holds a set of output buffers for pipeline (WebGL 2 only) */\nexport abstract class TransformFeedback extends Resource<TransformFeedbackProps> {\n static override defaultProps: Required<TransformFeedbackProps> = {\n ...Resource.defaultProps,\n layout: undefined!,\n buffers: {}\n };\n\n get [Symbol.toStringTag](): string {\n return 'TransformFeedback';\n }\n\n constructor(device: Device, props?: TransformFeedbackProps) {\n super(device, props, TransformFeedback.defaultProps);\n }\n}\n"],"mappings":";SAIQA,QAAQ;AAAAC,mBAAA,GAyBTC,MAAM,CAACC,WAAW;AAPzB,OAAO,MAAeC,iBAAiB,SAASJ,QAAQ,CAAyB;EAO/E,KAAAC,mBAAA,IAAmC;IACjC,OAAO,mBAAmB;EAC5B;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAA8B,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,iBAAiB,CAACI,YAAY,CAAC;EACtD;AACF;AAdsBJ,iBAAiB,CACrBI,YAAY,GAAqC;EAC/D,GAAGR,QAAQ,CAACQ,YAAY;EACxBC,MAAM,EAAEC,SAAU;EAClBC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -34,7 +34,7 @@ export type ShaderLayout = {
|
|
|
34
34
|
/** WebGL only (WebGPU use bindings and uniform buffers) */
|
|
35
35
|
uniforms?: any[];
|
|
36
36
|
/** WebGL2 only (WebGPU use compute shaders) */
|
|
37
|
-
varyings?:
|
|
37
|
+
varyings?: VaryingBinding[];
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Declares one for attributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/shader-layout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAC,iBAAiB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAC,MAAM,E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MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,kBAAkB;AAClB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-layout.js","names":[],"sources":["../../../src/adapter/types/shader-layout.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TextureFormat} from '../types/texture-formats';\nimport type {ShaderUniformType, ShaderAttributeType} from './shader-types';\nimport {AccessorObject} from '../types/accessor';\nimport type {Buffer} from '../resources/buffer';\nimport type {Sampler} from '../resources/sampler';\nimport type {Texture} from '../resources/texture';\n\n/**\n * Describes all shader binding points for a `RenderPipeline` or `ComputePipeline`\n * A ShaderLayout describes the static structure of a shader pipeline.\n * It also allows the numeric locations in the shader to accessed with the same variable names\n * used in the shader.\n * @note A ShaderLayout needs to be complemented by a BufferLayout that describes \n * the actual memory layout of the buffers that will be used with the pipeline.\n * \n * @example\n * ```\n device.createRenderPipeline({\n shaderLayout: [\n attributes: [\n {name: 'instancePositions', location: 0, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'instanceVelocities', location: 1, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'vertexPositions', location: 2, format: 'vec3<f32>', stepMode: 'vertex'}\n ],\n bindings: [...]\n ]\n })\n * ```\n */\nexport type ShaderLayout = {\n /** All attributes, their locations, and basic type information. Also an auto-deduced step mode */\n attributes: AttributeDeclaration[];\n /** All bidning points (textures, samplers, uniform buffers) with their locations and type */\n bindings: BindingDeclaration[];\n /** WebGL only (WebGPU use bindings and uniform buffers) */\n uniforms?: any[];\n /** WebGL2 only (WebGPU use compute shaders) */\n varyings?:
|
|
1
|
+
{"version":3,"file":"shader-layout.js","names":[],"sources":["../../../src/adapter/types/shader-layout.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TextureFormat} from '../types/texture-formats';\nimport type {ShaderUniformType, ShaderAttributeType} from './shader-types';\nimport {AccessorObject} from '../types/accessor';\nimport type {Buffer} from '../resources/buffer';\nimport type {Sampler} from '../resources/sampler';\nimport type {Texture} from '../resources/texture';\n\n/**\n * Describes all shader binding points for a `RenderPipeline` or `ComputePipeline`\n * A ShaderLayout describes the static structure of a shader pipeline.\n * It also allows the numeric locations in the shader to accessed with the same variable names\n * used in the shader.\n * @note A ShaderLayout needs to be complemented by a BufferLayout that describes \n * the actual memory layout of the buffers that will be used with the pipeline.\n * \n * @example\n * ```\n device.createRenderPipeline({\n shaderLayout: [\n attributes: [\n {name: 'instancePositions', location: 0, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'instanceVelocities', location: 1, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'vertexPositions', location: 2, format: 'vec3<f32>', stepMode: 'vertex'}\n ],\n bindings: [...]\n ]\n })\n * ```\n */\nexport type ShaderLayout = {\n /** All attributes, their locations, and basic type information. Also an auto-deduced step mode */\n attributes: AttributeDeclaration[];\n /** All bidning points (textures, samplers, uniform buffers) with their locations and type */\n bindings: BindingDeclaration[];\n /** WebGL only (WebGPU use bindings and uniform buffers) */\n uniforms?: any[];\n /** WebGL2 only (WebGPU use compute shaders) */\n varyings?: VaryingBinding[];\n};\n\n/**\n * Declares one for attributes\n */\nexport type AttributeDeclaration = {\n /** The name of this attribute in the shader */\n name: string;\n /** The index into the GPU's vertex array buffer bank (usually between 0-15) */\n location: number;\n /** WebGPU-style shader type. The declared format of the attribute in the shader code. Buffer's vertex format needs to map to this. */\n type: ShaderAttributeType;\n /** Inferred from attribute name. @note Technically not part of static structure of shader */\n stepMode?: 'vertex' | 'instance';\n};\n\n// BINDING LAYOUTS\n\n/*\ntype Binding = {\n binding: number;\n visibility: number;\n\n buffer?: {\n type?: 'uniform' | 'storage' | 'read-only-storage';\n hasDynamicOffset?: false;\n minBindingSize?: number;\n };\n\n // type = sampler\n samplerType?: 'filtering' | 'non-filtering' | 'comparison';\n\n // type = texture\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n multisampled?: boolean;\n\n // type = storage\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n access: 'read-only' | 'write-only';\n format: string;\n};\n*/\n\n/** ShaderLayout for bindings */\nexport type BindingDeclaration =\n | UniformBufferBindingLayout\n | BufferBindingLayout\n | TextureBindingLayout\n | SamplerBindingLayout\n | StorageTextureBindingLayout;\n\nexport type UniformBufferBindingLayout = {\n type: 'uniform';\n name: string;\n location: number;\n visibility?: number;\n hasDynamicOffset?: boolean;\n minBindingSize?: number;\n uniforms?: UniformInfo[];\n};\n\nexport type UniformInfo = {\n name: string;\n format: ShaderUniformType;\n type?: string;\n arrayLength: number;\n byteOffset: number;\n byteStride: number;\n};\n\nexport type BufferBindingLayout = {\n type: 'uniform' | 'storage' | 'read-only-storage';\n name: string;\n location: number;\n visibility?: number;\n hasDynamicOffset?: boolean;\n minBindingSize?: number;\n};\n\ntype TextureBindingLayout = {\n type: 'texture';\n name: string;\n location: number;\n visibility?: number;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d'; // default: '2d'\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint'; // default: 'float'\n multisampled?: boolean;\n};\n\ntype SamplerBindingLayout = {\n type: 'sampler';\n name: string;\n location: number;\n visibility?: number;\n samplerType?: 'filtering' | 'non-filtering' | 'comparison'; // default: filtering\n};\n\ntype StorageTextureBindingLayout = {\n type: 'storage';\n name: string;\n location: number;\n visibility?: number;\n access?: 'write-only';\n format: TextureFormat;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n};\n\n// BINDINGS\n\n/** Binding value */\nexport type Binding = Texture | Sampler | Buffer | {buffer: Buffer; offset?: number; size?: number};\n\n// SHADER LAYOUTS\n\n/**\n * Describes a varying binding for a program\n * @deprecated Varyings are WebGL-only\n */\nexport type VaryingBinding = {\n location: number;\n name: string;\n accessor: AccessorObject;\n};\n\n// Uniform bindings\n\n/** Describes a uniform block binding for a program */\nexport type UniformBlockBinding = {\n location: number;\n name: string;\n byteLength: number;\n vertex: boolean;\n fragment: boolean;\n uniformCount: number;\n uniformIndices?: number[];\n uniforms: UniformInfo[];\n};\n\n/** Describes a uniform (sampler etc) binding for a program */\nexport type UniformBinding = {\n location: number;\n name: string;\n size: number;\n type: number;\n isArray: boolean;\n};\n\n/** @deprecated */\nexport type AttributeBinding = {\n name: string;\n location: number;\n accessor: AccessorObject;\n};\n"],"mappings":""}
|
package/dist/dist.dev.js
CHANGED
|
@@ -48,6 +48,7 @@ var __exports__ = (() => {
|
|
|
48
48
|
Shader: () => Shader,
|
|
49
49
|
StatsManager: () => StatsManager,
|
|
50
50
|
Texture: () => Texture,
|
|
51
|
+
TransformFeedback: () => TransformFeedback,
|
|
51
52
|
UniformBlock: () => UniformBlock,
|
|
52
53
|
UniformBufferLayout: () => UniformBufferLayout,
|
|
53
54
|
UniformStore: () => UniformStore,
|
|
@@ -1174,10 +1175,10 @@ var __exports__ = (() => {
|
|
|
1174
1175
|
// Device loss
|
|
1175
1176
|
/** `true` if device is already lost */
|
|
1176
1177
|
/** Promise that resolves when device is lost */
|
|
1177
|
-
/**
|
|
1178
|
-
* Trigger device loss.
|
|
1179
|
-
* @returns `true` if context loss could actually be triggered.
|
|
1180
|
-
* @note primarily intended for testing how application reacts to device loss
|
|
1178
|
+
/**
|
|
1179
|
+
* Trigger device loss.
|
|
1180
|
+
* @returns `true` if context loss could actually be triggered.
|
|
1181
|
+
* @note primarily intended for testing how application reacts to device loss
|
|
1181
1182
|
*/
|
|
1182
1183
|
loseDevice() {
|
|
1183
1184
|
return false;
|
|
@@ -1206,9 +1207,10 @@ var __exports__ = (() => {
|
|
|
1206
1207
|
}
|
|
1207
1208
|
/** Create a temporary texture view of a video source */
|
|
1208
1209
|
/** Create a sampler */
|
|
1210
|
+
/** Create a Framebuffer. Must have at least one attachment. */
|
|
1209
1211
|
/** Create a shader */
|
|
1210
1212
|
/** Create a render pipeline (aka program) */
|
|
1211
|
-
/** Create a compute pipeline (aka program) */
|
|
1213
|
+
/** Create a compute pipeline (aka program). WebGPU only. */
|
|
1212
1214
|
createCommandEncoder(props = {}) {
|
|
1213
1215
|
throw new Error("not implemented");
|
|
1214
1216
|
}
|
|
@@ -1216,7 +1218,8 @@ var __exports__ = (() => {
|
|
|
1216
1218
|
/** Create a RenderPass */
|
|
1217
1219
|
/** Create a ComputePass */
|
|
1218
1220
|
/** Get a renderpass that is set up to render to the primary CanvasContext */
|
|
1219
|
-
|
|
1221
|
+
/** Create a transform feedback (immutable set of output buffer bindings). WebGL 2 only. */
|
|
1222
|
+
// Implementation
|
|
1220
1223
|
_getBufferProps(props) {
|
|
1221
1224
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
1222
1225
|
props = {
|
|
@@ -1889,10 +1892,10 @@ var __exports__ = (() => {
|
|
|
1889
1892
|
this.bufferLayout = this.props.bufferLayout || [];
|
|
1890
1893
|
}
|
|
1891
1894
|
/** Set bindings (stored on pipeline and set before each call) */
|
|
1892
|
-
/** Uniforms
|
|
1895
|
+
/** Uniforms
|
|
1893
1896
|
* @deprecated Only supported on WebGL devices.
|
|
1894
1897
|
* @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.
|
|
1895
|
-
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
1898
|
+
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
1896
1899
|
*/
|
|
1897
1900
|
/** Draw call */
|
|
1898
1901
|
};
|
|
@@ -2060,8 +2063,8 @@ var __exports__ = (() => {
|
|
|
2060
2063
|
get [Symbol.toStringTag]() {
|
|
2061
2064
|
return "CommandBuffer";
|
|
2062
2065
|
}
|
|
2063
|
-
constructor(props) {
|
|
2064
|
-
super(props, _CommandBuffer.defaultProps);
|
|
2066
|
+
constructor(device, props) {
|
|
2067
|
+
super(device, props, _CommandBuffer.defaultProps);
|
|
2065
2068
|
}
|
|
2066
2069
|
};
|
|
2067
2070
|
var CommandBuffer = _CommandBuffer;
|
|
@@ -2353,6 +2356,22 @@ var __exports__ = (() => {
|
|
|
2353
2356
|
renderPipeline: null
|
|
2354
2357
|
});
|
|
2355
2358
|
|
|
2359
|
+
// src/adapter/resources/transform-feedback.ts
|
|
2360
|
+
var _TransformFeedback = class extends Resource {
|
|
2361
|
+
get [Symbol.toStringTag]() {
|
|
2362
|
+
return "TransformFeedback";
|
|
2363
|
+
}
|
|
2364
|
+
constructor(device, props) {
|
|
2365
|
+
super(device, props, _TransformFeedback.defaultProps);
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
var TransformFeedback = _TransformFeedback;
|
|
2369
|
+
__publicField(TransformFeedback, "defaultProps", {
|
|
2370
|
+
...Resource.defaultProps,
|
|
2371
|
+
layout: void 0,
|
|
2372
|
+
buffers: {}
|
|
2373
|
+
});
|
|
2374
|
+
|
|
2356
2375
|
// src/lib/utils/assert.ts
|
|
2357
2376
|
function assert2(condition, message) {
|
|
2358
2377
|
if (!condition) {
|