csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.6 KiB
42 lines
1.6 KiB
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace GpuInterop;
|
|
|
|
static class NativeMethods
|
|
{
|
|
[Flags]
|
|
public enum IOSurfaceLockOptions : uint
|
|
{
|
|
None = 0,
|
|
ReadOnly = 1 << 0,
|
|
AvoidSync = 1 << 1,
|
|
}
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern int IOSurfaceLock(IntPtr surface, IOSurfaceLockOptions options, IntPtr seed);
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern nint IOSurfaceGetWidth(IntPtr surface);
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern nint IOSurfaceGetHeight(IntPtr surface);
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern nint IOSurfaceGetBytesPerRow(IntPtr surface);
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern IntPtr IOSurfaceGetBaseAddress(IntPtr surface);
|
|
|
|
[DllImport("/System/Library/Frameworks/IOSurface.framework/IOSurface")]
|
|
public static extern void IOSurfaceUnlock(IntPtr surface, IOSurfaceLockOptions options, IntPtr seed);
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public static extern IntPtr CFRetain(IntPtr cf);
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public static extern void CFRelease(IntPtr cf);
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public static extern nint CFGetRetainCount(IntPtr cf);
|
|
}
|
|
|