forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP on native wrapper, generator, and vulkan graphics.
- Loading branch information
1 parent
4305687
commit 93dd444
Showing
44 changed files
with
12,154 additions
and
2,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
// MonoGame - Copyright (C) The MonoGame Team | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE.txt', which is part of this source code package. | ||
|
||
using Microsoft.Xna.Framework.Graphics; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace MonoGame.Interop; | ||
|
||
internal struct PtrTo<T> | ||
{ | ||
public unsafe T* Ptr; | ||
} | ||
|
||
internal readonly struct MGG_GraphicsDevice { } | ||
internal readonly struct MGG_Buffer { } | ||
internal readonly struct MGG_Texture { } | ||
|
||
internal struct MGG_GraphicsDevice_Caps | ||
{ | ||
public int MaxTextureSlots; | ||
public int MaxVertexTextureSlots; | ||
public int MaxVertexBufferSlots; | ||
} | ||
|
||
internal enum TextureType | ||
{ | ||
_2D, | ||
_3D, | ||
Cube, | ||
} | ||
|
||
internal static unsafe partial class MGG | ||
{ | ||
#region GraphicsDevice | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_Create", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial MGG_GraphicsDevice* GraphicsDevice_Create(); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_GetCaps", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void GraphicsDevice_GetCaps(MGG_GraphicsDevice* device, out MGG_GraphicsDevice_Caps caps); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_ResetBackbuffer", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void GraphicsDevice_ResetBackbuffer(MGG_GraphicsDevice* device, int width, int height, SurfaceFormat color, DepthFormat depth); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_BeginFrame", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial int GraphicsDevice_BeginFrame(MGG_GraphicsDevice* device); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_Present", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void GraphicsDevice_Present(MGG_GraphicsDevice* device, int currentFrame); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_GraphicsDevice_BindConstantBuffer", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void GraphicsDevice_BindConstantBuffer(MGG_GraphicsDevice* device, ShaderStage stage, int slot, MGG_Buffer* buffer); | ||
|
||
#endregion | ||
|
||
#region Buffer | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Buffer_Create", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial MGG_Buffer* Buffer_Create(MGG_GraphicsDevice* device, int sizeInBytes); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Buffer_Destroy", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Buffer_Destroy(MGG_GraphicsDevice* device, MGG_Buffer* buffer); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Buffer_SetData", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Buffer_SetData( | ||
MGG_GraphicsDevice* device, | ||
ref MGG_Buffer* buffer, | ||
int offset, | ||
byte* data, | ||
int length, | ||
[MarshalAs(UnmanagedType.U1)] | ||
bool discard); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Buffer_GetData", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Buffer_GetData( | ||
MGG_GraphicsDevice* device, | ||
MGG_Buffer* buffer, | ||
int offset, | ||
byte* data, | ||
int dataCount, | ||
int dataBytes, | ||
int dataStride); | ||
|
||
#endregion | ||
|
||
#region Texture | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Texture_Create", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial MGG_Texture* Texture_Create(MGG_GraphicsDevice* device, TextureType type, SurfaceFormat format, int width, int height, int depth, int mipmaps, int slices); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_RenderTarget_Create", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial MGG_Texture* RenderTarget_Create( | ||
MGG_GraphicsDevice* device, | ||
TextureType type, | ||
SurfaceFormat format, | ||
int width, | ||
int height, | ||
int depth, | ||
int mipmaps, | ||
int slices, | ||
DepthFormat depthFormat, | ||
int multiSampleCount, | ||
RenderTargetUsage usage); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Texture_Destroy", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Texture_Destroy(MGG_GraphicsDevice* device, MGG_Texture* texture); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Texture_SetData", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Texture_SetData( | ||
MGG_GraphicsDevice* device, | ||
MGG_Texture* texture, | ||
int level, | ||
int slice, | ||
int x, | ||
int y, | ||
int z, | ||
int width, | ||
int height, | ||
int depth, | ||
byte* data, | ||
int dataBytes); | ||
|
||
[LibraryImport("monogame", EntryPoint = "MGG_Texture_GetData", StringMarshalling = StringMarshalling.Utf8)] | ||
public static partial void Texture_GetData( | ||
MGG_GraphicsDevice* device, | ||
MGG_Texture* texture, | ||
int level, | ||
int slice, | ||
int x, | ||
int y, | ||
int z, | ||
int width, | ||
int height, | ||
int depth, | ||
byte* data, | ||
int dataBytes); | ||
|
||
#endregion | ||
} |
Oops, something went wrong.