diff --git a/sources/Directory.Packages.props b/sources/Directory.Packages.props
index 9dd446193d..ee769ca628 100644
--- a/sources/Directory.Packages.props
+++ b/sources/Directory.Packages.props
@@ -32,7 +32,7 @@
-
+
@@ -138,4 +138,4 @@
-
\ No newline at end of file
+
diff --git a/sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs
index 5c91312b21..0830f13bd9 100644
--- a/sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs
@@ -201,7 +201,7 @@ private unsafe void SetViewportImpl()
var viewportCopy = Viewport;
if (viewportDirty)
{
- vkCmdSetViewport(currentCommandList.NativeCommandBuffer, firstViewport: 0, viewportCount: 1, (Vortice.Mathematics.Viewport*) &viewportCopy);
+ vkCmdSetViewport(currentCommandList.NativeCommandBuffer, firstViewport: 0, viewportCount: 1, (VkViewport*) &viewportCopy);
viewportDirty = false;
}
@@ -211,7 +211,7 @@ private unsafe void SetViewportImpl()
{
// Use manual scissor
var scissor = scissors[0];
- var nativeScissor = new Vortice.Mathematics.Rectangle(scissor.Left, scissor.Top, scissor.Width, scissor.Height);
+ var nativeScissor = new VkRect2D(scissor.Left, scissor.Top, (uint)scissor.Width, (uint)scissor.Height);
vkCmdSetScissor(currentCommandList.NativeCommandBuffer, firstScissor: 0, scissorCount: 1, &nativeScissor);
}
}
@@ -219,7 +219,7 @@ private unsafe void SetViewportImpl()
{
// Use viewport
// Always update, because either scissor or viewport was dirty and we use viewport size
- var scissor = new Vortice.Mathematics.Rectangle((int) viewportCopy.X, (int) viewportCopy.Y, (int) viewportCopy.Width, (int) viewportCopy.Height);
+ var scissor = new VkRect2D((int) viewportCopy.X, (int) viewportCopy.Y, (uint) viewportCopy.Width, (uint) viewportCopy.Height);
vkCmdSetScissor(currentCommandList.NativeCommandBuffer, firstScissor: 0, scissorCount: 1, &scissor);
}
@@ -889,7 +889,7 @@ public unsafe void Copy(GraphicsResource source, GraphicsResource destination)
var copy = new VkBufferImageCopy
{
imageSubresource = new VkImageSubresourceLayers(sourceParent.NativeImageAspect, (uint) mipLevel, (uint) arraySlice, layerCount: 1),
- imageExtent = new Vortice.Mathematics.Size3(width, height, depth),
+ imageExtent = new VkExtent3D(width, height, depth),
bufferOffset = (ulong) destinationOffset
};
vkCmdCopyImageToBuffer(currentCommandList.NativeCommandBuffer, sourceParent.NativeImage, VkImageLayout.TransferSrcOptimal, destinationParent.NativeBuffer, regionCount: 1, ©);
@@ -909,7 +909,7 @@ public unsafe void Copy(GraphicsResource source, GraphicsResource destination)
var copy = new VkBufferImageCopy
{
imageSubresource = destinationSubresource,
- imageExtent = new Vortice.Mathematics.Size3(width, height, depth),
+ imageExtent = new VkExtent3D(width, height, depth),
bufferOffset = (ulong) sourceOffset
};
vkCmdCopyBufferToImage(currentCommandList.NativeCommandBuffer, sourceParent.NativeBuffer, destinationParent.NativeImage, VkImageLayout.TransferDstOptimal, regionCount: 1, ©);
@@ -920,7 +920,7 @@ public unsafe void Copy(GraphicsResource source, GraphicsResource destination)
{
srcSubresource = new VkImageSubresourceLayers(sourceParent.NativeImageAspect, (uint) mipLevel, (uint) arraySlice, (uint) sourceTexture.ArraySize),
dstSubresource = destinationSubresource,
- extent = new Vortice.Mathematics.Size3(width, height, depth)
+ extent = new VkExtent3D(width, height, depth)
};
vkCmdCopyImage(currentCommandList.NativeCommandBuffer, sourceParent.NativeImage, VkImageLayout.TransferSrcOptimal, destinationParent.NativeImage, VkImageLayout.TransferDstOptimal, regionCount: 1, ©);
}
@@ -1080,8 +1080,8 @@ public unsafe void CopyRegion(GraphicsResource source, int sourceSubresource, Re
bufferOffset = (ulong) sourceTexture.ComputeBufferOffset(sourceSubresource, 0),
bufferImageHeight = (uint) sourceTexture.Height,
bufferRowLength = (uint) sourceTexture.Width,
- imageOffset = new Vortice.Mathematics.Point3(dstX, dstY, dstZ),
- imageExtent = new Vortice.Mathematics.Size3(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
+ imageOffset = new VkOffset3D(dstX, dstY, dstZ),
+ imageExtent = new VkExtent3D(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
};
vkCmdCopyBufferToImage(currentCommandList.NativeCommandBuffer, sourceParent.NativeBuffer, destinationParent.NativeImage, VkImageLayout.TransferDstOptimal, regionCount: 1, ©);
}
@@ -1090,10 +1090,10 @@ public unsafe void CopyRegion(GraphicsResource source, int sourceSubresource, Re
var copy = new VkImageCopy
{
srcSubresource = new VkImageSubresourceLayers(sourceParent.NativeImageAspect, (uint) sourceTexture.MipLevel, (uint) sourceTexture.ArraySlice, (uint) sourceTexture.ArraySize),
- srcOffset = new Vortice.Mathematics.Point3(region.Left, region.Top, region.Front),
+ srcOffset = new VkOffset3D(region.Left, region.Top, region.Front),
dstSubresource = destinationSubresource,
- dstOffset = new Vortice.Mathematics.Point3(dstX, dstY, dstZ),
- extent = new Vortice.Mathematics.Size3(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
+ dstOffset = new VkOffset3D(dstX, dstY, dstZ),
+ extent = new VkExtent3D(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
};
vkCmdCopyImage(currentCommandList.NativeCommandBuffer, sourceParent.NativeImage, VkImageLayout.TransferSrcOptimal, destinationParent.NativeImage, VkImageLayout.TransferDstOptimal, regionCount: 1, ©);
}
@@ -1219,8 +1219,8 @@ internal unsafe void UpdateSubresource(GraphicsResource resource, int subResourc
imageSubresource = new VkImageSubresourceLayers { aspectMask = VkImageAspectFlags.Color, baseArrayLayer = (uint) arraySlice, layerCount = 1, mipLevel = (uint) mipSlice },
bufferRowLength = (uint) (databox.RowPitch * texture.Format.BlockWidth() / texture.Format.BlockSize()),
bufferImageHeight = (uint) (databox.SlicePitch * texture.Format.BlockHeight() / databox.RowPitch),
- imageOffset = new Vortice.Mathematics.Point3(region.Left, region.Top, region.Front),
- imageExtent = new Vortice.Mathematics.Size3(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
+ imageOffset = new VkOffset3D(region.Left, region.Top, region.Front),
+ imageExtent = new VkExtent3D(region.Right - region.Left, region.Bottom - region.Top, region.Back - region.Front)
};
vkCmdCopyBufferToImage(currentCommandList.NativeCommandBuffer, uploadResource, texture.NativeImage, VkImageLayout.TransferDstOptimal, 1, &bufferCopy);
@@ -1435,7 +1435,7 @@ private unsafe void EnsureRenderPass()
sType = VkStructureType.RenderPassBeginInfo,
renderPass = pipelineRenderPass,
framebuffer = activeFramebuffer,
- renderArea = new Vortice.Mathematics.Rectangle(0, 0, renderTarget.ViewWidth, renderTarget.ViewHeight)
+ renderArea = new VkRect2D(0, 0, (uint)renderTarget.ViewWidth, (uint)renderTarget.ViewHeight)
};
vkCmdBeginRenderPass(currentCommandList.NativeCommandBuffer, &renderPassBegin, VkSubpassContents.Inline);
diff --git a/sources/engine/Stride.Graphics/Vulkan/GraphicsAdapterFactory.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/GraphicsAdapterFactory.Vulkan.cs
index aa1f7118b3..c00345daa8 100644
--- a/sources/engine/Stride.Graphics/Vulkan/GraphicsAdapterFactory.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/GraphicsAdapterFactory.Vulkan.cs
@@ -3,13 +3,13 @@
#if STRIDE_GRAPHICS_API_VULKAN
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Vortice.Vulkan;
using static Vortice.Vulkan.Vulkan;
using Stride.Core;
using Stride.Core.Diagnostics;
+using System.Text;
namespace Stride.Graphics
{
@@ -83,7 +83,6 @@ internal static GraphicsAdapterFactoryInstance GetInstance(bool enableValidation
internal class GraphicsAdapterFactoryInstance : IDisposable
{
private VkDebugUtilsMessengerEXT debugReportCallback;
- private vkDebugUtilsMessengerCallbackEXT debugReport;
internal VkInstance NativeInstance;
internal bool HasXlibSurfaceSupport;
@@ -93,146 +92,169 @@ internal class GraphicsAdapterFactoryInstance : IDisposable
public unsafe GraphicsAdapterFactoryInstance(bool enableValidation)
{
+ var pEngineName = new VkUtf8ReadOnlyString("Stride"u8);
var applicationInfo = new VkApplicationInfo
{
- sType = VkStructureType.ApplicationInfo,
- apiVersion = new VkVersion(1, 0, 0),
- pEngineName = (byte*)Marshal.StringToHGlobalAnsi("Stride"),
+ pEngineName = pEngineName,
//engineVersion = new VkVersion()
};
- var validationLayerNames = new[]
+ var validationLayerNames = stackalloc VkUtf8String[]
{
- "VK_LAYER_KHRONOS_validation",
+ VK_LAYER_KHRONOS_VALIDATION_EXTENSION_NAME,
};
-
- IntPtr[] enabledLayerNames = new IntPtr[0];
+ var validationLayers = new Span(validationLayerNames, 1);
+ var enabledLayerNames = new List();
if (enableValidation)
{
var layers = vkEnumerateInstanceLayerProperties();
- var availableLayerNames = new HashSet();
for (int index = 0; index < layers.Length; index++)
{
var properties = layers[index];
- var namePointer = properties.layerName;
- var name = Marshal.PtrToStringAnsi((IntPtr)namePointer);
+ var name = new VkUtf8String(properties.layerName);
+ var indexOfLayerName = validationLayers.IndexOf(name);
- availableLayerNames.Add(name);
+ if (indexOfLayerName >= 0)
+ enabledLayerNames.Add(validationLayerNames[indexOfLayerName]);
}
- enabledLayerNames = validationLayerNames
- .Where(x => availableLayerNames.Contains(x))
- .Select(Marshal.StringToHGlobalAnsi).ToArray();
-
// Check if validation was really available
- enableValidation = enabledLayerNames.Length > 0;
+ enableValidation = enabledLayerNames.Count > 0;
}
- var extensionProperties = vkEnumerateInstanceExtensionProperties();
- var availableExtensionNames = new List();
- var desiredExtensionNames = new List();
+ var supportedExtensionNames = stackalloc VkUtf8String[]
+ {
+ VK_KHR_SURFACE_EXTENSION_NAME,
+ VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
+ VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
+ VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
+ VK_KHR_XCB_SURFACE_EXTENSION_NAME,
+ VK_EXT_DEBUG_UTILS_EXTENSION_NAME
+ };
+ var supportedExtensions = new Span(supportedExtensionNames, 6);
+ var availableExtensionNames = GetAvailableExtensionNames(supportedExtensions);
+ ValidateSurfaceExtensionNamesAvailability(availableExtensionNames);
+ var desiredExtensionNames = new HashSet
+ {
+ VK_KHR_SURFACE_EXTENSION_NAME,
+ GetPlatformRelatedSurfaceExtensionName(availableExtensionNames)
+ };
+
+ HasXlibSurfaceSupport = desiredExtensionNames.Contains(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
- for (int index = 0; index < extensionProperties.Length; index++)
+ bool enableDebugReport = enableValidation && availableExtensionNames.Contains(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
+ if (enableDebugReport)
+ desiredExtensionNames.Add(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
+
+ using VkStringArray ppEnabledLayerNames = new(enabledLayerNames);
+ using VkStringArray ppEnabledExtensionNames = new(desiredExtensionNames);
+
+ var instanceCreateInfo = new VkInstanceCreateInfo
+ {
+ sType = VkStructureType.InstanceCreateInfo,
+ pApplicationInfo = &applicationInfo,
+ enabledLayerCount = ppEnabledLayerNames.Length,
+ ppEnabledLayerNames = ppEnabledLayerNames,
+ enabledExtensionCount = ppEnabledExtensionNames.Length,
+ ppEnabledExtensionNames = ppEnabledExtensionNames,
+ };
+
+ vkCreateInstance(&instanceCreateInfo, null, out NativeInstance);
+ vkLoadInstance(NativeInstance);
+
+ // Check if validation layer was available (otherwise detected count is 0)
+ if (enableValidation)
+ {
+ var createInfo = new VkDebugUtilsMessengerCreateInfoEXT
+ {
+ sType = VkStructureType.DebugUtilsMessengerCreateInfoEXT,
+ messageSeverity = VkDebugUtilsMessageSeverityFlagsEXT.Verbose | VkDebugUtilsMessageSeverityFlagsEXT.Error | VkDebugUtilsMessageSeverityFlagsEXT.Warning,
+ messageType = VkDebugUtilsMessageTypeFlagsEXT.General | VkDebugUtilsMessageTypeFlagsEXT.Validation | VkDebugUtilsMessageTypeFlagsEXT.Performance,
+ pfnUserCallback = &DebugReport
+ };
+
+ vkCreateDebugUtilsMessengerEXT(NativeInstance, &createInfo, null, out debugReportCallback).CheckResult();
+ }
+ }
+
+ private unsafe static HashSet GetAvailableExtensionNames(Span supportedExtensionNames)
+ {
+ var availableExtensionNames = new HashSet();
+ vkEnumerateInstanceExtensionProperties(out uint extensionCount).CheckResult();
+ var extensionProperties = new VkExtensionProperties[extensionCount];
+ vkEnumerateInstanceExtensionProperties(extensionProperties).CheckResult();
+
+ for (int index = 0; index < extensionCount; index++)
{
var extensionProperty = extensionProperties[index];
- var name = Marshal.PtrToStringAnsi((IntPtr)extensionProperty.extensionName);
- availableExtensionNames.Add(name);
+ var name = new VkUtf8String(extensionProperty.extensionName).Span;
+ var indexOfExtensionName = supportedExtensionNames.IndexOf(name);
+
+ if (indexOfExtensionName >= 0)
+ availableExtensionNames.Add(supportedExtensionNames[indexOfExtensionName]);
}
- desiredExtensionNames.Add(KHRSurfaceExtensionName);
- if (!availableExtensionNames.Contains(KHRSurfaceExtensionName))
- throw new InvalidOperationException($"Required extension {KHRSurfaceExtensionName} is not available");
+ return availableExtensionNames;
+ }
+
+ private static void ValidateSurfaceExtensionNamesAvailability(HashSet availableExtensionNames)
+ {
+ if (!availableExtensionNames.Contains(VK_KHR_SURFACE_EXTENSION_NAME))
+ throw new InvalidOperationException($"Required extension {Encoding.UTF8.GetString(VK_KHR_SURFACE_EXTENSION_NAME)} is not available");
if (Platform.Type == PlatformType.Windows)
{
- desiredExtensionNames.Add(KHRWin32SurfaceExtensionName);
- if (!availableExtensionNames.Contains(KHRWin32SurfaceExtensionName))
- throw new InvalidOperationException($"Required extension {KHRWin32SurfaceExtensionName} is not available");
+ if (!availableExtensionNames.Contains(VK_KHR_WIN32_SURFACE_EXTENSION_NAME))
+ throw new InvalidOperationException($"Required extension {Encoding.UTF8.GetString(VK_KHR_WIN32_SURFACE_EXTENSION_NAME)} is not available");
}
else if (Platform.Type == PlatformType.Android)
{
- desiredExtensionNames.Add(KHRAndroidSurfaceExtensionName);
- if (!availableExtensionNames.Contains(KHRAndroidSurfaceExtensionName))
- throw new InvalidOperationException($"Required extension {KHRAndroidSurfaceExtensionName} is not available");
+ if (!availableExtensionNames.Contains(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME))
+ throw new InvalidOperationException($"Required extension {Encoding.UTF8.GetString(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME)} is not available");
}
else if (Platform.Type == PlatformType.Linux)
{
- if (availableExtensionNames.Contains("VK_KHR_xlib_surface"))
- {
- desiredExtensionNames.Add("VK_KHR_xlib_surface");
- HasXlibSurfaceSupport = true;
- }
- else if (availableExtensionNames.Contains("VK_KHR_xcb_surface"))
- {
- desiredExtensionNames.Add("VK_KHR_xcb_surface");
- }
- else
+ if (!availableExtensionNames.Contains(VK_KHR_XLIB_SURFACE_EXTENSION_NAME)
+ && !availableExtensionNames.Contains(VK_KHR_XCB_SURFACE_EXTENSION_NAME))
{
throw new InvalidOperationException("None of the supported surface extensions VK_KHR_xcb_surface or VK_KHR_xlib_surface is available");
}
}
+ }
- bool enableDebugReport = enableValidation && availableExtensionNames.Contains(EXTDebugUtilsExtensionName);
- if (enableDebugReport)
- desiredExtensionNames.Add(EXTDebugUtilsExtensionName);
-
- var enabledExtensionNames = desiredExtensionNames.Select(Marshal.StringToHGlobalAnsi).ToArray();
+ private static VkUtf8String GetPlatformRelatedSurfaceExtensionName(HashSet availableExtensionNames)
+ {
+ VkUtf8String surfaceExtensionName = VK_KHR_SURFACE_EXTENSION_NAME;
- try
+ if (Platform.Type == PlatformType.Windows)
{
- fixed (void* enabledExtensionNamesPointer = &enabledExtensionNames[0])
- fixed (void* fEnabledLayerNames = enabledLayerNames) // null if array is empty or null
- {
- var instanceCreateInfo = new VkInstanceCreateInfo
- {
- sType = VkStructureType.InstanceCreateInfo,
- pApplicationInfo = &applicationInfo,
- enabledLayerCount = enabledLayerNames != null ? (uint)enabledLayerNames.Length : 0,
- ppEnabledLayerNames = (byte**)fEnabledLayerNames,
- enabledExtensionCount = (uint)enabledExtensionNames.Length,
- ppEnabledExtensionNames = (byte**)enabledExtensionNamesPointer,
- };
-
- vkCreateInstance(&instanceCreateInfo, null, out NativeInstance);
- vkLoadInstance(NativeInstance);
- }
-
- // Check if validation layer was available (otherwise detected count is 0)
- if (enableValidation)
- {
- debugReport = DebugReport;
- var createInfo = new VkDebugUtilsMessengerCreateInfoEXT
- {
- sType = VkStructureType.DebugUtilsMessengerCreateInfoEXT,
- messageSeverity = VkDebugUtilsMessageSeverityFlagsEXT.Verbose | VkDebugUtilsMessageSeverityFlagsEXT.Error | VkDebugUtilsMessageSeverityFlagsEXT.Warning,
- messageType = VkDebugUtilsMessageTypeFlagsEXT.General | VkDebugUtilsMessageTypeFlagsEXT.Validation | VkDebugUtilsMessageTypeFlagsEXT.Performance,
- pfnUserCallback = Marshal.GetFunctionPointerForDelegate(debugReport)
- };
-
- vkCreateDebugUtilsMessengerEXT(NativeInstance, &createInfo, null, out debugReportCallback).CheckResult();
- }
+ surfaceExtensionName = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
+ }
+ else if (Platform.Type == PlatformType.Android)
+ {
+ surfaceExtensionName = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
}
- finally
+ else if (Platform.Type == PlatformType.Linux)
{
- foreach (var enabledExtensionName in enabledExtensionNames)
+ if (availableExtensionNames.Contains(VK_KHR_XLIB_SURFACE_EXTENSION_NAME))
{
- Marshal.FreeHGlobal(enabledExtensionName);
+ surfaceExtensionName = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
}
-
- foreach (var enabledLayerName in enabledLayerNames)
+ else if (availableExtensionNames.Contains(VK_KHR_XCB_SURFACE_EXTENSION_NAME))
{
- Marshal.FreeHGlobal(enabledLayerName);
+ surfaceExtensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
}
-
- Marshal.FreeHGlobal((IntPtr)applicationInfo.pEngineName);
}
+
+ return surfaceExtensionName;
}
- private unsafe static VkBool32 DebugReport(VkDebugUtilsMessageSeverityFlagsEXT severity, VkDebugUtilsMessageTypeFlagsEXT types, VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, IntPtr userData)
+ [UnmanagedCallersOnly]
+ private unsafe static uint DebugReport(VkDebugUtilsMessageSeverityFlagsEXT severity, VkDebugUtilsMessageTypeFlagsEXT types, VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* userData)
{
- var message = Vortice.Vulkan.Interop.GetString(pCallbackData->pMessage);
+ var message = new VkUtf8String(pCallbackData->pMessage).ToString();
// Redirect to log
if (severity == VkDebugUtilsMessageSeverityFlagsEXT.Error)
@@ -252,7 +274,7 @@ private unsafe static VkBool32 DebugReport(VkDebugUtilsMessageSeverityFlagsEXT s
Log.Verbose(message);
}
- return false;
+ return VK_FALSE;
}
public unsafe void Dispose()
diff --git a/sources/engine/Stride.Graphics/Vulkan/GraphicsDevice.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/GraphicsDevice.Vulkan.cs
index ed3e433b40..7c237ccee7 100644
--- a/sources/engine/Stride.Graphics/Vulkan/GraphicsDevice.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/GraphicsDevice.Vulkan.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Threading;
using Vortice.Vulkan;
using static Vortice.Vulkan.Vulkan;
@@ -287,56 +286,37 @@ private unsafe void InitializePlatformDevice(GraphicsProfile[] graphicsProfiles,
depthClamp = true,
};
- var extensionProperties = vkEnumerateDeviceExtensionProperties(NativePhysicalDevice);
- var availableExtensionNames = new List();
- var desiredExtensionNames = new List();
-
- fixed (VkExtensionProperties* extensionPropertiesPtr = extensionProperties)
+ var supportedExtensionProperties = stackalloc VkUtf8String[]
{
- for (int index = 0; index < extensionProperties.Length; index++)
- {
- var namePointer = new IntPtr(extensionPropertiesPtr[index].extensionName);
- var name = Marshal.PtrToStringAnsi(namePointer);
- availableExtensionNames.Add(name);
- }
- }
-
- desiredExtensionNames.Add(KHRSwapchainExtensionName);
- if (!availableExtensionNames.Contains(KHRSwapchainExtensionName))
- throw new InvalidOperationException();
+ VK_KHR_SWAPCHAIN_EXTENSION_NAME,
+ VK_EXT_DEBUG_MARKER_EXTENSION_NAME,
+ };
+ var supportedProperties = new Span(supportedExtensionProperties, 2);
+ var availableExtensionProperties = GetAvailableExtensionProperties(supportedProperties);
+ ValidateExtensionPropertiesAvailability(availableExtensionProperties);
+ var desiredExtensionProperties = new HashSet
+ {
+ VK_KHR_SWAPCHAIN_EXTENSION_NAME
+ };
- if (availableExtensionNames.Contains(EXTDebugMarkerExtensionName) && IsDebugMode)
+ if (availableExtensionProperties.Contains(VK_EXT_DEBUG_MARKER_EXTENSION_NAME) && IsDebugMode)
{
- desiredExtensionNames.Add(EXTDebugMarkerExtensionName);
+ desiredExtensionProperties.Add(VK_EXT_DEBUG_MARKER_EXTENSION_NAME);
IsProfilingSupported = true;
}
- var enabledExtensionNames = desiredExtensionNames.Select(Marshal.StringToHGlobalAnsi).ToArray();
-
- try
- {
- // fixed yields null if array is empty or null
- fixed (void* fEnabledExtensionNames = enabledExtensionNames) {
- var deviceCreateInfo = new VkDeviceCreateInfo
- {
- sType = VkStructureType.DeviceCreateInfo,
- queueCreateInfoCount = 1,
- pQueueCreateInfos = &queueCreateInfo,
- enabledExtensionCount = (uint)enabledExtensionNames.Length,
- ppEnabledExtensionNames = (byte**)fEnabledExtensionNames,
- pEnabledFeatures = &enabledFeature,
- };
-
- vkCreateDevice(NativePhysicalDevice, &deviceCreateInfo, null, out nativeDevice);
- }
- }
- finally
+ using VkStringArray ppEnabledExtensionNames = new(desiredExtensionProperties);
+ var deviceCreateInfo = new VkDeviceCreateInfo
{
- foreach (var enabledExtensionName in enabledExtensionNames)
- {
- Marshal.FreeHGlobal(enabledExtensionName);
- }
- }
+ sType = VkStructureType.DeviceCreateInfo,
+ queueCreateInfoCount = 1,
+ pQueueCreateInfos = &queueCreateInfo,
+ enabledExtensionCount = ppEnabledExtensionNames.Length,
+ ppEnabledExtensionNames = ppEnabledExtensionNames,
+ pEnabledFeatures = &enabledFeature,
+ };
+
+ vkCreateDevice(NativePhysicalDevice, &deviceCreateInfo, null, out nativeDevice);
vkGetDeviceQueue(nativeDevice, 0, 0, out NativeCommandQueue);
@@ -364,6 +344,33 @@ private unsafe void InitializePlatformDevice(GraphicsProfile[] graphicsProfiles,
EmptyTexture = Texture.New2D(this, 1, 1, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.ShaderResource);
}
+ private unsafe HashSet GetAvailableExtensionProperties(Span supportedExtensionProperties)
+ {
+ var availableExtensionProperties = new HashSet();
+ var extensionProperties = vkEnumerateDeviceExtensionProperties(NativePhysicalDevice);
+
+ fixed (VkExtensionProperties* extensionPropertiesPtr = extensionProperties)
+ {
+ for (int index = 0; index < extensionProperties.Length; index++)
+ {
+ var namePointer = extensionPropertiesPtr[index].extensionName;
+ var name = new VkUtf8String(namePointer);
+ var indexOfExtensionName = supportedExtensionProperties.IndexOf(name);
+
+ if (indexOfExtensionName >= 0)
+ availableExtensionProperties.Add(supportedExtensionProperties[indexOfExtensionName]);
+ }
+ }
+
+ return availableExtensionProperties;
+ }
+
+ private static void ValidateExtensionPropertiesAvailability(HashSet availableExtensionProperties)
+ {
+ if (!availableExtensionProperties.Contains(VK_KHR_SWAPCHAIN_EXTENSION_NAME))
+ throw new InvalidOperationException();
+ }
+
internal unsafe IntPtr AllocateUploadBuffer(int size, out VkBuffer resource, out int offset)
{
// TODO D3D12 thread safety, should we simply use locks?
@@ -423,7 +430,7 @@ protected unsafe void AllocateMemory(VkMemoryPropertyFlags memoryProperties)
if ((typeBits & 1) == 1)
{
// Type is available, does it match user properties?
- var memoryType = *(&physicalDeviceMemoryProperties.memoryTypes_0 + i);
+ var memoryType = *(&physicalDeviceMemoryProperties.memoryTypes[0] + i);
if ((memoryType.propertyFlags & memoryProperties) == memoryProperties)
{
allocateInfo.memoryTypeIndex = i;
diff --git a/sources/engine/Stride.Graphics/Vulkan/GraphicsOutput.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/GraphicsOutput.Vulkan.cs
index 1adb291e73..f07d27f4d3 100644
--- a/sources/engine/Stride.Graphics/Vulkan/GraphicsOutput.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/GraphicsOutput.Vulkan.cs
@@ -37,7 +37,7 @@ internal GraphicsOutput(GraphicsAdapter adapter, VkDisplayPropertiesKHR displayP
this.outputIndex = outputIndex;
this.displayProperties = displayProperties;
- desktopBounds = new Rectangle(0, 0, (int)displayProperties.physicalResolution.Width, (int)displayProperties.physicalResolution.Height);
+ desktopBounds = new Rectangle(0, 0, (int)displayProperties.physicalResolution.width, (int)displayProperties.physicalResolution.height);
}
///
diff --git a/sources/engine/Stride.Graphics/Vulkan/GraphicsResource.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/GraphicsResource.Vulkan.cs
index ef04f6eb19..b3f09a0128 100644
--- a/sources/engine/Stride.Graphics/Vulkan/GraphicsResource.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/GraphicsResource.Vulkan.cs
@@ -70,7 +70,7 @@ protected unsafe void AllocateMemory(VkMemoryPropertyFlags memoryProperties, VkM
if ((typeBits & 1) == 1)
{
// Type is available, does it match user properties?
- var memoryType = *(&physicalDeviceMemoryProperties.memoryTypes_0 + i);
+ var memoryType = *(&physicalDeviceMemoryProperties.memoryTypes[0] + i);
if ((memoryType.propertyFlags & memoryProperties) == memoryProperties)
{
allocateInfo.memoryTypeIndex = i;
diff --git a/sources/engine/Stride.Graphics/Vulkan/QueryPool.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/QueryPool.Vulkan.cs
index dda55bec99..6532961eea 100644
--- a/sources/engine/Stride.Graphics/Vulkan/QueryPool.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/QueryPool.Vulkan.cs
@@ -16,7 +16,7 @@ public unsafe bool TryGetData(long[] dataArray)
fixed (long* dataPointer = &dataArray[0])
{
// Read back all results
- var result = vkGetQueryPoolResults(GraphicsDevice.NativeDevice, NativeQueryPool, 0, (uint)QueryCount, (uint)QueryCount * 8, dataPointer, 8, VkQueryResultFlags._64);
+ var result = vkGetQueryPoolResults(GraphicsDevice.NativeDevice, NativeQueryPool, 0, (uint)QueryCount, (uint)QueryCount * 8, dataPointer, 8, VkQueryResultFlags.Bit64);
// Some queries are not ready yet
if (result == VkResult.NotReady)
diff --git a/sources/engine/Stride.Graphics/Vulkan/SwapChainGraphicsPresenter.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/SwapChainGraphicsPresenter.Vulkan.cs
index 085c64faa3..0309b8e839 100644
--- a/sources/engine/Stride.Graphics/Vulkan/SwapChainGraphicsPresenter.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/SwapChainGraphicsPresenter.Vulkan.cs
@@ -323,7 +323,7 @@ private unsafe void CreateSwapChain()
surface = surface,
imageArrayLayers = 1,
imageSharingMode = VkSharingMode.Exclusive,
- imageExtent = new Vortice.Mathematics.Size(Description.BackBufferWidth, Description.BackBufferHeight),
+ imageExtent = new VkExtent2D(Description.BackBufferWidth, Description.BackBufferHeight),
imageFormat = backBufferFormat,
imageColorSpace = Description.ColorSpace == ColorSpace.Gamma ? VkColorSpaceKHR.SrgbNonLinear : 0,
imageUsage = VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransferDst | (surfaceCapabilities.supportedUsageFlags & VkImageUsageFlags.TransferSrc), // TODO VULKAN: Use off-screen buffer to emulate
diff --git a/sources/engine/Stride.Graphics/Vulkan/Texture.Vulkan.cs b/sources/engine/Stride.Graphics/Vulkan/Texture.Vulkan.cs
index 660cbabb07..c138ce2872 100644
--- a/sources/engine/Stride.Graphics/Vulkan/Texture.Vulkan.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/Texture.Vulkan.cs
@@ -221,7 +221,7 @@ private unsafe void CreateImage()
{
sType = VkStructureType.ImageCreateInfo,
arrayLayers = (uint) ArraySize,
- extent = new Vortice.Mathematics.Size3(Width, Height, Depth),
+ extent = new VkExtent3D(Width, Height, Depth),
mipLevels = (uint) MipLevels,
samples = VkSampleCountFlags.Count1,
format = NativeFormat,
@@ -361,8 +361,8 @@ private unsafe void InitializeData(DataBox[] dataBoxes)
imageSubresource = new VkImageSubresourceLayers(VkImageAspectFlags.Color, (uint) mipSlice, (uint) arraySlice, layerCount: 1),
bufferRowLength = (uint) (dataBoxes[i].RowPitch * Format.BlockWidth() / Format.BlockSize()),
bufferImageHeight = (uint) (dataBoxes[i].SlicePitch * Format.BlockHeight() / dataBoxes[i].RowPitch),
- imageOffset = new Vortice.Mathematics.Point3(0, 0, 0),
- imageExtent = new Vortice.Mathematics.Size3(mipMapDescription.Width, mipMapDescription.Height, mipMapDescription.Depth)
+ imageOffset = new VkOffset3D(0, 0, 0),
+ imageExtent = new VkExtent3D(mipMapDescription.Width, mipMapDescription.Height, mipMapDescription.Depth)
};
// Copy from upload buffer to image
@@ -701,9 +701,9 @@ private static int CalculateMipCount(int width, int height, int minimumSizeLastM
internal static VkFormat GetFallbackDepthStencilFormat(GraphicsDevice device, VkFormat format)
{
- if (format == VkFormat.D16UNormS8UInt || format == VkFormat.D24UNormS8UInt || format == VkFormat.D32SFloatS8UInt)
+ if (format == VkFormat.D16UnormS8Uint || format == VkFormat.D24UnormS8Uint || format == VkFormat.D32SfloatS8Uint)
{
- var fallbackFormats = new[] { format, VkFormat.D32SFloatS8UInt, VkFormat.D24UNormS8UInt, VkFormat.D16UNormS8UInt };
+ var fallbackFormats = new[] { format, VkFormat.D32SfloatS8Uint, VkFormat.D24UnormS8Uint, VkFormat.D16UnormS8Uint };
foreach (var fallbackFormat in fallbackFormats)
{
diff --git a/sources/engine/Stride.Graphics/Vulkan/VulkanConvertExtensions.cs b/sources/engine/Stride.Graphics/Vulkan/VulkanConvertExtensions.cs
index 65afd36ff7..5c6b472d8e 100644
--- a/sources/engine/Stride.Graphics/Vulkan/VulkanConvertExtensions.cs
+++ b/sources/engine/Stride.Graphics/Vulkan/VulkanConvertExtensions.cs
@@ -235,284 +235,284 @@ public static void ConvertPixelFormat(PixelFormat inputFormat, out VkFormat form
// pixelSize = 1;
// break;
case PixelFormat.R8_UNorm:
- format = VkFormat.R8UNorm;
+ format = VkFormat.R8Unorm;
pixelSize = 1;
break;
case PixelFormat.R8_SNorm:
- format = VkFormat.R8SNorm;
+ format = VkFormat.R8Snorm;
pixelSize = 1;
break;
case PixelFormat.R8_UInt:
- format = VkFormat.R8UInt;
+ format = VkFormat.R8Uint;
pixelSize = 1;
break;
case PixelFormat.R8_SInt:
- format = VkFormat.R8SInt;
+ format = VkFormat.R8Sint;
pixelSize = 1;
break;
case PixelFormat.R8G8B8A8_UNorm:
- format = VkFormat.R8G8B8A8UNorm;
+ format = VkFormat.R8G8B8A8Unorm;
pixelSize = 4;
break;
case PixelFormat.R8G8B8A8_UInt:
- format = VkFormat.R8G8B8A8UInt;
+ format = VkFormat.R8G8B8A8Uint;
pixelSize = 4;
break;
case PixelFormat.R8G8B8A8_SInt:
- format = VkFormat.R8G8B8A8SInt;
+ format = VkFormat.R8G8B8A8Sint;
pixelSize = 4;
break;
case PixelFormat.B8G8R8A8_UNorm:
- format = VkFormat.B8G8R8A8UNorm;
+ format = VkFormat.B8G8R8A8Unorm;
pixelSize = 4;
break;
case PixelFormat.R8G8B8A8_UNorm_SRgb:
- format = VkFormat.R8G8B8A8SRgb;
+ format = VkFormat.R8G8B8A8Srgb;
pixelSize = 4;
break;
case PixelFormat.B8G8R8A8_UNorm_SRgb:
- format = VkFormat.B8G8R8A8SRgb;
+ format = VkFormat.B8G8R8A8Srgb;
pixelSize = 4;
break;
case PixelFormat.R16_Float:
- format = VkFormat.R16SFloat;
+ format = VkFormat.R16Sfloat;
pixelSize = 2;
break;
case PixelFormat.R16_UNorm:
- format = VkFormat.R16UNorm;
+ format = VkFormat.R16Unorm;
pixelSize = 2;
break;
case PixelFormat.R16_UInt:
- format = VkFormat.R16UInt;
+ format = VkFormat.R16Uint;
pixelSize = 2;
break;
case PixelFormat.R16_SInt:
- format = VkFormat.R16SInt;
+ format = VkFormat.R16Sint;
pixelSize = 2;
break;
case PixelFormat.R16G16_Float:
- format = VkFormat.R16G16SFloat;
+ format = VkFormat.R16G16Sfloat;
pixelSize = 4;
break;
case PixelFormat.R16G16_SNorm:
- format = VkFormat.R16G16SNorm;
+ format = VkFormat.R16G16Snorm;
pixelSize = 4;
break;
case PixelFormat.R16G16_UNorm:
- format = VkFormat.R16G16UNorm;
+ format = VkFormat.R16G16Unorm;
pixelSize = 4;
break;
case PixelFormat.R16G16_SInt:
- format = VkFormat.R16G16SNorm;
+ format = VkFormat.R16G16Snorm;
pixelSize = 4;
break;
case PixelFormat.R16G16_UInt:
- format = VkFormat.R16G16UNorm;
+ format = VkFormat.R16G16Unorm;
pixelSize = 4;
break;
case PixelFormat.R16G16B16A16_Float:
- format = VkFormat.R16G16B16A16SFloat;
+ format = VkFormat.R16G16B16A16Sfloat;
pixelSize = 8;
break;
case PixelFormat.R16G16B16A16_UNorm:
- format = VkFormat.R16G16B16A16UNorm;
+ format = VkFormat.R16G16B16A16Unorm;
pixelSize = 8;
break;
case PixelFormat.R16G16B16A16_SNorm:
- format = VkFormat.R16G16B16A16SNorm;
+ format = VkFormat.R16G16B16A16Snorm;
pixelSize = 8;
break;
case PixelFormat.R16G16B16A16_UInt:
- format = VkFormat.R16G16B16A16UInt;
+ format = VkFormat.R16G16B16A16Uint;
pixelSize = 8;
break;
case PixelFormat.R16G16B16A16_SInt:
- format = VkFormat.R16G16B16A16SInt;
+ format = VkFormat.R16G16B16A16Sint;
pixelSize = 8;
break;
case PixelFormat.R32_UInt:
- format = VkFormat.R32UInt;
+ format = VkFormat.R32Uint;
pixelSize = 4;
break;
case PixelFormat.R32_Float:
- format = VkFormat.R32SFloat;
+ format = VkFormat.R32Sfloat;
pixelSize = 4;
break;
case PixelFormat.R32G32_Float:
- format = VkFormat.R32G32SFloat;
+ format = VkFormat.R32G32Sfloat;
pixelSize = 8;
break;
case PixelFormat.R32G32_UInt:
- format = VkFormat.R32G32UInt;
+ format = VkFormat.R32G32Uint;
pixelSize = 8;
break;
case PixelFormat.R32G32_SInt:
- format = VkFormat.R32G32SInt;
+ format = VkFormat.R32G32Sint;
pixelSize = 8;
break;
case PixelFormat.R32G32B32_Float:
- format = VkFormat.R32G32B32SFloat;
+ format = VkFormat.R32G32B32Sfloat;
pixelSize = 12;
break;
case PixelFormat.R32G32B32_SInt:
- format = VkFormat.R32G32B32SInt;
+ format = VkFormat.R32G32B32Sint;
pixelSize = 12;
break;
case PixelFormat.R32G32B32_UInt:
- format = VkFormat.R32G32B32UInt;
+ format = VkFormat.R32G32B32Uint;
pixelSize = 12;
break;
case PixelFormat.R32G32B32A32_Float:
- format = VkFormat.R32G32B32A32SFloat;
+ format = VkFormat.R32G32B32A32Sfloat;
pixelSize = 16;
break;
case PixelFormat.R32G32B32A32_SInt:
- format = VkFormat.R32G32B32A32SInt;
+ format = VkFormat.R32G32B32A32Sint;
pixelSize = 16;
break;
case PixelFormat.R32G32B32A32_UInt:
- format = VkFormat.R32G32B32A32UInt;
+ format = VkFormat.R32G32B32A32Uint;
pixelSize = 16;
break;
case PixelFormat.D16_UNorm:
- format = VkFormat.D16UNorm;
+ format = VkFormat.D16Unorm;
pixelSize = 2;
break;
case PixelFormat.D24_UNorm_S8_UInt:
- format = VkFormat.D24UNormS8UInt;
+ format = VkFormat.D24UnormS8Uint;
pixelSize = 4;
break;
// TODO: Temporary depth format (need to decide relation between RenderTarget1D and Texture)
case PixelFormat.D32_Float:
- format = VkFormat.D32SFloat;
+ format = VkFormat.D32Sfloat;
pixelSize = 4;
break;
case PixelFormat.ETC1:
case PixelFormat.ETC2_RGB: // ETC1 upper compatible
- format = VkFormat.ETC2R8G8B8UNormBlock;
+ format = VkFormat.Etc2R8G8B8UnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.ETC2_RGB_SRgb:
- format = VkFormat.ETC2R8G8B8SRgbBlock;
+ format = VkFormat.Etc2R8G8B8SrgbBlock;
compressed = true;
pixelSize = 1;
break;
case PixelFormat.ETC2_RGB_A1:
- format = VkFormat.ETC2R8G8B8A1UNormBlock;
+ format = VkFormat.Etc2R8G8B8A1UnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.ETC2_RGBA: // ETC2 + EAC
- format = VkFormat.ETC2R8G8B8A8UNormBlock;
+ format = VkFormat.Etc2R8G8B8A8UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.ETC2_RGBA_SRgb: // ETC2 + EAC
- format = VkFormat.ETC2R8G8B8A8SRgbBlock;
+ format = VkFormat.Etc2R8G8B8A8SrgbBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.EAC_R11_Unsigned:
- format = VkFormat.EACR11UNormBlock;
+ format = VkFormat.EacR11UnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.EAC_R11_Signed:
- format = VkFormat.EACR11SNormBlock;
+ format = VkFormat.EacR11SnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.EAC_RG11_Unsigned:
- format = VkFormat.EACR11G11UNormBlock;
+ format = VkFormat.EacR11G11UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.EAC_RG11_Signed:
- format = VkFormat.EACR11G11SNormBlock;
+ format = VkFormat.EacR11G11SnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC1_UNorm:
- format = VkFormat.BC1RGBAUNormBlock;
+ format = VkFormat.Bc1RgbaUnormBlock;
//format = VkFormat.RAD_TEXTURE_FORMAT_DXT1_RGBA;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.BC1_UNorm_SRgb:
- format = VkFormat.BC1RGBASRgbBlock;
+ format = VkFormat.Bc1RgbaSrgbBlock;
//format = VkFormat.RAD_TEXTURE_FORMAT_DXT1_RGBA_SRgb;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.BC2_UNorm:
- format = VkFormat.BC2UNormBlock;
+ format = VkFormat.Bc2UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC2_UNorm_SRgb:
- format = VkFormat.BC2SRgbBlock;
+ format = VkFormat.Bc2SrgbBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC3_UNorm:
- format = VkFormat.BC3UNormBlock;
+ format = VkFormat.Bc3UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC3_UNorm_SRgb:
- format = VkFormat.BC3SRgbBlock;
+ format = VkFormat.Bc3SrgbBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC4_SNorm:
- format = VkFormat.BC4SNormBlock;
+ format = VkFormat.Bc4SnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.BC4_UNorm:
- format = VkFormat.BC4UNormBlock;
+ format = VkFormat.Bc4UnormBlock;
compressed = true;
pixelSize = 1; // 4bpp
break;
case PixelFormat.BC5_SNorm:
- format = VkFormat.BC5SNormBlock;
+ format = VkFormat.Bc5SnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC5_UNorm:
- format = VkFormat.BC5UNormBlock;
+ format = VkFormat.Bc5UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC6H_Sf16:
- format = VkFormat.BC6HSFloatBlock;
+ format = VkFormat.Bc6hSfloatBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC6H_Uf16:
- format = VkFormat.BC6HUFloatBlock;
+ format = VkFormat.Bc6hUfloatBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC7_UNorm:
- format = VkFormat.BC7UNormBlock;
+ format = VkFormat.Bc7UnormBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
case PixelFormat.BC7_UNorm_SRgb:
- format = VkFormat.BC7SRgbBlock;
+ format = VkFormat.Bc7SrgbBlock;
compressed = true;
pixelSize = 2; // 8bpp
break;
@@ -581,76 +581,76 @@ public static int BlockSizeInBytes(this VkFormat format)
{
switch (format)
{
- case VkFormat.BC1RGBUNormBlock:
- case VkFormat.BC1RGBSRgbBlock:
- case VkFormat.BC1RGBAUNormBlock:
- case VkFormat.BC1RGBASRgbBlock:
+ case VkFormat.Bc1RgbUnormBlock:
+ case VkFormat.Bc1RgbSrgbBlock:
+ case VkFormat.Bc1RgbaUnormBlock:
+ case VkFormat.Bc1RgbaSrgbBlock:
return 8;
- case VkFormat.BC2UNormBlock:
- case VkFormat.BC2SRgbBlock:
- case VkFormat.BC3UNormBlock:
- case VkFormat.BC3SRgbBlock:
+ case VkFormat.Bc2UnormBlock:
+ case VkFormat.Bc2SrgbBlock:
+ case VkFormat.Bc3UnormBlock:
+ case VkFormat.Bc3SrgbBlock:
return 16;
- case VkFormat.BC4UNormBlock:
- case VkFormat.BC4SNormBlock:
+ case VkFormat.Bc4UnormBlock:
+ case VkFormat.Bc4SnormBlock:
return 8;
- case VkFormat.BC5UNormBlock:
- case VkFormat.BC5SNormBlock:
- case VkFormat.BC6HUFloatBlock:
- case VkFormat.BC6HSFloatBlock:
- case VkFormat.BC7UNormBlock:
- case VkFormat.BC7SRgbBlock:
+ case VkFormat.Bc5UnormBlock:
+ case VkFormat.Bc5SnormBlock:
+ case VkFormat.Bc6hUfloatBlock:
+ case VkFormat.Bc6hSfloatBlock:
+ case VkFormat.Bc7UnormBlock:
+ case VkFormat.Bc7SrgbBlock:
return 16;
- case VkFormat.ETC2R8G8B8UNormBlock:
- case VkFormat.ETC2R8G8B8SRgbBlock:
- case VkFormat.ETC2R8G8B8A1UNormBlock:
- case VkFormat.ETC2R8G8B8A1SRgbBlock:
+ case VkFormat.Etc2R8G8B8UnormBlock:
+ case VkFormat.Etc2R8G8B8SrgbBlock:
+ case VkFormat.Etc2R8G8B8A1UnormBlock:
+ case VkFormat.Etc2R8G8B8A1SrgbBlock:
return 8;
- case VkFormat.ETC2R8G8B8A8UNormBlock:
- case VkFormat.ETC2R8G8B8A8SRgbBlock:
+ case VkFormat.Etc2R8G8B8A8UnormBlock:
+ case VkFormat.Etc2R8G8B8A8SrgbBlock:
return 16;
- case VkFormat.EACR11UNormBlock:
- case VkFormat.EACR11SNormBlock:
+ case VkFormat.EacR11UnormBlock:
+ case VkFormat.EacR11SnormBlock:
return 8;
- case VkFormat.EACR11G11UNormBlock:
- case VkFormat.EACR11G11SNormBlock:
+ case VkFormat.EacR11G11UnormBlock:
+ case VkFormat.EacR11G11SnormBlock:
return 16;
- case VkFormat.ASTC4x4UNormBlock:
- case VkFormat.ASTC4x4SRgbBlock:
- case VkFormat.ASTC5x4UNormBlock:
- case VkFormat.ASTC5x4SRgbBlock:
- case VkFormat.ASTC5x5UNormBlock:
- case VkFormat.ASTC5x5SRgbBlock:
- case VkFormat.ASTC6x5UNormBlock:
- case VkFormat.ASTC6x5SRgbBlock:
- case VkFormat.ASTC6x6UNormBlock:
- case VkFormat.ASTC6x6SRgbBlock:
- case VkFormat.ASTC8x5UNormBlock:
- case VkFormat.ASTC8x5SRgbBlock:
- case VkFormat.ASTC8x6UNormBlock:
- case VkFormat.ASTC8x6SRgbBlock:
- case VkFormat.ASTC8x8UNormBlock:
- case VkFormat.ASTC8x8SRgbBlock:
- case VkFormat.ASTC10x5UNormBlock:
- case VkFormat.ASTC10x5SRgbBlock:
- case VkFormat.ASTC10x6UNormBlock:
- case VkFormat.ASTC10x6SRgbBlock:
- case VkFormat.ASTC10x8UNormBlock:
- case VkFormat.ASTC10x8SRgbBlock:
- case VkFormat.ASTC10x10UNormBlock:
- case VkFormat.ASTC10x10SRgbBlock:
- case VkFormat.ASTC12x10UNormBlock:
- case VkFormat.ASTC12x10SRgbBlock:
- case VkFormat.ASTC12x12UNormBlock:
- case VkFormat.ASTC12x12SRgbBlock:
+ case VkFormat.Astc4x4UnormBlock:
+ case VkFormat.Astc4x4SrgbBlock:
+ case VkFormat.Astc5x4UnormBlock:
+ case VkFormat.Astc5x4SrgbBlock:
+ case VkFormat.Astc5x5UnormBlock:
+ case VkFormat.Astc5x5SrgbBlock:
+ case VkFormat.Astc6x5UnormBlock:
+ case VkFormat.Astc6x5SrgbBlock:
+ case VkFormat.Astc6x6UnormBlock:
+ case VkFormat.Astc6x6SrgbBlock:
+ case VkFormat.Astc8x5UnormBlock:
+ case VkFormat.Astc8x5SrgbBlock:
+ case VkFormat.Astc8x6UnormBlock:
+ case VkFormat.Astc8x6SrgbBlock:
+ case VkFormat.Astc8x8UnormBlock:
+ case VkFormat.Astc8x8SrgbBlock:
+ case VkFormat.Astc10x5UnormBlock:
+ case VkFormat.Astc10x5SrgbBlock:
+ case VkFormat.Astc10x6UnormBlock:
+ case VkFormat.Astc10x6SrgbBlock:
+ case VkFormat.Astc10x8UnormBlock:
+ case VkFormat.Astc10x8SrgbBlock:
+ case VkFormat.Astc10x10UnormBlock:
+ case VkFormat.Astc10x10SrgbBlock:
+ case VkFormat.Astc12x10UnormBlock:
+ case VkFormat.Astc12x10SrgbBlock:
+ case VkFormat.Astc12x12UnormBlock:
+ case VkFormat.Astc12x12SrgbBlock:
return 16;
default: