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

Upgrade to net9.0 #623

Merged
merged 40 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1a6edc0
Solution: Switch to ManagePackageVersionsCentrally
Xian55 Sep 8, 2024
bbbdd09
.gitignore BenchmarkDotNet artifacts
Xian55 Sep 8, 2024
9f27219
Added two batfiles for .net9.0 JSON support
Xian55 Sep 8, 2024
7b6eca7
SharedLib: With .net9.0 this is not longer needed as included in syst…
Xian55 Sep 8, 2024
27736d1
BlazorServer: Resolve warning
Xian55 Sep 8, 2024
b8b9033
CoreTests: fix an issue when the running the Test_FindTargetByCursor …
Xian55 Sep 8, 2024
ccb5c93
PathingAPI: Route show UIMapID for the dropdown entries
Xian55 Sep 8, 2024
8b26e9e
PPather: WmoFile: Use optimized code for IsHole
Xian55 Sep 8, 2024
23fb744
PPather: MPQTrinagleSupplier: optimize code around reading triangles …
Xian55 Sep 8, 2024
f61cc88
PPather: BinaryReaderExtensions: ReadVector3 avoid allocating on the …
Xian55 Sep 8, 2024
f5395a6
Benchmark: Added a way to mass load all available profiles -- current…
Xian55 Sep 8, 2024
2d6c7de
HeadlessServer: Update readme about install.bat and run.bat differences.
Xian55 Sep 8, 2024
7485410
HeadlessServer: loadall.bat - Added a way to test if all the class pr…
Xian55 Sep 8, 2024
70bacee
Core: SpellBookReader: use collection expression - GetId ReadOnlySpan
Xian55 Sep 8, 2024
9a0d8d3
HeadlessServer: loadall.bat add --no-build to speed up the process
Xian55 Sep 8, 2024
b229e05
PPather: Utils: optimized functions with benchmarks
Xian55 Sep 8, 2024
373a422
Readme.md: update required .net version from net8.0 -> net9.0
Xian55 Sep 8, 2024
8231267
Benchmark: give better names for the bench functions
Xian55 Sep 8, 2024
46e21e2
Benchmark: give better names for the bench functions 2
Xian55 Sep 8, 2024
3ec2170
Readme: fix typo
Xian55 Sep 8, 2024
bad8a92
Core: NamesAttribute: Primary Constructor
Xian55 Sep 8, 2024
2ece7d2
Utilities: ReadDBC_CSV: Set Central package management - Update Nuget…
Xian55 Sep 9, 2024
e90209f
Json: DBC: Update Cataclysm Classic Update 4.4.1.56464
Xian55 Sep 9, 2024
bd02371
Json: DBC: Update SoM Classic Update 1.15.4.56493
Xian55 Sep 9, 2024
2f15377
Json: Area: Update Cataclysm Classic 4.4.1.56464
Xian55 Sep 9, 2024
4d27958
Utilities: WowheadDB_Extractor: Set Central package management - Upda…
Xian55 Sep 9, 2024
3da252f
Utilities: ReadItems: Set Central package management - Update NugetPa…
Xian55 Sep 9, 2024
3944b0d
Utilities: PathMaker: Set Central package management - Update NugetPa…
Xian55 Sep 9, 2024
cff9e52
Utilities: ImageFilter: remove project
Xian55 Sep 9, 2024
5218387
Solution: Moved platform targets from individual projects to Director…
Xian55 Sep 10, 2024
e12e78c
Solution: set sdk version to '9.0.100-rc.1'
Xian55 Sep 13, 2024
15e76f0
Fix: can't start BlazorServer due DI failed to resolve ConfigAddonRea…
Xian55 Sep 18, 2024
f9aa8f2
Core: Collection Expression typo fix
Xian55 Oct 12, 2024
282c1b7
Solution: Update nuget packages to net9.0
Xian55 Nov 15, 2024
416eb5f
PPather: PPatherService: Logging outside
Xian55 Nov 15, 2024
1345a8c
Fix: PathingAPI: possible missing render.
Xian55 Nov 15, 2024
37e3e78
Fix: Core: WoWScreenDXGI: compiler errors due latest Vortice update
Xian55 Nov 15, 2024
00c9b22
fix merge
Xian55 Nov 15, 2024
4a27048
Solution: global.json change sdk version to 9.0.100
Xian55 Nov 15, 2024
c304c43
Pipeline: dotnet_build: update sdk version to 9.0.x
Xian55 Nov 15, 2024
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
32 changes: 32 additions & 0 deletions .bat/json_find_most_requirement_count.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Define the folder path
$folderPath = "..\JSON\class"

# Initialize a variable to store the result
$maxCount = 0
$maxFile = ""

# Get all files in the folder
$files = Get-ChildItem -Path $folderPath -File

# Iterate through each file
foreach ($file in $files) {
# Read the file content
$content = Get-Content -Path $file.FullName

# Count occurrences of the word "Requirement"
$count = [regex]::Matches($content, "Requirement", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase).Count

# Check if this file has more occurrences than the current maximum
if ($count -gt $maxCount) {
$maxCount = $count
$maxFile = $file.FullName
}
}

# Output the result
if ($maxFile -ne "") {
Write-Output "File with the most occurrences of 'Requirement': $maxFile"
Write-Output "Occurrences count: $maxCount"
} else {
Write-Output "No files found in the specified folder."
}
2 changes: 2 additions & 0 deletions .bat/link_json_to_benchmark_release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mklink /J "..\Benchmarks\bin\Release\Json" "..\Json"
PAUSE
2 changes: 2 additions & 0 deletions .bat/link_json_to_blazorserver_release_publish_9.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mklink /J "..\BlazorServer\bin\Release\net9.0\publish\Json" "..\Json"
PAUSE
2 changes: 2 additions & 0 deletions .bat/link_json_to_headlessserver_release_publish_9.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mklink /J "..\HeadlessServer\bin\Release\net9.0\publish\Json" "..\Json"
PAUSE
2 changes: 1 addition & 1 deletion .github/workflows/dotnet_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,7 @@ HeadlessServer/data_config.json

PathingAPI/frame_config.json
PathingAPI/addon_config.json
PathingAPI/data_config.json
PathingAPI/data_config.json

# BenchmarkDotNet artifacts
**/BenchmarkDotNet.Artifacts/
20 changes: 20 additions & 0 deletions Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
<ProjectReference Include="..\HeadlessServer\HeadlessServer.csproj" />
<ProjectReference Include="..\PPather\PPather.csproj" />
</ItemGroup>

</Project>
43 changes: 43 additions & 0 deletions Benchmarks/ClassProfile/LoadAllProfiles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using BenchmarkDotNet.Attributes;

using HeadlessServer;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using WinAPI;

namespace Benchmarks.ClassProfile;

public class LoadAllProfiles
{
[Benchmark]
[ArgumentsSource(nameof(GetProfileNames))]
public void LoadProfile(string profileName)
{
// TODO: fix loading error frame_config.json not exists
HeadlessServer.Program.Main([$"{profileName}", "-m Local", "--loadonly"]);
}

public static IEnumerable<string> GetProfileNames()
{
var dataConfig = DataConfig.Load();

Directory.SetCurrentDirectory("..\\..\\..\\..\\HeadlessServer");

var root = Path.Join(dataConfig.Class, Path.DirectorySeparatorChar.ToString());
var files = Directory.EnumerateFiles(root, "*.json*", SearchOption.AllDirectories)
.Select(path => path.Replace(root, string.Empty))
.OrderBy(x => x, new NaturalStringComparer());

yield return files.First();

//foreach (var fileName in files)
//{
// yield return fileName;
//}
}
}
74 changes: 74 additions & 0 deletions Benchmarks/PPather/PPather_HasHoles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using BenchmarkDotNet.Attributes;

namespace Benchmarks.PPather;

[MemoryDiagnoser]
public class PPather_HasHoles
{

public bool hasholes = true;

public readonly uint holes;

// 0 ..3, 0 ..3
private static readonly int[] old_holetab_h = [0x1111, 0x2222, 0x4444, 0x8888];
private static readonly int[] old_holetab_v = [0x000F, 0x00F0, 0x0F00, 0xF000];

private static readonly int[] new_holetab = [
0x1111 & 0x000F, 0x1111 & 0x00F0, 0x1111 & 0x0F00, 0x1111 & 0xF000,
0x2222 & 0x000F, 0x2222 & 0x00F0, 0x2222 & 0x0F00, 0x2222 & 0xF000,
0x4444 & 0x000F, 0x4444 & 0x00F0, 0x4444 & 0x0F00, 0x4444 & 0xF000,
0x8888 & 0x000F, 0x8888 & 0x00F0, 0x8888 & 0x0F00, 0x8888 & 0xF000
];

[Benchmark(Baseline = true)]
[ArgumentsSource(nameof(Inputs_Fast))]
public bool Old_IsHole(int i, int j)
{
if (!hasholes)
return false;

i /= 2;
j /= 2;

return i <= 3 && j <= 3 && (holes & old_holetab_h[i] & old_holetab_v[j]) != 0;
}

[Benchmark]
[ArgumentsSource(nameof(Inputs_Fast))]
public bool New_IsHole(int i, int j)
{
if (!hasholes)
return false;

i >>= 1;
j >>= 1;

if (i > 3 || j > 3)
return false;

int index = (i << 2) | j;

return (holes & new_holetab[index]) != 0;
}

public static IEnumerable<object[]> Inputs_All()
{
const int min = -1; // -1
const int max = 5; // 5

// Generate a range of inputs from -1,-1 to 5,5
for (int i = min; i < max; i++)
{
for (int j = min; j < max; j++)
{
yield return [i, j];
}
}
}

public static IEnumerable<object[]> Inputs_Fast()
{
yield return [0, 0];
}
}
192 changes: 192 additions & 0 deletions Benchmarks/PPather/PPather_Utils_AxesIntersectTriangleBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
using BenchmarkDotNet.Attributes;

using System.Numerics;
using System.Runtime.CompilerServices;

using static System.MathF;
using static System.Numerics.Vector3;

namespace Benchmarks.PPather;

public class PPather_Utils_AxesIntersectTriangleBox
{
//static readonly Vector3 v0 = new(0.1f, 0.2f, 0.3f);
//static readonly Vector3 v1 = new(-0.1f, 0.2f, -0.3f);
//static readonly Vector3 v2 = new(0.1f, -0.2f, 0.3f);

//static readonly Vector3 boxExtents = new(1.0f, 1.0f, 1.0f); // AABB with extents of 1 unit in each axis

//

//static readonly Vector3 v0 = new(1.5f, 1.5f, 1.5f);
//static readonly Vector3 v1 = new(3.0f, 0.0f, -1.0f);
//static readonly Vector3 v2 = new(0.0f, 3.0f, 2.0f);

//static readonly Vector3 boxExtents = new(2.0f, 2.0f, 2.0f);

//

static readonly Vector3 v0 = new(5.0f, 5.0f, 5.0f); // Far outside the box
static readonly Vector3 v1 = new(6.0f, 5.0f, 4.0f); // Far outside the box
static readonly Vector3 v2 = new(5.0f, 6.0f, 4.0f); // Far outside the box

static readonly Vector3 boxExtents = new(1.0f, 1.0f, 1.0f); // AABB with extents of 1 unit in each axis

//

static readonly Vector3 f0 = v1 - v0;
static readonly Vector3 f1 = v2 - v1;
static readonly Vector3 f2 = v0 - v2;


[Benchmark(Baseline = true)]
#pragma warning disable CA1822 // Mark members as static
public void Old_AxesIntersectTriangleBox()
#pragma warning restore CA1822 // Mark members as static
{
_ = AxesIntersectTriangleBox_old(
in v0, in v1, in v2,
in boxExtents,
in f0, in f1, in f2);
}

[Benchmark]
#pragma warning disable CA1822 // Mark members as static
public void New_AxesIntersectTriangleBox()
#pragma warning restore CA1822 // Mark members as static
{
_ = AxesIntersectTriangleBox(
in v0, in v1, in v2,
in boxExtents,
in f0, in f1, in f2);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool AxesIntersectTriangleBox(
in Vector3 v0, in Vector3 v1, in Vector3 v2,
in Vector3 boxExtents,
in Vector3 f0, in Vector3 f1, in Vector3 f2)
{
float r, p0, p1, p2;

// Axis 1: Cross product of triangle edge f0 with the X, Y, Z axes
p0 = v0.Z * f0.Y - v0.Y * f0.Z;
p1 = v1.Z * f0.Y - v1.Y * f0.Z;
p2 = v2.Z * f0.Y - v2.Y * f0.Z;
r = boxExtents.Y * Abs(f0.Z) + boxExtents.Z * Abs(f0.Y);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.X * f0.Z - v0.Z * f0.X;
p1 = v1.X * f0.Z - v1.Z * f0.X;
p2 = v2.X * f0.Z - v2.Z * f0.X;
r = boxExtents.X * Abs(f0.Z) + boxExtents.Z * Abs(f0.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.Y * f0.X - v0.X * f0.Y;
p1 = v1.Y * f0.X - v1.X * f0.Y;
p2 = v2.Y * f0.X - v2.X * f0.Y;
r = boxExtents.X * Abs(f0.Y) + boxExtents.Y * Abs(f0.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

// Axis 2: Cross product of triangle edge f1 with the X, Y, Z axes
p0 = v0.Z * f1.Y - v0.Y * f1.Z;
p1 = v1.Z * f1.Y - v1.Y * f1.Z;
p2 = v2.Z * f1.Y - v2.Y * f1.Z;
r = boxExtents.Y * Abs(f1.Z) + boxExtents.Z * Abs(f1.Y);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.X * f1.Z - v0.Z * f1.X;
p1 = v1.X * f1.Z - v1.Z * f1.X;
p2 = v2.X * f1.Z - v2.Z * f1.X;
r = boxExtents.X * Abs(f1.Z) + boxExtents.Z * Abs(f1.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.Y * f1.X - v0.X * f1.Y;
p1 = v1.Y * f1.X - v1.X * f1.Y;
p2 = v2.Y * f1.X - v2.X * f1.Y;
r = boxExtents.X * Abs(f1.Y) + boxExtents.Y * Abs(f1.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

// Axis 3: Cross product of triangle edge f2 with the X, Y, Z axes
p0 = v0.Z * f2.Y - v0.Y * f2.Z;
p1 = v1.Z * f2.Y - v1.Y * f2.Z;
p2 = v2.Z * f2.Y - v2.Y * f2.Z;
r = boxExtents.Y * Abs(f2.Z) + boxExtents.Z * Abs(f2.Y);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.X * f2.Z - v0.Z * f2.X;
p1 = v1.X * f2.Z - v1.Z * f2.X;
p2 = v2.X * f2.Z - v2.Z * f2.X;
r = boxExtents.X * Abs(f2.Z) + boxExtents.Z * Abs(f2.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

p0 = v0.Y * f2.X - v0.X * f2.Y;
p1 = v1.Y * f2.X - v1.X * f2.Y;
p2 = v2.Y * f2.X - v2.X * f2.Y;
r = boxExtents.X * Abs(f2.Y) + boxExtents.Y * Abs(f2.X);
if (Max3(p0, p1, p2) < -r || Min3(p0, p1, p2) > r) return false;

return true;
}


[SkipLocalsInit]
private static bool AxesIntersectTriangleBox_old(
in Vector3 v0, in Vector3 v1, in Vector3 v2,
in Vector3 boxExtents,
in Vector3 f0, in Vector3 f1, in Vector3 f2)
{
float r;

ReadOnlySpan<Vector3> axes =
[
new(0, -f0.Z, f0.Y),
new(0, -f1.Z, f1.Y),
new(0, -f2.Z, f2.Y),

new(f0.Z, 0, -f0.X),
new(f1.Z, 0, -f1.X),
new(f2.Z, 0, -f2.X),

new(-f0.Y, f0.X, 0),
new(-f1.Y, f1.X, 0),
new(-f2.Y, f2.X, 0)
];

for (int i = 0; i < axes.Length; i++)
{
Vector3 axis = axes[i];

float p0 = Dot(v0, axis);
float p1 = Dot(v1, axis);
float p2 = Dot(v2, axis);

r =
(boxExtents.X * Abs(axis.X)) +
(boxExtents.Y * Abs(axis.Y)) +
(boxExtents.Z * Abs(axis.Z));

if (Max(-Max3(p0, p1, p2), Min3(p0, p1, p2)) > r)
{
return false;
}
}

return true;
}




[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Min3(float a, float b, float c)
{
return Min(a, Min(b, c));
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Max3(float a, float b, float c)
{
return Max(a, Max(b, c));
}
}
Loading
Loading