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

TypeError: Failed to execute 'writeBuffer' on 'GPUQueue': Argument 3 is a view on a SharedArrayBuffer, which is not allowed #25627

Open
Mutefish0 opened this issue Sep 14, 2024 · 0 comments
Labels
bug Something isn't working correctly webgpu WebGPU API

Comments

@Mutefish0
Copy link
Contributor

Version: Deno 1.46.3

in spce , it should be ok to use sharedArrayBuffer in device.queue.writeBuffer.

Reproduce

main.ts:

const worker = new Worker(import.meta.resolve("./worker.ts"), {
  type: "module",
});
worker.postMessage({ buffer: new SharedArrayBuffer(64) });

worker.ts:

const adapter = await navigator.gpu.requestAdapter();
const device = await adapter!.requestDevice();

const gpuBuffer = device.createBuffer({
  size: 32,
  usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
});

self.addEventListener("message", (event) => {
  const data = (event as any).data;
  const view = new DataView(data.buffer);
  device.queue.writeBuffer(gpuBuffer, 0, view, 0, 4);
});

run deno run --unstable-webgpu main.ts then get error:

截屏2024-09-14 13 40 10
@littledivy littledivy added bug Something isn't working correctly webgpu WebGPU API labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly webgpu WebGPU API
Projects
None yet
Development

No branches or pull requests

2 participants