<RestoreAdditionalProjectSources Condition="Exists('$(SolutionDir)build\$(Configuration)\')">$(SolutionDir)build\$(Configuration)\</RestoreAdditionalProjectSources>
<SpirVTasksReleaseVersion>0.1.45</SpirVTasksReleaseVersion>
<SpirVTasksPackageVersion>$(SpirVTasksReleaseVersion)</SpirVTasksPackageVersion>
- <VkeReleaseVersion>0.2.3</VkeReleaseVersion>
+ <VkeReleaseVersion>0.2.4</VkeReleaseVersion>
<VkePackageVersion>$(VkeReleaseVersion)-beta</VkePackageVersion>
<UseStbSharp>true</UseStbSharp>
<UseMemoryPools>false</UseMemoryPools>
uint frameCount;
Stopwatch frameChrono;
+ /// <summary>
+ /// Override this property to change the list of enabled instance extensions
+ /// </summary>
+ public virtual string[] EnabledLayers => null;
+
/// <summary>
/// Override this property to change the list of enabled instance extensions
/// </summary>
if (EnabledInstanceExtensions != null)
instExts.AddRange (EnabledInstanceExtensions);
- instance = new Instance (instExts.ToArray());
+ instance = new Instance (EnabledLayers, instExts.ToArray());
hSurf = instance.CreateSurface (hWin);
/// </summary>
public class Instance : IDisposable {
/// <summary>If true, the VK_LAYER_KHRONOS_validation layer is loaded at startup; </summary>
+ [Obsolete("use constructor with layers as 1st argument, vkWindow implement overridable `EnabledLayers`")]
public static bool VALIDATION;
/// <summary>If true, the VK_LAYER_RENDERDOC_Capture layer is loaded at startup; </summary>
+ [Obsolete("use constructor with layers as 1st argument, vkWindow implement overridable `EnabledLayers`")]
public static bool RENDER_DOC_CAPTURE;
public static uint VK_MAJOR = 1;
/// Create a new vulkan instance with enabled extensions given as argument.
/// </summary>
/// <param name="extensions">List of extension to enable if supported</param>
- public Instance (params string[] extensions) {
+ public Instance (params string[] extensions) : this (null, extensions) {}
+
+ /// <summary>
+ /// Create a new vulkan instance with enabled layers and extensions given as arguments.
+ /// </summary>
+ /// <param name="layers">if not null, load layers in order, else use `VALIDATION` and `RENDER_DOC_CAPTURE`
+ /// static variables to enable corresponding extensions</param>
+ /// <param name="extensions">List of extension to enable if supported</param>
+ public Instance (string[] layers, params string[] extensions) {
List<IntPtr> instanceExtensions = new List<IntPtr> ();
List<IntPtr> enabledLayerNames = new List<IntPtr> ();
Console.WriteLine ($"Vulkan initialisation: Unsupported extension: {extensions [i]}");
}
-
- if (VALIDATION)
- enabledLayerNames.Add (strValidationLayer.Pin (pctx));
- if (RENDER_DOC_CAPTURE)
- enabledLayerNames.Add (strRenderDocLayer.Pin (pctx));
-
+ if (layers != null) {
+ for (int i = 0; i < layers.Length; i++)
+ enabledLayerNames.Add (layers[i].Pin (pctx));
+ } else {
+ if (VALIDATION)
+ enabledLayerNames.Add (strValidationLayer.Pin (pctx));
+ if (RENDER_DOC_CAPTURE)
+ enabledLayerNames.Add (strRenderDocLayer.Pin (pctx));
+ }
VkApplicationInfo appInfo = new VkApplicationInfo () {
sType = VkStructureType.ApplicationInfo,
vkGetPhysicalDeviceFormatProperties (phy, format, out VkFormatProperties properties);
return properties;
}
+ public VkPhysicalDeviceToolPropertiesEXT[] GetToolProperties () {
+ Utils.CheckResult (vkGetPhysicalDeviceToolPropertiesEXT (phy , out uint count, IntPtr.Zero));
+ int sizeStruct = Marshal.SizeOf<VkPhysicalDeviceToolPropertiesEXT> ();
+ IntPtr ptrTools = Marshal.AllocHGlobal (sizeStruct * (int)count);
+ Utils.CheckResult (vkGetPhysicalDeviceToolPropertiesEXT (phy , out count, ptrTools));
+
+ VkPhysicalDeviceToolPropertiesEXT[] result = new VkPhysicalDeviceToolPropertiesEXT[count];
+ IntPtr tmp = ptrTools;
+ for (int i = 0; i < count; i++) {
+ result[i] = Marshal.PtrToStructure<VkPhysicalDeviceToolPropertiesEXT> (tmp);
+ tmp += sizeStruct;
+ }
+
+ Marshal.FreeHGlobal (ptrTools);
+ return result;
+ }
}
}