Skip to content

Commit 3f31773

Browse files
mvaligurskyMartin Valigursky
andauthored
Add assert for texture upload inside render pass on WebGPU (#8504)
Texture data upload during a render pass submits command buffers which invalidates the active pass encoder. Add a debug assert in the WebGPU uploadImmediate path to catch this early with a clear message pointing to the fix. Made-with: Cursor Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
1 parent 6c7bd12 commit 3f31773

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/platform/graphics/webgpu/webgpu-texture.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ class WebgpuTexture {
327327
uploadImmediate(device, texture) {
328328

329329
if (texture._needsUpload || texture._needsMipmapsUpload) {
330+
Debug.assert(!device.insideRenderPass,
331+
`Texture.upload() for "${texture.name}" was called while inside a render pass, which is not currently supported. ` +
332+
'Move texture updates to the before() or after() function of the RenderPass.');
330333
this.uploadData(device);
331334

332335
texture._needsUpload = false;

0 commit comments

Comments
 (0)