| 758 | } |
| 759 | |
| 760 | void GPUDeviceWebGPU::Dispose() |
| 761 | { |
| 762 | GPUDeviceLock lock(this); |
| 763 | if (_state == DeviceState::Disposed) |
| 764 | return; |
| 765 | |
| 766 | // Begin destruction |
| 767 | _state = DeviceState::Disposing; |
| 768 | WaitForGPU(); |
| 769 | preDispose(); |
| 770 | |
| 771 | // Clear device resources |
| 772 | for (int32 i = 0; i < QuerySetsCount; i++) |
| 773 | Delete(QuerySets[i]); |
| 774 | QuerySetsCount = 0; |
| 775 | DataUploader.ReleaseGPU(); |
| 776 | SAFE_DELETE_GPU_RESOURCE(DefaultRenderTarget); |
| 777 | SAFE_DELETE_GPU_RESOURCES(DefaultTexture); |
| 778 | SAFE_DELETE_GPU_RESOURCES(DefaultSamplers); |
| 779 | SAFE_DELETE(_mainContext); |
| 780 | SAFE_DELETE(Adapter); |
| 781 | if (DefaultBuffer) |
| 782 | { |
| 783 | wgpuBufferRelease(DefaultBuffer); |
| 784 | DefaultBuffer = nullptr; |
| 785 | } |
| 786 | if (Queue) |
| 787 | { |
| 788 | wgpuQueueRelease(Queue); |
| 789 | Queue = nullptr; |
| 790 | } |
| 791 | if (Device) |
| 792 | { |
| 793 | wgpuDeviceRelease(Device); |
| 794 | Device = nullptr; |
| 795 | } |
| 796 | wgpuInstanceRelease(WebGPUInstance); |
| 797 | |
| 798 | // End destruction |
| 799 | GPUDevice::Dispose(); |
| 800 | _state = DeviceState::Disposed; |
| 801 | } |
| 802 | |
| 803 | void GPUDeviceWebGPU::WaitForGPU() |
| 804 | { |
nothing calls this directly
no test coverage detected