Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="pipelineBindPoint">
 /// The PipelineBindPoint that this layout targets.
 /// </param>
 /// <param name="flags">
 /// A bitmask providing usage hints of this layout. See
 /// IndirectCommandsLayoutUsageFlagBitsNVX below for a description of
 /// the supported bits.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.NVidia.Experimental.IndirectCommandsLayout CreateIndirectCommandsLayout(this SharpVk.Device extendedHandle, SharpVk.PipelineBindPoint pipelineBindPoint, SharpVk.NVidia.Experimental.IndirectCommandsLayoutUsageFlags flags, ArrayProxy <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>?tokens, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.Experimental.IndirectCommandsLayout result = default(SharpVk.NVidia.Experimental.IndirectCommandsLayout);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout marshalledIndirectCommandsLayout = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout);
         commandCache                            = extendedHandle.commandCache;
         marshalledCreateInfo                    = (SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo>());
         marshalledCreateInfo->SType             = StructureType.IndirectCommandsLayoutCreateInfo;
         marshalledCreateInfo->Next              = nextPointer;
         marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint;
         marshalledCreateInfo->Flags             = flags;
         marshalledCreateInfo->TokenCount        = (uint)(Interop.HeapUtil.GetLength(tokens));
         if (tokens.IsNull())
         {
             marshalledCreateInfo->Tokens = null;
         }
         else
         {
             if (tokens.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->Tokens = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>());
                 *(SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(marshalledCreateInfo->Tokens) = tokens.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>(Interop.HeapUtil.GetLength(tokens.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(tokens.Value)); index++)
                 {
                     fieldPointer[index] = tokens.Value[index];
                 }
                 marshalledCreateInfo->Tokens = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate>("vkCreateIndirectCommandsLayoutNVX", "device");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledIndirectCommandsLayout);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.Experimental.IndirectCommandsLayout(extendedHandle, marshalledIndirectCommandsLayout);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// </param>
 /// <param name="initialData">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.Multivendor.ValidationCache CreateValidationCache(this SharpVk.Device extendedHandle, ArrayProxy <byte>?initialData, SharpVk.Multivendor.ValidationCacheCreateFlags?flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Multivendor.ValidationCache result = default(SharpVk.Multivendor.ValidationCache);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *);
         void *vkValidationCacheCreateInfoEXTNextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *       marshalledAllocator       = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Multivendor.ValidationCache marshalledValidationCache = default(SharpVk.Interop.Multivendor.ValidationCache);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationCacheCreateInfo>());
         marshalledCreateInfo->SType = StructureType.ValidationCacheCreateInfo;
         marshalledCreateInfo->Next  = vkValidationCacheCreateInfoEXTNextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags);
         }
         marshalledCreateInfo->InitialDataSize = (HostSize)(Interop.HeapUtil.GetLength(initialData));
         if (initialData.IsNull())
         {
             marshalledCreateInfo->InitialData = null;
         }
         else
         {
             if (initialData.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->InitialData            = (byte *)(Interop.HeapUtil.Allocate <byte>());
                 *(byte *)(marshalledCreateInfo->InitialData) = initialData.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(initialData.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(initialData.Value)); index++)
                 {
                     fieldPointer[index] = initialData.Value[index];
                 }
                 marshalledCreateInfo->InitialData = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Multivendor.VkDeviceCreateValidationCacheDelegate commandDelegate = commandCache.Cache.vkCreateValidationCacheEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledValidationCache);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Multivendor.ValidationCache(extendedHandle, marshalledValidationCache);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="stages">
 /// </param>
 /// <param name="groups">
 /// </param>
 public static unsafe SharpVk.Pipeline CreateRayTracingPipeline(this SharpVk.Device extendedHandle, SharpVk.PipelineCache pipelineCache, ArrayProxy <SharpVk.PipelineShaderStageCreateInfo>?stages, ArrayProxy <SharpVk.NVidia.RayTracingShaderGroupCreateInfo>?groups, uint maxRecursionDepth, SharpVk.PipelineLayout layout, SharpVk.Pipeline basePipelineHandle, int basePipelineIndex, SharpVk.PipelineCreateFlags?flags = default(SharpVk.PipelineCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Pipeline result          = default(SharpVk.Pipeline);
         CommandCache     commandCache    = default(CommandCache);
         uint             createInfoCount = default(uint);
         SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Pipeline *           marshalledPipelines = default(SharpVk.Interop.Pipeline *);
         commandCache                 = extendedHandle.commandCache;
         createInfoCount              = 1;
         marshalledCreateInfos        = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>());
         marshalledCreateInfos->SType = StructureType.RayTracingPipelineCreateInfo;
         marshalledCreateInfos->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfos->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfos->Flags = default(SharpVk.PipelineCreateFlags);
         }
         marshalledCreateInfos->StageCount = (uint)(Interop.HeapUtil.GetLength(stages));
         if (stages.IsNull())
         {
             marshalledCreateInfos->Stages = null;
         }
         else
         {
             if (stages.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos->Stages = (SharpVk.Interop.PipelineShaderStageCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.PipelineShaderStageCreateInfo>());
                 stages.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.PipelineShaderStageCreateInfo *)(marshalledCreateInfos->Stages));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.PipelineShaderStageCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.PipelineShaderStageCreateInfo>(Interop.HeapUtil.GetLength(stages.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(stages.Value)); index++)
                 {
                     stages.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos->Stages = fieldPointer;
             }
         }
         marshalledCreateInfos->GroupCount = (uint)(Interop.HeapUtil.GetLength(groups));
         if (groups.IsNull())
         {
             marshalledCreateInfos->Groups = null;
         }
         else
         {
             if (groups.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos->Groups = (SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo>());
                 groups.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(marshalledCreateInfos->Groups));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo>(Interop.HeapUtil.GetLength(groups.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(groups.Value)); index++)
                 {
                     groups.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos->Groups = fieldPointer;
             }
         }
         marshalledCreateInfos->MaxRecursionDepth  = maxRecursionDepth;
         marshalledCreateInfos->Layout             = layout?.handle ?? default(SharpVk.Interop.PipelineLayout);
         marshalledCreateInfos->BasePipelineHandle = basePipelineHandle?.handle ?? default(SharpVk.Interop.Pipeline);
         marshalledCreateInfos->BasePipelineIndex  = basePipelineIndex;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledPipelines = (SharpVk.Interop.Pipeline *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Pipeline>(1));
         SharpVk.Interop.NVidia.VkDeviceCreateRayTracingPipelinesDelegate commandDelegate = commandCache.Cache.vkCreateRayTracingPipelinesNV;
         Result methodResult = commandDelegate(extendedHandle.handle, pipelineCache?.handle ?? default(SharpVk.Interop.PipelineCache), createInfoCount, marshalledCreateInfos, marshalledAllocator, marshalledPipelines);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Pipeline(extendedHandle, *marshalledPipelines);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="firstBinding">
 /// </param>
 /// <param name="buffers">
 /// </param>
 /// <param name="offsets">
 /// </param>
 /// <param name="sizes">
 /// </param>
 public static unsafe void BindTransformFeedbackBuffers(this SharpVk.CommandBuffer extendedHandle, uint firstBinding, ArrayProxy <SharpVk.Buffer>?buffers, ArrayProxy <ulong>?offsets, ArrayProxy <ulong>?sizes = null)
 {
     try
     {
         CommandCache            commandCache      = default(CommandCache);
         SharpVk.Interop.Buffer *marshalledBuffers = default(SharpVk.Interop.Buffer *);
         ulong *marshalledOffsets = default(ulong *);
         ulong *marshalledSizes   = default(ulong *);
         commandCache = extendedHandle.commandCache;
         if (buffers.IsNull())
         {
             marshalledBuffers = null;
         }
         else
         {
             if (buffers.Value.Contents == ProxyContents.Single)
             {
                 marshalledBuffers = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Buffer>());
                 *(SharpVk.Interop.Buffer *)(marshalledBuffers) = buffers.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Buffer);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Buffer>(Interop.HeapUtil.GetLength(buffers.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(buffers.Value)); index++)
                 {
                     fieldPointer[index] = buffers.Value[index]?.handle ?? default(SharpVk.Interop.Buffer);
                 }
                 marshalledBuffers = fieldPointer;
             }
         }
         if (offsets.IsNull())
         {
             marshalledOffsets = null;
         }
         else
         {
             if (offsets.Value.Contents == ProxyContents.Single)
             {
                 marshalledOffsets             = (ulong *)(Interop.HeapUtil.Allocate <ulong>());
                 *(ulong *)(marshalledOffsets) = offsets.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (ulong *)(Interop.HeapUtil.AllocateAndClear <ulong>(Interop.HeapUtil.GetLength(offsets.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(offsets.Value)); index++)
                 {
                     fieldPointer[index] = offsets.Value[index];
                 }
                 marshalledOffsets = fieldPointer;
             }
         }
         if (sizes.IsNull())
         {
             marshalledSizes = null;
         }
         else
         {
             if (sizes.Value.Contents == ProxyContents.Single)
             {
                 marshalledSizes             = (ulong *)(Interop.HeapUtil.Allocate <ulong>());
                 *(ulong *)(marshalledSizes) = sizes.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (ulong *)(Interop.HeapUtil.AllocateAndClear <ulong>(Interop.HeapUtil.GetLength(sizes.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(sizes.Value)); index++)
                 {
                     fieldPointer[index] = sizes.Value[index];
                 }
                 marshalledSizes = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkCommandBufferBindTransformFeedbackBuffersDelegate commandDelegate = commandCache.Cache.vkCmdBindTransformFeedbackBuffersEXT;
         commandDelegate(extendedHandle.handle, firstBinding, (uint)(Interop.HeapUtil.GetLength(buffers)), marshalledBuffers, marshalledOffsets, marshalledSizes);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="timestampInfos">
 /// </param>
 /// <param name="timestamps">
 /// </param>
 public static unsafe ulong GetCalibratedTimestamps(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Multivendor.CalibratedTimestampInfo>?timestampInfos, ArrayProxy <ulong>?timestamps)
 {
     try
     {
         ulong        result       = default(ulong);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.CalibratedTimestampInfo *marshalledTimestampInfos = default(SharpVk.Interop.Multivendor.CalibratedTimestampInfo *);
         ulong *marshalledTimestamps   = default(ulong *);
         ulong  marshalledMaxDeviation = default(ulong);
         commandCache = extendedHandle.commandCache;
         if (timestampInfos.IsNull())
         {
             marshalledTimestampInfos = null;
         }
         else
         {
             if (timestampInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledTimestampInfos = (SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.CalibratedTimestampInfo>());
                 timestampInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(marshalledTimestampInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Multivendor.CalibratedTimestampInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Multivendor.CalibratedTimestampInfo>(Interop.HeapUtil.GetLength(timestampInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(timestampInfos.Value)); index++)
                 {
                     timestampInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledTimestampInfos = fieldPointer;
             }
         }
         if (timestamps.IsNull())
         {
             marshalledTimestamps = null;
         }
         else
         {
             if (timestamps.Value.Contents == ProxyContents.Single)
             {
                 marshalledTimestamps             = (ulong *)(Interop.HeapUtil.Allocate <ulong>());
                 *(ulong *)(marshalledTimestamps) = timestamps.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (ulong *)(Interop.HeapUtil.AllocateAndClear <ulong>(Interop.HeapUtil.GetLength(timestamps.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(timestamps.Value)); index++)
                 {
                     fieldPointer[index] = timestamps.Value[index];
                 }
                 marshalledTimestamps = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkDeviceGetCalibratedTimestampsDelegate commandDelegate = commandCache.Cache.vkGetCalibratedTimestampsEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(timestampInfos)), marshalledTimestampInfos, marshalledTimestamps, &marshalledMaxDeviation);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledMaxDeviation;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="bindInfos">
 /// </param>
 public static unsafe void BindAccelerationStructureMemory(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.NVidia.BindAccelerationStructureMemoryInfo>?bindInfos)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *marshalledBindInfos = default(SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *);
         commandCache = extendedHandle.commandCache;
         if (bindInfos.IsNull())
         {
             marshalledBindInfos = null;
         }
         else
         {
             if (bindInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledBindInfos = (SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo>());
                 bindInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(marshalledBindInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo>(Interop.HeapUtil.GetLength(bindInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(bindInfos.Value)); index++)
                 {
                     bindInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledBindInfos = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkDeviceBindAccelerationStructureMemoryDelegate commandDelegate = commandCache.Cache.vkBindAccelerationStructureMemoryNV;
         Result methodResult = commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(bindInfos)), marshalledBindInfos);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 7
0
 internal static uint GetLength <T>(ArrayProxy <T> value)
 {
     return((uint)value.Length);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="counterBuffers">
 /// </param>
 /// <param name="counterBufferOffsets">
 /// </param>
 public static unsafe void EndTransformFeedback(this SharpVk.CommandBuffer extendedHandle, uint firstCounterBuffer, ArrayProxy <SharpVk.Buffer>?counterBuffers = null, ArrayProxy <DeviceSize>?counterBufferOffsets = null)
 {
     try
     {
         CommandCache            commandCache                   = default(CommandCache);
         SharpVk.Interop.Buffer *marshalledCounterBuffers       = default(SharpVk.Interop.Buffer *);
         DeviceSize *            marshalledCounterBufferOffsets = default(DeviceSize *);
         commandCache = extendedHandle.commandCache;
         if (counterBuffers.IsNull())
         {
             marshalledCounterBuffers = null;
         }
         else
         {
             if (counterBuffers.Value.Contents == ProxyContents.Single)
             {
                 marshalledCounterBuffers = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Buffer>());
                 *(SharpVk.Interop.Buffer *)(marshalledCounterBuffers) = counterBuffers.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Buffer);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Buffer>(Interop.HeapUtil.GetLength(counterBuffers.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(counterBuffers.Value)); index++)
                 {
                     fieldPointer[index] = counterBuffers.Value[index]?.handle ?? default(SharpVk.Interop.Buffer);
                 }
                 marshalledCounterBuffers = fieldPointer;
             }
         }
         if (counterBufferOffsets.IsNull())
         {
             marshalledCounterBufferOffsets = null;
         }
         else
         {
             if (counterBufferOffsets.Value.Contents == ProxyContents.Single)
             {
                 marshalledCounterBufferOffsets = (DeviceSize *)(Interop.HeapUtil.Allocate <DeviceSize>());
                 *(DeviceSize *)(marshalledCounterBufferOffsets) = counterBufferOffsets.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (DeviceSize *)(Interop.HeapUtil.AllocateAndClear <DeviceSize>(Interop.HeapUtil.GetLength(counterBufferOffsets.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(counterBufferOffsets.Value)); index++)
                 {
                     fieldPointer[index] = counterBufferOffsets.Value[index];
                 }
                 marshalledCounterBufferOffsets = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkCommandBufferEndTransformFeedbackDelegate commandDelegate = commandCache.Cache.vkCmdEndTransformFeedbackEXT;
         commandDelegate(extendedHandle.handle, firstCounterBuffer, (uint)(Interop.HeapUtil.GetLength(counterBuffers)), marshalledCounterBuffers, marshalledCounterBufferOffsets);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Create multiple swapchains that share presentable images.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain[] CreateSharedSwapchains(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Khronos.SwapchainCreateInfo>?createInfos, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain[] result = default(SharpVk.Khronos.Swapchain[]);
         CommandCache commandCache          = default(CommandCache);
         uint         swapchainCount        = default(uint);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator   = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain *          marshalledSwapchains  = default(SharpVk.Interop.Khronos.Swapchain *);
         commandCache   = extendedHandle.commandCache;
         swapchainCount = (uint)(Interop.HeapUtil.GetLength(createInfos));
         if (createInfos.IsNull())
         {
             marshalledCreateInfos = null;
         }
         else
         {
             if (createInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
                 createInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Khronos.SwapchainCreateInfo *)(marshalledCreateInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.SwapchainCreateInfo>(Interop.HeapUtil.GetLength(createInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(createInfos.Value)); index++)
                 {
                     createInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledSwapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>(swapchainCount));
         SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate>("vkCreateSharedSwapchainsKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, swapchainCount, marshalledCreateInfos, marshalledAllocator, marshalledSwapchains);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         if (marshalledSwapchains != null)
         {
             var fieldPointer = new SharpVk.Khronos.Swapchain[(uint)(swapchainCount)];
             for (int index = 0; index < (uint)(swapchainCount); index++)
             {
                 fieldPointer[index] = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchains[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Create a new descriptor update template.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="templateType">
 /// Specifies the type of the descriptor update template. If set to
 /// VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR it can only
 /// be used to update descriptor sets with a fixed descriptorSetLayout.
 /// If set to VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
 /// it can only be used to push descriptor sets using the provided
 /// pipelineBindPoint, pipelineLayout, and set number.
 /// </param>
 /// <param name="descriptorSetLayout">
 /// The descriptor set layout the parameter update template will be
 /// used with. All descriptor sets which are going to be updated
 /// through the newly created descriptor update template must be
 /// created with this layout. descriptorSetLayout is the descriptor set
 /// layout used to build the descriptor update template. All descriptor
 /// sets which are going to be updated through the newly created
 /// descriptor update template must be created with a layout that
 /// matches (is the same as, or defined identically to) this layout.
 /// This parameter is ignored if templateType is not
 /// VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR.
 /// </param>
 /// <param name="pipelineBindPoint">
 /// A PipelineBindPoint indicating whether the descriptors will be used
 /// by graphics pipelines or compute pipelines. This parameter is
 /// ignored if templateType is not
 /// VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
 /// </param>
 /// <param name="pipelineLayout">
 /// A PipelineLayout object used to program the bindings. This
 /// parameter is ignored if templateType is not
 /// VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
 /// </param>
 /// <param name="set">
 /// The set number of the descriptor set in the pipeline layout that
 /// will be updated. This parameter is ignored if templateType is not
 /// VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR ifndef::VK_KHR_push_descriptor[]
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.DescriptorUpdateTemplate CreateDescriptorUpdateTemplate(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Khronos.DescriptorUpdateTemplateEntry>?descriptorUpdateEntries, SharpVk.Khronos.DescriptorUpdateTemplateType templateType, SharpVk.DescriptorSetLayout descriptorSetLayout, SharpVk.PipelineLayout pipelineLayout, SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?), SharpVk.PipelineBindPoint?pipelineBindPoint = default(SharpVk.PipelineBindPoint?), uint?set = default(uint?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.DescriptorUpdateTemplate result = default(SharpVk.Khronos.DescriptorUpdateTemplate);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *marshalledCreateInfo    = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *            marshalledAllocator                = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplate marshalledDescriptorUpdateTemplate = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplate);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DescriptorUpdateTemplateCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags);
         }
         marshalledCreateInfo->DescriptorUpdateEntryCount = (uint)(Interop.HeapUtil.GetLength(descriptorUpdateEntries));
         if (descriptorUpdateEntries.IsNull())
         {
             marshalledCreateInfo->DescriptorUpdateEntries = null;
         }
         else
         {
             if (descriptorUpdateEntries.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->DescriptorUpdateEntries = (SharpVk.Khronos.DescriptorUpdateTemplateEntry *)(Interop.HeapUtil.Allocate <SharpVk.Khronos.DescriptorUpdateTemplateEntry>());
                 *(SharpVk.Khronos.DescriptorUpdateTemplateEntry *)(marshalledCreateInfo->DescriptorUpdateEntries) = descriptorUpdateEntries.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.Khronos.DescriptorUpdateTemplateEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Khronos.DescriptorUpdateTemplateEntry>(Interop.HeapUtil.GetLength(descriptorUpdateEntries.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(descriptorUpdateEntries.Value)); index++)
                 {
                     fieldPointer[index] = descriptorUpdateEntries.Value[index];
                 }
                 marshalledCreateInfo->DescriptorUpdateEntries = fieldPointer;
             }
         }
         marshalledCreateInfo->TemplateType        = templateType;
         marshalledCreateInfo->DescriptorSetLayout = descriptorSetLayout?.handle ?? default(SharpVk.Interop.DescriptorSetLayout);
         if (pipelineBindPoint != null)
         {
             marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint.Value;
         }
         else
         {
             marshalledCreateInfo->PipelineBindPoint = default(SharpVk.PipelineBindPoint);
         }
         marshalledCreateInfo->PipelineLayout = pipelineLayout?.handle ?? default(SharpVk.Interop.PipelineLayout);
         if (set != null)
         {
             marshalledCreateInfo->Set = set.Value;
         }
         else
         {
             marshalledCreateInfo->Set = default(uint);
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkDeviceCreateDescriptorUpdateTemplateDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateDescriptorUpdateTemplateDelegate>("vkCreateDescriptorUpdateTemplateKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledDescriptorUpdateTemplate);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.DescriptorUpdateTemplate(extendedHandle, marshalledDescriptorUpdateTemplate);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Create a swapchain.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// A bitmask indicating parameters of swapchain creation. Bits which
 /// can be set include: + --
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain CreateSwapchain(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface, uint minImageCount, SharpVk.Format imageFormat, SharpVk.Khronos.ColorSpace imageColorSpace, SharpVk.Extent2D imageExtent, uint imageArrayLayers, SharpVk.ImageUsageFlags imageUsage, SharpVk.SharingMode imageSharingMode, ArrayProxy <uint>?queueFamilyIndices, SharpVk.Khronos.SurfaceTransformFlags preTransform, SharpVk.Khronos.CompositeAlphaFlags compositeAlpha, SharpVk.Khronos.PresentMode presentMode, bool clipped, SharpVk.Khronos.Swapchain oldSwapchain, SharpVk.Khronos.SwapchainCreateFlags?flags = default(SharpVk.Khronos.SwapchainCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain result = default(SharpVk.Khronos.Swapchain);
         CommandCache commandCache        = default(CommandCache);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain            marshalledSwapchain  = default(SharpVk.Interop.Khronos.Swapchain);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
         marshalledCreateInfo->SType = StructureType.SwapchainCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.SwapchainCreateFlags);
         }
         marshalledCreateInfo->Surface               = surface?.handle ?? default(SharpVk.Interop.Khronos.Surface);
         marshalledCreateInfo->MinImageCount         = minImageCount;
         marshalledCreateInfo->ImageFormat           = imageFormat;
         marshalledCreateInfo->ImageColorSpace       = imageColorSpace;
         marshalledCreateInfo->ImageExtent           = imageExtent;
         marshalledCreateInfo->ImageArrayLayers      = imageArrayLayers;
         marshalledCreateInfo->ImageUsage            = imageUsage;
         marshalledCreateInfo->ImageSharingMode      = imageSharingMode;
         marshalledCreateInfo->QueueFamilyIndexCount = (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices));
         if (queueFamilyIndices.IsNull())
         {
             marshalledCreateInfo->QueueFamilyIndices = null;
         }
         else
         {
             if (queueFamilyIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->QueueFamilyIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfo->QueueFamilyIndices) = queueFamilyIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)); index++)
                 {
                     fieldPointer[index] = queueFamilyIndices.Value[index];
                 }
                 marshalledCreateInfo->QueueFamilyIndices = fieldPointer;
             }
         }
         marshalledCreateInfo->PreTransform   = preTransform;
         marshalledCreateInfo->CompositeAlpha = compositeAlpha;
         marshalledCreateInfo->PresentMode    = presentMode;
         marshalledCreateInfo->Clipped        = clipped;
         marshalledCreateInfo->OldSwapchain   = oldSwapchain?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkDeviceCreateSwapchainDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateSwapchainDelegate>("vkCreateSwapchainKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSwapchain);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchain);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Write the contents of a descriptor set object.
        /// </summary>
        /// <param name="destinationSet">
        /// The destination descriptor set to update.
        /// </param>
        /// <param name="destinationBinding">
        /// The descriptor binding within the set.
        /// </param>
        /// <param name="destinationArrayElement">
        /// The starting element in the binding array.
        /// </param>
        /// <param name="descriptorType">
        /// A DescriptorType specifying the type of each descriptor in
        /// imageInfos.
        /// It must be the same type as that specified in
        /// DescriptorSetLayoutBinding for destinationSet at
        /// destinationBinding. The type of the descriptor also controls which
        /// array the descriptors are taken from.
        /// </param>
        /// <param name="imageInfos">
        /// An array of DescriptorImageInfo structures.
        /// </param>
        public unsafe void WriteDescriptorSet(DescriptorSet destinationSet, uint destinationBinding, uint destinationArrayElement, DescriptorType descriptorType, ArrayProxy <DescriptorImageInfo>?imageInfos)
        {
            int bufferInfosLength = imageInfos?.Length ?? 0;
            var marshalledInfos   = (Interop.DescriptorImageInfo *)Interop.HeapUtil.Allocate <Interop.DescriptorImageInfo>(bufferInfosLength);

            for (int index = 0; index < bufferInfosLength; index++)
            {
                imageInfos.Value[index].MarshalTo(&marshalledInfos[index]);
            }

            Interop.WriteDescriptorSet info = new Interop.WriteDescriptorSet
            {
                SType                   = StructureType.WriteDescriptorSet,
                ImageInfo               = marshalledInfos,
                DestinationSet          = destinationSet.handle,
                DestinationBinding      = destinationBinding,
                DestinationArrayElement = destinationArrayElement,
                DescriptorCount         = (uint)bufferInfosLength,
                DescriptorType          = descriptorType
            };

            var commandDelegate = commandCache.GetCommandDelegate <Interop.VkDeviceUpdateDescriptorSetsDelegate>("vkUpdateDescriptorSets", "");

            commandDelegate(this.handle, 1, &info, 0, null);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Write the contents of a descriptor set object.
        /// </summary>
        /// <param name="destinationSet">
        /// The destination descriptor set to update.
        /// </param>
        /// <param name="destinationBinding">
        /// The descriptor binding within the set.
        /// </param>
        /// <param name="destinationArrayElement">
        /// The starting element in the binding array.
        /// </param>
        /// <param name="descriptorType">
        /// A DescriptorType specifying the type of each descriptor in
        /// texelBufferViews.
        /// It must be the same type as that specified in
        /// DescriptorSetLayoutBinding for destinationSet at
        /// destinationBinding. The type of the descriptor also controls which
        /// array the descriptors are taken from.
        /// </param>
        /// <param name="texelBufferViews">
        /// An array of BufferViews.
        /// </param>
        public unsafe void WriteDescriptorSet(DescriptorSet destinationSet, uint destinationBinding, uint destinationArrayElement, DescriptorType descriptorType, ArrayProxy <BufferView>?texelBufferViews)
        {
            int bufferInfosLength = texelBufferViews?.Length ?? 0;
            var marshalledViews   = (Interop.BufferView *)Interop.HeapUtil.Allocate <Interop.BufferView>(bufferInfosLength);

            for (int index = 0; index < bufferInfosLength; index++)
            {
                marshalledViews[index] = texelBufferViews.Value[index].handle;
            }

            Interop.WriteDescriptorSet info = new Interop.WriteDescriptorSet
            {
                SType                   = StructureType.WriteDescriptorSet,
                TexelBufferView         = marshalledViews,
                DestinationSet          = destinationSet.handle,
                DestinationBinding      = destinationBinding,
                DestinationArrayElement = destinationArrayElement,
                DescriptorCount         = (uint)bufferInfosLength,
                DescriptorType          = descriptorType
            };

            var commandDelegate = commandCache.GetCommandDelegate <Interop.VkDeviceUpdateDescriptorSetsDelegate>("vkUpdateDescriptorSets", "");

            commandDelegate(this.handle, 1, &info, 0, null);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Create a new Vulkan instance.
 /// </summary>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="applicationInfo">
 /// Null or an instance of ApplicationInfo. If not Null, this
 /// information helps implementations recognize behavior inherent to
 /// classes of applications. ApplicationInfo is defined in detail
 /// below.
 /// </param>
 /// <param name="enabledLayerNames">
 /// An array of enabledLayerCount strings containing the names of
 /// layers to enable for the created instance. See the Layers section
 /// for further details.
 /// </param>
 /// <param name="enabledExtensionNames">
 /// An array of enabledExtensionCount strings containing the names of
 /// extensions to enable.
 /// </param>
 /// <param name="validationFlagsExt">
 /// </param>
 /// <param name="validationFeaturesExt"></param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public override unsafe void CreateInstance(ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = null, SharpVk.ApplicationInfo?applicationInfo = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, SharpVk.Multivendor.ValidationFeatures?validationFeaturesExt = null, AllocationCallbacks?allocator = null)
 {
     if (Instance != null)
     {
         return;
     }
     else if (Enabled)
     {
         Instance = SharpVk.Instance.Create(enabledLayerNames.GetValueOrDefault().AddUnique("VK_LAYER_KHRONOS_validation"), enabledExtensionNames.GetValueOrDefault().AddUnique(SharpVk.Multivendor.ExtExtensions.DebugUtils), flags, applicationInfo, null, validationFlagsExt, validationFeaturesExt, this, allocator);
         Debugger = Instance.CreateDebugUtilsMessenger(MessageSeverity, MessageType, DebugUtilsMessengerCallbackDelegate, Flags, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch_), allocator);
     }
     else
     {
         Instance = SharpVk.Instance.Create(enabledLayerNames, enabledExtensionNames, flags, applicationInfo, null, validationFlagsExt, validationFeaturesExt, null, allocator);
     }
 }
Ejemplo n.º 15
0
 internal static uint GetLength <T>(ArrayProxy <T>?value)
 {
     return((uint)(value?.Length ?? 0));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Pushes descriptor updates into a command buffer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="descriptorWrites">
 /// </param>
 public static unsafe void PushDescriptorSet(this SharpVk.CommandBuffer extendedHandle, SharpVk.PipelineBindPoint pipelineBindPoint, SharpVk.PipelineLayout layout, uint set, ArrayProxy <SharpVk.WriteDescriptorSet>?descriptorWrites)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.WriteDescriptorSet *marshalledDescriptorWrites = default(SharpVk.Interop.WriteDescriptorSet *);
         commandCache = extendedHandle.commandCache;
         if (descriptorWrites.IsNull())
         {
             marshalledDescriptorWrites = null;
         }
         else
         {
             if (descriptorWrites.Value.Contents == ProxyContents.Single)
             {
                 marshalledDescriptorWrites = (SharpVk.Interop.WriteDescriptorSet *)(Interop.HeapUtil.Allocate <SharpVk.Interop.WriteDescriptorSet>());
                 descriptorWrites.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.WriteDescriptorSet *)(marshalledDescriptorWrites));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.WriteDescriptorSet *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.WriteDescriptorSet>(Interop.HeapUtil.GetLength(descriptorWrites.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(descriptorWrites.Value)); index++)
                 {
                     descriptorWrites.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledDescriptorWrites = fieldPointer;
             }
         }
         SharpVk.Interop.Khronos.VkCommandBufferPushDescriptorSetDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkCommandBufferPushDescriptorSetDelegate>("vkCmdPushDescriptorSetKHR", "device");
         commandDelegate(extendedHandle.handle, pipelineBindPoint, layout?.handle ?? default(SharpVk.Interop.PipelineLayout), set, (uint)(Interop.HeapUtil.GetLength(descriptorWrites)), marshalledDescriptorWrites);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Queue an image for presentation.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Queue handle to extend.
 /// </param>
 /// <param name="waitSemaphores">
 /// </param>
 /// <param name="swapchains">
 /// </param>
 /// <param name="imageIndices">
 /// </param>
 /// <param name="results">
 /// </param>
 /// <param name="displayPresentInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="presentRegionsKhr">
 /// Extension struct
 /// </param>
 /// <param name="deviceGroupPresentInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="presentTimesInfoGoogle">
 /// Extension struct
 /// </param>
 /// <param name="presentFrameTokenGgp">
 /// Extension struct
 /// </param>
 public static unsafe Result Present(this SharpVk.Queue extendedHandle, ArrayProxy <SharpVk.Semaphore>?waitSemaphores, ArrayProxy <SharpVk.Khronos.Swapchain>?swapchains, ArrayProxy <uint>?imageIndices, ArrayProxy <SharpVk.Result>?results = null, SharpVk.Khronos.DisplayPresentInfo?displayPresentInfoKhr = null, SharpVk.Khronos.PresentRegions?presentRegionsKhr = null, SharpVk.Khronos.DeviceGroupPresentInfo?deviceGroupPresentInfoKhr = null, SharpVk.Google.PresentTimesInfo?presentTimesInfoGoogle = null, SharpVk.Ggp.PresentFrameToken?presentFrameTokenGgp = null)
 {
     try
     {
         Result       result       = default(Result);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.PresentInfo *marshalledPresentInfo = default(SharpVk.Interop.Khronos.PresentInfo *);
         void *vkPresentInfoKHRNextPointer = default(void *);
         if (displayPresentInfoKhr != null)
         {
             SharpVk.Interop.Khronos.DisplayPresentInfo *extensionPointer = default(SharpVk.Interop.Khronos.DisplayPresentInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.DisplayPresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayPresentInfo>());
             displayPresentInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next      = vkPresentInfoKHRNextPointer;
             vkPresentInfoKHRNextPointer = extensionPointer;
         }
         if (presentRegionsKhr != null)
         {
             SharpVk.Interop.Khronos.PresentRegions *extensionPointer = default(SharpVk.Interop.Khronos.PresentRegions *);
             extensionPointer = (SharpVk.Interop.Khronos.PresentRegions *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentRegions>());
             presentRegionsKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next      = vkPresentInfoKHRNextPointer;
             vkPresentInfoKHRNextPointer = extensionPointer;
         }
         if (deviceGroupPresentInfoKhr != null)
         {
             SharpVk.Interop.Khronos.DeviceGroupPresentInfo *extensionPointer = default(SharpVk.Interop.Khronos.DeviceGroupPresentInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.DeviceGroupPresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DeviceGroupPresentInfo>());
             deviceGroupPresentInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next      = vkPresentInfoKHRNextPointer;
             vkPresentInfoKHRNextPointer = extensionPointer;
         }
         if (presentTimesInfoGoogle != null)
         {
             SharpVk.Interop.Google.PresentTimesInfo *extensionPointer = default(SharpVk.Interop.Google.PresentTimesInfo *);
             extensionPointer = (SharpVk.Interop.Google.PresentTimesInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Google.PresentTimesInfo>());
             presentTimesInfoGoogle.Value.MarshalTo(extensionPointer);
             extensionPointer->Next      = vkPresentInfoKHRNextPointer;
             vkPresentInfoKHRNextPointer = extensionPointer;
         }
         if (presentFrameTokenGgp != null)
         {
             SharpVk.Interop.Ggp.PresentFrameToken *extensionPointer = default(SharpVk.Interop.Ggp.PresentFrameToken *);
             extensionPointer = (SharpVk.Interop.Ggp.PresentFrameToken *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Ggp.PresentFrameToken>());
             presentFrameTokenGgp.Value.MarshalTo(extensionPointer);
             extensionPointer->Next      = vkPresentInfoKHRNextPointer;
             vkPresentInfoKHRNextPointer = extensionPointer;
         }
         commandCache                 = extendedHandle.commandCache;
         marshalledPresentInfo        = (SharpVk.Interop.Khronos.PresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentInfo>());
         marshalledPresentInfo->SType = StructureType.PresentInfo;
         marshalledPresentInfo->Next  = vkPresentInfoKHRNextPointer;
         marshalledPresentInfo->WaitSemaphoreCount = (uint)(Interop.HeapUtil.GetLength(waitSemaphores));
         if (waitSemaphores.IsNull())
         {
             marshalledPresentInfo->WaitSemaphores = null;
         }
         else
         {
             if (waitSemaphores.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->WaitSemaphores = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Semaphore>());
                 *(SharpVk.Interop.Semaphore *)(marshalledPresentInfo->WaitSemaphores) = waitSemaphores.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Semaphore);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(Interop.HeapUtil.GetLength(waitSemaphores.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(waitSemaphores.Value)); index++)
                 {
                     fieldPointer[index] = waitSemaphores.Value[index]?.handle ?? default(SharpVk.Interop.Semaphore);
                 }
                 marshalledPresentInfo->WaitSemaphores = fieldPointer;
             }
         }
         marshalledPresentInfo->SwapchainCount = (uint)(Interop.HeapUtil.GetLength(swapchains));
         if (swapchains.IsNull())
         {
             marshalledPresentInfo->Swapchains = null;
         }
         else
         {
             if (swapchains.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->Swapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>());
                 *(SharpVk.Interop.Khronos.Swapchain *)(marshalledPresentInfo->Swapchains) = swapchains.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(Interop.HeapUtil.GetLength(swapchains.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(swapchains.Value)); index++)
                 {
                     fieldPointer[index] = swapchains.Value[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
                 }
                 marshalledPresentInfo->Swapchains = fieldPointer;
             }
         }
         if (imageIndices.IsNull())
         {
             marshalledPresentInfo->ImageIndices = null;
         }
         else
         {
             if (imageIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->ImageIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledPresentInfo->ImageIndices) = imageIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(imageIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(imageIndices.Value)); index++)
                 {
                     fieldPointer[index] = imageIndices.Value[index];
                 }
                 marshalledPresentInfo->ImageIndices = fieldPointer;
             }
         }
         if (results.IsNull())
         {
             marshalledPresentInfo->Results = null;
         }
         else
         {
             if (results.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->Results = (SharpVk.Result *)(Interop.HeapUtil.Allocate <SharpVk.Result>());
                 *(SharpVk.Result *)(marshalledPresentInfo->Results) = results.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.Result *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Result>(Interop.HeapUtil.GetLength(results.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(results.Value)); index++)
                 {
                     fieldPointer[index] = results.Value[index];
                 }
                 marshalledPresentInfo->Results = fieldPointer;
             }
         }
         SharpVk.Interop.Khronos.VkQueuePresentDelegate commandDelegate = commandCache.Cache.vkQueuePresentKHR;
         result = commandDelegate(extendedHandle.handle, marshalledPresentInfo);
         if (SharpVkException.IsError(result))
         {
             throw SharpVkException.Create(result);
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="objectTableEntries">
 /// </param>
 /// <param name="objectIndices">
 /// </param>
 public unsafe void RegisterObjects(ArrayProxy <SharpVk.NVidia.Experimental.ObjectTableEntry>?objectTableEntries, ArrayProxy <uint>?objectIndices)
 {
     try
     {
         SharpVk.NVidia.Experimental.ObjectTableEntry **marshalledObjectTableEntries     = default(SharpVk.NVidia.Experimental.ObjectTableEntry * *);
         SharpVk.NVidia.Experimental.ObjectTableEntry * semiMarshalledObjectTableEntries = default(SharpVk.NVidia.Experimental.ObjectTableEntry *);
         uint *marshalledObjectIndices = default(uint *);
         if (objectTableEntries.IsNull())
         {
             marshalledObjectTableEntries = null;
         }
         else
         {
             if (objectTableEntries.Value.Contents == ProxyContents.Single)
             {
                 semiMarshalledObjectTableEntries = (SharpVk.NVidia.Experimental.ObjectTableEntry *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectTableEntry>());
                 *(SharpVk.NVidia.Experimental.ObjectTableEntry *)(semiMarshalledObjectTableEntries) = objectTableEntries.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.ObjectTableEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectTableEntry>(Interop.HeapUtil.GetLength(objectTableEntries.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectTableEntries.Value)); index++)
                 {
                     fieldPointer[index] = objectTableEntries.Value[index];
                 }
                 semiMarshalledObjectTableEntries = fieldPointer;
                 var marshalledFieldPointer = (SharpVk.NVidia.Experimental.ObjectTableEntry * *)(Interop.HeapUtil.AllocateAndClear <IntPtr>(Interop.HeapUtil.GetLength(objectTableEntries.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectTableEntries.Value)); index++)
                 {
                     marshalledFieldPointer[index] = &semiMarshalledObjectTableEntries[index];
                 }
                 marshalledObjectTableEntries = marshalledFieldPointer;
             }
         }
         if (objectIndices.IsNull())
         {
             marshalledObjectIndices = null;
         }
         else
         {
             if (objectIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledObjectIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledObjectIndices) = objectIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(objectIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectIndices.Value)); index++)
                 {
                     fieldPointer[index] = objectIndices.Value[index];
                 }
                 marshalledObjectIndices = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.Experimental.VkObjectTableNVXRegisterObjectsDelegate commandDelegate = commandCache.Cache.vkRegisterObjectsNVX;
         Result methodResult = commandDelegate(this.parent.handle, this.handle, (uint)(Interop.HeapUtil.GetLength(objectTableEntries)), marshalledObjectTableEntries, marshalledObjectIndices);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="shadingRatePalettes">
 /// </param>
 public static unsafe void SetViewportShadingRatePalette(this SharpVk.CommandBuffer extendedHandle, uint firstViewport, ArrayProxy <SharpVk.NVidia.ShadingRatePalette>?shadingRatePalettes)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.ShadingRatePalette *marshalledShadingRatePalettes = default(SharpVk.Interop.NVidia.ShadingRatePalette *);
         commandCache = extendedHandle.commandCache;
         if (shadingRatePalettes.IsNull())
         {
             marshalledShadingRatePalettes = null;
         }
         else
         {
             if (shadingRatePalettes.Value.Contents == ProxyContents.Single)
             {
                 marshalledShadingRatePalettes = (SharpVk.Interop.NVidia.ShadingRatePalette *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.ShadingRatePalette>());
                 shadingRatePalettes.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.ShadingRatePalette *)(marshalledShadingRatePalettes));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.ShadingRatePalette *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.ShadingRatePalette>(Interop.HeapUtil.GetLength(shadingRatePalettes.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(shadingRatePalettes.Value)); index++)
                 {
                     shadingRatePalettes.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledShadingRatePalettes = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkCommandBufferSetViewportShadingRatePaletteDelegate commandDelegate = commandCache.Cache.vkCmdSetViewportShadingRatePaletteNV;
         commandDelegate(extendedHandle.handle, firstViewport, (uint)(Interop.HeapUtil.GetLength(shadingRatePalettes)), marshalledShadingRatePalettes);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="enabledLayerNames"></param>
 /// <param name="enabledExtensionNames"></param>
 /// <param name="flags"></param>
 /// <param name="applicationInfo"></param>
 /// <param name="validationFlagsExt"></param>
 /// <param name="validationFeaturesExt"></param>
 /// <param name="allocator"></param>
 public unsafe abstract void CreateInstance(ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = null, SharpVk.ApplicationInfo?applicationInfo = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, SharpVk.Multivendor.ValidationFeatures?validationFeaturesExt = null, AllocationCallbacks?allocator = null);
Ejemplo n.º 21
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="customSampleOrders">
 /// </param>
 public static unsafe void SetCoarseSampleOrder(this SharpVk.CommandBuffer extendedHandle, SharpVk.NVidia.CoarseSampleOrderType sampleOrderType, ArrayProxy <SharpVk.NVidia.CoarseSampleOrderCustom>?customSampleOrders)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.CoarseSampleOrderCustom *marshalledCustomSampleOrders = default(SharpVk.Interop.NVidia.CoarseSampleOrderCustom *);
         commandCache = extendedHandle.commandCache;
         if (customSampleOrders.IsNull())
         {
             marshalledCustomSampleOrders = null;
         }
         else
         {
             if (customSampleOrders.Value.Contents == ProxyContents.Single)
             {
                 marshalledCustomSampleOrders = (SharpVk.Interop.NVidia.CoarseSampleOrderCustom *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.CoarseSampleOrderCustom>());
                 customSampleOrders.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.CoarseSampleOrderCustom *)(marshalledCustomSampleOrders));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.CoarseSampleOrderCustom *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.CoarseSampleOrderCustom>(Interop.HeapUtil.GetLength(customSampleOrders.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(customSampleOrders.Value)); index++)
                 {
                     customSampleOrders.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCustomSampleOrders = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkCommandBufferSetCoarseSampleOrderDelegate commandDelegate = commandCache.Cache.vkCmdSetCoarseSampleOrderNV;
         commandDelegate(extendedHandle.handle, sampleOrderType, (uint)(Interop.HeapUtil.GetLength(customSampleOrders)), marshalledCustomSampleOrders);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="createInfos">
 /// </param>
 public static unsafe SharpVk.Pipeline[] CreateRayTracingPipelines(this SharpVk.Device extendedHandle, SharpVk.PipelineCache pipelineCache, ArrayProxy <SharpVk.NVidia.RayTracingPipelineCreateInfo>?createInfos, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Pipeline[] result       = default(SharpVk.Pipeline[]);
         CommandCache       commandCache = default(CommandCache);
         uint createInfoCount            = default(uint);
         SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Pipeline *           marshalledPipelines = default(SharpVk.Interop.Pipeline *);
         commandCache    = extendedHandle.commandCache;
         createInfoCount = (uint)(Interop.HeapUtil.GetLength(createInfos));
         if (createInfos.IsNull())
         {
             marshalledCreateInfos = null;
         }
         else
         {
             if (createInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>());
                 createInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(marshalledCreateInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>(Interop.HeapUtil.GetLength(createInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(createInfos.Value)); index++)
                 {
                     createInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledPipelines = (SharpVk.Interop.Pipeline *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Pipeline>(createInfoCount));
         SharpVk.Interop.NVidia.VkDeviceCreateRayTracingPipelinesDelegate commandDelegate = commandCache.Cache.vkCreateRayTracingPipelinesNV;
         Result methodResult = commandDelegate(extendedHandle.handle, pipelineCache?.handle ?? default(SharpVk.Interop.PipelineCache), createInfoCount, marshalledCreateInfos, marshalledAllocator, marshalledPipelines);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         if (marshalledPipelines != null)
         {
             var fieldPointer = new SharpVk.Pipeline[(uint)(createInfoCount)];
             for (int index = 0; index < (uint)(createInfoCount); index++)
             {
                 fieldPointer[index] = new SharpVk.Pipeline(extendedHandle, marshalledPipelines[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="accelerationStructures">
 /// </param>
 public static unsafe void WriteAccelerationStructuresProperties(this SharpVk.CommandBuffer extendedHandle, ArrayProxy <SharpVk.NVidia.AccelerationStructure>?accelerationStructures, SharpVk.QueryType queryType, SharpVk.QueryPool queryPool, uint firstQuery)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.AccelerationStructure *marshalledAccelerationStructures = default(SharpVk.Interop.NVidia.AccelerationStructure *);
         commandCache = extendedHandle.commandCache;
         if (accelerationStructures.IsNull())
         {
             marshalledAccelerationStructures = null;
         }
         else
         {
             if (accelerationStructures.Value.Contents == ProxyContents.Single)
             {
                 marshalledAccelerationStructures = (SharpVk.Interop.NVidia.AccelerationStructure *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructure>());
                 *(SharpVk.Interop.NVidia.AccelerationStructure *)(marshalledAccelerationStructures) = accelerationStructures.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.AccelerationStructure *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.AccelerationStructure>(Interop.HeapUtil.GetLength(accelerationStructures.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(accelerationStructures.Value)); index++)
                 {
                     fieldPointer[index] = accelerationStructures.Value[index]?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure);
                 }
                 marshalledAccelerationStructures = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkCommandBufferWriteAccelerationStructuresPropertiesDelegate commandDelegate = commandCache.Cache.vkCmdWriteAccelerationStructuresPropertiesNV;
         commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(accelerationStructures)), marshalledAccelerationStructures, queryType, queryPool?.handle ?? default(SharpVk.Interop.QueryPool), firstQuery);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="firstDiscardRectangle">
 /// </param>
 /// <param name="discardRectangles">
 /// </param>
 public static unsafe void SetDiscardRectangle(this SharpVk.CommandBuffer extendedHandle, uint firstDiscardRectangle, ArrayProxy <SharpVk.Rect2D>?discardRectangles)
 {
     try
     {
         CommandCache    commandCache = default(CommandCache);
         SharpVk.Rect2D *marshalledDiscardRectangles = default(SharpVk.Rect2D *);
         commandCache = extendedHandle.commandCache;
         if (discardRectangles.IsNull())
         {
             marshalledDiscardRectangles = null;
         }
         else
         {
             if (discardRectangles.Value.Contents == ProxyContents.Single)
             {
                 marshalledDiscardRectangles = (SharpVk.Rect2D *)(Interop.HeapUtil.Allocate <SharpVk.Rect2D>());
                 *(SharpVk.Rect2D *)(marshalledDiscardRectangles) = discardRectangles.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.Rect2D *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Rect2D>(Interop.HeapUtil.GetLength(discardRectangles.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(discardRectangles.Value)); index++)
                 {
                     fieldPointer[index] = discardRectangles.Value[index];
                 }
                 marshalledDiscardRectangles = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkCommandBufferSetDiscardRectangleDelegate commandDelegate = commandCache.Cache.vkCmdSetDiscardRectangleEXT;
         commandDelegate(extendedHandle.handle, firstDiscardRectangle, (uint)(Interop.HeapUtil.GetLength(discardRectangles)), marshalledDiscardRectangles);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Create a new Vulkan instance.
        /// </summary>
        /// <param name="flags">
        /// Reserved for future use.
        /// </param>
        /// <param name="applicationInfo">
        /// Null or an instance of ApplicationInfo. If not Null, this
        /// information helps implementations recognize behavior inherent to
        /// classes of applications. ApplicationInfo is defined in detail
        /// below.
        /// </param>
        /// <param name="enabledLayerNames">
        /// An array of enabledLayerCount strings containing the names of
        /// layers to enable for the created instance. See the Layers section
        /// for further details.
        /// </param>
        /// <param name="enabledExtensionNames">
        /// An array of enabledExtensionCount strings containing the names of
        /// extensions to enable.
        /// </param>
        /// <param name="debugReportCallbackCreateInfoExt">
        /// </param>
        /// <param name="validationFlagsExt">
        /// </param>
        /// <param name="allocator">
        /// An optional AllocationCallbacks instance that controls host memory
        /// allocation.
        /// </param>
        public static unsafe SharpVk.Instance Create(ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = null, SharpVk.ApplicationInfo?applicationInfo = null, SharpVk.Multivendor.DebugReportCallbackCreateInfo?debugReportCallbackCreateInfoExt = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, AllocationCallbacks?allocator = null)
        {
            var cache = new CommandCache(new SharpVk.Interop.NativeLibrary());

            cache.Initialise();

            return(Instance.Create(cache, enabledLayerNames, enabledExtensionNames, flags, applicationInfo, debugReportCallbackCreateInfoExt, validationFlagsExt, allocator: allocator));
        }
Ejemplo n.º 26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="maxUniformBuffersPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER or
 /// VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxStorageBuffersPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or
 /// VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxStorageImagesPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or
 /// VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxSampledImagesPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_SAMPLER,
 /// VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
 /// or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxPipelineLayouts">
 /// The maximum number of unique PipelineLayout used by any registered
 /// DescriptorSet or Pipeline in this table.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.NVidia.Experimental.ObjectTable CreateObjectTable(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.NVidia.Experimental.ObjectEntryType>?objectEntryTypes, ArrayProxy <uint>?objectEntryCounts, ArrayProxy <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>?objectEntryUsageFlags, uint maxUniformBuffersPerDescriptor, uint maxStorageBuffersPerDescriptor, uint maxStorageImagesPerDescriptor, uint maxSampledImagesPerDescriptor, uint maxPipelineLayouts, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.Experimental.ObjectTable result = default(SharpVk.NVidia.Experimental.ObjectTable);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *           marshalledAllocator   = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.Experimental.ObjectTable marshalledObjectTable = default(SharpVk.Interop.NVidia.Experimental.ObjectTable);
         commandCache                      = extendedHandle.commandCache;
         marshalledCreateInfo              = (SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo>());
         marshalledCreateInfo->SType       = StructureType.ObjectTableCreateInfo;
         marshalledCreateInfo->Next        = nextPointer;
         marshalledCreateInfo->ObjectCount = (uint)(Interop.HeapUtil.GetLength(objectEntryTypes));
         if (objectEntryTypes.IsNull())
         {
             marshalledCreateInfo->ObjectEntryTypes = null;
         }
         else
         {
             if (objectEntryTypes.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryTypes = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectEntryType>());
                 *(SharpVk.NVidia.Experimental.ObjectEntryType *)(marshalledCreateInfo->ObjectEntryTypes) = objectEntryTypes.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectEntryType>(Interop.HeapUtil.GetLength(objectEntryTypes.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryTypes.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryTypes.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryTypes = fieldPointer;
             }
         }
         if (objectEntryCounts.IsNull())
         {
             marshalledCreateInfo->ObjectEntryCounts = null;
         }
         else
         {
             if (objectEntryCounts.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryCounts            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfo->ObjectEntryCounts) = objectEntryCounts.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(objectEntryCounts.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryCounts.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryCounts.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryCounts = fieldPointer;
             }
         }
         if (objectEntryUsageFlags.IsNull())
         {
             marshalledCreateInfo->ObjectEntryUsageFlags = null;
         }
         else
         {
             if (objectEntryUsageFlags.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryUsageFlags = (SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>());
                 *(SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(marshalledCreateInfo->ObjectEntryUsageFlags) = objectEntryUsageFlags.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>(Interop.HeapUtil.GetLength(objectEntryUsageFlags.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryUsageFlags.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryUsageFlags.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryUsageFlags = fieldPointer;
             }
         }
         marshalledCreateInfo->MaxUniformBuffersPerDescriptor = maxUniformBuffersPerDescriptor;
         marshalledCreateInfo->MaxStorageBuffersPerDescriptor = maxStorageBuffersPerDescriptor;
         marshalledCreateInfo->MaxStorageImagesPerDescriptor  = maxStorageImagesPerDescriptor;
         marshalledCreateInfo->MaxSampledImagesPerDescriptor  = maxSampledImagesPerDescriptor;
         marshalledCreateInfo->MaxPipelineLayouts             = maxPipelineLayouts;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.NVidia.Experimental.VkDeviceCreateObjectTableDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkDeviceCreateObjectTableDelegate>("vkCreateObjectTableNVX", "device");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledObjectTable);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.Experimental.ObjectTable(extendedHandle, marshalledObjectTable);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Queue an image for presentation.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Queue handle to extend.
 /// </param>
 public static unsafe void Present(this SharpVk.Queue extendedHandle, ArrayProxy <SharpVk.Semaphore>?waitSemaphores, ArrayProxy <SharpVk.Khronos.Swapchain>?swapchains, ArrayProxy <uint>?imageIndices, ArrayProxy <SharpVk.Result>?results = null)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.PresentInfo *marshalledPresentInfo = default(SharpVk.Interop.Khronos.PresentInfo *);
         commandCache                 = extendedHandle.commandCache;
         marshalledPresentInfo        = (SharpVk.Interop.Khronos.PresentInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PresentInfo>());
         marshalledPresentInfo->SType = StructureType.PresentInfoKhr;
         marshalledPresentInfo->Next  = null;
         marshalledPresentInfo->WaitSemaphoreCount = (uint)(Interop.HeapUtil.GetLength(waitSemaphores));
         if (waitSemaphores.IsNull())
         {
             marshalledPresentInfo->WaitSemaphores = null;
         }
         else
         {
             if (waitSemaphores.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->WaitSemaphores = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Semaphore>());
                 *(SharpVk.Interop.Semaphore *)(marshalledPresentInfo->WaitSemaphores) = waitSemaphores.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Semaphore);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(Interop.HeapUtil.GetLength(waitSemaphores.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(waitSemaphores.Value)); index++)
                 {
                     fieldPointer[index] = waitSemaphores.Value[index]?.handle ?? default(SharpVk.Interop.Semaphore);
                 }
                 marshalledPresentInfo->WaitSemaphores = fieldPointer;
             }
         }
         marshalledPresentInfo->SwapchainCount = (uint)(Interop.HeapUtil.GetLength(swapchains));
         if (swapchains.IsNull())
         {
             marshalledPresentInfo->Swapchains = null;
         }
         else
         {
             if (swapchains.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->Swapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>());
                 *(SharpVk.Interop.Khronos.Swapchain *)(marshalledPresentInfo->Swapchains) = swapchains.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(Interop.HeapUtil.GetLength(swapchains.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(swapchains.Value)); index++)
                 {
                     fieldPointer[index] = swapchains.Value[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
                 }
                 marshalledPresentInfo->Swapchains = fieldPointer;
             }
         }
         if (imageIndices.IsNull())
         {
             marshalledPresentInfo->ImageIndices = null;
         }
         else
         {
             if (imageIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->ImageIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledPresentInfo->ImageIndices) = imageIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(imageIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(imageIndices.Value)); index++)
                 {
                     fieldPointer[index] = imageIndices.Value[index];
                 }
                 marshalledPresentInfo->ImageIndices = fieldPointer;
             }
         }
         if (results.IsNull())
         {
             marshalledPresentInfo->Results = null;
         }
         else
         {
             if (results.Value.Contents == ProxyContents.Single)
             {
                 marshalledPresentInfo->Results = (SharpVk.Result *)(Interop.HeapUtil.Allocate <SharpVk.Result>());
                 *(SharpVk.Result *)(marshalledPresentInfo->Results) = results.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.Result *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Result>(Interop.HeapUtil.GetLength(results.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(results.Value)); index++)
                 {
                     fieldPointer[index] = results.Value[index];
                 }
                 marshalledPresentInfo->Results = fieldPointer;
             }
         }
         SharpVk.Interop.Khronos.VkQueuePresentDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkQueuePresentDelegate>("vkQueuePresentKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledPresentInfo);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="swapchains">
 /// </param>
 /// <param name="metadata">
 /// </param>
 public static unsafe void SetHdrMetadata(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.Khronos.Swapchain>?swapchains, ArrayProxy <SharpVk.Multivendor.HdrMetadata>?metadata)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.Swapchain *      marshalledSwapchains = default(SharpVk.Interop.Khronos.Swapchain *);
         SharpVk.Interop.Multivendor.HdrMetadata *marshalledMetadata   = default(SharpVk.Interop.Multivendor.HdrMetadata *);
         commandCache = extendedHandle.commandCache;
         if (swapchains.IsNull())
         {
             marshalledSwapchains = null;
         }
         else
         {
             if (swapchains.Value.Contents == ProxyContents.Single)
             {
                 marshalledSwapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>());
                 *(SharpVk.Interop.Khronos.Swapchain *)(marshalledSwapchains) = swapchains.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(Interop.HeapUtil.GetLength(swapchains.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(swapchains.Value)); index++)
                 {
                     fieldPointer[index] = swapchains.Value[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
                 }
                 marshalledSwapchains = fieldPointer;
             }
         }
         if (metadata.IsNull())
         {
             marshalledMetadata = null;
         }
         else
         {
             if (metadata.Value.Contents == ProxyContents.Single)
             {
                 marshalledMetadata = (SharpVk.Interop.Multivendor.HdrMetadata *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.HdrMetadata>());
                 metadata.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.Multivendor.HdrMetadata *)(marshalledMetadata));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.Multivendor.HdrMetadata *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Multivendor.HdrMetadata>(Interop.HeapUtil.GetLength(metadata.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(metadata.Value)); index++)
                 {
                     metadata.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledMetadata = fieldPointer;
             }
         }
         SharpVk.Interop.Multivendor.VkDeviceSetHdrMetadataDelegate commandDelegate = commandCache.Cache.vkSetHdrMetadataEXT;
         commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(swapchains)), marshalledSwapchains, marshalledMetadata);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Set the viewport W scaling on a command buffer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 public static unsafe void SetViewportWScaling(this SharpVk.CommandBuffer extendedHandle, uint firstViewport, ArrayProxy <SharpVk.NVidia.ViewportWScaling>?viewportWScalings)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.NVidia.ViewportWScaling *marshalledViewportWScalings = default(SharpVk.NVidia.ViewportWScaling *);
         commandCache = extendedHandle.commandCache;
         if (viewportWScalings.IsNull())
         {
             marshalledViewportWScalings = null;
         }
         else
         {
             if (viewportWScalings.Value.Contents == ProxyContents.Single)
             {
                 marshalledViewportWScalings = (SharpVk.NVidia.ViewportWScaling *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.ViewportWScaling>());
                 *(SharpVk.NVidia.ViewportWScaling *)(marshalledViewportWScalings) = viewportWScalings.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.ViewportWScaling *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.ViewportWScaling>(Interop.HeapUtil.GetLength(viewportWScalings.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(viewportWScalings.Value)); index++)
                 {
                     fieldPointer[index] = viewportWScalings.Value[index];
                 }
                 marshalledViewportWScalings = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkCommandBufferSetViewportWScalingDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.VkCommandBufferSetViewportWScalingDelegate>("vkCmdSetViewportWScalingNV", "device");
         commandDelegate(extendedHandle.handle, firstViewport, (uint)(Interop.HeapUtil.GetLength(viewportWScalings)), marshalledViewportWScalings);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 30
0
        public void VisitThrowStatement(ThrowStatement throwStatement)
        {
            VisitExpression(throwStatement.Expression);

            if (CurrentFunction != null && ReturnValue is string) {

                ArrayProxy<TypeSummary> p = (ArrayProxy<TypeSummary>)CurrentFunction[NodeNames.Exception];

                if (p == null) {
                    CurrentFunction[NodeNames.Exception] = p = new ArrayProxy<TypeSummary>();
                }

                p.Add(new TypeSummary { Summary = (string)ReturnValue, Type = "String" });

            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Allocate one or more descriptor sets.
 /// </summary>
 /// <param name="setLayouts">
 /// </param>
 public DescriptorSet[] AllocateDescriptorSets(ArrayProxy <DescriptorSetLayout> setLayouts)
 {
     return(this.parent.AllocateDescriptorSets(this, setLayouts));
 }