Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void UpdateBuffer(SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, byte[] data)
 {
     try
     {
         byte *marshalledData = default(byte *);
         if (data != null)
         {
             var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(data.Length).ToPointer());
             for (int index = 0; index < (uint)(data.Length); index++)
             {
                 fieldPointer[index] = data[index];
             }
             marshalledData = fieldPointer;
         }
         else
         {
             marshalledData = null;
         }
         Interop.Commands.vkCmdUpdateBuffer(this.handle, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, (DeviceSize)(data?.Length ?? 0), marshalledData);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Map a memory object into application address space.
 /// </summary>
 public unsafe IntPtr Map(DeviceSize offset, DeviceSize size, SharpVk.MemoryMapFlags?flags = default(SharpVk.MemoryMapFlags?))
 {
     try
     {
         IntPtr result = default(IntPtr);
         SharpVk.MemoryMapFlags marshalledFlags = default(SharpVk.MemoryMapFlags);
         void *marshalledData = default(void *);
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.MemoryMapFlags);
         }
         Result methodResult = Interop.Commands.vkMapMemory(this.parent.handle, this.handle, offset, size, marshalledFlags, &marshalledData);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new IntPtr(marshalledData);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 public SubresourceLayout(DeviceSize offset, DeviceSize size, DeviceSize rowPitch, DeviceSize arrayPitch, DeviceSize depthPitch)
 {
     this.Offset     = offset;
     this.Size       = size;
     this.RowPitch   = rowPitch;
     this.ArrayPitch = arrayPitch;
     this.DepthPitch = depthPitch;
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 public BufferImageCopy(DeviceSize bufferOffset, uint bufferRowLength, uint bufferImageHeight, SharpVk.ImageSubresourceLayers imageSubresource, SharpVk.Offset3D imageOffset, SharpVk.Extent3D imageExtent)
 {
     this.BufferOffset      = bufferOffset;
     this.BufferRowLength   = bufferRowLength;
     this.BufferImageHeight = bufferImageHeight;
     this.ImageSubresource  = imageSubresource;
     this.ImageOffset       = imageOffset;
     this.ImageExtent       = imageExtent;
 }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void FillBuffer(SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, DeviceSize size, uint data)
 {
     try
     {
         Interop.Commands.vkCmdFillBuffer(this.handle, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, size, data);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void DispatchIndirect(SharpVk.Buffer buffer, DeviceSize offset)
 {
     try
     {
         Interop.Commands.vkCmdDispatchIndirect(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void DrawIndexedIndirect(SharpVk.Buffer buffer, DeviceSize offset, uint drawCount, uint stride)
 {
     try
     {
         Interop.Commands.vkCmdDrawIndexedIndirect(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, drawCount, stride);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 8
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void BindIndexBuffer(SharpVk.Buffer buffer, DeviceSize offset, SharpVk.IndexType indexType)
 {
     try
     {
         Interop.Commands.vkCmdBindIndexBuffer(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, indexType);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Bind device memory to an image object.
 /// </summary>
 public unsafe void BindMemory(SharpVk.DeviceMemory memory, DeviceSize memoryOffset)
 {
     try
     {
         Result methodResult = Interop.Commands.vkBindImageMemory(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Query the current commitment for a DeviceMemory.
 /// </summary>
 public unsafe DeviceSize GetCommitment()
 {
     try
     {
         DeviceSize result = default(DeviceSize);
         DeviceSize marshalledCommittedMemoryInBytes = default(DeviceSize);
         Interop.Commands.vkGetDeviceMemoryCommitment(this.parent.handle, this.handle, &marshalledCommittedMemoryInBytes);
         result = marshalledCommittedMemoryInBytes;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Query the current commitment for a VkDeviceMemory.
 /// </summary>
 public DeviceSize GetCommitment()
 {
     unsafe
     {
         try
         {
             DeviceSize result = default(DeviceSize);
             Interop.Commands.vkGetDeviceMemoryCommitment(this.parent.handle, this.handle, &result);
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Query the current commitment for a DeviceMemory.
 /// </summary>
 public unsafe DeviceSize GetCommitment()
 {
     try
     {
         DeviceSize result = default(DeviceSize);
         DeviceSize marshalledCommittedMemoryInBytes = default(DeviceSize);
         SharpVk.Interop.VkDeviceMemoryGetCommitmentDelegate commandDelegate = commandCache.Cache.vkGetDeviceMemoryCommitment;
         commandDelegate(this.parent.handle, this.handle, &marshalledCommittedMemoryInBytes);
         result = marshalledCommittedMemoryInBytes;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Bind device memory to a buffer object.
 /// </summary>
 public unsafe void BindMemory(SharpVk.DeviceMemory memory, DeviceSize memoryOffset)
 {
     try
     {
         SharpVk.Interop.VkBufferBindMemoryDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkBufferBindMemoryDelegate>("vkBindBufferMemory", "");
         Result methodResult = commandDelegate(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Bind device memory to a buffer object.
 /// </summary>
 public void BindMemory(DeviceMemory memory, DeviceSize memoryOffset)
 {
     unsafe
     {
         try
         {
             Result commandResult;
             Interop.DeviceMemory marshalledMemory = default(Interop.DeviceMemory);
             memory?.MarshalTo(&marshalledMemory);
             commandResult = Interop.Commands.vkBindBufferMemory(this.parent.handle, this.handle, marshalledMemory, memoryOffset);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Esempio n. 15
0
 /// <summary>
 /// Map a memory object into application address space.
 /// </summary>
 public void MapMemory(DeviceSize offset, DeviceSize size, MemoryMapFlags flags, ref IntPtr data)
 {
     unsafe
     {
         try
         {
             Result commandResult;
             void * marshalledData;
             commandResult = Interop.Commands.vkMapMemory(this.parent.handle, this.handle, offset, size, flags, &marshalledData);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             data = new IntPtr(marshalledData);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Esempio n. 16
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void GetResults(uint firstQuery, uint queryCount, byte[] data, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         byte *marshalledData = default(byte *);
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         if (data != null)
         {
             var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(data.Length).ToPointer());
             for (int index = 0; index < (uint)(data.Length); index++)
             {
                 fieldPointer[index] = data[index];
             }
             marshalledData = fieldPointer;
         }
         else
         {
             marshalledData = null;
         }
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         Result methodResult = Interop.Commands.vkGetQueryPoolResults(this.parent.handle, this.handle, firstQuery, queryCount, (HostSize)(data?.Length ?? 0), marshalledData, stride, marshalledFlags);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 17
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void CopyQueryPoolResults(SharpVk.QueryPool queryPool, uint firstQuery, uint queryCount, SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         Interop.Commands.vkCmdCopyQueryPoolResults(this.handle, queryPool?.handle ?? default(SharpVk.Interop.QueryPool), firstQuery, queryCount, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, stride, marshalledFlags);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Copy results of queries in a query pool to a host memory region.
 /// </summary>
 /// <param name="data">
 /// </param>
 public unsafe Result GetResults(uint firstQuery, uint queryCount, ArrayProxy <byte>?data, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         Result result         = default(Result);
         byte * marshalledData = default(byte *);
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         if (data.IsNull())
         {
             marshalledData = null;
         }
         else
         {
             if (data.Value.Contents == ProxyContents.Single)
             {
                 marshalledData            = (byte *)(Interop.HeapUtil.Allocate <byte>());
                 *(byte *)(marshalledData) = data.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(data.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(data.Value)); index++)
                 {
                     fieldPointer[index] = data.Value[index];
                 }
                 marshalledData = fieldPointer;
             }
         }
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         SharpVk.Interop.VkQueryPoolGetResultsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueryPoolGetResultsDelegate>("vkGetQueryPoolResults", "");
         result = commandDelegate(this.parent.handle, this.handle, firstQuery, queryCount, (HostSize)(Interop.HeapUtil.GetLength(data)), marshalledData, stride, marshalledFlags);
         if (SharpVkException.IsError(result))
         {
             throw SharpVkException.Create(result);
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Esempio n. 19
0
 /// <summary>
 ///
 /// </summary>
 public BufferCopy(DeviceSize sourceOffset, DeviceSize destinationOffset, DeviceSize size)
 {
     this.SourceOffset      = sourceOffset;
     this.DestinationOffset = destinationOffset;
     this.Size = size;
 }
 /// <summary>
 ///
 /// </summary>
 public SparseImageMemoryRequirements(SharpVk.SparseImageFormatProperties formatProperties, uint imageMipTailFirstLod, DeviceSize imageMipTailSize, DeviceSize imageMipTailOffset, DeviceSize imageMipTailStride)
 {
     this.FormatProperties     = formatProperties;
     this.ImageMipTailFirstLod = imageMipTailFirstLod;
     this.ImageMipTailSize     = imageMipTailSize;
     this.ImageMipTailOffset   = imageMipTailOffset;
     this.ImageMipTailStride   = imageMipTailStride;
 }
Esempio n. 21
0
 /// <summary>
 /// Copy results of queries in a query pool to a host memory region.
 /// </summary>
 public Result GetResults(uint firstQuery, uint queryCount, ArrayProxy <byte> data, DeviceSize stride, QueryResultFlags flags)
 {
     unsafe
     {
         try
         {
             Result   result         = default(Result);
             GCHandle dataHandle     = default(GCHandle);
             byte *   marshalledData = null;
             if (data.Contents != ProxyContents.Null)
             {
                 if (data.Contents == ProxyContents.Single)
                 {
                     byte *dataPointer = stackalloc byte[1];
                     *     dataPointer = data.GetSingleValue();
                     marshalledData = dataPointer;
                 }
                 else
                 {
                     var arrayValue = data.GetArrayValue();
                     dataHandle     = GCHandle.Alloc(arrayValue.Array, GCHandleType.Pinned);
                     marshalledData = (byte *)(dataHandle.AddrOfPinnedObject() + (int)(MemUtil.SizeOf <byte>() * arrayValue.Offset)).ToPointer();
                 }
             }
             else
             {
                 marshalledData = null;
             }
             result = Interop.Commands.vkGetQueryPoolResults(this.parent.handle, this.handle, firstQuery, queryCount, (Size)(data.Length), marshalledData, stride, flags);
             if (SharpVkException.IsError(result))
             {
                 throw SharpVkException.Create(result);
             }
             if (dataHandle.IsAllocated)
             {
                 dataHandle.Free();
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Esempio n. 22
0
 /// <summary>
 ///
 /// </summary>
 public ImageFormatProperties(SharpVk.Extent3D maxExtent, uint maxMipLevels, uint maxArrayLayers, SharpVk.SampleCountFlags sampleCounts, DeviceSize maxResourceSize)
 {
     this.MaxExtent       = maxExtent;
     this.MaxMipLevels    = maxMipLevels;
     this.MaxArrayLayers  = maxArrayLayers;
     this.SampleCounts    = sampleCounts;
     this.MaxResourceSize = maxResourceSize;
 }
Esempio n. 23
0
 /// <summary>
 ///
 /// </summary>
 public MemoryHeap(DeviceSize size, SharpVk.MemoryHeapFlags flags)
 {
     this.Size  = size;
     this.Flags = flags;
 }
Esempio n. 24
0
 /// <summary>
 ///
 /// </summary>
 public MemoryRequirements(DeviceSize size, DeviceSize alignment, uint memoryTypeBits)
 {
     this.Size           = size;
     this.Alignment      = alignment;
     this.MemoryTypeBits = memoryTypeBits;
 }