restructure bindings API

refresh2
cosmonaut 2024-03-01 12:42:04 -08:00
parent 020e76782a
commit 4268db4616
1 changed files with 50 additions and 26 deletions

View File

@ -314,7 +314,7 @@ namespace RefreshCS
Overwrite Overwrite
} }
public enum CopyOptions public enum WriteOptions
{ {
SafeDiscard, SafeDiscard,
SafeOverwrite SafeOverwrite
@ -592,7 +592,7 @@ namespace RefreshCS
public Vec4 clearColor; public Vec4 clearColor;
public LoadOp loadOp; public LoadOp loadOp;
public StoreOp storeOp; public StoreOp storeOp;
public byte safeDiscard; public WriteOptions writeOption;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
@ -604,7 +604,35 @@ namespace RefreshCS
public StoreOp storeOp; public StoreOp storeOp;
public LoadOp stencilLoadOp; public LoadOp stencilLoadOp;
public StoreOp stencilStoreOp; public StoreOp stencilStoreOp;
public byte safeDiscard; public WriteOptions writeOption;
}
[StructLayout(LayoutKind.Sequential)]
public struct BufferBinding
{
public IntPtr gpuBuffer;
public uint offset;
}
[StructLayout(LayoutKind.Sequential)]
public struct TextureSamplerBinding
{
public IntPtr texture;
public IntPtr sampler;
}
[StructLayout(LayoutKind.Sequential)]
public struct ComputeBufferBinding
{
public IntPtr gpuBuffer;
public WriteOptions writeOption;
}
[StructLayout(LayoutKind.Sequential)]
public struct ComputeTextureBinding
{
public TextureSlice textureSlice;
public WriteOptions writeOption;
} }
/* Logging */ /* Logging */
@ -766,38 +794,34 @@ namespace RefreshCS
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindVertexBuffers( public static extern unsafe void Refresh_BindVertexBuffers(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
uint firstBinding, uint firstBinding,
uint bindingCount, uint bindingCount,
IntPtr pBuffers, BufferBinding* pBindings
IntPtr pOffsets
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindIndexBuffer( public static extern void Refresh_BindIndexBuffer(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr gpuBuffer, in BufferBinding pBinding,
uint offset,
IndexElementSize indexElementSize IndexElementSize indexElementSize
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindVertexSamplers( public static extern unsafe void Refresh_BindVertexSamplers(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr pTextures, TextureSamplerBinding* pBindings
IntPtr pSamplers
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindFragmentSamplers( public static extern unsafe void Refresh_BindFragmentSamplers(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr pTextures, TextureSamplerBinding* pBindings
IntPtr pSamplers
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -875,17 +899,17 @@ namespace RefreshCS
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindComputeBuffers( public static extern unsafe void Refresh_BindComputeBuffers(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr pBuffers ComputeBufferBinding* pBindings
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BindComputeTextures( public static extern unsafe void Refresh_BindComputeTextures(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr pTextureSlices ComputeTextureBinding* pBindings
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -945,7 +969,7 @@ namespace RefreshCS
IntPtr transferBuffer, IntPtr transferBuffer,
in TextureRegion textureSlice, in TextureRegion textureSlice,
in BufferImageCopy copyParams, in BufferImageCopy copyParams,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -955,7 +979,7 @@ namespace RefreshCS
IntPtr transferBuffer, IntPtr transferBuffer,
IntPtr gpuBuffer, IntPtr gpuBuffer,
in BufferCopy copyParams, in BufferCopy copyParams,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -965,7 +989,7 @@ namespace RefreshCS
in TextureRegion textureSlice, in TextureRegion textureSlice,
IntPtr transferBuffer, IntPtr transferBuffer,
in BufferImageCopy copyParams, in BufferImageCopy copyParams,
TransferOptions option TransferOptions transferOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -975,7 +999,7 @@ namespace RefreshCS
IntPtr gpuBuffer, IntPtr gpuBuffer,
IntPtr transferBuffer, IntPtr transferBuffer,
in BufferCopy copyParams, in BufferCopy copyParams,
TransferOptions option TransferOptions transferOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -984,7 +1008,7 @@ namespace RefreshCS
IntPtr commandBuffer, IntPtr commandBuffer,
in TextureRegion source, in TextureRegion source,
in TextureRegion destination, in TextureRegion destination,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -994,7 +1018,7 @@ namespace RefreshCS
in TextureRegion textureSlice, in TextureRegion textureSlice,
IntPtr gpuBuffer, IntPtr gpuBuffer,
in BufferImageCopy copyParams, in BufferImageCopy copyParams,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -1004,7 +1028,7 @@ namespace RefreshCS
IntPtr gpuBuffer, IntPtr gpuBuffer,
in TextureRegion textureSlice, in TextureRegion textureSlice,
in BufferImageCopy bufferImageCopy, in BufferImageCopy bufferImageCopy,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -1014,7 +1038,7 @@ namespace RefreshCS
IntPtr source, IntPtr source,
IntPtr destination, IntPtr destination,
in BufferCopy copyParams, in BufferCopy copyParams,
CopyOptions option WriteOptions writeOption
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]