2021-01-06 00:30:14 +00:00
|
|
|
|
/* RefreshCS - C# bindings for the Refresh graphics Library
|
2021-01-05 23:33:38 +00:00
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2020 Evan Hemsley
|
|
|
|
|
*
|
|
|
|
|
* This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
|
* In no event will the authors be held liable for any damages arising from
|
|
|
|
|
* the use of this software.
|
|
|
|
|
*
|
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
|
*
|
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
|
* claim that you wrote the original software. If you use this software in a
|
|
|
|
|
* product, an acknowledgment in the product documentation would be
|
|
|
|
|
* appreciated but is not required.
|
|
|
|
|
*
|
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
|
*
|
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
*
|
|
|
|
|
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2021-01-06 02:57:05 +00:00
|
|
|
|
namespace RefreshCS
|
2021-01-05 23:33:38 +00:00
|
|
|
|
{
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public static class Refresh
|
|
|
|
|
{
|
|
|
|
|
private const string nativeLibName = "Refresh";
|
|
|
|
|
|
2022-03-03 00:06:37 +00:00
|
|
|
|
/* Version */
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public const uint REFRESH_MAJOR_VERSION = 2;
|
|
|
|
|
public const uint REFRESH_MINOR_VERSION = 0;
|
2022-03-03 00:06:37 +00:00
|
|
|
|
public const uint REFRESH_PATCH_VERSION = 0;
|
|
|
|
|
|
|
|
|
|
public const uint REFRESH_COMPILED_VERSION = (
|
|
|
|
|
(REFRESH_MAJOR_VERSION * 100 * 100) +
|
|
|
|
|
(REFRESH_MINOR_VERSION * 100) +
|
|
|
|
|
(REFRESH_PATCH_VERSION)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern uint Refresh_LinkedVersion();
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
/* Enums */
|
|
|
|
|
|
|
|
|
|
public enum PresentMode
|
|
|
|
|
{
|
|
|
|
|
Immediate,
|
|
|
|
|
Mailbox,
|
|
|
|
|
FIFO,
|
|
|
|
|
FIFORelaxed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum PrimitiveType
|
|
|
|
|
{
|
|
|
|
|
PointList,
|
|
|
|
|
LineList,
|
|
|
|
|
LineStrip,
|
|
|
|
|
TriangleList,
|
|
|
|
|
TriangleStrip
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LoadOp
|
|
|
|
|
{
|
|
|
|
|
Load,
|
|
|
|
|
Clear,
|
|
|
|
|
DontCare
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum StoreOp
|
|
|
|
|
{
|
|
|
|
|
Store,
|
|
|
|
|
DontCare
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum IndexElementSize
|
|
|
|
|
{
|
|
|
|
|
Sixteen,
|
|
|
|
|
ThirtyTwo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum TextureFormat
|
|
|
|
|
{
|
|
|
|
|
R8G8B8A8,
|
2022-03-02 06:56:46 +00:00
|
|
|
|
B8G8R8A8,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
R5G6B5,
|
|
|
|
|
A1R5G5B5,
|
|
|
|
|
B4G4R4A4,
|
2022-09-13 20:57:58 +00:00
|
|
|
|
A2R10G10B10,
|
|
|
|
|
R16G16,
|
|
|
|
|
R16G16B16A16,
|
|
|
|
|
R8,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
BC1,
|
|
|
|
|
BC2,
|
|
|
|
|
BC3,
|
2022-05-12 04:21:58 +00:00
|
|
|
|
BC7,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
R8G8_SNORM,
|
|
|
|
|
R8G8B8A8_SNORM,
|
|
|
|
|
R16_SFLOAT,
|
|
|
|
|
R16G16_SFLOAT,
|
|
|
|
|
R16G16B16A16_SFLOAT,
|
2022-09-13 20:57:58 +00:00
|
|
|
|
R32_SFLOAT,
|
|
|
|
|
R32G32_SFLOAT,
|
|
|
|
|
R32G32B32A32_SFLOAT,
|
|
|
|
|
|
|
|
|
|
R8_UINT,
|
|
|
|
|
R8G8_UINT,
|
|
|
|
|
R8G8B8A8_UINT,
|
|
|
|
|
R16_UINT,
|
|
|
|
|
R16G16_UINT,
|
|
|
|
|
R16G16B16A16_UINT,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
D16,
|
|
|
|
|
D32,
|
|
|
|
|
D16S8,
|
|
|
|
|
D32S8
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Flags]
|
|
|
|
|
public enum TextureUsageFlags : uint
|
|
|
|
|
{
|
|
|
|
|
Sampler = 1,
|
|
|
|
|
ColorTarget = 2,
|
2022-08-25 19:32:25 +00:00
|
|
|
|
DepthStencilTarget = 4,
|
|
|
|
|
Compute = 8
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum SampleCount
|
|
|
|
|
{
|
|
|
|
|
One,
|
|
|
|
|
Two,
|
|
|
|
|
Four,
|
2023-01-31 20:27:06 +00:00
|
|
|
|
Eight
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CubeMapFace : uint
|
|
|
|
|
{
|
|
|
|
|
PositiveX,
|
|
|
|
|
NegativeX,
|
|
|
|
|
PositiveY,
|
|
|
|
|
NegativeY,
|
|
|
|
|
PositiveZ,
|
|
|
|
|
NegativeZ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Flags]
|
|
|
|
|
public enum BufferUsageFlags : uint
|
|
|
|
|
{
|
|
|
|
|
Vertex = 1,
|
|
|
|
|
Index = 2,
|
2022-08-25 19:32:25 +00:00
|
|
|
|
Compute = 4,
|
|
|
|
|
Indirect = 8
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum VertexElementFormat
|
|
|
|
|
{
|
2022-03-17 21:41:47 +00:00
|
|
|
|
UInt,
|
|
|
|
|
Float,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
Vector2,
|
|
|
|
|
Vector3,
|
|
|
|
|
Vector4,
|
|
|
|
|
Color,
|
|
|
|
|
Byte4,
|
|
|
|
|
Short2,
|
|
|
|
|
Short4,
|
|
|
|
|
NormalizedShort2,
|
|
|
|
|
NormalizedShort4,
|
|
|
|
|
HalfVector2,
|
|
|
|
|
HalfVector4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum VertexInputRate
|
|
|
|
|
{
|
|
|
|
|
Vertex,
|
|
|
|
|
Instance
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum FillMode
|
|
|
|
|
{
|
|
|
|
|
Fill,
|
2022-03-02 19:40:06 +00:00
|
|
|
|
Line
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CullMode
|
|
|
|
|
{
|
|
|
|
|
None,
|
|
|
|
|
Front,
|
2022-03-02 19:40:06 +00:00
|
|
|
|
Back
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum FrontFace
|
|
|
|
|
{
|
|
|
|
|
CounterClockwise,
|
|
|
|
|
Clockwise
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CompareOp
|
|
|
|
|
{
|
|
|
|
|
Never,
|
|
|
|
|
Less,
|
|
|
|
|
Equal,
|
|
|
|
|
LessOrEqual,
|
|
|
|
|
Greater,
|
|
|
|
|
NotEqual,
|
|
|
|
|
GreaterOrEqual,
|
|
|
|
|
Always
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum StencilOp
|
|
|
|
|
{
|
|
|
|
|
Keep,
|
|
|
|
|
Zero,
|
|
|
|
|
Replace,
|
|
|
|
|
IncrementAndClamp,
|
|
|
|
|
DecrementAndClamp,
|
|
|
|
|
Invert,
|
|
|
|
|
IncrementAndWrap,
|
|
|
|
|
DecrementAndWrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum BlendOp
|
|
|
|
|
{
|
|
|
|
|
Add,
|
|
|
|
|
Subtract,
|
|
|
|
|
ReverseSubtract,
|
|
|
|
|
Min,
|
|
|
|
|
Max
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum BlendFactor
|
|
|
|
|
{
|
|
|
|
|
Zero,
|
|
|
|
|
One,
|
|
|
|
|
SourceColor,
|
|
|
|
|
OneMinusSourceColor,
|
|
|
|
|
DestinationColor,
|
|
|
|
|
OneMinusDestinationColor,
|
|
|
|
|
SourceAlpha,
|
|
|
|
|
OneMinusSourceAlpha,
|
|
|
|
|
DestinationAlpha,
|
|
|
|
|
OneMinusDestinationAlpha,
|
|
|
|
|
ConstantColor,
|
|
|
|
|
OneMinusConstantColor,
|
2022-12-29 03:16:50 +00:00
|
|
|
|
SourceAlphaSaturate
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Flags]
|
|
|
|
|
public enum ColorComponentFlags : uint
|
|
|
|
|
{
|
|
|
|
|
R = 1,
|
|
|
|
|
G = 2,
|
|
|
|
|
B = 4,
|
|
|
|
|
A = 8,
|
|
|
|
|
|
|
|
|
|
RG = R | G,
|
|
|
|
|
RB = R | B,
|
|
|
|
|
RA = R | A,
|
|
|
|
|
GB = G | B,
|
|
|
|
|
GA = G | A,
|
|
|
|
|
BA = B | A,
|
|
|
|
|
|
|
|
|
|
RGB = R | G | B,
|
|
|
|
|
RGA = R | G | A,
|
|
|
|
|
GBA = G | B | A,
|
|
|
|
|
|
|
|
|
|
RGBA = R | G | B | A
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ShaderStageType
|
|
|
|
|
{
|
|
|
|
|
Vertex,
|
|
|
|
|
Fragment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum Filter
|
|
|
|
|
{
|
|
|
|
|
Nearest,
|
2022-03-02 19:40:06 +00:00
|
|
|
|
Linear
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum SamplerMipmapMode
|
|
|
|
|
{
|
|
|
|
|
Nearest,
|
|
|
|
|
Linear
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum SamplerAddressMode
|
|
|
|
|
{
|
|
|
|
|
Repeat,
|
|
|
|
|
MirroredRepeat,
|
|
|
|
|
ClampToEdge,
|
|
|
|
|
ClampToBorder
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum BorderColor
|
|
|
|
|
{
|
|
|
|
|
FloatTransparentBlack,
|
|
|
|
|
IntTransparentBlack,
|
|
|
|
|
FloatOpaqueBlack,
|
|
|
|
|
IntOpaqueBlack,
|
|
|
|
|
FloatOpaqueWhite,
|
|
|
|
|
IntOpaqueWhite
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-29 03:15:22 +00:00
|
|
|
|
public enum TransferOptions
|
2024-02-23 08:05:44 +00:00
|
|
|
|
{
|
2024-03-07 22:24:03 +00:00
|
|
|
|
Cycle,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
Overwrite
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public enum WriteOptions
|
2024-02-29 03:15:22 +00:00
|
|
|
|
{
|
2024-03-07 22:24:03 +00:00
|
|
|
|
Cycle,
|
2024-02-29 03:15:22 +00:00
|
|
|
|
SafeOverwrite
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 21:17:59 +00:00
|
|
|
|
public enum Backend
|
|
|
|
|
{
|
|
|
|
|
Vulkan,
|
2024-03-06 00:12:14 +00:00
|
|
|
|
D3D11,
|
2022-09-29 21:17:59 +00:00
|
|
|
|
PS5,
|
|
|
|
|
Invalid
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
/* Native Structures */
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct DepthStencilValue
|
|
|
|
|
{
|
|
|
|
|
public float depth;
|
|
|
|
|
public uint stencil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct Rect
|
|
|
|
|
{
|
|
|
|
|
public int x;
|
|
|
|
|
public int y;
|
|
|
|
|
public int w;
|
|
|
|
|
public int h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct Vec4
|
|
|
|
|
{
|
|
|
|
|
public float x;
|
|
|
|
|
public float y;
|
|
|
|
|
public float z;
|
|
|
|
|
public float w;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct Viewport
|
|
|
|
|
{
|
|
|
|
|
public float x;
|
|
|
|
|
public float y;
|
|
|
|
|
public float w;
|
|
|
|
|
public float h;
|
|
|
|
|
public float minDepth;
|
|
|
|
|
public float maxDepth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct TextureSlice
|
|
|
|
|
{
|
|
|
|
|
public IntPtr texture;
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public uint mipLevel;
|
2024-03-01 07:47:49 +00:00
|
|
|
|
public uint layer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct TextureRegion
|
|
|
|
|
{
|
|
|
|
|
public TextureSlice textureSlice;
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public uint x;
|
|
|
|
|
public uint y;
|
|
|
|
|
public uint z;
|
|
|
|
|
public uint w;
|
|
|
|
|
public uint h;
|
|
|
|
|
public uint d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct BufferImageCopy
|
|
|
|
|
{
|
|
|
|
|
public uint bufferOffset;
|
|
|
|
|
public uint bufferStride;
|
|
|
|
|
public uint bufferImageHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct BufferCopy
|
|
|
|
|
{
|
|
|
|
|
public uint srcOffset;
|
|
|
|
|
public uint dstOffset;
|
|
|
|
|
public uint size;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-04 18:44:44 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct IndirectDrawCommand
|
|
|
|
|
{
|
|
|
|
|
public uint vertexCount;
|
|
|
|
|
public uint instanceCount;
|
|
|
|
|
public uint firstVertex;
|
|
|
|
|
public uint firstInstance;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct SamplerStateCreateInfo
|
|
|
|
|
{
|
|
|
|
|
public Filter minFilter;
|
|
|
|
|
public Filter magFilter;
|
|
|
|
|
public SamplerMipmapMode mipmapMode;
|
|
|
|
|
public SamplerAddressMode addressModeU;
|
|
|
|
|
public SamplerAddressMode addressModeV;
|
|
|
|
|
public SamplerAddressMode addressModeW;
|
|
|
|
|
public float mipLodBias;
|
|
|
|
|
public byte anisotropyEnable;
|
|
|
|
|
public float maxAnisotropy;
|
|
|
|
|
public byte compareEnable;
|
|
|
|
|
public CompareOp compareOp;
|
|
|
|
|
public float minLod;
|
|
|
|
|
public float maxLod;
|
|
|
|
|
public BorderColor borderColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct VertexBinding
|
|
|
|
|
{
|
|
|
|
|
public uint binding;
|
|
|
|
|
public uint stride;
|
|
|
|
|
public VertexInputRate inputRate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct VertexAttribute
|
|
|
|
|
{
|
|
|
|
|
public uint location;
|
|
|
|
|
public uint binding;
|
|
|
|
|
public VertexElementFormat format;
|
|
|
|
|
public uint offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct VertexInputState
|
|
|
|
|
{
|
|
|
|
|
public IntPtr vertexBindings;
|
|
|
|
|
public uint vertexBindingCount;
|
|
|
|
|
public IntPtr vertexAttributes;
|
|
|
|
|
public uint vertexAttributeCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct StencilOpState
|
|
|
|
|
{
|
|
|
|
|
public StencilOp failOp;
|
|
|
|
|
public StencilOp passOp;
|
|
|
|
|
public StencilOp depthFailOp;
|
|
|
|
|
public CompareOp compareOp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-02-26 01:49:40 +00:00
|
|
|
|
public struct ColorAttachmentBlendState
|
2022-02-25 05:33:45 +00:00
|
|
|
|
{
|
|
|
|
|
public byte blendEnable;
|
|
|
|
|
public BlendFactor sourceColorBlendFactor;
|
|
|
|
|
public BlendFactor destinationColorBlendFactor;
|
|
|
|
|
public BlendOp colorBlendOp;
|
|
|
|
|
public BlendFactor sourceAlphaBlendFactor;
|
|
|
|
|
public BlendFactor destinationAlphaBlendFactor;
|
|
|
|
|
public BlendOp alphaBlendOp;
|
|
|
|
|
public ColorComponentFlags colorWriteMask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct ShaderModuleCreateInfo
|
|
|
|
|
{
|
|
|
|
|
public UIntPtr codeSize; /* size_t */
|
|
|
|
|
public IntPtr byteCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct TextureCreateInfo
|
|
|
|
|
{
|
|
|
|
|
public uint width;
|
|
|
|
|
public uint height;
|
|
|
|
|
public uint depth;
|
|
|
|
|
public byte isCube;
|
2024-03-01 07:47:49 +00:00
|
|
|
|
public uint layerCount;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public uint levelCount;
|
2023-01-31 20:27:06 +00:00
|
|
|
|
public SampleCount sampleCount;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public TextureFormat format;
|
|
|
|
|
public TextureUsageFlags usageFlags; /* Refresh_TextureUsageFlags */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public struct GraphicsShaderInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
{
|
|
|
|
|
public IntPtr shaderModule;
|
|
|
|
|
[MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
|
public string entryPointName;
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public uint uniformBufferSize;
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public uint samplerBindingCount;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-26 01:49:40 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public struct ComputeShaderInfo
|
2022-02-26 01:49:40 +00:00
|
|
|
|
{
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public IntPtr shaderModule;
|
|
|
|
|
[MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
|
public string entryPointName;
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public uint uniformBufferSize;
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public uint bufferBindingCount;
|
|
|
|
|
public uint imageBindingCount;
|
2022-02-26 01:49:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct RasterizerState
|
|
|
|
|
{
|
|
|
|
|
public FillMode fillMode;
|
|
|
|
|
public CullMode cullMode;
|
|
|
|
|
public FrontFace frontFace;
|
|
|
|
|
public byte depthBiasEnable;
|
|
|
|
|
public float depthBiasConstantFactor;
|
|
|
|
|
public float depthBiasClamp;
|
|
|
|
|
public float depthBiasSlopeFactor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct MultisampleState
|
|
|
|
|
{
|
|
|
|
|
public SampleCount multisampleCount;
|
|
|
|
|
public uint sampleMask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct DepthStencilState
|
|
|
|
|
{
|
|
|
|
|
public byte depthTestEnable;
|
|
|
|
|
public byte depthWriteEnable;
|
|
|
|
|
public CompareOp compareOp;
|
|
|
|
|
public byte depthBoundsTestEnable;
|
|
|
|
|
public byte stencilTestEnable;
|
2024-03-03 07:10:29 +00:00
|
|
|
|
public StencilOpState backStencilState;
|
|
|
|
|
public StencilOpState frontStencilState;
|
|
|
|
|
public uint compareMask;
|
|
|
|
|
public uint writeMask;
|
|
|
|
|
public uint reference;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public float minDepthBounds;
|
|
|
|
|
public float maxDepthBounds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct ColorAttachmentDescription
|
|
|
|
|
{
|
|
|
|
|
public TextureFormat format;
|
2022-02-26 01:49:40 +00:00
|
|
|
|
public ColorAttachmentBlendState blendState;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct GraphicsPipelineAttachmentInfo
|
|
|
|
|
{
|
|
|
|
|
public IntPtr colorAttachmentDescriptions; /* Max size 4 */
|
|
|
|
|
public uint colorAttachmentCount;
|
|
|
|
|
public byte hasDepthStencilAttachment;
|
|
|
|
|
public TextureFormat depthStencilFormat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public unsafe struct GraphicsPipelineCreateInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
{
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public GraphicsShaderInfo vertexShaderInfo;
|
|
|
|
|
public GraphicsShaderInfo fragmentShaderInfo;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public VertexInputState vertexInputState;
|
|
|
|
|
public PrimitiveType primitiveType;
|
|
|
|
|
public RasterizerState rasterizerState;
|
|
|
|
|
public MultisampleState multisampleState;
|
|
|
|
|
public DepthStencilState depthStencilState;
|
|
|
|
|
public GraphicsPipelineAttachmentInfo attachmentInfo;
|
2022-03-02 19:40:06 +00:00
|
|
|
|
public fixed float blendConstants[4];
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 07:47:49 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public struct ColorAttachmentInfo
|
|
|
|
|
{
|
2024-03-01 07:47:49 +00:00
|
|
|
|
public TextureSlice textureSlice;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public Vec4 clearColor;
|
|
|
|
|
public LoadOp loadOp;
|
|
|
|
|
public StoreOp storeOp;
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public WriteOptions writeOption;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 07:47:49 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public struct DepthStencilAttachmentInfo
|
|
|
|
|
{
|
2024-03-01 07:47:49 +00:00
|
|
|
|
public TextureSlice textureSlice;
|
2022-03-02 06:56:46 +00:00
|
|
|
|
public DepthStencilValue depthStencilClearValue;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
public LoadOp loadOp;
|
|
|
|
|
public StoreOp storeOp;
|
|
|
|
|
public LoadOp stencilLoadOp;
|
|
|
|
|
public StoreOp stencilStoreOp;
|
2024-03-01 20:42:04 +00:00
|
|
|
|
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;
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Logging */
|
|
|
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
|
|
|
public delegate void Refresh_LogFunc(IntPtr msg);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_HookLogFunctions(
|
|
|
|
|
Refresh_LogFunc info,
|
|
|
|
|
Refresh_LogFunc warn,
|
|
|
|
|
Refresh_LogFunc error
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/* Init/Quit */
|
|
|
|
|
|
2022-09-29 21:17:59 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-07 18:34:14 +00:00
|
|
|
|
public static unsafe extern Backend Refresh_SelectBackend(
|
|
|
|
|
Backend* preferredBackends,
|
|
|
|
|
uint preferredBackendCount,
|
2022-09-29 21:17:59 +00:00
|
|
|
|
out uint flags
|
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern IntPtr Refresh_CreateDevice(
|
|
|
|
|
byte debugMode
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_DestroyDevice(IntPtr device);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
/* State Creation */
|
2022-02-25 05:33:45 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateComputePipeline(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in ComputeShaderInfo computeShaderInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateGraphicsPipeline(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateSampler(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in SamplerStateCreateInfo samplerStateCreateInfo
|
2022-08-25 19:32:25 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateShaderModule(
|
2022-08-25 19:32:25 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in ShaderModuleCreateInfo shaderModuleCreateInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateTexture(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in TextureCreateInfo textureCreateInfo
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern IntPtr Refresh_CreateGpuBuffer(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
BufferUsageFlags usageFlags,
|
|
|
|
|
uint sizeInBytes
|
|
|
|
|
);
|
2022-02-25 05:33:45 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 17:55:45 +00:00
|
|
|
|
public static extern IntPtr Refresh_CreateTransferBuffer(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
uint sizeInBytes
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
/* Disposal */
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_QueueDestroyTexture(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr texture
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_QueueDestroySampler(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr sampler
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_QueueDestroyGpuBuffer(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr gpuBuffer
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 17:55:45 +00:00
|
|
|
|
public static extern void Refresh_QueueDestroyTransferBuffer(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr transferBuffer
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_QueueDestroyShaderModule(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr shaderModule
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_QueueDestroyComputePipeline(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr computePipeline
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_QueueDestroyGraphicsPipeline(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr graphicsPipeline
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
/* Graphics State */
|
2022-02-25 05:33:45 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_BeginRenderPass(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr colorAttachmentInfos,
|
|
|
|
|
uint colorAttachmentCount,
|
|
|
|
|
IntPtr depthStencilAttachmentInfo /* can be NULL */
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static unsafe extern void Refresh_BeginRenderPass(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
ColorAttachmentInfo* colorAttachmentInfos,
|
|
|
|
|
uint colorAttachmentCount,
|
|
|
|
|
DepthStencilAttachmentInfo* depthStencilAttachmentInfo /* can be NULL */
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_BindGraphicsPipeline(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr graphicsPipeline
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_SetViewport(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in Viewport viewport
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_SetScissor(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
in Rect scissor
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public static extern unsafe void Refresh_BindVertexBuffers(
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
uint firstBinding,
|
|
|
|
|
uint bindingCount,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
BufferBinding* pBindings
|
2024-02-23 08:05:44 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_BindIndexBuffer(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
in BufferBinding pBinding,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IndexElementSize indexElementSize
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public static extern unsafe void Refresh_BindVertexSamplers(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
TextureSamplerBinding* pBindings
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public static extern unsafe void Refresh_BindFragmentSamplers(
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
TextureSamplerBinding* pBindings
|
2024-02-23 08:05:44 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_PushVertexShaderUniforms(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
IntPtr data,
|
|
|
|
|
uint dataLengthInBytes
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_PushFragmentShaderUniforms(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
IntPtr data,
|
|
|
|
|
uint dataLengthInBytes
|
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_DrawInstancedPrimitives(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
uint baseVertex,
|
|
|
|
|
uint startIndex,
|
|
|
|
|
uint primitiveCount,
|
|
|
|
|
uint instanceCount
|
|
|
|
|
);
|
2022-02-25 05:33:45 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_DrawIndexedPrimitives(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
uint baseVertex,
|
|
|
|
|
uint startIndex,
|
|
|
|
|
uint primitiveCount
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_DrawPrimitives(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
uint vertexStart,
|
|
|
|
|
uint primitiveCount
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_DrawPrimitivesIndirect(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr gpuBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
uint offsetInBytes,
|
|
|
|
|
uint drawCount,
|
|
|
|
|
uint stride
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_EndRenderPass(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
/* Compute Pass */
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_BeginComputePass(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_BindComputePipeline(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr computePipeline
|
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public static extern unsafe void Refresh_BindComputeBuffers(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
ComputeBufferBinding* pBindings
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-03-01 20:42:04 +00:00
|
|
|
|
public static extern unsafe void Refresh_BindComputeTextures(
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
ComputeTextureBinding* pBindings
|
2024-02-23 08:05:44 +00:00
|
|
|
|
);
|
2022-02-25 05:33:45 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_PushComputeShaderUniforms(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr data,
|
|
|
|
|
uint dataLengthInBytes
|
2022-03-07 06:32:41 +00:00
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_DispatchCompute(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
uint groupCountX,
|
|
|
|
|
uint groupCountY,
|
|
|
|
|
uint groupCountZ
|
2022-03-07 06:32:41 +00:00
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_EndComputePass(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer
|
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 17:55:45 +00:00
|
|
|
|
/* TransferBuffer Set/Get */
|
2024-02-23 08:05:44 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-29 03:15:22 +00:00
|
|
|
|
public static extern IntPtr Refresh_SetTransferData(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr data,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr transferBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
in BufferCopy copyParams,
|
2024-02-29 03:15:22 +00:00
|
|
|
|
TransferOptions option
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-29 03:15:22 +00:00
|
|
|
|
public static extern void Refresh_GetTransferData(
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr device,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr transferBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr data,
|
|
|
|
|
in BufferCopy copyParams
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/* Copy Pass */
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_BeginCopyPass(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_UploadToTexture(
|
2022-03-04 21:21:00 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr transferBuffer,
|
2024-03-06 01:38:06 +00:00
|
|
|
|
in TextureRegion textureRegion,
|
2024-02-29 03:15:22 +00:00
|
|
|
|
in BufferImageCopy copyParams,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
WriteOptions writeOption
|
2022-03-04 21:21:00 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_UploadToBuffer(
|
2022-03-04 21:21:00 +00:00
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 17:55:45 +00:00
|
|
|
|
IntPtr transferBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr gpuBuffer,
|
2024-02-29 03:15:22 +00:00
|
|
|
|
in BufferCopy copyParams,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
WriteOptions writeOption
|
2022-03-04 21:21:00 +00:00
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_CopyTextureToTexture(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-02-19 05:01:59 +00:00
|
|
|
|
IntPtr commandBuffer,
|
2024-03-01 07:47:49 +00:00
|
|
|
|
in TextureRegion source,
|
|
|
|
|
in TextureRegion destination,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
WriteOptions writeOption
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_CopyBufferToBuffer(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-02-19 05:01:59 +00:00
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr source,
|
|
|
|
|
IntPtr destination,
|
2024-02-29 03:15:22 +00:00
|
|
|
|
in BufferCopy copyParams,
|
2024-03-01 20:42:04 +00:00
|
|
|
|
WriteOptions writeOption
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2024-02-23 08:05:44 +00:00
|
|
|
|
public static extern void Refresh_GenerateMipmaps(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-02-19 05:01:59 +00:00
|
|
|
|
IntPtr commandBuffer,
|
2024-02-23 08:05:44 +00:00
|
|
|
|
IntPtr texture
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_EndCopyPass(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
2021-01-06 02:00:26 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
/* Submission/Presentation */
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2022-09-29 21:17:59 +00:00
|
|
|
|
public static extern byte Refresh_ClaimWindow(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-09-29 21:17:59 +00:00
|
|
|
|
IntPtr windowHandle,
|
|
|
|
|
PresentMode presentMode
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2022-09-29 21:17:59 +00:00
|
|
|
|
public static extern void Refresh_UnclaimWindow(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr windowHandle
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_SetSwapchainPresentMode(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-03-10 18:25:16 +00:00
|
|
|
|
IntPtr windowHandle,
|
2022-09-29 21:17:59 +00:00
|
|
|
|
PresentMode presentMode
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2022-03-02 06:56:46 +00:00
|
|
|
|
public static extern TextureFormat Refresh_GetSwapchainFormat(
|
2022-02-25 05:33:45 +00:00
|
|
|
|
IntPtr device,
|
2022-02-09 01:17:00 +00:00
|
|
|
|
IntPtr windowHandle
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
2022-09-29 21:17:59 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern IntPtr Refresh_AcquireCommandBuffer(
|
2023-01-14 18:04:17 +00:00
|
|
|
|
IntPtr device
|
2022-09-29 21:17:59 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern IntPtr Refresh_AcquireSwapchainTexture(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer,
|
|
|
|
|
IntPtr windowHandle,
|
|
|
|
|
out uint width,
|
|
|
|
|
out uint height
|
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_Submit(
|
|
|
|
|
IntPtr device,
|
2023-09-19 06:16:38 +00:00
|
|
|
|
IntPtr commandBuffer
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern IntPtr Refresh_SubmitAndAcquireFence(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr commandBuffer
|
2022-02-25 05:33:45 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_Wait(
|
|
|
|
|
IntPtr device
|
|
|
|
|
);
|
|
|
|
|
|
2023-09-19 06:16:38 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_WaitForFences(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
byte waitAll,
|
|
|
|
|
uint fenceCount,
|
|
|
|
|
IntPtr pFences
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern int Refresh_QueryFence(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr fence
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_ReleaseFence(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr fence
|
|
|
|
|
);
|
|
|
|
|
|
2024-03-06 01:38:06 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_DownloadFromTexture(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
in TextureRegion textureRegion,
|
|
|
|
|
IntPtr transferBuffer,
|
|
|
|
|
in BufferImageCopy copyParams,
|
|
|
|
|
TransferOptions transferOption
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern void Refresh_DownloadFromBuffer(
|
|
|
|
|
IntPtr device,
|
|
|
|
|
IntPtr gpuBuffer,
|
|
|
|
|
IntPtr transferBuffer,
|
|
|
|
|
in BufferCopy copyParams,
|
|
|
|
|
TransferOptions transferOption
|
|
|
|
|
);
|
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2023-04-19 06:49:14 +00:00
|
|
|
|
public static extern IntPtr Refresh_Image_Load(
|
|
|
|
|
IntPtr bufferPtr,
|
2023-04-04 00:27:34 +00:00
|
|
|
|
int bufferLength,
|
2023-04-19 06:49:14 +00:00
|
|
|
|
out int w,
|
|
|
|
|
out int h,
|
|
|
|
|
out int len
|
2023-04-04 00:27:34 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-23 08:05:44 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
public static extern byte Refresh_Image_Info(
|
|
|
|
|
IntPtr bufferPtr,
|
|
|
|
|
int bufferLength,
|
|
|
|
|
out int w,
|
|
|
|
|
out int h,
|
|
|
|
|
out int len
|
|
|
|
|
);
|
|
|
|
|
|
2023-04-04 00:27:34 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2023-04-19 06:49:14 +00:00
|
|
|
|
public static extern void Refresh_Image_Free(IntPtr mem);
|
2023-04-04 00:27:34 +00:00
|
|
|
|
|
2022-02-25 05:33:45 +00:00
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
2023-04-19 06:49:14 +00:00
|
|
|
|
public static extern IntPtr Refresh_Image_SavePNG(
|
2023-04-04 00:27:34 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.LPStr)] string filename,
|
2023-04-19 06:49:14 +00:00
|
|
|
|
IntPtr data,
|
2023-04-04 00:27:34 +00:00
|
|
|
|
int w,
|
2023-04-19 06:49:14 +00:00
|
|
|
|
int h
|
2023-04-04 00:27:34 +00:00
|
|
|
|
);
|
2022-02-25 05:33:45 +00:00
|
|
|
|
}
|
2021-01-05 23:33:38 +00:00
|
|
|
|
}
|