From 705b3c39f4cff342ea4c5c93787cfbcae5bbef50 Mon Sep 17 00:00:00 2001 From: bridgewaterrobbie Date: Tue, 6 May 2025 11:38:55 -0400 Subject: [PATCH] WebGPU: Add Draw call, with temporary hack to achieve spinning triangle Co-authored-by: Juan Caldas --- filament/backend/src/webgpu/WebGPUDriver.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index 283d3703f6..5192aff263 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -961,6 +961,13 @@ void WebGPUDriver::bindRenderPrimitive(Handle rph) { } void WebGPUDriver::draw2(uint32_t indexOffset, uint32_t indexCount, uint32_t instanceCount) { + // Calling DrawIndexed with "firstInstance = 0" results in a NON spinning triangle + // mRenderPassEncoder.DrawIndexed(indexCount, instanceCount, indexOffset, 0, 0); + // Calling DrawIndexed with "firstInstance = 1" results in a spinning triangle + mRenderPassEncoder.DrawIndexed(indexCount, instanceCount, indexOffset, 0, 1); + // Calling Draw with "firstInstance = 0" results in a NON spinning triangle + // Calling Draw with "firstInstance = 1" results in a spinning triangle + // mRenderPassEncoder.Draw(indexCount, instanceCount, 0, 1); } void WebGPUDriver::draw(PipelineState pipelineState, Handle rph,