Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the repo to target .NET 8 #60

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
spelling_error_severity = information
spelling_exclusion_path = exclusion.dic
spelling_languages = en-us
tab_width = 4
trim_trailing_whitespace = true

Expand Down
6 changes: 4 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- Default settings that explicitly differ from the Sdk.props defaults -->
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AnalysisLevel>preview</AnalysisLevel>
<AnalysisLevel>preview-all</AnalysisLevel>
<BaseIntermediateOutputPath>$(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/</BaseIntermediateOutputPath>
<DebugType>embedded</DebugType>
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
Expand All @@ -42,6 +42,8 @@
<BaseOutputPath>$(BaseArtifactsPath)bin/$(BaseArtifactsPathSuffix)/</BaseOutputPath>
<Company>TerraFX</Company>
<ContinuousIntegrationBuild Condition="'$(GITHUB_RUN_ID)' != ''">true</ContinuousIntegrationBuild>
<IsAotCompatible>true</IsAotCompatible>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>TerraFX.Interop.Vulkan</Product>
<RootNamespace>TerraFX.Interop</RootNamespace>
Expand All @@ -59,7 +61,7 @@
<Features>strict</Features>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<HighEntropyVA>true</HighEntropyVA>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
<MinClientVersion>4.3</MinClientVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- Settings that append the existing setting value -->
<PropertyGroup>
<NoWarn>$(NoWarn)</NoWarn>
<NoWarn>$(NoWarn);AD0001</NoWarn>
</PropertyGroup>

<!-- Settings that are only set for CI builds -->
Expand Down
5 changes: 2 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions TerraFX.Interop.Vulkan.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{2F337CB6
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
exclusion.dic = exclusion.dic
global.json = global.json
LICENSE.md = LICENSE.md
NuGet.config = NuGet.config
Expand Down
67 changes: 67 additions & 0 deletions exclusion.dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
aabb
aabbs
addr
astc
bipred
blit
bresenham
builtins
cabac
calibrateable
clusterculling
coef
colorspace
colour
denom
denorm
dylib
enums
glsl
hlsl
infos
irap
khronos
libvulkan
mgmt
micromap
micromaps
multisample
multisampled
nalu
nums
premultiplied
pushconstant
pvrtc
raygen
rdma
rects
renderpass
scalings
sgpr
sgprs
signedness
simd
spirv
srgb
stdcall
strided
subminor
subpass
subpasses
subresource
subresources
supersample
surfaceless
swapchain
swapchains
texel
transquant
uninitialize
unmap
uuid
vgpr
vgprs
vulkan
xcoeff
ycbcr
ycoeff
32 changes: 16 additions & 16 deletions generation/remap-handles.rsp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
--remap
AHardwareBuffer*=@IntPtr
ANativeWindow*=@IntPtr
Display*=@IntPtr
HANDLE=@IntPtr
HINSTANCE=@IntPtr
HMONITOR=@IntPtr
HWND=@IntPtr
IDirectFB*=@IntPtr
IDirectFBSurface*=@IntPtr
wl_display*=@IntPtr
wl_surface*=@IntPtr
xcb_connection_t*=@IntPtr
_screen_context*=@IntPtr
_screen_window*=@IntPtr
_SECURITY_ATTRIBUTES*=@IntPtr
__IOSurface*=@IntPtr
AHardwareBuffer*=@void*
ANativeWindow*=@void*
Display*=@void*
HANDLE=@void*
HINSTANCE=@void*
HMONITOR=@void*
HWND=@void*
IDirectFB*=@void*
IDirectFBSurface*=@void*
wl_display*=@void*
wl_surface*=@void*
xcb_connection_t*=@void*
_screen_context*=@void*
_screen_window*=@void*
_SECURITY_ATTRIBUTES*=@void*
__IOSurface*=@void*
3 changes: 3 additions & 0 deletions generation/settings.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
-Wno-macro-redefined
-Wno-nonportable-include-path
-Wno-pragma-pack
-Wno-switch
--config
exclude-com-proxies
exclude-empty-records
exclude-enum-operators
generate-aggressive-inlining
generate-callconv-member-function
generate-cpp-attributes
generate-disable-runtime-marshalling
generate-file-scoped-namespaces
generate-guid-member
generate-macro-bindings
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.100",
"allowPrerelease": false,
"version": "8.0.100",
"allowPrerelease": true,
"rollForward": "latestFeature"
}
}
3 changes: 1 addition & 2 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ try {
$DotNetInstallDirectory = Join-Path -Path $ArtifactsDir -ChildPath "dotnet"
Create-Directory -Path $DotNetInstallDirectory

& $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
& $DotNetInstallScript -Channel 7.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
& $DotNetInstallScript -Channel 8.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture

$env:PATH="$DotNetInstallDirectory;$env:PATH"
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ if [[ ! -z "$architecture" ]]; then
DotNetInstallDirectory="$ArtifactsDir/dotnet"
CreateDirectory "$DotNetInstallDirectory"

. "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
. "$DotNetInstallScript" --channel 7.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
. "$DotNetInstallScript" --channel 8.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"

PATH="$DotNetInstallDirectory:$PATH:"
fi
Expand Down
5 changes: 1 addition & 4 deletions sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnablePackageValidation>false</EnablePackageValidation>
<TerraFXProjectCategory>sources</TerraFXProjectCategory>
</PropertyGroup>

Expand All @@ -21,8 +22,4 @@
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" Key="$(AssemblyOriginatorPublicKey)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions sources/Interop/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ dotnet_naming_rule.type_parameters_should_be_pascal_case_prefixed_with_t.severit
# disable certain parent style options since they are not applicable to interop
###############################################################################
csharp_style_expression_bodied_methods = when_on_single_line:none
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
dotnet_style_prefer_conditional_expression_over_assignment = true:none
dotnet_style_prefer_conditional_expression_over_return = true:none
csharp_style_prefer_pattern_matching = true:none
Expand Down
8 changes: 0 additions & 8 deletions sources/Interop/Vulkan/Shims/UnscopedRefAttribute.cs

This file was deleted.

39 changes: 34 additions & 5 deletions sources/Interop/Vulkan/TerraFX.Interop.Vulkan.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<NoWarn>$(NoWarn);CA1069;CA1401;CS0282;CS1591;SYSLIB1054</NoWarn>
<RootNamespace>TerraFX.Interop</RootNamespace>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<Compile Remove="Shims/UnscopedRefAttribute.cs" />
</ItemGroup>
<PropertyGroup>
<!-- CA1003: Use generic event handler instances -->
<!-- CA1008: Enums should have zero value -->
<!-- CA1024: Use properties where appropriate -->
<!-- CA1027: Mark enums with FlagsAttribute -->
<!-- CA1028: Enum storage should be Int32 -->
<!-- CA1030: Use events where appropriate -->
<!-- CA1034: Nested types should not be visible -->
<!-- CA1040: Avoid empty interfaces -->
<!-- CA1041: Provide ObsoleteAttribute message -->
<!-- CA1051: Do not declare visible instance fields -->
<!-- CA1069: Enums should not have duplicate values -->
<!-- CA1305: Specify IFormatProvider -->
<!-- CA1401: P/Invokes should not be visible -->
<!-- CA1700: Do not name enum values 'Reserved' -->
<!-- CA1707: Identifiers should not contain underscores -->
<!-- CA1708: Identifiers should differ by more than case -->
<!-- CA1711: Identifiers should not have incorrect suffix -->
<!-- CA1712: Do not prefix enum values with type name -->
<!-- CA1715: Identifiers should have correct prefix -->
<!-- CA1716: Identifiers should not match keywords -->
<!-- CA1720: Identifiers should not contain type names -->
<!-- CA1724: Type names should not match namespaces -->
<!-- CA1815: Override equals and operator equals on value types -->
<!-- CA2201: Do not raise reserved exception types -->
<!-- CA2217: Do not mark enums with FlagsAttribute -->
<!-- CA2225: Operator overloads have named alternates -->
<!-- CS1591: Missing XML comment for publicly visible type or member -->
<!-- CS0282: There is no defined ordering between fields in multiple declarations of a partial struct. -->
<!-- CS8981: The type name only contains lower-cased ascii characters -->
<!-- SYSLIB1054: Use LibraryImportAttribute instead of DllImportAttribute to generate p/invoke marshalling code at compile time. -->
<NoWarn>$(NoWarn);CA1003;CA1008;CA1024;CA1027;CA1028;CA1030;CA1034;CA1040;CA1041;CA1051;CA1069;CA1305;CA1401;CA1700;CA1707;CA1708;CA1711;CA1712;CA1715;CA1716;CA1720;CA1724;CA1815;CA2201;CA2217;CA2225;CS1591;CS0282;CS8981;SYSLIB1054</NoWarn>
</PropertyGroup>

</Project>
4 changes: 3 additions & 1 deletion sources/Interop/Vulkan/Vulkan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]

namespace TerraFX.Interop.Vulkan;

public static unsafe partial class Vulkan
Expand All @@ -22,7 +24,7 @@ private static IntPtr OnDllImport(string libraryName, Assembly assembly, DllImpo
return nativeLibrary;
}

if (libraryName.Equals("vulkan") && TryResolveVulkan(assembly, searchPath, out nativeLibrary))
if (libraryName.Equals("vulkan", StringComparison.Ordinal) && TryResolveVulkan(assembly, searchPath, out nativeLibrary))
{
return nativeLibrary;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

using System.Runtime.CompilerServices;

[assembly: DisableRuntimeMarshalling]
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// Ported from include/vk_video/vulkan_video_codec_h264std.h in the KhronosGroup/Vulkan-Headers repository for tag v1.3.239
// Original source is Copyright © 2015-2022 The Khronos Group Inc. Licensed under the Apache License v2.0 (Apache-2.0)

using System.Runtime.CompilerServices;

namespace TerraFX.Interop.Vulkan;

public unsafe partial struct StdVideoH264HrdParameters
public partial struct StdVideoH264HrdParameters
{
[NativeTypeName("uint8_t")]
public byte cpb_cnt_minus1;
Expand All @@ -20,13 +22,13 @@ public unsafe partial struct StdVideoH264HrdParameters
public byte reserved1;

[NativeTypeName("uint32_t[32]")]
public fixed uint bit_rate_value_minus1[32];
public _bit_rate_value_minus1_e__FixedBuffer bit_rate_value_minus1;

[NativeTypeName("uint32_t[32]")]
public fixed uint cpb_size_value_minus1[32];
public _cpb_size_value_minus1_e__FixedBuffer cpb_size_value_minus1;

[NativeTypeName("uint8_t[32]")]
public fixed byte cbr_flag[32];
public _cbr_flag_e__FixedBuffer cbr_flag;

[NativeTypeName("uint32_t")]
public uint initial_cpb_removal_delay_length_minus1;
Expand All @@ -39,4 +41,22 @@ public unsafe partial struct StdVideoH264HrdParameters

[NativeTypeName("uint32_t")]
public uint time_offset_length;

[InlineArray(32)]
public partial struct _bit_rate_value_minus1_e__FixedBuffer
{
public uint e0;
}

[InlineArray(32)]
public partial struct _cpb_size_value_minus1_e__FixedBuffer
{
public uint e0;
}

[InlineArray(32)]
public partial struct _cbr_flag_e__FixedBuffer
{
public byte e0;
}
}
Loading