Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
634e7aa
wip drawie 2
flabbet Aug 6, 2026
2f15f5b
Fixed browser
flabbet Aug 6, 2026
78cd1ea
Updated skia
flabbet Aug 6, 2026
46638cc
Fix browser
flabbet Aug 6, 2026
8883b17
Avalonia 12
flabbet Aug 6, 2026
23a4ab3
Added ImGui and layers concept
flabbet Aug 6, 2026
8c12eca
Sample 3D test
flabbet Aug 7, 2026
34ca606
Draw mesh wip
flabbet Aug 10, 2026
2d5b24a
Made shit work
flabbet Aug 10, 2026
aa5b30b
Got the cube workin
flabbet Aug 11, 2026
c6056f5
Improved shader management
flabbet Aug 11, 2026
d7d58c2
Bind texture works
flabbet Aug 11, 2026
775eef9
Removed ImageSharp
flabbet Aug 12, 2026
c4e5c5d
Custom model drawing
flabbet Aug 12, 2026
90268a4
Fixed imgui with skia textures bindings
flabbet Aug 12, 2026
b510c28
wip webgl
flabbet Aug 14, 2026
fbcdb4e
some changes to webgl, but ill stop now
flabbet Aug 14, 2026
46e1502
vulkan first draft
flabbet Aug 14, 2026
b2acf62
some progress
flabbet Aug 14, 2026
d032282
Got vulkan to render correctly
flabbet Aug 15, 2026
bbf1fd3
Fixed bindings
flabbet Aug 15, 2026
cbaa21b
Fixed opengl skia textures and bindings
flabbet Aug 15, 2026
84d8d7a
Added MiniUI
flabbet Aug 15, 2026
3bbcd86
Disposing
flabbet Aug 15, 2026
0689bd4
Added scene concept
flabbet Aug 15, 2026
21acbd1
Some MiniUI improvements
flabbet Aug 15, 2026
95d2793
Technically added msaa support
flabbet Aug 16, 2026
17437ef
Added MSAA to opengl
flabbet Aug 16, 2026
51ee242
fixed vulkan validation errors
flabbet Aug 16, 2026
6081d79
Updated packages and such
flabbet Aug 16, 2026
ea5241a
rework wip
flabbet Aug 16, 2026
b75228a
works with dynamic rendering now
flabbet Aug 16, 2026
9aabfd8
classic render pass works
flabbet Aug 16, 2026
a804189
Updated to avalonia 12
flabbet Aug 19, 2026
01d4faf
net 10
flabbet Aug 19, 2026
8a8ccbd
Fixed handle management
flabbet Aug 20, 2026
c2c7b72
Update Directory.Build.props
flabbet Aug 20, 2026
2ded78f
Removed unused vector path data
flabbet Aug 25, 2026
d6a571c
Merge branch 'avalonia-12' into drawie2
flabbet Aug 25, 2026
f5a4935
Some fixes
flabbet Aug 25, 2026
04e5317
Update skiasharp to v4
flabbet Aug 25, 2026
6b241de
net10 and skiasharp 4
flabbet Aug 25, 2026
abe5b0f
Update Directory.Build.props
flabbet Aug 26, 2026
f31e441
prefer discrete gpu, better vulkan handling
flabbet Aug 27, 2026
fb6e9ef
Update VulkanContext.cs
flabbet Aug 27, 2026
9c95bff
Update Directory.Build.props
flabbet Aug 27, 2026
24ab847
Merge branch 'avalonia-12' into drawie2
flabbet Aug 27, 2026
7bf459f
Global sampler and native handle fixes
flabbet Aug 27, 2026
e50a712
Sampler fixes and spirv 1.3
flabbet Aug 27, 2026
925aea2
Some target changes and disposal wip
flabbet Aug 27, 2026
33ebcaf
fixes and slnx
flabbet Aug 28, 2026
b18ea0a
damn, sneaky one
flabbet Aug 28, 2026
41a6b0f
Fixed very sneaky bug
flabbet Aug 28, 2026
af8d789
Doesn't crash on dispose (on linux at least)
flabbet Aug 28, 2026
1265e78
Fix MSAA on Vulkan
flabbet Aug 29, 2026
6572dff
MSaa samples option
flabbet Aug 29, 2026
0007089
Auto externally accessible textures
flabbet Aug 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.3.12-cibuild0004211-alpha</AvaloniaVersion>
<AvaloniaVersion>[12.1.1-cibuild0004449-alpha]</AvaloniaVersion>
<AvaloniaAccessUnstablePrivateApis>true</AvaloniaAccessUnstablePrivateApis>
<Avalonia_I_Want_To_Use_Private_Apis_In_Nuget_Package_And_Promise_To_Pin_The_Exact_Avalonia_Version_In_Package_Dependency>true</Avalonia_I_Want_To_Use_Private_Apis_In_Nuget_Package_And_Promise_To_Pin_The_Exact_Avalonia_Version_In_Package_Dependency>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/DrawiEngine.Browser/BrowserDrawingEngine.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Drawie.JSInterop;
using Drawie.RenderApi.WebGl;
using Drawie.Skia;
using Drawie.Windowing.Browser;
using Drawie.Host.Browser;

namespace DrawiEngine.Browser;

Expand Down
4 changes: 2 additions & 2 deletions src/DrawiEngine.Browser/DrawiEngine.Browser.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Drawie.Backend.Skia\Drawie.Backend.Skia.csproj" />
<ProjectReference Include="..\Drawie.RenderApi.WebGl\Drawie.RenderApi.WebGl.csproj" />
<ProjectReference Include="..\Drawie.Windowing.Browser\Drawie.Windowing.Browser.csproj" />
<ProjectReference Include="..\Drawie.Host.Browser\Drawie.Host.Browser.csproj" />
<ProjectReference Include="..\DrawiEngine\DrawiEngine.csproj" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/DrawiEngine.Desktop/DesktopDrawingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace DrawiEngine.Desktop;

public static class DesktopDrawingEngine
{
public static DrawingEngine CreateDefaultDesktop()
public static DrawingEngine CreateDefaultDesktop(bool preferVulkan = true)
{
IRenderApi renderApi = new VulkanRenderApi();
IRenderApi renderApi = preferVulkan ? new VulkanRenderApi() : new OpenGlRenderApi();

if (OperatingSystem.IsMacOS())
{
Expand Down
4 changes: 2 additions & 2 deletions src/DrawiEngine.Desktop/DrawiEngine.Desktop.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Drawie.RenderApi.OpenGl\Drawie.RenderApi.OpenGl.csproj" />
<ProjectReference Include="..\Drawie.RenderApi.Vulkan\Drawie.RenderApi.Vulkan.csproj" />
<ProjectReference Include="..\Drawie.Windowing.Glfw\Drawie.Windowing.Glfw.csproj" />
<ProjectReference Include="..\Drawie.Host.Glfw\Drawie.Host.Glfw.csproj" />
<ProjectReference Include="..\DrawiEngine\DrawiEngine.csproj" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/DrawiEngine/DrawiEngine.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Drawie.Backend.Core\Drawie.Backend.Core.csproj" />
<ProjectReference Include="..\Drawie.Windowing\Drawie.Windowing.csproj" />
<ProjectReference Include="..\Drawie.Host\Drawie.Host.csproj" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/DrawiEngine/DrawieApp.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Drawie.Backend.Core.Bridge;
using Drawie.Windowing;
using Drawie.Host;

namespace DrawiEngine;

Expand All @@ -17,11 +17,11 @@ public void Initialize(DrawingEngine engine)
Engine = engine;
}

public abstract IWindow CreateMainWindow();
public abstract IHost CreateMainWindow();

public void Run()
{
if (DrawingBackendApi.HasBackend)
if (DrawingBackendApi.Initialized)
{
OnInitialize();
}
Expand Down
37 changes: 35 additions & 2 deletions src/DrawiEngine/DrawieRenderingDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,40 @@ namespace DrawiEngine;

public class DrawieRenderingDispatcher : IRenderingDispatcher
{
public Action<Action> Invoke { get; } = action => action();
private bool renderApiReady = false;

private List<Action> queuedActions = new List<Action>();

public Action<Action> Invoke { get; }

public DrawieRenderingDispatcher()
{
Invoke = OnInvoke;
}

private void OnInvoke(Action action)
{
if (renderApiReady)
{
action();
}
else
{
queuedActions.Add(action);
}
}

void IRenderingDispatcher.RenderApiReady()
{
renderApiReady = true;

foreach (var action in queuedActions)
{
action();
}

queuedActions.Clear();
}

public async Task<TResult> InvokeAsync<TResult>(Func<TResult> func)
{
Expand Down Expand Up @@ -32,4 +65,4 @@ public class EmptyDisposable : IDisposable
public void Dispose()
{
}
}
}
9 changes: 5 additions & 4 deletions src/DrawiEngine/DrawingEngine.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Drawie.Backend.Core;
using Drawie.Backend.Core.Bridge;
using Drawie.RenderApi;
using Drawie.Windowing;
using Drawie.Host;

namespace DrawiEngine;

Expand Down Expand Up @@ -32,14 +32,14 @@ public void RunWithApp(DrawieApp app)
Console.WriteLine($"\t- DrawingBackend: {DrawingBackend}");

app.Initialize(this);
IWindow window = app.CreateMainWindow();
IHost host = app.CreateMainWindow();

window.Initialize();
host.Initialize();

DrawingBackendApi.InitializeBackend(RenderApi);

app.Run();
window.Show();
host.Show();
}

public void Run()
Expand All @@ -55,5 +55,6 @@ public void Run()
public async ValueTask Dispose()
{
await DrawingBackend.DisposeAsync();
RenderApi.Dispose();
}
}
12 changes: 6 additions & 6 deletions src/Drawie.AvaloniaInterop/Drawie.AvaloniaInterop.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand All @@ -11,12 +11,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia" Version="12.1.1" />
<PackageReference Include="Avalonia.Desktop" Version="12.1.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.1.1" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.1.1" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.19" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Drawie.AvaloniaInterop/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public MainWindow()

protected override void OnLoaded(RoutedEventArgs e)
{
Texture texture = new Texture(new VecI(128, 128));
NativeTexture nativeTexture = new NativeTexture(new VecI(128, 128));
using Paint paint = new Paint();
paint.Color = Colors.Red;

texture.DrawingSurface.Canvas.DrawRect(0, 0, 128, 128, paint);
nativeTexture.DrawingSurface.Canvas.DrawRect(0, 0, 128, 128, paint);
paint.Color = Colors.Blue;
texture.DrawingSurface.Canvas.DrawCircle(64, 64, 64, paint);
nativeTexture.DrawingSurface.Canvas.DrawCircle(64, 64, 64, paint);

DrawieControl.Texture = texture;
DrawieControl.NativeTexture = nativeTexture;
base.OnLoaded(e);
}

Expand All @@ -45,15 +45,15 @@ public override void Render(DrawingContext context)
byte green = (byte)(Math.Sin(time / 1000.0 + 2) * 127 + 128);
byte blue = (byte)(Math.Sin(time / 1000.0 + 4) * 127 + 128);

DrawieControl.Texture?.DrawingSurface.Canvas.DrawRect(0, 0, 128, 128, new Paint()
DrawieControl.NativeTexture?.DrawingSurface.Canvas.DrawRect(0, 0, 128, 128, new Paint()
{
Color = new Color(red, green, blue, 255),
Style = PaintStyle.StrokeAndFill
});

// test transparency

DrawieControl.Texture?.DrawingSurface.Canvas.DrawCircle(64, 64, 64, new Paint()
DrawieControl.NativeTexture?.DrawingSurface.Canvas.DrawCircle(64, 64, 64, new Paint()
{
Color = new Color(255, 255, 255, 128),
Style = PaintStyle.Fill
Expand Down
3 changes: 2 additions & 1 deletion src/Drawie.AvaloniaInterop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Threading.Tasks;
using Avalonia.Logging;
using Avalonia.OpenGL.Egl;
using Avalonia.Vulkan;
using Drawie.Interop.Avalonia.Vulkan;
using Drawie.Interop.VulkanAvalonia;
Expand Down Expand Up @@ -32,7 +33,7 @@ public static AppBuilder BuildAvaloniaApp()
Win32RenderingMode.Vulkan
},
})
.With(new X11PlatformOptions() { RenderingMode = new[] { X11RenderingMode.Vulkan, X11RenderingMode.Glx } })
.With(new X11PlatformOptions() { RenderingMode = new[] { X11RenderingMode.Egl, X11RenderingMode.Glx } })
.WithDrawie()
.LogToTrace(LogEventLevel.Debug, "Vulkan");
}
6 changes: 4 additions & 2 deletions src/Drawie.Backend.Core/Bridge/DrawingBackendApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static IDrawingBackend Current
}

public static bool HasBackend => _current != null;
public static bool Initialized { get; private set; }

public static void SetupBackend(IDrawingBackend backend, IRenderingDispatcher dispatcher)
{
Expand All @@ -32,8 +33,6 @@ public static void SetupBackend(IDrawingBackend backend, IRenderingDispatcher di

_current = backend;
_current.RenderingDispatcher = dispatcher;

OnBackendInitialized?.Invoke();
}

public static void InitializeBackend(IRenderApi renderApi)
Expand All @@ -44,6 +43,9 @@ public static void InitializeBackend(IRenderApi renderApi)
}

_current.Setup(renderApi);
_current.RenderingDispatcher.RenderApiReady();
OnBackendInitialized?.Invoke();
Initialized = true;
}
}
}
5 changes: 4 additions & 1 deletion src/Drawie.Backend.Core/Bridge/IDrawingBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
using Drawie.Backend.Core.Surfaces;
using Drawie.Numerics;
using Drawie.RenderApi;
using Drawie.RenderApi.Abstraction.Textures;

namespace Drawie.Backend.Core.Bridge
{
public interface IDrawingBackend : IAsyncDisposable
{
public IRenderApi ActiveRenderApi { get; }
public void Setup(IRenderApi renderApi);
public IColorImplementation ColorImplementation { get; }
public IImageImplementation ImageImplementation { get; }
Expand All @@ -31,8 +33,9 @@ public interface IDrawingBackend : IAsyncDisposable
public IPictureImplementation PictureImplementation { get; }
public IBlenderImplementation BlenderImplementation { get; }
public IMeshImplementation MeshImplementation { get; }
public DrawingSurface CreateRenderSurface(VecI size, ITexture renderTexture, SurfaceOrigin origin);
public DrawingSurface? CreateRenderSurface(VecI size, ITexture renderTexture, SurfaceOrigin origin);
public int GetNativeInstancesTotalCount();
public void Flush();
void ResetContext();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public interface IPaintImplementation
public void SetColor(Paint paint, Color value);
public BlendMode GetBlendMode(Paint paint);
public void SetBlendMode(Paint paint, BlendMode value);
public FilterQuality GetFilterQuality(Paint paint);
public void SetFilterQuality(Paint paint, FilterQuality value);
public bool GetIsAntiAliased(Paint paint);
public void SetIsAntiAliased(Paint paint, bool value);
public PaintStyle GetStyle(Paint paint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ public Shader ToShader(IntPtr objectPointer, TileMode tileX, TileMode tileY, Sam
Matrix3X3 localMatrix);
public Shader ToRawShader(IntPtr objectPointer);
public Shader? ToShader(IntPtr objectPointer, TileMode clamp, TileMode tileMode, Matrix3X3 fillMatrixValue);
public uint GetUniqueId(IntPtr objectPointer);
/*
public ulong? GetTextureId(IntPtr objectPointer);
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ public interface ISurfaceImplementation
public RectI GetDeviceClipBounds(IntPtr drawingSurface);
public void Unmanage(DrawingSurface surface);
public RectD GetLocalClipBounds(IntPtr objectPointer);
INativeSurfaceInfo? GetNativeSurfaceInfo(IntPtr objectPointer);
INativeSurfaceInfo? ToExternallyAccessibleSurface(IntPtr objectPointer);
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TexturePaintable : Paintable

public override RectD LocalBounds => new RectD(0, 0, Image.Size.X, Image.Size.Y);

private Image lastSnapshot;
private Image? lastSnapshot;

private bool disposeAfterUse;

Expand Down
3 changes: 2 additions & 1 deletion src/Drawie.Backend.Core/Drawie.Backend.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!--<WarningsAsErrors>CS8600;CS8601;CS8602;CS8604;CS8613;CS8614;CS8619;CS8620;CS8622;CS8625;CS8629;CS8633;CS8524;CS8509;CS8524;CS8767</WarningsAsErrors><!-->
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/Drawie.Backend.Core/IRenderable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Drawie.Backend.Core.Surfaces;

namespace Drawie.Backend.Core;

public interface IRenderable
{
public void Draw(Canvas canvas);
}
1 change: 1 addition & 0 deletions src/Drawie.Backend.Core/IRenderingDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public interface IRenderingDispatcher
{
public Action<Action> Invoke { get; }
protected internal void RenderApiReady();
public Task<TResult> InvokeAsync<TResult>(Func<TResult> func);
public Task<TResult> InvokeInBackgroundAsync<TResult>(Func<TResult> function);
public Task InvokeInBackgroundAsync(Action function);
Expand Down
Loading