Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Core/Silk.NET.Core/Miscellaneous/PfnVoidFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Silk.NET.Core
{
public readonly unsafe struct PfnVoidFunction
public readonly unsafe struct PfnVoidFunction : IDisposable
{
private readonly void* _handle;

Expand All @@ -16,6 +16,7 @@ public PfnVoidFunction
(Delegate func) => _handle = (delegate* unmanaged[Cdecl]<void>) SilkMarshal.DelegateToPtr
(func);

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator delegate* unmanaged[Cdecl]<void>
(PfnVoidFunction pfn) => pfn.Handle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Silk.NET.OpenXR
{
public readonly unsafe struct PfnDebugUtilsMessengerCallbackEXT
public readonly unsafe struct PfnDebugUtilsMessengerCallbackEXT : IDisposable
{
private readonly void* _handle;

Expand All @@ -19,6 +19,7 @@ public PfnDebugUtilsMessengerCallbackEXT
DebugUtilsMessengerCallbackDataEXT*, void*, Bool32> ptr
) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnDebugUtilsMessengerCallbackEXT pfn) => (nint) pfn.Handle;

public PfnDebugUtilsMessengerCallbackEXT(DebugUtilsMessengerCallbackFunctionEXT func) => _handle =
Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/PfnAllocationFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnAllocationFunction
public readonly unsafe struct PfnAllocationFunction : IDisposable
{
private readonly void* _handle;

Expand All @@ -13,6 +13,7 @@ public readonly unsafe struct PfnAllocationFunction
public PfnAllocationFunction
(delegate* unmanaged[Cdecl]<void*, nuint, nuint, SystemAllocationScope, void*> ptr) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnAllocationFunction pfn) => (nint) pfn.Handle;

public PfnAllocationFunction
Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/PfnDebugReportCallbackEXT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnDebugReportCallbackEXT
public readonly unsafe struct PfnDebugReportCallbackEXT : IDisposable
{
private readonly void* _handle;

Expand All @@ -19,6 +19,7 @@ public PfnDebugReportCallbackEXT
void*, Bool32> ptr
) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnDebugReportCallbackEXT pfn) => (nint) pfn.Handle;

public PfnDebugReportCallbackEXT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnDebugUtilsMessengerCallbackEXT
public readonly unsafe struct PfnDebugUtilsMessengerCallbackEXT : IDisposable
{
private readonly void* _handle;

Expand All @@ -19,6 +19,7 @@ public PfnDebugUtilsMessengerCallbackEXT
DebugUtilsMessengerCallbackDataEXT*, void*, Bool32> ptr
) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnDebugUtilsMessengerCallbackEXT pfn) => (nint) pfn.Handle;

public PfnDebugUtilsMessengerCallbackEXT(DebugUtilsMessengerCallbackFunctionEXT func) => _handle =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Silk.NET.Core.Native;

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnDeviceMemoryReportCallbackEXT
public readonly unsafe struct PfnDeviceMemoryReportCallbackEXT : IDisposable
{
private readonly void* _handle;

Expand All @@ -15,6 +16,7 @@ public readonly unsafe struct PfnDeviceMemoryReportCallbackEXT
public PfnDeviceMemoryReportCallbackEXT
(delegate* unmanaged[Cdecl]<DeviceMemoryReportCallbackDataEXT*, void*, void> ptr) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnDeviceMemoryReportCallbackEXT pfn) => (nint) pfn.Handle;

public PfnDeviceMemoryReportCallbackEXT
Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/PfnFreeFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnFreeFunction
public readonly unsafe struct PfnFreeFunction : IDisposable
{
private readonly void* _handle;

Expand All @@ -12,6 +12,7 @@ public readonly unsafe struct PfnFreeFunction

public PfnFreeFunction(delegate* unmanaged[Cdecl]<void*, void*, void> ptr) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnFreeFunction pfn) => (nint) pfn.Handle;

public PfnFreeFunction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnInternalAllocationNotification
public readonly unsafe struct PfnInternalAllocationNotification : IDisposable
{
private readonly void* _handle;

Expand All @@ -23,6 +23,7 @@ public PfnInternalAllocationNotification
(delegate* unmanaged[Cdecl]<void*, nuint, InternalAllocationType, SystemAllocationScope, void>) SilkMarshal
.DelegateToPtr(func);

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator delegate* unmanaged[Cdecl]<void*, nuint, InternalAllocationType,
SystemAllocationScope, void>(PfnInternalAllocationNotification pfn) => pfn.Handle;

Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/PfnInternalFreeNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnInternalFreeNotification
public readonly unsafe struct PfnInternalFreeNotification : IDisposable
{
private readonly void* _handle;

Expand All @@ -20,6 +20,7 @@ public PfnInternalFreeNotification
(delegate* unmanaged[Cdecl]<void*, nuint, InternalAllocationType, SystemAllocationScope, void>) SilkMarshal
.DelegateToPtr(func);

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator delegate* unmanaged[Cdecl]<void*, nuint, InternalAllocationType,
SystemAllocationScope, void>(PfnInternalFreeNotification pfn) => pfn.Handle;

Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/Silk.NET.Vulkan/PfnReallocationFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Silk.NET.Vulkan
{
public readonly unsafe struct PfnReallocationFunction
public readonly unsafe struct PfnReallocationFunction : IDisposable
{
private readonly void* _handle;

Expand All @@ -13,6 +13,7 @@ public readonly unsafe struct PfnReallocationFunction
public PfnReallocationFunction
(delegate* unmanaged[Cdecl]<void*, void*, nuint, nuint, SystemAllocationScope, void*> ptr) => _handle = ptr;

public void Dispose() => SilkMarshal.Free((nint) _handle);
public static implicit operator nint(PfnReallocationFunction pfn) => (nint) pfn.Handle;

public PfnReallocationFunction
Expand Down