From f22ec940389df80779c7ba034d0c2fc5f7d8be26 Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 25 Apr 2024 00:59:02 +0900 Subject: [PATCH] support C# 10, 11 in DotRecast.Recast.Demo --- .github/workflows/codeql.yml | 2 +- .github/workflows/dotnet.yml | 6 ++---- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 2 +- .../DotRecast.Recast.Demo.csproj | 2 +- .../Draw/GLCheckerTexture.cs | 21 +++++++++++++------ 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1001d74..0093ad1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v4 - name: Set up .NET 8.0 - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.x diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index aac3f76..af233a5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -37,7 +37,7 @@ jobs: fetch-depth: 0 # Get all history to allow automatic versioning using MinVer - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnet-version }}.x @@ -45,9 +45,7 @@ jobs: run: dotnet restore - name: Build - run: | - dotnet restore - dotnet build -c Release --no-restore --framework net${{ matrix.dotnet-version }}.0 + run: dotnet build -c Release --no-restore --framework net${{ matrix.dotnet-version }}.0 - name: Test run: dotnet test -c Release --no-build --verbosity normal --framework net${{ matrix.dotnet-version }}.0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a849a60..f00fc9f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -33,7 +33,7 @@ jobs: fetch-depth: 0 # Get all history to allow automatic versioning using MinVer - name: Setup Dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: '8.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f14ed1..2e75fbe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 0 # Get all history to allow automatic versioning using MinVer - name: Setup Dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: '8.x' diff --git a/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj b/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj index 15c6da7..b231327 100644 --- a/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj +++ b/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net6.0;net7.0;net8.0 true DotRecast.Recast.Demo README.md diff --git a/src/DotRecast.Recast.Demo/Draw/GLCheckerTexture.cs b/src/DotRecast.Recast.Demo/Draw/GLCheckerTexture.cs index 061ab23..e044757 100644 --- a/src/DotRecast.Recast.Demo/Draw/GLCheckerTexture.cs +++ b/src/DotRecast.Recast.Demo/Draw/GLCheckerTexture.cs @@ -32,15 +32,18 @@ public class GLCheckerTexture _gl = gl; } - public void Release() + public unsafe void Release() { if (m_texId != 0) { - _gl.DeleteTextures(1, m_texId); + fixed (uint* p = &m_texId) + { + _gl.DeleteTextures(1, p); + } } } - public void Bind() + public unsafe void Bind() { if (m_texId == 0) { @@ -50,7 +53,11 @@ public class GLCheckerTexture uint TSIZE = 64; int[] data = new int[TSIZE * TSIZE]; - _gl.GenTextures(1, out m_texId); + fixed (uint* p = &m_texId) + { + _gl.GenTextures(1, p); + } + _gl.BindTexture(GLEnum.Texture2D, m_texId); int level = 0; @@ -70,8 +77,10 @@ public class GLCheckerTexture level++; } - _gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMinFilter, (uint)GLEnum.LinearMipmapNearest); - _gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMagFilter, (uint)GLEnum.Linear); + uint linearMipmapNearest = (uint)GLEnum.LinearMipmapNearest; + uint linear = (uint)GLEnum.Linear; + _gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMinFilter, &linearMipmapNearest); + _gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMagFilter, &linear); } else {