| 531 | } |
| 532 | |
| 533 | void GPUContextWebGPU::Flush() |
| 534 | { |
| 535 | if (!Encoder) |
| 536 | return; |
| 537 | PROFILE_CPU(); |
| 538 | |
| 539 | // End existing pass (if any) |
| 540 | if (_renderPass) |
| 541 | EndRenderPass(); |
| 542 | |
| 543 | // Flush pending actions |
| 544 | FlushTimestamps(); |
| 545 | _pendingTimestampWrites.Clear(); |
| 546 | |
| 547 | // Resolve used queries |
| 548 | for (uint32 setIndex = 0; setIndex < _device->QuerySetsCount; setIndex++) |
| 549 | { |
| 550 | if (_usedQuerySets & (1u << setIndex)) |
| 551 | _device->QuerySets[setIndex]->Resolve(Encoder); |
| 552 | } |
| 553 | _usedQuerySets = 0; |
| 554 | |
| 555 | // End commands recording |
| 556 | WGPUCommandBufferDescriptor commandBufferDesc = WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT; |
| 557 | WGPUCommandBuffer commandBuffer = wgpuCommandEncoderFinish(Encoder, &commandBufferDesc); |
| 558 | wgpuCommandEncoderRelease(Encoder); |
| 559 | Encoder = nullptr; |
| 560 | if (commandBuffer) |
| 561 | { |
| 562 | wgpuQueueSubmit(_device->Queue, 1, &commandBuffer); |
| 563 | wgpuCommandBufferRelease(commandBuffer); |
| 564 | _device->QueueSubmits++; |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | void GPUContextWebGPU::UpdateBuffer(GPUBuffer* buffer, const void* data, uint32 size, uint32 offset) |
| 569 | { |