forked from 3DRadSpace/3D_Rad_Space
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstGPUBuffer.cs
More file actions
38 lines (29 loc) · 903 Bytes
/
Copy pathInstGPUBuffer.cs
File metadata and controls
38 lines (29 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Runtime.InteropServices;
namespace Engine3DRadSpace.Graphics;
public class InstGPUBuffer : InstGPUResource, IGPUBuffer
{
[DllImport("3DRadSpace.FFI.dll", EntryPoint = "E3DRSP_IGPUBuffer_ReadData")]
extern static ulong _read(IntPtr res, IntPtr ppData);
[DllImport("3DRadSpace.FFI.dll", EntryPoint = "E3DRSP_IGPUBuffer_SetData")]
extern static void _write(IntPtr res, IntPtr pData, ulong buffSize);
[DllImport("3DRadSpace.FFI.dll", EntryPoint = "E3DRSP_IGPUBuffer_EndRead")]
extern static void _end(IntPtr res);
public InstGPUBuffer(IntPtr handle) : base(handle)
{
}
protected InstGPUBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}
public void EndRead()
{
_end(_handle);
}
public ulong ReadData(nint ppData)
{
return _read(_handle, ppData);
}
public void SetData(nint pData, ulong buffSize)
{
_write(_handle, pData, buffSize);
}
}