MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Dispose

Method Dispose

Source/Engine/GraphicsDevice/WebGPU/GPUDeviceWebGPU.cpp:760–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760void 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
803void GPUDeviceWebGPU::WaitForGPU()
804{

Callers

nothing calls this directly

Calls 3

DeleteFunction · 0.85
DisposeFunction · 0.85
ReleaseGPUMethod · 0.45

Tested by

no test coverage detected