-
-
Notifications
You must be signed in to change notification settings - Fork 436
Closed
Labels
area-Core/Infrastructure/CodegenenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Summary of feature
The API of ComPtr from wrl has Detach method, which will return the underlying handle to the object and nullify the handle inside the pointer. But for some reason, Silk.NET doesn't implement such method, which can be very helpful for cleaning interfaces in case error occur.
Example:
public ID3D12Device* Device;
static bool Initialize() {
using ComPtr<ID3D12Device> pDevice = new();
HResult hr = D3D12.CreateDevice(null, D3DFeatureLevel.Feature110, SilkMarshal.GuidPtrOf<ID3D12Device>(), (void**)pDevice.GetAddressOf());
if (hr.IsFailure) {
return false;
}
// Initialize ID3D12CommandQueue, IDXGIFactory, etc... here without having to release every successfully created object on every failure
Device = pDevice.Detach();
}
Metadata
Metadata
Assignees
Labels
area-Core/Infrastructure/CodegenenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed