diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9d823ad..e19417f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -25,11 +25,14 @@ jobs:
- uses: actions/checkout@v2
- name: Setup .NET Core
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '8.0.x'
- - uses: actions/cache@v1
+ - name: Install macos workload
+ run: dotnet workload install macos
+
+ - uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -43,7 +46,7 @@ jobs:
run: dotnet pack ${{ env.PlatformBuildParameters }} ${{ env.BuildParameters }}
- name: Upload artifacts
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
with:
name: nuget
path: artifacts/nuget/**/*.nupkg
@@ -59,18 +62,19 @@ jobs:
- uses: actions/checkout@v2
- name: Setup .NET Core
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '8.0.x'
+
+ - name: Install macos workload
+ run: dotnet workload install macos
- - name: setup-xamarin
- uses: maxim-lobanov/setup-xamarin@v1
+ - name: Setup XCode
+ uses: maxim-lobanov/setup-xcode@v1
with:
- mono-version: latest
- xamarin-mac-version: latest
- xcode-version: latest
+ xcode-version: latest-stable
- - uses: actions/cache@v1
+ - uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -84,7 +88,7 @@ jobs:
run: dotnet pack ${{ env.PlatformBuildParameters }} ${{ env.BuildParameters }}
# - name: Upload artifacts
-# uses: actions/upload-artifact@v2
+# uses: actions/upload-artifact@v4
# with:
# name: nuget
# path: artifacts/nuget/**/Eto.Veldrid.XamMac2.nupkg
@@ -95,10 +99,10 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Setup .NET Core
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
- name: Download NuGet Packages
- uses: actions/download-artifact@v1
+ uses: actions/download-artifact@v4
with:
name: nuget
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 3b85bb1..ef810ad 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -11,34 +11,31 @@
"preLaunchTask": "build",
"program": "",
"osx": {
- "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Mac64/Debug/net5.0/osx-x64/TestEtoVeldrid.Mac64.app/Contents/MacOS/TestEtoVeldrid.Mac64"
+ "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Mac64/Debug/net8.0/TestEtoVeldrid.Mac64.app/Contents/MacOS/TestEtoVeldrid.Mac64"
},
"linux": {
- "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Gtk/Debug/net7.0/linux-x64/TestEtoVeldrid.Gtk.dll"
+ "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Gtk/Debug/net8.0/linux-x64/TestEtoVeldrid.Gtk.dll"
},
"windows": {
- "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Wpf/Debug/net5.0-windows/win-x64/TestEtoVeldrid.Wpf.dll"
+ "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Wpf/Debug/net8.0-windows/win-x64/TestEtoVeldrid.Wpf.dll"
},
"console": "internalConsole",
"stopAtEntry": false
},
{
- "name": "Launch Mono",
- "type": "mono",
+ "name": "Launch macOS",
+ "type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "",
"osx": {
- "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Mac64/Debug/net48/osx-x64/TestEtoVeldrid.Mac64.app/Contents/MacOS/TestEtoVeldrid.Mac64",
- "useRuntime": false
- },
- "linux": {
- "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.Gtk/Debug/net48/linux-x64/TestEtoVeldrid.Gtk.exe"
+ "program": "${workspaceFolder}/artifacts/bin/TestEtoVeldrid.macOS/Debug/net8.0-macos/TestEtoVeldrid.macOS.app/Contents/MacOS/TestEtoVeldrid.macOS"
},
- "console": "internalConsole"
+ "console": "internalConsole",
+ "stopAtEntry": false
},
{
- "name": "Launch .NET (WPF)",
+ "name": "Launch WPF - net48",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
@@ -49,7 +46,7 @@
"console": "internalConsole"
},
{
- "name": "Launch .NET (WinForms)",
+ "name": "Launch WinForms - net48",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 10d70b6..3159249 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -5,73 +5,35 @@
"label": "build",
"command": "dotnet",
"type": "shell",
- "osx": {
- "args": [
- "build",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Mac",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
+ "args": [
+ "build",
+ "${workspaceFolder}/Eto.Veldrid.sln",
+ "/p:Configuration=${input:configuration}",
+ "/p:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile",
+ "presentation": {
+ "reveal": "always",
+ "clear": true
},
- "linux": {
- "args": [
- "build",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Mac",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- },
- "windows": {
- "args": [
- "build",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Windows",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- },
- "problemMatcher": "$msCompile"
},
{
"label": "Pack",
"command": "dotnet",
"type": "process",
- "osx": {
- "args": [
- "pack",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Mac",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ]
- },
- "linux": {
- "args": [
- "pack",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Mac",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ]
- },
- "windows": {
- "args": [
- "pack",
- "${workspaceFolder}/Eto.Veldrid.sln",
- "/p:Platform=Windows",
- "/p:Configuration=${input:configuration}",
- "/p:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ]
+ "args": [
+ "pack",
+ "${workspaceFolder}/Eto.Veldrid.sln",
+ "/p:Configuration=${input:configuration}",
+ "/p:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile",
+ "presentation": {
+ "reveal": "always",
+ "clear": true
},
- "problemMatcher": "$msCompile"
}
],
"inputs": [
@@ -86,4 +48,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/Directory.Build.props b/Directory.Build.props
index 47abf29..bc4c695 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,6 +8,11 @@
+ enable
+ 10.0
+
+ true
+
https://www.myget.org/F/eto/
$(MSBuildThisFileDirectory)
@@ -28,7 +33,7 @@
- 0.1.0
+ 0.2.0
$(BuildBranch.Substring(10))
diff --git a/Eto.Veldrid.sln b/Eto.Veldrid.sln
index 8dbb54f..5f30d4f 100644
--- a/Eto.Veldrid.sln
+++ b/Eto.Veldrid.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28803.156
+# Visual Studio Version 17
+VisualStudioVersion = 17.10.35004.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eto.Veldrid", "src\Eto.Veldrid\Eto.Veldrid.csproj", "{72B9021E-5D60-4494-8C19-96EA28F1154E}"
EndProject
@@ -34,96 +34,194 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestEtoVeldrid.Wpf", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestEtoVeldrid", "test\TestEtoVeldrid\TestEtoVeldrid.csproj", "{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eto.VeldridSurface", "src\Eto.VeldridSurface\Eto.VeldridSurface.csproj", "{AB712D06-69EA-4601-A9B3-774820B56633}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eto.Veldrid.macOS", "src\Eto.Veldrid.Mac\Eto.Veldrid.macOS.csproj", "{B5532B13-B15D-4987-81E5-7AEBC18CDED0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestEtoVeldrid.macOS", "test\TestEtoVeldrid.Mac\TestEtoVeldrid.macOS.csproj", "{63B74346-2B72-429F-AA2C-BD4CA09CD0E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Linux = Debug|Linux
Debug|Mac = Debug|Mac
Debug|Windows = Debug|Windows
+ Release|Any CPU = Release|Any CPU
+ Release|Linux = Release|Linux
Release|Mac = Release|Mac
Release|Windows = Release|Windows
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Linux.Build.0 = Debug|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Mac.ActiveCfg = Debug|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Mac.Build.0 = Debug|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Windows.ActiveCfg = Debug|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Debug|Windows.Build.0 = Debug|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Linux.ActiveCfg = Release|Any CPU
+ {72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Linux.Build.0 = Release|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Mac.ActiveCfg = Release|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Mac.Build.0 = Release|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Windows.ActiveCfg = Release|Any CPU
{72B9021E-5D60-4494-8C19-96EA28F1154E}.Release|Windows.Build.0 = Release|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Linux.Build.0 = Debug|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Mac.ActiveCfg = Debug|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Mac.Build.0 = Debug|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Windows.ActiveCfg = Debug|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Debug|Windows.Build.0 = Debug|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Linux.ActiveCfg = Release|Any CPU
+ {280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Linux.Build.0 = Release|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Mac.ActiveCfg = Release|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Mac.Build.0 = Release|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Windows.ActiveCfg = Release|Any CPU
{280A06EE-3A6C-422F-B303-040F90EA4B3B}.Release|Windows.Build.0 = Release|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Linux.Build.0 = Debug|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Mac.ActiveCfg = Debug|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Mac.Build.0 = Debug|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Windows.ActiveCfg = Debug|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Debug|Windows.Build.0 = Debug|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Linux.ActiveCfg = Release|Any CPU
+ {E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Linux.Build.0 = Release|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Mac.ActiveCfg = Release|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Mac.Build.0 = Release|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Windows.ActiveCfg = Release|Any CPU
{E8C6995B-791B-449A-A9B9-AEA2047FAA1E}.Release|Windows.Build.0 = Release|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Linux.ActiveCfg = Debug|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Mac.ActiveCfg = Debug|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Windows.ActiveCfg = Debug|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Debug|Windows.Build.0 = Debug|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Any CPU.Build.0 = Release|Any CPU
+ {748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Linux.ActiveCfg = Release|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Mac.ActiveCfg = Release|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Windows.ActiveCfg = Release|Any CPU
{748ABF6C-F3E3-4872-8746-627ABFA7D322}.Release|Windows.Build.0 = Release|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Linux.ActiveCfg = Debug|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Mac.ActiveCfg = Debug|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Windows.ActiveCfg = Debug|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Debug|Windows.Build.0 = Debug|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Linux.ActiveCfg = Release|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Mac.ActiveCfg = Release|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Windows.ActiveCfg = Release|Any CPU
{2B8EAE29-7D66-4C15-918E-A7C2ED97F040}.Release|Windows.Build.0 = Release|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Linux.Build.0 = Debug|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Mac.ActiveCfg = Debug|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Mac.Build.0 = Debug|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Windows.ActiveCfg = Debug|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Debug|Windows.Build.0 = Debug|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Linux.ActiveCfg = Release|Any CPU
+ {AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Linux.Build.0 = Release|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Mac.ActiveCfg = Release|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Mac.Build.0 = Release|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Windows.ActiveCfg = Release|Any CPU
{AB71CC3A-A9A4-4EA0-96FB-16036E92BBC9}.Release|Windows.Build.0 = Release|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Linux.Build.0 = Debug|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Mac.ActiveCfg = Debug|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Mac.Build.0 = Debug|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Windows.ActiveCfg = Debug|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Debug|Windows.Build.0 = Debug|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Linux.ActiveCfg = Release|Any CPU
+ {6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Linux.Build.0 = Release|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Mac.ActiveCfg = Release|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Mac.Build.0 = Release|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Windows.ActiveCfg = Release|Any CPU
{6AF05698-3D64-4FA5-B9DE-CCA2C2DD9CA1}.Release|Windows.Build.0 = Release|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Linux.ActiveCfg = Debug|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Mac.ActiveCfg = Debug|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Windows.ActiveCfg = Debug|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Debug|Windows.Build.0 = Debug|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Linux.ActiveCfg = Release|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Mac.ActiveCfg = Release|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Windows.ActiveCfg = Release|Any CPU
{3589BA37-A44E-49DB-A370-26D41EB3955F}.Release|Windows.Build.0 = Release|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Linux.ActiveCfg = Debug|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Mac.ActiveCfg = Debug|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Windows.ActiveCfg = Debug|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Debug|Windows.Build.0 = Debug|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Linux.ActiveCfg = Release|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Mac.ActiveCfg = Release|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Windows.ActiveCfg = Release|Any CPU
{51F518B4-5A7F-438D-A164-145D527DB1FF}.Release|Windows.Build.0 = Release|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Linux.Build.0 = Debug|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Mac.ActiveCfg = Debug|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Mac.Build.0 = Debug|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Windows.ActiveCfg = Debug|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Debug|Windows.Build.0 = Debug|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Linux.ActiveCfg = Release|Any CPU
+ {14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Linux.Build.0 = Release|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Mac.ActiveCfg = Release|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Mac.Build.0 = Release|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Windows.ActiveCfg = Release|Any CPU
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4}.Release|Windows.Build.0 = Release|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Debug|Mac.ActiveCfg = Debug|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Debug|Mac.Build.0 = Debug|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Debug|Windows.ActiveCfg = Debug|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Debug|Windows.Build.0 = Debug|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Release|Mac.ActiveCfg = Release|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Release|Mac.Build.0 = Release|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Release|Windows.ActiveCfg = Release|Any CPU
- {AB712D06-69EA-4601-A9B3-774820B56633}.Release|Windows.Build.0 = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Mac.ActiveCfg = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Mac.Build.0 = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Debug|Windows.ActiveCfg = Debug|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Linux.ActiveCfg = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Linux.Build.0 = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Mac.ActiveCfg = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Mac.Build.0 = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Windows.ActiveCfg = Release|Any CPU
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0}.Release|Windows.Build.0 = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Linux.ActiveCfg = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Mac.ActiveCfg = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Mac.Build.0 = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Debug|Windows.ActiveCfg = Debug|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Linux.ActiveCfg = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Linux.Build.0 = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Mac.ActiveCfg = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Mac.Build.0 = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Windows.ActiveCfg = Release|Any CPU
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5}.Release|Windows.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -139,7 +237,8 @@ Global
{3589BA37-A44E-49DB-A370-26D41EB3955F} = {48C6A621-D898-4932-A28F-DFC0C1B272B6}
{51F518B4-5A7F-438D-A164-145D527DB1FF} = {48C6A621-D898-4932-A28F-DFC0C1B272B6}
{14AFF269-5C00-4E7A-8528-4DA704B7D2F4} = {48C6A621-D898-4932-A28F-DFC0C1B272B6}
- {AB712D06-69EA-4601-A9B3-774820B56633} = {6136B651-45C5-48C7-80E7-943FF2461732}
+ {B5532B13-B15D-4987-81E5-7AEBC18CDED0} = {6136B651-45C5-48C7-80E7-943FF2461732}
+ {63B74346-2B72-429F-AA2C-BD4CA09CD0E5} = {48C6A621-D898-4932-A28F-DFC0C1B272B6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0F9A175-218E-4414-B0EC-A227B0E5FA61}
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100755
index 0000000..1d4bd7f
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,9 @@
+
+
+
+
+
+ enable
+
+
+
diff --git a/src/Eto.Veldrid.Gtk/Eto.Veldrid.Gtk.csproj b/src/Eto.Veldrid.Gtk/Eto.Veldrid.Gtk.csproj
index ffc44b0..75990ec 100644
--- a/src/Eto.Veldrid.Gtk/Eto.Veldrid.Gtk.csproj
+++ b/src/Eto.Veldrid.Gtk/Eto.Veldrid.Gtk.csproj
@@ -1,15 +1,10 @@
-
+
+ netstandard2.0;net6.0
GTK3
Veldrid Gtk implementation for Eto.Forms
This provides the Gtk implementation of Eto.Veldrid for Eto.Forms
- net7.0
-
-
-
- Project
- false
@@ -19,5 +14,5 @@
-
+
diff --git a/src/Eto.Veldrid.Gtk/GtkVeldridSurfaceHandler.cs b/src/Eto.Veldrid.Gtk/GtkVeldridSurfaceHandler.cs
index 14e8134..8291a7e 100755
--- a/src/Eto.Veldrid.Gtk/GtkVeldridSurfaceHandler.cs
+++ b/src/Eto.Veldrid.Gtk/GtkVeldridSurfaceHandler.cs
@@ -12,7 +12,7 @@ namespace Eto.Veldrid.Gtk
{
public class GtkVeldridSurfaceHandler : GtkControl, VeldridSurface.IHandler, VeldridSurface.IOpenGL
{
- GLArea glArea;
+ GLArea? glArea;
System.Action _makeCurrent;
System.Action _clearCurrent;
public Size RenderSize => Size.Round((SizeF)Widget.Size * Scale);
@@ -27,13 +27,13 @@ public GtkVeldridSurfaceHandler()
_clearCurrent = ClearCurrent;
}
- public Swapchain CreateSwapchain()
+ public Swapchain? CreateSwapchain()
{
- Swapchain swapchain;
+ Swapchain? swapchain;
if (Widget.Backend == GraphicsBackend.OpenGL)
{
- swapchain = Widget.GraphicsDevice.MainSwapchain;
+ swapchain = Widget.GraphicsDevice?.MainSwapchain;
}
else
{
@@ -47,7 +47,7 @@ public Swapchain CreateSwapchain()
X11Interop.gdk_x11_window_get_xid(Control.Window.Handle));
var renderSize = RenderSize;
- swapchain = Widget.GraphicsDevice.ResourceFactory.CreateSwapchain(
+ swapchain = Widget.GraphicsDevice?.ResourceFactory.CreateSwapchain(
new SwapchainDescription(
source,
(uint)renderSize.Width,
@@ -60,15 +60,17 @@ public Swapchain CreateSwapchain()
return swapchain;
}
- void glArea_InitializeGraphicsBackend(object sender, EventArgs e)
+ void glArea_InitializeGraphicsBackend(object? sender, EventArgs e)
{
+ if (glArea == null)
+ return;
// Make context current to manually initialize a Veldrid GraphicsDevice.
glArea.Context.MakeCurrent();
Callback.OnInitializeBackend(Widget, new InitializeEventArgs(RenderSize));
// Veldrid clears the context at the end of initialization and sets it current in the worker thread.
// Clear context in the worker thread for now to make Mesa happy.
- if (Widget.GraphicsDevice.GetOpenGLInfo(out BackendInfoOpenGL glInfo))
+ if (Widget.GraphicsDevice?.GetOpenGLInfo(out BackendInfoOpenGL glInfo) == true)
{
// This action has to wait so GTK can manage the context after this method.
glInfo.ExecuteOnGLThread(_clearCurrent);//, wait: true);
@@ -78,7 +80,7 @@ void glArea_InitializeGraphicsBackend(object sender, EventArgs e)
glArea.Resize += glArea_Resize;
}
- void Control_InitializeGraphicsBackend(object sender, EventArgs e)
+ void Control_InitializeGraphicsBackend(object? sender, EventArgs e)
{
Callback.OnInitializeBackend(Widget, new InitializeEventArgs(RenderSize));
}
@@ -99,6 +101,8 @@ void glArea_Render(object o, RenderArgs args)
// GTK makes the context current for us, so we need to clear it to hand it over to the Veldrid worker.
Gdk.GLContext.ClearCurrent();
+ if (Widget.GraphicsDevice == null)
+ return;
// Make context current on the Veldrid worker.
if (Widget.GraphicsDevice.GetOpenGLInfo(out BackendInfoOpenGL glInfo))
diff --git a/src/Eto.Veldrid.Mac/Eto.Veldrid.Mac64.csproj b/src/Eto.Veldrid.Mac/Eto.Veldrid.Mac64.csproj
index 4883845..2587c03 100644
--- a/src/Eto.Veldrid.Mac/Eto.Veldrid.Mac64.csproj
+++ b/src/Eto.Veldrid.Mac/Eto.Veldrid.Mac64.csproj
@@ -1,16 +1,15 @@
+ net6.0;net462
MONOMAC
false
Veldrid Mac implementation for Eto.Forms
This provides the Mac64 implementation of Eto.Veldrid for Eto.Forms
- net7.0
-
diff --git a/src/Eto.Veldrid.Mac/Eto.Veldrid.macOS.csproj b/src/Eto.Veldrid.Mac/Eto.Veldrid.macOS.csproj
new file mode 100755
index 0000000..8532713
--- /dev/null
+++ b/src/Eto.Veldrid.Mac/Eto.Veldrid.macOS.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net7.0-macos10.15
+ Veldrid Mac implementation for Eto.Forms
+ This provides the Mac64 implementation of Eto.Veldrid for Eto.Forms
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Eto.Veldrid.Mac/MacVeldridSurfaceHandler.cs b/src/Eto.Veldrid.Mac/MacVeldridSurfaceHandler.cs
index 2944fc6..1f78055 100755
--- a/src/Eto.Veldrid.Mac/MacVeldridSurfaceHandler.cs
+++ b/src/Eto.Veldrid.Mac/MacVeldridSurfaceHandler.cs
@@ -3,12 +3,13 @@
using Eto.Veldrid.Mac;
using System;
using Veldrid;
-using MonoMac.CoreVideo;
using Eto.Drawing;
#if MONOMAC
+using MonoMac.CoreVideo;
using MonoMac.AppKit;
-#elif XAMMAC2
+#else
+using CoreVideo;
using AppKit;
#endif
@@ -18,7 +19,7 @@ namespace Eto.Veldrid.Mac
{
public class MacVeldridSurfaceHandler : MacView, VeldridSurface.IHandler
{
- CVDisplayLink _displayLink;
+ CVDisplayLink? _displayLink;
Size? _newRenderSize;
public Size RenderSize => Size.Round((SizeF)Widget.Size * Scale);
@@ -36,13 +37,13 @@ public MacVeldridSurfaceHandler()
Control.Draw += Control_Draw;
}
- public Swapchain CreateSwapchain()
+ public Swapchain? CreateSwapchain()
{
- Swapchain swapchain;
+ Swapchain? swapchain;
if (Widget.Backend == GraphicsBackend.OpenGL)
{
- swapchain = Widget.GraphicsDevice.MainSwapchain;
+ swapchain = Widget.GraphicsDevice?.MainSwapchain;
}
else
{
@@ -54,7 +55,7 @@ public Swapchain CreateSwapchain()
var source = SwapchainSource.CreateNSView(Control.Handle);
var renderSize = RenderSize;
- swapchain = Widget.GraphicsDevice.ResourceFactory.CreateSwapchain(
+ swapchain = Widget.GraphicsDevice?.ResourceFactory.CreateSwapchain(
new SwapchainDescription(
source,
(uint)renderSize.Width,
@@ -67,7 +68,7 @@ public Swapchain CreateSwapchain()
return swapchain;
}
- private void Control_Draw(object sender, EventArgs e)
+ private void Control_Draw(object? sender, EventArgs e)
{
Callback.OnInitializeBackend(Widget, new InitializeEventArgs(RenderSize));
@@ -82,7 +83,7 @@ private void Control_Draw(object sender, EventArgs e)
Widget.SizeChanged += Widget_SizeChanged;
}
- private void Widget_SizeChanged(object sender, EventArgs e)
+ private void Widget_SizeChanged(object? sender, EventArgs e)
{
if (Widget.Backend == GraphicsBackend.OpenGL)
{
diff --git a/src/Eto.Veldrid.Mac/MacVeldridView.cs b/src/Eto.Veldrid.Mac/MacVeldridView.cs
old mode 100644
new mode 100755
index b5e70a0..566fd84
--- a/src/Eto.Veldrid.Mac/MacVeldridView.cs
+++ b/src/Eto.Veldrid.Mac/MacVeldridView.cs
@@ -4,7 +4,7 @@
#if MONOMAC
using MonoMac.AppKit;
using MonoMac.CoreGraphics;
-#elif XAMMAC2
+#else
using AppKit;
using CoreGraphics;
#endif
@@ -19,9 +19,9 @@ public class MacVeldridView : NSView, IMacControl
public bool CanFocus { get; set; } = true;
- public WeakReference WeakHandler { get; set; }
+ public WeakReference? WeakHandler { get; set; }
- public event EventHandler Draw;
+ public event EventHandler? Draw;
public override void DrawRect(CGRect dirtyRect)
{
diff --git a/src/Eto.Veldrid.WinForms/Eto.Veldrid.WinForms.csproj b/src/Eto.Veldrid.WinForms/Eto.Veldrid.WinForms.csproj
index d078b62..3e7324a 100755
--- a/src/Eto.Veldrid.WinForms/Eto.Veldrid.WinForms.csproj
+++ b/src/Eto.Veldrid.WinForms/Eto.Veldrid.WinForms.csproj
@@ -1,16 +1,8 @@
-
+
- true
- net7.0
-
-
-
-
-
-
- $(TargetFrameworks);netcoreapp3.1
- true
+ net6.0-windows;net462
+ true
Veldrid Windows Forms implementation for Eto.Forms
This provides the Windows Forms implementation of Eto.Veldrid for Eto.Forms
@@ -19,17 +11,8 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/Eto.Veldrid.WinForms/WinFormsVeldridSurfaceHandler.cs b/src/Eto.Veldrid.WinForms/WinFormsVeldridSurfaceHandler.cs
index 43ab475..8d40884 100755
--- a/src/Eto.Veldrid.WinForms/WinFormsVeldridSurfaceHandler.cs
+++ b/src/Eto.Veldrid.WinForms/WinFormsVeldridSurfaceHandler.cs
@@ -12,7 +12,7 @@ namespace Eto.Veldrid.WinForms
{
public class WinFormsVeldridSurfaceHandler : WindowsControl, VeldridSurface.IHandler
{
- public Size RenderSize => Size.Round((SizeF)Widget.Size * Scale);
+ public Eto.Drawing.Size RenderSize => Eto.Drawing.Size.Round((Eto.Drawing.SizeF)Widget.Size * Scale);
float Scale => Widget.ParentWindow?.LogicalPixelSize ?? 1;
@@ -24,13 +24,13 @@ public WinFormsVeldridSurfaceHandler()
Control.HandleCreated += Control_HandleCreated;
}
- public Swapchain CreateSwapchain()
+ public Swapchain? CreateSwapchain()
{
- Swapchain swapchain;
+ Swapchain? swapchain;
if (Widget.Backend == GraphicsBackend.OpenGL)
{
- swapchain = Widget.GraphicsDevice.MainSwapchain;
+ swapchain = Widget.GraphicsDevice?.MainSwapchain;
}
else
{
@@ -44,7 +44,7 @@ public Swapchain CreateSwapchain()
Marshal.GetHINSTANCE(typeof(VeldridSurface).Module));
var renderSize = RenderSize;
- swapchain = Widget.GraphicsDevice.ResourceFactory.CreateSwapchain(
+ swapchain = Widget.GraphicsDevice?.ResourceFactory.CreateSwapchain(
new SwapchainDescription(
source,
(uint)renderSize.Width,
@@ -57,7 +57,7 @@ public Swapchain CreateSwapchain()
return swapchain;
}
- private void Control_HandleCreated(object sender, EventArgs e)
+ private void Control_HandleCreated(object? sender, EventArgs e)
{
if (RenderSize.IsEmpty)
return;
@@ -67,7 +67,7 @@ private void Control_HandleCreated(object sender, EventArgs e)
Widget.SizeChanged += Widget_SizeChanged;
}
- private void Widget_SizeChanged(object sender, EventArgs e)
+ private void Widget_SizeChanged(object? sender, EventArgs e)
{
Callback.OnResize(Widget, new ResizeEventArgs(RenderSize));
}
diff --git a/src/Eto.Veldrid.Wpf/Eto.Veldrid.Wpf.csproj b/src/Eto.Veldrid.Wpf/Eto.Veldrid.Wpf.csproj
index ab46151..4921562 100755
--- a/src/Eto.Veldrid.Wpf/Eto.Veldrid.Wpf.csproj
+++ b/src/Eto.Veldrid.Wpf/Eto.Veldrid.Wpf.csproj
@@ -1,17 +1,9 @@
-
+
- true
- net7.0
-
-
-
-
-
-
- $(TargetFrameworks);netcoreapp3.1
- true
- true
+ net6.0-windows;net462
+ true
+ true
NU1701
Veldrid WPF implementation for Eto.Forms
@@ -23,17 +15,16 @@
-
+
-
-
+
@@ -43,8 +34,4 @@
-
-
-
-
diff --git a/src/Eto.Veldrid.Wpf/ManualBubbleWindowsFormsHostHandler.cs b/src/Eto.Veldrid.Wpf/ManualBubbleWindowsFormsHostHandler.cs
old mode 100644
new mode 100755
index 81af132..7238221
--- a/src/Eto.Veldrid.Wpf/ManualBubbleWindowsFormsHostHandler.cs
+++ b/src/Eto.Veldrid.Wpf/ManualBubbleWindowsFormsHostHandler.cs
@@ -121,7 +121,7 @@ private void Control_MouseWheel(object sender, swi.MouseWheelEventArgs e)
bool charPressed;
public Keys? LastKeyDown { get; set; }
- void WinFormsControl_KeyDown(object sender, swf.KeyEventArgs e)
+ void WinFormsControl_KeyDown(object? sender, swf.KeyEventArgs e)
{
charPressed = false;
handled = true;
@@ -149,7 +149,7 @@ void WinFormsControl_KeyDown(object sender, swf.KeyEventArgs e)
LastKeyDown = null;
}
- void WinFormsControl_KeyPress(object sender, swf.KeyPressEventArgs e)
+ void WinFormsControl_KeyPress(object? sender, swf.KeyPressEventArgs e)
{
charPressed = true;
keyChar = e.KeyChar;
@@ -173,7 +173,7 @@ void WinFormsControl_KeyPress(object sender, swf.KeyPressEventArgs e)
e.Handled = true;
}
- void WinFormsControl_KeyUp(object sender, swf.KeyEventArgs e)
+ void WinFormsControl_KeyUp(object? sender, swf.KeyEventArgs e)
{
key = e.KeyData.ToEto();
@@ -182,7 +182,7 @@ void WinFormsControl_KeyUp(object sender, swf.KeyEventArgs e)
e.Handled = kpea.Handled;
}
- void WinFormsControl_TextChanged(object sender, EventArgs e)
+ void WinFormsControl_TextChanged(object? sender, EventArgs e)
{
var widget = Widget as TextControl;
if (widget != null)
@@ -192,7 +192,7 @@ void WinFormsControl_TextChanged(object sender, EventArgs e)
}
}
- void WinFormsControl_MouseWheel(object sender, swf.MouseEventArgs e)
+ void WinFormsControl_MouseWheel(object? sender, swf.MouseEventArgs e)
{
var args = new swi.MouseWheelEventArgs(swi.InputManager.Current.PrimaryMouseDevice, Environment.TickCount, e.Delta)
{
@@ -203,13 +203,13 @@ void WinFormsControl_MouseWheel(object sender, swf.MouseEventArgs e)
Control.RaiseEvent(args);
}
- void WinFormsControl_MouseLeave(object sender, EventArgs e) => Callback.OnMouseLeave(Widget, new MouseEventArgs(Mouse.Buttons, Keyboard.Modifiers, PointFromScreen(Mouse.Position)));
+ void WinFormsControl_MouseLeave(object? sender, EventArgs e) => Callback.OnMouseLeave(Widget, new MouseEventArgs(Mouse.Buttons, Keyboard.Modifiers, PointFromScreen(Mouse.Position)));
- void WinFormsControl_MouseEnter(object sender, EventArgs e) => Callback.OnMouseEnter(Widget, new MouseEventArgs(Mouse.Buttons, Keyboard.Modifiers, PointFromScreen(Mouse.Position)));
+ void WinFormsControl_MouseEnter(object? sender, EventArgs e) => Callback.OnMouseEnter(Widget, new MouseEventArgs(Mouse.Buttons, Keyboard.Modifiers, PointFromScreen(Mouse.Position)));
- void WinFormsControl_MouseDoubleClick(object sender, swf.MouseEventArgs e) => Callback.OnMouseDoubleClick(Widget, e.ToEto(WinFormsControl));
+ void WinFormsControl_MouseDoubleClick(object? sender, swf.MouseEventArgs e) => Callback.OnMouseDoubleClick(Widget, e.ToEto(WinFormsControl));
- void WinFormsControl_MouseDown(object sender, swf.MouseEventArgs e)
+ void WinFormsControl_MouseDown(object? sender, swf.MouseEventArgs e)
{
// Contrary to most WPF controls, the WindowsFormsHost class seems
// to prevent correct mouse event data from being obtained (e.g.
@@ -233,7 +233,7 @@ void WinFormsControl_MouseDown(object sender, swf.MouseEventArgs e)
Control.RaiseEvent(args);
}
- void WinFormsControl_MouseUp(object sender, swf.MouseEventArgs e)
+ void WinFormsControl_MouseUp(object? sender, swf.MouseEventArgs e)
{
Control.CaptureMouse();
@@ -251,7 +251,7 @@ void WinFormsControl_MouseUp(object sender, swf.MouseEventArgs e)
Control.RaiseEvent(args);
}
- void WinFormsControl_MouseMove(object sender, swf.MouseEventArgs e)
+ void WinFormsControl_MouseMove(object? sender, swf.MouseEventArgs e)
{
var args = new swi.MouseEventArgs(swi.InputManager.Current.PrimaryMouseDevice, Environment.TickCount)
{
@@ -262,9 +262,9 @@ void WinFormsControl_MouseMove(object sender, swf.MouseEventArgs e)
Control.RaiseEvent(args);
}
- void WinFormsControl_LostFocus(object sender, EventArgs e) => Callback.OnLostFocus(Widget, EventArgs.Empty);
+ void WinFormsControl_LostFocus(object? sender, EventArgs e) => Callback.OnLostFocus(Widget, EventArgs.Empty);
- void WinFormsControl_GotFocus(object sender, EventArgs e) => Callback.OnGotFocus(Widget, EventArgs.Empty);
+ void WinFormsControl_GotFocus(object? sender, EventArgs e) => Callback.OnGotFocus(Widget, EventArgs.Empty);
public override void Focus()
{
@@ -274,7 +274,7 @@ public override void Focus()
Widget.LoadComplete += Widget_LoadComplete;
}
- void Widget_LoadComplete(object sender, EventArgs e)
+ void Widget_LoadComplete(object? sender, EventArgs e)
{
Widget.LoadComplete -= Widget_LoadComplete;
WinFormsControl.Focus();
diff --git a/src/Eto.Veldrid.Wpf/WpfVeldridSurfaceHandler.cs b/src/Eto.Veldrid.Wpf/WpfVeldridSurfaceHandler.cs
index 17cffe9..293e4b4 100755
--- a/src/Eto.Veldrid.Wpf/WpfVeldridSurfaceHandler.cs
+++ b/src/Eto.Veldrid.Wpf/WpfVeldridSurfaceHandler.cs
@@ -20,13 +20,13 @@ public WpfVeldridSurfaceHandler() : base(new WinFormsVeldridUserControl())
Control.Loaded += Control_Loaded;
}
- public Swapchain CreateSwapchain()
+ public Swapchain? CreateSwapchain()
{
- Swapchain swapchain;
+ Swapchain? swapchain;
if (Widget.Backend == GraphicsBackend.OpenGL)
{
- swapchain = Widget.GraphicsDevice.MainSwapchain;
+ swapchain = Widget.GraphicsDevice?.MainSwapchain;
}
else
{
@@ -40,7 +40,7 @@ public Swapchain CreateSwapchain()
Marshal.GetHINSTANCE(typeof(VeldridSurface).Module));
var renderSize = RenderSize;
- swapchain = Widget.GraphicsDevice.ResourceFactory.CreateSwapchain(
+ swapchain = Widget.GraphicsDevice?.ResourceFactory.CreateSwapchain(
new SwapchainDescription(
source,
(uint)renderSize.Width,
@@ -61,7 +61,7 @@ private void Control_Loaded(object sender, System.Windows.RoutedEventArgs e)
Widget.SizeChanged += Widget_SizeChanged;
}
- private void Widget_SizeChanged(object sender, EventArgs e)
+ private void Widget_SizeChanged(object? sender, EventArgs e)
{
Callback.OnResize(Widget, new ResizeEventArgs(RenderSize));
}
diff --git a/src/Eto.Veldrid/Eto.Veldrid.csproj b/src/Eto.Veldrid/Eto.Veldrid.csproj
index 84520c3..e00df32 100644
--- a/src/Eto.Veldrid/Eto.Veldrid.csproj
+++ b/src/Eto.Veldrid/Eto.Veldrid.csproj
@@ -1,33 +1,28 @@
- AnyCPU
+ netstandard2.0;net6.0
Veldrid Control for Eto.Forms
This provides the control to use in your Eto.Forms application.
Add the platform-specific package for each platform you wish to support. E.g. Eto.Veldrid.Gtk, Eto.Veldrid.Mac64, Eto.Veldrid.Wpf, etc.
- net7.0
-
+
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- Eto.Veldrid-LICENSE
+
+ Eto.Veldrid-LICENSE.txt
PreserveNewest
-
-
- Eto.Veldrid-AUTHORS
+
+
+ Eto.Veldrid-AUTHORS.txt
PreserveNewest
-
+
diff --git a/src/Eto.Veldrid/VeldridSurface.cs b/src/Eto.Veldrid/VeldridSurface.cs
index ba37d74..84abbbe 100755
--- a/src/Eto.Veldrid/VeldridSurface.cs
+++ b/src/Eto.Veldrid/VeldridSurface.cs
@@ -16,7 +16,7 @@ public class VeldridSurface : Control
public new interface IHandler : Control.IHandler
{
Size RenderSize { get; }
- Swapchain CreateSwapchain();
+ Swapchain? CreateSwapchain();
}
new IHandler Handler => (IHandler)base.Handler;
@@ -72,9 +72,9 @@ public interface IOpenGL
public int RenderHeight => RenderSize.Height;
public GraphicsBackend Backend { get; private set; }
- public GraphicsDevice GraphicsDevice { get; private set; }
+ public GraphicsDevice? GraphicsDevice { get; private set; }
public GraphicsDeviceOptions GraphicsDeviceOptions { get; private set; }
- public Swapchain Swapchain { get; private set; }
+ public Swapchain? Swapchain { get; private set; }
public const string VeldridInitializedEvent = "VeldridSurface.VeldridInitialized";
public const string DrawEvent = "VeldridSurface.Draw";
diff --git a/src/Eto.VeldridSurface/Eto.VeldridSurface.csproj b/src/Eto.VeldridSurface/Eto.VeldridSurface.csproj
deleted file mode 100644
index c34cb80..0000000
--- a/src/Eto.VeldridSurface/Eto.VeldridSurface.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- net7.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Eto.VeldridSurface/VeldridDriver.cs b/src/Eto.VeldridSurface/VeldridDriver.cs
deleted file mode 100644
index f94b20a..0000000
--- a/src/Eto.VeldridSurface/VeldridDriver.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-using Eto.Veldrid;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Veldrid;
-using Veldrid.SPIRV;
-using VeldridEto;
-
-namespace TestEtoVeldrid2
-{
- public struct VertexPositionColor
- {
- public static uint SizeInBytes = (uint)Marshal.SizeOf(typeof(VertexPositionColor));
-
- public Vector3 Position;
- public RgbaFloat Color;
-
- public VertexPositionColor(Vector3 position, RgbaFloat color)
- {
- Position = position;
- Color = color;
- }
- }
-
- ///
- /// A class that controls rendering to a VeldridSurface.
- ///
- ///
- /// VeldridSurface is only a basic control that lets you render to the screen
- /// using Veldrid. How exactly to do that is up to you; this driver class is
- /// only one possible approach, and in all likelihood not the most efficient.
- ///
- public partial class VeldridDriver
- {
-
- public VeldridDriver(ref OVPSettings settings, ref VeldridSurface surface)
- {
- ovpSettings = settings;
- Surface = surface;
- addKeyHandlers();
- Clock.Interval = 1.0f / 60.0f;
- Clock.Elapsed += Clock_Elapsed;
- }
-
- public void SetUpVeldrid()
- {
- CreateResources();
-
- Ready = true;
- }
-
- private void CreateResources()
- {
- // Veldrid.SPIRV is an additional library that complements Veldrid
- // by simplifying the development of cross-backend shaders, and is
- // currently the recommended approach to doing so:
- //
- // https://veldrid.dev/articles/portable-shaders.html
- //
- // If you decide against using it, you can try out Veldrid developer
- // mellinoe's other project, ShaderGen, or drive yourself crazy by
- // writing and maintaining custom shader code for each platform.
- byte[] vertexShaderSpirvBytes = LoadSpirvBytes(ShaderStages.Vertex);
- byte[] fragmentShaderSpirvBytes = LoadSpirvBytes(ShaderStages.Fragment);
-
- var options = new CrossCompileOptions();
- switch (Surface.GraphicsDevice.BackendType)
- {
- // InvertVertexOutputY and FixClipSpaceZ address two major
- // differences between Veldrid's various graphics APIs, as
- // discussed here:
- //
- // https://veldrid.dev/articles/backend-differences.html
- //
- // Note that the only reason those options are useful in this
- // example project is that the vertices being drawn are stored
- // the way Vulkan stores vertex data. The options will therefore
- // properly convert from the Vulkan style to whatever's used by
- // the destination backend. If you store vertices in a different
- // coordinate system, these may not do anything for you, and
- // you'll need to handle the difference in your shader code.
- case GraphicsBackend.Metal:
- options.InvertVertexOutputY = true;
- break;
- case GraphicsBackend.Direct3D11:
- options.InvertVertexOutputY = true;
- break;
- case GraphicsBackend.OpenGL:
- options.FixClipSpaceZ = true;
- options.InvertVertexOutputY = true;
- break;
- default:
- break;
- }
-
- ResourceFactory factory = Surface.GraphicsDevice.ResourceFactory;
-
- ResourceLayout viewMatrixLayout = factory.CreateResourceLayout(
- new ResourceLayoutDescription(
- new ResourceLayoutElementDescription(
- "ViewMatrix",
- ResourceKind.UniformBuffer,
- ShaderStages.Vertex)));
-
- ViewBuffer = factory.CreateBuffer(
- new BufferDescription(64, BufferUsage.UniformBuffer));
-
- ViewMatrixSet = factory.CreateResourceSet(new ResourceSetDescription(
- viewMatrixLayout, ViewBuffer));
-
- var vertex = new ShaderDescription(ShaderStages.Vertex, vertexShaderSpirvBytes, "main", true);
- var fragment = new ShaderDescription(ShaderStages.Fragment, fragmentShaderSpirvBytes, "main", true);
- Shader[] shaders = factory.CreateFromSpirv(vertex, fragment, options);
-
- ResourceLayout modelMatrixLayout = factory.CreateResourceLayout(
- new ResourceLayoutDescription(
- new ResourceLayoutElementDescription(
- "ModelMatrix",
- ResourceKind.UniformBuffer,
- ShaderStages.Vertex)));
-
- ModelBuffer = factory.CreateBuffer(
- new BufferDescription(64, BufferUsage.UniformBuffer));
-
- ModelMatrixSet = factory.CreateResourceSet(new ResourceSetDescription(
- modelMatrixLayout, ModelBuffer));
-
- VertexBuffer =
- factory.CreateBuffer(new BufferDescription(4 * VertexPositionColor.SizeInBytes,
- BufferUsage.VertexBuffer));
- IndexBuffer = factory.CreateBuffer(new BufferDescription(4 * sizeof(ushort), BufferUsage.IndexBuffer));
-
- // Veldrid.SPIRV, when cross-compiling to HLSL, will always produce
- // TEXCOORD semantics; VertexElementSemantic.TextureCoordinate thus
- // becomes necessary to let D3D11 work alongside Vulkan and OpenGL.
- //
- // https://github.com/mellinoe/veldrid/issues/121
- //
- var vertexLayout = new VertexLayoutDescription(
- new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate,
- VertexElementFormat.Float3),
- new VertexElementDescription("Color", VertexElementSemantic.TextureCoordinate,
- VertexElementFormat.Float4));
-
- create_pipelines(ref factory, ref viewMatrixLayout, ref modelMatrixLayout, ref shaders, ref vertexLayout);
-
- CommandList = factory.CreateCommandList();
- }
-
- private void create_pipelines(ref ResourceFactory factory, ref ResourceLayout viewMatrixLayout,
- ref ResourceLayout modelMatrixLayout, ref Shader[] shaders, ref VertexLayoutDescription vertexLayout)
- {
- LinePipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
- {
- BlendState = BlendStateDescription.SingleOverrideBlend,
- DepthStencilState = new DepthStencilStateDescription(
- depthTestEnabled: true,
- depthWriteEnabled: true,
- comparisonKind: ComparisonKind.LessEqual),
- RasterizerState = new RasterizerStateDescription(
- cullMode: FaceCullMode.Back,
- fillMode: PolygonFillMode.Solid,
- frontFace: FrontFace.Clockwise,
- depthClipEnabled: true,
- scissorTestEnabled: false),
- PrimitiveTopology = PrimitiveTopology.LineList,
- ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
- ShaderSet = new ShaderSetDescription(
- vertexLayouts: new[] { vertexLayout },
- shaders: shaders),
- Outputs = Surface.Swapchain.Framebuffer.OutputDescription
- });
-
- LinesPipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
- {
- BlendState = BlendStateDescription.SingleAlphaBlend,
- DepthStencilState = new DepthStencilStateDescription(
- depthTestEnabled: false,
- depthWriteEnabled: false,
- comparisonKind: ComparisonKind.LessEqual),
- RasterizerState = new RasterizerStateDescription(
- cullMode: FaceCullMode.Back,
- fillMode: PolygonFillMode.Solid,
- frontFace: FrontFace.Clockwise,
- depthClipEnabled: false,
- scissorTestEnabled: false),
- PrimitiveTopology = PrimitiveTopology.LineStrip,
- ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
- ShaderSet = new ShaderSetDescription(
- vertexLayouts: new[] { vertexLayout },
- shaders: shaders),
- Outputs = Surface.Swapchain.Framebuffer.OutputDescription
- });
-
- FilledPipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
- {
- BlendState = BlendStateDescription.SingleAlphaBlend,
- DepthStencilState = new DepthStencilStateDescription(
- depthTestEnabled: false,
- depthWriteEnabled: false,
- comparisonKind: ComparisonKind.LessEqual),
- RasterizerState = new RasterizerStateDescription(
- cullMode: FaceCullMode.None,
- fillMode: PolygonFillMode.Solid,
- frontFace: FrontFace.CounterClockwise,
- depthClipEnabled: false,
- scissorTestEnabled: false),
- PrimitiveTopology = PrimitiveTopology.TriangleStrip,
- ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
- ShaderSet = new ShaderSetDescription(
- vertexLayouts: new[] { vertexLayout },
- shaders: shaders),
- Outputs = Surface.Swapchain.Framebuffer.OutputDescription
- });
- }
-
- private byte[] LoadSpirvBytes(ShaderStages stage)
- {
- string name = $"VertexColor-{stage.ToString().ToLowerInvariant()}.450.glsl";
- string full = $"Eto.VeldridSurface.shaders.{name}";
-
- // Precompiled SPIR-V bytecode can speed up program start by saving
- // the need to load text files and compile them before converting
- // the result to the final backend shader format. If they're not
- // available, though, the plain .glsl files will do just fine. Look
- // up glslangValidator to learn how to compile SPIR-V binary files.
-
- using (var stream = GetType().Assembly.GetManifestResourceStream(full))
- using (var reader = new BinaryReader(stream))
- {
- return reader.ReadBytes((int)stream.Length);
- }
- }
- }
-}
diff --git a/test/TestEtoVeldrid.Gtk/TestEtoVeldrid.Gtk.csproj b/test/TestEtoVeldrid.Gtk/TestEtoVeldrid.Gtk.csproj
index d29df91..eb91039 100644
--- a/test/TestEtoVeldrid.Gtk/TestEtoVeldrid.Gtk.csproj
+++ b/test/TestEtoVeldrid.Gtk/TestEtoVeldrid.Gtk.csproj
@@ -2,18 +2,11 @@
WinExe
- linux-x64
- net7.0
-
-
-
- Project
- false
+ net8.0
-
diff --git a/test/TestEtoVeldrid.Mac/Info.plist b/test/TestEtoVeldrid.Mac/Info.plist
index 7a937cb..784a35f 100644
--- a/test/TestEtoVeldrid.Mac/Info.plist
+++ b/test/TestEtoVeldrid.Mac/Info.plist
@@ -9,7 +9,7 @@
CFBundleShortVersionString
1.0
LSMinimumSystemVersion
- 10.7
+ 10.15
CFBundleDevelopmentRegion
en
NSHumanReadableCopyright
diff --git a/test/TestEtoVeldrid.Mac/TestEtoVeldrid.Mac64.csproj b/test/TestEtoVeldrid.Mac/TestEtoVeldrid.Mac64.csproj
index 348443b..ae24336 100644
--- a/test/TestEtoVeldrid.Mac/TestEtoVeldrid.Mac64.csproj
+++ b/test/TestEtoVeldrid.Mac/TestEtoVeldrid.Mac64.csproj
@@ -1,15 +1,18 @@
- WinExe
+ Exe
+ osx-x64;osx-arm64
+ net8.0
MONOMAC
- osx-x64
- net7.0
+
+
+
+
-
diff --git a/test/TestEtoVeldrid.Mac/TestEtoVeldrid.macOS.csproj b/test/TestEtoVeldrid.Mac/TestEtoVeldrid.macOS.csproj
new file mode 100644
index 0000000..c915c8c
--- /dev/null
+++ b/test/TestEtoVeldrid.Mac/TestEtoVeldrid.macOS.csproj
@@ -0,0 +1,24 @@
+
+
+
+ Exe
+ osx-x64;osx-arm64
+ net8.0-macos
+ 10.15
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/TestEtoVeldrid.WinForms/Program.cs b/test/TestEtoVeldrid.WinForms/Program.cs
old mode 100644
new mode 100755
index 7464426..15d2734
--- a/test/TestEtoVeldrid.WinForms/Program.cs
+++ b/test/TestEtoVeldrid.WinForms/Program.cs
@@ -10,7 +10,7 @@ public static void Main(string[] args)
{
var platform = new Eto.WinForms.Platform();
- new Application(platform).Run(new MainForm());
+ new Eto.Forms.Application(platform).Run(new MainForm());
}
}
}
diff --git a/test/TestEtoVeldrid.WinForms/TestEtoVeldrid.WinForms.csproj b/test/TestEtoVeldrid.WinForms/TestEtoVeldrid.WinForms.csproj
old mode 100644
new mode 100755
index 1886146..ae0365f
--- a/test/TestEtoVeldrid.WinForms/TestEtoVeldrid.WinForms.csproj
+++ b/test/TestEtoVeldrid.WinForms/TestEtoVeldrid.WinForms.csproj
@@ -1,16 +1,8 @@
-
-
-
- true
- net7.0
-
-
-
-
+
WinExe
- $(TargetFrameworks);net5.0-windows
+ net48;net8.0-windows
true
win-x64
@@ -24,7 +16,4 @@
-
-
-
diff --git a/test/TestEtoVeldrid.Wpf/TestEtoVeldrid.Wpf.csproj b/test/TestEtoVeldrid.Wpf/TestEtoVeldrid.Wpf.csproj
old mode 100644
new mode 100755
index f72b470..277463a
--- a/test/TestEtoVeldrid.Wpf/TestEtoVeldrid.Wpf.csproj
+++ b/test/TestEtoVeldrid.Wpf/TestEtoVeldrid.Wpf.csproj
@@ -1,19 +1,11 @@
-
-
-
- true
- net7.0
-
-
-
-
+
WinExe
- $(TargetFrameworks);net5.0-windows
+ net48;net8.0-windows
app1.manifest
- true
win-x64
+ true
NU1701
@@ -24,17 +16,13 @@
-
+
-
-
-
-
diff --git a/test/TestEtoVeldrid/MainForm.cs b/test/TestEtoVeldrid/MainForm.cs
old mode 100644
new mode 100755
index f51afc3..baa95e5
--- a/test/TestEtoVeldrid/MainForm.cs
+++ b/test/TestEtoVeldrid/MainForm.cs
@@ -1,11 +1,7 @@
using Eto.Drawing;
using Eto.Forms;
using Eto.Veldrid;
-using System;
-using System.Threading;
-using TestEtoVeldrid2;
using Veldrid;
-using VeldridEto;
using PixelFormat = Veldrid.PixelFormat;
namespace TestEtoVeldrid
diff --git a/src/Eto.VeldridSurface/OVPSettings.cs b/test/TestEtoVeldrid/OVPSettings.cs
old mode 100644
new mode 100755
similarity index 98%
rename from src/Eto.VeldridSurface/OVPSettings.cs
rename to test/TestEtoVeldrid/OVPSettings.cs
index 60c36f9..970e88f
--- a/src/Eto.VeldridSurface/OVPSettings.cs
+++ b/test/TestEtoVeldrid/OVPSettings.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace VeldridEto;
+namespace TestEtoVeldrid;
public static class errorReporter
{
@@ -56,10 +56,7 @@ public class OVPSettings
private float base_zoom;
private float zoomFactor;
private int zoomStep;
- private bool allowZoomAndPan;
private bool dynamicGrid;
- private bool panning;
- private bool selecting;
private bool showGrid;
private bool showAxes;
private bool showDrawn;
@@ -443,12 +440,9 @@ private void init(float defX, float defY)
backColor = new Color(1.0f, 1.0f, 1.0f);
selectionColor = SystemColors.Highlight;
inverSelectionColor = SystemColors.Highlight;
- allowZoomAndPan = true;
enableFilledPolys = false;
showPoints = true;
dynamicGrid = true;
- panning = false;
- selecting = false;
showGrid = true;
showAxes = true;
grid_spacing = 10;
diff --git a/test/TestEtoVeldrid/TestEtoVeldrid.csproj b/test/TestEtoVeldrid/TestEtoVeldrid.csproj
old mode 100644
new mode 100755
index 2c73e0c..dedac6e
--- a/test/TestEtoVeldrid/TestEtoVeldrid.csproj
+++ b/test/TestEtoVeldrid/TestEtoVeldrid.csproj
@@ -1,28 +1,21 @@
- AnyCPU
+ netstandard2.0
TestEtoVeldrid
TestEtoVeldrid
- net7.0
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
diff --git a/test/TestEtoVeldrid/VeldridDriver.cs b/test/TestEtoVeldrid/VeldridDriver.cs
new file mode 100755
index 0000000..cae5c25
--- /dev/null
+++ b/test/TestEtoVeldrid/VeldridDriver.cs
@@ -0,0 +1,232 @@
+using Eto.Veldrid;
+using System.Numerics;
+using System.Runtime.InteropServices;
+using Veldrid;
+using Veldrid.SPIRV;
+
+namespace TestEtoVeldrid;
+
+public struct VertexPositionColor
+{
+ public static uint SizeInBytes = (uint)Marshal.SizeOf(typeof(VertexPositionColor));
+
+ public Vector3 Position;
+ public RgbaFloat Color;
+
+ public VertexPositionColor(Vector3 position, RgbaFloat color)
+ {
+ Position = position;
+ Color = color;
+ }
+}
+
+///
+/// A class that controls rendering to a VeldridSurface.
+///
+///
+/// VeldridSurface is only a basic control that lets you render to the screen
+/// using Veldrid. How exactly to do that is up to you; this driver class is
+/// only one possible approach, and in all likelihood not the most efficient.
+///
+public partial class VeldridDriver
+{
+
+ public VeldridDriver(ref OVPSettings settings, ref VeldridSurface surface)
+ {
+ ovpSettings = settings;
+ Surface = surface;
+ addKeyHandlers();
+ Clock.Interval = 1.0f / 60.0f;
+ Clock.Elapsed += Clock_Elapsed;
+ }
+
+ public void SetUpVeldrid()
+ {
+ CreateResources();
+
+ Ready = true;
+ }
+
+ private void CreateResources()
+ {
+ // Veldrid.SPIRV is an additional library that complements Veldrid
+ // by simplifying the development of cross-backend shaders, and is
+ // currently the recommended approach to doing so:
+ //
+ // https://veldrid.dev/articles/portable-shaders.html
+ //
+ // If you decide against using it, you can try out Veldrid developer
+ // mellinoe's other project, ShaderGen, or drive yourself crazy by
+ // writing and maintaining custom shader code for each platform.
+ byte[] vertexShaderSpirvBytes = LoadSpirvBytes(ShaderStages.Vertex);
+ byte[] fragmentShaderSpirvBytes = LoadSpirvBytes(ShaderStages.Fragment);
+
+ var options = new CrossCompileOptions();
+ switch (Surface.GraphicsDevice.BackendType)
+ {
+ // InvertVertexOutputY and FixClipSpaceZ address two major
+ // differences between Veldrid's various graphics APIs, as
+ // discussed here:
+ //
+ // https://veldrid.dev/articles/backend-differences.html
+ //
+ // Note that the only reason those options are useful in this
+ // example project is that the vertices being drawn are stored
+ // the way Vulkan stores vertex data. The options will therefore
+ // properly convert from the Vulkan style to whatever's used by
+ // the destination backend. If you store vertices in a different
+ // coordinate system, these may not do anything for you, and
+ // you'll need to handle the difference in your shader code.
+ case GraphicsBackend.Metal:
+ options.InvertVertexOutputY = true;
+ break;
+ case GraphicsBackend.Direct3D11:
+ options.InvertVertexOutputY = true;
+ break;
+ case GraphicsBackend.OpenGL:
+ options.FixClipSpaceZ = true;
+ options.InvertVertexOutputY = true;
+ break;
+ default:
+ break;
+ }
+
+ ResourceFactory factory = Surface.GraphicsDevice.ResourceFactory;
+
+ ResourceLayout viewMatrixLayout = factory.CreateResourceLayout(
+ new ResourceLayoutDescription(
+ new ResourceLayoutElementDescription(
+ "ViewMatrix",
+ ResourceKind.UniformBuffer,
+ ShaderStages.Vertex)));
+
+ ViewBuffer = factory.CreateBuffer(
+ new BufferDescription(64, BufferUsage.UniformBuffer));
+
+ ViewMatrixSet = factory.CreateResourceSet(new ResourceSetDescription(
+ viewMatrixLayout, ViewBuffer));
+
+ var vertex = new ShaderDescription(ShaderStages.Vertex, vertexShaderSpirvBytes, "main", true);
+ var fragment = new ShaderDescription(ShaderStages.Fragment, fragmentShaderSpirvBytes, "main", true);
+ Shader[] shaders = factory.CreateFromSpirv(vertex, fragment, options);
+
+ ResourceLayout modelMatrixLayout = factory.CreateResourceLayout(
+ new ResourceLayoutDescription(
+ new ResourceLayoutElementDescription(
+ "ModelMatrix",
+ ResourceKind.UniformBuffer,
+ ShaderStages.Vertex)));
+
+ ModelBuffer = factory.CreateBuffer(
+ new BufferDescription(64, BufferUsage.UniformBuffer));
+
+ ModelMatrixSet = factory.CreateResourceSet(new ResourceSetDescription(
+ modelMatrixLayout, ModelBuffer));
+
+ VertexBuffer =
+ factory.CreateBuffer(new BufferDescription(4 * VertexPositionColor.SizeInBytes,
+ BufferUsage.VertexBuffer));
+ IndexBuffer = factory.CreateBuffer(new BufferDescription(4 * sizeof(ushort), BufferUsage.IndexBuffer));
+
+ // Veldrid.SPIRV, when cross-compiling to HLSL, will always produce
+ // TEXCOORD semantics; VertexElementSemantic.TextureCoordinate thus
+ // becomes necessary to let D3D11 work alongside Vulkan and OpenGL.
+ //
+ // https://github.com/mellinoe/veldrid/issues/121
+ //
+ var vertexLayout = new VertexLayoutDescription(
+ new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate,
+ VertexElementFormat.Float3),
+ new VertexElementDescription("Color", VertexElementSemantic.TextureCoordinate,
+ VertexElementFormat.Float4));
+
+ create_pipelines(ref factory, ref viewMatrixLayout, ref modelMatrixLayout, ref shaders, ref vertexLayout);
+
+ CommandList = factory.CreateCommandList();
+ }
+
+ private void create_pipelines(ref ResourceFactory factory, ref ResourceLayout viewMatrixLayout,
+ ref ResourceLayout modelMatrixLayout, ref Shader[] shaders, ref VertexLayoutDescription vertexLayout)
+ {
+ LinePipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
+ {
+ BlendState = BlendStateDescription.SingleOverrideBlend,
+ DepthStencilState = new DepthStencilStateDescription(
+ depthTestEnabled: true,
+ depthWriteEnabled: true,
+ comparisonKind: ComparisonKind.LessEqual),
+ RasterizerState = new RasterizerStateDescription(
+ cullMode: FaceCullMode.Back,
+ fillMode: PolygonFillMode.Solid,
+ frontFace: FrontFace.Clockwise,
+ depthClipEnabled: true,
+ scissorTestEnabled: false),
+ PrimitiveTopology = PrimitiveTopology.LineList,
+ ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
+ ShaderSet = new ShaderSetDescription(
+ vertexLayouts: new[] { vertexLayout },
+ shaders: shaders),
+ Outputs = Surface.Swapchain.Framebuffer.OutputDescription
+ });
+
+ LinesPipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
+ {
+ BlendState = BlendStateDescription.SingleAlphaBlend,
+ DepthStencilState = new DepthStencilStateDescription(
+ depthTestEnabled: false,
+ depthWriteEnabled: false,
+ comparisonKind: ComparisonKind.LessEqual),
+ RasterizerState = new RasterizerStateDescription(
+ cullMode: FaceCullMode.Back,
+ fillMode: PolygonFillMode.Solid,
+ frontFace: FrontFace.Clockwise,
+ depthClipEnabled: false,
+ scissorTestEnabled: false),
+ PrimitiveTopology = PrimitiveTopology.LineStrip,
+ ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
+ ShaderSet = new ShaderSetDescription(
+ vertexLayouts: new[] { vertexLayout },
+ shaders: shaders),
+ Outputs = Surface.Swapchain.Framebuffer.OutputDescription
+ });
+
+ FilledPipeline = factory.CreateGraphicsPipeline(new GraphicsPipelineDescription
+ {
+ BlendState = BlendStateDescription.SingleAlphaBlend,
+ DepthStencilState = new DepthStencilStateDescription(
+ depthTestEnabled: false,
+ depthWriteEnabled: false,
+ comparisonKind: ComparisonKind.LessEqual),
+ RasterizerState = new RasterizerStateDescription(
+ cullMode: FaceCullMode.None,
+ fillMode: PolygonFillMode.Solid,
+ frontFace: FrontFace.CounterClockwise,
+ depthClipEnabled: false,
+ scissorTestEnabled: false),
+ PrimitiveTopology = PrimitiveTopology.TriangleStrip,
+ ResourceLayouts = new[] { viewMatrixLayout, modelMatrixLayout },
+ ShaderSet = new ShaderSetDescription(
+ vertexLayouts: new[] { vertexLayout },
+ shaders: shaders),
+ Outputs = Surface.Swapchain.Framebuffer.OutputDescription
+ });
+ }
+
+ private byte[] LoadSpirvBytes(ShaderStages stage)
+ {
+ string name = $"VertexColor-{stage.ToString().ToLowerInvariant()}.450.glsl";
+ string full = $"TestEtoVeldrid.shaders.{name}";
+
+ // Precompiled SPIR-V bytecode can speed up program start by saving
+ // the need to load text files and compile them before converting
+ // the result to the final backend shader format. If they're not
+ // available, though, the plain .glsl files will do just fine. Look
+ // up glslangValidator to learn how to compile SPIR-V binary files.
+
+ using (var stream = GetType().Assembly.GetManifestResourceStream(full))
+ using (var reader = new BinaryReader(stream))
+ {
+ return reader.ReadBytes((int)stream.Length);
+ }
+ }
+}
diff --git a/src/Eto.VeldridSurface/VeldridDriver_Conversions.cs b/test/TestEtoVeldrid/VeldridDriver_Conversions.cs
old mode 100644
new mode 100755
similarity index 97%
rename from src/Eto.VeldridSurface/VeldridDriver_Conversions.cs
rename to test/TestEtoVeldrid/VeldridDriver_Conversions.cs
index f2b77de..5f35efc
--- a/src/Eto.VeldridSurface/VeldridDriver_Conversions.cs
+++ b/test/TestEtoVeldrid/VeldridDriver_Conversions.cs
@@ -1,6 +1,6 @@
using Eto.Drawing;
-namespace TestEtoVeldrid2;
+namespace TestEtoVeldrid;
public partial class VeldridDriver
{
diff --git a/src/Eto.VeldridSurface/VeldridDriver_Draw.cs b/test/TestEtoVeldrid/VeldridDriver_Draw.cs
old mode 100644
new mode 100755
similarity index 99%
rename from src/Eto.VeldridSurface/VeldridDriver_Draw.cs
rename to test/TestEtoVeldrid/VeldridDriver_Draw.cs
index 731be1b..b1a6266
--- a/src/Eto.VeldridSurface/VeldridDriver_Draw.cs
+++ b/test/TestEtoVeldrid/VeldridDriver_Draw.cs
@@ -2,7 +2,7 @@
using System.Numerics;
using Veldrid;
-namespace TestEtoVeldrid2;
+namespace TestEtoVeldrid;
public partial class VeldridDriver
{
diff --git a/src/Eto.VeldridSurface/VeldridDriver_Handlers.cs b/test/TestEtoVeldrid/VeldridDriver_Handlers.cs
old mode 100644
new mode 100755
similarity index 99%
rename from src/Eto.VeldridSurface/VeldridDriver_Handlers.cs
rename to test/TestEtoVeldrid/VeldridDriver_Handlers.cs
index 5871de8..a066015
--- a/src/Eto.VeldridSurface/VeldridDriver_Handlers.cs
+++ b/test/TestEtoVeldrid/VeldridDriver_Handlers.cs
@@ -2,7 +2,7 @@
using Eto.Drawing;
using Eto.Forms;
-namespace TestEtoVeldrid2;
+namespace TestEtoVeldrid;
public partial class VeldridDriver
{
@@ -219,7 +219,6 @@ private void addKeyHandlers()
Surface.MouseEnter += setFocus;
Surface.MouseLeave += removeFocus;
Surface.KeyDown += keyHandler;
- keyHandlerApplied = true;
// Surface.MouseLeave += removeKeyHandler;
}
catch (Exception ex)
diff --git a/src/Eto.VeldridSurface/VeldridDriver_Public.cs b/test/TestEtoVeldrid/VeldridDriver_Public.cs
old mode 100644
new mode 100755
similarity index 98%
rename from src/Eto.VeldridSurface/VeldridDriver_Public.cs
rename to test/TestEtoVeldrid/VeldridDriver_Public.cs
index 8fb64a7..d15cc26
--- a/src/Eto.VeldridSurface/VeldridDriver_Public.cs
+++ b/test/TestEtoVeldrid/VeldridDriver_Public.cs
@@ -1,8 +1,7 @@
using Eto.Drawing;
using Eto.Forms;
-using VeldridEto;
-namespace TestEtoVeldrid2;
+namespace TestEtoVeldrid;
public partial class VeldridDriver
{
diff --git a/src/Eto.VeldridSurface/VeldridDriver_Variables.cs b/test/TestEtoVeldrid/VeldridDriver_Variables.cs
old mode 100644
new mode 100755
similarity index 89%
rename from src/Eto.VeldridSurface/VeldridDriver_Variables.cs
rename to test/TestEtoVeldrid/VeldridDriver_Variables.cs
index af9592f..fe68e7c
--- a/src/Eto.VeldridSurface/VeldridDriver_Variables.cs
+++ b/test/TestEtoVeldrid/VeldridDriver_Variables.cs
@@ -4,7 +4,7 @@
using System.Numerics;
using Veldrid;
-namespace TestEtoVeldrid2;
+namespace TestEtoVeldrid;
public partial class VeldridDriver
{
@@ -35,8 +35,8 @@ private set
private uint[] gridIndices;
private uint[] axesIndices;
- private float axisZ;
- private float gridZ;
+ private float axisZ = 0;
+ private float gridZ = 0;
private DeviceBuffer GridVertexBuffer;
private DeviceBuffer GridIndexBuffer;
@@ -54,7 +54,6 @@ private set
private DeviceBuffer PolysVertexBuffer;
private DeviceBuffer TessVertexBuffer;
- private Pipeline PointsPipeline;
private Pipeline LinePipeline;
private Pipeline LinesPipeline;
private Pipeline FilledPipeline;
@@ -75,15 +74,12 @@ private set
private const float pointWidth = 0.50f;
private bool hasFocus;
- private bool keyHandlerApplied;
// Use for drag handling.
private bool dragging { get; set; }
private float x_orig;
private float y_orig;
- private DateTime CurrentTime;
- private DateTime PreviousTime = DateTime.Now;
private ContextMenu menu;
}
diff --git a/src/Eto.VeldridSurface/ovp_Poly.cs b/test/TestEtoVeldrid/ovp_Poly.cs
old mode 100644
new mode 100755
similarity index 93%
rename from src/Eto.VeldridSurface/ovp_Poly.cs
rename to test/TestEtoVeldrid/ovp_Poly.cs
index 589e55f..2d9943b
--- a/src/Eto.VeldridSurface/ovp_Poly.cs
+++ b/test/TestEtoVeldrid/ovp_Poly.cs
@@ -1,6 +1,6 @@
using Eto.Drawing;
-namespace VeldridEto;
+namespace TestEtoVeldrid;
public class ovp_Poly
{
@@ -21,4 +21,4 @@ public ovp_Poly(PointF[] geometry, Color geoColor, float alpha_)
color = geoColor;
alpha = alpha_;
}
-}
\ No newline at end of file
+}
diff --git a/src/Eto.VeldridSurface/shaders/VertexColor-fragment.450.glsl b/test/TestEtoVeldrid/shaders/VertexColor-fragment.450.glsl
old mode 100644
new mode 100755
similarity index 100%
rename from src/Eto.VeldridSurface/shaders/VertexColor-fragment.450.glsl
rename to test/TestEtoVeldrid/shaders/VertexColor-fragment.450.glsl
diff --git a/src/Eto.VeldridSurface/shaders/VertexColor-vertex.450.glsl b/test/TestEtoVeldrid/shaders/VertexColor-vertex.450.glsl
old mode 100644
new mode 100755
similarity index 100%
rename from src/Eto.VeldridSurface/shaders/VertexColor-vertex.450.glsl
rename to test/TestEtoVeldrid/shaders/VertexColor-vertex.450.glsl