Skip to content

Commit f7df7f3

Browse files
committed
Graphics: Restore engine in working state (Vulkan), remove TerraFX source code support.
1 parent 0939bf9 commit f7df7f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+360
-2347
lines changed

Alimer.sln

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Alimer.Audio", "src\Alimer.
6565
EndProject
6666
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Alimer.Navigation", "src\Alimer.Navigation\Alimer.Navigation.csproj", "{78E4C77E-9DA7-4314-B7A2-E8797036CFFF}"
6767
EndProject
68-
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TerraFX.Interop.Windows.Shared", "src\TerraFX.Interop.Windows.Shared\TerraFX.Interop.Windows.Shared.shproj", "{BC61A7B9-4E0B-4F71-B1DE-C5E053E7DFBE}"
69-
EndProject
7068
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Alimer.Bindings.OpenAL", "src\Alimer.Bindings.OpenAL\Alimer.Bindings.OpenAL.csproj", "{8ACFDEAE-EEFA-4096-8329-E7D2C5836C5B}"
7169
EndProject
7270
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Alimer.EditorFramework", "src\editor\Alimer.EditorFramework\Alimer.EditorFramework.csproj", "{23D2739E-5B8A-406B-A6D7-B1DB939B12E7}"
@@ -177,7 +175,4 @@ Global
177175
GlobalSection(ExtensibilityGlobals) = postSolution
178176
SolutionGuid = {2F91C04E-B42E-4037-8FF3-A9C768E70094}
179177
EndGlobalSection
180-
GlobalSection(SharedMSBuildProjectFiles) = preSolution
181-
src\TerraFX.Interop.Windows.Shared\TerraFX.Interop.Windows.Shared.projitems*{bc61a7b9-4e0b-4f71-b1de-c5e053e7dfbe}*SharedItemsImports = 13
182-
EndGlobalSection
183178
EndGlobal

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<VorticeWin32Version>2.2.2</VorticeWin32Version>
55
<TerraFXWindowsVersion>10.0.22621.6</TerraFXWindowsVersion>
66
<ImGuiVersion>1.0.4</ImGuiVersion>
7-
<SkiaSharpVersion>3.0.0-preview.3.1</SkiaSharpVersion>
7+
<SkiaSharpVersion>3.0.0-preview.4.1</SkiaSharpVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>
@@ -21,13 +21,13 @@
2121
<PackageVersion Include="Vortice.Win32.Graphics.Direct3D11" Version="$(VorticeWin32Version)" />
2222
<PackageVersion Include="Vortice.Win32.Graphics.Direct3D12" Version="$(VorticeWin32Version)" />
2323
<PackageVersion Include="XenoAtom.Collections" Version="1.1.0" />
24-
<PackageVersion Include="ppy.SDL3-CS" Version="2024.528.0" />
24+
<PackageVersion Include="ppy.SDL3-CS" Version="2024.717.0" />
2525
<PackageVersion Include="K4os.Compression.LZ4.Streams" Version="1.3.8" />
2626
<PackageVersion Include="StbImageSharp" Version="2.27.14" />
2727
<PackageVersion Include="Alimer.Bindings.WebGPU" Version="1.4.3" />
2828
<PackageVersion Include="TerraFX.Interop.Windows" Version="$(TerraFXWindowsVersion)" />
2929
<PackageVersion Include="TerraFX.Interop.D3D12MemoryAllocator" Version="2.0.1.5" />
30-
<PackageVersion Include="Vortice.Vulkan" Version="1.9.3" />
30+
<PackageVersion Include="Vortice.Vulkan" Version="1.9.4" />
3131
<PackageVersion Include="BepuPhysics" Version="2.5.0-beta.23" />
3232
<PackageVersion Include="DotRecast.Recast" Version="2024.3.1" />
3333

samples/Alimer.Samples/SampleBrowserApp.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ protected override void Initialize()
2222
{
2323
base.Initialize();
2424

25-
foreach (VertexFormat format in Enum.GetValues<VertexFormat>())
26-
{
27-
if (format == VertexFormat.Undefined)
28-
continue;
29-
30-
GraphicsDevice.QueryVertexFormatSupport(format);
31-
}
32-
3325
//string texturesPath = Path.Combine(AppContext.BaseDirectory, "Assets", "Textures");
3426
//Image image = Image.FromFile(Path.Combine(texturesPath, "10points.png"));
3527

@@ -70,7 +62,7 @@ public static void Main()
7062

7163
#if !WINDOWS
7264
//preferredGraphicsBackend = GraphicsBackendType.WebGPU;
73-
//preferredGraphicsBackend = GraphicsBackendType.Vulkan;
65+
preferredGraphicsBackend = GraphicsBackendType.Vulkan;
7466
#endif
7567

7668
using SampleBrowserApp game = new(preferredGraphicsBackend);

src/Alimer.Applications/AppPlatform.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public static AppPlatform CreateDefault()
3737
{
3838
#if WINDOWS || WINDOWS_UWP
3939
return new WindowsPlatform(swapChainPanel: default);
40+
#elif __ANDROID__
41+
throw new NotImplementedException();
4042
#else
4143
return new SDLPlatform();
4244
#endif
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Amer Koleci and Contributors.
2+
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
3+
4+
using Android.Content;
5+
using static Android.Content.ClipboardManager;
6+
using AndroidApplication = Android.App.Application;
7+
8+
namespace Alimer.Input;
9+
10+
partial class ClipboardImplementation : IClipboard
11+
{
12+
private static ClipboardManager? _clipboardManager;
13+
14+
private static ClipboardManager? ClipboardManager => _clipboardManager ??= AndroidApplication.Context.GetSystemService(Context.ClipboardService) as ClipboardManager;
15+
16+
public bool HasText
17+
{
18+
get
19+
{
20+
return
21+
ClipboardManager is not null &&
22+
ClipboardManager.HasPrimaryClip &&
23+
!string.IsNullOrEmpty(ClipboardManager.PrimaryClip?.GetItemAt(0)?.Text);
24+
}
25+
}
26+
27+
public Task<string?> GetTextAsync()
28+
{
29+
return Task.FromResult(ClipboardManager?.PrimaryClip?.GetItemAt(0)?.Text);
30+
}
31+
32+
public Task SetTextAsync(string? text)
33+
{
34+
if (ClipboardManager is not null)
35+
ClipboardManager.PrimaryClip = ClipData.NewPlainText("Text", text ?? string.Empty);
36+
37+
return Task.CompletedTask;
38+
}
39+
}

src/Alimer.Bindings.OpenAL/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Alimer.Graphics/Alimer.Graphics.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
<Import Project="$(AlimerRootDirectory)Alimer.MultiTargeting.targets" />
1111

12+
<PropertyGroup Condition=" $(TargetFramework.Contains('-android')) ">
13+
<ExcludeD3D12>true</ExcludeD3D12>
14+
<ExcludeWebGPU>true</ExcludeWebGPU>
15+
<ExcludeMetal>true</ExcludeMetal>
16+
</PropertyGroup>
17+
1218
<PropertyGroup Condition=" $(TargetFramework.Contains('-windows10')) ">
1319
<ExcludeVulkan>true</ExcludeVulkan>
1420
<ExcludeWebGPU>true</ExcludeWebGPU>

src/Alimer.Graphics/D3D12/D3D12GraphicsDevice.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,12 +720,14 @@ public override bool QueryPixelFormatSupport(PixelFormat format)
720720
return false;
721721
}
722722

723+
#if TODO
723724
/// <inheritdoc />
724725
public override bool QueryVertexFormatSupport(VertexFormat format)
725726
{
726727
// TODO:
727728
return false;
728-
}
729+
}
730+
#endif
729731

730732
/// <inheritdoc />
731733
public override void WaitIdle()

src/Alimer.Graphics/GraphicsDevice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ internal void QueueDestroy(GraphicsObject @object)
199199

200200
public abstract bool QueryFeatureSupport(Feature feature);
201201
public abstract /*PixelFormatSupport*/bool QueryPixelFormatSupport(PixelFormat format);
202-
public abstract bool QueryVertexFormatSupport(VertexFormat format);
202+
//public abstract bool QueryVertexFormatSupport(VertexFormat format);
203203

204204
public virtual void WriteShadingRateValue(ShadingRate rate, void* dest)
205205
{
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright (c) Amer Koleci and Contributors.
2+
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
3+
4+
using System.Runtime.CompilerServices;
5+
using System.Runtime.InteropServices;
6+
using System.Text;
7+
using Vortice.Vulkan;
8+
using XenoAtom.Collections;
9+
10+
namespace Alimer.Graphics.Vulkan;
11+
12+
internal unsafe class Ut8StringArray : IDisposable
13+
{
14+
private readonly byte** _data;
15+
16+
public readonly uint Length;
17+
18+
public Ut8StringArray(UnsafeList<VkUtf8String> strings)
19+
{
20+
Length = (uint)strings.Count;
21+
_data = (byte**)NativeMemory.Alloc((nuint)(strings.Count * sizeof(byte*)));
22+
23+
for (int i = 0; i < Length; i++)
24+
{
25+
ReadOnlySpan<byte> bytes = strings[i].Span;
26+
27+
uint size = (uint)(bytes.Length + 1) * sizeof(byte);
28+
_data[i] = (byte*)NativeMemory.Alloc(size);
29+
30+
fixed (byte* pBytes = bytes)
31+
{
32+
NativeMemory.Copy(pBytes, _data[i], size);
33+
}
34+
}
35+
}
36+
37+
public void Dispose()
38+
{
39+
for (int i = 0; i < Length; i++)
40+
NativeMemory.Free(_data[i]);
41+
42+
NativeMemory.Free(_data);
43+
}
44+
45+
public override string ToString()
46+
{
47+
StringBuilder builder = new("[");
48+
49+
for (int i = 0; i < Length; i++)
50+
{
51+
builder.Append(new string((sbyte*)_data[i]));
52+
53+
if (i < Length - 1)
54+
builder.Append(", ");
55+
}
56+
57+
builder.Append(']');
58+
59+
return builder.ToString();
60+
}
61+
62+
public static implicit operator byte**(Ut8StringArray pStringArray) => pStringArray._data;
63+
}

0 commit comments

Comments
 (0)