mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Code style - Use file scoped namespaces
Code style - Ran code cleanup
This commit is contained in:
1 parent
e68e16df4d
commit
f6090dc296
691 files changed
+37301
-38119
No files matched your search
@@ -4,61 +4,60 @@ using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Windows.SkiaSharp.Vulkan;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Windows.SkiaSharp
|
||||
namespace Artemis.UI.Windows.SkiaSharp;
|
||||
|
||||
public class VulkanContext : IManagedGraphicsContext
|
||||
{
|
||||
public class VulkanContext : IManagedGraphicsContext
|
||||
private readonly GRVkBackendContext _vulkanBackendContext;
|
||||
private readonly Win32VkContext _vulkanContext;
|
||||
|
||||
public VulkanContext()
|
||||
{
|
||||
private readonly GRVkBackendContext _vulkanBackendContext;
|
||||
private readonly Win32VkContext _vulkanContext;
|
||||
|
||||
public VulkanContext()
|
||||
// Try everything in separate try-catch blocks to provide some accuracy in error reporting
|
||||
try
|
||||
{
|
||||
// Try everything in separate try-catch blocks to provide some accuracy in error reporting
|
||||
try
|
||||
{
|
||||
_vulkanContext = new Win32VkContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan context", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_vulkanBackendContext = new GRVkBackendContext
|
||||
{
|
||||
VkInstance = (IntPtr) _vulkanContext.Instance.RawHandle.ToUInt64(),
|
||||
VkPhysicalDevice = (IntPtr) _vulkanContext.PhysicalDevice.RawHandle.ToUInt64(),
|
||||
VkDevice = (IntPtr) _vulkanContext.Device.RawHandle.ToUInt64(),
|
||||
VkQueue = (IntPtr) _vulkanContext.GraphicsQueue.RawHandle.ToUInt64(),
|
||||
GraphicsQueueIndex = _vulkanContext.GraphicsFamily,
|
||||
GetProcedureAddress = _vulkanContext.GetProc
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan backend context", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
GraphicsContext = GRContext.CreateVulkan(_vulkanBackendContext);
|
||||
if (GraphicsContext == null)
|
||||
throw new ArtemisGraphicsContextException("GRContext.CreateVulkan returned null");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan graphics context", e);
|
||||
}
|
||||
|
||||
GraphicsContext.Flush();
|
||||
_vulkanContext = new Win32VkContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan context", e);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
try
|
||||
{
|
||||
_vulkanBackendContext = new GRVkBackendContext
|
||||
{
|
||||
VkInstance = (IntPtr) _vulkanContext.Instance.RawHandle.ToUInt64(),
|
||||
VkPhysicalDevice = (IntPtr) _vulkanContext.PhysicalDevice.RawHandle.ToUInt64(),
|
||||
VkDevice = (IntPtr) _vulkanContext.Device.RawHandle.ToUInt64(),
|
||||
VkQueue = (IntPtr) _vulkanContext.GraphicsQueue.RawHandle.ToUInt64(),
|
||||
GraphicsQueueIndex = _vulkanContext.GraphicsFamily,
|
||||
GetProcedureAddress = _vulkanContext.GetProc
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan backend context", e);
|
||||
}
|
||||
|
||||
public GRContext GraphicsContext { get; }
|
||||
try
|
||||
{
|
||||
GraphicsContext = GRContext.CreateVulkan(_vulkanBackendContext);
|
||||
if (GraphicsContext == null)
|
||||
throw new ArtemisGraphicsContextException("GRContext.CreateVulkan returned null");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan graphics context", e);
|
||||
}
|
||||
|
||||
GraphicsContext.Flush();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public GRContext GraphicsContext { get; }
|
||||
}
|
||||
Reference in new issue
Block a user