mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 08:06:02 +08:00
Improve generator and adding objects for getting WIC to work.
This commit is contained in:
@@ -11,11 +11,15 @@ public static class Program
|
||||
{
|
||||
private static readonly string[] jsons = new[]
|
||||
{
|
||||
//"System.Com.json",
|
||||
|
||||
"Graphics.json",
|
||||
"Graphics.Dxgi.Common.json",
|
||||
"Graphics.Dxgi.json",
|
||||
"Graphics.Direct3D.json",
|
||||
"Graphics.Direct3D11.json",
|
||||
"Graphics.Direct3D12.json",
|
||||
//"Graphics.Imaging.json",
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> s_csNameMappings = new()
|
||||
@@ -55,11 +59,17 @@ public static class Program
|
||||
|
||||
{ "Foundation.LUID", "Luid" },
|
||||
{ "Foundation.LARGE_INTEGER", "LargeInterger" },
|
||||
{ "Foundation.ULARGE_INTEGER", "ULargeInterger" },
|
||||
|
||||
{ "System.Com.IUnknown", "IUnknown" },
|
||||
{ "System.Com.ISequentialStream", "Com.ISequentialStream" },
|
||||
{ "System.Com.IStream", "Com.IStream" },
|
||||
|
||||
{ "Graphics.Gdi.HMONITOR", "IntPtr" },
|
||||
{ "Graphics.Gdi.HDC", "IntPtr" },
|
||||
{ "Graphics.Gdi.HBITMAP", "IntPtr" },
|
||||
{ "Graphics.Gdi.HPALETTE", "IntPtr" },
|
||||
{ "UI.WindowsAndMessaging.HICON", "IntPtr" },
|
||||
|
||||
{ "Graphics.Direct3D.D3DVECTOR", "Vector3" },
|
||||
{ "Graphics.Direct3D.D3DMATRIX", "Matrix4x4" },
|
||||
@@ -330,6 +340,9 @@ public static class Program
|
||||
|
||||
// D3D12
|
||||
{ "D3D12_RLDO_FLAGS", "ReportLiveDeviceObjectFlags" },
|
||||
|
||||
// D2D1
|
||||
{ "D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE", "AffineTransform2DInterpolationMode" },
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> s_structFieldTypeRemap = new()
|
||||
@@ -443,14 +456,25 @@ public static class Program
|
||||
|
||||
fileName += splits[i];
|
||||
}
|
||||
string ns = fileName;
|
||||
|
||||
string ns = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(fileName) == true)
|
||||
{
|
||||
fileName = splits[0];
|
||||
ns = folderRoot;
|
||||
}
|
||||
else
|
||||
{
|
||||
ns = $"{folderRoot}.{fileName}";
|
||||
}
|
||||
|
||||
fileName += ".cs";
|
||||
|
||||
using var writer = new CodeWriter(
|
||||
Path.Combine(outputFolder, fileName),
|
||||
$"{folderRoot}.{ns}",
|
||||
ns,
|
||||
docFile,
|
||||
$"Win32.{folderRoot}.{ns}");
|
||||
$"Win32.{ns}");
|
||||
|
||||
GenerateConstants(writer, api);
|
||||
GenerateTypes(writer, api);
|
||||
@@ -509,7 +533,7 @@ public static class Program
|
||||
|
||||
private static void GenerateTypes(CodeWriter writer, ApiData api)
|
||||
{
|
||||
writer.WriteLine($"#region Enums");
|
||||
bool regionWritten = false;
|
||||
foreach (ApiType enumType in api.Types.Where(item => item.Kind.ToLowerInvariant() == "enum"))
|
||||
{
|
||||
if (enumType.Name.StartsWith("D3DX11"))
|
||||
@@ -517,19 +541,28 @@ public static class Program
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#region Enums");
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateEnum(writer, enumType, false);
|
||||
|
||||
s_visitedEnums.Add($"{writer.Api}.{enumType.Name}");
|
||||
}
|
||||
|
||||
writer.WriteLine($"#endregion Enums");
|
||||
writer.WriteLine();
|
||||
if (regionWritten)
|
||||
{
|
||||
writer.WriteLine("#endregion Enums");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
// Generated enums -> from constants
|
||||
writer.WriteLine($"#region Generated Enums");
|
||||
var createdEnums = new Dictionary<string, ApiType>();
|
||||
regionWritten = false;
|
||||
Dictionary<string, ApiType> createdEnums = new();
|
||||
|
||||
foreach (var constant in api.Constants)
|
||||
foreach (ApiDataConstant constant in api.Constants)
|
||||
{
|
||||
if (ShouldSkipConstant(constant))
|
||||
continue;
|
||||
@@ -572,14 +605,24 @@ public static class Program
|
||||
|
||||
foreach (ApiType enumType in createdEnums.Values)
|
||||
{
|
||||
if (!regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#region Generated Enums");
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateEnum(writer, enumType, true);
|
||||
}
|
||||
|
||||
writer.WriteLine($"#endregion Generated Enums");
|
||||
writer.WriteLine();
|
||||
if (regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#endregion Generated Enums");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
// Unions
|
||||
writer.WriteLine($"#region Unions");
|
||||
regionWritten = false;
|
||||
|
||||
foreach (ApiType structType in api.Types.Where(item => item.Kind.ToLowerInvariant() == "union"))
|
||||
{
|
||||
if (structType.Name.StartsWith("D3DX11") ||
|
||||
@@ -593,15 +636,25 @@ public static class Program
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#region Unions");
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateStruct(writer, structType);
|
||||
|
||||
s_visitedStructs.Add($"{writer.Api}.{structType.Name}");
|
||||
}
|
||||
writer.WriteLine($"#endregion Unions");
|
||||
writer.WriteLine();
|
||||
|
||||
if (regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#endregion Unions");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
// Structs
|
||||
writer.WriteLine($"#region Structs");
|
||||
regionWritten = false;
|
||||
foreach (ApiType structType in api.Types.Where(item => item.Kind.ToLowerInvariant() == "struct"))
|
||||
{
|
||||
if (structType.Name.StartsWith("D3DX11") ||
|
||||
@@ -615,15 +668,24 @@ public static class Program
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!regionWritten)
|
||||
{
|
||||
writer.WriteLine($"#region Structs");
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateStruct(writer, structType);
|
||||
|
||||
s_visitedStructs.Add($"{writer.Api}.{structType.Name}");
|
||||
}
|
||||
writer.WriteLine($"#endregion Structs");
|
||||
writer.WriteLine();
|
||||
if (regionWritten)
|
||||
{
|
||||
writer.WriteLine("#endregion Structs");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
// Com types
|
||||
writer.WriteLine($"#region COM Types");
|
||||
regionWritten = false;
|
||||
foreach (ApiType comType in api.Types.Where(item => item.Kind.ToLowerInvariant() == "com"))
|
||||
{
|
||||
if (comType.Name.StartsWith("ID3DX11"))
|
||||
@@ -631,10 +693,19 @@ public static class Program
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!regionWritten)
|
||||
{
|
||||
writer.WriteLine("#region COM Types");
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
// Generate methods
|
||||
List<KeyValuePair<ApiFunction, string>> methodsToGenerate = new();
|
||||
ApiType iterateType = comType;
|
||||
while (iterateType.Interface != null && iterateType.Interface.Name != "IUnknown")
|
||||
while (iterateType.Interface != null
|
||||
&& iterateType.Interface.Name != "IUnknown"
|
||||
&& iterateType.Interface.Name != "IStream"
|
||||
&& iterateType.Interface.Name != "IPersistStream")
|
||||
{
|
||||
iterateType = api.Types.First(item => item.Name == iterateType.Interface.Name);
|
||||
|
||||
@@ -642,7 +713,6 @@ public static class Program
|
||||
{
|
||||
methodsToGenerate.Add(new(method, iterateType.Name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach (ApiFunction method in comType.Methods)
|
||||
@@ -653,8 +723,11 @@ public static class Program
|
||||
GenerateComType(api, writer, comType, methodsToGenerate);
|
||||
}
|
||||
|
||||
writer.WriteLine($"#endregion Com Types");
|
||||
writer.WriteLine();
|
||||
if (regionWritten)
|
||||
{
|
||||
writer.WriteLine("#endregion Com Types");
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateFunctions(CodeWriter writer, ApiData api)
|
||||
@@ -971,7 +1044,8 @@ public static class Program
|
||||
writer.WriteLine("[FieldOffset(0)]");
|
||||
}
|
||||
|
||||
writer.WriteLine($"public unsafe fixed {fieldTypeName} {fieldValueName}[{field.Type.Shape.Size}];");
|
||||
int arraySize = field.Type.Shape != null ? field.Type.Shape.Size : 1;
|
||||
writer.WriteLine($"public unsafe fixed {fieldTypeName} {fieldValueName}[{arraySize}];");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
81
src/Vortice.Win32/Com/ISequentialStream.cs
Normal file
81
src/Vortice.Win32/Com/ISequentialStream.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static Win32.Apis;
|
||||
|
||||
namespace Win32.Com;
|
||||
|
||||
[Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D")]
|
||||
[NativeTypeName("struct ISequentialStream : IUnknown")]
|
||||
[NativeInheritance("IUnknown")]
|
||||
public unsafe partial struct ISequentialStream
|
||||
{
|
||||
public static ref readonly Guid IID_ISequentialStream
|
||||
{
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0x30, 0x3A, 0x73, 0x0C,
|
||||
0x1C, 0x2A,
|
||||
0xCE, 0x11,
|
||||
0xAD,
|
||||
0xE5,
|
||||
0x00,
|
||||
0xAA,
|
||||
0x00,
|
||||
0x44,
|
||||
0x77,
|
||||
0x3D
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_ISequentialStream));
|
||||
|
||||
public void** lpVtbl;
|
||||
|
||||
/// <inheritdoc cref="IUnknown.QueryInterface" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(0)]
|
||||
public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, Guid*, void**, int>)(lpVtbl[0]))((ISequentialStream*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.AddRef" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, uint>)(lpVtbl[1]))((ISequentialStream*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.Release" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, uint>)(lpVtbl[2]))((ISequentialStream*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
public HResult Read(void* pv, uint cb, uint* pcbRead)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, void*, uint, uint*, int>)(lpVtbl[3]))((ISequentialStream*)Unsafe.AsPointer(ref this), pv, cb, pcbRead);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(4)]
|
||||
public HResult Write([NativeTypeName("const void *")] void* pv, [NativeTypeName("ULONG")] uint cb, [NativeTypeName("ULONG *")] uint* pcbWritten)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, void*, uint, uint*, int>)(lpVtbl[4]))((ISequentialStream*)Unsafe.AsPointer(ref this), pv, cb, pcbWritten);
|
||||
}
|
||||
}
|
||||
148
src/Vortice.Win32/Com/IStream.cs
Normal file
148
src/Vortice.Win32/Com/IStream.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Win32.Com;
|
||||
|
||||
[Guid("0000000C-0000-0000-C000-000000000046")]
|
||||
[NativeTypeName("struct IStream : ISequentialStream")]
|
||||
[NativeInheritance("ISequentialStream")]
|
||||
public unsafe partial struct IStream
|
||||
{
|
||||
public static ref readonly Guid IID_IStream
|
||||
{
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0x0C, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0xC0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x46
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_IStream));
|
||||
|
||||
public void** lpVtbl;
|
||||
|
||||
/// <inheritdoc cref="IUnknown.QueryInterface" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(0)]
|
||||
public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, Guid*, void**, int>)(lpVtbl[0]))((ISequentialStream*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.AddRef" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, uint>)(lpVtbl[1]))((ISequentialStream*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.Release" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ISequentialStream*, uint>)(lpVtbl[2]))((ISequentialStream*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ISequentialStream.Read" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
public HResult Read(void* pv, uint cb, uint* pcbRead)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, void*, uint, uint*, int>)(lpVtbl[3]))((IStream*)Unsafe.AsPointer(ref this), pv, cb, pcbRead);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ISequentialStream.Write" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(4)]
|
||||
public HResult Write(void* pv, uint cb, uint* pcbWritten)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, void*, uint, uint*, int>)(lpVtbl[4]))((IStream*)Unsafe.AsPointer(ref this), pv, cb, pcbWritten);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(5)]
|
||||
public HResult Seek(LargeInterger dlibMove, uint dwOrigin, LargeInterger* plibNewPosition)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, LargeInterger, uint, LargeInterger*, int>)(lpVtbl[5]))((IStream*)Unsafe.AsPointer(ref this), dlibMove, dwOrigin, plibNewPosition);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(6)]
|
||||
public HResult SetSize(LargeInterger libNewSize)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, LargeInterger, int>)(lpVtbl[6]))((IStream*)Unsafe.AsPointer(ref this), libNewSize);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(7)]
|
||||
public HResult CopyTo(IStream* pstm, ULargeInterger cb, ULargeInterger* pcbRead, ULargeInterger* pcbWritten)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, IStream*, ULargeInterger, ULargeInterger*, ULargeInterger*, int>)(lpVtbl[7]))((IStream*)Unsafe.AsPointer(ref this), pstm, cb, pcbRead, pcbWritten);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(8)]
|
||||
public HResult Commit(uint grfCommitFlags)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, uint, int>)(lpVtbl[8]))((IStream*)Unsafe.AsPointer(ref this), grfCommitFlags);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(9)]
|
||||
public HResult Revert()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, int>)(lpVtbl[9]))((IStream*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
///// <include file='IStream.xml' path='doc/member[@name="IStream.LockRegion"]/*' />
|
||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
//[VtblIndex(10)]
|
||||
//public HRESULT LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, [NativeTypeName("DWORD")] uint dwLockType)
|
||||
//{
|
||||
// return ((delegate* unmanaged[Stdcall]<IStream*, ULARGE_INTEGER, ULARGE_INTEGER, uint, int>)(lpVtbl[10]))((IStream*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType);
|
||||
//}
|
||||
|
||||
///// <include file='IStream.xml' path='doc/member[@name="IStream.UnlockRegion"]/*' />
|
||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
//[VtblIndex(11)]
|
||||
//public HRESULT UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, [NativeTypeName("DWORD")] uint dwLockType)
|
||||
//{
|
||||
// return ((delegate* unmanaged[Stdcall]<IStream*, ULARGE_INTEGER, ULARGE_INTEGER, uint, int>)(lpVtbl[11]))((IStream*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType);
|
||||
//}
|
||||
|
||||
///// <include file='IStream.xml' path='doc/member[@name="IStream.Stat"]/*' />
|
||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
//[VtblIndex(12)]
|
||||
//public HRESULT Stat(STATSTG* pstatstg, [NativeTypeName("DWORD")] uint grfStatFlag)
|
||||
//{
|
||||
// return ((delegate* unmanaged[Stdcall]<IStream*, STATSTG*, uint, int>)(lpVtbl[12]))((IStream*)Unsafe.AsPointer(ref this), pstatstg, grfStatFlag);
|
||||
//}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(13)]
|
||||
public HResult Clone(IStream** ppstm)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IStream*, IStream**, int>)(lpVtbl[13]))((IStream*)Unsafe.AsPointer(ref this), ppstm);
|
||||
}
|
||||
}
|
||||
@@ -1067,12 +1067,6 @@ public enum ParameterFlags : int
|
||||
|
||||
#endregion Enums
|
||||
|
||||
#region Generated Enums
|
||||
#endregion Generated Enums
|
||||
|
||||
#region Unions
|
||||
#endregion Unions
|
||||
|
||||
#region Structs
|
||||
/// <include file='../Direct3D.xml' path='doc/member[@name="D3D_SHADER_MACRO"]/*' />
|
||||
/// <unmanaged>D3D_SHADER_MACRO</unmanaged>
|
||||
|
||||
@@ -6963,9 +6963,6 @@ public enum TraceRegisterType : int
|
||||
|
||||
#endregion Enums
|
||||
|
||||
#region Generated Enums
|
||||
#endregion Generated Enums
|
||||
|
||||
#region Unions
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_AUTHENTICATED_PROTECTION_FLAGS"]/*' />
|
||||
/// <unmanaged>D3D11_AUTHENTICATED_PROTECTION_FLAGS</unmanaged>
|
||||
|
||||
@@ -6698,12 +6698,6 @@ public enum ShaderVersionType : int
|
||||
|
||||
#endregion Enums
|
||||
|
||||
#region Generated Enums
|
||||
#endregion Generated Enums
|
||||
|
||||
#region Unions
|
||||
#endregion Unions
|
||||
|
||||
#region Structs
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_COMMAND_QUEUE_DESC"]/*' />
|
||||
/// <unmanaged>D3D12_COMMAND_QUEUE_DESC</unmanaged>
|
||||
|
||||
@@ -570,9 +570,6 @@ public enum CpuAccess : uint
|
||||
|
||||
#endregion Generated Enums
|
||||
|
||||
#region Unions
|
||||
#endregion Unions
|
||||
|
||||
#region Structs
|
||||
/// <include file='../Dxgi.xml' path='doc/member[@name="DXGI_RATIONAL"]/*' />
|
||||
/// <unmanaged>DXGI_RATIONAL</unmanaged>
|
||||
@@ -1745,6 +1742,3 @@ public partial struct JpegQuantizationTable
|
||||
|
||||
#endregion Structs
|
||||
|
||||
#region COM Types
|
||||
#endregion Com Types
|
||||
|
||||
|
||||
@@ -1650,9 +1650,6 @@ public enum WindowAssociationFlags : uint
|
||||
|
||||
#endregion Generated Enums
|
||||
|
||||
#region Unions
|
||||
#endregion Unions
|
||||
|
||||
#region Structs
|
||||
/// <include file='../Dxgi.xml' path='doc/member[@name="DXGI_RGBA"]/*' />
|
||||
/// <unmanaged>DXGI_RGBA</unmanaged>
|
||||
|
||||
51
src/Vortice.Win32/Generated/Graphics/Graphics.cs
Normal file
51
src/Vortice.Win32/Generated/Graphics/Graphics.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
using MemoryMarshal = Win32.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
namespace Win32.Graphics;
|
||||
|
||||
public static partial class Apis
|
||||
{
|
||||
}
|
||||
|
||||
#region Enums
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE</unmanaged>
|
||||
public enum AffineTransform2DInterpolationMode : uint
|
||||
{
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR</unmanaged>
|
||||
NearestNeighbor = 0,
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR</unmanaged>
|
||||
Linear = 1,
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_CUBIC"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_CUBIC</unmanaged>
|
||||
Cubic = 2,
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR</unmanaged>
|
||||
MultiSampleLinear = 3,
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC</unmanaged>
|
||||
Anisotropic = 4,
|
||||
/// <include file='../json.xml' path='doc/member[@name="D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE::D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC"]/*' />
|
||||
/// <unmanaged>D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC</unmanaged>
|
||||
HighQualityCubic = 5,
|
||||
}
|
||||
|
||||
#endregion Enums
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static Win32.Apis;
|
||||
|
||||
namespace Win32;
|
||||
|
||||
[Guid("00000000-0000-0000-C000-000000000046")]
|
||||
public unsafe partial struct IUnknown
|
||||
{
|
||||
public static ref readonly Guid IID_IUnknown
|
||||
{
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0xC0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x46
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_IUnknown));
|
||||
|
||||
public void** lpVtbl;
|
||||
|
||||
74
src/Vortice.Win32/ULargeInterger.cs
Normal file
74
src/Vortice.Win32/ULargeInterger.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright © Amer Koleci and Contributors.
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
using MemoryMarshal = Win32.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
namespace Win32;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
[NativeTypeName("ULARGE_INTEGER")]
|
||||
public partial struct ULargeInterger
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
[NativeTypeName("_ULARGE_INTEGER::(anonymous struct at C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um/winnt.h:895:5)")]
|
||||
public _Anonymous_e__Struct Anonymous;
|
||||
|
||||
[FieldOffset(0)]
|
||||
[NativeTypeName("struct (anonymous struct at C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um/winnt.h:899:5)")]
|
||||
public _u_e__Struct u;
|
||||
|
||||
[FieldOffset(0)]
|
||||
[NativeTypeName("ULONGLONG")]
|
||||
public ulong QuadPart;
|
||||
|
||||
[UnscopedRef]
|
||||
public ref uint LowPart
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if NET7_0_OR_GREATER
|
||||
return ref Anonymous.LowPart;
|
||||
#else
|
||||
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LowPart, 1));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public ref uint HighPart
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if NET7_0_OR_GREATER
|
||||
return ref Anonymous.HighPart;
|
||||
#else
|
||||
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.HighPart, 1));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public partial struct _Anonymous_e__Struct
|
||||
{
|
||||
[NativeTypeName("DWORD")]
|
||||
public uint LowPart;
|
||||
|
||||
[NativeTypeName("DWORD")]
|
||||
public uint HighPart;
|
||||
}
|
||||
|
||||
public partial struct _u_e__Struct
|
||||
{
|
||||
[NativeTypeName("DWORD")]
|
||||
public uint LowPart;
|
||||
|
||||
[NativeTypeName("DWORD")]
|
||||
public uint HighPart;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,17 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0;</TargetFrameworks>
|
||||
<Description>Windows API low level bindings.</Description>
|
||||
<VersionPrefix>1.1.0</VersionPrefix>
|
||||
<VersionPrefix>1.2.0</VersionPrefix>
|
||||
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="System\**" />
|
||||
<EmbeddedResource Remove="System\**" />
|
||||
<None Remove="System\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\LICENSE" PackagePath="" Pack="true" />
|
||||
|
||||
|
||||
@@ -4,35 +4,14 @@
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace Win32;
|
||||
|
||||
public static partial class Apis
|
||||
public static unsafe partial class Apis
|
||||
{
|
||||
public static ref readonly Guid IID_IUnknown
|
||||
{
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0xC0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x46
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the GUID of of a specified type.</summary>
|
||||
/// <param name="value">A value of type <typeparamref name="T"/>.</param>
|
||||
/// <typeparam name="T">The type to retrieve the GUID for.</typeparam>
|
||||
@@ -107,4 +86,7 @@ public static partial class Apis
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("ole32", ExactSpelling = true)]
|
||||
public static extern HResult CoCreateInstance([NativeTypeName("const IID &")] Guid* rclsid, [NativeTypeName("LPUNKNOWN")] IUnknown* pUnkOuter, [NativeTypeName("DWORD")] uint dwClsContext, [NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("LPVOID *")] void** ppv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user