@luma.gl/webgpu
Advanced tools
Comparing version 9.0.0-alpha.35 to 9.0.0-alpha.36
@@ -6,4 +6,4 @@ function addDepthStencil(descriptor) { | ||
stencilBack: {}, | ||
depthWriteEnabled: undefined, | ||
depthCompare: undefined | ||
depthWriteEnabled: false, | ||
depthCompare: 'less-equal' | ||
}; | ||
@@ -10,0 +10,0 @@ return descriptor.depthStencil; |
@@ -1,2 +0,2 @@ | ||
import { RenderPass, cast } from '@luma.gl/core'; | ||
import { RenderPass, cast, log } from '@luma.gl/core'; | ||
export class WebGPURenderPass extends RenderPass { | ||
@@ -12,2 +12,5 @@ constructor(device) { | ||
const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer); | ||
log.groupCollapsed(1, `new WebGPURenderPass(${this.id})`)(); | ||
log.probe(1, JSON.stringify(renderPassDescriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor); | ||
@@ -45,3 +48,3 @@ this.handle.label = this.props.id; | ||
} else { | ||
this.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance); | ||
this.handle.draw(options.vertexCount || 0, options.instanceCount || 1, options.firstIndex, options.firstInstance); | ||
} | ||
@@ -84,3 +87,3 @@ } | ||
renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(colorAttachment => ({ | ||
loadOp: 'clear', | ||
loadOp: this.props.clearColor !== false ? 'clear' : 'load', | ||
colorClearValue: this.props.clearColor || [0, 0, 0, 0], | ||
@@ -92,5 +95,21 @@ storeOp: this.props.discard ? 'discard' : 'store', | ||
renderPassDescriptor.depthStencilAttachment = { | ||
...this.props, | ||
view: framebuffer.depthStencilAttachment.handle.createView() | ||
}; | ||
const { | ||
depthStencilAttachment | ||
} = renderPassDescriptor; | ||
if (this.props.depthReadOnly) { | ||
depthStencilAttachment.depthReadOnly = true; | ||
} | ||
depthStencilAttachment.depthClearValue = this.props.clearDepth || 0; | ||
const hasDepthAspect = true; | ||
if (hasDepthAspect) { | ||
depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load'; | ||
depthStencilAttachment.depthStoreOp = 'store'; | ||
} | ||
const hasStencilAspect = false; | ||
if (hasStencilAspect) { | ||
depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load'; | ||
depthStencilAttachment.stencilStoreOp = 'store'; | ||
} | ||
} | ||
@@ -97,0 +116,0 @@ return renderPassDescriptor; |
@@ -20,3 +20,2 @@ /// <reference types="dist" /> | ||
constructor(device: WebGPUDevice, props: RenderPipelineProps); | ||
protected createHandle(): GPURenderPipeline; | ||
destroy(): void; | ||
@@ -31,3 +30,5 @@ setIndexBuffer(indexBuffer: Buffer): void; | ||
_getBindGroup(): GPUBindGroup; | ||
/** Populate the complex WebGPU GPURenderPipelineDescriptor */ | ||
/** | ||
* Populate the complex WebGPU GPURenderPipelineDescriptor | ||
*/ | ||
protected _getRenderPipelineDescriptor(): GPURenderPipelineDescriptor; | ||
@@ -34,0 +35,0 @@ draw(options: { |
@@ -16,6 +16,13 @@ import { RenderPipeline, cast, log, isObjectEmpty } from '@luma.gl/core'; | ||
this._indexBuffer = null; | ||
this._bindGroupLayout = void 0; | ||
this._bindGroupLayout = null; | ||
this._bindGroup = null; | ||
this.device = device; | ||
this.handle = this.props.handle || this.createHandle(); | ||
this.handle = this.props.handle; | ||
if (!this.handle) { | ||
const descriptor = this._getRenderPipelineDescriptor(); | ||
log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)(); | ||
log.probe(1, JSON.stringify(descriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
this.handle = this.device.handle.createRenderPipeline(descriptor); | ||
} | ||
this.handle.label = this.props.id; | ||
@@ -26,12 +33,3 @@ this.vs = cast(props.vs); | ||
this._buffers = new Array(Object.keys(this._bufferSlots).length).fill(null); | ||
this._bindGroupLayout = this.handle.getBindGroupLayout(0); | ||
} | ||
createHandle() { | ||
const descriptor = this._getRenderPipelineDescriptor(); | ||
const renderPipeline = this.device.handle.createRenderPipeline(descriptor); | ||
log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)(); | ||
log.log(1, JSON.stringify(descriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
return renderPipeline; | ||
} | ||
destroy() {} | ||
@@ -57,2 +55,3 @@ setIndexBuffer(indexBuffer) { | ||
Object.assign(this.props.bindings, bindings); | ||
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0); | ||
this._bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.shaderLayout, this.props.bindings); | ||
@@ -117,3 +116,3 @@ } | ||
} else { | ||
webgpuRenderPass.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance); | ||
webgpuRenderPass.handle.draw(options.vertexCount || 0, options.instanceCount || 1, options.firstInstance); | ||
} | ||
@@ -120,0 +119,0 @@ } |
@@ -28,3 +28,3 @@ import { Shader, log } from '@luma.gl/core'; | ||
let language = this.props.language; | ||
if (!language) { | ||
if (language === 'auto') { | ||
language = source.includes('->') ? 'wgsl' : 'glsl'; | ||
@@ -31,0 +31,0 @@ } |
@@ -6,4 +6,7 @@ /// <reference types="dist" /> | ||
import { WebGPUFramebuffer } from './resources/webgpu-framebuffer'; | ||
import { WebGPUTexture } from './resources/webgpu-texture'; | ||
/** | ||
* Holds a WebGPU Canvas Context which handles resizing etc | ||
* Holds a WebGPU Canvas Context | ||
* The primary job of the CanvasContext is to generate textures for rendering into the current canvas | ||
* It also manages canvas sizing calculations and resizing. | ||
*/ | ||
@@ -13,8 +16,11 @@ export declare class WebGPUCanvasContext extends CanvasContext { | ||
readonly gpuCanvasContext: GPUCanvasContext; | ||
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */ | ||
readonly format: TextureFormat; | ||
/** Default stencil format for depth textures */ | ||
depthStencilFormat: TextureFormat; | ||
sampleCount: number; | ||
private depthStencilAttachment; | ||
constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps); | ||
/** Destroy any textures produced while configured and remove the context configuration. */ | ||
destroy(): void; | ||
getCurrentTexture(): WebGPUTexture; | ||
/** Update framebuffer with properly resized "swap chain" texture views */ | ||
@@ -21,0 +27,0 @@ getCurrentFramebuffer(): WebGPUFramebuffer; |
@@ -9,5 +9,4 @@ import { CanvasContext, log } from '@luma.gl/core'; | ||
this.gpuCanvasContext = void 0; | ||
this.format = void 0; | ||
this.format = navigator.gpu.getPreferredCanvasFormat(); | ||
this.depthStencilFormat = 'depth24plus'; | ||
this.sampleCount = 1; | ||
this.depthStencilAttachment = null; | ||
@@ -19,3 +18,3 @@ this.device = device; | ||
this.gpuCanvasContext = this.canvas.getContext('webgpu'); | ||
this.format = this.gpuCanvasContext.getPreferredFormat(adapter); | ||
this.format = 'bgra8unorm'; | ||
} | ||
@@ -25,11 +24,13 @@ destroy() { | ||
} | ||
getCurrentTexture() { | ||
return this.device._createTexture({ | ||
id: 'default-render-target', | ||
handle: this.gpuCanvasContext.getCurrentTexture() | ||
}); | ||
} | ||
getCurrentFramebuffer() { | ||
this.update(); | ||
const currentColorAttachment = this.device.createTexture({ | ||
id: 'default-render-target', | ||
handle: this.gpuCanvasContext.getCurrentTexture(), | ||
format: this.format, | ||
width: this.width, | ||
height: this.height | ||
}); | ||
const currentColorAttachment = this.getCurrentTexture(); | ||
this.width = currentColorAttachment.width; | ||
this.height = currentColorAttachment.height; | ||
this._createDepthStencilAttachment(); | ||
@@ -36,0 +37,0 @@ return new WebGPUFramebuffer(this.device, { |
/// <reference types="dist" /> | ||
import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, BufferProps, SamplerProps, ShaderProps, Texture, TextureProps, TextureFormat, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, RenderPassProps, ComputePassProps } from '@luma.gl/core'; | ||
import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, BufferProps, SamplerProps, ShaderProps, Texture, TextureProps, TextureFormat, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, RenderPassProps, ComputePassProps, VertexArrayProps } from '@luma.gl/core'; | ||
import { Device } from '@luma.gl/core'; | ||
@@ -14,2 +14,3 @@ import { WebGPUBuffer } from './resources/webgpu-buffer'; | ||
import { WebGPUComputePass } from './resources/webgpu-compute-pass'; | ||
import { WebGPUVertexArray } from './resources/webgpu-vertex-array'; | ||
import { WebGPUCanvasContext } from './webgpu-canvas-context'; | ||
@@ -52,2 +53,3 @@ /** WebGPU Device implementation */ | ||
createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline; | ||
createVertexArray(props: VertexArrayProps): WebGPUVertexArray; | ||
/** | ||
@@ -64,2 +66,3 @@ * Allows a render pass to begin against a canvas context | ||
* @note Called internally by Model. | ||
* @deprecated Create explicit pass with device.beginRenderPass | ||
*/ | ||
@@ -66,0 +69,0 @@ getDefaultRenderPass(): WebGPURenderPass; |
@@ -11,2 +11,3 @@ import { Device, CanvasContext, log, uid } from '@luma.gl/core'; | ||
import { WebGPUComputePass } from "./resources/webgpu-compute-pass.js"; | ||
import { WebGPUVertexArray } from "./resources/webgpu-vertex-array.js"; | ||
import { WebGPUCanvasContext } from "./webgpu-canvas-context.js"; | ||
@@ -66,3 +67,3 @@ export class WebGPUDevice extends Device { | ||
gpu: 'unknown', | ||
shadingLanguages: ['glsl', 'wgsl'], | ||
shadingLanguages: ['wgsl'], | ||
shadingLanguageVersions: { | ||
@@ -83,7 +84,5 @@ glsl: '450', | ||
}); | ||
if (props.canvas) { | ||
this.canvasContext = new WebGPUCanvasContext(this, this.adapter, { | ||
canvas: props.canvas | ||
}); | ||
} | ||
this.canvasContext = new WebGPUCanvasContext(this, this.adapter, { | ||
canvas: props.canvas | ||
}); | ||
this.features = this._getFeatures(); | ||
@@ -137,2 +136,5 @@ } | ||
} | ||
createVertexArray(props) { | ||
return new WebGPUVertexArray(this, props); | ||
} | ||
beginRenderPass(props) { | ||
@@ -150,11 +152,6 @@ this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder(); | ||
getDefaultRenderPass() { | ||
var _this$canvasContext; | ||
this.renderPass = this.renderPass || this.beginRenderPass({ | ||
framebuffer: (_this$canvasContext = this.canvasContext) === null || _this$canvasContext === void 0 ? void 0 : _this$canvasContext.getCurrentFramebuffer() | ||
}); | ||
return this.renderPass; | ||
throw new Error('a'); | ||
} | ||
submit() { | ||
var _this$renderPass, _this$commandEncoder; | ||
(_this$renderPass = this.renderPass) === null || _this$renderPass === void 0 ? void 0 : _this$renderPass.end(); | ||
var _this$commandEncoder; | ||
const commandBuffer = (_this$commandEncoder = this.commandEncoder) === null || _this$commandEncoder === void 0 ? void 0 : _this$commandEncoder.finish(); | ||
@@ -165,3 +162,2 @@ if (commandBuffer) { | ||
this.commandEncoder = null; | ||
this.renderPass = null; | ||
} | ||
@@ -168,0 +164,0 @@ _getFeatures() { |
{ | ||
"name": "@luma.gl/webgpu", | ||
"version": "9.0.0-alpha.35", | ||
"version": "9.0.0-alpha.36", | ||
"description": "WebGPU adapter for the luma.gl API", | ||
@@ -40,7 +40,7 @@ "type": "module", | ||
"@babel/runtime": "^7.0.0", | ||
"@luma.gl/core": "9.0.0-alpha.35", | ||
"@luma.gl/core": "9.0.0-alpha.36", | ||
"@probe.gl/env": "^4.0.2", | ||
"@webgpu/types": "^0.1.34" | ||
}, | ||
"gitHead": "5b93557731aaf1b9fd0fc1d84b5a3c7c0717298a" | ||
"gitHead": "05d6f82f0006047f9a6a562a1da1011d3b6b15e3" | ||
} |
@@ -0,1 +1,2 @@ | ||
// luma.gl, MIT license | ||
import type {ShaderLayout, BufferLayout, AttributeDeclaration, VertexFormat} from '@luma.gl/core'; | ||
@@ -2,0 +3,0 @@ import {getAttributeInfosFromLayouts, decodeVertexFormat} from '@luma.gl/core'; |
@@ -10,4 +10,4 @@ import {Parameters} from '@luma.gl/core'; | ||
// TODO can this cause trouble? Should we set to WebGPU defaults? Are there defaults? | ||
depthWriteEnabled: undefined!, | ||
depthCompare: undefined! | ||
depthWriteEnabled: false, | ||
depthCompare: 'less-equal' | ||
}; | ||
@@ -14,0 +14,0 @@ return descriptor.depthStencil; |
import type {RenderPassProps, RenderPassParameters, Binding, Framebuffer} from '@luma.gl/core'; | ||
import {Buffer, RenderPass, RenderPipeline, cast} from '@luma.gl/core'; | ||
import {Buffer, RenderPass, RenderPipeline, cast, log} from '@luma.gl/core'; | ||
import {WebGPUDevice} from '../webgpu-device'; | ||
@@ -21,2 +21,5 @@ import {WebGPUBuffer} from './webgpu-buffer'; | ||
const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer); | ||
log.groupCollapsed(1, `new WebGPURenderPass(${this.id})`)(); | ||
log.probe(1, JSON.stringify(renderPassDescriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor); | ||
@@ -79,3 +82,3 @@ this.handle.label = this.props.id; | ||
options.vertexCount || 0, | ||
options.instanceCount, | ||
options.instanceCount || 1, | ||
options.firstIndex, | ||
@@ -147,3 +150,3 @@ options.firstInstance | ||
// clear values | ||
loadOp: 'clear', | ||
loadOp: this.props.clearColor !== false ? 'clear' : 'load', | ||
colorClearValue: this.props.clearColor || [0, 0, 0, 0], | ||
@@ -157,5 +160,25 @@ storeOp: this.props.discard? 'discard': 'store', | ||
renderPassDescriptor.depthStencilAttachment = { | ||
...this.props, | ||
view: (framebuffer.depthStencilAttachment as WebGPUTexture).handle.createView() | ||
}; | ||
const {depthStencilAttachment} = renderPassDescriptor; | ||
// DEPTH | ||
if (this.props.depthReadOnly) { | ||
depthStencilAttachment.depthReadOnly = true; | ||
} | ||
depthStencilAttachment.depthClearValue = this.props.clearDepth || 0; | ||
// WebGPU only wants us to set these parameters if the texture format actually has a depth aspect | ||
const hasDepthAspect = true; | ||
if (hasDepthAspect) { | ||
depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load'; | ||
depthStencilAttachment.depthStoreOp = 'store'; // TODO - support 'discard'? | ||
} | ||
// WebGPU only wants us to set these parameters if the texture format actually has a stencil aspect | ||
const hasStencilAspect = false; | ||
if (hasStencilAspect) { | ||
depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load'; | ||
depthStencilAttachment.stencilStoreOp = 'store'; // TODO - support 'discard'? | ||
} | ||
} | ||
@@ -162,0 +185,0 @@ |
@@ -35,3 +35,3 @@ // luma.gl MIT license | ||
/** For internal use to create BindGroups */ | ||
private _bindGroupLayout: GPUBindGroupLayout; | ||
private _bindGroupLayout: GPUBindGroupLayout | null = null; | ||
private _bindGroup: GPUBindGroup | null = null; | ||
@@ -42,3 +42,10 @@ | ||
this.device = device; | ||
this.handle = (this.props.handle as GPURenderPipeline) || this.createHandle(); | ||
this.handle = this.props.handle as GPURenderPipeline; | ||
if (!this.handle) { | ||
const descriptor = this._getRenderPipelineDescriptor(); | ||
log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)(); | ||
log.probe(1, JSON.stringify(descriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
this.handle = this.device.handle.createRenderPipeline(descriptor); | ||
} | ||
this.handle.label = this.props.id; | ||
@@ -51,14 +58,4 @@ | ||
this._buffers = new Array<Buffer>(Object.keys(this._bufferSlots).length).fill(null); | ||
this._bindGroupLayout = this.handle.getBindGroupLayout(0); | ||
} | ||
protected createHandle(): GPURenderPipeline { | ||
const descriptor = this._getRenderPipelineDescriptor(); | ||
const renderPipeline = this.device.handle.createRenderPipeline(descriptor); | ||
log.groupCollapsed(1, `new WebGPRenderPipeline(${this.id})`)(); | ||
log.log(1, JSON.stringify(descriptor, null, 2))(); | ||
log.groupEnd(1)(); | ||
return renderPipeline; | ||
} | ||
override destroy(): void { | ||
@@ -97,3 +94,8 @@ // WebGPURenderPipeline has no destroy method. | ||
if (!isObjectEmpty(this.props.bindings)) { | ||
// Do we want to save things on CPU side? | ||
Object.assign(this.props.bindings, bindings); | ||
// Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group | ||
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0); | ||
// Set up the bindings | ||
@@ -125,3 +127,5 @@ this._bindGroup = getBindGroup( | ||
/** Populate the complex WebGPU GPURenderPipelineDescriptor */ | ||
/** | ||
* Populate the complex WebGPU GPURenderPipelineDescriptor | ||
*/ | ||
protected _getRenderPipelineDescriptor() { | ||
@@ -211,4 +215,3 @@ // Set up the vertex stage | ||
options.vertexCount || 0, | ||
options.instanceCount, | ||
options.firstIndex, | ||
options.instanceCount || 1, // If 0, nothing will be drawn | ||
options.firstInstance | ||
@@ -215,0 +218,0 @@ ); |
@@ -50,3 +50,3 @@ // luma.gl, MIT license | ||
// Compile from src | ||
if (!language) { | ||
if (language === 'auto') { | ||
// wgsl uses C++ "auto" style arrow notation | ||
@@ -53,0 +53,0 @@ language = source.includes('->') ? 'wgsl' : 'glsl'; |
@@ -48,2 +48,9 @@ // luma.gl, MIT license | ||
this.height = this.handle.height; | ||
// Why not just read all properties directly from the texture | ||
// this.depthOrArrayLayers = this.handle.depthOrArrayLayers; | ||
// this.mipLevelCount = this.handle.mipLevelCount; | ||
// this.sampleCount = this.handle.sampleCount; | ||
// this.dimension = this.handle.dimension; | ||
// this.format = this.handle.format; | ||
// this.usage = this.handle.usage; | ||
@@ -50,0 +57,0 @@ // Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture |
@@ -0,1 +1,2 @@ | ||
// / <reference types="@webgpu/types" /> | ||
import type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/core'; | ||
@@ -6,5 +7,8 @@ import {CanvasContext, log} from '@luma.gl/core'; | ||
import {WebGPUFramebuffer} from './resources/webgpu-framebuffer'; | ||
import {WebGPUTexture} from './resources/webgpu-texture'; | ||
/** | ||
* Holds a WebGPU Canvas Context which handles resizing etc | ||
* Holds a WebGPU Canvas Context | ||
* The primary job of the CanvasContext is to generate textures for rendering into the current canvas | ||
* It also manages canvas sizing calculations and resizing. | ||
*/ | ||
@@ -14,5 +18,6 @@ export class WebGPUCanvasContext extends CanvasContext { | ||
readonly gpuCanvasContext: GPUCanvasContext; | ||
readonly format: TextureFormat; | ||
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */ | ||
readonly format: TextureFormat = navigator.gpu.getPreferredCanvasFormat(); | ||
/** Default stencil format for depth textures */ | ||
depthStencilFormat: TextureFormat = 'depth24plus'; | ||
sampleCount: number = 1; | ||
@@ -27,10 +32,12 @@ private depthStencilAttachment: Texture | null = null; | ||
this.height = -1; | ||
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`); | ||
// @ts-ignore TODO - we don't handle OffscreenRenderingContext. | ||
this.gpuCanvasContext = this.canvas.getContext('webgpu') ; | ||
// @ts-expect-error TODO this has been replaced | ||
this.format = this.gpuCanvasContext.getPreferredFormat(adapter); | ||
this.gpuCanvasContext = this.canvas.getContext('webgpu'); | ||
// TODO this has been replaced | ||
// this.format = this.gpuCanvasContext.getPreferredFormat(adapter); | ||
this.format = 'bgra8unorm'; | ||
} | ||
/** Destroy any textures produced while configured and remove the context configuration. */ | ||
destroy(): void { | ||
@@ -40,2 +47,10 @@ this.gpuCanvasContext.unconfigure(); | ||
getCurrentTexture(): WebGPUTexture { | ||
// Wrap the current canvas context texture in a luma.gl texture | ||
return this.device._createTexture({ | ||
id: 'default-render-target', | ||
handle: this.gpuCanvasContext.getCurrentTexture() | ||
}); | ||
} | ||
/** Update framebuffer with properly resized "swap chain" texture views */ | ||
@@ -46,10 +61,15 @@ getCurrentFramebuffer(): WebGPUFramebuffer { | ||
// Wrap the current canvas context texture in a luma.gl texture | ||
// const currentColorAttachment = this.device.createTexture({ | ||
// id: 'default-render-target', | ||
// handle: this.gpuCanvasContext.getCurrentTexture(), | ||
// format: this.format, | ||
// width: this.width, | ||
// height: this.height | ||
// }); | ||
// Wrap the current canvas context texture in a luma.gl texture | ||
const currentColorAttachment = this.device.createTexture({ | ||
id: 'default-render-target', | ||
handle: this.gpuCanvasContext.getCurrentTexture(), | ||
format: this.format, | ||
width: this.width, | ||
height: this.height | ||
}); | ||
const currentColorAttachment = this.getCurrentTexture(); | ||
this.width = currentColorAttachment.width; | ||
this.height = currentColorAttachment.height; | ||
@@ -85,3 +105,4 @@ // Resize the depth stencil attachment | ||
format: getWebGPUTextureFormat(this.format), | ||
// size: [this.width, this.height], | ||
// Can be used to define e.g. -srgb views | ||
// viewFormats: [...] | ||
colorSpace: this.props.colorSpace, | ||
@@ -93,3 +114,2 @@ alphaMode: this.props.alphaMode | ||
} | ||
} | ||
@@ -96,0 +116,0 @@ |
@@ -22,3 +22,4 @@ // prettier-ignore | ||
ComputePassProps, | ||
// CommandEncoderProps | ||
// CommandEncoderProps, | ||
VertexArrayProps | ||
} from '@luma.gl/core'; | ||
@@ -37,2 +38,3 @@ import {Device, CanvasContext, log, uid} from '@luma.gl/core'; | ||
// import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder'; | ||
import {WebGPUVertexArray} from './resources/webgpu-vertex-array'; | ||
@@ -110,3 +112,3 @@ import {WebGPUCanvasContext} from './webgpu-canvas-context'; | ||
gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown', | ||
shadingLanguages: ['glsl', 'wgsl'], | ||
shadingLanguages: ['wgsl'], | ||
shadingLanguageVersions: { | ||
@@ -128,5 +130,5 @@ glsl: '450', | ||
// Note: WebGPU devices can be created without a canvas, for compute shader purposes | ||
if (props.canvas) { | ||
this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {canvas: props.canvas}); | ||
} | ||
// if (props.canvas) { | ||
this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {canvas: props.canvas}); | ||
// } | ||
@@ -206,2 +208,6 @@ this.features = this._getFeatures(); | ||
createVertexArray(props: VertexArrayProps): WebGPUVertexArray { | ||
return new WebGPUVertexArray(this, props); | ||
} | ||
// WebGPU specifics | ||
@@ -235,14 +241,16 @@ | ||
* @note Called internally by Model. | ||
* @deprecated Create explicit pass with device.beginRenderPass | ||
*/ | ||
getDefaultRenderPass(): WebGPURenderPass { | ||
this.renderPass = | ||
this.renderPass || | ||
this.beginRenderPass({ | ||
framebuffer: this.canvasContext?.getCurrentFramebuffer() | ||
}); | ||
return this.renderPass; | ||
// this.renderPass = | ||
// this.renderPass || | ||
// this.beginRenderPass({ | ||
// framebuffer: this.canvasContext?.getCurrentFramebuffer() | ||
// }); | ||
// return this.renderPass; | ||
throw new Error('a'); | ||
} | ||
submit(): void { | ||
this.renderPass?.end(); | ||
// this.renderPass?.end(); | ||
const commandBuffer = this.commandEncoder?.finish(); | ||
@@ -253,3 +261,3 @@ if (commandBuffer) { | ||
this.commandEncoder = null; | ||
this.renderPass = null; | ||
// this.renderPass = null; | ||
} | ||
@@ -256,0 +264,0 @@ |
Sorry, the diff of this file is too big to display
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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
579058
126
9367
+ Added@luma.gl/core@9.0.0-alpha.36(transitive)
- Removed@luma.gl/core@9.0.0-alpha.35(transitive)
Updated@luma.gl/core@9.0.0-alpha.36