Vulkan Support for Win32 (and APIs for everyone as well) (#1010)

Add support for Vulkan on Win32 (#252)
* Bindings for m80 Vulkan backend context and related types. (#1276, #897)
* Added tests for Vulkan
* Rename the SKColorType enum values (#1222)

Co-authored-by: Davide Tuccilli <davide@gritworld.com>
Co-authored-by: Davide Tuccilli <d.tuccilli@gmail.com>
Co-authored-by: Dariusz Komosiński <darek.komosinski@gmail.com>
This commit is contained in:
Matthew Leibowitz 2020-05-14 03:01:38 +02:00 коммит произвёл GitHub
Родитель 3fb8c0cdc5
Коммит 6baf53f3ab
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
56 изменённых файлов: 1843 добавлений и 302 удалений

Просмотреть файл

@ -18,6 +18,7 @@ GLibSharp release 3.22.24.37
AtkSharp release 3.22.24.37
System.Memory release 4.5.3
System.IO.UnmanagedMemoryStream release 4.3.0
SharpVk release 0.4.2
# additional references used by the tooling
OpenTK.GLControl reference 1.1.2349.61993
@ -49,5 +50,6 @@ SkiaSharp.Views.Forms nuget 2.80.0
SkiaSharp.Views.Forms.WPF nuget 2.80.0
SkiaSharp.Views.Forms.GTK nuget 2.80.0
SkiaSharp.HarfBuzz nuget 2.80.0
SkiaSharp.Vulkan.SharpVk nuget 2.80.0
HarfBuzzSharp nuget 2.6.1.3
HarfBuzzSharp.NativeAssets.Linux nuget 2.6.1.3

Просмотреть файл

@ -67,14 +67,14 @@ namespace SkiaSharp
Rgb101010x = 8,
Gray8 = 9,
RgbaF16 = 10,
RgbaF16Normalized = 11,
RgbaF16Clamped = 11,
RgbaF32 = 12,
R8g8Unnormalized = 13,
A16Float = 14,
R16g16Float = 15,
A16Unnormalized = 16,
R16g16Unnormalized = 17,
R16g16b16a16Unnormalized = 18,
Rg88 = 13,
AlphaF16 = 14,
RgF16 = 15,
Alpha16 = 16,
Rg1616 = 17,
Rgba16161616 = 18,
}
public static partial class SkiaExtensions
@ -125,21 +125,21 @@ namespace SkiaSharp
// 2
SKColorType.Rgb565 => 2,
SKColorType.Argb4444 => 2,
SKColorType.R8g8Unnormalized => 2,
SKColorType.A16Unnormalized => 2,
SKColorType.A16Float => 2,
SKColorType.Rg88 => 2,
SKColorType.Alpha16 => 2,
SKColorType.AlphaF16 => 2,
// 4
SKColorType.Bgra8888 => 4,
SKColorType.Rgba8888 => 4,
SKColorType.Rgb888x => 4,
SKColorType.Rgba1010102 => 4,
SKColorType.Rgb101010x => 4,
SKColorType.R16g16Unnormalized => 4,
SKColorType.R16g16Float => 4,
SKColorType.Rg1616 => 4,
SKColorType.RgF16 => 4,
// 8
SKColorType.RgbaF16Normalized => 8,
SKColorType.RgbaF16Clamped => 8,
SKColorType.RgbaF16 => 8,
SKColorType.R16g16b16a16Unnormalized => 8,
SKColorType.Rgba16161616 => 8,
// 16
SKColorType.RgbaF32 => 16,
//
@ -156,8 +156,8 @@ namespace SkiaSharp
// opaque or premul
case SKColorType.Alpha8:
case SKColorType.A16Unnormalized:
case SKColorType.A16Float:
case SKColorType.Alpha16:
case SKColorType.AlphaF16:
if (SKAlphaType.Unpremul == alphaType) {
alphaType = SKAlphaType.Premul;
}
@ -168,17 +168,17 @@ namespace SkiaSharp
case SKColorType.Rgba8888:
case SKColorType.Bgra8888:
case SKColorType.Rgba1010102:
case SKColorType.RgbaF16Normalized:
case SKColorType.RgbaF16Clamped:
case SKColorType.RgbaF16:
case SKColorType.RgbaF32:
case SKColorType.R16g16b16a16Unnormalized:
case SKColorType.Rgba16161616:
break;
// opaque
case SKColorType.Gray8:
case SKColorType.R8g8Unnormalized:
case SKColorType.R16g16Unnormalized:
case SKColorType.R16g16Float:
case SKColorType.Rg88:
case SKColorType.Rg1616:
case SKColorType.RgF16:
case SKColorType.Rgb565:
case SKColorType.Rgb888x:
case SKColorType.Rgb101010x:

Просмотреть файл

@ -17,6 +17,8 @@ namespace SkiaSharp
public delegate IntPtr GRGlGetProcDelegate (object context, string name);
public delegate IntPtr GRVkGetProcDelegate (object context, string name, IntPtr instance, IntPtr device);
public delegate void SKGlyphPathDelegate (SKPath path, SKMatrix matrix, object context);
internal unsafe static partial class DelegateProxies
@ -29,6 +31,7 @@ namespace SkiaSharp
public static readonly SKImageTextureReleaseProxyDelegate SKImageTextureReleaseDelegateProxy = SKImageTextureReleaseDelegateProxyImplementation;
public static readonly SKSurfaceRasterReleaseProxyDelegate SKSurfaceReleaseDelegateProxy = SKSurfaceReleaseDelegateProxyImplementation;
public static readonly GRGlGetProcProxyDelegate GRGlGetProcDelegateProxy = GRGlGetProcDelegateProxyImplementation;
public static readonly GRVkGetProcProxyDelegate GRVkGetProcDelegateProxy = GRVkGetProcDelegateProxyImplementation;
public static readonly SKGlyphPathProxyDelegate SKGlyphPathDelegateProxy = SKGlyphPathDelegateProxyImplementation;
// internal proxy implementations
@ -101,6 +104,14 @@ namespace SkiaSharp
return del.Invoke (null, name);
}
[MonoPInvokeCallback (typeof (GRVkGetProcProxyDelegate))]
private static IntPtr GRVkGetProcDelegateProxyImplementation (void* context, string name, IntPtr instance, IntPtr device)
{
var del = Get<GRVkGetProcDelegate> ((IntPtr)context, out _);
return del.Invoke (null, name, instance, device);
}
[MonoPInvokeCallback (typeof (SKGlyphPathProxyDelegate))]
private static void SKGlyphPathDelegateProxyImplementation (IntPtr pathOrNull, SKMatrix* matrix, void* context)
{

Просмотреть файл

@ -11,6 +11,8 @@ namespace SkiaSharp
Dawn = 3,
}
[EditorBrowsable (EditorBrowsableState.Never)]
[Obsolete ("Use SKColorType instead.")]
public enum GRPixelConfig
{
Unknown = 0,
@ -72,70 +74,6 @@ namespace SkiaSharp
_ => throw new ArgumentOutOfRangeException (nameof (backend)),
};
internal static GRPixelConfigNative ToNative (this GRPixelConfig config) =>
config switch
{
GRPixelConfig.Unknown => GRPixelConfigNative.Unknown,
GRPixelConfig.Alpha8 => GRPixelConfigNative.Alpha8,
GRPixelConfig.Gray8 => GRPixelConfigNative.Gray8,
GRPixelConfig.Rgb565 => GRPixelConfigNative.Rgb565,
GRPixelConfig.Rgba4444 => GRPixelConfigNative.Rgba4444,
GRPixelConfig.Rgba8888 => GRPixelConfigNative.Rgba8888,
GRPixelConfig.Rgb888 => GRPixelConfigNative.Rgb888,
GRPixelConfig.Bgra8888 => GRPixelConfigNative.Bgra8888,
GRPixelConfig.Srgba8888 => GRPixelConfigNative.Srgba8888,
GRPixelConfig.Rgba1010102 => GRPixelConfigNative.Rgba1010102,
GRPixelConfig.AlphaHalf => GRPixelConfigNative.AlphaHalf,
GRPixelConfig.RgbaHalf => GRPixelConfigNative.RgbaHalf,
GRPixelConfig.Alpha8AsAlpha => GRPixelConfigNative.Alpha8AsAlpha,
GRPixelConfig.Alpha8AsRed => GRPixelConfigNative.Alpha8AsRed,
GRPixelConfig.AlphaHalfAsLum => GRPixelConfigNative.AlphaHalfAsLum,
GRPixelConfig.AlphaHalfAsRed => GRPixelConfigNative.AlphaHalfAsRed,
GRPixelConfig.Gray8AsLum => GRPixelConfigNative.Gray8AsLum,
GRPixelConfig.Gray8AsRed => GRPixelConfigNative.Gray8AsRed,
GRPixelConfig.RgbaHalfClamped => GRPixelConfigNative.RgbaHalfClamped,
GRPixelConfig.Alpha16 => GRPixelConfigNative.Alpha16,
GRPixelConfig.Rg1616 => GRPixelConfigNative.Rg1616,
GRPixelConfig.Rgba16161616 => GRPixelConfigNative.Rgba16161616,
GRPixelConfig.RgHalf => GRPixelConfigNative.RgHalf,
GRPixelConfig.Rg88 => GRPixelConfigNative.Rg88,
GRPixelConfig.Rgb888x => GRPixelConfigNative.Rgb888x,
GRPixelConfig.RgbEtc1 => GRPixelConfigNative.RgbEtc1,
_ => throw new ArgumentOutOfRangeException (nameof (config)),
};
internal static GRPixelConfig FromNative (this GRPixelConfigNative config) =>
config switch
{
GRPixelConfigNative.Unknown => GRPixelConfig.Unknown,
GRPixelConfigNative.Alpha8 => GRPixelConfig.Alpha8,
GRPixelConfigNative.Gray8 => GRPixelConfig.Gray8,
GRPixelConfigNative.Rgb565 => GRPixelConfig.Rgb565,
GRPixelConfigNative.Rgba4444 => GRPixelConfig.Rgba4444,
GRPixelConfigNative.Rgba8888 => GRPixelConfig.Rgba8888,
GRPixelConfigNative.Rgb888 => GRPixelConfig.Rgb888,
GRPixelConfigNative.Bgra8888 => GRPixelConfig.Bgra8888,
GRPixelConfigNative.Srgba8888 => GRPixelConfig.Srgba8888,
GRPixelConfigNative.Rgba1010102 => GRPixelConfig.Rgba1010102,
GRPixelConfigNative.AlphaHalf => GRPixelConfig.AlphaHalf,
GRPixelConfigNative.RgbaHalf => GRPixelConfig.RgbaHalf,
GRPixelConfigNative.Alpha8AsAlpha => GRPixelConfig.Alpha8AsAlpha,
GRPixelConfigNative.Alpha8AsRed => GRPixelConfig.Alpha8AsRed,
GRPixelConfigNative.AlphaHalfAsLum => GRPixelConfig.AlphaHalfAsLum,
GRPixelConfigNative.AlphaHalfAsRed => GRPixelConfig.AlphaHalfAsRed,
GRPixelConfigNative.Gray8AsLum => GRPixelConfig.Gray8AsLum,
GRPixelConfigNative.Gray8AsRed => GRPixelConfig.Gray8AsRed,
GRPixelConfigNative.RgbaHalfClamped => GRPixelConfig.RgbaHalfClamped,
GRPixelConfigNative.Alpha16 => GRPixelConfig.Alpha16,
GRPixelConfigNative.Rg1616 => GRPixelConfig.Rg1616,
GRPixelConfigNative.Rgba16161616 => GRPixelConfig.Rgba16161616,
GRPixelConfigNative.RgHalf => GRPixelConfig.RgHalf,
GRPixelConfigNative.Rg88 => GRPixelConfig.Rg88,
GRPixelConfigNative.Rgb888x => GRPixelConfig.Rgb888x,
GRPixelConfigNative.RgbEtc1 => GRPixelConfig.RgbEtc1,
_ => throw new ArgumentOutOfRangeException (nameof (config)),
};
internal static SKColorTypeNative ToNative (this SKColorType colorType) =>
colorType switch
{
@ -149,15 +87,15 @@ namespace SkiaSharp
SKColorType.Rgba1010102 => SKColorTypeNative.Rgba1010102,
SKColorType.Rgb101010x => SKColorTypeNative.Rgb101010x,
SKColorType.Gray8 => SKColorTypeNative.Gray8,
SKColorType.RgbaF16Normalized => SKColorTypeNative.RgbaF16Normalized,
SKColorType.RgbaF16Clamped => SKColorTypeNative.RgbaF16Norm,
SKColorType.RgbaF16 => SKColorTypeNative.RgbaF16,
SKColorType.RgbaF32 => SKColorTypeNative.RgbaF32,
SKColorType.R8g8Unnormalized => SKColorTypeNative.R8g8Unnormalized,
SKColorType.A16Float => SKColorTypeNative.A16Float,
SKColorType.R16g16Float => SKColorTypeNative.R16g16Float,
SKColorType.A16Unnormalized => SKColorTypeNative.A16Unnormalized,
SKColorType.R16g16Unnormalized => SKColorTypeNative.R16g16Unnormalized,
SKColorType.R16g16b16a16Unnormalized => SKColorTypeNative.R16g16b16a16Unnormalized,
SKColorType.Rg88 => SKColorTypeNative.R8g8Unorm,
SKColorType.AlphaF16 => SKColorTypeNative.A16Float,
SKColorType.RgF16 => SKColorTypeNative.R16g16Float,
SKColorType.Alpha16 => SKColorTypeNative.A16Unorm,
SKColorType.Rg1616 => SKColorTypeNative.R16g16Unorm,
SKColorType.Rgba16161616 => SKColorTypeNative.R16g16b16a16Unorm,
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
};
@ -174,15 +112,15 @@ namespace SkiaSharp
SKColorTypeNative.Rgba1010102 => SKColorType.Rgba1010102,
SKColorTypeNative.Rgb101010x => SKColorType.Rgb101010x,
SKColorTypeNative.Gray8 => SKColorType.Gray8,
SKColorTypeNative.RgbaF16Normalized => SKColorType.RgbaF16Normalized,
SKColorTypeNative.RgbaF16Norm => SKColorType.RgbaF16Clamped,
SKColorTypeNative.RgbaF16 => SKColorType.RgbaF16,
SKColorTypeNative.RgbaF32 => SKColorType.RgbaF32,
SKColorTypeNative.R8g8Unnormalized => SKColorType.R8g8Unnormalized,
SKColorTypeNative.A16Float => SKColorType.A16Float,
SKColorTypeNative.R16g16Float => SKColorType.R16g16Float,
SKColorTypeNative.A16Unnormalized => SKColorType.A16Unnormalized,
SKColorTypeNative.R16g16Unnormalized => SKColorType.R16g16Unnormalized,
SKColorTypeNative.R16g16b16a16Unnormalized => SKColorType.R16g16b16a16Unnormalized,
SKColorTypeNative.R8g8Unorm => SKColorType.Rg88,
SKColorTypeNative.A16Float => SKColorType.AlphaF16,
SKColorTypeNative.R16g16Float => SKColorType.RgF16,
SKColorTypeNative.A16Unorm => SKColorType.Alpha16,
SKColorTypeNative.R16g16Unorm => SKColorType.Rg1616,
SKColorTypeNative.R16g16b16a16Unorm => SKColorType.Rgba16161616,
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
};
}

Просмотреть файл

@ -37,6 +37,12 @@ namespace SkiaSharp
CreateGl (width, height, sampleCount, stencilBits, glInfo);
}
public GRBackendRenderTarget (int width, int height, int sampleCount, GRVkImageInfo vkImageInfo)
: this (IntPtr.Zero, true)
{
CreateVulkan (width, height, sampleCount, vkImageInfo);
}
private void CreateGl (int width, int height, int sampleCount, int stencilBits, GRGlFramebufferInfo glInfo)
{
Handle = SkiaApi.gr_backendrendertarget_new_gl (width, height, sampleCount, stencilBits, &glInfo);
@ -46,6 +52,15 @@ namespace SkiaSharp
}
}
private void CreateVulkan (int width, int height, int sampleCount, GRVkImageInfo vkImageInfo)
{
Handle = SkiaApi.gr_backendrendertarget_new_vulkan (width, height, sampleCount, &vkImageInfo);
if (Handle == IntPtr.Zero) {
throw new InvalidOperationException ("Unable to create a new GRBackendRenderTarget instance.");
}
}
protected override void Dispose (bool disposing) =>
base.Dispose (disposing);

Просмотреть файл

@ -41,6 +41,12 @@ namespace SkiaSharp
CreateGl (width, height, mipmapped, glInfo);
}
public GRBackendTexture (int width, int height, GRVkImageInfo vkInfo)
: this (IntPtr.Zero, true)
{
CreateVulkan (width, height, vkInfo);
}
private void CreateGl (int width, int height, bool mipmapped, GRGlTextureInfo glInfo)
{
Handle = SkiaApi.gr_backendtexture_new_gl (width, height, mipmapped, &glInfo);
@ -50,6 +56,15 @@ namespace SkiaSharp
}
}
private void CreateVulkan (int width, int height, GRVkImageInfo vkInfo)
{
Handle = SkiaApi.gr_backendtexture_new_vulkan (width, height, &vkInfo);
if (Handle == IntPtr.Zero) {
throw new InvalidOperationException ("Unable to create a new GRBackendTexture instance.");
}
}
protected override void Dispose (bool disposing) =>
base.Dispose (disposing);

Просмотреть файл

@ -40,7 +40,7 @@ namespace SkiaSharp
};
[EditorBrowsable (EditorBrowsableState.Never)]
[Obsolete ("Use Create(GRBackend, GRGlInterface) instead.")]
[Obsolete ("Use CreateGl(GRGlInterface) instead.")]
public static GRContext Create (GRBackend backend, IntPtr backendContext) =>
backend switch
{
@ -59,6 +59,16 @@ namespace SkiaSharp
public static GRContext CreateGl (GRGlInterface backendContext) =>
GetObject (SkiaApi.gr_context_make_gl (backendContext == null ? IntPtr.Zero : backendContext.Handle));
// CreateVulkan
public static GRContext CreateVulkan (GRVkBackendContext backendContext)
{
if (backendContext == null)
throw new ArgumentNullException (nameof (backendContext));
return GetObject(SkiaApi.gr_context_make_vulkan (backendContext.ToNative ()));
}
//
public GRBackend Backend => SkiaApi.gr_context_get_backend (Handle).FromNative ();

Просмотреть файл

@ -215,8 +215,32 @@ namespace SkiaSharp
public static partial class SkiaExtensions
{
public static uint ToGlSizedFormat (this SKColorType colorType) =>
colorType.ToPixelConfig ().ToGlSizedFormat ();
colorType switch
{
SKColorType.Unknown => 0,
SKColorType.Alpha8 => GRGlSizedFormat.ALPHA8,
SKColorType.Gray8 => GRGlSizedFormat.LUMINANCE8,
SKColorType.Rgb565 => GRGlSizedFormat.RGB565,
SKColorType.Argb4444 => GRGlSizedFormat.RGBA4,
SKColorType.Rgba8888 => GRGlSizedFormat.RGBA8,
SKColorType.Rgb888x => GRGlSizedFormat.RGB8,
SKColorType.Bgra8888 => GRGlSizedFormat.BGRA8,
SKColorType.Rgba1010102 => GRGlSizedFormat.RGB10_A2,
SKColorType.AlphaF16 => GRGlSizedFormat.R16F,
SKColorType.RgbaF16 => GRGlSizedFormat.RGBA16F,
SKColorType.RgbaF16Clamped => GRGlSizedFormat.RGBA16F,
SKColorType.Alpha16 => GRGlSizedFormat.R16,
SKColorType.Rg1616 => GRGlSizedFormat.RG16,
SKColorType.Rgba16161616 => GRGlSizedFormat.RGBA16,
SKColorType.RgF16 => GRGlSizedFormat.RG16F,
SKColorType.Rg88 => GRGlSizedFormat.RG8,
SKColorType.Rgb101010x => 0,
SKColorType.RgbaF32 => 0,
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
};
[EditorBrowsable (EditorBrowsableState.Never)]
[Obsolete ("Use SKColorType instead.")]
public static uint ToGlSizedFormat (this GRPixelConfig config) =>
config switch
{
@ -249,11 +273,65 @@ namespace SkiaSharp
_ => throw new ArgumentOutOfRangeException (nameof (config)),
};
[EditorBrowsable (EditorBrowsableState.Never)]
[Obsolete ("Use SKColorType instead.")]
public static GRPixelConfig ToPixelConfig (this SKColorType colorType) =>
SkiaApi.sk_colortype_to_gr_pixelconfig (colorType.ToNative ()).FromNative ();
colorType switch
{
SKColorType.Unknown => GRPixelConfig.Unknown,
SKColorType.Alpha8 => GRPixelConfig.Alpha8,
SKColorType.Gray8 => GRPixelConfig.Gray8,
SKColorType.Rgb565 => GRPixelConfig.Rgb565,
SKColorType.Argb4444 => GRPixelConfig.Rgba4444,
SKColorType.Rgba8888 => GRPixelConfig.Rgba8888,
SKColorType.Rgb888x => GRPixelConfig.Rgb888,
SKColorType.Bgra8888 => GRPixelConfig.Bgra8888,
SKColorType.Rgba1010102 => GRPixelConfig.Rgba1010102,
SKColorType.AlphaF16 => GRPixelConfig.AlphaHalf,
SKColorType.RgbaF16 => GRPixelConfig.RgbaHalf,
SKColorType.RgbaF16Clamped => GRPixelConfig.RgbaHalfClamped,
SKColorType.Alpha16 => GRPixelConfig.Alpha16,
SKColorType.Rg1616 => GRPixelConfig.Rg1616,
SKColorType.Rgba16161616 => GRPixelConfig.Rgba16161616,
SKColorType.RgF16 => GRPixelConfig.RgHalf,
SKColorType.Rg88 => GRPixelConfig.Rg88,
SKColorType.Rgb101010x => GRPixelConfig.Unknown,
SKColorType.RgbaF32 => GRPixelConfig.Unknown,
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
};
[Obsolete ("Use SKColorType instead.")]
public static SKColorType ToColorType (this GRPixelConfig config) =>
SkiaApi.gr_pixelconfig_to_sk_colortype (config.ToNative ()).FromNative ();
config switch
{
GRPixelConfig.Unknown => SKColorType.Unknown,
GRPixelConfig.Alpha8 => SKColorType.Alpha8,
GRPixelConfig.Gray8 => SKColorType.Gray8,
GRPixelConfig.Rgb565 => SKColorType.Rgb565,
GRPixelConfig.Rgba4444 => SKColorType.Argb4444,
GRPixelConfig.Rgba8888 => SKColorType.Rgba8888,
GRPixelConfig.Rgb888 => SKColorType.Rgb888x,
GRPixelConfig.Bgra8888 => SKColorType.Bgra8888,
GRPixelConfig.Srgba8888 => SKColorType.Rgba8888,
GRPixelConfig.Rgba1010102 => SKColorType.Rgba1010102,
GRPixelConfig.AlphaHalf => SKColorType.AlphaF16,
GRPixelConfig.RgbaHalf => SKColorType.RgbaF16,
GRPixelConfig.Alpha8AsAlpha => SKColorType.Alpha8,
GRPixelConfig.Alpha8AsRed => SKColorType.Alpha8,
GRPixelConfig.AlphaHalfAsLum => SKColorType.AlphaF16,
GRPixelConfig.AlphaHalfAsRed => SKColorType.AlphaF16,
GRPixelConfig.Gray8AsLum => SKColorType.Gray8,
GRPixelConfig.Gray8AsRed => SKColorType.Gray8,
GRPixelConfig.RgbaHalfClamped => SKColorType.RgbaF16Clamped,
GRPixelConfig.Alpha16 => SKColorType.Alpha16,
GRPixelConfig.Rg1616 => SKColorType.Rg1616,
GRPixelConfig.Rgba16161616 => SKColorType.Rgba16161616,
GRPixelConfig.RgHalf => SKColorType.RgF16,
GRPixelConfig.Rg88 => SKColorType.Rg88,
GRPixelConfig.Rgb888x => SKColorType.Rgb888x,
GRPixelConfig.RgbEtc1 => SKColorType.Rgb888x,
_ => throw new ArgumentOutOfRangeException (nameof (config)),
};
}
internal static class GRGlSizedFormat

Просмотреть файл

@ -0,0 +1,89 @@
using System;
using System.Runtime.InteropServices;
namespace SkiaSharp
{
#if THROW_OBJECT_EXCEPTIONS
using GCHandle = SkiaSharp.GCHandleProxy;
#endif
public unsafe class GRVkBackendContext : IDisposable
{
private GRVkGetProcDelegate getProc;
private GRVkGetProcProxyDelegate getProcProxy;
private GCHandle getProcHandle;
private void* getProcContext;
protected virtual void Dispose (bool disposing)
{
if (disposing) {
if (getProcHandle.IsAllocated) {
getProcHandle.Free ();
getProcHandle = default;
}
}
}
public void Dispose ()
{
Dispose (disposing: true);
GC.SuppressFinalize (this);
}
public IntPtr VkInstance { get; set; }
public IntPtr VkPhysicalDevice { get; set; }
public IntPtr VkDevice { get; set; }
public IntPtr VkQueue { get; set; }
public UInt32 GraphicsQueueIndex { get; set; }
public UInt32 MaxAPIVersion { get; set; }
public GRVkExtensions Extensions { get; set; }
public IntPtr VkPhysicalDeviceFeatures { get; set; }
public IntPtr VkPhysicalDeviceFeatures2 { get; set; }
public GRVkGetProcDelegate GetProc {
get => getProc;
set {
getProc = value;
if (getProcHandle.IsAllocated)
getProcHandle.Free ();
getProcProxy = null;
getProcHandle = default;
getProcContext = null;
if (value != null) {
getProcProxy = DelegateProxies.Create (value, DelegateProxies.GRVkGetProcDelegateProxy, out var gch, out var ctx);
getProcHandle = gch;
getProcContext = (void*)ctx;
}
}
}
public bool ProtectedContext { get; set; }
internal GRVkBackendContextNative ToNative () =>
new GRVkBackendContextNative {
fInstance = VkInstance,
fDevice = VkDevice,
fPhysicalDevice = VkPhysicalDevice,
fQueue = VkQueue,
fGraphicsQueueIndex = GraphicsQueueIndex,
fMaxAPIVersion = MaxAPIVersion,
fVkExtensions = Extensions?.Handle ?? IntPtr.Zero,
fDeviceFeatures = VkPhysicalDeviceFeatures,
fDeviceFeatures2 = VkPhysicalDeviceFeatures2,
fGetProcUserData = getProcContext,
fGetProc = getProcProxy,
fProtectedContext = ProtectedContext ? (byte)1 : (byte)0
};
}
}

Просмотреть файл

@ -0,0 +1,48 @@
using System;
namespace SkiaSharp
{
public unsafe class GRVkExtensions : SKObject, ISKSkipObjectRegistration
{
internal GRVkExtensions (IntPtr h, bool owns)
: base (h, owns)
{
}
private GRVkExtensions ()
: this (SkiaApi.gr_vk_extensions_new (), true)
{
}
protected override void DisposeNative () =>
SkiaApi.gr_vk_extensions_delete (Handle);
public void HasExtension (string extension, int minVersion) =>
SkiaApi.gr_vk_extensions_has_extension (Handle, extension, (uint)minVersion);
public void Initialize (GRVkGetProcDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice) =>
Initialize (getProc, vkInstance, vkPhysicalDevice, null, null);
public void Initialize (GRVkGetProcDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions)
{
var proxy = DelegateProxies.Create (getProc, DelegateProxies.GRVkGetProcDelegateProxy, out var gch, out var ctx);
try {
var ie = instanceExtensions;
var de = deviceExtensions;
SkiaApi.gr_vk_extensions_init (Handle, proxy, (void*)ctx, vkInstance, vkPhysicalDevice, (uint)(ie?.Length ?? 0), ie, (uint)(de?.Length ?? 0), de);
} finally {
gch.Free ();
}
}
public static GRVkExtensions Create (GRVkGetProcDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions)
{
var extensions = new GRVkExtensions ();
extensions.Initialize (getProc, vkInstance, vkPhysicalDevice, instanceExtensions, deviceExtensions);
return extensions;
}
internal static GRVkExtensions GetObject (IntPtr handle) =>
handle == IntPtr.Zero ? null : new GRVkExtensions (handle, true);
}
}

Просмотреть файл

@ -9,6 +9,9 @@ namespace SkiaSharp
using gr_backendtexture_t = IntPtr;
using gr_context_t = IntPtr;
using gr_glinterface_t = IntPtr;
using gr_vk_extensions_t = IntPtr;
using gr_vk_memory_allocator_t = IntPtr;
using gr_vkinterface_t = IntPtr;
using sk_3dview_t = IntPtr;
using sk_bitmap_t = IntPtr;
using sk_canvas_t = IntPtr;
@ -73,6 +76,12 @@ namespace SkiaSharp
using sk_wstream_t = IntPtr;
using sk_xmlstreamwriter_t = IntPtr;
using sk_xmlwriter_t = IntPtr;
using vk_device_t = IntPtr;
using vk_instance_t = IntPtr;
using vk_physical_device_features_2_t = IntPtr;
using vk_physical_device_features_t = IntPtr;
using vk_physical_device_t = IntPtr;
using vk_queue_t = IntPtr;
#endregion
@ -118,6 +127,10 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_gl (Int32 width, Int32 height, Int32 samples, Int32 stencils, GRGlFramebufferInfo* glInfo);
// gr_backendrendertarget_t* gr_backendrendertarget_new_vulkan(int width, int height, int samples, const gr_vk_imageinfo_t* vkImageInfo)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendrendertarget_t gr_backendrendertarget_new_vulkan (Int32 width, Int32 height, Int32 samples, GRVkImageInfo* vkImageInfo);
// void gr_backendtexture_delete(gr_backendtexture_t* texture)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gr_backendtexture_delete (gr_backendtexture_t texture);
@ -153,6 +166,10 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendtexture_t gr_backendtexture_new_gl (Int32 width, Int32 height, [MarshalAs (UnmanagedType.I1)] bool mipmapped, GRGlTextureInfo* glInfo);
// gr_backendtexture_t* gr_backendtexture_new_vulkan(int width, int height, const gr_vk_imageinfo_t* vkInfo)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_backendtexture_t gr_backendtexture_new_vulkan (Int32 width, Int32 height, GRVkImageInfo* vkInfo);
// void gr_context_abandon_context(gr_context_t* context)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gr_context_abandon_context (gr_context_t context);
@ -181,6 +198,10 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_context_t gr_context_make_gl (gr_glinterface_t glInterface);
// gr_context_t* gr_context_make_vulkan(const gr_vk_backendcontext_t vkBackendContext)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_context_t gr_context_make_vulkan (GRVkBackendContextNative vkBackendContext);
// void gr_context_release_resources_and_abandon_context(gr_context_t* context)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gr_context_release_resources_and_abandon_context (gr_context_t context);
@ -227,6 +248,23 @@ namespace SkiaSharp
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool gr_glinterface_validate (gr_glinterface_t glInterface);
// void gr_vk_extensions_delete(gr_vk_extensions_t* extensions)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gr_vk_extensions_delete (gr_vk_extensions_t extensions);
// bool gr_vk_extensions_has_extension(gr_vk_extensions_t* extensions, const char* ext, uint32_t minVersion)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool gr_vk_extensions_has_extension (gr_vk_extensions_t extensions, [MarshalAs (UnmanagedType.LPStr)] String ext, UInt32 minVersion);
// void gr_vk_extensions_init(gr_vk_extensions_t* extensions, gr_vk_get_proc getProc, void* userData, vk_instance_t* instance, vk_physical_device_t* physDev, uint32_t instanceExtensionCount, const char** instanceExtensions, uint32_t deviceExtensionCount, const char** deviceExtensions)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gr_vk_extensions_init (gr_vk_extensions_t extensions, GRVkGetProcProxyDelegate getProc, void* userData, vk_instance_t instance, vk_physical_device_t physDev, UInt32 instanceExtensionCount, [MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[] instanceExtensions, UInt32 deviceExtensionCount, [MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[] deviceExtensions);
// gr_vk_extensions_t* gr_vk_extensions_new()
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern gr_vk_extensions_t gr_vk_extensions_new ();
#endregion
#region sk_bitmap.h
@ -1273,18 +1311,10 @@ namespace SkiaSharp
#region sk_general.h
// sk_colortype_t gr_pixelconfig_to_sk_colortype(gr_pixelconfig_t pixelConfig)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern SKColorTypeNative gr_pixelconfig_to_sk_colortype (GRPixelConfigNative pixelConfig);
// sk_colortype_t sk_colortype_get_default_8888()
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern SKColorTypeNative sk_colortype_get_default_8888 ();
// gr_pixelconfig_t sk_colortype_to_gr_pixelconfig(sk_colortype_t colorType)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern GRPixelConfigNative sk_colortype_to_gr_pixelconfig (SKColorTypeNative colorType);
// int sk_nvrefcnt_get_ref_count(const sk_nvrefcnt_t* refcnt)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern Int32 sk_nvrefcnt_get_ref_count (sk_nvrefcnt_t refcnt);
@ -3762,6 +3792,14 @@ namespace SkiaSharp
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate IntPtr GRGlGetProcProxyDelegate(void* ctx, [MarshalAs (UnmanagedType.LPStr)] String name);
// typedef void (*)()* gr_vk_func_ptr
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void GRVkFuncPtr();
// typedef gr_vk_func_ptr (*)(void* ctx, const char* name, vk_instance_t* instance, vk_device_t* device)* gr_vk_get_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate IntPtr GRVkGetProcProxyDelegate(void* ctx, [MarshalAs (UnmanagedType.LPStr)] String name, vk_instance_t instance, vk_device_t device);
// typedef void (*)(void* addr, void* context)* sk_bitmap_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKBitmapReleaseProxyDelegate(void* addr, void* context);
@ -3967,6 +4005,358 @@ namespace SkiaSharp
}
// gr_vk_alloc_t
[StructLayout (LayoutKind.Sequential)]
public unsafe partial struct GRVkAlloc : IEquatable<GRVkAlloc> {
// public uint64_t fMemory
private UInt64 fMemory;
public UInt64 Memory {
readonly get => fMemory;
set => fMemory = value;
}
// public uint64_t fOffset
private UInt64 fOffset;
public UInt64 Offset {
readonly get => fOffset;
set => fOffset = value;
}
// public uint64_t fSize
private UInt64 fSize;
public UInt64 Size {
readonly get => fSize;
set => fSize = value;
}
// public uint32_t fFlags
private UInt32 fFlags;
public UInt32 Flags {
readonly get => fFlags;
set => fFlags = value;
}
// public gr_vk_backendmemory_t fBackendMemory
private IntPtr fBackendMemory;
public IntPtr BackendMemory {
readonly get => fBackendMemory;
set => fBackendMemory = value;
}
// public bool _private_fUsesSystemHeap
private Byte fUsesSystemHeap;
public readonly bool Equals (GRVkAlloc obj) =>
fMemory == obj.fMemory && fOffset == obj.fOffset && fSize == obj.fSize && fFlags == obj.fFlags && fBackendMemory == obj.fBackendMemory && fUsesSystemHeap == obj.fUsesSystemHeap;
public readonly override bool Equals (object obj) =>
obj is GRVkAlloc f && Equals (f);
public static bool operator == (GRVkAlloc left, GRVkAlloc right) =>
left.Equals (right);
public static bool operator != (GRVkAlloc left, GRVkAlloc right) =>
!left.Equals (right);
public readonly override int GetHashCode ()
{
var hash = new HashCode ();
hash.Add (fMemory);
hash.Add (fOffset);
hash.Add (fSize);
hash.Add (fFlags);
hash.Add (fBackendMemory);
hash.Add (fUsesSystemHeap);
return hash.ToHashCode ();
}
}
// gr_vk_backendcontext_t
[StructLayout (LayoutKind.Sequential)]
internal unsafe partial struct GRVkBackendContextNative : IEquatable<GRVkBackendContextNative> {
// public vk_instance_t* fInstance
public vk_instance_t fInstance;
// public vk_physical_device_t* fPhysicalDevice
public vk_physical_device_t fPhysicalDevice;
// public vk_device_t* fDevice
public vk_device_t fDevice;
// public vk_queue_t* fQueue
public vk_queue_t fQueue;
// public uint32_t fGraphicsQueueIndex
public UInt32 fGraphicsQueueIndex;
// public uint32_t fMinAPIVersion
public UInt32 fMinAPIVersion;
// public uint32_t fInstanceVersion
public UInt32 fInstanceVersion;
// public uint32_t fMaxAPIVersion
public UInt32 fMaxAPIVersion;
// public uint32_t fExtensions
public UInt32 fExtensions;
// public const gr_vk_extensions_t* fVkExtensions
public gr_vk_extensions_t fVkExtensions;
// public uint32_t fFeatures
public UInt32 fFeatures;
// public const vk_physical_device_features_t* fDeviceFeatures
public vk_physical_device_features_t fDeviceFeatures;
// public const vk_physical_device_features_2_t* fDeviceFeatures2
public vk_physical_device_features_2_t fDeviceFeatures2;
// public gr_vk_memory_allocator_t* fMemoryAllocator
public gr_vk_memory_allocator_t fMemoryAllocator;
// public gr_vk_get_proc fGetProc
public GRVkGetProcProxyDelegate fGetProc;
// public void* fGetProcUserData
public void* fGetProcUserData;
// public bool fOwnsInstanceAndDevice
public Byte fOwnsInstanceAndDevice;
// public bool fProtectedContext
public Byte fProtectedContext;
public readonly bool Equals (GRVkBackendContextNative obj) =>
fInstance == obj.fInstance && fPhysicalDevice == obj.fPhysicalDevice && fDevice == obj.fDevice && fQueue == obj.fQueue && fGraphicsQueueIndex == obj.fGraphicsQueueIndex && fMinAPIVersion == obj.fMinAPIVersion && fInstanceVersion == obj.fInstanceVersion && fMaxAPIVersion == obj.fMaxAPIVersion && fExtensions == obj.fExtensions && fVkExtensions == obj.fVkExtensions && fFeatures == obj.fFeatures && fDeviceFeatures == obj.fDeviceFeatures && fDeviceFeatures2 == obj.fDeviceFeatures2 && fMemoryAllocator == obj.fMemoryAllocator && fGetProc == obj.fGetProc && fGetProcUserData == obj.fGetProcUserData && fOwnsInstanceAndDevice == obj.fOwnsInstanceAndDevice && fProtectedContext == obj.fProtectedContext;
public readonly override bool Equals (object obj) =>
obj is GRVkBackendContextNative f && Equals (f);
public static bool operator == (GRVkBackendContextNative left, GRVkBackendContextNative right) =>
left.Equals (right);
public static bool operator != (GRVkBackendContextNative left, GRVkBackendContextNative right) =>
!left.Equals (right);
public readonly override int GetHashCode ()
{
var hash = new HashCode ();
hash.Add (fInstance);
hash.Add (fPhysicalDevice);
hash.Add (fDevice);
hash.Add (fQueue);
hash.Add (fGraphicsQueueIndex);
hash.Add (fMinAPIVersion);
hash.Add (fInstanceVersion);
hash.Add (fMaxAPIVersion);
hash.Add (fExtensions);
hash.Add (fVkExtensions);
hash.Add (fFeatures);
hash.Add (fDeviceFeatures);
hash.Add (fDeviceFeatures2);
hash.Add (fMemoryAllocator);
hash.Add (fGetProc);
hash.Add (fGetProcUserData);
hash.Add (fOwnsInstanceAndDevice);
hash.Add (fProtectedContext);
return hash.ToHashCode ();
}
}
// gr_vk_imageinfo_t
[StructLayout (LayoutKind.Sequential)]
public unsafe partial struct GRVkImageInfo : IEquatable<GRVkImageInfo> {
// public uint64_t fImage
private UInt64 fImage;
public UInt64 Image {
readonly get => fImage;
set => fImage = value;
}
// public gr_vk_alloc_t fAlloc
private GRVkAlloc fAlloc;
public GRVkAlloc Alloc {
readonly get => fAlloc;
set => fAlloc = value;
}
// public uint32_t fImageTiling
private UInt32 fImageTiling;
public UInt32 ImageTiling {
readonly get => fImageTiling;
set => fImageTiling = value;
}
// public uint32_t fImageLayout
private UInt32 fImageLayout;
public UInt32 ImageLayout {
readonly get => fImageLayout;
set => fImageLayout = value;
}
// public uint32_t fFormat
private UInt32 fFormat;
public UInt32 Format {
readonly get => fFormat;
set => fFormat = value;
}
// public uint32_t fLevelCount
private UInt32 fLevelCount;
public UInt32 LevelCount {
readonly get => fLevelCount;
set => fLevelCount = value;
}
// public uint32_t fCurrentQueueFamily
private UInt32 fCurrentQueueFamily;
public UInt32 CurrentQueueFamily {
readonly get => fCurrentQueueFamily;
set => fCurrentQueueFamily = value;
}
// public bool fProtected
private Byte fProtected;
public bool Protected {
readonly get => fProtected > 0;
set => fProtected = value ? (byte)1 : (byte)0;
}
// public gr_vk_ycbcrconversioninfo_t fYcbcrConversionInfo
private GrVkYcbcrConversionInfo fYcbcrConversionInfo;
public GrVkYcbcrConversionInfo YcbcrConversionInfo {
readonly get => fYcbcrConversionInfo;
set => fYcbcrConversionInfo = value;
}
public readonly bool Equals (GRVkImageInfo obj) =>
fImage == obj.fImage && fAlloc == obj.fAlloc && fImageTiling == obj.fImageTiling && fImageLayout == obj.fImageLayout && fFormat == obj.fFormat && fLevelCount == obj.fLevelCount && fCurrentQueueFamily == obj.fCurrentQueueFamily && fProtected == obj.fProtected && fYcbcrConversionInfo == obj.fYcbcrConversionInfo;
public readonly override bool Equals (object obj) =>
obj is GRVkImageInfo f && Equals (f);
public static bool operator == (GRVkImageInfo left, GRVkImageInfo right) =>
left.Equals (right);
public static bool operator != (GRVkImageInfo left, GRVkImageInfo right) =>
!left.Equals (right);
public readonly override int GetHashCode ()
{
var hash = new HashCode ();
hash.Add (fImage);
hash.Add (fAlloc);
hash.Add (fImageTiling);
hash.Add (fImageLayout);
hash.Add (fFormat);
hash.Add (fLevelCount);
hash.Add (fCurrentQueueFamily);
hash.Add (fProtected);
hash.Add (fYcbcrConversionInfo);
return hash.ToHashCode ();
}
}
// gr_vk_ycbcrconversioninfo_t
[StructLayout (LayoutKind.Sequential)]
public unsafe partial struct GrVkYcbcrConversionInfo : IEquatable<GrVkYcbcrConversionInfo> {
// public uint32_t fFormat
private UInt32 fFormat;
public UInt32 Format {
readonly get => fFormat;
set => fFormat = value;
}
// public uint64_t fExternalFormat
private UInt64 fExternalFormat;
public UInt64 ExternalFormat {
readonly get => fExternalFormat;
set => fExternalFormat = value;
}
// public uint32_t fYcbcrModel
private UInt32 fYcbcrModel;
public UInt32 YcbcrModel {
readonly get => fYcbcrModel;
set => fYcbcrModel = value;
}
// public uint32_t fYcbcrRange
private UInt32 fYcbcrRange;
public UInt32 YcbcrRange {
readonly get => fYcbcrRange;
set => fYcbcrRange = value;
}
// public uint32_t fXChromaOffset
private UInt32 fXChromaOffset;
public UInt32 XChromaOffset {
readonly get => fXChromaOffset;
set => fXChromaOffset = value;
}
// public uint32_t fYChromaOffset
private UInt32 fYChromaOffset;
public UInt32 YChromaOffset {
readonly get => fYChromaOffset;
set => fYChromaOffset = value;
}
// public uint32_t fChromaFilter
private UInt32 fChromaFilter;
public UInt32 ChromaFilter {
readonly get => fChromaFilter;
set => fChromaFilter = value;
}
// public uint32_t fForceExplicitReconstruction
private UInt32 fForceExplicitReconstruction;
public UInt32 ForceExplicitReconstruction {
readonly get => fForceExplicitReconstruction;
set => fForceExplicitReconstruction = value;
}
// public uint32_t fFormatFeatures
private UInt32 fFormatFeatures;
public UInt32 FormatFeatures {
readonly get => fFormatFeatures;
set => fFormatFeatures = value;
}
public readonly bool Equals (GrVkYcbcrConversionInfo obj) =>
fFormat == obj.fFormat && fExternalFormat == obj.fExternalFormat && fYcbcrModel == obj.fYcbcrModel && fYcbcrRange == obj.fYcbcrRange && fXChromaOffset == obj.fXChromaOffset && fYChromaOffset == obj.fYChromaOffset && fChromaFilter == obj.fChromaFilter && fForceExplicitReconstruction == obj.fForceExplicitReconstruction && fFormatFeatures == obj.fFormatFeatures;
public readonly override bool Equals (object obj) =>
obj is GrVkYcbcrConversionInfo f && Equals (f);
public static bool operator == (GrVkYcbcrConversionInfo left, GrVkYcbcrConversionInfo right) =>
left.Equals (right);
public static bool operator != (GrVkYcbcrConversionInfo left, GrVkYcbcrConversionInfo right) =>
!left.Equals (right);
public readonly override int GetHashCode ()
{
var hash = new HashCode ();
hash.Add (fFormat);
hash.Add (fExternalFormat);
hash.Add (fYcbcrModel);
hash.Add (fYcbcrRange);
hash.Add (fXChromaOffset);
hash.Add (fYChromaOffset);
hash.Add (fChromaFilter);
hash.Add (fForceExplicitReconstruction);
hash.Add (fFormatFeatures);
return hash.ToHashCode ();
}
}
// sk_codec_frameinfo_t
[StructLayout (LayoutKind.Sequential)]
public unsafe partial struct SKCodecFrameInfo : IEquatable<SKCodecFrameInfo> {
@ -5518,62 +5908,6 @@ namespace SkiaSharp
Vulkan = 3,
}
// gr_pixelconfig_t
internal enum GRPixelConfigNative {
// UNKNOWN_GR_PIXEL_CONFIG = 0
Unknown = 0,
// ALPHA_8_GR_PIXEL_CONFIG = 1
Alpha8 = 1,
// ALPHA_8_AS_ALPHA_GR_PIXEL_CONFIG = 2
Alpha8AsAlpha = 2,
// ALPHA_8_AS_RED_GR_PIXEL_CONFIG = 3
Alpha8AsRed = 3,
// GRAY_8_GR_PIXEL_CONFIG = 4
Gray8 = 4,
// GRAY_8_AS_LUM_GR_PIXEL_CONFIG = 5
Gray8AsLum = 5,
// GRAY_8_AS_RED_GR_PIXEL_CONFIG = 6
Gray8AsRed = 6,
// RGB_565_GR_PIXEL_CONFIG = 7
Rgb565 = 7,
// RGBA_4444_GR_PIXEL_CONFIG = 8
Rgba4444 = 8,
// RGBA_8888_GR_PIXEL_CONFIG = 9
Rgba8888 = 9,
// RGB_888_GR_PIXEL_CONFIG = 10
Rgb888 = 10,
// RGB_888X_GR_PIXEL_CONFIG = 11
Rgb888x = 11,
// RG_88_GR_PIXEL_CONFIG = 12
Rg88 = 12,
// BGRA_8888_GR_PIXEL_CONFIG = 13
Bgra8888 = 13,
// SRGBA_8888_GR_PIXEL_CONFIG = 14
Srgba8888 = 14,
// RGBA_1010102_GR_PIXEL_CONFIG = 15
Rgba1010102 = 15,
// ALPHA_HALF_GR_PIXEL_CONFIG = 16
AlphaHalf = 16,
// ALPHA_HALF_AS_LUM_GR_PIXEL_CONFIG = 17
AlphaHalfAsLum = 17,
// ALPHA_HALF_AS_RED_GR_PIXEL_CONFIG = 18
AlphaHalfAsRed = 18,
// RGBA_HALF_GR_PIXEL_CONFIG = 19
RgbaHalf = 19,
// RGBA_HALF_CLAMPED_GR_PIXEL_CONFIG = 20
RgbaHalfClamped = 20,
// RGB_ETC1_GR_PIXEL_CONFIG = 21
RgbEtc1 = 21,
// ALPHA_16_GR_PIXEL_CONFIG = 22
Alpha16 = 22,
// RG_1616_GR_PIXEL_CONFIG = 23
Rg1616 = 23,
// RGBA_16161616_GR_PIXEL_CONFIG = 24
Rgba16161616 = 24,
// RG_HALF_GR_PIXEL_CONFIG = 25
RgHalf = 25,
}
// gr_surfaceorigin_t
public enum GRSurfaceOrigin {
// TOP_LEFT_GR_SURFACE_ORIGIN = 0
@ -5757,24 +6091,24 @@ namespace SkiaSharp
Rgb101010x = 8,
// GRAY_8_SK_COLORTYPE = 9
Gray8 = 9,
// RGBA_F16_NORMALIZED_SK_COLORTYPE = 10
RgbaF16Normalized = 10,
// RGBA_F16_NORM_SK_COLORTYPE = 10
RgbaF16Norm = 10,
// RGBA_F16_SK_COLORTYPE = 11
RgbaF16 = 11,
// RGBA_F32_SK_COLORTYPE = 12
RgbaF32 = 12,
// R8G8_UNNORMALIZED_SK_COLORTYPE = 13
R8g8Unnormalized = 13,
// R8G8_UNORM_SK_COLORTYPE = 13
R8g8Unorm = 13,
// A16_FLOAT_SK_COLORTYPE = 14
A16Float = 14,
// R16G16_FLOAT_SK_COLORTYPE = 15
R16g16Float = 15,
// A16_UNNORMALIZED_SK_COLORTYPE = 16
A16Unnormalized = 16,
// R16G16_UNNORMALIZED_SK_COLORTYPE = 17
R16g16Unnormalized = 17,
// R16G16B16A16_UNNORMALIZED_SK_COLORTYPE = 18
R16g16b16a16Unnormalized = 18,
// A16_UNORM_SK_COLORTYPE = 16
A16Unorm = 16,
// R16G16_UNORM_SK_COLORTYPE = 17
R16g16Unorm = 17,
// R16G16B16A16_UNORM_SK_COLORTYPE = 18
R16g16b16a16Unorm = 18,
}
// sk_crop_rect_flags_t

Просмотреть файл

@ -17,6 +17,9 @@
"mappings": {
"types": {
// type aliases
"gr_vk_backendmemory_t": {
"cs": "IntPtr"
},
"sk_color_t": {
"cs": "UInt32"
},
@ -30,6 +33,12 @@
"cs": "UInt32"
},
// the rest
"gr_vk_imageinfo_t": {
"cs": "GRVkImageInfo"
},
"gr_vk_ycbcrconversioninfo_t": {
"cs": "GrVkYcbcrConversionInfo"
},
"gr_pixelconfig_t": {
"cs": "GRPixelConfigNative",
"internal": true
@ -56,6 +65,10 @@
"fID": "Id"
}
},
"gr_vk_backendcontext_t": {
"cs": "GRVkBackendContextNative",
"internal": true
},
"sk_color4f_t": {
"cs": "SKColorF",
"readonly": true,
@ -340,6 +353,16 @@
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
}
},
"gr_vk_func_ptr": {
"convention": "stdcall"
},
"gr_vk_get_proc": {
"cs": "GRVkGetProcProxyDelegate",
"parameters": {
"-1": "IntPtr",
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
}
},
"sk_managedwstream_write_proc": {
"cs": "SKManagedWStreamWriteProxyDelegate"
},
@ -358,6 +381,17 @@
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
}
},
"gr_vk_extensions_has_extension": {
"parameters": {
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
}
},
"gr_vk_extensions_init": {
"parameters": {
"6": "[MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[]",
"8": "[MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[]"
}
},
"sk_fontmgr_match_family": {
"parameters": {
"1": "[MarshalAs (UnmanagedType.LPStr)] String"

Просмотреть файл

@ -37,6 +37,9 @@ var UNSUPPORTED_TESTS = Argument ("unsupportedTests", "");
var THROW_ON_TEST_FAILURE = Argument ("throwOnTestFailure", true);
var NUGET_DIFF_PRERELEASE = Argument ("nugetDiffPrerelease", false);
var SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? "false");
var SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower () == "true";
var NuGetToolPath = Context.Tools.Resolve ("nuget.exe");
var CakeToolPath = Context.Tools.Resolve ("Cake.exe");
var MDocPath = Context.Tools.Resolve ("mdoc.exe");
@ -67,6 +70,7 @@ var TRACKED_NUGETS = new Dictionary<string, Version> {
{ "HarfBuzzSharp", new Version (1, 0, 0) },
{ "HarfBuzzSharp.NativeAssets.Linux", new Version (1, 0, 0) },
{ "SkiaSharp.HarfBuzz", new Version (1, 57, 0) },
{ "SkiaSharp.Vulkan.SharpVk", new Version (1, 57, 0) },
};
#load "cake/msbuild.cake"
@ -145,14 +149,25 @@ Task ("tests")
void RunDesktopTest (string arch)
{
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln",
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests.sln",
platform: arch == "AnyCPU" ? "Any CPU" : arch,
bl: $"./output/binlogs/tests-desktop.{arch}.binlog");
// SkiaSharp.Tests.dll
try {
RunTests ($"./tests/SkiaSharp.Desktop.Tests/bin/{arch}/{CONFIGURATION}/SkiaSharp.Tests.dll", arch == "x86");
} catch {
failedTests++;
}
// SkiaSharp.Vulkan.Tests.dll
if (SUPPORT_VULKAN) {
try {
RunTests ($"./tests/SkiaSharp.Vulkan.Desktop.Tests/bin/{arch}/{CONFIGURATION}/SkiaSharp.Vulkan.Tests.dll", arch == "x86");
} catch {
failedTests++;
}
}
}
CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*");
@ -169,7 +184,9 @@ Task ("tests")
}
// .NET Core
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.sln",
// SkiaSharp.NetCore.Tests.csproj
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests.sln",
bl: $"./output/binlogs/tests-netcore.binlog");
try {
RunNetCoreTests ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.csproj");
@ -177,6 +194,15 @@ Task ("tests")
failedTests++;
}
// SkiaSharp.Vulkan.NetCore.Tests.csproj
if (SUPPORT_VULKAN) {
try {
RunNetCoreTests ("./tests/SkiaSharp.Vulkan.NetCore.Tests/SkiaSharp.Vulkan.NetCore.Tests.csproj");
} catch {
failedTests++;
}
}
if (failedTests > 0)
if (THROW_ON_TEST_FAILURE)
throw new Exception ($"There were {failedTests} failed tests.");

Просмотреть файл

@ -84,6 +84,9 @@ Task ("docs-api-diff")
comparer.SaveAssemblyApiInfo = true;
comparer.SaveAssemblyMarkdownDiff = true;
// some libraries depend in SkiaSharp
comparer.SearchPaths.Add($"./output/SkiaSharp/nuget/lib/netstandard2.0");
var filter = new NuGetVersions.Filter {
IncludePrerelease = NUGET_DIFF_PRERELEASE
};

2
externals/skia поставляемый

@ -1 +1 @@
Subproject commit fe5185495a925ca7ead436ed71904c510349b3ad
Subproject commit 5e82f5d99a2c77980efd793e0f9e4e89ee35f48d

Просмотреть файл

@ -6,6 +6,9 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));
string SUPPORT_GPU_VAR = Argument("supportGpu", EnvironmentVariable("SUPPORT_GPU") ?? "true").ToLower();
bool SUPPORT_GPU = SUPPORT_GPU_VAR == "1" || SUPPORT_GPU_VAR == "true";
string SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? "false");
bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower () == "true";
string CC = Argument("cc", EnvironmentVariable("CC"));
string CXX = Argument("ccx", EnvironmentVariable("CXX"));
string AR = Argument("ar", EnvironmentVariable("AR"));
@ -49,6 +52,7 @@ Task("libSkiaSharp")
$"skia_use_system_libpng=false " +
$"skia_use_system_libwebp=false " +
$"skia_use_system_zlib=false " +
$"skia_use_vulkan={SUPPORT_VULKAN} ".ToLower () +
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_SYSCALL_GETRANDOM', '-DXML_DEV_URANDOM' ] " +
$"extra_ldflags=[ '-static-libstdc++', '-static-libgcc', '-Wl,--version-script={map}' ] " +
compilers +

Просмотреть файл

@ -3,6 +3,9 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));
DirectoryPath LLVM_HOME = Argument("llvm", EnvironmentVariable("LLVM_HOME") ?? "C:/Program Files/LLVM");
string SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? "true");
bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower () == "true";
#load "../../cake/native-shared.cake"
#load "../../cake/msbuild.cake"
@ -37,6 +40,7 @@ Task("libSkiaSharp")
$"skia_use_system_libpng=false " +
$"skia_use_system_libwebp=false " +
$"skia_use_system_zlib=false " +
$"skia_use_vulkan={SUPPORT_VULKAN} ".ToLower () +
clang +
$"extra_cflags=[ '-DSKIA_C_DLL', '/MT', '/EHsc', '/Z7', '-D_HAS_AUTO_PTR_ETC=1' ] " +
$"extra_ldflags=[ '/DEBUG:FULL' ] " +

Просмотреть файл

@ -17,7 +17,7 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=868516</iconUrl>
<tags>xamarin graphics ios android windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<tags>xamarin graphics ios android windows uwp tvos watchos macos tizen cross-platform skiasharp harfbuzz</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>

Просмотреть файл

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.Vulkan.SharpVk</id>
<title>SkiaSharp.Vulkan.SharpVk</title>
<version>1.0.0</version>
<description>
This package adds Vulkan support to SkiaSharp via SharpVk.
</description>
<summary>
This package adds Vulkan support to SkiaSharp via SharpVk.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=868516</iconUrl>
<tags>xamarin graphics ios android windows uwp tvos watchos macos tizen cross-platform skiasharp vulkan</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<dependency id="SkiaSharp" version="1.0.0" />
<dependency id="SharpVk" version="0.4.2" />
</dependencies>
</metadata>
<files>
<!-- SkiaSharp.Vulkan.SharpVk.dll -->
<file src="lib/netstandard2.0/SkiaSharp.Vulkan.SharpVk.dll" />
<!-- <file src="lib/netstandard2.0/SkiaSharp.Vulkan.SharpVk.xml" /> -->
<!-- legal -->
<file src="LICENSE.txt" />
</files>
</package>

Просмотреть файл

@ -398,7 +398,7 @@ stages:
displayName: Tests (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: tests
additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE)
additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --supportVulkan=true
shouldPublish: false
requiredArtifacts:
- native_win32_x86_windows
@ -410,14 +410,14 @@ stages:
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.Desktop.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.Desktop.Tests/**/TestResults.xml'
testRunTitle: 'Windows .NET Framework Tests'
- task: PublishTestResults@2
displayName: Publish the .NET Core test results
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.NetCore.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.NetCore.Tests/**/TestResults.xml'
testRunTitle: 'Windows .NET Core Tests'
- template: azure-templates-bootstrapper.yml # Tests (macOS)
parameters:
@ -435,14 +435,14 @@ stages:
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.Desktop.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.Desktop.Tests/**/TestResults.xml'
testRunTitle: 'macOS Mono Tests'
- task: PublishTestResults@2
displayName: Publish the .NET Core test results
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.NetCore.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.NetCore.Tests/**/TestResults.xml'
testRunTitle: 'macOS .NET Core Tests'
- template: azure-templates-bootstrapper.yml # Tests (Linux)
parameters:
@ -462,14 +462,14 @@ stages:
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.Desktop.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.Desktop.Tests/**/TestResults.xml'
testRunTitle: 'Linux Mono Tests'
- task: PublishTestResults@2
displayName: Publish the .NET Core test results
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'tests/SkiaSharp.NetCore.Tests/**/TestResults.xml'
testResultsFiles: 'tests/SkiaSharp*.NetCore.Tests/**/TestResults.xml'
testRunTitle: 'Linux .NET Core Tests'
# TODO: add tests for linux no dependencies
# TODO: add tests for windows nano server

Просмотреть файл

@ -0,0 +1,97 @@
using System;
using System.Runtime.InteropServices;
using SharpVk;
using PhysicalDeviceFeaturesNative = SharpVk.Interop.PhysicalDeviceFeatures;
namespace SkiaSharp
{
public unsafe class GRSharpVkBackendContext : GRVkBackendContext
{
private Instance vkInstance;
private PhysicalDevice vkPhysicalDevice;
private Device vkDevice;
private Queue vkQueue;
private PhysicalDeviceFeatures? vkPhysicalDeviceFeatures;
private PhysicalDeviceFeaturesNative devFeatures;
private GCHandle devFeaturesHandle;
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
if (devFeaturesHandle.IsAllocated)
{
devFeaturesHandle.Free();
devFeaturesHandle = default;
}
}
}
public new Instance VkInstance
{
get => vkInstance;
set
{
vkInstance = value;
base.VkInstance = (IntPtr)vkInstance?.RawHandle.ToUInt64();
}
}
public new PhysicalDevice VkPhysicalDevice
{
get => vkPhysicalDevice;
set
{
vkPhysicalDevice = value;
base.VkPhysicalDevice = (IntPtr)vkPhysicalDevice?.RawHandle.ToUInt64();
}
}
public new Device VkDevice
{
get => vkDevice;
set
{
vkDevice = value;
base.VkDevice = (IntPtr)vkDevice?.RawHandle.ToUInt64();
}
}
public new Queue VkQueue
{
get => vkQueue;
set
{
vkQueue = value;
base.VkQueue = (IntPtr)vkQueue?.RawHandle.ToUInt64();
}
}
public new PhysicalDeviceFeatures? VkPhysicalDeviceFeatures
{
get => vkPhysicalDeviceFeatures;
set
{
vkPhysicalDeviceFeatures = value;
if (devFeaturesHandle.IsAllocated)
devFeaturesHandle.Free();
devFeatures = default;
devFeaturesHandle = default;
base.VkPhysicalDeviceFeatures = IntPtr.Zero;
if (value is PhysicalDeviceFeatures feat)
{
devFeatures = feat.ToNative();
devFeaturesHandle = GCHandle.Alloc(devFeatures, GCHandleType.Pinned);
base.VkPhysicalDeviceFeatures = devFeaturesHandle.AddrOfPinnedObject();
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using System;
using SharpVk;
namespace SkiaSharp
{
public static class GRVkExtensionsExtensions
{
public static void Initialize(this GRVkExtensions extensions, GRVkGetProcDelegate getProc, Instance instance, PhysicalDevice physicalDevice) =>
extensions.Initialize(getProc, instance, physicalDevice, null, null);
public static void Initialize(this GRVkExtensions extensions, GRVkGetProcDelegate getProc, Instance instance, PhysicalDevice physicalDevice, string[] instanceExtensions, string[] deviceExtensions) =>
extensions.Initialize(getProc, (IntPtr)instance?.RawHandle.ToUInt64(), (IntPtr)physicalDevice?.RawHandle.ToUInt64(), instanceExtensions, deviceExtensions);
}
}

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("SkiaSharp.Vulkan.SharpVk")]
[assembly: AssemblyDescription("This package adds Vulkan support to SkiaSharp via SharpVk.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("SkiaSharp.Vulkan.SharpVk")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: NeutralResourcesLanguage("en")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

Просмотреть файл

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>SkiaSharp</RootNamespace>
<AssemblyName>SkiaSharp.Vulkan.SharpVk</AssemblyName>
<SignAssembly>false</SignAssembly>
<PackagingGroup>SkiaSharp.Vulkan.SharpVk</PackagingGroup>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<DefineConstants>$(DefineConstants);NET_STANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants>$(DefineConstants);__DESKTOP__</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SharpVk" Version="0.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,69 @@
using SharpVk;
using PhysicalDeviceFeaturesNative = SharpVk.Interop.PhysicalDeviceFeatures;
namespace SkiaSharp
{
internal static class Utils
{
public static PhysicalDeviceFeaturesNative ToNative(this PhysicalDeviceFeatures features) =>
new PhysicalDeviceFeaturesNative
{
RobustBufferAccess = features.RobustBufferAccess,
FullDrawIndexUint32 = features.FullDrawIndexUint32,
ImageCubeArray = features.ImageCubeArray,
IndependentBlend = features.IndependentBlend,
GeometryShader = features.GeometryShader,
TessellationShader = features.TessellationShader,
SampleRateShading = features.SampleRateShading,
DualSourceBlend = features.DualSourceBlend,
LogicOp = features.LogicOp,
MultiDrawIndirect = features.MultiDrawIndirect,
DrawIndirectFirstInstance = features.DrawIndirectFirstInstance,
DepthClamp = features.DepthClamp,
DepthBiasClamp = features.DepthBiasClamp,
FillModeNonSolid = features.FillModeNonSolid,
DepthBounds = features.DepthBounds,
WideLines = features.WideLines,
LargePoints = features.LargePoints,
AlphaToOne = features.AlphaToOne,
MultiViewport = features.MultiViewport,
SamplerAnisotropy = features.SamplerAnisotropy,
TextureCompressionETC2 = features.TextureCompressionETC2,
TexturecompressionastcLdr = features.TexturecompressionastcLdr,
TextureCompressionBC = features.TextureCompressionBC,
OcclusionQueryPrecise = features.OcclusionQueryPrecise,
PipelineStatisticsQuery = features.PipelineStatisticsQuery,
VertexPipelineStoresAndAtomics = features.VertexPipelineStoresAndAtomics,
FragmentStoresAndAtomics = features.FragmentStoresAndAtomics,
ShaderTessellationAndGeometryPointSize = features.ShaderTessellationAndGeometryPointSize,
ShaderImageGatherExtended = features.ShaderImageGatherExtended,
ShaderStorageImageExtendedFormats = features.ShaderStorageImageExtendedFormats,
ShaderStorageImageMultisample = features.ShaderStorageImageMultisample,
ShaderStorageImageReadWithoutFormat = features.ShaderStorageImageReadWithoutFormat,
ShaderStorageImageWriteWithoutFormat = features.ShaderStorageImageWriteWithoutFormat,
ShaderUniformBufferArrayDynamicIndexing = features.ShaderUniformBufferArrayDynamicIndexing,
ShaderSampledImageArrayDynamicIndexing = features.ShaderSampledImageArrayDynamicIndexing,
ShaderStorageBufferArrayDynamicIndexing = features.ShaderStorageBufferArrayDynamicIndexing,
ShaderStorageImageArrayDynamicIndexing = features.ShaderStorageImageArrayDynamicIndexing,
ShaderClipDistance = features.ShaderClipDistance,
ShaderCullDistance = features.ShaderCullDistance,
ShaderFloat64 = features.ShaderFloat64,
ShaderInt64 = features.ShaderInt64,
ShaderInt16 = features.ShaderInt16,
ShaderResourceResidency = features.ShaderResourceResidency,
ShaderResourceMinLod = features.ShaderResourceMinLod,
SparseBinding = features.SparseBinding,
SparseResidencyBuffer = features.SparseResidencyBuffer,
SparseResidencyImage2D = features.SparseResidencyImage2D,
SparseResidencyImage3D = features.SparseResidencyImage3D,
SparseResidency2Samples = features.SparseResidency2Samples,
SparseResidency4Samples = features.SparseResidency4Samples,
SparseResidency8Samples = features.SparseResidency8Samples,
SparseResidency16Samples = features.SparseResidency16Samples,
SparseResidencyAliased = features.SparseResidencyAliased,
VariableMultisampleRate = features.VariableMultisampleRate,
InheritedQueries = features.InheritedQueries,
};
}
}

Просмотреть файл

@ -41,6 +41,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Desktop.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.GTK", "SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.GTK\SkiaSharp.Views.Forms.GTK.csproj", "{857CB6E9-BA27-4E94-A2D7-68BFF1EE193B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SkiaSharp.Vulkan", "SkiaSharp.Vulkan", "{66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{4606F63B-F0B1-418E-8B45-844361E17EB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -99,6 +103,10 @@ Global
{857CB6E9-BA27-4E94-A2D7-68BFF1EE193B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{857CB6E9-BA27-4E94-A2D7-68BFF1EE193B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{857CB6E9-BA27-4E94-A2D7-68BFF1EE193B}.Release|Any CPU.Build.0 = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -117,6 +125,7 @@ Global
{E20EECC0-6534-4625-AEDA-38D6EE0A99A0} = {4F5EBFFB-DD81-43B9-8531-156ED3639C91}
{6FB08346-1A02-4793-B5E1-4F739C6342D5} = {4F5EBFFB-DD81-43B9-8531-156ED3639C91}
{857CB6E9-BA27-4E94-A2D7-68BFF1EE193B} = {B3C4E4EC-68C7-4AFB-A6D4-1B2B0EB8C421}
{4606F63B-F0B1-418E-8B45-844361E17EB1} = {66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B4229170-607D-4886-9990-8FD5D86220B9}

Просмотреть файл

@ -73,6 +73,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Desktop.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.GTK", "SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.GTK\SkiaSharp.Views.Forms.GTK.csproj", "{9EEF1A57-C2E5-47C4-9ABA-A3DDC931B051}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SkiaSharp.Vulkan", "SkiaSharp.Vulkan", "{66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{4606F63B-F0B1-418E-8B45-844361E17EB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -195,6 +199,10 @@ Global
{9EEF1A57-C2E5-47C4-9ABA-A3DDC931B051}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EEF1A57-C2E5-47C4-9ABA-A3DDC931B051}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EEF1A57-C2E5-47C4-9ABA-A3DDC931B051}.Release|Any CPU.Build.0 = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -229,6 +237,7 @@ Global
{E20EECC0-6534-4625-AEDA-38D6EE0A99A0} = {EB592D4C-48E1-498D-8A9F-3AEA0C7FAB30}
{6FB08346-1A02-4793-B5E1-4F739C6342D5} = {EB592D4C-48E1-498D-8A9F-3AEA0C7FAB30}
{9EEF1A57-C2E5-47C4-9ABA-A3DDC931B051} = {EB592D4C-48E1-498D-8A9F-3AEA0C7FAB30}
{4606F63B-F0B1-418E-8B45-844361E17EB1} = {66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B8BED07-EA83-4BC1-B3BB-6B8EBC54C25F}

Просмотреть файл

@ -61,6 +61,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Desktop.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.WPF", "SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.WPF\SkiaSharp.Views.Forms.WPF.csproj", "{F55B16B3-4427-45EA-A93C-E12A7409E37D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SkiaSharp.Vulkan", "SkiaSharp.Vulkan", "{66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{4606F63B-F0B1-418E-8B45-844361E17EB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -159,6 +163,10 @@ Global
{F55B16B3-4427-45EA-A93C-E12A7409E37D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F55B16B3-4427-45EA-A93C-E12A7409E37D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F55B16B3-4427-45EA-A93C-E12A7409E37D}.Release|Any CPU.Build.0 = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -187,6 +195,7 @@ Global
{EDFAEF02-C462-4953-9CA4-4525479DD027} = {F19E1537-81B2-4D4F-A69E-78DC73ACC141}
{6FB08346-1A02-4793-B5E1-4F739C6342D5} = {F19E1537-81B2-4D4F-A69E-78DC73ACC141}
{F55B16B3-4427-45EA-A93C-E12A7409E37D} = {D40675E1-610D-4BBB-AA2A-BEF020717431}
{4606F63B-F0B1-418E-8B45-844361E17EB1} = {66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63A8C36E-4917-46DB-9AAD-522B8EC00C23}

Просмотреть файл

@ -93,6 +93,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.WPF",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.GTK", "SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.GTK\SkiaSharp.Views.Forms.GTK.csproj", "{A88ED3B7-79F8-446F-B6BF-82E94BB153C1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SkiaSharp.Vulkan", "SkiaSharp.Vulkan", "{66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{4606F63B-F0B1-418E-8B45-844361E17EB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -255,6 +259,10 @@ Global
{A88ED3B7-79F8-446F-B6BF-82E94BB153C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A88ED3B7-79F8-446F-B6BF-82E94BB153C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A88ED3B7-79F8-446F-B6BF-82E94BB153C1}.Release|Any CPU.Build.0 = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4606F63B-F0B1-418E-8B45-844361E17EB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -299,6 +307,7 @@ Global
{6FB08346-1A02-4793-B5E1-4F739C6342D5} = {F19E1537-81B2-4D4F-A69E-78DC73ACC141}
{A88ED3B7-79F8-446F-B6BF-72E94BB153C0} = {DCADA8CC-D50A-4BD9-B2E6-86696A43D819}
{A88ED3B7-79F8-446F-B6BF-82E94BB153C1} = {DCADA8CC-D50A-4BD9-B2E6-86696A43D819}
{4606F63B-F0B1-418E-8B45-844361E17EB1} = {66A0800A-CA70-4AC2-88B7-8E7C4CA7C914}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67EACD19-0CEA-4127-9842-549AA6FB84C9}

Просмотреть файл

@ -1,15 +1,19 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.215
VisualStudioVersion = 16.0.29930.152
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Desktop.Tests", "SkiaSharp.Desktop.Tests.csproj", "{F0179CDB-9435-4FB4-8E52-DBF191079491}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Desktop.Tests", "SkiaSharp.Desktop.Tests\SkiaSharp.Desktop.Tests.csproj", "{F0179CDB-9435-4FB4-8E52-DBF191079491}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarfBuzzSharp", "..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj", "{E1EC00B1-6CAE-4E80-80CA-DBD300FB699F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarfBuzzSharp", "..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj", "{E1EC00B1-6CAE-4E80-80CA-DBD300FB699F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\binding\SkiaSharp\SkiaSharp.csproj", "{E0FCC609-2CD1-4B35-BA81-80C3F25410B0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\binding\SkiaSharp\SkiaSharp.csproj", "{E0FCC609-2CD1-4B35-BA81-80C3F25410B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{AE91B0DA-7EB3-41B4-B113-78E6AD9DF62F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{AE91B0DA-7EB3-41B4-B113-78E6AD9DF62F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Vulkan.Desktop.Tests", "SkiaSharp.Vulkan.Desktop.Tests\SkiaSharp.Vulkan.Desktop.Tests.csproj", "{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "..\source\SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -69,6 +73,30 @@ Global
{AE91B0DA-7EB3-41B4-B113-78E6AD9DF62F}.Release|x64.Build.0 = Release|Any CPU
{AE91B0DA-7EB3-41B4-B113-78E6AD9DF62F}.Release|x86.ActiveCfg = Release|Any CPU
{AE91B0DA-7EB3-41B4-B113-78E6AD9DF62F}.Release|x86.Build.0 = Release|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|x64.ActiveCfg = Debug|x64
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|x64.Build.0 = Debug|x64
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|x86.ActiveCfg = Debug|x86
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|x86.Build.0 = Debug|x86
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|Any CPU.Build.0 = Release|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|x64.ActiveCfg = Release|x64
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|x64.Build.0 = Release|x64
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|x86.ActiveCfg = Release|x86
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|x86.Build.0 = Release|x86
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|x64.ActiveCfg = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|x64.Build.0 = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|x86.ActiveCfg = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|x86.Build.0 = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|Any CPU.Build.0 = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|x64.ActiveCfg = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|x64.Build.0 = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|x86.ActiveCfg = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -3,13 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\binding\SkiaSharp\SkiaSharp.csproj", "{3E1B158B-6C3B-4340-9F01-28E77D24F31D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\binding\SkiaSharp\SkiaSharp.csproj", "{3E1B158B-6C3B-4340-9F01-28E77D24F31D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarfBuzzSharp", "..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj", "{38FFD397-8A5E-421A-8649-24FE463E1DE9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HarfBuzzSharp", "..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj", "{38FFD397-8A5E-421A-8649-24FE463E1DE9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{0DE402FA-A101-438E-8528-6EA82E0FF803}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{0DE402FA-A101-438E-8528-6EA82E0FF803}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.NetCore.Tests", "SkiaSharp.NetCore.Tests.csproj", "{8E5284C3-5AAF-4902-B12F-84E9172F20E0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.NetCore.Tests", "SkiaSharp.NetCore.Tests\SkiaSharp.NetCore.Tests.csproj", "{8E5284C3-5AAF-4902-B12F-84E9172F20E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Vulkan.NetCore.Tests", "SkiaSharp.Vulkan.NetCore.Tests\SkiaSharp.Vulkan.NetCore.Tests.csproj", "{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Vulkan.SharpVk", "..\source\SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj", "{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,6 +37,14 @@ Global
{8E5284C3-5AAF-4902-B12F-84E9172F20E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E5284C3-5AAF-4902-B12F-84E9172F20E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E5284C3-5AAF-4902-B12F-84E9172F20E0}.Release|Any CPU.Build.0 = Release|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}.Release|Any CPU.Build.0 = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53DD2E5-55C4-4F7C-9316-D7FAD9A6F19F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -0,0 +1 @@


Просмотреть файл

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\source\SkiaSharp.Build.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9C3F6513-7B66-4DF3-ADBA-1030FEE9C111}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>SkiaSharp.Vulkan.Tests</RootNamespace>
<AssemblyName>SkiaSharp.Vulkan.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<ShouldIncludeNativeSkiaSharp>true</ShouldIncludeNativeSkiaSharp>
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
<SkipCopyToOutputDirectory>true</SkipCopyToOutputDirectory>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\AnyCPU\Debug\</OutputPath>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\AnyCPU\Release\</OutputPath>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.assemblyfixture" Version="2.0.3" />
<PackageReference Include="xunit.skippablefact" Version="1.3.12" />
<PackageReference Include="SharpVk" Version="0.4.2" />
<PackageReference Include="SharpVk.Glfw" Version="0.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj">
<Project>{2ae5d8c5-eac6-4515-89f2-a4994b41c925}</Project>
<Name>HarfBuzzSharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\binding\SkiaSharp\SkiaSharp.csproj">
<Project>{eb1bbdcc-fb07-40d5-8b9e-0079e2c2f2df}</Project>
<Name>SkiaSharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj">
<Project>{7cad1912-05a5-42e5-b7ba-81bb051f056a}</Project>
<Name>SkiaSharp.HarfBuzz</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj">
<Project>{a53dd2e5-55c4-4f7c-9316-d7fad9a6f19f}</Project>
<Name>SkiaSharp.Vulkan.SharpVk</Name>
</ProjectReference>
<ProjectReference Include="..\SkiaSharp.Desktop.Tests\SkiaSharp.Desktop.Tests.csproj">
<Project>{f0179cdb-9435-4fb4-8e52-dbf191079491}</Project>
<Name>SkiaSharp.Desktop.Tests</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\VulkanTests\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Content\**\*" Link="%(RecursiveDir)%(FileName)%(Extension)" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.dll" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\$(Platform)\libSkiaSharp.dll') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.pdb" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\$(Platform)\libSkiaSharp.pdb') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.dll" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.dll') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.pdb" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.pdb') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\osx\libSkiaSharp.dylib" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\osx\libSkiaSharp.dylib') or '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\osx\libHarfBuzzSharp.dylib" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\osx\libHarfBuzzSharp.dylib') or '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libSkiaSharp.so" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\linux\$(Platform)\libSkiaSharp.so') or '$(IsLinux)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libHarfBuzzSharp.so" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\linux\$(Platform)\libHarfBuzzSharp.so') or '$(IsLinux)' == 'true' " />
</ItemGroup>
<Import Project="..\..\source\SkiaSharp.Build.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<DefineConstants>$(DefineConstants);NET_STANDARD</DefineConstants>
<RootNamespace>SkiaSharp.Vulkan.Tests</RootNamespace>
<AssemblyName>SkiaSharp.Vulkan.Tests</AssemblyName>
<SignAssembly>false</SignAssembly>
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
<SkipCopyToOutputDirectory>true</SkipCopyToOutputDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
<PackageReference Include="xunit.skippablefact" Version="1.3.12" />
<PackageReference Include="SharpVk" Version="0.4.2" />
<PackageReference Include="SharpVk.Glfw" Version="0.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\binding\HarfBuzzSharp\HarfBuzzSharp.csproj" />
<ProjectReference Include="..\..\binding\SkiaSharp\SkiaSharp.csproj" />
<ProjectReference Include="..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj" />
<ProjectReference Include="..\..\source\SkiaSharp.Vulkan\SkiaSharp.Vulkan.SharpVk\SkiaSharp.Vulkan.SharpVk.csproj" />
<ProjectReference Include="..\SkiaSharp.NetCore.Tests\SkiaSharp.NetCore.Tests.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VulkanTests\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Content\**\*" Link="%(RecursiveDir)%(FileName)%(Extension)" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\output\native\windows\x64\libSkiaSharp.dll" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\x64\libSkiaSharp.dll') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\x64\libSkiaSharp.pdb" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\x64\libSkiaSharp.pdb') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\x64\libHarfBuzzSharp.dll" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\x64\libHarfBuzzSharp.dll') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\x64\libHarfBuzzSharp.pdb" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\windows\x64\libHarfBuzzSharp.pdb') or '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\osx\libSkiaSharp.dylib" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\osx\libSkiaSharp.dylib') or '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\osx\libHarfBuzzSharp.dylib" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\osx\libHarfBuzzSharp.dylib') or '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\linux\x64\libSkiaSharp.so" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\linux\x64\libSkiaSharp.so') or '$(IsLinux)' == 'true' " />
<Content Include="..\..\output\native\linux\x64\libHarfBuzzSharp.so" CopyToOutputDirectory="Always" Visible="false"
Condition=" Exists('..\..\output\native\linux\x64\libHarfBuzzSharp.so') or '$(IsLinux)' == 'true' " />
</ItemGroup>
</Project>

Просмотреть файл

@ -19,34 +19,131 @@ namespace SkiaSharp.Tests
}
}
[Obsolete]
[SkippableFact]
public void GRPixelConfigMappings()
public void GRPixelConfigMappingsToSKColorType()
{
foreach (GRPixelConfig value in Enum.GetValues(typeof(GRPixelConfig)))
{
if (IsEnumValueDeprected(value))
Assert.Throws<ArgumentOutOfRangeException>(() => value.ToNative());
else
Assert.Equal(value.ToString(), value.ToNative().ToString());
}
var colortype = value switch
{
GRPixelConfig.Unknown => SKColorType.Unknown,
GRPixelConfig.Alpha8 => SKColorType.Alpha8,
GRPixelConfig.Gray8 => SKColorType.Gray8,
GRPixelConfig.Rgb565 => SKColorType.Rgb565,
GRPixelConfig.Rgba4444 => SKColorType.Argb4444,
GRPixelConfig.Rgba8888 => SKColorType.Rgba8888,
GRPixelConfig.Rgb888 => SKColorType.Rgb888x,
GRPixelConfig.Bgra8888 => SKColorType.Bgra8888,
GRPixelConfig.Srgba8888 => SKColorType.Rgba8888,
GRPixelConfig.Rgba1010102 => SKColorType.Rgba1010102,
GRPixelConfig.AlphaHalf => SKColorType.AlphaF16,
GRPixelConfig.RgbaHalf => SKColorType.RgbaF16,
GRPixelConfig.Alpha8AsAlpha => SKColorType.Alpha8,
GRPixelConfig.Alpha8AsRed => SKColorType.Alpha8,
GRPixelConfig.AlphaHalfAsLum => SKColorType.AlphaF16,
GRPixelConfig.AlphaHalfAsRed => SKColorType.AlphaF16,
GRPixelConfig.Gray8AsLum => SKColorType.Gray8,
GRPixelConfig.Gray8AsRed => SKColorType.Gray8,
GRPixelConfig.RgbaHalfClamped => SKColorType.RgbaF16Clamped,
GRPixelConfig.Alpha16 => SKColorType.Alpha16,
GRPixelConfig.Rg1616 => SKColorType.Rg1616,
GRPixelConfig.Rgba16161616 => SKColorType.Rgba16161616,
GRPixelConfig.RgHalf => SKColorType.RgF16,
GRPixelConfig.Rg88 => SKColorType.Rg88,
GRPixelConfig.Rgb888x => SKColorType.Rgb888x,
GRPixelConfig.RgbEtc1 => SKColorType.Rgb888x,
_ => SKColorType.Unknown,
};
foreach (GRPixelConfigNative value in Enum.GetValues(typeof(GRPixelConfigNative)))
if (IsEnumValueDeprected(value))
Assert.Throws<ArgumentOutOfRangeException>(() => value.ToColorType());
else
Assert.Equal(colortype, value.ToColorType());
}
}
[Obsolete]
[SkippableFact]
public void GRPixelConfigMappingsFromSKColorType()
{
foreach (SKColorType value in Enum.GetValues(typeof(SKColorType)))
{
Assert.Equal(value.ToString(), value.FromNative().ToString());
var config = value switch
{
SKColorType.Unknown => GRPixelConfig.Unknown,
SKColorType.Alpha8 => GRPixelConfig.Alpha8,
SKColorType.Gray8 => GRPixelConfig.Gray8,
SKColorType.Rgb565 => GRPixelConfig.Rgb565,
SKColorType.Argb4444 => GRPixelConfig.Rgba4444,
SKColorType.Rgba8888 => GRPixelConfig.Rgba8888,
SKColorType.Rgb888x => GRPixelConfig.Rgb888,
SKColorType.Bgra8888 => GRPixelConfig.Bgra8888,
SKColorType.Rgba1010102 => GRPixelConfig.Rgba1010102,
SKColorType.AlphaF16 => GRPixelConfig.AlphaHalf,
SKColorType.RgbaF16 => GRPixelConfig.RgbaHalf,
SKColorType.RgbaF16Clamped => GRPixelConfig.RgbaHalfClamped,
SKColorType.Alpha16 => GRPixelConfig.Alpha16,
SKColorType.Rg1616 => GRPixelConfig.Rg1616,
SKColorType.Rgba16161616 => GRPixelConfig.Rgba16161616,
SKColorType.RgF16 => GRPixelConfig.RgHalf,
SKColorType.Rg88 => GRPixelConfig.Rg88,
_ => GRPixelConfig.Unknown,
};
Assert.Equal(config, value.ToPixelConfig());
}
}
[SkippableFact]
public void SKColorTypeMappings()
public void SKColorTypeMappingsToNative()
{
foreach (SKColorType value in Enum.GetValues(typeof(SKColorType)))
{
Assert.Equal(value.ToString(), value.ToNative().ToString());
}
var native = value.ToNative();
if (value == SKColorType.RgbaF16Clamped)
Assert.Equal(SKColorTypeNative.RgbaF16Norm, native);
else if (value == SKColorType.Alpha16)
Assert.Equal(SKColorTypeNative.A16Unorm, native);
else if (value == SKColorType.Rgba16161616)
Assert.Equal(SKColorTypeNative.R16g16b16a16Unorm, native);
else if (value == SKColorType.Rg1616)
Assert.Equal(SKColorTypeNative.R16g16Unorm, native);
else if (value == SKColorType.Rg88)
Assert.Equal(SKColorTypeNative.R8g8Unorm, native);
else if (value == SKColorType.AlphaF16)
Assert.Equal(SKColorTypeNative.A16Float, native);
else if (value == SKColorType.RgF16)
Assert.Equal(SKColorTypeNative.R16g16Float, native);
else
Assert.Equal(value.ToString(), native.ToString());
}
}
[SkippableFact]
public void SKColorTypeMappingsFromNative()
{
foreach (SKColorTypeNative value in Enum.GetValues(typeof(SKColorTypeNative)))
{
Assert.Equal(value.ToString(), value.FromNative().ToString());
var managed = value.FromNative();
if (value == SKColorTypeNative.RgbaF16Norm)
Assert.Equal(SKColorType.RgbaF16Clamped, managed);
else if (value == SKColorTypeNative.A16Unorm)
Assert.Equal(SKColorType.Alpha16, managed);
else if (value == SKColorTypeNative.R16g16b16a16Unorm)
Assert.Equal(SKColorType.Rgba16161616, managed);
else if (value == SKColorTypeNative.R16g16Unorm)
Assert.Equal(SKColorType.Rg1616, managed);
else if (value == SKColorTypeNative.R8g8Unorm)
Assert.Equal(SKColorType.Rg88, managed);
else if (value == SKColorTypeNative.A16Float)
Assert.Equal(SKColorType.AlphaF16, managed);
else if (value == SKColorTypeNative.R16g16Float)
Assert.Equal(SKColorType.RgF16, managed);
else
Assert.Equal(value.ToString(), managed.ToString());
}
}

Просмотреть файл

@ -19,6 +19,7 @@ namespace SkiaSharp.Tests
}
}
[Obsolete]
[SkippableFact]
public void ToGlSizedFormat()
{

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace SkiaSharp.Tests
{

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace SkiaSharp.Tests
{
@ -9,66 +6,20 @@ namespace SkiaSharp.Tests
{
private static readonly object fLock = new object();
private static ushort gWC;
private static readonly Win32Window window = new Win32Window("WglContext");
private static IntPtr fWindow;
private static IntPtr fDeviceContext;
private IntPtr fPbuffer;
private IntPtr fPbufferDC;
private IntPtr fPbufferGlContext;
static WglContext()
{
var wc = new WNDCLASS
{
cbClsExtra = 0,
cbWndExtra = 0,
hbrBackground = IntPtr.Zero,
hCursor = User32.LoadCursor(IntPtr.Zero, (int)User32.IDC_ARROW),
hIcon = User32.LoadIcon(IntPtr.Zero, (IntPtr)User32.IDI_APPLICATION),
hInstance = Kernel32.CurrentModuleHandle,
lpfnWndProc = (WNDPROC)User32.DefWindowProc,
lpszClassName = "Griffin",
lpszMenuName = null,
style = User32.CS_HREDRAW | User32.CS_VREDRAW | User32.CS_OWNDC
};
gWC = User32.RegisterClass(ref wc);
if (gWC == 0)
{
throw new Exception("Could not register window class.");
}
fWindow = User32.CreateWindow(
"Griffin",
"The Invisible Man",
WindowStyles.WS_OVERLAPPEDWINDOW,
0, 0,
1, 1,
IntPtr.Zero, IntPtr.Zero, Kernel32.CurrentModuleHandle, IntPtr.Zero);
if (fWindow == IntPtr.Zero)
{
throw new Exception($"Could not create window.");
}
fDeviceContext = User32.GetDC(fWindow);
if (fDeviceContext == IntPtr.Zero)
{
DestroyWindow();
throw new Exception("Could not get device context.");
}
if (!Wgl.HasExtension(fDeviceContext, "WGL_ARB_pixel_format") ||
!Wgl.HasExtension(fDeviceContext, "WGL_ARB_pbuffer"))
{
DestroyWindow();
throw new Exception("DC does not have extensions.");
}
}
private IntPtr pbufferHandle;
private IntPtr pbufferDeviceContextHandle;
private IntPtr pbufferGlContextHandle;
public WglContext()
{
if (!Wgl.HasExtension(window.DeviceContextHandle, "WGL_ARB_pixel_format") ||
!Wgl.HasExtension(window.DeviceContextHandle, "WGL_ARB_pbuffer"))
{
throw new Exception("DC does not have extensions.");
}
var iAttrs = new int[]
{
Wgl.WGL_ACCELERATION_ARB, Wgl.WGL_FULL_ACCELERATION_ARB,
@ -87,7 +38,7 @@ namespace SkiaSharp.Tests
lock (fLock)
{
// HACK: This call seems to cause deadlocks on some systems.
Wgl.wglChoosePixelFormatARB(fDeviceContext, iAttrs, null, (uint)piFormats.Length, piFormats, out nFormats);
Wgl.wglChoosePixelFormatARB(window.DeviceContextHandle, iAttrs, null, (uint)piFormats.Length, piFormats, out nFormats);
}
if (nFormats == 0)
{
@ -95,15 +46,15 @@ namespace SkiaSharp.Tests
throw new Exception("Could not get pixel formats.");
}
fPbuffer = Wgl.wglCreatePbufferARB(fDeviceContext, piFormats[0], 1, 1, null);
if (fPbuffer == IntPtr.Zero)
pbufferHandle = Wgl.wglCreatePbufferARB(window.DeviceContextHandle, piFormats[0], 1, 1, null);
if (pbufferHandle == IntPtr.Zero)
{
Destroy();
throw new Exception("Could not create Pbuffer.");
}
fPbufferDC = Wgl.wglGetPbufferDCARB(fPbuffer);
if (fPbufferDC == IntPtr.Zero)
pbufferDeviceContextHandle = Wgl.wglGetPbufferDCARB(pbufferHandle);
if (pbufferDeviceContextHandle == IntPtr.Zero)
{
Destroy();
throw new Exception("Could not get Pbuffer DC.");
@ -112,11 +63,11 @@ namespace SkiaSharp.Tests
var prevDC = Wgl.wglGetCurrentDC();
var prevGLRC = Wgl.wglGetCurrentContext();
fPbufferGlContext = Wgl.wglCreateContext(fPbufferDC);
pbufferGlContextHandle = Wgl.wglCreateContext(pbufferDeviceContextHandle);
Wgl.wglMakeCurrent(prevDC, prevGLRC);
if (fPbufferGlContext == IntPtr.Zero)
if (pbufferGlContextHandle == IntPtr.Zero)
{
Destroy();
throw new Exception("Could not creeate Pbuffer GL context.");
@ -125,7 +76,7 @@ namespace SkiaSharp.Tests
public override void MakeCurrent()
{
if (!Wgl.wglMakeCurrent(fPbufferDC, fPbufferGlContext))
if (!Wgl.wglMakeCurrent(pbufferDeviceContextHandle, pbufferGlContextHandle))
{
Destroy();
throw new Exception("Could not set the context.");
@ -134,7 +85,7 @@ namespace SkiaSharp.Tests
public override void SwapBuffers()
{
if (!Gdi32.SwapBuffers(fPbufferDC))
if (!Gdi32.SwapBuffers(pbufferDeviceContextHandle))
{
Destroy();
throw new Exception("Could not complete SwapBuffers.");
@ -143,33 +94,28 @@ namespace SkiaSharp.Tests
public override void Destroy()
{
if (!Wgl.HasExtension(fPbufferDC, "WGL_ARB_pbuffer"))
if (pbufferGlContextHandle != IntPtr.Zero)
{
// ASSERT
Wgl.wglDeleteContext(pbufferGlContextHandle);
pbufferGlContextHandle = IntPtr.Zero;
}
Wgl.wglDeleteContext(fPbufferGlContext);
Wgl.wglReleasePbufferDCARB?.Invoke(fPbuffer, fPbufferDC);
Wgl.wglDestroyPbufferARB?.Invoke(fPbuffer);
}
private static void DestroyWindow()
{
if (fWindow != IntPtr.Zero)
if (pbufferHandle != IntPtr.Zero)
{
if (fDeviceContext != IntPtr.Zero)
if (pbufferDeviceContextHandle != IntPtr.Zero)
{
User32.ReleaseDC(fWindow, fDeviceContext);
fDeviceContext = IntPtr.Zero;
if (!Wgl.HasExtension(pbufferDeviceContextHandle, "WGL_ARB_pbuffer"))
{
// ASSERT
}
Wgl.wglReleasePbufferDCARB?.Invoke(pbufferHandle, pbufferDeviceContextHandle);
pbufferDeviceContextHandle = IntPtr.Zero;
}
User32.DestroyWindow(fWindow);
fWindow = IntPtr.Zero;
Wgl.wglDestroyPbufferARB?.Invoke(pbufferHandle);
pbufferHandle = IntPtr.Zero;
}
User32.UnregisterClass("Griffin", Kernel32.CurrentModuleHandle);
}
public override GRGlTextureInfo CreateTexture(SKSizeI textureSize)

Просмотреть файл

@ -0,0 +1,76 @@
using System;
namespace SkiaSharp.Tests
{
public class Win32Window : IDisposable
{
private ushort classRegistration;
public string WindowClassName { get; }
public IntPtr WindowHandle { get; private set; }
public IntPtr DeviceContextHandle { get; private set; }
public Win32Window(string className)
{
WindowClassName = className;
var wc = new WNDCLASS
{
cbClsExtra = 0,
cbWndExtra = 0,
hbrBackground = IntPtr.Zero,
hCursor = User32.LoadCursor(IntPtr.Zero, (int)User32.IDC_ARROW),
hIcon = User32.LoadIcon(IntPtr.Zero, (IntPtr)User32.IDI_APPLICATION),
hInstance = Kernel32.CurrentModuleHandle,
lpfnWndProc = (WNDPROC)User32.DefWindowProc,
lpszClassName = WindowClassName,
lpszMenuName = null,
style = User32.CS_HREDRAW | User32.CS_VREDRAW | User32.CS_OWNDC
};
classRegistration = User32.RegisterClass(ref wc);
if (classRegistration == 0)
throw new Exception($"Could not register window class: {className}");
WindowHandle = User32.CreateWindow(
WindowClassName,
$"The Invisible Man ({className})",
WindowStyles.WS_OVERLAPPEDWINDOW,
0, 0,
1, 1,
IntPtr.Zero, IntPtr.Zero, Kernel32.CurrentModuleHandle, IntPtr.Zero);
if (WindowHandle == IntPtr.Zero)
throw new Exception($"Could not create window: {className}");
DeviceContextHandle = User32.GetDC(WindowHandle);
if (DeviceContextHandle == IntPtr.Zero)
{
Dispose();
throw new Exception($"Could not get device context: {className}");
}
}
public void Dispose()
{
if (WindowHandle != IntPtr.Zero)
{
if (DeviceContextHandle != IntPtr.Zero)
{
User32.ReleaseDC(WindowHandle, DeviceContextHandle);
DeviceContextHandle = IntPtr.Zero;
}
User32.DestroyWindow(WindowHandle);
WindowHandle = IntPtr.Zero;
}
if (classRegistration != 0)
{
User32.UnregisterClass(WindowClassName, Kernel32.CurrentModuleHandle);
classRegistration = 0;
}
}
}
}

Просмотреть файл

@ -55,7 +55,7 @@ namespace SkiaSharp.Tests
Assert.NotEqual(SKColors.Empty, color);
if (colorType == SKColorType.Gray8)
Assert.Equal(0xFF353535, color);
else if (colorType == SKColorType.Alpha8 || colorType == SKColorType.A16Float || colorType == SKColorType.A16Unnormalized)
else if (colorType == SKColorType.Alpha8 || colorType == SKColorType.AlphaF16 || colorType == SKColorType.Alpha16)
Assert.Equal(0xFF000000, color);
else
Assert.Equal(0xFFFF0000, color);
@ -95,11 +95,11 @@ namespace SkiaSharp.Tests
Assert.True(color.Red > color.Blue);
Assert.Equal(255, color.Alpha);
}
else if (colorType == SKColorType.Alpha8 || colorType == SKColorType.A16Unnormalized)
else if (colorType == SKColorType.Alpha8 || colorType == SKColorType.Alpha16)
{
Assert.Equal((SKColor)0xAA000000, color);
}
else if (colorType == SKColorType.A16Float)
else if (colorType == SKColorType.AlphaF16)
{
// rounding
Assert.Equal((SKColor)0xA9000000, color);

Просмотреть файл

@ -0,0 +1,31 @@
using System;
using Xunit;
namespace SkiaSharp.Vulkan.Tests
{
public class GRContextTest : VKTest
{
[Trait(CategoryKey, GpuCategory)]
[SkippableFact]
public void CreateVkContextIsValid()
{
using var ctx = CreateVkContext();
using var grVkBackendContext = new GRVkBackendContext
{
VkInstance = (IntPtr)ctx.Instance.RawHandle.ToUInt64(),
VkPhysicalDevice = (IntPtr)ctx.PhysicalDevice.RawHandle.ToUInt64(),
VkDevice = (IntPtr)ctx.Device.RawHandle.ToUInt64(),
VkQueue = (IntPtr)ctx.GraphicsQueue.RawHandle.ToUInt64(),
GraphicsQueueIndex = ctx.GraphicsFamily,
GetProc = ctx.GetProc
};
Assert.NotNull(grVkBackendContext);
using var grContext = GRContext.CreateVulkan(grVkBackendContext);
Assert.NotNull(grContext);
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
using Xunit;
namespace SkiaSharp.Vulkan.Tests
{
public class SharpVkBackendContextTest : VKTest
{
[Trait(CategoryKey, GpuCategory)]
[SkippableFact]
public void VkGpuSurfaceIsCreatedSharpVkTypes()
{
using var ctx = CreateVkContext();
using var grVkBackendContext = new GRSharpVkBackendContext
{
VkInstance = ctx.Instance,
VkPhysicalDevice = ctx.PhysicalDevice,
VkDevice = ctx.Device,
VkQueue = ctx.GraphicsQueue,
GraphicsQueueIndex = ctx.GraphicsFamily,
GetProc = ctx.GetProc,
VkPhysicalDeviceFeatures = ctx.PhysicalDevice.GetFeatures(),
};
Assert.NotNull(grVkBackendContext);
var baseType = grVkBackendContext as GRVkBackendContext;
Assert.NotNull(baseType);
Assert.Equal(ctx.Instance.RawHandle.ToUInt64(), (ulong)baseType.VkInstance);
Assert.Equal(ctx.PhysicalDevice.RawHandle.ToUInt64(), (ulong)baseType.VkPhysicalDevice);
Assert.Equal(ctx.Device.RawHandle.ToUInt64(), (ulong)baseType.VkDevice);
Assert.Equal(ctx.GraphicsQueue.RawHandle.ToUInt64(), (ulong)baseType.VkQueue);
Assert.NotEqual(0, (long)baseType.VkPhysicalDeviceFeatures);
}
[Trait(CategoryKey, GpuCategory)]
[SkippableFact]
public void PropertyIsSetAndUnset()
{
using var grVkBackendContext = new GRSharpVkBackendContext();
var baseType = grVkBackendContext as GRVkBackendContext;
Assert.Equal(0, (long)baseType.VkPhysicalDeviceFeatures);
grVkBackendContext.VkPhysicalDeviceFeatures = new global::SharpVk.PhysicalDeviceFeatures();
Assert.NotEqual(0, (long)baseType.VkPhysicalDeviceFeatures);
grVkBackendContext.VkPhysicalDeviceFeatures = null;
Assert.Equal(0, (long)baseType.VkPhysicalDeviceFeatures);
}
}
}

Просмотреть файл

@ -0,0 +1,72 @@
using System;
using Xunit;
namespace SkiaSharp.Vulkan.Tests
{
public class SKSurfaceTest : VKTest
{
[Trait(CategoryKey, GpuCategory)]
[SkippableFact]
public void VkGpuSurfaceIsCreated()
{
using var ctx = CreateVkContext();
using var grVkBackendContext = new GRVkBackendContext
{
VkInstance = (IntPtr)ctx.Instance.RawHandle.ToUInt64(),
VkPhysicalDevice = (IntPtr)ctx.PhysicalDevice.RawHandle.ToUInt64(),
VkDevice = (IntPtr)ctx.Device.RawHandle.ToUInt64(),
VkQueue = (IntPtr)ctx.GraphicsQueue.RawHandle.ToUInt64(),
GraphicsQueueIndex = ctx.GraphicsFamily,
GetProc = ctx.GetProc
};
Assert.NotNull(grVkBackendContext);
using var grContext = GRContext.CreateVulkan(grVkBackendContext);
using var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100));
Assert.NotNull(surface);
var canvas = surface.Canvas;
Assert.NotNull(canvas);
canvas.Clear(SKColors.Transparent);
canvas.Flush();
}
[Trait(CategoryKey, GpuCategory)]
[SkippableFact]
public void VkGpuSurfaceIsCreatedSharpVkTypes()
{
using var ctx = CreateVkContext();
using var grVkBackendContext = new GRSharpVkBackendContext
{
VkInstance = ctx.Instance,
VkPhysicalDevice = ctx.PhysicalDevice,
VkDevice = ctx.Device,
VkQueue = ctx.GraphicsQueue,
GraphicsQueueIndex = ctx.GraphicsFamily,
GetProc = ctx.GetProc
};
Assert.NotNull(grVkBackendContext);
using var grContext = GRContext.CreateVulkan(grVkBackendContext);
using var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100));
Assert.NotNull(surface);
var canvas = surface.Canvas;
Assert.NotNull(canvas);
canvas.Clear(SKColors.Transparent);
canvas.Flush();
}
}
}

Просмотреть файл

@ -0,0 +1,24 @@
using System;
using SkiaSharp.Tests;
using Xunit;
namespace SkiaSharp.Vulkan.Tests
{
public class VKTest : SKTest
{
protected VkContext CreateVkContext()
{
try
{
if (!IsWindows)
throw new PlatformNotSupportedException();
return new Win32VkContext();
}
catch (Exception ex)
{
throw new SkipException($"Unable to create Vulkan context: {ex.Message}");
}
}
}
}

Просмотреть файл

@ -0,0 +1,34 @@
using System;
using SharpVk.Khronos;
using Device = SharpVk.Device;
using Instance = SharpVk.Instance;
using PhysicalDevice = SharpVk.PhysicalDevice;
using Queue = SharpVk.Queue;
namespace SkiaSharp.Tests
{
public class VkContext : IDisposable
{
public virtual Instance Instance { get; protected set; }
public virtual PhysicalDevice PhysicalDevice { get; protected set; }
public virtual Surface Surface { get; protected set; }
public virtual Device Device { get; protected set; }
public virtual Queue GraphicsQueue { get; protected set; }
public virtual Queue PresentQueue { get; protected set; }
public virtual uint GraphicsFamily { get; protected set; }
public virtual uint PresentFamily { get; protected set; }
public virtual GRVkGetProcDelegate GetProc { get; protected set; }
public virtual void Dispose() =>
Instance?.Dispose();
}
}

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Linq;
using SharpVk;
using SharpVk.Khronos;
namespace SkiaSharp.Tests
{
public sealed class Win32VkContext : VkContext
{
private static readonly Win32Window window = new Win32Window("Win32VkContext");
public Win32VkContext()
{
Instance = Instance.Create(null, new[] { "VK_KHR_surface", "VK_KHR_win32_surface" });
PhysicalDevice = Instance.EnumeratePhysicalDevices().First();
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, window.WindowHandle);
(GraphicsFamily, PresentFamily) = FindQueueFamilies();
var queueInfos = new[]
{
new DeviceQueueCreateInfo { QueueFamilyIndex = GraphicsFamily, QueuePriorities = new[] { 1f } },
new DeviceQueueCreateInfo { QueueFamilyIndex = PresentFamily, QueuePriorities = new[] { 1f } },
};
Device = PhysicalDevice.CreateDevice(queueInfos, null, null);
GraphicsQueue = Device.GetQueue(GraphicsFamily, 0);
PresentQueue = Device.GetQueue(PresentFamily, 0);
GetProc = (context, name, instanceHandle, deviceHandle) =>
{
if (deviceHandle != IntPtr.Zero)
return Device.GetProcedureAddress(name);
return Instance.GetProcedureAddress(name);
};
}
private (uint, uint) FindQueueFamilies()
{
var queueFamilyProperties = PhysicalDevice.GetQueueFamilyProperties();
var graphicsFamily = queueFamilyProperties
.Select((properties, index) => new { properties, index })
.SkipWhile(pair => !pair.properties.QueueFlags.HasFlag(QueueFlags.Graphics))
.FirstOrDefault();
if (graphicsFamily == null)
throw new Exception("Unable to find graphics queue");
uint? presentFamily = default;
for (uint i = 0; i < queueFamilyProperties.Length; ++i)
{
if (PhysicalDevice.GetSurfaceSupport(i, Surface))
presentFamily = i;
}
if (!presentFamily.HasValue)
throw new Exception("Unable to find present queue");
return ((uint)graphicsFamily.index, presentFamily.Value);
}
}
}