]> O.S.I.I.S - jp/vke.net.git/commitdiff
clearscreen and triangle ok with ptrProxies in vk.net 0.4.0-beta
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 5 Dec 2021 06:48:36 +0000 (07:48 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 5 Dec 2021 06:48:36 +0000 (07:48 +0100)
.vscode/launch.json
vke/src/ShaderInfo.cs
vke/src/base/DescriptorSetWrites.cs
vke/src/base/Instance.cs
vke/src/base/Queue.cs

index 25a58aa30c0001109a7d3b746d48ea6d1a8e5571..dfc683322a0c9f86a26b3e704f82adcb8d137142 100644 (file)
                        "args": [],
                        "cwd": "${workspaceFolder}/build/Debug/netcoreapp3.1/",
                        "stopAtEntry": false,
-                       "console": "internalConsole"
+                       "console": "internalConsole",
+                       "env": {
+                               "VK_INSTANCE_LAYERS": "VK_LAYER_KHRONOS_validation"
+                         }
                },
                {
                        "name": ".NET Core Launch (Triangle)",
index 10291a18a09342c2d813ce6b3a479f464fca016a..9e12500a5d801c13718fe44f0a3165a7638bb731 100644 (file)
@@ -9,8 +9,6 @@ namespace vke {
        /// This class is a helper class for VkPipelineShaderStageCreateInfo creation.
        /// </summary>
        public class ShaderInfo : IDisposable {
-               readonly FixedUtf8String EntryPoint;
-
                protected VkPipelineShaderStageCreateInfo info = VkPipelineShaderStageCreateInfo.New ();
                protected Device dev;
 
@@ -70,9 +68,7 @@ namespace vke {
 
                protected virtual void Dispose (bool disposing) {
                        if (!disposedValue) {
-                               if (disposing)
-                                       EntryPoint.Dispose ();
-                               else
+                               if (!disposing)
                                        System.Diagnostics.Debug.WriteLine ("VKE ShaderInfo disposed by finalizer");
 
                                dev?.DestroyShaderModule (info.module);
index 59d7a408aebc9bffce92a54ba6387bbae3897f5b..b6fdecac09ab6490ff881c96aef878285d834f78 100644 (file)
@@ -7,6 +7,7 @@ using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using Vulkan;
 using static Vulkan.Vk;
+using System.Linq;
 
 namespace vke {
        /// <summary>
@@ -108,28 +109,19 @@ namespace vke {
                                        VkWriteDescriptorSet wds = WriteDescriptorSets[wdsPtr];
                                        if (dstSetOverride != null)
                                                wds.dstSet = dstSetOverride.Value.Handle;
-                                       IntPtr pDescriptors = IntPtr.Zero;
 
-                                       if (wds.descriptorCount > 1) {
-                                               List<IntPtr> descPtrArray = new List<IntPtr> ();
-                                               for (int d = 0; d < wds.descriptorCount; d++) {
-                                                       descPtrArray.Add (descriptors[i].Pin (pinCtx));
-                                                       i++;
-                                               }
-                                       } else {
-                                               pDescriptors = descriptors[i].Pin (pinCtx);
-                                               i++;
-                                       }
-                                       /*if (descriptors[firstDescriptor] is VkDescriptorBufferInfo)
-                                               wds.pBufferInfo = pDescriptors;
+                                       if (descriptors[i] is VkDescriptorBufferInfo)
+                                               wds.pBufferInfo = descriptors.SubArray (i,(int)wds.descriptorCount).Cast<VkDescriptorBufferInfo>().ToArray();
                                        else if (descriptors[firstDescriptor] is VkDescriptorImageInfo)
-                                               wds.pImageInfo = pDescriptors;*/
-
+                                               wds.pImageInfo = descriptors.SubArray (i,(int)wds.descriptorCount).Cast<VkDescriptorImageInfo>().ToArray();
+                                       i+=(int)wds.descriptorCount;
                                        WriteDescriptorSets[wdsPtr] = wds;
                                        wdsPtr++;
                                }
                                vkUpdateDescriptorSets (dev.Handle, (uint)WriteDescriptorSets.Count, WriteDescriptorSets.Pin (pinCtx), 0, IntPtr.Zero);
                        }
+                       foreach (VkWriteDescriptorSet wds in WriteDescriptorSets)
+                               wds.Dispose();
                }
                /// <summary>
                /// execute the descriptors writes targeting descriptorSets setted on AddWriteInfo call
index 420aca404e52e91704c0abeb9ad227dc05c2580b..57611e54e7e1f3dedca51af74949abf2b51524d1 100644 (file)
@@ -81,8 +81,8 @@ namespace vke {
                                VkApplicationInfo appInfo = new VkApplicationInfo () {
                                        sType = VkStructureType.ApplicationInfo,
                                        apiVersion = new Vulkan.Version (VK_MAJOR, VK_MINOR, 0),
-                                       pApplicationName = ENGINE_NAME.Pin (pctx),
-                                       pEngineName = APPLICATION_NAME.Pin (pctx),
+                                       pApplicationName = ENGINE_NAME,
+                                       pEngineName = APPLICATION_NAME,
                                };
 
                                VkInstanceCreateInfo instanceCreateInfo = VkInstanceCreateInfo.New ();
index fd4bbaaa8d97243cdf7e4fdab504db2be33cc056..3de9713ce09d8eb951c69f7bc264f56c2398cb5b 100644 (file)
@@ -44,6 +44,7 @@ namespace vke {
                        uint idx = swapChain.currentImageIndex;
                        VkSwapchainKHR sc = swapChain.Handle;
                        present.pSwapchains = sc;
+                       present.pImageIndices = idx.Pin();
                        present.pWaitSemaphores = wait;
 
                        vkQueuePresentKHR (handle, ref present);