From dcf97657ca83d4cda544ebc7d943d6645d750450 Mon Sep 17 00:00:00 2001 From: DMP9 Date: Thu, 8 Aug 2019 00:30:47 +0100 Subject: [PATCH 1/2] Start working on android/EGL windowing --- Silk.NET.sln | 202 +++++------ .../ANativeWindow.cs | 24 ++ .../Silk.NET.Windowing.Android/ARect.cs | 11 + .../Silk.NET.Windowing.Android/Android.cs | 117 +++++++ .../AndroidPlatform.cs | 22 ++ .../AndroidWindow.cs | 319 ++++++++++++++++++ .../Silk.NET.Windowing.Android.csproj | 16 + .../Interfaces/IWindow.cs | 2 +- .../Interfaces/IWindowFunctions.cs | 10 - .../Silk.NET.Windowing.Desktop/GlfwWindow.cs | 4 + .../Silk.NET.Windowing.csproj | 11 +- src/Windowing/Silk.NET.Windowing/Window.cs | 34 +- 12 files changed, 652 insertions(+), 120 deletions(-) create mode 100644 src/Windowing/Silk.NET.Windowing.Android/ANativeWindow.cs create mode 100644 src/Windowing/Silk.NET.Windowing.Android/ARect.cs create mode 100644 src/Windowing/Silk.NET.Windowing.Android/Android.cs create mode 100644 src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs create mode 100644 src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs create mode 100644 src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj diff --git a/Silk.NET.sln b/Silk.NET.sln index 9d91b00262..0a97137012 100644 --- a/Silk.NET.sln +++ b/Silk.NET.sln @@ -1,177 +1,179 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.352 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildTools", "src\Core\BuildTools\BuildTools.csproj", "{FD24E9FF-1097-4777-A418-F2D88C558665}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildTools", "src\Core\BuildTools\BuildTools.csproj", "{FD24E9FF-1097-4777-A418-F2D88C558665}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windowing", "Windowing", "{23324041-2076-477C-A4BF-B385B8066C6C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.GLFW", "src\Windowing\Silk.NET.GLFW\Silk.NET.GLFW.csproj", "{BFE429EB-4C2E-4BF3-A302-C9C5A2FDA6D7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.GLFW", "src\Windowing\Silk.NET.GLFW\Silk.NET.GLFW.csproj", "{BFE429EB-4C2E-4BF3-A302-C9C5A2FDA6D7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Core", "src\Core\Silk.NET.Core\Silk.NET.Core.csproj", "{136C6154-D300-4B82-80D3-17B637841A2B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Core", "src\Core\Silk.NET.Core\Silk.NET.Core.csproj", "{136C6154-D300-4B82-80D3-17B637841A2B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing.Common", "src\Windowing\Silk.NET.Windowing.Common\Silk.NET.Windowing.Common.csproj", "{A8DFEA18-E880-4303-BBCE-0F27EE214D44}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Windowing.Common", "src\Windowing\Silk.NET.Windowing.Common\Silk.NET.Windowing.Common.csproj", "{A8DFEA18-E880-4303-BBCE-0F27EE214D44}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing.Desktop", "src\Windowing\Silk.NET.Windowing.Desktop\Silk.NET.Windowing.Desktop.csproj", "{0A18FCAE-572E-47FF-B8E3-C97ED15132FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Windowing.Desktop", "src\Windowing\Silk.NET.Windowing.Desktop\Silk.NET.Windowing.Desktop.csproj", "{0A18FCAE-572E-47FF-B8E3-C97ED15132FA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlankWindow", "examples\BlankWindow\BlankWindow.csproj", "{E8C4587E-9424-438B-AEAF-A09E0234865A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlankWindow", "examples\BlankWindow\BlankWindow.csproj", "{E8C4587E-9424-438B-AEAF-A09E0234865A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing", "src\Windowing\Silk.NET.Windowing\Silk.NET.Windowing.csproj", "{956F722C-DFD3-435E-9D2E-A0549C4D8BC0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Windowing", "src\Windowing\Silk.NET.Windowing\Silk.NET.Windowing.csproj", "{956F722C-DFD3-435E-9D2E-A0549C4D8BC0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{E1F91563-7277-4E9B-A3B7-8D5FD9802A4A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenAL", "OpenAL", "{081E7761-B200-4DBF-8950-941464DECACE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL", "src\OpenAL\Silk.NET.OpenAL\Silk.NET.OpenAL.csproj", "{5A41E9D5-67F5-447C-8AE2-78FED7A45206}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL", "src\OpenAL\Silk.NET.OpenAL\Silk.NET.OpenAL.csproj", "{5A41E9D5-67F5-447C-8AE2-78FED7A45206}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{896B1A79-FEC8-4B7A-8A9C-0CC8EDA2CCFC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL.Extensions.Creative", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Creative\Silk.NET.OpenAL.Extensions.Creative.csproj", "{FC015604-3326-4BCC-9212-C5CB0DFB0D12}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions.Creative", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Creative\Silk.NET.OpenAL.Extensions.Creative.csproj", "{FC015604-3326-4BCC-9212-C5CB0DFB0D12}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL.Extensions.Enumeration", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Enumeration\Silk.NET.OpenAL.Extensions.Enumeration.csproj", "{66F172D3-4AE5-4C6E-A035-0E0AE962F555}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions.Enumeration", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Enumeration\Silk.NET.OpenAL.Extensions.Enumeration.csproj", "{66F172D3-4AE5-4C6E-A035-0E0AE962F555}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL.Extensions.EXT", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.EXT\Silk.NET.OpenAL.Extensions.EXT.csproj", "{352E06E3-9D5E-4C2B-836D-C5538F8AA48D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions.EXT", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.EXT\Silk.NET.OpenAL.Extensions.EXT.csproj", "{352E06E3-9D5E-4C2B-836D-C5538F8AA48D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL.Extensions.Soft", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Soft\Silk.NET.OpenAL.Extensions.Soft.csproj", "{94D7D3A3-3640-4791-BE19-CA50C59187C6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions.Soft", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Soft\Silk.NET.OpenAL.Extensions.Soft.csproj", "{94D7D3A3-3640-4791-BE19-CA50C59187C6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Properties", "Build Properties", "{21F1A5E2-9861-49A6-934D-DF5AAA03AFFE}" -ProjectSection(SolutionItems) = preProject - build\props\bindings.props = build\props\bindings.props - build\props\common.props = build\props\common.props -EndProjectSection + ProjectSection(SolutionItems) = preProject + build\props\bindings.props = build\props\bindings.props + build\props\common.props = build\props\common.props + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFAC}") = "Silk.NET.Input.Common", "src\Input\Silk.NET.Input.Common\Silk.NET.Input.Common.csproj", "{8FFF49D6-B029-400B-8510-1A088868DFA6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Input.Common", "src\Input\Silk.NET.Input.Common\Silk.NET.Input.Common.csproj", "{8FFF49D6-B029-400B-8510-1A088868DFA6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Input", "Input", "{FA9D1C95-5585-4DEC-B226-1447A486C376}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenGL", "OpenGL", "{0E9C83A8-A413-4921-8F39-59519BFF939B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL", "src\OpenGL\Silk.NET.OpenGL\Silk.NET.OpenGL.csproj", "{A01F43A5-B4ED-47C5-B426-D1AC3C94B5E7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL", "src\OpenGL\Silk.NET.OpenGL\Silk.NET.OpenGL.csproj", "{A01F43A5-B4ED-47C5-B426-D1AC3C94B5E7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy", "src\OpenGL\Silk.NET.OpenGL.Legacy\Silk.NET.OpenGL.Legacy.csproj", "{446DD80A-CAF4-4E19-B87E-A43135E2D59D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy", "src\OpenGL\Silk.NET.OpenGL.Legacy\Silk.NET.OpenGL.Legacy.csproj", "{446DD80A-CAF4-4E19-B87E-A43135E2D59D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES", "src\OpenGL\Silk.NET.OpenGLES\Silk.NET.OpenGLES.csproj", "{24CE7080-FF44-46BF-886F-456F30E54442}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES", "src\OpenGL\Silk.NET.OpenGLES\Silk.NET.OpenGLES.csproj", "{24CE7080-FF44-46BF-886F-456F30E54442}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{CF69D5C3-4ACE-4458-BA5A-0E9A3B294CDC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.AMD\Silk.NET.OpenGL.Extensions.AMD.csproj", "{F49FCBFD-2041-4936-89CF-095C77555CEC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.AMD\Silk.NET.OpenGL.Extensions.AMD.csproj", "{F49FCBFD-2041-4936-89CF-095C77555CEC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.APPLE\Silk.NET.OpenGL.Extensions.APPLE.csproj", "{21BFFC67-4844-440A-8AA4-D4E6AC2DFE83}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.APPLE\Silk.NET.OpenGL.Extensions.APPLE.csproj", "{21BFFC67-4844-440A-8AA4-D4E6AC2DFE83}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.ARB", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.ARB\Silk.NET.OpenGL.Extensions.ARB.csproj", "{4C5A0F3B-2333-4ED8-998B-CB891D786DD1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.ARB", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.ARB\Silk.NET.OpenGL.Extensions.ARB.csproj", "{4C5A0F3B-2333-4ED8-998B-CB891D786DD1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.EXT\Silk.NET.OpenGL.Extensions.EXT.csproj", "{28155265-C538-4D63-A9A4-2A225115BCC3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.EXT\Silk.NET.OpenGL.Extensions.EXT.csproj", "{28155265-C538-4D63-A9A4-2A225115BCC3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.INTEL\Silk.NET.OpenGL.Extensions.INTEL.csproj", "{C1FE5A2C-7EF1-4112-B220-BB7EB60B6E41}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.INTEL\Silk.NET.OpenGL.Extensions.INTEL.csproj", "{C1FE5A2C-7EF1-4112-B220-BB7EB60B6E41}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.KHR\Silk.NET.OpenGL.Extensions.KHR.csproj", "{224CB2E1-3923-4BA6-A202-DA290E55725A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.KHR\Silk.NET.OpenGL.Extensions.KHR.csproj", "{224CB2E1-3923-4BA6-A202-DA290E55725A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.NV\Silk.NET.OpenGL.Extensions.NV.csproj", "{063B37FE-87A0-41BA-A61A-6870D4AEB76F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.NV\Silk.NET.OpenGL.Extensions.NV.csproj", "{063B37FE-87A0-41BA-A61A-6870D4AEB76F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.OVR\Silk.NET.OpenGL.Extensions.OVR.csproj", "{7C56DB2E-0254-4A05-AE81-F09CE9B28C6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Extensions.OVR\Silk.NET.OpenGL.Extensions.OVR.csproj", "{7C56DB2E-0254-4A05-AE81-F09CE9B28C6F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.AMD\Silk.NET.OpenGL.Legacy.Extensions.AMD.csproj", "{67CE45B7-997F-4396-AB90-FC6C7FBA07C3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.AMD\Silk.NET.OpenGL.Legacy.Extensions.AMD.csproj", "{67CE45B7-997F-4396-AB90-FC6C7FBA07C3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.APPLE\Silk.NET.OpenGL.Legacy.Extensions.APPLE.csproj", "{B6DC6862-C2CB-43D7-AE0F-7A3A5EB41A34}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.APPLE\Silk.NET.OpenGL.Legacy.Extensions.APPLE.csproj", "{B6DC6862-C2CB-43D7-AE0F-7A3A5EB41A34}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.ARB", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.ARB\Silk.NET.OpenGL.Legacy.Extensions.ARB.csproj", "{ADFB4E80-301E-416F-B932-86FF242F5BBA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.ARB", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.ARB\Silk.NET.OpenGL.Legacy.Extensions.ARB.csproj", "{ADFB4E80-301E-416F-B932-86FF242F5BBA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.ATI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.ATI\Silk.NET.OpenGL.Legacy.Extensions.ATI.csproj", "{B2C295D9-70AC-4D6E-BEC0-ABDBA8C3FC18}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.ATI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.ATI\Silk.NET.OpenGL.Legacy.Extensions.ATI.csproj", "{B2C295D9-70AC-4D6E-BEC0-ABDBA8C3FC18}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.EXT\Silk.NET.OpenGL.Legacy.Extensions.EXT.csproj", "{C02D75ED-33EE-46D5-9AF1-A54E01206161}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.EXT\Silk.NET.OpenGL.Legacy.Extensions.EXT.csproj", "{C02D75ED-33EE-46D5-9AF1-A54E01206161}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.GL3DFX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.GL3DFX\Silk.NET.OpenGL.Legacy.Extensions.GL3DFX.csproj", "{B81A79D9-6CEF-4FEB-9E40-CAB74F802E9E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.GL3DFX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.GL3DFX\Silk.NET.OpenGL.Legacy.Extensions.GL3DFX.csproj", "{B81A79D9-6CEF-4FEB-9E40-CAB74F802E9E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.GREMEDY", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.GREMEDY\Silk.NET.OpenGL.Legacy.Extensions.GREMEDY.csproj", "{33C55873-FF79-4822-BDC5-CBFBCF78C12A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.GREMEDY", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.GREMEDY\Silk.NET.OpenGL.Legacy.Extensions.GREMEDY.csproj", "{33C55873-FF79-4822-BDC5-CBFBCF78C12A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.HP", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.HP\Silk.NET.OpenGL.Legacy.Extensions.HP.csproj", "{C3931003-EC0A-41D6-A481-8D3CD28556F4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.HP", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.HP\Silk.NET.OpenGL.Legacy.Extensions.HP.csproj", "{C3931003-EC0A-41D6-A481-8D3CD28556F4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.IBM", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.IBM\Silk.NET.OpenGL.Legacy.Extensions.IBM.csproj", "{AFD7A0F4-6C58-4E9D-A40B-1F03C1AFA136}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.IBM", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.IBM\Silk.NET.OpenGL.Legacy.Extensions.IBM.csproj", "{AFD7A0F4-6C58-4E9D-A40B-1F03C1AFA136}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.INGR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.INGR\Silk.NET.OpenGL.Legacy.Extensions.INGR.csproj", "{7FB49D81-CE37-47D8-B62D-5954F72DE052}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.INGR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.INGR\Silk.NET.OpenGL.Legacy.Extensions.INGR.csproj", "{7FB49D81-CE37-47D8-B62D-5954F72DE052}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.INTEL\Silk.NET.OpenGL.Legacy.Extensions.INTEL.csproj", "{6CCD4C39-C953-4281-8135-1316B1A68248}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.INTEL\Silk.NET.OpenGL.Legacy.Extensions.INTEL.csproj", "{6CCD4C39-C953-4281-8135-1316B1A68248}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.KHR\Silk.NET.OpenGL.Legacy.Extensions.KHR.csproj", "{E9754021-FBDD-460C-B966-B41019E3EF98}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.KHR\Silk.NET.OpenGL.Legacy.Extensions.KHR.csproj", "{E9754021-FBDD-460C-B966-B41019E3EF98}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.MESA", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.MESA\Silk.NET.OpenGL.Legacy.Extensions.MESA.csproj", "{7483030B-2CA2-4B60-9188-6BA5633EFBF1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.MESA", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.MESA\Silk.NET.OpenGL.Legacy.Extensions.MESA.csproj", "{7483030B-2CA2-4B60-9188-6BA5633EFBF1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.MESAX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.MESAX\Silk.NET.OpenGL.Legacy.Extensions.MESAX.csproj", "{7BAAFB8D-4FDE-4C77-9093-8ECAF93C1890}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.MESAX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.MESAX\Silk.NET.OpenGL.Legacy.Extensions.MESAX.csproj", "{7BAAFB8D-4FDE-4C77-9093-8ECAF93C1890}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.NV\Silk.NET.OpenGL.Legacy.Extensions.NV.csproj", "{3AE416D7-C523-415B-A3AF-B790A1B5C05F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.NV\Silk.NET.OpenGL.Legacy.Extensions.NV.csproj", "{3AE416D7-C523-415B-A3AF-B790A1B5C05F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.NVX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.NVX\Silk.NET.OpenGL.Legacy.Extensions.NVX.csproj", "{75DC2611-F3A9-4C17-A647-454097698434}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.NVX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.NVX\Silk.NET.OpenGL.Legacy.Extensions.NVX.csproj", "{75DC2611-F3A9-4C17-A647-454097698434}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.OES", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OES\Silk.NET.OpenGL.Legacy.Extensions.OES.csproj", "{2FBBB8C4-CCF3-4421-8514-9BC91A0933C8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.OES", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OES\Silk.NET.OpenGL.Legacy.Extensions.OES.csproj", "{2FBBB8C4-CCF3-4421-8514-9BC91A0933C8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.OML", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OML\Silk.NET.OpenGL.Legacy.Extensions.OML.csproj", "{7BB402A0-274C-4476-A9F9-884045F30376}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.OML", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OML\Silk.NET.OpenGL.Legacy.Extensions.OML.csproj", "{7BB402A0-274C-4476-A9F9-884045F30376}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OVR\Silk.NET.OpenGL.Legacy.Extensions.OVR.csproj", "{2A3247AB-750D-48E6-9B99-A876397404D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.OVR\Silk.NET.OpenGL.Legacy.Extensions.OVR.csproj", "{2A3247AB-750D-48E6-9B99-A876397404D6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.PGI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.PGI\Silk.NET.OpenGL.Legacy.Extensions.PGI.csproj", "{BF9F8BA0-81F1-457D-89DF-9466FD4868C1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.PGI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.PGI\Silk.NET.OpenGL.Legacy.Extensions.PGI.csproj", "{BF9F8BA0-81F1-457D-89DF-9466FD4868C1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.REND", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.REND\Silk.NET.OpenGL.Legacy.Extensions.REND.csproj", "{4451DE2E-B803-46E2-A911-C4FF5B183FD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.REND", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.REND\Silk.NET.OpenGL.Legacy.Extensions.REND.csproj", "{4451DE2E-B803-46E2-A911-C4FF5B183FD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.S3", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.S3\Silk.NET.OpenGL.Legacy.Extensions.S3.csproj", "{3934B088-9BB7-4D48-BDC3-DA2E9D0545E1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.S3", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.S3\Silk.NET.OpenGL.Legacy.Extensions.S3.csproj", "{3934B088-9BB7-4D48-BDC3-DA2E9D0545E1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.SGI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGI\Silk.NET.OpenGL.Legacy.Extensions.SGI.csproj", "{63F82AE3-05F1-4C5C-A4C9-18EBFA01DF74}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.SGI", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGI\Silk.NET.OpenGL.Legacy.Extensions.SGI.csproj", "{63F82AE3-05F1-4C5C-A4C9-18EBFA01DF74}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.SGIS", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGIS\Silk.NET.OpenGL.Legacy.Extensions.SGIS.csproj", "{800B088D-2C80-4B72-84C3-3FF1F3DCB42A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.SGIS", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGIS\Silk.NET.OpenGL.Legacy.Extensions.SGIS.csproj", "{800B088D-2C80-4B72-84C3-3FF1F3DCB42A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.SGIX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGIX\Silk.NET.OpenGL.Legacy.Extensions.SGIX.csproj", "{C0066476-7E6C-47B0-B6AD-87669FF643D1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.SGIX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SGIX\Silk.NET.OpenGL.Legacy.Extensions.SGIX.csproj", "{C0066476-7E6C-47B0-B6AD-87669FF643D1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.SUN", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SUN\Silk.NET.OpenGL.Legacy.Extensions.SUN.csproj", "{F1632267-F122-4F27-BDD9-501C8D087DF2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.SUN", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SUN\Silk.NET.OpenGL.Legacy.Extensions.SUN.csproj", "{F1632267-F122-4F27-BDD9-501C8D087DF2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.SUNX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SUNX\Silk.NET.OpenGL.Legacy.Extensions.SUNX.csproj", "{318FBDE5-3045-4DE4-A489-F5A314D4D4B5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.SUNX", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.SUNX\Silk.NET.OpenGL.Legacy.Extensions.SUNX.csproj", "{318FBDE5-3045-4DE4-A489-F5A314D4D4B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGL.Legacy.Extensions.WIN", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.WIN\Silk.NET.OpenGL.Legacy.Extensions.WIN.csproj", "{B56BD145-5D19-4049-9700-CA1F024CE8A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGL.Legacy.Extensions.WIN", "src\OpenGL\Extensions\Silk.NET.OpenGL.Legacy.Extensions.WIN\Silk.NET.OpenGL.Legacy.Extensions.WIN.csproj", "{B56BD145-5D19-4049-9700-CA1F024CE8A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.AMD\Silk.NET.OpenGLES.Extensions.AMD.csproj", "{F7181088-183E-4267-B13D-59A8EE90FAD1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.AMD", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.AMD\Silk.NET.OpenGLES.Extensions.AMD.csproj", "{F7181088-183E-4267-B13D-59A8EE90FAD1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.ANDROID", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ANDROID\Silk.NET.OpenGLES.Extensions.ANDROID.csproj", "{3FCBE160-964B-4066-A9D1-ADFEAAFAF0D4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.ANDROID", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ANDROID\Silk.NET.OpenGLES.Extensions.ANDROID.csproj", "{3FCBE160-964B-4066-A9D1-ADFEAAFAF0D4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.ANGLE", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ANGLE\Silk.NET.OpenGLES.Extensions.ANGLE.csproj", "{5B084D8A-795F-4641-B89D-823A369AB84C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.ANGLE", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ANGLE\Silk.NET.OpenGLES.Extensions.ANGLE.csproj", "{5B084D8A-795F-4641-B89D-823A369AB84C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.APPLE\Silk.NET.OpenGLES.Extensions.APPLE.csproj", "{DB5446E8-3884-4C77-8E17-F5C67584C514}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.APPLE", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.APPLE\Silk.NET.OpenGLES.Extensions.APPLE.csproj", "{DB5446E8-3884-4C77-8E17-F5C67584C514}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.ARM", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ARM\Silk.NET.OpenGLES.Extensions.ARM.csproj", "{5AC8140B-D9C2-4317-948D-A447B846493A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.ARM", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.ARM\Silk.NET.OpenGLES.Extensions.ARM.csproj", "{5AC8140B-D9C2-4317-948D-A447B846493A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.DMP", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.DMP\Silk.NET.OpenGLES.Extensions.DMP.csproj", "{83A352A0-F1EE-4091-8785-25BBA1C5F4B1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.DMP", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.DMP\Silk.NET.OpenGLES.Extensions.DMP.csproj", "{83A352A0-F1EE-4091-8785-25BBA1C5F4B1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.EXT\Silk.NET.OpenGLES.Extensions.EXT.csproj", "{D8E37A9A-E94F-4A6A-9913-7EFB5494CE70}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.EXT", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.EXT\Silk.NET.OpenGLES.Extensions.EXT.csproj", "{D8E37A9A-E94F-4A6A-9913-7EFB5494CE70}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.FJ", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.FJ\Silk.NET.OpenGLES.Extensions.FJ.csproj", "{E247B4A2-5EB3-451B-8D24-06DB83023B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.FJ", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.FJ\Silk.NET.OpenGLES.Extensions.FJ.csproj", "{E247B4A2-5EB3-451B-8D24-06DB83023B85}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.IMG", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.IMG\Silk.NET.OpenGLES.Extensions.IMG.csproj", "{107CE915-3387-4A0D-A8C7-0859A0D3DF80}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.IMG", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.IMG\Silk.NET.OpenGLES.Extensions.IMG.csproj", "{107CE915-3387-4A0D-A8C7-0859A0D3DF80}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.INTEL\Silk.NET.OpenGLES.Extensions.INTEL.csproj", "{9EA0B2F1-9C74-4817-9458-A8AB20B4CED7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.INTEL", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.INTEL\Silk.NET.OpenGLES.Extensions.INTEL.csproj", "{9EA0B2F1-9C74-4817-9458-A8AB20B4CED7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.KHR\Silk.NET.OpenGLES.Extensions.KHR.csproj", "{A48E9ECA-FA1A-4851-BF14-E434FCBBAB84}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.KHR", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.KHR\Silk.NET.OpenGLES.Extensions.KHR.csproj", "{A48E9ECA-FA1A-4851-BF14-E434FCBBAB84}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.MESA", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.MESA\Silk.NET.OpenGLES.Extensions.MESA.csproj", "{4F8FAA99-0491-4857-9252-685BF3B46AAB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.MESA", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.MESA\Silk.NET.OpenGLES.Extensions.MESA.csproj", "{4F8FAA99-0491-4857-9252-685BF3B46AAB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.NV\Silk.NET.OpenGLES.Extensions.NV.csproj", "{7E00824E-34C5-4162-AA26-86F84A4FBA42}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.NV", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.NV\Silk.NET.OpenGLES.Extensions.NV.csproj", "{7E00824E-34C5-4162-AA26-86F84A4FBA42}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.NVX", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.NVX\Silk.NET.OpenGLES.Extensions.NVX.csproj", "{C8A6C654-015C-4218-B653-DFFD40D51492}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.NVX", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.NVX\Silk.NET.OpenGLES.Extensions.NVX.csproj", "{C8A6C654-015C-4218-B653-DFFD40D51492}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.OES", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.OES\Silk.NET.OpenGLES.Extensions.OES.csproj", "{1D221A69-EE04-476A-B660-32DFDB2DC162}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.OES", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.OES\Silk.NET.OpenGLES.Extensions.OES.csproj", "{1D221A69-EE04-476A-B660-32DFDB2DC162}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.OVR\Silk.NET.OpenGLES.Extensions.OVR.csproj", "{3BC72F4A-8B32-490A-9EA7-B68320991E15}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.OVR", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.OVR\Silk.NET.OpenGLES.Extensions.OVR.csproj", "{3BC72F4A-8B32-490A-9EA7-B68320991E15}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.QCOM", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.QCOM\Silk.NET.OpenGLES.Extensions.QCOM.csproj", "{6D2F52DB-2DB4-49EF-8DD1-212FA33CE034}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.QCOM", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.QCOM\Silk.NET.OpenGLES.Extensions.QCOM.csproj", "{6D2F52DB-2DB4-49EF-8DD1-212FA33CE034}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenGLES.Extensions.VIV", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.VIV\Silk.NET.OpenGLES.Extensions.VIV.csproj", "{8D534FE1-6113-457A-97DD-FD42782580A5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.Extensions.VIV", "src\OpenGL\Extensions\Silk.NET.OpenGLES.Extensions.VIV\Silk.NET.OpenGLES.Extensions.VIV.csproj", "{8D534FE1-6113-457A-97DD-FD42782580A5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{0651C5EF-50AA-4598-8D9C-8F210ADD8490}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle", "examples\Triangle\Triangle.csproj", "{3478F392-7055-4ECC-B388-7F115AA7EA5A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Triangle", "examples\Triangle\Triangle.csproj", "{3478F392-7055-4ECC-B388-7F115AA7EA5A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Input.Desktop", "src\Input\Silk.NET.Input.Desktop\Silk.NET.Input.Desktop.csproj", "{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Input.Desktop", "src\Input\Silk.NET.Input.Desktop\Silk.NET.Input.Desktop.csproj", "{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Input", "src\Input\Silk.NET.Input\Silk.NET.Input.csproj", "{020A8E88-B607-4281-BA0D-5ED03484A201}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Input", "src\Input\Silk.NET.Input\Silk.NET.Input.csproj", "{020A8E88-B607-4281-BA0D-5ED03484A201}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InputTest", "examples\InputTest\InputTest.csproj", "{3E744E54-F450-4051-8919-04D9B591688E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputTest", "examples\InputTest\InputTest.csproj", "{3E744E54-F450-4051-8919-04D9B591688E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing.Android", "src\Windowing\Silk.NET.Windowing.Android\Silk.NET.Windowing.Android.csproj", "{AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -182,9 +184,6 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FD24E9FF-1097-4777-A418-F2D88C558665}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD24E9FF-1097-4777-A418-F2D88C558665}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -330,18 +329,6 @@ Global {94D7D3A3-3640-4791-BE19-CA50C59187C6}.Release|x64.Build.0 = Release|Any CPU {94D7D3A3-3640-4791-BE19-CA50C59187C6}.Release|x86.ActiveCfg = Release|Any CPU {94D7D3A3-3640-4791-BE19-CA50C59187C6}.Release|x86.Build.0 = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|x64.ActiveCfg = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|x64.Build.0 = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|x86.ActiveCfg = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Debug|x86.Build.0 = Debug|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|Any CPU.Build.0 = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|x64.ActiveCfg = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|x64.Build.0 = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|x86.ActiveCfg = Release|Any CPU - {8FFF49D6-B029-400B-8510-19088868DFA6}.Release|x86.Build.0 = Release|Any CPU {8FFF49D6-B029-400B-8510-1A088868DFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8FFF49D6-B029-400B-8510-1A088868DFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU {8FFF49D6-B029-400B-8510-1A088868DFA6}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1086,13 +1073,30 @@ Global {3E744E54-F450-4051-8919-04D9B591688E}.Release|x64.Build.0 = Release|Any CPU {3E744E54-F450-4051-8919-04D9B591688E}.Release|x86.ActiveCfg = Release|Any CPU {3E744E54-F450-4051-8919-04D9B591688E}.Release|x86.Build.0 = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|x64.ActiveCfg = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|x64.Build.0 = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|x86.ActiveCfg = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Debug|x86.Build.0 = Debug|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|Any CPU.Build.0 = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x64.ActiveCfg = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x64.Build.0 = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x86.ActiveCfg = Release|Any CPU + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {FD24E9FF-1097-4777-A418-F2D88C558665} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490} {BFE429EB-4C2E-4BF3-A302-C9C5A2FDA6D7} = {23324041-2076-477C-A4BF-B385B8066C6C} + {136C6154-D300-4B82-80D3-17B637841A2B} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490} {A8DFEA18-E880-4303-BBCE-0F27EE214D44} = {23324041-2076-477C-A4BF-B385B8066C6C} {0A18FCAE-572E-47FF-B8E3-C97ED15132FA} = {23324041-2076-477C-A4BF-B385B8066C6C} - {956F722C-DFD3-435E-9D2E-A0549C4D8BC0} = {23324041-2076-477C-A4BF-B385B8066C6C} {E8C4587E-9424-438B-AEAF-A09E0234865A} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A} + {956F722C-DFD3-435E-9D2E-A0549C4D8BC0} = {23324041-2076-477C-A4BF-B385B8066C6C} {5A41E9D5-67F5-447C-8AE2-78FED7A45206} = {081E7761-B200-4DBF-8950-941464DECACE} {896B1A79-FEC8-4B7A-8A9C-0CC8EDA2CCFC} = {081E7761-B200-4DBF-8950-941464DECACE} {FC015604-3326-4BCC-9212-C5CB0DFB0D12} = {896B1A79-FEC8-4B7A-8A9C-0CC8EDA2CCFC} @@ -1158,11 +1162,13 @@ Global {3BC72F4A-8B32-490A-9EA7-B68320991E15} = {CF69D5C3-4ACE-4458-BA5A-0E9A3B294CDC} {6D2F52DB-2DB4-49EF-8DD1-212FA33CE034} = {CF69D5C3-4ACE-4458-BA5A-0E9A3B294CDC} {8D534FE1-6113-457A-97DD-FD42782580A5} = {CF69D5C3-4ACE-4458-BA5A-0E9A3B294CDC} - {FD24E9FF-1097-4777-A418-F2D88C558665} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490} - {136C6154-D300-4B82-80D3-17B637841A2B} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490} {3478F392-7055-4ECC-B388-7F115AA7EA5A} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A} {3908DEF6-7403-49F5-B8EC-5B3B12C325D4} = {FA9D1C95-5585-4DEC-B226-1447A486C376} {020A8E88-B607-4281-BA0D-5ED03484A201} = {FA9D1C95-5585-4DEC-B226-1447A486C376} {3E744E54-F450-4051-8919-04D9B591688E} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A} + {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00} = {23324041-2076-477C-A4BF-B385B8066C6C} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {03A4D8D2-2C1B-4488-8442-698D88093522} EndGlobalSection EndGlobal diff --git a/src/Windowing/Silk.NET.Windowing.Android/ANativeWindow.cs b/src/Windowing/Silk.NET.Windowing.Android/ANativeWindow.cs new file mode 100644 index 0000000000..b535d74434 --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/ANativeWindow.cs @@ -0,0 +1,24 @@ +// This file is part of Silk.NET. +// +// You may modify and distribute Silk.NET under the terms +// of the MIT license. See the LICENSE file for details. + +namespace Silk.NET.Windowing.Android +{ + /// + /// Opaque handle to an Android Native Window. + /// + /// A pointer can be obtained using + /// + /// + public struct ANativeWindow + { + /// + /// Struct that represents a window's buffer. + /// + public struct Buffer + { + + } + } +} diff --git a/src/Windowing/Silk.NET.Windowing.Android/ARect.cs b/src/Windowing/Silk.NET.Windowing.Android/ARect.cs new file mode 100644 index 0000000000..554d109412 --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/ARect.cs @@ -0,0 +1,11 @@ +// This file is part of Silk.NET. +// +// You may modify and distribute Silk.NET under the terms +// of the MIT license. See the LICENSE file for details. +namespace Silk.NET.Windowing.Android +{ + public struct ARect + { + public int Bottom, Left, Right, Top; + } +} diff --git a/src/Windowing/Silk.NET.Windowing.Android/Android.cs b/src/Windowing/Silk.NET.Windowing.Android/Android.cs new file mode 100644 index 0000000000..a1f566a332 --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/Android.cs @@ -0,0 +1,117 @@ +// This file is part of Silk.NET. +// +// You may modify and distribute Silk.NET under the terms +// of the MIT license. See the LICENSE file for details. + +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace Silk.NET.Windowing.Android +{ + public static class Android + { + /// + /// Acquire a reference on the given object. This prevents the object from being + /// deleted until the reference is removed. + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_acquire")] + public static extern unsafe void Acquire(ANativeWindow* window); + + /// + /// Return the ANativeWindow associated with a Java Surface object, for interacting with it through native code. + /// + /// The JNI environment. + /// The Java surface. + /// + [DllImport("android", EntryPoint = "ANativeWindow_fromSurface")] + public static extern unsafe ANativeWindow* CreateNativeWindow(IntPtr jni, IntPtr surface); + + /// + /// Get the dataspace of buffers in window. + /// + /// The window to get the dataspace of. + /// The dataspace. + [DllImport("android", EntryPoint = "ANativeWindow_getBuffersDataSpace")] + public static extern unsafe int GetBuffersDataSpace(ANativeWindow* window); + + /// + /// Gets the current pixel format of the window surface. + /// + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_getFormat")] + public static extern unsafe int GetFormat(ANativeWindow* anw); + + /// + /// Gets the current width in pixels of the window surface. + /// + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_getWidth")] + public static extern unsafe int GetWidth(ANativeWindow* anw); + + /// + /// Gets the current height in pixels of the window surface. + /// + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_getHeight")] + public static extern unsafe int GetHeight(ANativeWindow* anw); + + /// + /// Lock the window's next drawing surface for writing. + /// + /// The window. + /// The output buffer. + /// The region the caller intends to redraw. + /// + [DllImport("android", EntryPoint = "ANativeWindow_lock")] + public static extern unsafe int LockWindow(ANativeWindow* anw, ANativeWindow.Buffer* outBuffer, ARect* inOutDirtyBounds); + + /// + /// Remove a reference that was previously acquired with . + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_release")] + public static extern unsafe void ReleaseNativeWindow(ANativeWindow* window); + + /// + /// All buffers queued after this call will be associated with the dataSpace parameter specified. + /// + /// The window. + /// Data space of all buffers queued after this call. + /// + [DllImport("android", EntryPoint = "ANativeWindow_setBuffersDataSpace")] + public static extern unsafe int SetBuffersDataSpace(ANativeWindow* window, int dataSpace); + + /// + /// Change the format and size of the window buffers. + /// + /// The window. + /// The new width. + /// The new height. + /// The new format. + /// + [DllImport("android", EntryPoint = "ANativeWindow_setBuffersGeometry")] + public static extern unsafe int SetBuffersGeometry(ANativeWindow* window, int width, int height, int format); + + /// + /// Set a transform that will be applied to future buffers posted to the window. + /// + /// + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_setBuffersTransform")] + public static extern unsafe int SetBuffersTransform(ANativeWindow* window, int transform); + + /// + /// Unlock the window's drawing surface after previously locking it, posting the new buffer to the display. + /// + /// + /// + [DllImport("android", EntryPoint = "ANativeWindow_unlockAndPost")] + public static extern unsafe int SwapBuffers(ANativeWindow* anw); + } +} diff --git a/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs b/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs new file mode 100644 index 0000000000..19bca04f7f --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs @@ -0,0 +1,22 @@ +using System; +using Android.App; +using Silk.NET.Windowing.Common; + +namespace Silk.NET.Windowing.Android +{ + public class AndroidPlatform : IWindowPlatform + { + public bool IsApplicable => Activity != null; + public static Activity Activity { get; set; } + public static AndroidWindow Current { get; set; } + + public IWindow GetWindow(WindowOptions options) + { + if (Current != null) + { + throw new NotSupportedException("Multiple windows are not supported on Android."); + } + return Current = new AndroidWindow(Activity, options); + } + } +} diff --git a/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs b/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs new file mode 100644 index 0000000000..664559a3e0 --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs @@ -0,0 +1,319 @@ +// This file is part of Silk.NET. +// +// You may modify and distribute Silk.NET under the terms +// of the MIT license. See the LICENSE file for details. + +using System; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Android.Content; +using Android.Graphics; +using Android.Opengl; +using Android.Runtime; +using Android.Views; +using Silk.NET.Windowing.Common; +using static Android.Opengl.EGL14; +using Point = System.Drawing.Point; +using Size = System.Drawing.Size; + +namespace Silk.NET.Windowing.Android +{ + [Register("uk/co/ultz/SilkDotNet/AndroidWindow")] + public class AndroidWindow : SurfaceView, IWindow, ISurfaceHolderCallback + { + private bool _running; + private bool _windowShouldClose; + private ConcurrentQueue _invokeQueue; + private int _mainThread; + private int _isRunningSlowlyTries; + private Stopwatch _renderStopwatch; + private Stopwatch _updateStopwatch; + private unsafe ANativeWindow* _windowPtr; + private EGLContext _context; + private double _updatePeriod; + private double _renderPeriod; + private EGLDisplay _display; + private EGLSurface _surface; + private static readonly int[] _attribs = { + EglSurfaceType, EglWindowBit, + EglBlueSize, 8, + EglGreenSize, 8, + EglRedSize, 8, + EglNone + }; + + private EGLConfig _config; + + + // IWindow + public bool IsVisible { get; set; } + public bool UseSingleThreadedWindow { get; } + public Point Position + { + get => default; + set {} + } + + public unsafe Size Size + { + get => Handle == IntPtr.Zero ? new Size(Android.GetWidth(_windowPtr), Android.GetHeight(_windowPtr)) : default; + set { } + } + + public double FramesPerSecond { get; set; } + public double UpdatesPerSecond { get; set; } + public GraphicsAPI API { get; } + public string Title { get; set; } + + public WindowState WindowState + { + get => WindowState.Fullscreen; + set { } + } + + public WindowBorder WindowBorder + { + get => WindowBorder.Hidden; + set { } + } + + public VSyncMode VSync { get; set; } + public int RunningSlowTolerance { get; set; } + public event Action Move; + public event Action Resize; + public event Action Closing; + public event Action StateChanged; + public event Action FocusChanged; + public event Action FileDrop; + public event Action Load; + public event Action Update; + public event Action Render; + public unsafe IntPtr Handle => (IntPtr) _windowPtr; + public bool IsRunningSlowly { get; } + public unsafe void Run() + { + _running = true; + + _invokeQueue = new ConcurrentQueue(); + _mainThread = Thread.CurrentThread.ManagedThreadId; + if ((_display = EglGetDisplay(EglDefaultDisplay)) == EglNoDisplay) + { + throw new EglException("Couldn't get the default display, error code " + EglGetError()); + } + + if (!EglInitialize(_display, null, 0, null, 0)) + { + throw new EglException("Couldn't initialize, error code " + EglGetError()); + } + + var configs = new EGLConfig[1]; + var numConfigs = new int[1]; + if (!EglChooseConfig(_display, _attribs, 0, configs, 0, 1, numConfigs, 0)) { + throw new EglException("Couldn't choose config, error code " + EglGetError()); + } + + _config = configs[0]; + + var formats = new int[1]; + if (!EglGetConfigAttrib(_display, _config, EglNativeVisualId, formats, 0)) { + throw new EglException("Couldn't get config attribute, error code " + EglGetError()); + } + + Android.SetBuffersGeometry(_windowPtr, 0, 0, formats[0]); + var win = new Java.Lang.Object((IntPtr)_windowPtr, JniHandleOwnership.DoNotTransfer); + + if ((_surface = EglCreateWindowSurface(_display, _config, win, null, 0)) == EglNoSurface) { + throw new EglException("Couldn't create surface, error code " + EglGetError()); + } + + if ((_context = EglCreateContext(_display, _config, EglNoContext, null, 0)) == EglNoContext) { + throw new EglException("Couldn't create context, error code " + EglGetError()); + } + + if (!EglMakeCurrent(_display, _surface, _surface, _context)) { + throw new EglException("Couldn't make context current, error code " + EglGetError()); + } + + // todo vsync + + InitializeCallbacks(); + + // Run OnLoad. + Load?.Invoke(); + + // Initialize some variables + _isRunningSlowlyTries = 0; + + _renderStopwatch = new Stopwatch(); + _updateStopwatch = new Stopwatch(); + + _mainThread = Thread.CurrentThread.ManagedThreadId; + + // Start the update loop. + while (!_windowShouldClose && !AndroidPlatform.Activity.IsFinishing) + { + // TODO events + + if (UseSingleThreadedWindow) + { + RaiseUpdateFrame(); + RaiseRenderFrame(); + } + else + { + // Raise UpdateFrame, but don't await it yet. + var task = Task.Run((Action)RaiseUpdateFrame); // cast to action, ambiguous call + + // Loop while we're still updating - the Update thread might be calling the main thread + while (!task.IsCompleted) + { + if (!_invokeQueue.IsEmpty && _invokeQueue.TryDequeue(out var invokeCall)) + { + invokeCall.GetAwaiter().GetResult(); + } + } + + // Raise render. + RaiseRenderFrame(); + } + + if (VSync == VSyncMode.Adaptive) + { + EglSwapInterval(_display, IsRunningSlowly ? 0 : 1); + } + } + + _running = false; + } + + private void InitializeCallbacks() + { + throw new NotImplementedException(); + } + + public void Close() + { + throw new NotImplementedException(); + } + + public Point PointToClient(Point point) + { + throw new NotImplementedException(); + } + + public Point PointToScreen(Point point) + { + throw new NotImplementedException(); + } + + public object Invoke(Delegate d) + { + throw new NotImplementedException(); + } + + public object Invoke(Delegate d, params object[] args) + { + throw new NotImplementedException(); + } + + // Implementation + + /// + /// Run an OnUpdate event. + /// + private void RaiseUpdateFrame() + { + // If using a capped framerate without vsync, we have to do some synchronization-related things + // before rendering. + if (UpdatesPerSecond > double.Epsilon + && (VSync == VSyncMode.Off || VSync == VSyncMode.Adaptive && IsRunningSlowly)) + { + // Calculate the amount of time to sleep. + var sleepTime = _updatePeriod - _updateStopwatch.Elapsed.TotalSeconds; + + // If the result is negative, that means the frame is running slowly. Mark as such and don't sleep. + if (sleepTime < 0.0) + { + _isRunningSlowlyTries += 1; + } + // Else, sleep for that amount of time. + else + { + _isRunningSlowlyTries = 0; + Thread.Sleep((int) (1000 * sleepTime)); + } + } + + // Calculate delta and run frame. + var delta = _updateStopwatch.Elapsed.TotalSeconds; + Update?.Invoke(delta); + _updateStopwatch.Restart(); + } + + /// + /// Run an OnRender event. + /// + private void RaiseRenderFrame() + { + // Identical to RaiseUpdateFrame. + if (FramesPerSecond > double.Epsilon + && (VSync == VSyncMode.Off || VSync == VSyncMode.Adaptive && IsRunningSlowly)) + { + var sleepTime = _renderPeriod - _renderStopwatch.Elapsed.TotalSeconds; + + if (sleepTime > 0.0) + { + Thread.Sleep((int) (1000 * sleepTime)); + } + } + + var delta = _renderStopwatch.Elapsed.TotalSeconds; + Render?.Invoke(delta); + if (!EglSwapBuffers(_display, _surface)) + { + throw new EglException("Couldn't swap buffers, error code " + EglGetError()); + } + _renderStopwatch.Restart(); + + // This has to be called on the thread with the graphics context + if (VSync == VSyncMode.Adaptive) + { + EglSwapInterval(EglGetCurrentDisplay(), IsRunningSlowly ? 0 : 1); + } + } + + // SurfaceView + public void Dispose() + { + throw new NotImplementedException(); + } + + public void SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height) + { + throw new NotImplementedException(); + } + + public void SurfaceCreated(ISurfaceHolder holder) + { + throw new NotImplementedException(); + } + + public void SurfaceDestroyed(ISurfaceHolder holder) + { + throw new NotImplementedException(); + } + + [Register(".ctor", "(Landroid/content/Context;)V", "")] + public AndroidWindow(Context context, WindowOptions opts) : base(context) + { + // todo opts + } + } + + public class EglException : Exception + { + public EglException(string str) : base(str){} + } +} diff --git a/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj b/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj new file mode 100644 index 0000000000..e77a782135 --- /dev/null +++ b/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj @@ -0,0 +1,16 @@ + + + monoandroid90 + true + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindow.cs b/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindow.cs index 4191925cef..bf1c322f8f 100644 --- a/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindow.cs +++ b/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindow.cs @@ -10,7 +10,7 @@ namespace Silk.NET.Windowing.Common /// /// An interface representing a window. /// - public interface IWindow : IWindowProperties, IWindowFunctions, IWindowEvents + public interface IWindow : IWindowProperties, IWindowFunctions, IWindowEvents, IDisposable { /// /// A handle to the underlying window. diff --git a/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindowFunctions.cs b/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindowFunctions.cs index 9208bb6052..deeb6a3336 100644 --- a/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindowFunctions.cs +++ b/src/Windowing/Silk.NET.Windowing.Common/Interfaces/IWindowFunctions.cs @@ -23,16 +23,6 @@ public interface IWindowFunctions /// void Close(); - /// - /// Process all pending window events. - /// - void ProcessEvents(); - - /// - /// Swap between rendering buffers. - /// - void SwapBuffers(); - /// /// Converts this point to client coordinates. /// diff --git a/src/Windowing/Silk.NET.Windowing.Desktop/GlfwWindow.cs b/src/Windowing/Silk.NET.Windowing.Desktop/GlfwWindow.cs index 20a7481ed1..5e6d27cfc9 100644 --- a/src/Windowing/Silk.NET.Windowing.Desktop/GlfwWindow.cs +++ b/src/Windowing/Silk.NET.Windowing.Desktop/GlfwWindow.cs @@ -775,5 +775,9 @@ private unsafe void InitializeCallbacks() } ); } + + public void Dispose() + { + } } } diff --git a/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj b/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj index 154ec087c0..4a313fcee6 100644 --- a/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj +++ b/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj @@ -1,13 +1,18 @@ - + - netstandard2.0 + netstandard2.0;xamarin.android90 - + + + + + + diff --git a/src/Windowing/Silk.NET.Windowing/Window.cs b/src/Windowing/Silk.NET.Windowing/Window.cs index 9cecd6aa89..3cfad78d7e 100644 --- a/src/Windowing/Silk.NET.Windowing/Window.cs +++ b/src/Windowing/Silk.NET.Windowing/Window.cs @@ -6,7 +6,6 @@ using System; using Silk.NET.Core.Platform; using Silk.NET.Windowing.Common; -using Silk.NET.Windowing.Desktop; namespace Silk.NET.Windowing { @@ -22,7 +21,8 @@ public static class Window /// A Silk.NET window using the current platform. public static IWindow Create(WindowOptions options) { - if (!SilkManager.IsRegistered()) { + if (!SilkManager.IsRegistered()) + { Init(); } @@ -39,17 +39,35 @@ public static IWindow Create(WindowOptions options) /// public static void Init() { - var glfwPlatform = new GlfwPlatform(); +#if NETSTANDARD + var glfwPlatform = new Windowing.Desktop.GlfwPlatform(); if (glfwPlatform.IsApplicable) { SilkManager.Register(glfwPlatform); return; } - - // TODO: Mobile - - if (!SilkManager.IsRegistered()) { +#elif XAMARIN_ANDROID + var androidPlatform = new Windowing.Android.AndroidPlatform(); + if (androidPlatform.IsApplicable) + { + SilkManager.Register(androidPlatform); + } +#endif + if (!SilkManager.IsRegistered()) + { throw new NotSupportedException("Couldn't find a suitable windowing platform."); } } + +#if XAMARIN_ANDROID + /// + /// Attempts to resolve an equipped to use the given + /// + /// The activity to use. + public static void Init(global::Android.App.Activity activity) + { + Android.AndroidPlatform.Activity = activity; + Init(); + } +#endif } -} \ No newline at end of file +} From cff1df45f4aff72306f5e3063103e76275e8d903 Mon Sep 17 00:00:00 2001 From: DMP9 Date: Fri, 9 Aug 2019 18:34:20 +0100 Subject: [PATCH 2/2] misc changes --- Silk.NET.sln | 35 ++- examples/Triangle.Desktop/Program.cs | 13 + .../Triangle.Desktop/Triangle.Desktop.csproj | 12 + .../{Program.cs => OpenGL/TriangleDesktop.cs} | 6 +- examples/Triangle/OpenGLES/TriangleMobile.cs | 124 ++++++++++ examples/Triangle/Triangle.csproj | 4 +- .../AndroidPlatform.cs | 14 ++ .../AndroidWindow.cs | 231 ++++++++++++------ .../Silk.NET.Windowing.Android.csproj | 63 ++++- .../Silk.NET.Windowing.csproj | 12 +- src/Windowing/Silk.NET.Windowing/Window.cs | 14 +- 11 files changed, 422 insertions(+), 106 deletions(-) create mode 100644 examples/Triangle.Desktop/Program.cs create mode 100644 examples/Triangle.Desktop/Triangle.Desktop.csproj rename examples/Triangle/{Program.cs => OpenGL/TriangleDesktop.cs} (97%) create mode 100644 examples/Triangle/OpenGLES/TriangleMobile.cs diff --git a/Silk.NET.sln b/Silk.NET.sln index 0a97137012..9d16b80312 100644 --- a/Silk.NET.sln +++ b/Silk.NET.sln @@ -35,11 +35,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenAL.Extensions.Soft", "src\OpenAL\Extensions\Silk.NET.OpenAL.Extensions.Soft\Silk.NET.OpenAL.Extensions.Soft.csproj", "{94D7D3A3-3640-4791-BE19-CA50C59187C6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Properties", "Build Properties", "{21F1A5E2-9861-49A6-934D-DF5AAA03AFFE}" - ProjectSection(SolutionItems) = preProject - build\props\bindings.props = build\props\bindings.props - build\props\common.props = build\props\common.props - EndProjectSection +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{21F1A5E2-9861-49A6-934D-DF5AAA03AFFE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Input.Common", "src\Input\Silk.NET.Input.Common\Silk.NET.Input.Common.csproj", "{8FFF49D6-B029-400B-8510-1A088868DFA6}" EndProject @@ -175,6 +171,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputTest", "examples\Input EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing.Android", "src\Windowing\Silk.NET.Windowing.Android\Silk.NET.Windowing.Android.csproj", "{AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle.Desktop", "examples\Triangle.Desktop\Triangle.Desktop.csproj", "{A933F5C7-23C0-4055-AE68-171CFD4DD96B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{41C41723-97A1-4E34-9161-C3E990CBD49F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Props", "Props", "{B0962E20-EE16-4761-A243-7BFB15CA6F63}" +ProjectSection(SolutionItems) = preProject + build\props\bindings.props = build\props\bindings.props + build\props\common.props = build\props\common.props +EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1085,6 +1091,18 @@ Global {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x64.Build.0 = Release|Any CPU {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x86.ActiveCfg = Release|Any CPU {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00}.Release|x86.Build.0 = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|x64.ActiveCfg = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|x64.Build.0 = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|x86.ActiveCfg = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Debug|x86.Build.0 = Debug|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|Any CPU.Build.0 = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|x64.ActiveCfg = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|x64.Build.0 = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|x86.ActiveCfg = Release|Any CPU + {A933F5C7-23C0-4055-AE68-171CFD4DD96B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1167,6 +1185,13 @@ Global {020A8E88-B607-4281-BA0D-5ED03484A201} = {FA9D1C95-5585-4DEC-B226-1447A486C376} {3E744E54-F450-4051-8919-04D9B591688E} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A} {AF7A51B8-5E31-49B0-B879-1B5CB0BCBE00} = {23324041-2076-477C-A4BF-B385B8066C6C} + {A933F5C7-23C0-4055-AE68-171CFD4DD96B} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A} + {0651C5EF-50AA-4598-8D9C-8F210ADD8490} = {41C41723-97A1-4E34-9161-C3E990CBD49F} + {FA9D1C95-5585-4DEC-B226-1447A486C376} = {41C41723-97A1-4E34-9161-C3E990CBD49F} + {081E7761-B200-4DBF-8950-941464DECACE} = {41C41723-97A1-4E34-9161-C3E990CBD49F} + {0E9C83A8-A413-4921-8F39-59519BFF939B} = {41C41723-97A1-4E34-9161-C3E990CBD49F} + {23324041-2076-477C-A4BF-B385B8066C6C} = {41C41723-97A1-4E34-9161-C3E990CBD49F} + {B0962E20-EE16-4761-A243-7BFB15CA6F63} = {21F1A5E2-9861-49A6-934D-DF5AAA03AFFE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {03A4D8D2-2C1B-4488-8442-698D88093522} diff --git a/examples/Triangle.Desktop/Program.cs b/examples/Triangle.Desktop/Program.cs new file mode 100644 index 0000000000..f538cdf837 --- /dev/null +++ b/examples/Triangle.Desktop/Program.cs @@ -0,0 +1,13 @@ +using System; +using Triangle.OpenGL; + +namespace Triangle.Desktop +{ + class Program + { + static void Main(string[] args) + { + TriangleDesktop.Run(); + } + } +} diff --git a/examples/Triangle.Desktop/Triangle.Desktop.csproj b/examples/Triangle.Desktop/Triangle.Desktop.csproj new file mode 100644 index 0000000000..0de660104e --- /dev/null +++ b/examples/Triangle.Desktop/Triangle.Desktop.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.0 + + + + + + + diff --git a/examples/Triangle/Program.cs b/examples/Triangle/OpenGL/TriangleDesktop.cs similarity index 97% rename from examples/Triangle/Program.cs rename to examples/Triangle/OpenGL/TriangleDesktop.cs index 4537ae70f6..551991f0e5 100644 --- a/examples/Triangle/Program.cs +++ b/examples/Triangle/OpenGL/TriangleDesktop.cs @@ -6,9 +6,9 @@ using Silk.NET.Windowing; using Silk.NET.Windowing.Common; -namespace Triangle +namespace Triangle.OpenGL { - public static class Program + public static class TriangleDesktop { private static readonly float[] _vertices = { @@ -42,7 +42,7 @@ public static class Program " gl_Position = vec4(aPosition, 1.0);\n" + "}\n"; - public static void Main(string[] args) + public static void Run() { _window = Window.Create(WindowOptions.Default); _window.Load += Load; diff --git a/examples/Triangle/OpenGLES/TriangleMobile.cs b/examples/Triangle/OpenGLES/TriangleMobile.cs new file mode 100644 index 0000000000..27bff501d8 --- /dev/null +++ b/examples/Triangle/OpenGLES/TriangleMobile.cs @@ -0,0 +1,124 @@ +using System; +using System.Drawing; +using Silk.NET.Input; +using Silk.NET.Input.Common; +using Silk.NET.OpenGLES; +using Silk.NET.Windowing; +using Silk.NET.Windowing.Common; + +namespace Triangle.OpenGLES +{ + public static class TriangleMobile + { + private static readonly float[] _vertices = + { + -0.5f, -0.5f, 0.0f, + 0.5f, -0.5f, 0.0f, + 0.0f, 0.5f, 0.0f + }; + + private static uint _vertexBufferObject; + private static uint _vertexArrayObject; + private static uint _shader; + private static GL _gl; + private static IInputContext _input; + private static IWindow _window; + + private const string VertexShader = "#version 330\n\n" + + + "out vec4 outputColor;\n\n" + + + "void main()\n" + + "{\n" + + " outputColor = vec4(1.0, 1.0, 0.0, 1.0);\n" + + "}\n"; + + private const string FragmentShader = "#version 330 core\n\n" + + + "layout(location = 0) in vec3 aPosition;\n\n" + + + "void main(void)\n" + + "{\n" + + " gl_Position = vec4(aPosition, 1.0);\n" + + "}\n"; + + public static void Run() + { + _window = Window.Create(WindowOptions.Default); + _window.Load += Load; + _window.Render += RenderFrame; + _window.Update += UpdateFrame; + _window.Resize += Resize; + _window.Run(); + End(); + } + + private static unsafe void Load() + { + _gl ??= GL.GetApi(); + var vertShader = _gl.CreateShader(GLEnum.VertexShader); + var fragShader = _gl.CreateShader(GLEnum.FragmentShader); + _gl.ShaderSource(vertShader, VertexShader); + _gl.ShaderSource(fragShader, FragmentShader); + _gl.CompileShader(vertShader); + _gl.CompileShader(fragShader); + _shader = _gl.CreateProgram(); + _gl.AttachShader(_shader, vertShader); + _gl.AttachShader(_shader, fragShader); + _gl.LinkProgram(_shader); + _gl.DetachShader(_shader, vertShader); + _gl.DetachShader(_shader, fragShader); + _gl.DeleteShader(fragShader); + _gl.DeleteShader(vertShader); + _gl.ClearColor(0.2f, 0.3f, 0.3f, 1.0f); + _vertexBufferObject = _gl.GenBuffer(); + _gl.BindBuffer(GLEnum.ArrayBuffer, _vertexBufferObject); + fixed (void* vertices = _vertices) + { + _gl.BufferData(GLEnum.ArrayBuffer, (uint) _vertices.Length * sizeof(float), vertices, GLEnum.StaticDraw); + } + + _vertexArrayObject = _gl.GenVertexArray(); + _gl.BindVertexArray(_vertexArrayObject); + _gl.VertexAttribPointer(0, 3, GLEnum.Float, false, 3 * sizeof(float), 0); + _gl.EnableVertexAttribArray(0); + _gl.BindBuffer(GLEnum.ArrayBuffer, _vertexBufferObject); + Console.WriteLine("done load"); + } + + + private static void RenderFrame(double delta) + { + _gl.Clear((uint)GLEnum.ColorBufferBit); + _gl.UseProgram(_shader); + _gl.BindVertexArray(_vertexArrayObject); + _gl.DrawArrays(GLEnum.Triangles, 0, 3); + } + + + private static void UpdateFrame(double delta) + { + _input ??= _window.GetInput(); + if (_input.Keyboards[0].IsKeyPressed(Key.Escape)) + { + _window.Close(); + } + } + + private static void Resize(Size size) + { + _gl.Viewport(0, 0, (uint) size.Width, (uint) size.Height); + Console.WriteLine("done resize"); + } + + private static void End() + { + _gl.BindBuffer(GLEnum.ArrayBuffer, 0); + _gl.BindVertexArray(0); + _gl.UseProgram(0); + _gl.DeleteBuffer(_vertexBufferObject); + _gl.DeleteVertexArray(_vertexArrayObject); + _gl.DeleteProgram(_shader); + } + } +} diff --git a/examples/Triangle/Triangle.csproj b/examples/Triangle/Triangle.csproj index cb41c6370f..92d3a4ffbe 100644 --- a/examples/Triangle/Triangle.csproj +++ b/examples/Triangle/Triangle.csproj @@ -1,8 +1,7 @@  - Exe - netcoreapp3 + netstandard2 true 8 @@ -11,6 +10,7 @@ + diff --git a/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs b/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs index 19bca04f7f..8c89949064 100644 --- a/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs +++ b/src/Windowing/Silk.NET.Windowing.Android/AndroidPlatform.cs @@ -16,7 +16,21 @@ public IWindow GetWindow(WindowOptions options) { throw new NotSupportedException("Multiple windows are not supported on Android."); } + + if (Activity == null) + { + throw new InvalidOperationException + ( + "AndroidPlatform has not been initialized. To initialize it, pass the current Activity " + + "as an argument to Window.Init(Activity)" + ); + } return Current = new AndroidWindow(Activity, options); } + + public static void Init(Activity activity) + { + Activity = activity; + } } } diff --git a/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs b/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs index 664559a3e0..774d362c05 100644 --- a/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs +++ b/src/Windowing/Silk.NET.Windowing.Android/AndroidWindow.cs @@ -14,7 +14,6 @@ using Android.Runtime; using Android.Views; using Silk.NET.Windowing.Common; -using static Android.Opengl.EGL14; using Point = System.Drawing.Point; using Size = System.Drawing.Size; @@ -36,34 +35,70 @@ public class AndroidWindow : SurfaceView, IWindow, ISurfaceHolderCallback private double _renderPeriod; private EGLDisplay _display; private EGLSurface _surface; - private static readonly int[] _attribs = { - EglSurfaceType, EglWindowBit, - EglBlueSize, 8, - EglGreenSize, 8, - EglRedSize, 8, - EglNone - }; - private EGLConfig _config; + private AutoResetEvent _runEvent; + private ISurfaceHolder _holder; + private VSyncMode _vsync; + private static readonly int[] Attribs = + { + EGL14.EglSurfaceType, EGL14.EglWindowBit, + EGL14.EglBlueSize, 8, + EGL14.EglGreenSize, 8, + EGL14.EglRedSize, 8, + EGL14.EglNone + }; // IWindow public bool IsVisible { get; set; } public bool UseSingleThreadedWindow { get; } + public Point Position { get => default; - set {} + set { } } public unsafe Size Size { - get => Handle == IntPtr.Zero ? new Size(Android.GetWidth(_windowPtr), Android.GetHeight(_windowPtr)) : default; + get => Handle == IntPtr.Zero + ? new Size(Android.GetWidth(_windowPtr), Android.GetHeight(_windowPtr)) + : default; set { } } - public double FramesPerSecond { get; set; } - public double UpdatesPerSecond { get; set; } + /// + public double FramesPerSecond + { + get => 1.0 / _renderPeriod; + set + { + if (value <= double.Epsilon) + { + _renderPeriod = 0.0; + return; + } + + _renderPeriod = 1.0 / value; + } + } + + /// + public double UpdatesPerSecond + { + get => 1.0 / _updatePeriod; + set + { + if (value <= double.Epsilon) + { + _updatePeriod = 0.0; + return; + } + + _updatePeriod = 1.0 / value; + } + } + public GraphicsAPI API { get; } public string Title { get; set; } @@ -79,66 +114,104 @@ public WindowBorder WindowBorder set { } } - public VSyncMode VSync { get; set; } + public VSyncMode VSync + { + get => _vsync; + set + { + if (_running) + { + switch (value) + { + case VSyncMode.Off: + { + EGL14.EglSwapInterval(_display, 0); + break; + } + case VSyncMode.On: + { + EGL14.EglSwapInterval(_display, 1); + break; + } + case VSyncMode.Adaptive: + { + EGL14.EglSwapInterval(_display, IsRunningSlowly ? 0 : 1); + break; + } + default: + throw new ArgumentOutOfRangeException(nameof(value), value, null); + } + } + + _vsync = value; + } + } + public int RunningSlowTolerance { get; set; } - public event Action Move; + public event Action Move; // never called public event Action Resize; public event Action Closing; - public event Action StateChanged; - public event Action FocusChanged; - public event Action FileDrop; + public event Action StateChanged; // never called + public event Action FocusChanged; // todo + public event Action FileDrop; // never called public event Action Load; public event Action Update; public event Action Render; - public unsafe IntPtr Handle => (IntPtr) _windowPtr; - public bool IsRunningSlowly { get; } + unsafe IntPtr IWindow.Handle => (IntPtr) _windowPtr; + public bool IsRunningSlowly => _isRunningSlowlyTries > RunningSlowTolerance; + public unsafe void Run() { _running = true; - + _runEvent.WaitOne(); + _windowPtr = Android.CreateNativeWindow(JNIEnv.Handle, _holder.Surface.Handle); _invokeQueue = new ConcurrentQueue(); _mainThread = Thread.CurrentThread.ManagedThreadId; - if ((_display = EglGetDisplay(EglDefaultDisplay)) == EglNoDisplay) + if ((_display = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay)) == EGL14.EglNoDisplay) { - throw new EglException("Couldn't get the default display, error code " + EglGetError()); + throw new EglException("Couldn't get the default display, error code " + EGL14.EglGetError()); } - if (!EglInitialize(_display, null, 0, null, 0)) + if (!EGL14.EglInitialize(_display, null, 0, null, 0)) { - throw new EglException("Couldn't initialize, error code " + EglGetError()); + throw new EglException("Couldn't initialize, error code " + EGL14.EglGetError()); } var configs = new EGLConfig[1]; var numConfigs = new int[1]; - if (!EglChooseConfig(_display, _attribs, 0, configs, 0, 1, numConfigs, 0)) { - throw new EglException("Couldn't choose config, error code " + EglGetError()); + if (!EGL14.EglChooseConfig(_display, Attribs, 0, configs, 0, 1, numConfigs, 0)) + { + throw new EglException("Couldn't choose config, error code " + EGL14.EglGetError()); } _config = configs[0]; var formats = new int[1]; - if (!EglGetConfigAttrib(_display, _config, EglNativeVisualId, formats, 0)) { - throw new EglException("Couldn't get config attribute, error code " + EglGetError()); + if (!EGL14.EglGetConfigAttrib(_display, _config, EGL14.EglNativeVisualId, formats, 0)) + { + throw new EglException("Couldn't get config attribute, error code " + EGL14.EglGetError()); } Android.SetBuffersGeometry(_windowPtr, 0, 0, formats[0]); - var win = new Java.Lang.Object((IntPtr)_windowPtr, JniHandleOwnership.DoNotTransfer); + var win = new Java.Lang.Object((IntPtr) _windowPtr, JniHandleOwnership.DoNotTransfer); - if ((_surface = EglCreateWindowSurface(_display, _config, win, null, 0)) == EglNoSurface) { - throw new EglException("Couldn't create surface, error code " + EglGetError()); + if ((_surface = EGL14.EglCreateWindowSurface(_display, _config, win, null, 0)) == EGL14.EglNoSurface) + { + throw new EglException("Couldn't create surface, error code " + EGL14.EglGetError()); } - - if ((_context = EglCreateContext(_display, _config, EglNoContext, null, 0)) == EglNoContext) { - throw new EglException("Couldn't create context, error code " + EglGetError()); + + if ((_context = EGL14.EglCreateContext(_display, _config, EGL14.EglNoContext, null, 0)) == + EGL14.EglNoContext) + { + throw new EglException("Couldn't create context, error code " + EGL14.EglGetError()); } - - if (!EglMakeCurrent(_display, _surface, _surface, _context)) { - throw new EglException("Couldn't make context current, error code " + EglGetError()); + + if (!EGL14.EglMakeCurrent(_display, _surface, _surface, _context)) + { + throw new EglException("Couldn't make context current, error code " + EGL14.EglGetError()); } - - // todo vsync - InitializeCallbacks(); + VSync = _vsync; // inform EGL about the VSync preference // Run OnLoad. Load?.Invoke(); @@ -152,10 +225,8 @@ public unsafe void Run() _mainThread = Thread.CurrentThread.ManagedThreadId; // Start the update loop. - while (!_windowShouldClose && !AndroidPlatform.Activity.IsFinishing) + while (!_windowShouldClose) { - // TODO events - if (UseSingleThreadedWindow) { RaiseUpdateFrame(); @@ -164,7 +235,7 @@ public unsafe void Run() else { // Raise UpdateFrame, but don't await it yet. - var task = Task.Run((Action)RaiseUpdateFrame); // cast to action, ambiguous call + var task = Task.Run((Action) RaiseUpdateFrame); // cast to action, ambiguous call // Loop while we're still updating - the Update thread might be calling the main thread while (!task.IsCompleted) @@ -181,45 +252,58 @@ public unsafe void Run() if (VSync == VSyncMode.Adaptive) { - EglSwapInterval(_display, IsRunningSlowly ? 0 : 1); + EGL14.EglSwapInterval(_display, IsRunningSlowly ? 0 : 1); } } + EGL14.EglDestroyContext(_display, _context); + EGL14.EglDestroySurface(_display, _surface); + EGL14.EglTerminate(_display); + Android.ReleaseNativeWindow(_windowPtr); + _holder.Surface.Release(); _running = false; } - private void InitializeCallbacks() - { - throw new NotImplementedException(); - } - public void Close() { - throw new NotImplementedException(); + _windowShouldClose = true; } public Point PointToClient(Point point) { - throw new NotImplementedException(); + return point; } public Point PointToScreen(Point point) { - throw new NotImplementedException(); + return point; } public object Invoke(Delegate d) { - throw new NotImplementedException(); + return Invoke(d, new object[0]); } public object Invoke(Delegate d, params object[] args) { - throw new NotImplementedException(); + if (!_running) + { + throw new InvalidOperationException("The window must be running to be able to invoke it."); + } + + if (Thread.CurrentThread.ManagedThreadId == _mainThread) + { + return d.DynamicInvoke(args); + } + + var task = new Task(() => d.DynamicInvoke(args)); + _invokeQueue.Enqueue(task); + SpinWait.SpinUntil(() => task.IsCompleted); + return task.Result; } - + // Implementation - + /// /// Run an OnUpdate event. /// @@ -271,49 +355,56 @@ private void RaiseRenderFrame() var delta = _renderStopwatch.Elapsed.TotalSeconds; Render?.Invoke(delta); - if (!EglSwapBuffers(_display, _surface)) + if (!EGL14.EglSwapBuffers(_display, _surface)) { - throw new EglException("Couldn't swap buffers, error code " + EglGetError()); + throw new EglException("Couldn't swap buffers, error code " + EGL14.EglGetError()); } + _renderStopwatch.Restart(); // This has to be called on the thread with the graphics context if (VSync == VSyncMode.Adaptive) { - EglSwapInterval(EglGetCurrentDisplay(), IsRunningSlowly ? 0 : 1); + EGL14.EglSwapInterval(EGL14.EglGetCurrentDisplay(), IsRunningSlowly ? 0 : 1); } } - + // SurfaceView - public void Dispose() + void IDisposable.Dispose() { - throw new NotImplementedException(); } public void SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height) { - throw new NotImplementedException(); + Resize?.Invoke(new Size(width, height)); } public void SurfaceCreated(ISurfaceHolder holder) { - throw new NotImplementedException(); + _holder = holder; + _runEvent.Set(); } public void SurfaceDestroyed(ISurfaceHolder holder) { - throw new NotImplementedException(); + _windowShouldClose = true; + Closing?.Invoke(); } - [Register(".ctor", "(Landroid/content/Context;)V", "")] public AndroidWindow(Context context, WindowOptions opts) : base(context) { - // todo opts + _runEvent = new AutoResetEvent(false); + UseSingleThreadedWindow = opts.UseSingleThreadedWindow; + RunningSlowTolerance = opts.RunningSlowTolerance; + _vsync = opts.VSync; + API = opts.API; } } public class EglException : Exception { - public EglException(string str) : base(str){} + public EglException(string str) : base(str) + { + } } } diff --git a/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj b/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj index e77a782135..bcd0de95f0 100644 --- a/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj +++ b/src/Windowing/Silk.NET.Windowing.Android/Silk.NET.Windowing.Android.csproj @@ -1,16 +1,61 @@ - + + - monoandroid90 + Debug + AnyCPU + 8.0.30703 + 2.0 + {B82877C4-FCDF-4385-BBA3-14A09D264B2C} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + ClassLibrary1 + ClassLibrary1 + 512 + Resources\Resource.Designer.cs + Off + True + v5.0 true + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + - - + - - - - - + + + {a8dfea18-e880-4303-bbce-0f27ee214d44} + Silk.NET.Windowing.Common + + + + + \ No newline at end of file diff --git a/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj b/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj index 4a313fcee6..c28766b698 100644 --- a/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj +++ b/src/Windowing/Silk.NET.Windowing/Silk.NET.Windowing.csproj @@ -1,18 +1,22 @@ - + - netstandard2.0;xamarin.android90 + xamarin.android90;netstandard2.0; - + - + + + + + diff --git a/src/Windowing/Silk.NET.Windowing/Window.cs b/src/Windowing/Silk.NET.Windowing/Window.cs index 3cfad78d7e..535229025b 100644 --- a/src/Windowing/Silk.NET.Windowing/Window.cs +++ b/src/Windowing/Silk.NET.Windowing/Window.cs @@ -46,7 +46,7 @@ public static void Init() return; } #elif XAMARIN_ANDROID - var androidPlatform = new Windowing.Android.AndroidPlatform(); + var androidPlatform = new Android.AndroidPlatform(); if (androidPlatform.IsApplicable) { SilkManager.Register(androidPlatform); @@ -57,17 +57,5 @@ public static void Init() throw new NotSupportedException("Couldn't find a suitable windowing platform."); } } - -#if XAMARIN_ANDROID - /// - /// Attempts to resolve an equipped to use the given - /// - /// The activity to use. - public static void Init(global::Android.App.Activity activity) - { - Android.AndroidPlatform.Activity = activity; - Init(); - } -#endif } }