"stopAtEntry": false,
"console": "internalConsole"
},
+ {
+ "name": ".NET Core Launch (MeshShader)",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build MeshShader",
+ "program": "${workspaceFolder}/build/Debug/netcoreapp3.1/MeshShader",
+ "args": [],
+ "cwd": "${workspaceFolder}/build/Debug/netcoreapp3.1/",
+ "stopAtEntry": false,
+ "console": "internalConsole",
+ "env": {
+ "VK_ICD_FILENAMES": "/usr/local/share/vulkan/icd.d/radeon_icd.x86_64.json",
+ "RADV_PERFTEST": "rt,ext_ms"
+ }
+ },
{
"name": ".NET Core Launch (Compute)",
"type": "coreclr",
{
"version": "2.0.0",
"tasks": [
+ {
+ "label": "build SpirVTasks",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "build",
+ "${workspaceFolder}/SpirVTasks/SpirVTasks.csproj",
+ "/property:GenerateFullPaths=true",
+ "/property:SolutionDir=${workspaceFolder}/",
+ "/property:Configuration=Debug",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
{
"label": "build ExternalMemmories",
"command": "dotnet",
],
"problemMatcher": "$msCompile"
},
+ {
+ "label": "build MeshShader",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "build",
+ "${workspaceFolder}/samples/MeshShader/MeshShader.csproj",
+ "/property:GenerateFullPaths=true",
+ "/property:SolutionDir=${workspaceFolder}/",
+ "/property:Configuration=Debug",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
{
"label": "build Compute",
"command": "dotnet",
<PropertyGroup>
<RootDirectory>$(MSBuildThisFileDirectory)</RootDirectory>
<RestoreAdditionalProjectSources Condition="Exists('$(SolutionDir)build\$(Configuration)\')">$(SolutionDir)build\$(Configuration)\</RestoreAdditionalProjectSources>
- <SpirVTasksReleaseVersion>0.1.45</SpirVTasksReleaseVersion>
+ <SpirVTasksReleaseVersion>0.2.0</SpirVTasksReleaseVersion>
<SpirVTasksPackageVersion>$(SpirVTasksReleaseVersion)</SpirVTasksPackageVersion>
- <VkeReleaseVersion>0.2.7</VkeReleaseVersion>
+ <VkeReleaseVersion>0.3.0</VkeReleaseVersion>
<VkePackageVersion>$(VkeReleaseVersion)-beta</VkePackageVersion>
<UseStbSharp>true</UseStbSharp>
<UseMemoryPools>false</UseMemoryPools>
<FileExtension Name=".vert" ContentType="GLSLShader" />
<FileExtension Name=".tesc" ContentType="GLSLShader" />
<FileExtension Name=".tese" ContentType="GLSLShader" />
+ <FileExtension Name=".mesh" ContentType="GLSLShader" />
+ <FileExtension Name=".task" ContentType="GLSLShader" />
</ProjectSchemaDefinitions>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)common\Utils.cs;$(MSBuildThisFileDirectory)common\SampleBase.cs"/>
- <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom">
+ <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom;shaders\**\*.mesh;shaders\**\*.task">
<LogicalName>shaders.%(Filename)%(Extension).spv</LogicalName>
</GLSLShader>
<EmbeddedResource Include="ui\**\*.*">
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <IncludeDefaultNoneItems>false</IncludeDefaultNoneItems>
+ </PropertyGroup>
+</Project>
--- /dev/null
+// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Numerics;
+using System.Runtime.InteropServices;
+using vke;
+using Vulkan;
+using Glfw;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace MeshShader {
+ class Program : SampleBase {
+#if DEBUG
+ /*public override string[] EnabledLayers =>
+ new string[] {
+ "VK_LAYER_KHRONOS_validation"
+ };*/
+
+#endif
+ public override string[] EnabledInstanceExtensions => new string[] {
+ Ext.I.VK_KHR_get_physical_device_properties2,
+ Ext.I.VK_EXT_debug_utils,
+ };
+ public override string[] EnabledDeviceExtensions => new string[] {
+ Ext.D.VK_KHR_swapchain,
+ Ext.D.VK_KHR_spirv_1_4,
+ Ext.D.VK_EXT_mesh_shader
+ //"VK_NV_mesh_shader"
+ };
+ protected override void configureEnabledFeatures(VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features)
+ {
+ base.configureEnabledFeatures(available_features, ref enabled_features);
+
+
+ }
+ vke.DebugUtils.Messenger dbgmsg;
+ protected override void selectPhysicalDevice () {
+ PhysicalDeviceCollection phys = instance.GetAvailablePhysicalDevice ();
+ phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault (p => p.Properties.deviceType == VkPhysicalDeviceType.DiscreteGpu && p.HasSwapChainSupport);
+ Console.WriteLine($"Using gpu: {phy.Properties.deviceName}");
+
+ dbgmsg = new vke.DebugUtils.Messenger (instance,
+ VkDebugUtilsMessageTypeFlagsEXT.PerformanceEXT | VkDebugUtilsMessageTypeFlagsEXT.ValidationEXT | VkDebugUtilsMessageTypeFlagsEXT.GeneralEXT,
+ VkDebugUtilsMessageSeverityFlagsEXT.InfoEXT |
+ VkDebugUtilsMessageSeverityFlagsEXT.WarningEXT |
+ VkDebugUtilsMessageSeverityFlagsEXT.ErrorEXT |
+ VkDebugUtilsMessageSeverityFlagsEXT.VerboseEXT);
+
+ VkPhysicalDeviceFeatures2 phyFeat2 = VkPhysicalDeviceFeatures2.New;
+ VkPhysicalDeviceMeshShaderFeaturesEXT meshFeat = VkPhysicalDeviceMeshShaderFeaturesEXT.New;
+
+ IntPtr pPhyFeat2 = Marshal.AllocHGlobal(Marshal.SizeOf<VkPhysicalDeviceFeatures2>());
+ IntPtr pMeshFeat = Marshal.AllocHGlobal(Marshal.SizeOf<VkPhysicalDeviceMeshShaderFeaturesEXT>());
+
+ Marshal.StructureToPtr<VkPhysicalDeviceMeshShaderFeaturesEXT>(meshFeat, pMeshFeat,false);
+ phyFeat2.pNext = pMeshFeat;
+ Marshal.StructureToPtr<VkPhysicalDeviceFeatures2>(phyFeat2, pPhyFeat2,false);
+
+ Vk.vkGetPhysicalDeviceFeatures2(phy.Handle, pPhyFeat2);
+
+ phyFeat2 = Marshal.PtrToStructure<VkPhysicalDeviceFeatures2>(pPhyFeat2);
+ meshFeat = Marshal.PtrToStructure<VkPhysicalDeviceMeshShaderFeaturesEXT>(pMeshFeat);
+ Marshal.FreeHGlobal(pPhyFeat2);
+ Marshal.FreeHGlobal(pMeshFeat);
+
+ Console.WriteLine($"Mesh Shader Support:\t{meshFeat.meshShader}");
+ Console.WriteLine($"Task Shader Support:\t{meshFeat.taskShader}");
+
+ if (!(meshFeat.meshShader && meshFeat.taskShader)) {
+ phy = null;
+ }
+ }
+
+ static void Main (string[] args) {
+ Instance.VK_MINOR = 3;
+ using (Program vke = new Program ()) {
+ vke.Run ();
+ }
+ }
+
+ const float rotSpeed = 0.01f, zoomSpeed = 0.01f;
+ float rotX, rotY, zoom = 1f;
+
+ HostBuffer<Matrix4x4> uboMVPmatrix; //a host mappable buffer for mvp matrice.
+
+ DescriptorPool descriptorPool;
+ DescriptorSet descriptorSet;//descriptor set for the mvp matrice.
+
+ FrameBuffers frameBuffers; //the frame buffer collection coupled to the swapchain images
+ GraphicPipeline pipeline;
+
+ protected override void initVulkan () {
+ base.initVulkan ();
+
+
+ descriptorPool = new DescriptorPool (dev, 1, new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer));
+ using (GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false)) {
+ //Create the pipeline layout, it will be automatically activated on pipeline creation, so that sharing layout among different pipelines will benefit
+ //from the reference counting to automatically dispose unused layout on pipeline clean up. It's the same for DescriptorSetLayout.
+ /*cfg.Layout = new PipelineLayout (dev,
+ new DescriptorSetLayout (dev, new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer)));*/
+ cfg.Layout = new PipelineLayout (dev);
+ //create a default renderpass with just a color attachment for the swapchain image, a default subpass is automatically created and the renderpass activation
+ //will follow the pipeline life cicle and will be automatically disposed when no longuer used.
+ cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, cfg.Samples);
+ //configuration of vertex bindings and attributes
+
+ //shader are automatically compiled by SpirVTasks if added to the project. The resulting shaders are automatically embedded in the assembly.
+ //To specifiy that the shader path is a resource name, put the '#' prefix. Else the path will be search on disk.
+ cfg.AddShaders (
+ new ShaderInfo (dev, VkShaderStageFlags.MeshEXT, "#shaders.main.mesh.spv"),
+ new ShaderInfo (dev, VkShaderStageFlags.Fragment, "#shaders.main.frag.spv")
+ );
+
+ //create and activate the pipeline with the configuration we've just done.
+ pipeline = new GraphicPipeline (cfg);
+ }
+
+ //because descriptor layout used for a pipeline are only activated on pipeline activation, descriptor set must not be allocated before, except if the layout has been manually activated,
+ //but in this case, layout will need also to be explicitly disposed.
+ //descriptorSet = descriptorPool.Allocate (pipeline.Layout.DescriptorSetLayouts[0]);
+
+ //Write the content of the descriptor, the mvp matrice.
+ //DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, pipeline.Layout.DescriptorSetLayouts[0]);
+ //Descriptor property of the mvp buffer will return a default descriptor with no offset of the full size of the buffer.
+ //uboUpdate.Write (dev, uboMVPmatrix.Descriptor);
+
+ //allocate the default VkWindow buffers, one per swapchain image. Their will be only reset when rebuilding and not reallocated.
+ cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
+ }
+
+ //view update override, see base method for more informations.
+ public override void UpdateView () {
+ /*uboMVPmatrix.AsSpan()[0] =
+ Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
+ Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX) *
+ Matrix4x4.CreateTranslation (0, 0, -3f * zoom) *
+ Helpers.CreatePerspectiveFieldOfView (Helpers.DegreesToRadians (45f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f);
+
+ base.UpdateView ();*/
+ }
+ protected override void onMouseMove (double xPos, double yPos) {
+ double diffX = lastMouseX - xPos;
+ double diffY = lastMouseY - yPos;
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
+ rotY -= rotSpeed * (float)diffX;
+ rotX += rotSpeed * (float)diffY;
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
+ zoom += zoomSpeed * (float)diffY;
+ updateViewRequested = true;
+ }
+ }
+
+ void buildCommandBuffers() {
+ cmdPool.Reset (VkCommandPoolResetFlags.ReleaseResources);
+
+ for (int i = 0; i < swapChain.ImageCount; ++i) {
+ FrameBuffer fb = frameBuffers[i];
+ cmds[i].Start ();
+
+ pipeline.RenderPass.Begin (cmds[i], fb);
+
+ cmds[i].SetViewport (swapChain.Width, swapChain.Height);
+ cmds[i].SetScissor (swapChain.Width, swapChain.Height);
+
+ //cmds[i].BindDescriptorSet (pipeline.Layout, descriptorSet);
+
+ cmds[i].BindPipeline (pipeline);
+
+ Vk.vkCmdDrawMeshTasksEXT(cmds[i].Handle, 1, 1, 1);
+
+ pipeline.RenderPass.End (cmds[i]);
+
+ cmds[i].End ();
+ }
+ }
+
+ protected override void OnResize () {
+ base.OnResize ();
+
+ updateViewRequested = true;
+
+ frameBuffers?.Dispose();
+ frameBuffers = pipeline.RenderPass.CreateFrameBuffers(swapChain);
+
+ buildCommandBuffers ();
+ }
+ //clean up
+ protected override void Dispose (bool disposing) {
+ dev.WaitIdle ();
+ if (disposing) {
+ if (!isDisposed) {
+ //pipeline clean up will dispose PipelineLayout, DescriptorSet layouts and render pass automatically. If their reference count is zero, their handles will be destroyed.
+ pipeline.Dispose ();
+ //frame buffers are automatically activated on creation as for resources, so it requests an explicit call to dispose.
+ frameBuffers?.Dispose();
+ //the descriptor pool
+ descriptorPool.Dispose ();
+ //resources have to be explicityly disposed.
+ //uboMVPmatrix.Dispose ();
+ dbgmsg?.Dispose ();
+ }
+ }
+
+ base.Dispose (disposing);
+ }
+ }
+}
--- /dev/null
+#version 450
+
+layout (location = 0) in PerVertexData
+{
+ vec4 color;
+} fragIn;
+
+layout (location = 0) out vec4 FragColor;
+
+void main()
+{
+ FragColor = fragIn.color;
+}
\ No newline at end of file
--- /dev/null
+
+#extension GL_EXT_mesh_shader : require
+
+layout(local_size_x = 1) in;
+layout(triangles, max_vertices = 3, max_primitives = 1) out;
+
+// Custom vertex output block
+layout (location = 0) out PerVertexData
+{
+ vec4 color;
+} v_out[]; // [max_vertices]
+
+
+float scale = 0.95;
+const vec3 vertices[3] = {vec3(-1,-1,0), vec3(0,1,0), vec3(1,-1,0)};
+const vec3 colors[3] = {vec3(1.0,0.0,0.0), vec3(0.0,1.0,0.0), vec3(0.0,0.0,1.0)};
+
+
+void main()
+{
+ vec4 pos = vec4(vertices[0] * scale, 1.0);
+ // GL->VK conventions...
+ pos.y = -pos.y; pos.z = (pos.z + pos.w) / 2.0;
+ gl_MeshVerticesEXT[0].gl_Position = pos;
+
+ pos = vec4(vertices[1] * scale, 1.0);
+ pos.y = -pos.y; pos.z = (pos.z + pos.w) / 2.0;
+ gl_MeshVerticesEXT[1].gl_Position = pos;
+
+ pos = vec4(vertices[2] * scale, 1.0);
+ pos.y = -pos.y; pos.z = (pos.z + pos.w) / 2.0;
+ gl_MeshVerticesEXT[2].gl_Position = pos;
+
+
+ v_out[0].color = vec4(colors[0], 1.0);
+ v_out[1].color = vec4(colors[1], 1.0);
+ v_out[2].color = vec4(colors[2], 1.0);
+
+
+ gl_PrimitiveIndicesEXT[0] = 0;
+ gl_PrimitiveIndicesEXT[1] = 1;
+ gl_PrimitiveIndicesEXT[2] = 2;
+
+ gl_PrimitiveCountEXT = 1;
+
+ SetMeshOutputsEXT(3,1);
+}
\ No newline at end of file
{
base.initVulkan();
#if DEBUG
- foreach (VkPhysicalDeviceToolPropertiesEXT toolProp in phy.GetToolProperties()) {
+ foreach (VkPhysicalDeviceToolProperties toolProp in phy.GetToolProperties()) {
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine ($"Enabled Tool: {toolProp.name}({toolProp.version})");
Console.ResetColor ();
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pbr", "samples\pbr\pbr.csproj", "{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExternalMemmories", "samples\ExternalMemmories\ExternalMemmories.csproj", "{85CD9813-E182-4ED1-8D2C-38467657BEF3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExternalMemmories", "samples\ExternalMemmories\ExternalMemmories.csproj", "{85CD9813-E182-4ED1-8D2C-38467657BEF3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VulkanContext", "samples\VulkanContext\VulkanContext.csproj", "{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VulkanContext", "samples\VulkanContext\VulkanContext.csproj", "{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeshShader", "samples\MeshShader\MeshShader.csproj", "{5787D082-7E4E-4B18-9C69-529CBC4F105E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
{642726F4-0592-4846-8EAF-A5D1964C85A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{642726F4-0592-4846-8EAF-A5D1964C85A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{642726F4-0592-4846-8EAF-A5D1964C85A7}.Release|Any CPU.Build.0 = Release|Any CPU
- {642726F4-0592-4846-8EAF-A5D1964C85A7}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F04C3F79-2E08-4D35-A804-43039DCB7F5E}.Release|Any CPU.Build.0 = Release|Any CPU
- {F04C3F79-2E08-4D35-A804-43039DCB7F5E}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.Release|Any CPU.Build.0 = Release|Any CPU
- {FEF3AF30-5B88-4D3C-8BD7-8734200E0D1E}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3BBF67D-7E63-48F3-8156-ADC014D268BB}.Release|Any CPU.Build.0 = Release|Any CPU
- {F3BBF67D-7E63-48F3-8156-ADC014D268BB}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
{1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.Release|Any CPU.Build.0 = Release|Any CPU
- {1D2A1968-8F04-4BE0-B03A-573F1F68AB66}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Debug|Any CPU
- {124152F8-FAE6-4D4B-87B9-6074DD365E9B}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{124152F8-FAE6-4D4B-87B9-6074DD365E9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{124152F8-FAE6-4D4B-87B9-6074DD365E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{124152F8-FAE6-4D4B-87B9-6074DD365E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{124152F8-FAE6-4D4B-87B9-6074DD365E9B}.Release|Any CPU.Build.0 = Release|Any CPU
- {124152F8-FAE6-4D4B-87B9-6074DD365E9B}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {1B2DF710-E500-49E5-8802-EBA71A05E827}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{1B2DF710-E500-49E5-8802-EBA71A05E827}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B2DF710-E500-49E5-8802-EBA71A05E827}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B2DF710-E500-49E5-8802-EBA71A05E827}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B2DF710-E500-49E5-8802-EBA71A05E827}.Release|Any CPU.Build.0 = Release|Any CPU
- {1B2DF710-E500-49E5-8802-EBA71A05E827}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.Release|Any CPU.Build.0 = Release|Any CPU
- {5000CDE2-99B9-47EA-B4D9-EA1631F0E14A}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {77437C6D-28B5-4798-96CA-68F987770D65}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{77437C6D-28B5-4798-96CA-68F987770D65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77437C6D-28B5-4798-96CA-68F987770D65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77437C6D-28B5-4798-96CA-68F987770D65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77437C6D-28B5-4798-96CA-68F987770D65}.Release|Any CPU.Build.0 = Release|Any CPU
- {77437C6D-28B5-4798-96CA-68F987770D65}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {8185163E-A67C-4C0E-8548-67E2A9F16309}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{8185163E-A67C-4C0E-8548-67E2A9F16309}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8185163E-A67C-4C0E-8548-67E2A9F16309}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8185163E-A67C-4C0E-8548-67E2A9F16309}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8185163E-A67C-4C0E-8548-67E2A9F16309}.Release|Any CPU.Build.0 = Release|Any CPU
- {8185163E-A67C-4C0E-8548-67E2A9F16309}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {D9A41382-444E-44ED-B638-3D8F06F2FBC2}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{D9A41382-444E-44ED-B638-3D8F06F2FBC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9A41382-444E-44ED-B638-3D8F06F2FBC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9A41382-444E-44ED-B638-3D8F06F2FBC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9A41382-444E-44ED-B638-3D8F06F2FBC2}.Release|Any CPU.Build.0 = Release|Any CPU
- {D9A41382-444E-44ED-B638-3D8F06F2FBC2}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.Release|Any CPU.Build.0 = Release|Any CPU
- {7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Release|Any CPU
- {85CD9813-E182-4ED1-8D2C-38467657BEF3}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {85CD9813-E182-4ED1-8D2C-38467657BEF3}.BuildPackages|Any CPU.Build.0 = Debug|Any CPU
{85CD9813-E182-4ED1-8D2C-38467657BEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85CD9813-E182-4ED1-8D2C-38467657BEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85CD9813-E182-4ED1-8D2C-38467657BEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85CD9813-E182-4ED1-8D2C-38467657BEF3}.Release|Any CPU.Build.0 = Release|Any CPU
- {85CD9813-E182-4ED1-8D2C-38467657BEF3}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Debug|Any CPU
- {85CD9813-E182-4ED1-8D2C-38467657BEF3}.ReleaseSpirVTasks|Any CPU.Build.0 = Debug|Any CPU
- {CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.BuildPackages|Any CPU.Build.0 = Debug|Any CPU
{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.Release|Any CPU.Build.0 = Release|Any CPU
- {CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.ReleaseSpirVTasks|Any CPU.ActiveCfg = Debug|Any CPU
- {CF8755E1-9E8B-4AD2-A7D1-D66D797004AD}.ReleaseSpirVTasks|Any CPU.Build.0 = Debug|Any CPU
+ {5787D082-7E4E-4B18-9C69-529CBC4F105E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5787D082-7E4E-4B18-9C69-529CBC4F105E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5787D082-7E4E-4B18-9C69-529CBC4F105E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5787D082-7E4E-4B18-9C69-529CBC4F105E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{7EB2430B-6BC0-4AE9-B1FA-57C3DB2AE1C5} = {16439374-B8DB-4643-8116-EB3358B49A12}
{85CD9813-E182-4ED1-8D2C-38467657BEF3} = {16439374-B8DB-4643-8116-EB3358B49A12}
{CF8755E1-9E8B-4AD2-A7D1-D66D797004AD} = {16439374-B8DB-4643-8116-EB3358B49A12}
+ {5787D082-7E4E-4B18-9C69-529CBC4F105E} = {16439374-B8DB-4643-8116-EB3358B49A12}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1360F94D-CF3C-4121-A8D7-E227F41668F1}
instance = new Instance (EnabledLayers, instExts.ToArray());
- hSurf = instance.CreateSurface (hWin);
-
selectPhysicalDevice ();
+ if (phy == null) {
+ instance.Dispose();
+ terminateGLFW();
+ throw new Exception("Required physical device not found.");
+ }
+
+ hSurf = instance.CreateSurface (hWin);
+
VkPhysicalDeviceFeatures enabledFeatures = default;
configureEnabledFeatures (phy.Features, ref enabledFeatures);
#region IDisposable Support
protected bool isDisposed;
+ void terminateGLFW() {
+ if (currentCursor != IntPtr.Zero)
+ Glfw3.DestroyCursor (currentCursor);
+ if (hWin != IntPtr.Zero) {
+ windows.Remove (hWin);
+ Glfw3.DestroyWindow (hWin);
+ }
+ Glfw3.Terminate ();
+ }
protected virtual void Dispose (bool disposing) {
if (!isDisposed) {
} else
Debug.WriteLine ("a VkWindow has not been correctly disposed");
- if (currentCursor != IntPtr.Zero)
- Glfw3.DestroyCursor (currentCursor);
-
- windows.Remove (hWin);
-
- Glfw3.DestroyWindow (hWin);
- Glfw3.Terminate ();
-
-
+ terminateGLFW();
isDisposed = true;
}
}
tiling, usage, flags, out properties);
return result == VkResult.Success;
}
- public VkPhysicalDeviceToolPropertiesEXT[] GetToolProperties () {
- CheckResult (vkGetPhysicalDeviceToolPropertiesEXT (phy , out uint count, IntPtr.Zero));
- int sizeStruct = Marshal.SizeOf<VkPhysicalDeviceToolPropertiesEXT> ();
+ public VkPhysicalDeviceToolProperties[] GetToolProperties () {
+ CheckResult (vkGetPhysicalDeviceToolProperties (phy , out uint count, IntPtr.Zero));
+ int sizeStruct = Marshal.SizeOf<VkPhysicalDeviceToolProperties> ();
IntPtr ptrTools = Marshal.AllocHGlobal (sizeStruct * (int)count);
- CheckResult (vkGetPhysicalDeviceToolPropertiesEXT (phy , out count, ptrTools));
+ CheckResult (vkGetPhysicalDeviceToolProperties (phy , out count, ptrTools));
- VkPhysicalDeviceToolPropertiesEXT[] result = new VkPhysicalDeviceToolPropertiesEXT[count];
+ VkPhysicalDeviceToolProperties[] result = new VkPhysicalDeviceToolProperties[count];
IntPtr tmp = ptrTools;
for (int i = 0; i < count; i++) {
- result[i] = Marshal.PtrToStructure<VkPhysicalDeviceToolPropertiesEXT> (tmp);
+ result[i] = Marshal.PtrToStructure<VkPhysicalDeviceToolProperties> (tmp);
tmp += sizeStruct;
}
<ItemGroup>
<PackageReference Include="SpirVTasks" Version="$(SpirVTasksPackageVersion)" />
- <PackageReference Include="Vulkan" Version="0.4.1-beta" />
+ <PackageReference Include="Vulkan" Version="0.4.2" />
<PackageReference Include="shaderc.net" Version="0.1.0" />
<PackageReference Include="glfw-sharp" Version="0.2.14" />
</ItemGroup>