Update to official .NET 7 SDK and improve bindings.

This commit is contained in:
Amer Koleci
2022-11-17 14:14:45 +01:00
parent a73143c08f
commit dec4ed8056
52 changed files with 293 additions and 142 deletions

View File

@@ -5,15 +5,16 @@ on:
branches:
- 'main'
paths-ignore:
- 'docs/**'
- '*.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- 'LICENSE'
env:
DOTNET_CLI_TELEMETRY_OPTOUT: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build:
@@ -22,18 +23,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install .NET 7.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Install .NET 7 SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
include-prerelease: true
dotnet-version: 7.0.100
- name: Pack
run: dotnet pack Vortice.Win32.sln --configuration Release --output build/packages
run: dotnet pack Vortice.Win32.sln --configuration Release --output artifacts
- name: Publish to NuGet
if: github.event_name == 'push'
run: dotnet nuget push build/packages/**/*.nupkg -k ${{secrets.NUGET_TOKEN}} --skip-duplicate --source https://api.nuget.org/v3/index.json
- name: Upload Package Artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: artifacts\*.nupkg
if-no-files-found: error

View File

@@ -1,31 +1,38 @@
<Project>
<PropertyGroup>
<LangVersion>preview</LangVersion>
<RepositoryUrl>https://github.com/amerkoleci/Vortice.Win32</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>11.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<DebugType>embedded</DebugType>
<Features>strict</Features>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<RestoreConfigFile>$(MSBuildThisFileDirectory)NuGet.config</RestoreConfigFile>
<VersionPrefix>1.8.4</VersionPrefix>
<VersionPrefix>1.8.5</VersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);AD0001;CS1591;CS1701;CA2252;</NoWarn>
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup>
<RepositoryUrl>https://github.com/amerkoleci/Vortice.Win32</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<ProjectUrl>https://github.com/amerkoleci/Vortice.Win32</ProjectUrl>
<Authors>Amer Koleci</Authors>
<Owners>Amer Koleci</Owners>
<Authors>Amer Koleci and Contributors</Authors>
<Company>Amer Koleci</Company>
<Copyright>Copyright © 2022 Amer Koleci</Copyright>
<Copyright>Copyright © Amer Koleci and Contributors</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>win32 graphics gamedev core standard game vortice</PackageTags>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
</PropertyGroup>
<!-- https://github.com/dotnet/sourcelink -->
@@ -38,10 +45,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
<PackageReference Include="PolySharp" PrivateAssets="all" />
</ItemGroup>
</Project>

33
Directory.Packages.props Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Packages.props is automatically picked up and imported by
Microsoft.Common.targets. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly late and most other props/targets will have been
imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageVersion Include="PolySharp" Version="1.8.0" />
<PackageVersion Include="CommunityToolkit.Diagnostics" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.4" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<!-- Generator -->
<PackageVersion Include="MessagePack" Version="2.4.35" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.2-beta3" />
<PackageVersion Include="Microsoft.Windows.SDK.Win32Docs" Version="0.1.8-alpha" />
</ItemGroup>
</Project>

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2022 Amer Koleci
Copyright (c) 2022 Amer Koleci and Contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{065268A8
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
LICENSE = LICENSE
NuGet.config = NuGet.config
README.md = README.md

9
global.json Normal file
View File

@@ -0,0 +1,9 @@
{
"sdk": {
"version": "7.0.100",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44"
}
}

View File

@@ -8,9 +8,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="2.4.35" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2-beta2" />
<PackageReference Include="Microsoft.Windows.SDK.Win32Docs" Version="0.1.8-alpha" />
<PackageReference Include="MessagePack" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Microsoft.Windows.SDK.Win32Docs" />
</ItemGroup>
<ItemGroup>

View File

@@ -26,7 +26,7 @@ public static class Program
"Graphics.Direct2D.json",
"Graphics.Imaging.D2D.json",
"Graphics.DirectComposition.json",
"Graphics.Direct3D9.json",
//"Graphics.Direct3D9.json",
// Media
//"Media.Audio.json",
@@ -1117,7 +1117,7 @@ public static class Program
//DocGenerator.Generate(new[] { "DWRITE" }, Path.Combine(repoRoot, "Generated", "Graphics", "DirectWrite.xml"));
//DocGenerator.Generate(new[] { "WIC" }, Path.Combine(repoRoot, "Generated", "Graphics", "Imaging.xml"));
DocGenerator.Generate(new[] { "D3D9" }, Path.Combine(d3d9Path, "Direct3D9.xml"));
//DocGenerator.Generate(new[] { "D3D9" }, Path.Combine(d3d9Path, "Direct3D9.xml"));
//DocGenerator.Generate(new[] { "D3D11" }, Path.Combine(d3d11Path, "Direct3D11.xml"));
//DocGenerator.Generate(new[] { "D3D12" }, Path.Combine(d3d12Path, "Direct3D12.xml"));
//DocGenerator.Generate(new[] { "DComposition" }, Path.Combine(directCompositionPath, "DirectComposition.xml"));
@@ -2391,9 +2391,10 @@ public static class Program
out string parameterType,
out string parameterName);
if (method.Name == "CreateWrappedResource")
if (method.Name == "CheckFeatureSupport" &&
parameterName == "FeatureSupportDataSize")
{
parameterType = "int";
}
argumentBuilder

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Direct2D1 bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>DXC bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>FXC bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device : INativeGuid
/// <include file='../Direct3D11.xml' path='doc/member[@name="ID3D11Device::CheckFeatureSupport"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="ID3D11Device::GetPrivateData"]/*' />

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device1 : INativeGuid
/// <inheritdoc cref="ID3D11Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device1*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device1*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device1*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device1*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D11Device.GetPrivateData" />

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device2 : INativeGuid
/// <inheritdoc cref="ID3D11Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device2*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device2*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D11Device.GetPrivateData" />

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device3 : INativeGuid
/// <inheritdoc cref="ID3D11Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device3*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device3*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device3*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device3*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D11Device.GetPrivateData" />

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device4 : INativeGuid
/// <inheritdoc cref="ID3D11Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device4*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device4*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device4*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device4*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D11Device.GetPrivateData" />

View File

@@ -317,9 +317,9 @@ public unsafe partial struct ID3D11Device5 : INativeGuid
/// <inheritdoc cref="ID3D11Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(33)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11Device5*, Feature, void*, uint, int>)(lpVtbl[33]))((ID3D11Device5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11Device5*, Feature, void*, int, int>)(lpVtbl[33]))((ID3D11Device5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D11Device.GetPrivateData" />

View File

@@ -245,9 +245,9 @@ public unsafe partial struct ID3D11VideoDevice2 : INativeGuid
/// <include file='../Direct3D11.xml' path='doc/member[@name="ID3D11VideoDevice2::CheckFeatureSupport"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(24)]
public HResult CheckFeatureSupport(FeatureVideo Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(FeatureVideo Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D11VideoDevice2*, FeatureVideo, void*, uint, int>)(lpVtbl[24]))((ID3D11VideoDevice2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D11VideoDevice2*, FeatureVideo, void*, int, int>)(lpVtbl[24]))((ID3D11VideoDevice2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="ID3D11VideoDevice2::NegotiateCryptoSessionKeyExchangeMT"]/*' />

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Direct3D11 bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Direct3D11on12 bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -91,7 +91,7 @@ public static unsafe partial class Apis
PlaneCount = 0,
};
if (device->CheckFeatureSupport(Feature.FormatInfo, &formatInfo, (uint)(sizeof(FeatureDataFormatInfo))).Failure)
if (device->CheckFeatureSupport(Feature.FormatInfo, &formatInfo, sizeof(FeatureDataFormatInfo)).Failure)
{
return 0;
}

View File

@@ -0,0 +1,35 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public partial struct CommandQueueDescription
{
/// <summary>
/// Initializes a new instance of the <see cref="CommandQueueDescription"/> struct.
/// </summary>
public CommandQueueDescription(CommandListType type, int priority = 0, CommandQueueFlags flags = CommandQueueFlags.None, uint nodeMask = 0)
{
Type = type;
Priority = priority;
Flags = flags;
NodeMask = nodeMask;
}
/// <summary>
/// Initializes a new instance of the <see cref="CommandQueueDescription"/> struct.
/// </summary>
/// <param name="type">The queue type.</param>
/// <param name="priority">The priority.</param>
/// <param name="flags">Options flags.</param>
/// <param name="nodeMask">Node mask.</param>
public CommandQueueDescription(CommandListType type, CommandQueuePriority priority, CommandQueueFlags flags = CommandQueueFlags.None, uint nodeMask = 0)
{
Type = type;
Priority = (int)priority;
Flags = flags;
NodeMask = nodeMask;
}
}

View File

@@ -5,7 +5,7 @@ using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct DepthStencilDescription
public partial struct DepthStencilDescription
{
/// <summary>
/// A built-in description with settings for not using a depth stencil buffer.

View File

@@ -5,7 +5,7 @@ using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct DepthStencilDescription1
public partial struct DepthStencilDescription1
{
/// <summary>
/// A built-in description with settings for not using a depth stencil buffer.

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device : INativeGuid
/// <include file='../Direct3D12.xml' path='doc/member[@name="ID3D12Device::CheckFeatureSupport"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <include file='../Direct3D12.xml' path='doc/member[@name="ID3D12Device::CreateDescriptorHeap"]/*' />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device1 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device1*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device1*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device1*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device1*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device2 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device2*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device2*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device2*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device3 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device3*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device3*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device3*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device3*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device4 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device4*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device4*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device4*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device4*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device5 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device5*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device5*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device6 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device6*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device6*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device6*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device6*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device7 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device7*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device7*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device7*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device7*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device8 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device8*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device8*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device8*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device8*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -157,9 +157,9 @@ public unsafe partial struct ID3D12Device9 : INativeGuid
/// <inheritdoc cref="ID3D12Device.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<ID3D12Device9*, Feature, void*, uint, int>)(lpVtbl[13]))((ID3D12Device9*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<ID3D12Device9*, Feature, void*, int, int>)(lpVtbl[13]))((ID3D12Device9*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="ID3D12Device.CreateDescriptorHeap" />

View File

@@ -11,10 +11,19 @@ public unsafe partial struct ID3D12Device
where TFeature : unmanaged
{
TFeature featureData = default;
CheckFeatureSupport(feature, &featureData, (uint)sizeof(TFeature)).ThrowIfFailed();
CheckFeatureSupport(feature, &featureData, sizeof(TFeature)).ThrowIfFailed();
return featureData;
}
public HResult CheckFeatureSupport<TFeature>(Feature feature, ref TFeature featureData)
where TFeature : unmanaged
{
fixed (TFeature* featureDataPtr = &featureData)
{
return CheckFeatureSupport(feature, featureDataPtr, sizeof(TFeature));
}
}
public HResult CreateCommittedResource(HeapType heapType, ResourceDescription* pDesc, ResourceStates InitialResourceState, ClearValue* pOptimizedClearValue, Guid* riidResource, void** ppvResource)
{
HeapProperties heapProperties = new(heapType);

View File

@@ -99,7 +99,7 @@ public unsafe partial struct ResourceDescription : IEquatable<ResourceDescriptio
flags);
}
public static ResourceDescription Texture3D(Format format,
public static ResourceDescription Tex3D(Format format,
ulong width,
uint height,
ushort depth,

View File

@@ -5,7 +5,7 @@ using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct SamplerDescription
public partial struct SamplerDescription
{
public static readonly SamplerDescription PointWrap = new(Filter.MinMagMipPoint, TextureAddressMode.Wrap);
public static readonly SamplerDescription PointClamp = new(Filter.MinMagMipPoint, TextureAddressMode.Clamp);
@@ -29,7 +29,7 @@ public unsafe partial struct SamplerDescription
/// <param name="borderColor">Border color to use if <see cref="TextureAddressMode.Border"/> is specified for AddressU, AddressV, or AddressW.</param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
public unsafe SamplerDescription(
Filter filter,
TextureAddressMode addressU,
TextureAddressMode addressV,
@@ -68,7 +68,7 @@ public unsafe partial struct SamplerDescription
/// <param name="comparisonFunction">A function that compares sampled data against existing sampled data. </param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
public unsafe SamplerDescription(
Filter filter,
TextureAddressMode addressU,
TextureAddressMode addressV,
@@ -104,7 +104,7 @@ public unsafe partial struct SamplerDescription
/// <param name="comparisonFunction">A function that compares sampled data against existing sampled data. </param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
public unsafe SamplerDescription(
Filter filter,
TextureAddressMode address,
float mipLODBias = 0.0f,

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Direct3D12 bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>DirectComposition bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>DirectWrite bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -48,7 +48,7 @@ public static unsafe class IDXGIFactory5Extensions
where TFeature : unmanaged
{
TFeature featureData = default;
factory.CheckFeatureSupport(feature, &featureData, (uint)sizeof(TFeature)).ThrowIfFailed();
factory.CheckFeatureSupport(feature, &featureData, sizeof(TFeature)).ThrowIfFailed();
return featureData;
}
}

View File

@@ -277,9 +277,9 @@ public unsafe partial struct IDXGIFactory5 : INativeGuid
/// <include file='../Dxgi.xml' path='doc/member[@name="IDXGIFactory5::CheckFeatureSupport"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(28)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<IDXGIFactory5*, Feature, void*, uint, int>)(lpVtbl[28]))((IDXGIFactory5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<IDXGIFactory5*, Feature, void*, int, int>)(lpVtbl[28]))((IDXGIFactory5*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
}

View File

@@ -277,9 +277,9 @@ public unsafe partial struct IDXGIFactory6 : INativeGuid
/// <inheritdoc cref="IDXGIFactory5.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(28)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<IDXGIFactory6*, Feature, void*, uint, int>)(lpVtbl[28]))((IDXGIFactory6*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<IDXGIFactory6*, Feature, void*, int, int>)(lpVtbl[28]))((IDXGIFactory6*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <include file='../Dxgi.xml' path='doc/member[@name="IDXGIFactory6::EnumAdapterByGpuPreference"]/*' />

View File

@@ -277,9 +277,9 @@ public unsafe partial struct IDXGIFactory7 : INativeGuid
/// <inheritdoc cref="IDXGIFactory5.CheckFeatureSupport" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(28)]
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, uint FeatureSupportDataSize)
public HResult CheckFeatureSupport(Feature Feature, void* pFeatureSupportData, int FeatureSupportDataSize)
{
return ((delegate* unmanaged[Stdcall]<IDXGIFactory7*, Feature, void*, uint, int>)(lpVtbl[28]))((IDXGIFactory7*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
return ((delegate* unmanaged[Stdcall]<IDXGIFactory7*, Feature, void*, int, int>)(lpVtbl[28]))((IDXGIFactory7*)Unsafe.AsPointer(ref this), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
/// <inheritdoc cref="IDXGIFactory6.EnumAdapterByGpuPreference" />

View File

@@ -0,0 +1,9 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Dxgi;
public partial struct IDXGIInfoQueue
{
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Dxgi bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>DXC bindings.</Description>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>

View File

@@ -0,0 +1,31 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Gdi;
/// <summary>
/// Specifies the color and usage of an entry in a logical palette.
/// </summary>
/// <unmanaged>PALETTEENTRY</unmanaged>
public partial struct PaletteEntry
{
/// <summary>
/// The red intensity value for the palette entry.
/// </summary>
public byte Red;
/// <summary>
/// The green intensity value for the palette entry.
/// </summary>
public byte Green;
/// <summary>
/// The blue intensity value for the palette entry.
/// </summary>
public byte Blue;
/// <summary>
/// The alpha intensity value for the palette entry. Note that as of DirectX 8, this member is treated differently than documented for Windows.
/// </summary>
public byte Flags;
}

View File

@@ -0,0 +1,20 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Gdi;
/// <summary>
/// The RGNDATA structure contains a header and an array of rectangles that compose a region.
/// The rectangles are sorted top to bottom, left to right. They do not overlap.
/// </summary>
/// <unmanaged>RGNDATA</unmanaged>
public unsafe partial struct RgnData
{
public RgnDataHeader rdh;
/// <summary>
/// Specifies an arbitrary-size buffer that contains the RECT structures that make up the region.
/// </summary>
[NativeTypeName("char[1]")]
public fixed sbyte Buffer[1];
}

View File

@@ -0,0 +1,34 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Gdi;
/// <unmanaged>RGNDATAHEADER</unmanaged>
public partial struct RgnDataHeader
{
/// <summary>
/// The size, in bytes, of the header.
/// </summary>
public uint Size;
/// <summary>
/// The type of region. This value must be RDH_RECTANGLES.
/// </summary>
public uint iType;
/// <summary>
/// The number of rectangles that make up the region.
/// </summary>
public uint nCount;
/// <summary>
/// The size of the <see cref="RgnData"/> buffer required to receive the <see cref="RawRect"/> structures that make up the region.
/// If the size is not known, this member can be zero.
/// </summary>
public uint nRgnSize;
/// <summary>
/// A bounding rectangle for the region in logical units.
/// </summary>
public RawRect rcBound;
}

View File

@@ -1,36 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics.CodeAnalysis;
/// <summary>
/// Used to indicate a byref escapes and is not scoped.
/// </summary>
/// <remarks>
/// <para>
/// There are several cases where the C# compiler treats a <see langword="ref"/> as implicitly
/// <see langword="scoped"/> - where the compiler does not allow the <see langword="ref"/> to escape the method.
/// </para>
/// <para>
/// For example:
/// <list type="number">
/// <item><see langword="this"/> for <see langword="struct"/> instance methods.</item>
/// <item><see langword="ref"/> parameters that refer to <see langword="ref"/> <see langword="struct"/> types.</item>
/// <item><see langword="out"/> parameters.</item>
/// </list>
/// </para>
/// <para>
/// This attribute is used in those instances where the <see langword="ref"/> should be allowed to escape.
/// </para>
/// <para>
/// Applying this attribute, in any form, has impact on consumers of the applicable API. It is necessary for
/// API authors to understand the lifetime implications of applying this attribute and how it may impact their users.
/// </para>
/// </remarks>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter,
AllowMultiple = false,
Inherited = false)]
internal sealed class UnscopedRefAttribute : Attribute
{
}

View File

@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Description>Windows API low level bindings.</Description>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
<NoWarn>$(NoWarn);CS0419;IDE0017</NoWarn>
</PropertyGroup>
@@ -17,18 +17,13 @@
<Using Include="System.Diagnostics.CodeAnalysis" />
<Using Include="Win32.Numerics" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<Compile Remove="UnscopedRefAttribute.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.Memory" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
</Project>