Skip to content

Commit

Permalink
Update to latest SharpGen.Runtime, fix #450
Browse files Browse the repository at this point in the history
  • Loading branch information
amerkoleci committed Jul 8, 2024
1 parent 248692b commit cc2dda5
Show file tree
Hide file tree
Showing 33 changed files with 314 additions and 218 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- Version -->
<PropertyGroup>
<VersionPrefix>3.5.9</VersionPrefix>
<VersionPrefix>3.5.10</VersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' == ''">beta</VersionSuffix>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project>
<!-- https://learn.microsoft.com/nuget/consume-packages/central-package-management -->
<PropertyGroup>
<SharpGenVersion>2.1.2-beta</SharpGenVersion>
<SharpGenVersion>2.2.0-beta</SharpGenVersion>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Vortice.Mathematics" Version="1.7.8" />
<PackageVersion Include="Vortice.Mathematics" Version="1.8.0" />
<PackageVersion Include="SharpGen.Runtime.COM" Version="$(SharpGenVersion)" />
<PackageVersion Include="Vortice.Dxc.Native" Version="1.0.1" />

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.302",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
38 changes: 19 additions & 19 deletions src/Vortice.D3DCompiler/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static ReadOnlyMemory<byte> Compile(
{
Result result = Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
null,
null,
Expand Down Expand Up @@ -82,7 +82,7 @@ public static ReadOnlyMemory<byte> Compile(
{
Result result = Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
macros,
null,
Expand Down Expand Up @@ -137,7 +137,7 @@ public static ReadOnlyMemory<byte> Compile(
{
Result result = Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
macros,
include,
Expand Down Expand Up @@ -192,7 +192,7 @@ public static Blob Compile(
{
Result result = Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
macros,
include,
Expand Down Expand Up @@ -243,7 +243,7 @@ public static Result Compile(
{
return Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
null,
null,
Expand Down Expand Up @@ -280,7 +280,7 @@ public static Result Compile(
{
return Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
defines,
null,
Expand Down Expand Up @@ -318,7 +318,7 @@ public static Result Compile(
{
return Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -357,7 +357,7 @@ public static Result Compile(
{
return Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -397,7 +397,7 @@ public static Result Compile(
{
return Compile(
shaderSourcePtr.ToPointer(),
shaderSource.Length,
(nuint)shaderSource.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -432,7 +432,7 @@ public static Result Compile(
{
return Compile(
sourcePtr,
source.Length,
(nuint)source.Length,
sourceName,
null,
null,
Expand Down Expand Up @@ -463,7 +463,7 @@ public static Result Compile(
{
return Compile(
sourcePtr,
source.Length,
(nuint)source.Length,
sourceName,
defines,
null,
Expand Down Expand Up @@ -495,7 +495,7 @@ public static Result Compile(
{
return Compile(
sourcePtr,
source.Length,
(nuint)source.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -528,7 +528,7 @@ public static Result Compile(
{
return Compile(
sourcePtr,
source.Length,
(nuint)source.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -562,7 +562,7 @@ public static Result Compile(
{
return Compile(
sourcePtr,
source.Length,
(nuint)source.Length,
sourceName,
defines,
include,
Expand Down Expand Up @@ -771,7 +771,7 @@ public static ReadOnlyMemory<byte> CompileFromFile(
}
#endregion

public static Blob CreateBlob(PointerSize size)
public static Blob CreateBlob(nuint size)
{
CreateBlob(size, out Blob blob).CheckError();
return blob;
Expand All @@ -781,7 +781,7 @@ public static Blob CreateBlob(PointerSize size)
{
fixed (byte* shaderBytecodePtr = shaderBytecode)
{
Reflect(shaderBytecodePtr, shaderBytecode.Length, typeof(T).GUID, out IntPtr nativePtr).CheckError();
Reflect(shaderBytecodePtr, (nuint)shaderBytecode.Length, typeof(T).GUID, out IntPtr nativePtr).CheckError();
return MarshallingHelpers.FromPointer<T>(nativePtr)!;
}
}
Expand All @@ -790,7 +790,7 @@ public static Blob CreateBlob(PointerSize size)
{
fixed (byte* shaderBytecodePtr = shaderBytecode)
{
Result result = Reflect(shaderBytecodePtr, shaderBytecode.Length, typeof(T).GUID, out IntPtr nativePtr);
Result result = Reflect(shaderBytecodePtr, (nuint)shaderBytecode.Length, typeof(T).GUID, out IntPtr nativePtr);
if (result.Success)
{
reflection = MarshallingHelpers.FromPointer<T>(nativePtr);
Expand Down Expand Up @@ -829,7 +829,7 @@ public static Blob GetInputSignatureBlob(ReadOnlySpan<byte> srcData)
{
fixed (byte* pSrcData = srcData)
{
GetInputSignatureBlob((IntPtr)pSrcData, srcData.Length, out Blob signatureBlob).CheckError();
GetInputSignatureBlob((IntPtr)pSrcData, (nuint)srcData.Length, out Blob signatureBlob).CheckError();
return signatureBlob;
}
}
Expand All @@ -849,7 +849,7 @@ public static Blob GetOutputSignatureBlob(ReadOnlySpan<byte> srcData)
{
fixed (byte* pSrcData = srcData)
{
GetOutputSignatureBlob((IntPtr)pSrcData, srcData.Length, out Blob signatureBlob).CheckError();
GetOutputSignatureBlob((IntPtr)pSrcData, (nuint)srcData.Length, out Blob signatureBlob).CheckError();
return signatureBlob;
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/Vortice.DXGI/Debug/IDXGIInfoQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,37 @@

namespace Vortice.DXGI.Debug;

public partial class IDXGIInfoQueue
public unsafe partial class IDXGIInfoQueue
{
public unsafe InfoQueueMessage GetMessage(Guid producer, ulong messageIndex)
public InfoQueueMessage GetMessage(Guid producer, ulong messageIndex)
{
PointerSize messageSize = 0;
PointerUSize messageSize = 0;
GetMessage(producer, messageIndex, IntPtr.Zero, ref messageSize);

if (messageSize == 0)
{
return new InfoQueueMessage();
}

var messagePtr = stackalloc byte[messageSize];
byte* messagePtr = stackalloc byte[(int)((uint)messageSize)];
GetMessage(producer, messageIndex, new IntPtr(messagePtr), ref messageSize);

var message = new InfoQueueMessage();
message.__MarshalFrom(ref *(InfoQueueMessage.__Native*)messagePtr);
return message;
}


public unsafe InfoQueueFilter? GetStorageFilter(Guid producer)
public InfoQueueFilter? GetStorageFilter(Guid producer)
{
PointerSize sizeFilter = PointerSize.Zero;
PointerUSize sizeFilter = PointerUSize.Zero;
GetStorageFilter(producer, IntPtr.Zero, ref sizeFilter);

if (sizeFilter == 0)
{
return null;
}

byte* filter = stackalloc byte[(int)sizeFilter];
byte* filter = stackalloc byte[(int)((uint)sizeFilter)];
GetStorageFilter(producer, (IntPtr)filter, ref sizeFilter);

var queueNative = new InfoQueueFilter();
Expand All @@ -43,16 +42,17 @@ public unsafe InfoQueueMessage GetMessage(Guid producer, ulong messageIndex)
return queueNative;
}

public unsafe InfoQueueFilter? GetRetrievalFilter(Guid producer)
public InfoQueueFilter? GetRetrievalFilter(Guid producer)
{
var sizeFilter = PointerSize.Zero;
PointerUSize sizeFilter = PointerUSize.Zero;
GetRetrievalFilter(producer, IntPtr.Zero, ref sizeFilter);

if (sizeFilter == 0)
{
return null;
}
var filter = stackalloc byte[(int)sizeFilter];

byte* filter = stackalloc byte[(int)((uint)sizeFilter)];
GetRetrievalFilter(producer, (IntPtr)filter, ref sizeFilter);

var queueNative = new InfoQueueFilter();
Expand Down
7 changes: 1 addition & 6 deletions src/Vortice.DXGI/Mappings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config id="vortice-dxgi" xmlns="urn:SharpGen.Config">
<namespace>Vortice.DXGI</namespace>
<depends>Vortice.DirectX</depends>

<sdk name="WindowsSdk" version="10.0.22621.0" />
<sdk name="StdLib" />
<include-dir override="true">$(THIS_CONFIG_PATH)/../native/include/directx</include-dir>
Expand Down Expand Up @@ -105,11 +105,6 @@
<map field="DXGI_ADAPTER_DESC[123]?::SubSysId" name="SubsystemId" />
<map field="DXGI_ADAPTER_DESC[12]::Flags" type="DXGI_ADAPTER_FLAG" />

<map struct="DXGI_ADAPTER_DESC" pack="4"/>
<map struct="DXGI_ADAPTER_DESC1" pack="4"/>
<map struct="DXGI_ADAPTER_DESC2" pack="4"/>
<map struct="DXGI_ADAPTER_DESC3" pack="4"/>

<!-- DXGI_SWAP_CHAIN_DESC -->
<map field="DXGI_SWAP_CHAIN_DESC[12]?::BufferUsage" type="DXGI_USAGE_ENUM"/>
<map field="DXGI_SWAP_CHAIN_DESC[12]?::Flags" type="DXGI_SWAP_CHAIN_FLAG" />
Expand Down
20 changes: 10 additions & 10 deletions src/Vortice.Direct3D11/Debug/ID3D11InfoQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,55 @@

namespace Vortice.Direct3D11.Debug;

public partial class ID3D11InfoQueue
public unsafe partial class ID3D11InfoQueue
{
public unsafe Message GetMessage(ulong messageIndex)
public Message GetMessage(ulong messageIndex)
{
PointerSize messageSize = 0;
PointerUSize messageSize = 0;
GetMessage(messageIndex, IntPtr.Zero, ref messageSize);

if (messageSize == 0)
{
return new Message();
}

byte* messagePtr = stackalloc byte[messageSize];
byte* messagePtr = stackalloc byte[(int)((uint)messageSize)];
GetMessage(messageIndex, new IntPtr(messagePtr), ref messageSize);

Message message = new Message();
message.__MarshalFrom(ref *(Message.__Native*)messagePtr);
return message;
}

public unsafe InfoQueueFilter? GetStorageFilter()
public InfoQueueFilter? GetStorageFilter()
{
PointerSize sizeFilter = PointerSize.Zero;
PointerUSize sizeFilter = PointerUSize.Zero;
GetStorageFilter(IntPtr.Zero, ref sizeFilter);

if (sizeFilter == 0)
{
return default;
}

byte* filter = stackalloc byte[sizeFilter];
byte* filter = stackalloc byte[(int)((uint)sizeFilter)];
GetStorageFilter((IntPtr)filter, ref sizeFilter);

InfoQueueFilter queueNative = new InfoQueueFilter();
queueNative.__MarshalFrom(ref *(InfoQueueFilter.__Native*)filter);
return queueNative;
}

public unsafe InfoQueueFilter? GetRetrievalFilter()
public InfoQueueFilter? GetRetrievalFilter()
{
PointerSize sizeFilter = PointerSize.Zero;
PointerUSize sizeFilter = PointerUSize.Zero;
GetRetrievalFilter(IntPtr.Zero, ref sizeFilter);

if (sizeFilter == 0)
{
return default;
}

byte* filter = stackalloc byte[sizeFilter];
byte* filter = stackalloc byte[(int)((uint)sizeFilter)];
GetRetrievalFilter((IntPtr)filter, ref sizeFilter);

InfoQueueFilter queueNative = new InfoQueueFilter();
Expand Down
2 changes: 1 addition & 1 deletion src/Vortice.Direct3D11/Debug/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal struct __Native
public MessageSeverity Severity;
public MessageId Id;
public unsafe sbyte* pDescription;
public PointerSize DescriptionByteLength;
public nuint DescriptionByteLength;
}

internal unsafe void __MarshalFrom(ref __Native @ref)
Expand Down
Loading

0 comments on commit cc2dda5

Please sign in to comment.