From 0705d55186238518e846f2fe572e71b06bb147d6 Mon Sep 17 00:00:00 2001 From: Beyley Thomas Date: Tue, 17 Jan 2023 23:13:25 -0800 Subject: [PATCH 1/7] Implement ImGui glyph ranges into the OpenGL ImGui controller (#1111) * Implement ImGui glyph ranges into the OpenGL ImGui controller * Formatting and fix public API in ImGuiController * More public API fixes Co-authored-by: Dylan Perks <11160611+Perksey@users.noreply.github.com> --- .../ImGuiController.cs | 85 ++++++++++--------- .../ImGuiFontConfig.cs | 10 ++- .../PublicAPI/net5.0/PublicAPI.Shipped.txt | 1 - .../PublicAPI/net5.0/PublicAPI.Unshipped.txt | 2 + .../netcoreapp3.1/PublicAPI.Shipped.txt | 1 - .../netcoreapp3.1/PublicAPI.Unshipped.txt | 2 + .../netstandard2.0/PublicAPI.Shipped.txt | 1 - .../netstandard2.0/PublicAPI.Unshipped.txt | 2 + .../netstandard2.1/PublicAPI.Shipped.txt | 1 - .../netstandard2.1/PublicAPI.Unshipped.txt | 2 + .../Shader.cs | 7 +- .../Texture.cs | 37 ++++---- .../Silk.NET.OpenGL.Extensions.ImGui/Util.cs | 3 + .../PublicAPI/net5.0/PublicAPI.Shipped.txt | 1 - .../PublicAPI/net5.0/PublicAPI.Unshipped.txt | 2 + .../netcoreapp3.1/PublicAPI.Shipped.txt | 1 - .../netcoreapp3.1/PublicAPI.Unshipped.txt | 2 + .../netstandard2.0/PublicAPI.Shipped.txt | 1 - .../netstandard2.0/PublicAPI.Unshipped.txt | 2 + .../netstandard2.1/PublicAPI.Shipped.txt | 1 - .../netstandard2.1/PublicAPI.Unshipped.txt | 2 + .../PublicAPI/net5.0/PublicAPI.Shipped.txt | 1 - .../PublicAPI/net5.0/PublicAPI.Unshipped.txt | 2 + .../netcoreapp3.1/PublicAPI.Shipped.txt | 1 - .../netcoreapp3.1/PublicAPI.Unshipped.txt | 2 + .../netstandard2.0/PublicAPI.Shipped.txt | 1 - .../netstandard2.0/PublicAPI.Unshipped.txt | 2 + .../netstandard2.1/PublicAPI.Shipped.txt | 1 - .../netstandard2.1/PublicAPI.Unshipped.txt | 2 + 29 files changed, 105 insertions(+), 73 deletions(-) diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs index 8302b082e6..28c440bbc0 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + using System; using System.Collections.Generic; using System.Drawing; @@ -63,14 +66,14 @@ public ImGuiController(GL gl, IView view, IInputContext input) : this(gl, view, public ImGuiController(GL gl, IView view, IInputContext input, ImGuiFontConfig imGuiFontConfig) : this(gl, view, input, imGuiFontConfig, null) { } - + /// /// Constructs a new ImGuiController with an onConfigureIO Action. /// public ImGuiController(GL gl, IView view, IInputContext input, Action onConfigureIO) : this(gl, view, input, null, onConfigureIO) { } - + /// /// Constructs a new ImGuiController with font configuration and onConfigure Action. /// @@ -81,7 +84,9 @@ public ImGuiController(GL gl, IView view, IInputContext input, ImGuiFontConfig? var io = ImGuiNET.ImGui.GetIO(); if (imGuiFontConfig is not null) { - io.Fonts.AddFontFromFileTTF(imGuiFontConfig.Value.FontPath, imGuiFontConfig.Value.FontSize); + var glyphRange = imGuiFontConfig.Value.GetGlyphRange?.Invoke(io) ?? default(IntPtr); + + io.Fonts.AddFontFromFileTTF(imGuiFontConfig.Value.FontPath, imGuiFontConfig.Value.FontSize, null, glyphRange); } onConfigureIO?.Invoke(); @@ -98,7 +103,7 @@ public ImGuiController(GL gl, IView view, IInputContext input, ImGuiFontConfig? public void MakeCurrent() { - ImGuiNET.ImGui.SetCurrentContext(this.Context); + ImGuiNET.ImGui.SetCurrentContext(Context); } private void Init(GL gl, IView view, IInputContext input) @@ -146,16 +151,16 @@ public void Render() { var oldCtx = ImGuiNET.ImGui.GetCurrentContext(); - if (oldCtx != this.Context) + if (oldCtx != Context) { - ImGuiNET.ImGui.SetCurrentContext(this.Context); + ImGuiNET.ImGui.SetCurrentContext(Context); } - + _frameBegun = false; ImGuiNET.ImGui.Render(); RenderImDrawData(ImGuiNET.ImGui.GetDrawData()); - - if (oldCtx != this.Context) + + if (oldCtx != Context) { ImGuiNET.ImGui.SetCurrentContext(oldCtx); } @@ -169,11 +174,11 @@ public void Update(float deltaSeconds) { var oldCtx = ImGuiNET.ImGui.GetCurrentContext(); - if (oldCtx != this.Context) + if (oldCtx != Context) { - ImGuiNET.ImGui.SetCurrentContext(this.Context); + ImGuiNET.ImGui.SetCurrentContext(Context); } - + if (_frameBegun) { ImGuiNET.ImGui.Render(); @@ -184,8 +189,8 @@ public void Update(float deltaSeconds) _frameBegun = true; ImGuiNET.ImGui.NewFrame(); - - if (oldCtx != this.Context) + + if (oldCtx != Context) { ImGuiNET.ImGui.SetCurrentContext(oldCtx); } @@ -209,7 +214,7 @@ private void SetPerFrameImGuiData(float deltaSeconds) io.DeltaTime = deltaSeconds; // DeltaTime is in seconds. } - private static Key[] keyEnumArr = (Key[]) Enum.GetValues(typeof(Key)); + private static Key[] keyEnumArr = (Key[]) Enum.GetValues(typeof(Key)); private void UpdateImGuiInput() { var io = ImGuiNET.ImGui.GetIO(); @@ -289,10 +294,10 @@ private unsafe void SetupRenderState(ImDrawDataPtr drawDataPtr, int framebufferW _gl.Disable(GLEnum.DepthTest); _gl.Disable(GLEnum.StencilTest); _gl.Enable(GLEnum.ScissorTest); - #if !GLES && !LEGACY +#if !GLES && !LEGACY _gl.Disable(GLEnum.PrimitiveRestart); _gl.PolygonMode(GLEnum.FrontAndBack, GLEnum.Fill); - #endif +#endif float L = drawDataPtr.DisplayPos.X; float R = drawDataPtr.DisplayPos.X + drawDataPtr.DisplaySize.X; @@ -350,11 +355,11 @@ private unsafe void RenderImDrawData(ImDrawDataPtr drawDataPtr) _gl.GetInteger(GLEnum.ArrayBufferBinding, out int lastArrayBuffer); _gl.GetInteger(GLEnum.VertexArrayBinding, out int lastVertexArrayObject); - #if !GLES +#if !GLES Span lastPolygonMode = stackalloc int[2]; _gl.GetInteger(GLEnum.PolygonMode, lastPolygonMode); - #endif - +#endif + Span lastScissorBox = stackalloc int[4]; _gl.GetInteger(GLEnum.ScissorBox, lastScissorBox); @@ -373,10 +378,10 @@ private unsafe void RenderImDrawData(ImDrawDataPtr drawDataPtr) bool lastEnableStencilTest = _gl.IsEnabled(GLEnum.StencilTest); bool lastEnableScissorTest = _gl.IsEnabled(GLEnum.ScissorTest); - #if !GLES && !LEGACY +#if !GLES && !LEGACY bool lastEnablePrimitiveRestart = _gl.IsEnabled(GLEnum.PrimitiveRestart); - #endif - +#endif + SetupRenderState(drawDataPtr, framebufferWidth, framebufferHeight); // Will project scissor/clipping rectangles into framebuffer space @@ -429,7 +434,7 @@ private unsafe void RenderImDrawData(ImDrawDataPtr drawDataPtr) } // Destroy the temporary VAO - _gl.DeleteVertexArray(_vertexArrayObject); + _gl.DeleteVertexArray(_vertexArrayObject); _vertexArrayObject = 0; // Restore modified GL state @@ -489,8 +494,8 @@ private unsafe void RenderImDrawData(ImDrawDataPtr drawDataPtr) { _gl.Disable(GLEnum.ScissorTest); } - - #if !GLES && !LEGACY + +#if !GLES && !LEGACY if (lastEnablePrimitiveRestart) { _gl.Enable(GLEnum.PrimitiveRestart); @@ -501,8 +506,8 @@ private unsafe void RenderImDrawData(ImDrawDataPtr drawDataPtr) } _gl.PolygonMode(GLEnum.FrontAndBack, (GLEnum) lastPolygonMode[0]); - #endif - +#endif + _gl.Scissor(lastScissorBox[0], lastScissorBox[1], (uint) lastScissorBox[2], (uint) lastScissorBox[3]); } @@ -515,7 +520,7 @@ private void CreateDeviceResources() _gl.GetInteger(GLEnum.VertexArrayBinding, out int lastVertexArray); string vertexSource = - #if GLES +#if GLES @"#version 300 es precision highp float; @@ -531,7 +536,7 @@ void main() Frag_Color = Color; gl_Position = ProjMtx * vec4(Position.xy,0.0,1.0); }"; - #elif GL +#elif GL @"#version 330 layout (location = 0) in vec2 Position; layout (location = 1) in vec2 UV; @@ -545,7 +550,7 @@ void main() Frag_Color = Color; gl_Position = ProjMtx * vec4(Position.xy,0,1); }"; - #elif LEGACY +#elif LEGACY @"#version 110 attribute vec2 Position; attribute vec2 UV; @@ -562,11 +567,11 @@ void main() Frag_Color = Color; gl_Position = ProjMtx * vec4(Position.xy,0,1); }"; - #endif +#endif - string fragmentSource = - #if GLES + string fragmentSource = +#if GLES @"#version 300 es precision highp float; @@ -578,7 +583,7 @@ void main() { Out_Color = Frag_Color * texture(Texture, Frag_UV.st); }"; - #elif GL +#elif GL @"#version 330 in vec2 Frag_UV; in vec4 Frag_Color; @@ -588,7 +593,7 @@ void main() { Out_Color = Frag_Color * texture(Texture, Frag_UV.st); }"; - #elif LEGACY +#elif LEGACY @"#version 110 varying vec2 Frag_UV; varying vec4 Frag_Color; @@ -599,7 +604,7 @@ void main() { gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st); }"; - #endif +#endif _shader = new Shader(_gl, vertexSource, fragmentSource); @@ -634,7 +639,7 @@ private unsafe void RecreateFontDeviceTexture() // Upload texture to graphics system _gl.GetInteger(GLEnum.TextureBinding2D, out int lastTexture); - + _fontTexture = new Texture(_gl, width, height, pixels); _fontTexture.Bind(); _fontTexture.SetMagFilter(TextureMagFilter.Linear); @@ -661,8 +666,8 @@ public void Dispose() _fontTexture.Dispose(); _shader.Dispose(); - - ImGuiNET.ImGui.DestroyContext(this.Context); + + ImGuiNET.ImGui.DestroyContext(Context); } } } diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiFontConfig.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiFontConfig.cs index e03cbd8e5e..38674e53c8 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiFontConfig.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiFontConfig.cs @@ -1,4 +1,8 @@ -using System; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using ImGuiNET; #if GL namespace Silk.NET.OpenGL.Extensions.ImGui @@ -10,14 +14,16 @@ namespace Silk.NET.OpenGL.Legacy.Extensions.ImGui { public readonly struct ImGuiFontConfig { - public ImGuiFontConfig(string fontPath, int fontSize) + public ImGuiFontConfig(string fontPath, int fontSize, Func getGlyphRange = null) { if (fontSize <= 0) throw new ArgumentOutOfRangeException(nameof(fontSize)); FontPath = fontPath ?? throw new ArgumentNullException(nameof(fontPath)); FontSize = fontSize; + GetGlyphRange = getGlyphRange; } public string FontPath { get; } public int FontSize { get; } + public Func GetGlyphRange { get; } } } diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt index 7ccc0bc45b..3c69e8420f 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenGL. ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt index 32db72dcb1..eec5039959 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 7ccc0bc45b..3c69e8420f 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenGL. ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt index 32db72dcb1..eec5039959 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt index 7ccc0bc45b..3c69e8420f 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenGL. ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 32db72dcb1..eec5039959 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt index 7ccc0bc45b..3c69e8420f 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenGL. ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt index 32db72dcb1..eec5039959 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Shader.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Shader.cs index 5994bc30a4..59acfec44b 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Shader.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Shader.cs @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + using System; using System.Collections.Generic; using System.Diagnostics; @@ -94,7 +97,7 @@ public int GetUniformLocation(string uniform) Debug.Print($"The uniform '{uniform}' does not exist in the shader!"); } } - + return location; } @@ -160,7 +163,7 @@ private uint CompileShader(ShaderType type, string source) string info = _gl.GetShaderInfoLog(shader); Debug.WriteLine($"GL.CompileShader for shader [{type}] had info log:\n{info}"); } - + return shader; } } diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Texture.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Texture.cs index b885f8ad34..cdec760fb4 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Texture.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Texture.cs @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + using System; #if GLES using Silk.NET.OpenGLES; @@ -24,10 +27,10 @@ public enum TextureCoordinate class Texture : IDisposable { - public const SizedInternalFormat Srgb8Alpha8 = (SizedInternalFormat)GLEnum.Srgb8Alpha8; - public const SizedInternalFormat Rgb32F = (SizedInternalFormat)GLEnum.Rgb32f; + public const SizedInternalFormat Srgb8Alpha8 = (SizedInternalFormat) GLEnum.Srgb8Alpha8; + public const SizedInternalFormat Rgb32F = (SizedInternalFormat) GLEnum.Rgb32f; - public const GLEnum MaxTextureMaxAnisotropy = (GLEnum)0x84FF; + public const GLEnum MaxTextureMaxAnisotropy = (GLEnum) 0x84FF; public static float? MaxAniso; private readonly GL _gl; @@ -44,26 +47,26 @@ public unsafe Texture(GL gl, int width, int height, IntPtr data, bool generateMi Width = (uint) width; Height = (uint) height; InternalFormat = srgb ? Srgb8Alpha8 : SizedInternalFormat.Rgba8; - MipmapLevels = (uint) (generateMipmaps == false ? 1 : (int)Math.Floor(Math.Log(Math.Max(Width, Height), 2))); + MipmapLevels = (uint) (generateMipmaps == false ? 1 : (int) Math.Floor(Math.Log(Math.Max(Width, Height), 2))); GlTexture = _gl.GenTexture(); Bind(); - #if GLES || LEGACY +#if GLES || LEGACY PixelFormat pxFormat = PixelFormat.Rgba; - #elif GL +#elif GL PixelFormat pxFormat = PixelFormat.Bgra; - #endif - +#endif + _gl.TexStorage2D(GLEnum.Texture2D, MipmapLevels, InternalFormat, Width, Height); _gl.TexSubImage2D(GLEnum.Texture2D, 0, 0, 0, Width, Height, pxFormat, PixelType.UnsignedByte, (void*) data); if (generateMipmaps) - #if GLES +#if GLES _gl.GenerateMipmap(GLEnum.Texture2D); - #elif GL +#elif GL _gl.GenerateTextureMipmap(GlTexture); - #endif +#endif SetWrap(TextureCoordinate.S, TextureWrapMode.Repeat); SetWrap(TextureCoordinate.T, TextureWrapMode.Repeat); @@ -77,18 +80,18 @@ public void Bind() public void SetMinFilter(TextureMinFilter filter) { - _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMinFilter, (int)filter); + _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMinFilter, (int) filter); } public void SetMagFilter(TextureMagFilter filter) { - _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMagFilter, (int)filter); + _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMagFilter, (int) filter); } public void SetAnisotropy(float level) { - const TextureParameterName textureMaxAnisotropy = (TextureParameterName)0x84FE; - _gl.TexParameter(GLEnum.Texture2D, (GLEnum)textureMaxAnisotropy, Util.Clamp(level, 1, MaxAniso.GetValueOrDefault())); + const TextureParameterName textureMaxAnisotropy = (TextureParameterName) 0x84FE; + _gl.TexParameter(GLEnum.Texture2D, (GLEnum) textureMaxAnisotropy, Util.Clamp(level, 1, MaxAniso.GetValueOrDefault())); } public void SetLod(int @base, int min, int max) @@ -97,10 +100,10 @@ public void SetLod(int @base, int min, int max) _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMinLod, min); _gl.TexParameterI(GLEnum.Texture2D, TextureParameterName.TextureMaxLod, max); } - + public void SetWrap(TextureCoordinate coord, TextureWrapMode mode) { - _gl.TexParameterI(GLEnum.Texture2D, (TextureParameterName)coord, (int)mode); + _gl.TexParameterI(GLEnum.Texture2D, (TextureParameterName) coord, (int) mode); } public void Dispose() diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Util.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Util.cs index d918208b16..33c93d0e8a 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Util.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/Util.cs @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + using System.Diagnostics; using System.Diagnostics.Contracts; #if GLES diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt index 9b3022efe9..4a2e7f44fd 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Legacy.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET. ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt index 1d4497055f..169be1b531 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 9b3022efe9..4a2e7f44fd 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Legacy.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET. ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt index 1d4497055f..169be1b531 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt index 9b3022efe9..4a2e7f44fd 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Legacy.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET. ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 1d4497055f..169be1b531 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt index 9b3022efe9..4a2e7f44fd 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGL.Legacy.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET. ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGL.Legacy.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt index 1d4497055f..169be1b531 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Legacy.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGL.Legacy.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt index 6be7a83239..329be71dbb 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGLES.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenG ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt index 9f706fb24f..13874b9269 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/net5.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 6be7a83239..329be71dbb 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGLES.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenG ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt index 9f706fb24f..13874b9269 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt index 6be7a83239..329be71dbb 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGLES.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenG ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 9f706fb24f..13874b9269 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt index 6be7a83239..329be71dbb 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt @@ -15,4 +15,3 @@ Silk.NET.OpenGLES.Extensions.ImGui.TextureCoordinate.T = 10243 -> Silk.NET.OpenG ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig? imGuiFontConfig = null, System.Action onConfigureIO = null) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.ImGuiController(Silk.NET.OpenGLES.GL gl, Silk.NET.Windowing.IView view, Silk.NET.Input.IInputContext input, System.Action onConfigureIO) -> void ~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.FontPath.get -> string -~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize) -> void diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt index 9f706fb24f..13874b9269 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt +++ b/src/OpenGL/Extensions/Silk.NET.OpenGLES.Extensions.ImGui/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ #nullable enable Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.Context -> System.IntPtr Silk.NET.OpenGLES.Extensions.ImGui.ImGuiController.MakeCurrent() -> void +~Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.ImGuiFontConfig(string fontPath, int fontSize, System.Func getGlyphRange = null) -> void +Silk.NET.OpenGLES.Extensions.ImGui.ImGuiFontConfig.GetGlyphRange.get -> System.Func From 9e073a6e51ab19618c15aa2bc5f852373ee1ef74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:38:13 +0000 Subject: [PATCH 2/7] Bump Microsoft.CodeAnalysis.PublicApiAnalyzers from 3.3.3 to 3.3.4 (#1243) Bumps [Microsoft.CodeAnalysis.PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/main/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/v3.3.3...v3.3.4) --- updated-dependencies: - dependency-name: Microsoft.CodeAnalysis.PublicApiAnalyzers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build/props/common.props | 2 +- src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/props/common.props b/build/props/common.props index bccd344eab..909e8124b9 100644 --- a/build/props/common.props +++ b/build/props/common.props @@ -122,7 +122,7 @@ - + diff --git a/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj b/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj index 1e0757f3cc..3c066b13c5 100644 --- a/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj +++ b/src/Maths/Silk.NET.Maths/Silk.NET.Maths.csproj @@ -16,7 +16,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From a7a3d0ec40bafb278ec85d6003efa014318b999d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 17:12:11 +0000 Subject: [PATCH 3/7] Bump Microsoft.CodeAnalysis.Analyzers from 3.3.3 to 3.3.4 (#1242) Bumps [Microsoft.CodeAnalysis.Analyzers](https://github.com/dotnet/roslyn-analyzers) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/main/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/v3.3.3...v3.3.4) --- updated-dependencies: - dependency-name: Microsoft.CodeAnalysis.Analyzers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Core/Silk.NET.SilkTouch/Silk.NET.SilkTouch.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/Silk.NET.SilkTouch/Silk.NET.SilkTouch.csproj b/src/Core/Silk.NET.SilkTouch/Silk.NET.SilkTouch.csproj index 78e7d1415a..5081556c48 100644 --- a/src/Core/Silk.NET.SilkTouch/Silk.NET.SilkTouch.csproj +++ b/src/Core/Silk.NET.SilkTouch/Silk.NET.SilkTouch.csproj @@ -19,7 +19,7 @@ - + From 1f5f1b23abe522ca825223c4254a897c5a96fe49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 17:52:02 +0000 Subject: [PATCH 4/7] Bump BenchmarkDotNet from 0.13.3 to 0.13.4 (#1244) Bumps [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.13.3 to 0.13.4. - [Release notes](https://github.com/dotnet/BenchmarkDotNet/releases) - [Commits](https://github.com/dotnet/BenchmarkDotNet/compare/v0.13.3...v0.13.4) --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Lab/Benchmarks/InvokeBenchmarks/InvokeBenchmarks.csproj | 2 +- .../Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lab/Benchmarks/InvokeBenchmarks/InvokeBenchmarks.csproj b/src/Lab/Benchmarks/InvokeBenchmarks/InvokeBenchmarks.csproj index a3719d7506..1207f39cec 100644 --- a/src/Lab/Benchmarks/InvokeBenchmarks/InvokeBenchmarks.csproj +++ b/src/Lab/Benchmarks/InvokeBenchmarks/InvokeBenchmarks.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Maths/Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj b/src/Maths/Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj index b71ec1da17..3bcbf9859a 100644 --- a/src/Maths/Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj +++ b/src/Maths/Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj @@ -8,7 +8,7 @@ - + From 487b5269c7d18e704fdb14f68884ea88e9b96bdb Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 20 Jan 2023 06:30:30 +0800 Subject: [PATCH 5/7] Add ReopenDevices extension for OpenAL Soft (#1230) * start working on RepoenDevices extension * add `ReopenDevices` extension --- .../ReopenDevices.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/OpenAL/Extensions/Silk.NET.OpenAL.Extensions.Soft/ReopenDevices.cs diff --git a/src/OpenAL/Extensions/Silk.NET.OpenAL.Extensions.Soft/ReopenDevices.cs b/src/OpenAL/Extensions/Silk.NET.OpenAL.Extensions.Soft/ReopenDevices.cs new file mode 100644 index 0000000000..516d5688bb --- /dev/null +++ b/src/OpenAL/Extensions/Silk.NET.OpenAL.Extensions.Soft/ReopenDevices.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Silk.NET.Core.Attributes; +using Silk.NET.Core.Contexts; +using Silk.NET.Core.Native; + +namespace Silk.NET.OpenAL.Extensions.Soft +{ + /// + /// Exposes the public API of the OpenAL Soft Reopen Device extension. + /// + [NativeApi(Prefix = "alc")] + [Extension("ALC_SOFT_reopen_device")] + public partial class ReopenDevices : NativeExtension + { + /// + public ReopenDevices(INativeContext ctx) + : base(ctx) + { + } + + /// + [NativeApi(EntryPoint = "ReopenDeviceSOFT")] + public unsafe partial bool ReopenDevice(Device* device, string deviceName, int* attributeList); + } +} From 10d15f68c7c829258f06913557147affdcbe3903 Mon Sep 17 00:00:00 2001 From: ThomasMiz <32400648+ThomasMiz@users.noreply.github.com> Date: Thu, 19 Jan 2023 19:59:37 -0300 Subject: [PATCH 6/7] Project Templates for Windowing, OpenGL (#748) * Initial template design * Applied first batch of suggestions * Removed unwanted coma (oops) * Applied suggestions on packaging * Added template projects to nuke exclusions * Added nuke exclusions, 2nd try * Moved templates to src/Templates * Code style changes * Applied meeting review suggestions Co-authored-by: Dylan Perks <11160611+Perksey@users.noreply.github.com> --- Silk.NET.sln | 18 +++ build/nuke/Build.ReviewHelpers.cs | 10 +- .../netstandard2.0/PublicAPI.Shipped.txt | 1 + .../netstandard2.0/PublicAPI.Unshipped.txt | 1 + .../Silk.NET.Templates.csproj | 24 +++ .../silkgl/.template.config/template.json | 13 ++ .../templates/silkgl/Program.cs | 48 ++++++ .../templates/silkgl/silkgl.csproj | 14 ++ .../.template.config/template.json | 13 ++ .../templates/silkgltriangle/Program.cs | 149 ++++++++++++++++++ .../silkgltriangle/silkgltriangle.csproj | 14 ++ .../silkwindow/.template.config/template.json | 13 ++ .../templates/silkwindow/Program.cs | 38 +++++ .../templates/silkwindow/silkwindow.csproj | 12 ++ 14 files changed, 365 insertions(+), 3 deletions(-) create mode 100644 src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt create mode 100644 src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt create mode 100644 src/Templates/Silk.NET.Templates/Silk.NET.Templates.csproj create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgl/.template.config/template.json create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgl/Program.cs create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgl/silkgl.csproj create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgltriangle/.template.config/template.json create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgltriangle/Program.cs create mode 100644 src/Templates/Silk.NET.Templates/templates/silkgltriangle/silkgltriangle.csproj create mode 100644 src/Templates/Silk.NET.Templates/templates/silkwindow/.template.config/template.json create mode 100644 src/Templates/Silk.NET.Templates/templates/silkwindow/Program.cs create mode 100644 src/Templates/Silk.NET.Templates/templates/silkwindow/silkwindow.csproj diff --git a/Silk.NET.sln b/Silk.NET.sln index 99b61e0e02..5f2c17d068 100644 --- a/Silk.NET.sln +++ b/Silk.NET.sln @@ -474,6 +474,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrototypeStructChaining.Tes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Vulkan.Tests", "src\Vulkan\Silk.NET.Vulkan.Tests\Silk.NET.Vulkan.Tests.csproj", "{225BA79C-36FE-421A-85E4-D15F8B61869B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{278FE083-D2F7-4DD2-9D27-6AD883E3A4B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Templates", "src\Templates\Silk.NET.Templates\Silk.NET.Templates.csproj", "{4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenGLES.ANGLE.Native", "src\Native\Silk.NET.OpenGLES.ANGLE.Native\Silk.NET.OpenGLES.ANGLE.Native.csproj", "{8D02DFEB-121A-449B-BC39-09C3F9A88E07}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.Vulkan.Loader.Native", "src\Native\Silk.NET.Vulkan.Loader.Native\Silk.NET.Vulkan.Loader.Native.csproj", "{36C38837-8250-42F9-ABDA-DEFC1AB129E1}" @@ -2925,6 +2929,18 @@ Global {225BA79C-36FE-421A-85E4-D15F8B61869B}.Release|x64.Build.0 = Release|Any CPU {225BA79C-36FE-421A-85E4-D15F8B61869B}.Release|x86.ActiveCfg = Release|Any CPU {225BA79C-36FE-421A-85E4-D15F8B61869B}.Release|x86.Build.0 = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|x64.ActiveCfg = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|x64.Build.0 = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|x86.ActiveCfg = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Debug|x86.Build.0 = Debug|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|Any CPU.Build.0 = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|x64.ActiveCfg = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|x64.Build.0 = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|x86.ActiveCfg = Release|Any CPU + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2}.Release|x86.Build.0 = Release|Any CPU {8D02DFEB-121A-449B-BC39-09C3F9A88E07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D02DFEB-121A-449B-BC39-09C3F9A88E07}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D02DFEB-121A-449B-BC39-09C3F9A88E07}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -3574,6 +3590,8 @@ Global {EEFF37DA-E4F2-406E-AF97-8615BB7BC34C} = {B15922CB-815C-4038-B635-EE2D8A8F700B} {BD19250B-E143-4F4E-9E1D-18829CCB3642} = {B15922CB-815C-4038-B635-EE2D8A8F700B} {225BA79C-36FE-421A-85E4-D15F8B61869B} = {E2ABDF45-C329-47B2-8E09-B7298E2557F7} + {278FE083-D2F7-4DD2-9D27-6AD883E3A4B8} = {16AFCF73-8CC1-4B5D-8969-A90F468DC6D5} + {4D65197C-79B2-40CF-846E-C1EAB4F6EEA2} = {278FE083-D2F7-4DD2-9D27-6AD883E3A4B8} {8D02DFEB-121A-449B-BC39-09C3F9A88E07} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} {36C38837-8250-42F9-ABDA-DEFC1AB129E1} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} {54F439B6-36E4-4FB0-8731-F73D42AD921F} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} diff --git a/build/nuke/Build.ReviewHelpers.cs b/build/nuke/Build.ReviewHelpers.cs index 92ab8048dc..41f42b7c58 100644 --- a/build/nuke/Build.ReviewHelpers.cs +++ b/build/nuke/Build.ReviewHelpers.cs @@ -12,6 +12,10 @@ partial class Build // ReSharper disable once RedundantEmptyObjectOrCollectionInitializer readonly HashSet AllowedExclusions = new() { + "silkwindow", + "silkgl", + "silkgltriangle", + "DotZLib" }; Target ValidateSolution => CommonTarget @@ -20,8 +24,8 @@ partial class Build ( () => { - var files = SourceDirectory.GlobFiles("**/*.csproj").ToArray(); - Logger.Info($"Found {files.Length} csproj files in \"{SourceDirectory}\""); + var files = RootDirectory.GlobFiles("**\\*.csproj").Concat(RootDirectory.GlobFiles("**/*.csproj")).ToArray(); + Logger.Info($"Found {files.Length} csproj files in \"{RootDirectory}\""); var missedOut = new List(); foreach (var file in files) { @@ -41,7 +45,7 @@ partial class Build ( "A project has not been included in the solution and will not be shipped! " + $"\"{file}\" if this is acceptable please add the project name (excluding the path and " + - "extension) to the AllowedExclusions array in the NUKE Build.CI.AutoReview.cs file." + "extension) to the AllowedExclusions array in the NUKE Build.ReviewHelpers.cs file." ); missedOut.Add(Path.GetRelativePath(RootDirectory, file).Replace('\\', '/')); diff --git a/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt new file mode 100644 index 0000000000..7dc5c58110 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000..7dc5c58110 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/Templates/Silk.NET.Templates/Silk.NET.Templates.csproj b/src/Templates/Silk.NET.Templates/Silk.NET.Templates.csproj new file mode 100644 index 0000000000..741845869b --- /dev/null +++ b/src/Templates/Silk.NET.Templates/Silk.NET.Templates.csproj @@ -0,0 +1,24 @@ + + + + false + Template + A package with template projects for Silk.NET. + This is a quick and easy way to get started with Silk.NET. First, install the templates using `dotnet new --install Silk.NET.Templates`, and then create a project using these templates:%0a- **OpenGL (with a triangle)**: `dotnet new silkgltriangle`%0a**OpenGL (blank)**: `dotnet new silkgl`%0a- **Blank Window**: `dotnet new silkwindow` + true + + netstandard2.0 + + true + false + content + $(NoWarn);NU5128 + + + + + + + + + diff --git a/src/Templates/Silk.NET.Templates/templates/silkgl/.template.config/template.json b/src/Templates/Silk.NET.Templates/templates/silkgl/.template.config/template.json new file mode 100644 index 0000000000..0ed4cf8111 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgl/.template.config/template.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": ".NET Foundation and Contributors", + "classifications": [ "Silk.NET" ], + "identity": "Silk.NET.Templates.SilkGL", + "name": "Silk.NET Window (OpenGL)", + "shortName": "silkgl", + "description": "A Silk.NET Window with user input and an OpenGL Context.", + "tags": { + "language": "C#", + "type": "project" + } +} diff --git a/src/Templates/Silk.NET.Templates/templates/silkgl/Program.cs b/src/Templates/Silk.NET.Templates/templates/silkgl/Program.cs new file mode 100644 index 0000000000..62479e4df5 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgl/Program.cs @@ -0,0 +1,48 @@ +using Silk.NET.Windowing; +using Silk.NET.Input; +using Silk.NET.OpenGL; + +WindowOptions windowOptions = WindowOptions.Default with +{ + Title = "My Silk.NET Window", + PreferredDepthBufferBits = 24, + PreferredStencilBufferBits = 8, + API = new GraphicsAPI(ContextAPI.OpenGL, new APIVersion(3, 3)) +}; + +using IWindow window = Window.Create(windowOptions); +IInputContext inputContext = null!; +GL gl = null!; + +window.Load += () => +{ + // ran on first startup - use this event to initialize stuff. + gl = window.CreateOpenGL(); + inputContext = window.CreateInput(); + gl.Viewport(window.FramebufferSize); +}; + +window.Update += deltaSeconds => +{ + // ran every frame but before render - use this event to update data (e.g. physics). +}; + +window.Render += deltaSeconds => +{ + // ran every frame but after update - use this event to draw. +}; + +window.FramebufferResize += newSize => +{ + // ran when the window framebuffer is resized - usually used to update the viewport and, in 3D apps, view matrices. + gl.Viewport(newSize); +}; + +window.Closing += () => +{ + // ran just before the window closes. +}; + +window.Run(); +gl.Dispose(); +inputContext.Dispose(); \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkgl/silkgl.csproj b/src/Templates/Silk.NET.Templates/templates/silkgl/silkgl.csproj new file mode 100644 index 0000000000..4322f97695 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgl/silkgl.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + + + + + + + + + \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkgltriangle/.template.config/template.json b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/.template.config/template.json new file mode 100644 index 0000000000..6d504ba3c8 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/.template.config/template.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": ".NET Foundation and Contributors", + "classifications": [ "Silk.NET" ], + "identity": "Silk.NET.Templates.SilkGLTriangle", + "name": "Silk.NET Triangle (OpenGL)", + "shortName": "silkgltriangle", + "description": "A Silk.NET Window with an OpenGL Context drawing a triangle.", + "tags": { + "language": "C#", + "type": "project" + } +} \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkgltriangle/Program.cs b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/Program.cs new file mode 100644 index 0000000000..eb23ca6a1e --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/Program.cs @@ -0,0 +1,149 @@ +using System; +using System.Numerics; +using System.Runtime.InteropServices; +using Silk.NET.Windowing; +using Silk.NET.Input; +using Silk.NET.OpenGL; + +WindowOptions windowOptions = WindowOptions.Default with +{ + Title = "My Silk.NET Triangle", + PreferredDepthBufferBits = 24, + PreferredStencilBufferBits = 8, + API = new GraphicsAPI(ContextAPI.OpenGL, new APIVersion(3, 3)) +}; + +using IWindow window = Window.Create(windowOptions); +IInputContext inputContext = null!; +GL gl = null!; + +uint vbo = 0; +uint vao = 0; +uint shader = 0; + +const string VertexShaderCode = @" +#version 330 core +layout (location = 0) in vec3 vPosition; +layout (location = 1) in vec4 vColor; + +out vec4 fColor; + +void main() { + gl_Position = vec4(vPosition, 1.0); + fColor = vColor; +}"; + +const string FragmentShaderCode = @" +#version 330 core +in vec4 fColor; + +out vec4 FragColor; + +void main() { + FragColor = fColor; +}"; + +window.Load += () => +{ + // ran on first startup - use this event to initialize stuff. + gl = window.CreateOpenGL(); + inputContext = window.CreateInput(); + + // We create a Span with our vertex data. Since it's very little + // data, we'll just allocate it in the stack. + Span vertexData = stackalloc Vertex[] + { + new Vertex(new Vector3(-0.5f, -0.5f, 0), 255, 0, 0, 255), + new Vertex(new Vector3(0, 0.5f, 0), 0, 255, 0, 255), + new Vertex(new Vector3(0.5f, -0.5f, 0), 0, 0, 255, 255) + }; + + // We create or GL Buffer Object, bind it and fill it up with data + // from our span. + vbo = gl.GenBuffer(); + gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo); + gl.BufferData(BufferTargetARB.ArrayBuffer, vertexData, BufferUsageARB.StaticDraw); + + // We create or GL Vertex Array Object, bind it and specify two + // vertex attributes sourced from the currently bound buffer; + // Attrib 0: 3 floats (a vec3) + // Attrib 1: 4 unsigned bytes, normalized into a vec4 + vao = gl.GenVertexArray(); + gl.BindVertexArray(vao); + unsafe + { + gl.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, Vertex.Size, (void*)0); + gl.VertexAttribPointer(1, 4, VertexAttribPointerType.UnsignedByte, true, Vertex.Size, (void*)12); + } + gl.EnableVertexAttribArray(0); + gl.EnableVertexAttribArray(1); + + // We create the vertex shader, give it it's source code, and compile. + uint vs = gl.CreateShader(ShaderType.VertexShader); + gl.ShaderSource(vs, VertexShaderCode); + gl.CompileShader(vs); + + // We create the fragment shader, give it it's source code, and compile. + uint fs = gl.CreateShader(ShaderType.FragmentShader); + gl.ShaderSource(fs, FragmentShaderCode); + gl.CompileShader(fs); + + // We create the GL Shader Program Object, which links the vertex and + // fragment shaders into a single program. + shader = gl.CreateProgram(); + gl.AttachShader(shader, vs); + gl.AttachShader(shader, fs); + gl.LinkProgram(shader); + + // We detach the shaders from the program and delete them. This won't + // have any effect until the program itself is re-linked or deleted. + gl.DetachShader(shader, vs); + gl.DetachShader(shader, fs); + gl.DeleteShader(vs); + gl.DeleteShader(fs); + + gl.Viewport(window.FramebufferSize); +}; + +window.Update += deltaSeconds => +{ + // ran every frame but before render - use this event to update data (e.g. physics). +}; + +window.Render += deltaSeconds => +{ + // ran every frame but after update - use this event to draw. + + // Clear the whole screen to black. + gl.ClearColor(0f, 0f, 0f, 1f); + gl.Clear(ClearBufferMask.ColorBufferBit); + + // Draw the 3 vertices from our buffer object as a single triangle. + gl.BindVertexArray(vao); + gl.UseProgram(shader); + gl.DrawArrays(PrimitiveType.Triangles, 0, 3); +}; + +window.FramebufferResize += newSize => +{ + // ran when the window framebuffer is resized - usually used to update the viewport and, in 3D apps, view matrices. + gl.Viewport(newSize); +}; + +window.Closing += () => +{ + // ran just before the window closes. + gl.DeleteProgram(shader); + gl.DeleteVertexArray(vao); + gl.DeleteBuffer(vbo); +}; + +window.Run(); +gl.Dispose(); +inputContext.Dispose(); + +[StructLayout(LayoutKind.Sequential)] +record struct Vertex(Vector3 Position, byte R, byte G, byte B, byte A) +{ + public static uint Size = 3 * 4 + 4; +} \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkgltriangle/silkgltriangle.csproj b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/silkgltriangle.csproj new file mode 100644 index 0000000000..ee5f7bae58 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkgltriangle/silkgltriangle.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + true + + + + + + + + \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkwindow/.template.config/template.json b/src/Templates/Silk.NET.Templates/templates/silkwindow/.template.config/template.json new file mode 100644 index 0000000000..1d21a69d96 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkwindow/.template.config/template.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": ".NET Foundation and Contributors", + "classifications": [ "Silk.NET" ], + "identity": "Silk.NET.Templates.SilkWindow", + "name": "Silk.NET Window (Empty)", + "shortName": "silkwindow", + "description": "An empty Silk.NET Window.", + "tags": { + "language": "C#", + "type": "project" + } +} \ No newline at end of file diff --git a/src/Templates/Silk.NET.Templates/templates/silkwindow/Program.cs b/src/Templates/Silk.NET.Templates/templates/silkwindow/Program.cs new file mode 100644 index 0000000000..6fe1a65551 --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkwindow/Program.cs @@ -0,0 +1,38 @@ +using Silk.NET.Windowing; + +WindowOptions windowOptions = WindowOptions.Default with +{ + Title = "My Silk.NET Window", + PreferredDepthBufferBits = 24, + PreferredStencilBufferBits = 8, + API = new GraphicsAPI(ContextAPI.OpenGL, new APIVersion(3, 3)) +}; + +using IWindow window = Window.Create(windowOptions); + +window.Load += () => +{ + // ran on first startup - use this event to initialize stuff. +}; + +window.Update += deltaSeconds => +{ + // ran every frame but before render - use this event to update data (e.g. physics). +}; + +window.Render += deltaSeconds => +{ + // ran every frame but after update - use this event to draw. +}; + +window.FramebufferResize += newSize => +{ + // ran when the window framebuffer is resized - usually used to update the viewport and, in 3D apps, view matrices. +}; + +window.Closing += () => +{ + // ran just before the window closes. +}; + +window.Run(); diff --git a/src/Templates/Silk.NET.Templates/templates/silkwindow/silkwindow.csproj b/src/Templates/Silk.NET.Templates/templates/silkwindow/silkwindow.csproj new file mode 100644 index 0000000000..d92109272d --- /dev/null +++ b/src/Templates/Silk.NET.Templates/templates/silkwindow/silkwindow.csproj @@ -0,0 +1,12 @@ + + + + Exe + net6.0 + + + + + + + \ No newline at end of file From 30e26d04bf43ecaef933f22ce1a1072533d7f6f8 Mon Sep 17 00:00:00 2001 From: Dylan Perks <11160611+Perksey@users.noreply.github.com> Date: Thu, 19 Jan 2023 23:34:47 +0000 Subject: [PATCH 7/7] Use a self-hosted runner (#1222) * Test selfhosted runner * Update build.yml * Fix README data race * Use .NET 7 in Actions * Use .NET 7 in global.json * Test sign service on selfhosted runner * Update build.yml * Reserve the quick runner for Silk.NET team use only * Remove specific branch for testing * Use GitHub hosted runners if the self-hosted ones are busy * Always use self-hosted for releases --- .github/workflows/build.yml | 31 ++++++++++++++++++++----------- build/props/common.props | 2 +- global.json | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 146db6c4bd..2a96fa0dc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,14 @@ on: - 'documentation/**' jobs: Build: - runs-on: windows-latest + # This will: + # - use windows-quick (self-hosted only) for release tags on this repo + # - use windows-2022 (self-hosted or GitHub-hosted depending on what's available) for development in this repo + # - use windows-latest (GitHub-hosted only) in all other cases (i.e. community contributions) + # Note: the reason we use windows-2022 instead of windows-latest is so that both the self-hosted runner + # (which has the windows-2022 label but NOT the windows-latest label) and the GitHub hosted runner are + # treated as candidates. We will never have a windows-latest self-hosted runner even if it is the latest. + runs-on: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') && 'windows-quick' || github.repository == 'dotnet/Silk.NET' && 'windows-2022' || 'windows-latest' }} steps: - uses: actions/checkout@v2 with: @@ -24,6 +31,10 @@ jobs: with: java-version: 11 distribution: "temurin" + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.102 - name: Setup .NET 6.0 uses: actions/setup-dotnet@v1 with: @@ -36,8 +47,6 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: 3.1.404 - - name: Setup NUKE - run: dotnet tool install Nuke.GlobalTool --global - name: Install Workloads # TODO: This is slow. Maybe we can make a docker container with this already done? run: dotnet workload install android ios maccatalyst maui @@ -45,18 +54,18 @@ jobs: if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }} # skip Clean, Restore, and Compile as this will build the affect the whole solution. # dotnet test will compile the necessary projects for testing only. - run: nuke Test --skip Clean Restore Compile + run: .\build.cmd Test --skip Clean Restore Compile - name: Validation Checks if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }} - run: nuke ValidateSolution + run: .\build.cmd ValidateSolution - name: Pack (CI) if: ${{ github.repository != 'dotnet/Silk.NET' || !startsWith(github.ref, 'refs/tags/') }} # TODO build native mixins such as BuildLibSilkDroid - run: nuke Pack --configuration Release --msbuild-properties VersionSuffix=build${{ github.run_number }}.0 ContinuousIntegrationBuild=true + run: .\build.cmd Pack --configuration Release --msbuild-properties VersionSuffix=build${{ github.run_number }}.0 ContinuousIntegrationBuild=true - name: Pack (CD) if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }} # TODO build native mixins such as BuildLibSilkDroid - run: nuke Pack --configuration Release --msbuild-properties ContinuousIntegrationBuild=true + run: .\build.cmd Pack --configuration Release --msbuild-properties ContinuousIntegrationBuild=true - name: Upload Unsigned Artifacts to Actions uses: actions/upload-artifact@v2.2.4 with: @@ -66,13 +75,13 @@ jobs: retention-days: 1 - name: Sign Packages if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }} - run: nuke SignPackages --sign-username "${{ secrets.SIGN_USERNAME }}" --sign-password "${{ secrets.SIGN_PASSWORD }}" + run: .\build.cmd SignPackages --sign-username "${{ secrets.SIGN_USERNAME }}" --sign-password "${{ secrets.SIGN_PASSWORD }}" - name: Push to Azure Experimental Feed if: ${{ github.repository == 'dotnet/Silk.NET' && github.event_name != 'pull_request' }} - run: nuke PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://pkgs.dev.azure.com/UltzOS/Silk.NET/_packaging/Experimental/nuget/v3/index.json --nuget-username ${{ secrets.AZDO_ARTIFACTS_USERNAME }} --nuget-password ${{ secrets.AZDO_ARTIFACTS_TOKEN }} --nuget-api-key az + run: .\build.cmd PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://pkgs.dev.azure.com/UltzOS/Silk.NET/_packaging/Experimental/nuget/v3/index.json --nuget-username ${{ secrets.AZDO_ARTIFACTS_USERNAME }} --nuget-password ${{ secrets.AZDO_ARTIFACTS_TOKEN }} --nuget-api-key az - name: Push to GitHub Packages if: ${{ github.repository == 'dotnet/Silk.NET' && github.event_name != 'pull_request' }} - run: nuke PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }} + run: .\build.cmd PushToNuGet --skip Clean Restore Compile Pack --nuget-feed https://nuget.pkg.github.com/dotnet/index.json --nuget-api-key ${{ secrets.GITHUB_TOKEN }} - name: Upload Signed Artifacts to Actions if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }} uses: actions/upload-artifact@v2.2.4 @@ -82,5 +91,5 @@ jobs: if-no-files-found: warn - name: Push to NuGet if: ${{ github.repository == 'dotnet/Silk.NET' && startsWith(github.ref, 'refs/tags/') }} - run: nuke PushToNuGet --skip Clean Restore Pack --nuget-api-key ${{ secrets.NUGET_TOKEN }} + run: .\build.cmd PushToNuGet --skip Clean Restore Pack --nuget-api-key ${{ secrets.NUGET_TOKEN }} diff --git a/build/props/common.props b/build/props/common.props index 909e8124b9..e4114a7ae2 100644 --- a/build/props/common.props +++ b/build/props/common.props @@ -95,7 +95,7 @@ .Replace('<div>', '').Replace('</div>', '') .Replace('<a>', '').Replace('</a>', '')) - $(IntermediateOutputPath)README.md + $(IntermediateOutputPath)$(TargetFramework)/README.md $(SilkDescription) $(Description) diff --git a/global.json b/global.json index 5dd65a08dd..f678fbcc6f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.201", + "version": "7.0.102", "rollForward": "major" } }