Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luma.gl/webgpu

Package Overview
Dependencies
Maintainers
7
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/webgpu - npm Package Compare versions

Comparing version 9.0.0-alpha.11 to 9.0.0-alpha.12

2

dist/adapter/helpers/get-vertex-buffer-layout.js

@@ -13,4 +13,2 @@ import { decodeVertexFormat } from '@luma.gl/api';

if ('attributes' in mapping) {
const arrayStride = mapping.byteStride;
for (const interleaved of mapping.attributes) {

@@ -17,0 +15,0 @@ const attributeLayout = findAttributeLayout(layout, interleaved.name, usedAttributes);

3

dist/adapter/helpers/webgpu-parameters.js

@@ -88,4 +88,3 @@ function addDepthStencil(descriptor) {

blendColorOperation: (parameter, value, descriptor) => {
const targets = addColorState(descriptor);
const target = targets[0];
addColorState(descriptor);
}

@@ -92,0 +91,0 @@ };

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Framebuffer, Texture } from '@luma.gl/api';
import WEBGPUTexture from './webgpu-texture';
const MAX_COLOR_ATTACHMENTS = 8;
export default class WebGPUFramebuffer extends Framebuffer {

@@ -6,0 +5,0 @@ constructor(device, props) {

@@ -131,4 +131,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

if (this._getBindGroup()) {
webgpuRenderPass.handle.setBindGroup(0, this._getBindGroup());
const bindGroup = this._getBindGroup();
if (bindGroup) {
webgpuRenderPass.handle.setBindGroup(0, bindGroup);
}

@@ -135,0 +137,0 @@

@@ -12,3 +12,4 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

this.device = device;
const samplerProps = this.props;
const samplerProps = { ...this.props
};

@@ -19,3 +20,3 @@ if (samplerProps.type !== 'comparison-sampler') {

this.handle = this.handle || this.device.handle.createSampler(this.props);
this.handle = this.handle || this.device.handle.createSampler(samplerProps);
this.handle.label = this.props.id;

@@ -22,0 +23,0 @@ }

@@ -15,3 +15,3 @@ /// <reference types="@webgpu/types" />

constructor(device: WebGPUDevice, props: WebGPUShaderProps);
_checkCompilationError(errorScope: Promise<GPUError>): Promise<void>;
_checkCompilationError(errorScope: Promise<GPUError | null>): Promise<void>;
destroy(): void;

@@ -18,0 +18,0 @@ protected createHandle(): GPUShaderModule;

@@ -23,3 +23,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

_defineProperty(this, "sampler", null);
_defineProperty(this, "sampler", void 0);

@@ -26,0 +26,0 @@ if (typeof this.props.format === 'number') {

@@ -13,4 +13,2 @@ /// <reference types="@webgpu/types" />

readonly format: TextureFormat;
width: number;
height: number;
depthStencilFormat: TextureFormat;

@@ -17,0 +15,0 @@ sampleCount: number;

@@ -15,6 +15,2 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

_defineProperty(this, "width", -1);
_defineProperty(this, "height", -1);
_defineProperty(this, "depthStencilFormat", 'depth24plus');

@@ -27,2 +23,7 @@

this.device = device;
this.width = -1;
this.height = -1;
this._setAutoCreatedCanvasId("".concat(this.device.id, "-canvas"));
this.gpuCanvasContext = this.canvas.getContext('webgpu');

@@ -29,0 +30,0 @@ this.format = this.gpuCanvasContext.getPreferredFormat(adapter);

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Device, CanvasContext, log } from '@luma.gl/api';
import { Device, CanvasContext, log, uid } from '@luma.gl/api';
import WebGPUBuffer from './resources/webgpu-buffer';

@@ -51,3 +51,5 @@ import WebGPUTexture from './resources/webgpu-texture';

constructor(device, adapter, props) {
super(props);
super({ ...props,
id: props.id || uid('webgpu-device')
});

@@ -54,0 +56,0 @@ _defineProperty(this, "handle", void 0);

{
"name": "@luma.gl/webgpu",
"version": "9.0.0-alpha.11",
"version": "9.0.0-alpha.12",
"description": "WebGPU adapter for the luma.gl API",

@@ -31,7 +31,7 @@ "license": "MIT",

"@babel/runtime": "^7.0.0",
"@luma.gl/api": "9.0.0-alpha.11",
"@luma.gl/api": "9.0.0-alpha.12",
"@webgpu/types": "^0.1.9",
"probe.gl": "^3.2.1"
},
"gitHead": "3a99f57970a609d50948851aec7a56d56685ab62"
"gitHead": "4059dc47e41bc587b7e5871929aec3f97020015f"
}

@@ -27,3 +27,3 @@ import type {ShaderLayout, BufferMapping, AttributeLayout} from '@luma.gl/api';

if ('attributes' in mapping) {
const arrayStride = mapping.byteStride;
// const arrayStride = mapping.byteStride; TODO
for (const interleaved of mapping.attributes) {

@@ -30,0 +30,0 @@ const attributeLayout = findAttributeLayout(layout, interleaved.name, usedAttributes);

@@ -124,4 +124,5 @@ import {Parameters} from '@luma.gl/api';

blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {
const targets = addColorState(descriptor);
const target = targets[0];
addColorState(descriptor);
// const targets = addColorState(descriptor);
// const target = targets[0];
// const blend: GPUBlendState = target.blend || {color: {alpha: 0}};

@@ -128,0 +129,0 @@ // blend.color = blend.color || {};

// WEBGPU Buffer implementation
import {Buffer, BufferProps, assert} from '@luma.gl/api';
import {Buffer, BufferProps} from '@luma.gl/api';
import type WebGPUDevice from '../webgpu-device';

@@ -39,3 +39,3 @@

destroy(): void {
override destroy(): void {
this.handle.destroy();

@@ -45,3 +45,3 @@ }

// WebGPU provides multiple ways to write a buffer...
write(data: ArrayBufferView, byteOffset = 0) {
override write(data: ArrayBufferView, byteOffset = 0) {
this.device.handle.queue.writeBuffer(

@@ -56,3 +56,3 @@ this.handle,

async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<ArrayBuffer> {
override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<ArrayBuffer> {
// We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer

@@ -59,0 +59,0 @@ const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});

@@ -1,2 +0,2 @@

import {CommandEncoder, CommandEncoderProps, RenderPipeline, Buffer, Texture, cast} from '@luma.gl/api';
import {CommandEncoder, CommandEncoderProps, Buffer, Texture, cast} from '@luma.gl/api';
import WebGPUDevice from '../webgpu-device';

@@ -19,3 +19,3 @@ import WEBGPUBuffer from './webgpu-buffer';

destroy() {}
override destroy(): void {}

@@ -92,11 +92,11 @@ finish(options?: {id?: string}): GPUCommandBuffer {

pushDebugGroup(groupLabel: string): void {
override pushDebugGroup(groupLabel: string): void {
this.handle.pushDebugGroup(groupLabel);
}
popDebugGroup(): void {
override popDebugGroup(): void {
this.handle.popDebugGroup();
}
insertDebugMarker(markerLabel: string): void {
override insertDebugMarker(markerLabel: string): void {
this.handle.insertDebugMarker(markerLabel);

@@ -103,0 +103,0 @@ }

@@ -23,3 +23,3 @@ import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';

/** @note no WebGPU destroy method, just gc */
destroy() {}
override destroy(): void {}

@@ -26,0 +26,0 @@ endPass(): void {

@@ -25,3 +25,3 @@ // luma.gl, MIT license

destroy(): void {
override destroy(): void {
// External textures are destroyed automatically,

@@ -28,0 +28,0 @@ // as a microtask, instead of manually or upon garbage collection like other resources.

@@ -10,3 +10,3 @@ import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';

const MAX_COLOR_ATTACHMENTS = 8;
// const MAX_COLOR_ATTACHMENTS = 8;

@@ -13,0 +13,0 @@ /**

@@ -39,3 +39,3 @@ /*

destroy() {
override destroy(): void {
this.handle.destroy();

@@ -42,0 +42,0 @@ }

import type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/api';
import {Buffer, RenderPass, RenderPipeline, cast, log} from '@luma.gl/api';
import {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/api';
import WebGPUDevice from '../webgpu-device';

@@ -25,3 +25,3 @@ import WebGPUBuffer from './webgpu-buffer';

destroy() {}
override destroy(): void {}

@@ -28,0 +28,0 @@ endPass(): void {

@@ -1,2 +0,2 @@

import type {Binding, RenderPass, Shader} from '@luma.gl/api';
import type {Binding, RenderPass} from '@luma.gl/api';
import {Buffer, RenderPipeline, RenderPipelineProps, cast, log, isObjectEmpty} from '@luma.gl/api';

@@ -59,3 +59,3 @@ import {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';

destroy() {
override destroy(): void {
// WebGPURenderPipeline has no destroy method.

@@ -174,3 +174,3 @@ }

}): void {
const webgpuRenderPass =
const webgpuRenderPass: WebGPURenderPass =
cast<WebGPURenderPass>(options.renderPass) || this.device.getDefaultRenderPass();

@@ -182,4 +182,5 @@

// Set bindings (uniform buffers, textures etc)
if (this._getBindGroup()) {
webgpuRenderPass.handle.setBindGroup(0, this._getBindGroup());
const bindGroup = this._getBindGroup();
if (bindGroup) {
webgpuRenderPass.handle.setBindGroup(0, bindGroup);
}

@@ -186,0 +187,0 @@

@@ -20,3 +20,3 @@ import {Sampler, SamplerProps} from '@luma.gl/api';

// Prepare sampler props
const samplerProps = this.props;
const samplerProps: Partial<WebGPUSamplerProps> = {...this.props};
if (samplerProps.type !== 'comparison-sampler') {

@@ -26,9 +26,9 @@ delete samplerProps.compare;

this.handle = this.handle || this.device.handle.createSampler(this.props);
this.handle = this.handle || this.device.handle.createSampler(samplerProps);
this.handle.label = this.props.id;
}
destroy(): void {
override destroy(): void {
// this.handle.destroy();
}
}

@@ -28,3 +28,3 @@ import type {ShaderProps, CompilerMessage} from '@luma.gl/api';

async _checkCompilationError(errorScope: Promise<GPUError>): Promise<void> {
async _checkCompilationError(errorScope: Promise<GPUError | null>): Promise<void> {
const error = await errorScope as GPUValidationError;

@@ -40,3 +40,3 @@ if (error) {

destroy() {
override destroy(): void {
// this.handle.destroy();

@@ -43,0 +43,0 @@ }

// luma.gl, MIT license
import {Texture, TextureProps, Sampler, SamplerProps, assert} from '@luma.gl/api';
import {Texture, TextureProps, Sampler, SamplerProps} from '@luma.gl/api';
import {getWebGPUTextureFormat} from '../helpers/convert-texture-format';

@@ -20,3 +20,3 @@ import type WebGPUDevice from '../webgpu-device';

readonly view: GPUTextureView;
sampler: WebGPUSampler = null;
sampler: WebGPUSampler;

@@ -86,3 +86,3 @@ // static async createFromImageURL(src, usage = 0) {

destroy(): void {
override destroy(): void {
this.handle.destroy();

@@ -89,0 +89,0 @@ }

@@ -14,4 +14,2 @@ import type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/api';

readonly format: TextureFormat;
width: number = -1;
height: number = -1;
depthStencilFormat: TextureFormat = 'depth24plus';

@@ -25,2 +23,7 @@ sampleCount: number = 1;

this.device = device;
// TODO - hack to trigger resize?
this.width = -1;
this.height = -1;
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
this.gpuCanvasContext = this.canvas.getContext('webgpu') as GPUCanvasContext;

@@ -30,3 +33,3 @@ this.format = this.gpuCanvasContext.getPreferredFormat(adapter);

destroy() {
destroy(): void {
this.gpuCanvasContext.unconfigure();

@@ -33,0 +36,0 @@ }

@@ -21,3 +21,3 @@ /// <reference types="@webgpu/types" />

} from '@luma.gl/api';
import {Device, CanvasContext, log, cast} from '@luma.gl/api';
import {Device, CanvasContext, log, uid} from '@luma.gl/api';
import WebGPUBuffer from './resources/webgpu-buffer';

@@ -94,3 +94,3 @@ import WebGPUTexture from './resources/webgpu-texture';

constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {
super(props);
super({...props, id: props.id || uid('webgpu-device')});
this.handle = device;

@@ -134,3 +134,3 @@ this.adapter = adapter;

destroy() {
destroy(): void {
this.handle.destroy();

@@ -137,0 +137,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc