Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU: Allow to pass to a compute shader the gpu buffer used in a bundle to render instances #13881

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/dev/core/src/Engines/WebGPU/webgpuDrawContext.ts
Expand Up @@ -49,7 +49,10 @@ export class WebGPUDrawContext implements IDrawContext {
this.indirectDrawBuffer = undefined;
this._indirectDrawData = undefined;
} else {
this.indirectDrawBuffer = this._bufferManager.createRawBuffer(40, WebGPUConstants.BufferUsage.CopyDst | WebGPUConstants.BufferUsage.Indirect);
this.indirectDrawBuffer = this._bufferManager.createRawBuffer(
20,
WebGPUConstants.BufferUsage.CopyDst | WebGPUConstants.BufferUsage.Indirect | WebGPUConstants.BufferUsage.Storage
);
this._indirectDrawData = new Uint32Array(5);
this._indirectDrawData[3] = 0;
this._indirectDrawData[4] = 0;
Expand Down
3 changes: 2 additions & 1 deletion packages/dev/core/src/Meshes/WebGPU/webgpuDataBuffer.ts
Expand Up @@ -5,8 +5,9 @@ import type { Nullable } from "../../types";
export class WebGPUDataBuffer extends DataBuffer {
private _buffer: Nullable<GPUBuffer>;

public constructor(resource: GPUBuffer) {
public constructor(resource: GPUBuffer, capacity = 0) {
super();
this.capacity = capacity;
this._buffer = resource;
}

Expand Down