@luma.gl/core 9.0.0-beta.1 → 9.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/device.d.ts +11 -0
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +9 -0
- package/dist/adapter/device.js.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -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/shader.d.ts +1 -1
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +3 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js.map +1 -1
- package/dist/dist.dev.js +16 -3
- package/dist/index.cjs +32 -7
- package/dist/lib/compiler-log/format-compiler-log.js +5 -1
- package/dist/lib/compiler-log/format-compiler-log.js.map +1 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-store.js +2 -2
- package/dist/lib/uniforms/uniform-store.js.map +1 -1
- package/dist.min.js +20 -20
- package/package.json +2 -2
- package/src/adapter/device.ts +17 -1
- package/src/adapter/resources/render-pipeline.ts +2 -0
- package/src/adapter/resources/shader.ts +6 -4
- package/src/adapter/resources/vertex-array.ts +3 -1
- package/src/lib/compiler-log/format-compiler-log.ts +11 -1
- package/src/lib/uniforms/uniform-store.ts +21 -10
package/dist/adapter/device.d.ts
CHANGED
|
@@ -202,6 +202,17 @@ export declare abstract class Device {
|
|
|
202
202
|
sourceHeight?: number;
|
|
203
203
|
sourceType?: number;
|
|
204
204
|
}): Buffer;
|
|
205
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
206
|
+
setParametersWebGL(parameters: any): void;
|
|
207
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
208
|
+
withParametersWebGL(parameters: any, func: any): any;
|
|
209
|
+
/** @deprecated - will be removed - should use clear arguments in RenderPass */
|
|
210
|
+
clearWebGL(options?: {
|
|
211
|
+
framebuffer?: Framebuffer;
|
|
212
|
+
color?: any;
|
|
213
|
+
depth?: any;
|
|
214
|
+
stencil?: any;
|
|
215
|
+
}): void;
|
|
205
216
|
protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps;
|
|
206
217
|
}
|
|
207
218
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter/device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAY,MAAM,wBAAwB,CAAC;AAG/D,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,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,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GACA,UAAU,GAAG,WAAW,GAAG,YAAY;IAI1C,iEAAiE;IACjE,wBAAwB,CACtB,MAAM,EAAE,WAAW,GAAG,OAAO,EAC7B,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAE1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GACA,MAAM;IAIT,8EAA8E;IAC9E,kBAAkB,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IAIzC,8EAA8E;IAC9E,mBAAmB,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG;IAIpD,+EAA+E;IAC/E,UAAU,CAAC,OAAO,CAAC,EAAE;QAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAC,GAAG,IAAI;IAMhG,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW;CAqB3F"}
|
package/dist/adapter/device.js
CHANGED
|
@@ -51,6 +51,15 @@ export class Device {
|
|
|
51
51
|
readPixelsToBufferWebGL2(source, options) {
|
|
52
52
|
throw new Error('not implemented');
|
|
53
53
|
}
|
|
54
|
+
setParametersWebGL(parameters) {
|
|
55
|
+
throw new Error('not implemented');
|
|
56
|
+
}
|
|
57
|
+
withParametersWebGL(parameters, func) {
|
|
58
|
+
throw new Error('not implemented');
|
|
59
|
+
}
|
|
60
|
+
clearWebGL(options) {
|
|
61
|
+
throw new Error('not implemented');
|
|
62
|
+
}
|
|
54
63
|
_getBufferProps(props) {
|
|
55
64
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
56
65
|
props = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","id","statsManager","userData","_lumaData","info","lost","canvasContext","defaultProps","toLowerCase","loseDevice","getCanvasContext","Error","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","readPixelsToArrayWebGL","source","options","readPixelsToBufferWebGL2","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array","warn","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../utils/stats-manager';\nimport {log} from '../utils/log';\nimport {uid} from '../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\n/**\n * Identifies the GPU vendor and driver.\n * @note Chrome WebGPU does not provide much information, though more can be enabled with\n * @see https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates\n * chrome://flags/#enable-webgpu-developer-features\n */\nexport type DeviceInfo = {\n /** Type of device */\n type: 'webgl' | 'webgl2' | 'webgpu';\n /** Vendor (name of GPU vendor, Apple, nVidia etc */\n vendor: string;\n /** Renderer (usually driver name) */\n renderer: string;\n /** version of driver */\n version: string;\n /** family of GPU */\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n /** Type of GPU () */\n gpuType: 'discrete' | 'integrated' | 'cpu' | 'unknown';\n /** GPU architecture */\n gpuArchitecture?: string; // 'common-3' on Apple\n /** GPU driver backend. Can sometimes be sniffed */\n gpuBackend?: 'opengl' | 'opengles' | 'metal' | 'd3d11' | 'd3d12' | 'vulkan' | 'unknown';\n /** If this is a fallback adapter */\n fallback?: boolean;\n /** Shader language supported by device.createShader() */\n shadingLanguage: 'wgsl' | 'glsl';\n /** Highest supported shader language version (GLSL 3.00 = 300, GLSL 1.00 = 100) */\n shadingLanguageVersion: number;\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\n static defaultProps: 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 \n\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...Device.defaultProps, ...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 abstract destroy(): void;\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 /** 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 createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n // HACKS - until we have a better way to handle these\n\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToArrayWebGL(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n sourceAttachment?: number;\n target?: Uint8Array | Uint16Array | Float32Array;\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Uint8Array | Uint16Array | Float32Array {\n throw new Error('not implemented');\n }\n \n /** @deprecated - will be removed - should use command encoder */\n readPixelsToBufferWebGL2(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Buffer {\n throw new Error('not implemented');\n }\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 }\n return newProps;\n }\n}\n"],"mappings":";SACQA,OAAO;AAAA,SACOC,SAAS;AAAA,SACvBC,GAAG;AAAA,SACHC,GAAG;AAAA,SAIHC,MAAM;AAAAC,mBAAA,GAqNPC,MAAM,CAACC,WAAW;AA3BzB,OAAO,MAA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D,MAAM,CA+BnBR,OAAO,GAAGA,OAAO"}
|
|
1
|
+
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","id","statsManager","userData","_lumaData","info","lost","canvasContext","defaultProps","toLowerCase","loseDevice","getCanvasContext","Error","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","readPixelsToArrayWebGL","source","options","readPixelsToBufferWebGL2","setParametersWebGL","parameters","withParametersWebGL","func","clearWebGL","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array","warn","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../utils/stats-manager';\nimport {log} from '../utils/log';\nimport {uid} from '../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\n/**\n * Identifies the GPU vendor and driver.\n * @note Chrome WebGPU does not provide much information, though more can be enabled with\n * @see https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates\n * chrome://flags/#enable-webgpu-developer-features\n */\nexport type DeviceInfo = {\n /** Type of device */\n type: 'webgl' | 'webgl2' | 'webgpu';\n /** Vendor (name of GPU vendor, Apple, nVidia etc */\n vendor: string;\n /** Renderer (usually driver name) */\n renderer: string;\n /** version of driver */\n version: string;\n /** family of GPU */\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n /** Type of GPU () */\n gpuType: 'discrete' | 'integrated' | 'cpu' | 'unknown';\n /** GPU architecture */\n gpuArchitecture?: string; // 'common-3' on Apple\n /** GPU driver backend. Can sometimes be sniffed */\n gpuBackend?: 'opengl' | 'opengles' | 'metal' | 'd3d11' | 'd3d12' | 'vulkan' | 'unknown';\n /** If this is a fallback adapter */\n fallback?: boolean;\n /** Shader language supported by device.createShader() */\n shadingLanguage: 'wgsl' | 'glsl';\n /** Highest supported shader language version (GLSL 3.00 = 300, GLSL 1.00 = 100) */\n shadingLanguageVersion: number;\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\n static defaultProps: 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 \n\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...Device.defaultProps, ...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 abstract destroy(): void;\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 /** 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 createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n // WebGL specific HACKS - enables app to remove webgl import\n // Use until we have a better way to handle these\n\n /** @deprecated - will be removed - should use command encoder */\n readPixelsToArrayWebGL(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n sourceAttachment?: number;\n target?: Uint8Array | Uint16Array | Float32Array;\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Uint8Array | Uint16Array | Float32Array {\n throw new Error('not implemented');\n }\n \n /** @deprecated - will be removed - should use command encoder */\n readPixelsToBufferWebGL2(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Buffer {\n throw new Error('not implemented');\n }\n\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n setParametersWebGL(parameters: any): void {\n throw new Error('not implemented');\n }\n\n /** @deprecated - will be removed - should use WebGPU parameters (pipeline) */\n withParametersWebGL(parameters: any, func: any): any {\n throw new Error('not implemented');\n }\n\n /** @deprecated - will be removed - should use clear arguments in RenderPass */\n clearWebGL(options?: {framebuffer?: Framebuffer; color?: any; depth?: any; stencil?: any}): void {\n throw new Error('not implemented');\n }\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')();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CAAC,CAAC;MAC9D;IACF;IACA,OAAON,QAAQ;EACjB;AACF;AAhPsBnC,MAAM,CAEnBU,YAAY,GAA0B;EAC3CP,EAAE,EAAE,IAAK;EACTuC,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,CAACzD,GAAG,CAAC0D,GAAG,CAAC,OAAO,CAAC,CAAC;EAChCC,KAAK,EAAE,EAAE;EAUTC,EAAE,EAAE;AACN,CAAC;AAxBmBtD,MAAM,CA+BnBR,OAAO,GAAGA,OAAO"}
|
|
@@ -69,6 +69,8 @@ export declare abstract class RenderPipeline extends Resource<RenderPipelineProp
|
|
|
69
69
|
renderPass?: RenderPass;
|
|
70
70
|
/** vertex attributes */
|
|
71
71
|
vertexArray: VertexArray;
|
|
72
|
+
/** Number of "rows" in index buffer */
|
|
73
|
+
indexCount?: number;
|
|
72
74
|
/** Number of "rows" in 'vertex' buffers */
|
|
73
75
|
vertexCount?: number;
|
|
74
76
|
/** Number of "rows" in 'instance' buffers */
|
|
@@ -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,EAA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AwB;QACxB,WAAW,EAAE,WAAW,CAAC;QACzB,uCAAuC;QACvC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,2CAA2C;QAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,6CAA6C;QAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gCAAgC;QAChC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+BAA+B;QAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kCAAkC;QAClC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,wCAAwC;QACxC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;KACvC,GAAG,IAAI;CACT"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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 index buffer */\n indexCount?: number;\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;AAiCF;AAzEsBT,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"}
|
|
@@ -36,7 +36,7 @@ export declare abstract class Shader extends Resource<ShaderProps> {
|
|
|
36
36
|
/** Get compiler log asynchronously */
|
|
37
37
|
abstract getCompilationInfo(): Promise<readonly CompilerMessage[]>;
|
|
38
38
|
/** Get compiler log synchronously (WebGL only) */
|
|
39
|
-
getCompilationInfoSync():
|
|
39
|
+
getCompilationInfoSync(): readonly CompilerMessage[] | null;
|
|
40
40
|
/** In browser logging of errors */
|
|
41
41
|
debugShader(): Promise<void>;
|
|
42
42
|
/** In-browser UI logging of errors */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/shader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAGnD,OAAO,EAAC,eAAe,EAAC,MAAM,yCAAyC,CAAC;AAIxE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,0EAA0E;IAC1E,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,8BAAsB,MAAO,SAAQ,QAAQ,CAAC,WAAW,CAAC;IACxD,OAAgB,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,CAQjD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/shader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EA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AS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI;CAuCxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader.js","names":["Resource","uid","formatCompilerLog","getShaderInfo","_Symbol$toStringTag","Symbol","toStringTag","Shader","constructor","device","props","id","getShaderIdFromProps","defaultProps","stage","source","compilationStatus","getCompilationInfoSync","debugShader","debug","messages","getCompilationInfo","length","_displayShaderLog","_document","_errors$","document","createElement","shaderName","name","shaderTitle","htmlLog","showSourceCode","html","button","innerHTML","style","top","left","position","zIndex","width","textAlign","body","appendChild","errors","getElementsByClassName","scrollIntoView","onclick","dataURI","encodeURIComponent","navigator","clipboard","writeText","language","sourceMap","entryPoint"],"sources":["../../../src/adapter/resources/shader.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n// import { log } from '../../utils/log';\nimport {uid} from '../../utils/utils';\nimport {CompilerMessage} from '../../lib/compiler-log/compiler-message';\nimport {formatCompilerLog} from '../../lib/compiler-log/format-compiler-log';\nimport {getShaderInfo} from '../../lib/compiler-log/get-shader-info';\n\n/**\n * Properties for a Shader\n */\nexport type ShaderProps = ResourceProps & {\n /** Shader language (defaults to auto)
|
|
1
|
+
{"version":3,"file":"shader.js","names":["Resource","uid","formatCompilerLog","getShaderInfo","_Symbol$toStringTag","Symbol","toStringTag","Shader","constructor","device","props","id","getShaderIdFromProps","defaultProps","stage","source","compilationStatus","getCompilationInfoSync","debugShader","debug","messages","getCompilationInfo","length","_displayShaderLog","_document","_errors$","document","createElement","shaderName","name","shaderTitle","htmlLog","showSourceCode","html","button","innerHTML","style","top","left","position","zIndex","width","textAlign","body","appendChild","errors","getElementsByClassName","scrollIntoView","onclick","dataURI","encodeURIComponent","navigator","clipboard","writeText","language","sourceMap","entryPoint"],"sources":["../../../src/adapter/resources/shader.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n// import { log } from '../../utils/log';\nimport {uid} from '../../utils/utils';\nimport {CompilerMessage} from '../../lib/compiler-log/compiler-message';\nimport {formatCompilerLog} from '../../lib/compiler-log/format-compiler-log';\nimport {getShaderInfo} from '../../lib/compiler-log/get-shader-info';\n\n/**\n * Properties for a Shader\n */\nexport type ShaderProps = ResourceProps & {\n /** Shader language (defaults to auto) */\n language?: 'glsl' | 'wgsl' | 'auto';\n /** Which stage are we compiling? Required by WebGL and GLSL transpiler */\n stage: 'vertex' | 'fragment' | 'compute';\n /** Shader source code */\n source: string;\n /** Optional shader source map (WebGPU only) */\n sourceMap?: string | null;\n /** Optional shader entry point (WebGPU only) */\n entryPoint?: string;\n /** Show shader source in browser? */\n debug?: 'never' | 'errors' | 'warnings' | 'always';\n};\n\n/**\n * Immutable Shader object\n * In WebGPU the handle can be copied between threads\n */\nexport abstract class Shader extends Resource<ShaderProps> {\n static override defaultProps: Required<ShaderProps> = {\n ...Resource.defaultProps,\n language: 'auto',\n stage: 'vertex',\n source: '',\n sourceMap: null,\n entryPoint: 'main',\n debug: 'errors'\n };\n\n override get [Symbol.toStringTag](): string {\n return 'Shader';\n }\n\n /** The stage of this shader */\n readonly stage: 'vertex' | 'fragment' | 'compute';\n /** The source code of this shader */\n readonly source: string;\n /** The compilation status of this shader. May be 'pending' if compilation is done asynchronously */\n compilationStatus: 'success' | 'error' | 'pending' = 'pending';\n\n /** Create a new Shader instance */\n constructor(device: Device, props: ShaderProps) {\n super(device, {id: getShaderIdFromProps(props), ...props}, Shader.defaultProps);\n this.stage = this.props.stage;\n this.source = this.props.source;\n }\n\n /** Get compiler log asynchronously */\n abstract getCompilationInfo(): Promise<readonly CompilerMessage[]>;\n\n /** Get compiler log synchronously (WebGL only) */\n getCompilationInfoSync(): readonly CompilerMessage[] | null {\n return null;\n }\n\n // PORTABLE HELPERS\n\n /** In browser logging of errors */\n async debugShader(): Promise<void> {\n switch (this.props.debug) {\n case 'never':\n return;\n case 'errors':\n // On WebGL - Don't extract the log unless errors\n if (this.compilationStatus === 'success') {\n return;\n }\n break;\n case 'warnings':\n case 'always':\n break;\n }\n\n const messages = await this.getCompilationInfo();\n if (this.props.debug === 'warnings' && messages?.length === 0) {\n return;\n }\n this._displayShaderLog(messages);\n }\n\n // PRIVATE\n\n /** In-browser UI logging of errors */\n protected _displayShaderLog(messages: readonly CompilerMessage[]): void {\n // Return if under Node.js / incomplete `document` polyfills\n if (typeof document === 'undefined' || !document?.createElement) {\n return;\n }\n\n const shaderName: string = getShaderInfo(this.source).name;\n const shaderTitle: string = `${this.stage} ${shaderName}`;\n const htmlLog = formatCompilerLog(messages, this.source, {showSourceCode: 'all', html: true});\n\n // Make it clickable so we can copy to clipboard\n const button = document.createElement('Button');\n button.innerHTML = `\n<h1>Shader Compilation Error in ${shaderTitle}</h1><br /><br />\n<code style=\"user-select:text;\"><pre>\n${htmlLog}\n</pre></code>`;\n button.style.top = '10px';\n button.style.left = '10px';\n button.style.position = 'absolute';\n button.style.zIndex = '9999';\n button.style.width = '100%';\n button.style.textAlign = 'left';\n document.body.appendChild(button);\n\n const errors = document.getElementsByClassName('luma-compiler-log-error');\n if (errors[0]?.scrollIntoView) {\n errors[0].scrollIntoView();\n }\n\n // TODO - add a small embedded copy button (instead of main button)\n button.onclick = () => {\n // const source = this.source.replaceAll('\\n', '<br />');\n const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;\n navigator.clipboard.writeText(dataURI);\n };\n\n // TODO - add a small embedded close button\n }\n}\n\n// HELPERS\n\n/** Deduce an id, from shader source, or supplied id, or shader type */\nfunction getShaderIdFromProps(props: ShaderProps): string {\n return getShaderInfo(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);\n}\n"],"mappings":";SAEQA,QAAQ;AAAA,SAERC,GAAG;AAAA,SAEHC,iBAAiB;AAAA,SACjBC,aAAa;AAAAC,mBAAA,GAmCLC,MAAM,CAACC,WAAW;AAXlC,OAAO,MAAeC,MAAM,SAASP,QAAQ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0B;EACpD,GAAGb,QAAQ,CAACa,YAAY;EACxByC,QAAQ,EAAE,MAAM;EAChBxC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAE,EAAE;EACVwC,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE,MAAM;EAClBrC,KAAK,EAAE;AACT,CAAC;AAoGH,SAASP,oBAAoBA,CAACF,KAAkB,EAAU;EACxD,OAAOP,aAAa,CAACO,KAAK,CAACK,MAAM,CAAC,CAACc,IAAI,IAAInB,KAAK,CAACC,EAAE,IAAIV,GAAG,CAAE,WAAUS,KAAK,CAACI,KAAM,SAAQ,CAAC;AAC7F"}
|
|
@@ -23,13 +23,15 @@ export declare abstract class VertexArray extends Resource<VertexArrayProps> {
|
|
|
23
23
|
readonly maxVertexAttributes: number;
|
|
24
24
|
/** Attribute infos indexed by location - TODO only needed by webgl module? */
|
|
25
25
|
protected readonly attributeInfos: AttributeInfo[];
|
|
26
|
+
/** Index buffer */
|
|
26
27
|
indexBuffer: Buffer | null;
|
|
28
|
+
/** Attributes indexed by buffer slot */
|
|
27
29
|
attributes: (Buffer | TypedArray | null)[];
|
|
28
30
|
constructor(device: Device, props: VertexArrayProps);
|
|
29
31
|
/** Set attributes (stored on pipeline and set before each call) */
|
|
30
32
|
abstract setIndexBuffer(indices: Buffer | null): void;
|
|
31
33
|
/** Set attributes (stored on pipeline and set before each call) */
|
|
32
|
-
abstract setBuffer(
|
|
34
|
+
abstract setBuffer(bufferSlot: number, buffer: Buffer | null): void;
|
|
33
35
|
/** Set constant attributes (WebGL only) */
|
|
34
36
|
abstract setConstant(location: number, value: TypedArray | null): void;
|
|
35
37
|
abstract bindBeforeRender(renderPass: RenderPass): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/vertex-array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,aAA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AE,UAAU,GAAG,IAAI,GAAG,IAAI;IAEtE,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IACvD,QAAQ,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-array.js","names":["getAttributeInfosByLocation","Resource","_Symbol$toStringTag","Symbol","toStringTag","VertexArray","constructor","device","props","defaultProps","maxVertexAttributes","attributeInfos","indexBuffer","attributes","limits","Array","fill","renderPipeline","shaderLayout","bufferLayout"],"sources":["../../../src/adapter/resources/vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TypedArray} from '../../types';\nimport {\n AttributeInfo,\n getAttributeInfosByLocation\n} from '../attribute-utils/get-attribute-from-layouts';\nimport type {Device} from '../device';\nimport type {Buffer} from './buffer';\nimport type {RenderPass} from './render-pass';\nimport type {RenderPipeline} from './render-pipeline';\nimport {Resource, ResourceProps} from './resource';\n\n/** Properties for initializing a VertexArray */\nexport type VertexArrayProps = ResourceProps & {\n renderPipeline: RenderPipeline | null;\n};\n\n/**\n * Stores attribute bindings.\n * Makes it easy to share a render pipeline and use separate vertex arrays.\n * @note On WebGL, VertexArray allows non-constant bindings to be performed in advance\n * reducing the number of WebGL calls per draw call.\n * @note On WebGPU this is just a convenience class that collects the bindings.\n */\nexport abstract class VertexArray extends Resource<VertexArrayProps> {\n static override defaultProps: Required<VertexArrayProps> = {\n ...Resource.defaultProps,\n renderPipeline: null\n };\n\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n /** Max number of vertex attributes */\n readonly maxVertexAttributes: number;\n /** Attribute infos indexed by location - TODO only needed by webgl module? */\n protected readonly attributeInfos: AttributeInfo[];\n\n indexBuffer: Buffer | null = null;\n attributes: (Buffer | TypedArray | null)[];\n\n constructor(device: Device, props: VertexArrayProps) {\n super(device, props, VertexArray.defaultProps);\n this.maxVertexAttributes = device.limits.maxVertexAttributes;\n this.attributes = new Array(this.maxVertexAttributes).fill(null);\n this.attributeInfos = getAttributeInfosByLocation(\n props.renderPipeline.shaderLayout,\n props.renderPipeline.bufferLayout,\n this.maxVertexAttributes\n );\n }\n\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setIndexBuffer(indices: Buffer | null): void;\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setBuffer(
|
|
1
|
+
{"version":3,"file":"vertex-array.js","names":["getAttributeInfosByLocation","Resource","_Symbol$toStringTag","Symbol","toStringTag","VertexArray","constructor","device","props","defaultProps","maxVertexAttributes","attributeInfos","indexBuffer","attributes","limits","Array","fill","renderPipeline","shaderLayout","bufferLayout"],"sources":["../../../src/adapter/resources/vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TypedArray} from '../../types';\nimport {\n AttributeInfo,\n getAttributeInfosByLocation\n} from '../attribute-utils/get-attribute-from-layouts';\nimport type {Device} from '../device';\nimport type {Buffer} from './buffer';\nimport type {RenderPass} from './render-pass';\nimport type {RenderPipeline} from './render-pipeline';\nimport {Resource, ResourceProps} from './resource';\n\n/** Properties for initializing a VertexArray */\nexport type VertexArrayProps = ResourceProps & {\n renderPipeline: RenderPipeline | null;\n};\n\n/**\n * Stores attribute bindings.\n * Makes it easy to share a render pipeline and use separate vertex arrays.\n * @note On WebGL, VertexArray allows non-constant bindings to be performed in advance\n * reducing the number of WebGL calls per draw call.\n * @note On WebGPU this is just a convenience class that collects the bindings.\n */\nexport abstract class VertexArray extends Resource<VertexArrayProps> {\n static override defaultProps: Required<VertexArrayProps> = {\n ...Resource.defaultProps,\n renderPipeline: null\n };\n\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n /** Max number of vertex attributes */\n readonly maxVertexAttributes: number;\n /** Attribute infos indexed by location - TODO only needed by webgl module? */\n protected readonly attributeInfos: AttributeInfo[];\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Attributes indexed by buffer slot */\n attributes: (Buffer | TypedArray | null)[];\n\n constructor(device: Device, props: VertexArrayProps) {\n super(device, props, VertexArray.defaultProps);\n this.maxVertexAttributes = device.limits.maxVertexAttributes;\n this.attributes = new Array(this.maxVertexAttributes).fill(null);\n this.attributeInfos = getAttributeInfosByLocation(\n props.renderPipeline.shaderLayout,\n props.renderPipeline.bufferLayout,\n this.maxVertexAttributes\n );\n }\n\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setIndexBuffer(indices: Buffer | null): void;\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setBuffer(bufferSlot: number, buffer: Buffer | null): void;\n /** Set constant attributes (WebGL only) */\n abstract setConstant(location: number, value: TypedArray | null): void;\n\n abstract bindBeforeRender(renderPass: RenderPass): void;\n abstract unbindAfterRender(renderPass: RenderPass): void;\n}\n"],"mappings":";SAIEA,2BAA2B;AAAA,SAMrBC,QAAQ;AAAAC,mBAAA,GAoBAC,MAAM,CAACC,WAAW;AANlC,OAAO,MAAeC,WAAW,SAASJ,QAAQ,CAAmB;EAMnE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAYAI,WAAWA,CAACC,MAAc,EAAEC,KAAuB,EAAE;IACnD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,WAAW,CAACI,YAAY,CAAC;IAAC,KAVxCC,mBAAmB;IAAA,KAETC,cAAc;IAAA,KAGjCC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,UAAU;IAIR,IAAI,CAACH,mBAAmB,GAAGH,MAAM,CAACO,MAAM,CAACJ,mBAAmB;IAC5D,IAAI,CAACG,UAAU,GAAG,IAAIE,KAAK,CAAC,IAAI,CAACL,mBAAmB,CAAC,CAACM,IAAI,CAAC,IAAI,CAAC;IAChE,IAAI,CAACL,cAAc,GAAGX,2BAA2B,CAC/CQ,KAAK,CAACS,cAAc,CAACC,YAAY,EACjCV,KAAK,CAACS,cAAc,CAACE,YAAY,EACjC,IAAI,CAACT,mBACP,CAAC;EACH;AAWF;AAxCsBL,WAAW,CACfI,YAAY,GAA+B;EACzD,GAAGR,QAAQ,CAACQ,YAAY;EACxBQ,cAAc,EAAE;AAClB,CAAC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -1081,6 +1081,15 @@ var __exports__ = (() => {
|
|
|
1081
1081
|
readPixelsToBufferWebGL2(source, options) {
|
|
1082
1082
|
throw new Error("not implemented");
|
|
1083
1083
|
}
|
|
1084
|
+
setParametersWebGL(parameters) {
|
|
1085
|
+
throw new Error("not implemented");
|
|
1086
|
+
}
|
|
1087
|
+
withParametersWebGL(parameters, func) {
|
|
1088
|
+
throw new Error("not implemented");
|
|
1089
|
+
}
|
|
1090
|
+
clearWebGL(options) {
|
|
1091
|
+
throw new Error("not implemented");
|
|
1092
|
+
}
|
|
1084
1093
|
_getBufferProps(props) {
|
|
1085
1094
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
1086
1095
|
props = {
|
|
@@ -1531,7 +1540,8 @@ ${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.mes
|
|
|
1531
1540
|
return numberedLines;
|
|
1532
1541
|
}
|
|
1533
1542
|
function getNumberedLine(line, lineNum, options) {
|
|
1534
|
-
|
|
1543
|
+
const escapedLine = options?.html ? escapeHTML(line) : line;
|
|
1544
|
+
return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? "<br/>" : "\n"}`;
|
|
1535
1545
|
}
|
|
1536
1546
|
function padLeft(string, paddedLength) {
|
|
1537
1547
|
let result = "";
|
|
@@ -1540,6 +1550,9 @@ ${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.mes
|
|
|
1540
1550
|
}
|
|
1541
1551
|
return result + string;
|
|
1542
1552
|
}
|
|
1553
|
+
function escapeHTML(unsafe) {
|
|
1554
|
+
return unsafe.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1555
|
+
}
|
|
1543
1556
|
|
|
1544
1557
|
// src/lib/compiler-log/get-shader-info.ts
|
|
1545
1558
|
function getShaderInfo(source, defaultName) {
|
|
@@ -2507,7 +2520,7 @@ ${htmlLog}
|
|
|
2507
2520
|
}
|
|
2508
2521
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
2509
2522
|
const uniformBuffer = device.createBuffer({
|
|
2510
|
-
usage: Buffer2.UNIFORM,
|
|
2523
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
2511
2524
|
byteLength
|
|
2512
2525
|
});
|
|
2513
2526
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
@@ -2518,7 +2531,7 @@ ${htmlLog}
|
|
|
2518
2531
|
if (!this.uniformBuffers.get(uniformBufferName)) {
|
|
2519
2532
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
2520
2533
|
const uniformBuffer = device.createBuffer({
|
|
2521
|
-
usage: Buffer2.UNIFORM,
|
|
2534
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
2522
2535
|
byteLength
|
|
2523
2536
|
});
|
|
2524
2537
|
this.uniformBuffers.set(uniformBufferName, uniformBuffer);
|
package/dist/index.cjs
CHANGED
|
@@ -409,7 +409,8 @@ var _Device = class {
|
|
|
409
409
|
createCommandEncoder(props = {}) {
|
|
410
410
|
throw new Error("not implemented");
|
|
411
411
|
}
|
|
412
|
-
// HACKS -
|
|
412
|
+
// WebGL specific HACKS - enables app to remove webgl import
|
|
413
|
+
// Use until we have a better way to handle these
|
|
413
414
|
/** @deprecated - will be removed - should use command encoder */
|
|
414
415
|
readPixelsToArrayWebGL(source, options) {
|
|
415
416
|
throw new Error("not implemented");
|
|
@@ -418,6 +419,18 @@ var _Device = class {
|
|
|
418
419
|
readPixelsToBufferWebGL2(source, options) {
|
|
419
420
|
throw new Error("not implemented");
|
|
420
421
|
}
|
|
422
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
423
|
+
setParametersWebGL(parameters) {
|
|
424
|
+
throw new Error("not implemented");
|
|
425
|
+
}
|
|
426
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
427
|
+
withParametersWebGL(parameters, func) {
|
|
428
|
+
throw new Error("not implemented");
|
|
429
|
+
}
|
|
430
|
+
/** @deprecated - will be removed - should use clear arguments in RenderPass */
|
|
431
|
+
clearWebGL(options) {
|
|
432
|
+
throw new Error("not implemented");
|
|
433
|
+
}
|
|
421
434
|
// Implementation
|
|
422
435
|
_getBufferProps(props) {
|
|
423
436
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
@@ -925,7 +938,8 @@ function getNumberedLines(lines, lineNum, options) {
|
|
|
925
938
|
return numberedLines;
|
|
926
939
|
}
|
|
927
940
|
function getNumberedLine(line, lineNum, options) {
|
|
928
|
-
|
|
941
|
+
const escapedLine = (options == null ? void 0 : options.html) ? escapeHTML(line) : line;
|
|
942
|
+
return `${padLeft(String(lineNum), 4)}: ${escapedLine}${(options == null ? void 0 : options.html) ? "<br/>" : "\n"}`;
|
|
929
943
|
}
|
|
930
944
|
function padLeft(string, paddedLength) {
|
|
931
945
|
let result = "";
|
|
@@ -934,6 +948,9 @@ function padLeft(string, paddedLength) {
|
|
|
934
948
|
}
|
|
935
949
|
return result + string;
|
|
936
950
|
}
|
|
951
|
+
function escapeHTML(unsafe) {
|
|
952
|
+
return unsafe.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
953
|
+
}
|
|
937
954
|
|
|
938
955
|
// src/lib/compiler-log/get-shader-info.ts
|
|
939
956
|
function getShaderInfo(source, defaultName) {
|
|
@@ -1707,7 +1724,9 @@ var _VertexArray = class extends Resource {
|
|
|
1707
1724
|
maxVertexAttributes;
|
|
1708
1725
|
/** Attribute infos indexed by location - TODO only needed by webgl module? */
|
|
1709
1726
|
attributeInfos;
|
|
1727
|
+
/** Index buffer */
|
|
1710
1728
|
indexBuffer = null;
|
|
1729
|
+
/** Attributes indexed by buffer slot */
|
|
1711
1730
|
attributes;
|
|
1712
1731
|
constructor(device, props) {
|
|
1713
1732
|
super(device, props, _VertexArray.defaultProps);
|
|
@@ -2010,16 +2029,19 @@ var UniformStore = class {
|
|
|
2010
2029
|
const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();
|
|
2011
2030
|
return this.uniformBufferLayouts.get(uniformBufferName).getData(uniformValues);
|
|
2012
2031
|
}
|
|
2013
|
-
/**
|
|
2014
|
-
* Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)
|
|
2015
|
-
* The new buffer is initialized with current / supplied values
|
|
2032
|
+
/**
|
|
2033
|
+
* Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)
|
|
2034
|
+
* The new buffer is initialized with current / supplied values
|
|
2016
2035
|
*/
|
|
2017
2036
|
createUniformBuffer(device, uniformBufferName, uniforms) {
|
|
2018
2037
|
if (uniforms) {
|
|
2019
2038
|
this.setUniforms(uniforms);
|
|
2020
2039
|
}
|
|
2021
2040
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
2022
|
-
const uniformBuffer = device.createBuffer({
|
|
2041
|
+
const uniformBuffer = device.createBuffer({
|
|
2042
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
2043
|
+
byteLength
|
|
2044
|
+
});
|
|
2023
2045
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
2024
2046
|
uniformBuffer.write(uniformBufferData);
|
|
2025
2047
|
return uniformBuffer;
|
|
@@ -2028,7 +2050,10 @@ var UniformStore = class {
|
|
|
2028
2050
|
getManagedUniformBuffer(device, uniformBufferName) {
|
|
2029
2051
|
if (!this.uniformBuffers.get(uniformBufferName)) {
|
|
2030
2052
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
2031
|
-
const uniformBuffer = device.createBuffer({
|
|
2053
|
+
const uniformBuffer = device.createBuffer({
|
|
2054
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
2055
|
+
byteLength
|
|
2056
|
+
});
|
|
2032
2057
|
this.uniformBuffers.set(uniformBufferName, uniformBuffer);
|
|
2033
2058
|
}
|
|
2034
2059
|
return this.uniformBuffers.get(uniformBufferName);
|
|
@@ -48,7 +48,8 @@ function getNumberedLines(lines, lineNum, options) {
|
|
|
48
48
|
return numberedLines;
|
|
49
49
|
}
|
|
50
50
|
function getNumberedLine(line, lineNum, options) {
|
|
51
|
-
|
|
51
|
+
const escapedLine = options !== null && options !== void 0 && options.html ? escapeHTML(line) : line;
|
|
52
|
+
return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options !== null && options !== void 0 && options.html ? '<br/>' : '\n'}`;
|
|
52
53
|
}
|
|
53
54
|
function padLeft(string, paddedLength) {
|
|
54
55
|
let result = '';
|
|
@@ -57,4 +58,7 @@ function padLeft(string, paddedLength) {
|
|
|
57
58
|
}
|
|
58
59
|
return result + string;
|
|
59
60
|
}
|
|
61
|
+
function escapeHTML(unsafe) {
|
|
62
|
+
return unsafe.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll('\'', ''');
|
|
63
|
+
}
|
|
60
64
|
//# sourceMappingURL=format-compiler-log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-compiler-log.js","names":["formatCompilerLog","shaderLog","source","options","formattedLog","lines","split","log","slice","sort","a","b","lineNum","showSourceCode","currentMessage","length","getNumberedLine","message","formatCompilerMessage","inlineSource","numberedLines","getNumberedLines","positionIndicator","linePos","repeat","type","toUpperCase","html","lineIndex","sourceLine","undefined","line","padLeft","String","string","paddedLength","result","i"],"sources":["../../../src/lib/compiler-log/format-compiler-log.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from './compiler-message';\n\n/** @returns annotated errors or warnings */\nexport function formatCompilerLog(\n shaderLog: readonly CompilerMessage[],\n source: string,\n options?: {\n /** Include source code in the log. Either just the lines before issues or all source code */\n showSourceCode?: 'no' | 'issues' | 'all';\n html?: boolean;\n }\n): string {\n let formattedLog = '';\n const lines = source.split(/\\r?\\n/);\n const log = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);\n\n switch (options?.showSourceCode || 'no') {\n case 'all':\n // Parse the error - note: browser and driver dependent\n let currentMessage = 0;\n for (let lineNum = 1; lineNum <= lines.length; lineNum++) {\n formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);\n while (log.length > currentMessage && log[currentMessage].lineNum === lineNum) {\n const message = log[currentMessage++];\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n ...options,\n inlineSource: false\n });\n }\n }\n return formattedLog;\n\n case 'issues':\n case 'no':\n // Parse the error - note: browser and driver dependent\n for (const message of shaderLog) {\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n inlineSource: options?.showSourceCode !== 'no'\n });\n }\n return formattedLog;\n }\n}\n\n// Helpers\n\n/** Format one message */\nfunction formatCompilerMessage(\n message: CompilerMessage,\n lines: readonly string[],\n lineNum: number,\n options: {\n inlineSource?: boolean;\n html?: boolean;\n }\n): string {\n if (options?.inlineSource) {\n const numberedLines = getNumberedLines(lines, lineNum);\n // If we got error position on line add a `^^^` indicator on next line\n const positionIndicator = message.linePos > 0 ? `${' '.repeat(message.linePos + 5)}^^^\\n` : '';\n return `\n${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.message}\n\n`;\n }\n return options?.html\n ? `<div class='luma-compiler-log-error' style=\"color:red;\"><b> ${message.type.toUpperCase()}: ${message.message}</b></div>`\n : `${message.type.toUpperCase()}: ${message.message}`;\n}\n\nfunction getNumberedLines(\n lines: readonly string[],\n lineNum: number,\n options?: {html?: boolean}\n): string {\n let numberedLines = '';\n for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {\n const sourceLine = lines[lineIndex - 1];\n if (sourceLine !== undefined) {\n numberedLines += getNumberedLine(sourceLine, lineNum, options);\n }\n }\n return numberedLines;\n}\n\nfunction getNumberedLine(line: string, lineNum: number, options?: {html?: boolean}): string {\n return `${padLeft(String(lineNum), 4)}: ${
|
|
1
|
+
{"version":3,"file":"format-compiler-log.js","names":["formatCompilerLog","shaderLog","source","options","formattedLog","lines","split","log","slice","sort","a","b","lineNum","showSourceCode","currentMessage","length","getNumberedLine","message","formatCompilerMessage","inlineSource","numberedLines","getNumberedLines","positionIndicator","linePos","repeat","type","toUpperCase","html","lineIndex","sourceLine","undefined","line","escapedLine","escapeHTML","padLeft","String","string","paddedLength","result","i","unsafe","replaceAll"],"sources":["../../../src/lib/compiler-log/format-compiler-log.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from './compiler-message';\n\n/** @returns annotated errors or warnings */\nexport function formatCompilerLog(\n shaderLog: readonly CompilerMessage[],\n source: string,\n options?: {\n /** Include source code in the log. Either just the lines before issues or all source code */\n showSourceCode?: 'no' | 'issues' | 'all';\n html?: boolean;\n }\n): string {\n let formattedLog = '';\n const lines = source.split(/\\r?\\n/);\n const log = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);\n\n switch (options?.showSourceCode || 'no') {\n case 'all':\n // Parse the error - note: browser and driver dependent\n let currentMessage = 0;\n for (let lineNum = 1; lineNum <= lines.length; lineNum++) {\n formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);\n while (log.length > currentMessage && log[currentMessage].lineNum === lineNum) {\n const message = log[currentMessage++];\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n ...options,\n inlineSource: false\n });\n }\n }\n return formattedLog;\n\n case 'issues':\n case 'no':\n // Parse the error - note: browser and driver dependent\n for (const message of shaderLog) {\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n inlineSource: options?.showSourceCode !== 'no'\n });\n }\n return formattedLog;\n }\n}\n\n// Helpers\n\n/** Format one message */\nfunction formatCompilerMessage(\n message: CompilerMessage,\n lines: readonly string[],\n lineNum: number,\n options: {\n inlineSource?: boolean;\n html?: boolean;\n }\n): string {\n if (options?.inlineSource) {\n const numberedLines = getNumberedLines(lines, lineNum);\n // If we got error position on line add a `^^^` indicator on next line\n const positionIndicator = message.linePos > 0 ? `${' '.repeat(message.linePos + 5)}^^^\\n` : '';\n return `\n${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.message}\n\n`;\n }\n return options?.html\n ? `<div class='luma-compiler-log-error' style=\"color:red;\"><b> ${message.type.toUpperCase()}: ${message.message}</b></div>`\n : `${message.type.toUpperCase()}: ${message.message}`;\n}\n\nfunction getNumberedLines(\n lines: readonly string[],\n lineNum: number,\n options?: {html?: boolean}\n): string {\n let numberedLines = '';\n for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {\n const sourceLine = lines[lineIndex - 1];\n if (sourceLine !== undefined) {\n numberedLines += getNumberedLine(sourceLine, lineNum, options);\n }\n }\n return numberedLines;\n}\n\nfunction getNumberedLine(line: string, lineNum: number, options?: {html?: boolean}): string {\n const escapedLine = options?.html ? escapeHTML(line) : line;\n return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? '<br/>' : '\\n'}`;\n}\n\n/**\n * Pads a string with a number of spaces (space characters) to the left\n * @param {String} string - string to pad\n * @param {Number} digits - number of spaces to add\n * @return {String} string - The padded string\n */\nfunction padLeft(string: string, paddedLength: number): string {\n let result = '';\n for (let i = string.length; i < paddedLength; ++i) {\n result += ' ';\n }\n return result + string;\n}\n\nfunction escapeHTML(unsafe: string): string {\n return unsafe\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('\"', '"')\n .replaceAll('\\'', ''');\n}\n"],"mappings":"AAIA,OAAO,SAASA,iBAAiBA,CAC/BC,SAAqC,EACrCC,MAAc,EACdC,OAIC,EACO;EACR,IAAIC,YAAY,GAAG,EAAE;EACrB,MAAMC,KAAK,GAAGH,MAAM,CAACI,KAAK,CAAC,OAAO,CAAC;EACnC,MAAMC,GAAG,GAAGN,SAAS,CAACO,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,C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AE,iBAAiB,CAAC,CAAC;QACjD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KAChD,CACF;IAgBH,0CAA0C;IAC1C,OAAO,IAAI,IAAI;IAMf;;;OAGG;IACH,WAAW,CACT,QAAQ,EAAE,OAAO,CAAC;SAAE,KAAK,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAAC,CAAC,GAC7E,IAAI;IAUP,4DAA4D;IAC5D,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM;IAIxE,mEAAmE;IACnE,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,UAAU;IAKtE;;;OAGG;IACH,mBAAmB,CACjB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM,WAAW,EACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;SAAE,KAAK,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAAC,CAAC,GAC9E,MAAM;IAeT,4GAA4G;IAC5G,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM;IAarF,4DAA4D;IAC5D,oBAAoB,IAAI,KAAK,GAAG,MAAM;IAYtC,qEAAqE;IACrE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM;CAwB1E"}
|
|
@@ -42,7 +42,7 @@ export class UniformStore {
|
|
|
42
42
|
}
|
|
43
43
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
44
44
|
const uniformBuffer = device.createBuffer({
|
|
45
|
-
usage: Buffer.UNIFORM,
|
|
45
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST,
|
|
46
46
|
byteLength
|
|
47
47
|
});
|
|
48
48
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
@@ -53,7 +53,7 @@ export class UniformStore {
|
|
|
53
53
|
if (!this.uniformBuffers.get(uniformBufferName)) {
|
|
54
54
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
55
55
|
const uniformBuffer = device.createBuffer({
|
|
56
|
-
usage: Buffer.UNIFORM,
|
|
56
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST,
|
|
57
57
|
byteLength
|
|
58
58
|
});
|
|
59
59
|
this.uniformBuffers.set(uniformBufferName, uniformBuffer);
|