namespace Brutal.VulkanApi
{
public static unsafe partial class VkDeviceExtensions
{
///
/// vkGetDeviceProcAddr - Return a function pointer for a command
///
///
///
/// In order to support systems with multiple Vulkan implementations, the
/// function pointers returned by vkGetInstanceProcAddr may: point to
/// dispatch code that calls a different real implementation for different
/// VkDevice objects or their child objects.
/// The overhead of the internal dispatch for VkDevice objects can be
/// avoided by obtaining device-specific function pointers for any commands that
/// use a device or device-child object as their dispatchable object.
/// Such function pointers can be obtained by calling:
///
///
/// // Provided by VK_VERSION_1_0
/// PFN_vkVoidFunction vkGetDeviceProcAddr(
/// VkDevice device,
/// const char* pName);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe PfnVkVoidFunction GetProcAddr(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pName
)
{
fixed (byte* pNameFixed = pName)
{
return handle.PInvoke.vkGetDeviceProcAddr.Invoke(handle.Handle, pNameFixed);
}
}
///
/// vkDestroyDevice - Destroy a logical device
///
///
///
/// To destroy a device, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyDevice(
/// VkDevice device,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void DestroyDeviceInternal(
this VulkanHandleWrapper handle,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyDevice.Invoke(handle.Handle, pAllocator);
}
///
/// vkGetDeviceQueue - Get a queue handle from a device
///
///
///
/// To retrieve a handle to a VkQueue object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetDeviceQueue(
/// VkDevice device,
/// uint32_t queueFamilyIndex,
/// uint32_t queueIndex,
/// VkQueue* pQueue);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe VkQueue GetQueueInternal(
this VulkanHandleWrapper handle,
int queueFamilyIndex,
int queueIndex
)
{
VkQueue pQueueLocal = default;
handle.PInvoke.vkGetDeviceQueue.Invoke(handle.Handle, queueFamilyIndex, queueIndex, &pQueueLocal);
return pQueueLocal;
}
///
/// vkQueueSubmit - Submits a sequence of semaphores or command buffers to a queue
///
///
///
/// :refpage: vkQueueSubmit
///
///
/// To submit command buffers to a queue, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkQueueSubmit(
/// VkQueue queue,
/// uint32_t submitCount,
/// const VkSubmitInfo* pSubmits,
/// VkFence fence);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void SubmitInternal(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pSubmits,
VkFence fence
)
{
fixed (VkSubmitInfo* pSubmitsFixed = pSubmits)
{
VkResult result = handle.PInvoke.vkQueueSubmit.Invoke(
handle.Handle,
pSubmits.Length,
pSubmitsFixed,
fence
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkQueueSubmit failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkQueueSubmit failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkQueueSubmit failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkQueueSubmit failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkQueueSubmit failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkQueueWaitIdle - Wait for a queue to become idle
///
///
///
/// :refpage: vkQueueWaitIdle
///
///
/// To wait on the host for the completion of outstanding queue operations for a
/// given queue, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkQueueWaitIdle(
/// VkQueue queue);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void WaitIdleInternal(this VulkanHandleWrapper handle)
{
VkResult result = handle.PInvoke.vkQueueWaitIdle.Invoke(handle.Handle);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkQueueWaitIdle failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkQueueWaitIdle failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkQueueWaitIdle failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkQueueWaitIdle failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkQueueWaitIdle failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkDeviceWaitIdle - Wait for a device to become idle
///
///
///
/// :refpage: vkDeviceWaitIdle
///
///
/// To wait on the host for the completion of outstanding queue operations for
/// all queues on a given logical device, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkDeviceWaitIdle(
/// VkDevice device);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WaitIdle(this VulkanHandleWrapper handle)
{
VkResult result = handle.PInvoke.vkDeviceWaitIdle.Invoke(handle.Handle);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkDeviceWaitIdle failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkDeviceWaitIdle failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkDeviceWaitIdle failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkDeviceWaitIdle failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkDeviceWaitIdle failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkAllocateMemory - Allocate device memory
///
///
///
/// :refpage: vkAllocateMemory
/// :objectnameplural: device memory objects
/// :objectnamecamelcase: deviceMemory
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To allocate memory objects, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkAllocateMemory(
/// VkDevice device,
/// const VkMemoryAllocateInfo* pAllocateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkDeviceMemory* pMemory);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkDeviceMemory AllocateMemory(
this VulkanHandleWrapper handle,
in VkMemoryAllocateInfo pAllocateInfo,
VkAllocator? pAllocator
)
{
fixed (VkMemoryAllocateInfo* pAllocateInfoFixed = &pAllocateInfo)
{
VkDeviceMemory pMemoryLocal = default;
VkResult result = handle.PInvoke.vkAllocateMemory.Invoke(
handle.Handle,
pAllocateInfoFixed,
pAllocator,
&pMemoryLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidExternalHandle:
throw new VkResultError(
VkResult.ErrorInvalidExternalHandle,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkAllocateMemory failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pMemoryLocal;
}
}
///
/// vkFreeMemory - Free device memory
///
///
///
/// To free a memory object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkFreeMemory(
/// VkDevice device,
/// VkDeviceMemory memory,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void FreeMemory(
this VulkanHandleWrapper handle,
VkDeviceMemory memory,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkFreeMemory.Invoke(handle.Handle, memory, pAllocator);
}
///
/// vkMapMemory - Map a memory object into application address space
///
///
///
/// :refpage: vkMapMemory
///
///
/// To retrieve a host virtual address pointer to a region of a mappable memory
/// object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkMapMemory(
/// VkDevice device,
/// VkDeviceMemory memory,
/// VkDeviceSize offset,
/// VkDeviceSize size,
/// VkMemoryMapFlags flags,
/// void** ppData);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void* MapMemory(
this VulkanHandleWrapper handle,
VkDeviceMemory memory,
ByteSize64 offset,
ByteSize64 size,
VkMemoryMapFlags flags
)
{
void* ppDataLocal = default;
VkResult result = handle.PInvoke.vkMapMemory.Invoke(
handle.Handle,
memory,
offset,
size,
flags,
&ppDataLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkMapMemory failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkMapMemory failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorMemoryMapFailed:
throw new VkResultError(
VkResult.ErrorMemoryMapFailed,
"Vulkan call to vkMapMemory failed with error: VK_ERROR_MEMORY_MAP_FAILED"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkMapMemory failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkMapMemory failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return ppDataLocal;
}
///
/// vkUnmapMemory - Unmap a previously mapped memory object
///
///
///
/// To unmap a memory object once host access to it is no longer needed by the
/// application, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkUnmapMemory(
/// VkDevice device,
/// VkDeviceMemory memory);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void UnmapMemory(
this VulkanHandleWrapper handle,
VkDeviceMemory memory
)
{
handle.PInvoke.vkUnmapMemory.Invoke(handle.Handle, memory);
}
///
/// vkFlushMappedMemoryRanges - Flush mapped memory ranges
///
///
///
/// :refpage: vkFlushMappedMemoryRanges
///
///
/// To flush ranges of non-coherent memory from the host caches, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkFlushMappedMemoryRanges(
/// VkDevice device,
/// uint32_t memoryRangeCount,
/// const VkMappedMemoryRange* pMemoryRanges);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void FlushMappedMemoryRanges(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pMemoryRanges
)
{
fixed (VkMappedMemoryRange* pMemoryRangesFixed = pMemoryRanges)
{
VkResult result = handle.PInvoke.vkFlushMappedMemoryRanges.Invoke(
handle.Handle,
pMemoryRanges.Length,
pMemoryRangesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkFlushMappedMemoryRanges failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkFlushMappedMemoryRanges failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkFlushMappedMemoryRanges failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkFlushMappedMemoryRanges failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkInvalidateMappedMemoryRanges - Invalidate ranges of mapped memory objects
///
///
///
/// :refpage: vkInvalidateMappedMemoryRanges
///
///
/// To invalidate ranges of non-coherent memory from the host caches, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkInvalidateMappedMemoryRanges(
/// VkDevice device,
/// uint32_t memoryRangeCount,
/// const VkMappedMemoryRange* pMemoryRanges);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void InvalidateMappedMemoryRanges(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pMemoryRanges
)
{
fixed (VkMappedMemoryRange* pMemoryRangesFixed = pMemoryRanges)
{
VkResult result = handle.PInvoke.vkInvalidateMappedMemoryRanges.Invoke(
handle.Handle,
pMemoryRanges.Length,
pMemoryRangesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkInvalidateMappedMemoryRanges failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkInvalidateMappedMemoryRanges failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkInvalidateMappedMemoryRanges failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkInvalidateMappedMemoryRanges failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkGetDeviceMemoryCommitment - Query the current commitment for a VkDeviceMemory
///
///
///
/// To determine the amount of lazily-allocated memory that is currently
/// committed for a memory object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetDeviceMemoryCommitment(
/// VkDevice device,
/// VkDeviceMemory memory,
/// VkDeviceSize* pCommittedMemoryInBytes);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ByteSize64 GetMemoryCommitment(
this VulkanHandleWrapper handle,
VkDeviceMemory memory
)
{
ByteSize64 pCommittedMemoryInBytesLocal = default;
handle.PInvoke.vkGetDeviceMemoryCommitment.Invoke(handle.Handle, memory, &pCommittedMemoryInBytesLocal);
return pCommittedMemoryInBytesLocal;
}
///
/// vkBindBufferMemory - Bind device memory to a buffer object
///
///
///
/// :refpage: vkBindBufferMemory
///
///
/// To attach memory to a buffer object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkBindBufferMemory(
/// VkDevice device,
/// VkBuffer buffer,
/// VkDeviceMemory memory,
/// VkDeviceSize memoryOffset);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindBufferMemory(
this VulkanHandleWrapper handle,
VkBuffer buffer,
VkDeviceMemory memory,
ByteSize64 memoryOffset
)
{
VkResult result = handle.PInvoke.vkBindBufferMemory.Invoke(handle.Handle, buffer, memory, memoryOffset);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkBindBufferMemory failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkBindBufferMemory failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkBindBufferMemory failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkBindBufferMemory failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkBindBufferMemory failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkBindImageMemory - Bind device memory to an image object
///
///
///
/// :refpage: vkBindImageMemory
///
///
/// To attach memory to an image object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkBindImageMemory(
/// VkDevice device,
/// VkImage image,
/// VkDeviceMemory memory,
/// VkDeviceSize memoryOffset);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindImageMemory(
this VulkanHandleWrapper handle,
VkImage image,
VkDeviceMemory memory,
ByteSize64 memoryOffset
)
{
VkResult result = handle.PInvoke.vkBindImageMemory.Invoke(handle.Handle, image, memory, memoryOffset);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkBindImageMemory failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkBindImageMemory failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkBindImageMemory failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkBindImageMemory failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkGetBufferMemoryRequirements - Returns the memory requirements for specified Vulkan object
///
///
///
/// To determine the memory requirements for a buffer resource, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetBufferMemoryRequirements(
/// VkDevice device,
/// VkBuffer buffer,
/// VkMemoryRequirements* pMemoryRequirements);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetBufferMemoryRequirements(
this VulkanHandleWrapper handle,
VkBuffer buffer,
ref VkMemoryRequirements pMemoryRequirements
)
{
fixed (VkMemoryRequirements* pMemoryRequirementsFixed = &pMemoryRequirements)
{
handle.PInvoke.vkGetBufferMemoryRequirements.Invoke(handle.Handle, buffer, pMemoryRequirementsFixed);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkMemoryRequirements.
public static VkMemoryRequirements GetBufferMemoryRequirements(
this VulkanHandleWrapper handle,
VkBuffer buffer
)
{
VkMemoryRequirements outValue = new();
GetBufferMemoryRequirements(handle, buffer, ref outValue);
return outValue;
}
///
/// vkGetImageMemoryRequirements - Returns the memory requirements for specified Vulkan object
///
///
///
/// To determine the memory requirements for an image resource, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetImageMemoryRequirements(
/// VkDevice device,
/// VkImage image,
/// VkMemoryRequirements* pMemoryRequirements);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetImageMemoryRequirements(
this VulkanHandleWrapper handle,
VkImage image,
ref VkMemoryRequirements pMemoryRequirements
)
{
fixed (VkMemoryRequirements* pMemoryRequirementsFixed = &pMemoryRequirements)
{
handle.PInvoke.vkGetImageMemoryRequirements.Invoke(handle.Handle, image, pMemoryRequirementsFixed);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkMemoryRequirements.
public static VkMemoryRequirements GetImageMemoryRequirements(
this VulkanHandleWrapper handle,
VkImage image
)
{
VkMemoryRequirements outValue = new();
GetImageMemoryRequirements(handle, image, ref outValue);
return outValue;
}
///
/// vkGetImageSparseMemoryRequirements - Query the memory requirements for a sparse image
///
///
///
/// To query sparse memory requirements for an image, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetImageSparseMemoryRequirements(
/// VkDevice device,
/// VkImage image,
/// uint32_t* pSparseMemoryRequirementCount,
/// VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe void GetImageSparseMemoryRequirements(
this VulkanHandleWrapper handle,
VkImage image,
ref int pSparseMemoryRequirementCount,
scoped ReadOnlySpan pSparseMemoryRequirements
)
{
fixed (VkSparseImageMemoryRequirements* pSparseMemoryRequirementsFixed = pSparseMemoryRequirements)
fixed (int* pSparseMemoryRequirementCountFixed = &pSparseMemoryRequirementCount)
{
handle.PInvoke.vkGetImageSparseMemoryRequirements.Invoke(
handle.Handle,
image,
pSparseMemoryRequirementCountFixed,
pSparseMemoryRequirementsFixed
);
}
}
/// Queries the required length.
/// The required length.
public static int GetImageSparseMemoryRequirements_Count(
this VulkanHandleWrapper handle,
VkImage image
)
{
int pSparseMemoryRequirementCount = default;
GetImageSparseMemoryRequirements(handle, image, ref pSparseMemoryRequirementCount, null);
return pSparseMemoryRequirementCount;
}
/// Writes to a provided span.
/// The span to write to.
/// Return value of the underlying function.
public static void GetImageSparseMemoryRequirements_Write(
this VulkanHandleWrapper handle,
VkImage image,
scoped ReadOnlySpan pSparseMemoryRequirements
)
{
int pSparseMemoryRequirementCount = pSparseMemoryRequirements.Length;
GetImageSparseMemoryRequirements(
handle,
image,
ref pSparseMemoryRequirementCount,
pSparseMemoryRequirements
);
}
///
/// vkQueueBindSparse - Bind device memory to a sparse resource object
///
///
///
/// To submit sparse binding operations to a queue, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkQueueBindSparse(
/// VkQueue queue,
/// uint32_t bindInfoCount,
/// const VkBindSparseInfo* pBindInfo,
/// VkFence fence);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void BindSparseInternal(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pBindInfo,
VkFence fence
)
{
fixed (VkBindSparseInfo* pBindInfoFixed = pBindInfo)
{
VkResult result = handle.PInvoke.vkQueueBindSparse.Invoke(
handle.Handle,
pBindInfo.Length,
pBindInfoFixed,
fence
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkQueueBindSparse failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkQueueBindSparse failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkQueueBindSparse failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkQueueBindSparse failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkQueueBindSparse failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkCreateFence - Create a new fence object
///
///
///
/// :refpage: vkCreateFence
/// :objectnameplural: fences
/// :objectnamecamelcase: fence
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a fence, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateFence(
/// VkDevice device,
/// const VkFenceCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkFence* pFence);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkFence CreateFence(
this VulkanHandleWrapper handle,
in VkFenceCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkFenceCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkFence pFenceLocal = default;
VkResult result = handle.PInvoke.vkCreateFence.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pFenceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateFence failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateFence failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateFence failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateFence failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pFenceLocal;
}
}
///
/// vkDestroyFence - Destroy a fence object
///
///
///
/// To destroy a fence, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyFence(
/// VkDevice device,
/// VkFence fence,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyFence(
this VulkanHandleWrapper handle,
VkFence fence,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyFence.Invoke(handle.Handle, fence, pAllocator);
}
///
/// vkResetFences - Resets one or more fence objects
///
///
///
/// To set the state of fences to unsignaled from the host, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkResetFences(
/// VkDevice device,
/// uint32_t fenceCount,
/// const VkFence* pFences);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ResetFences(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pFences
)
{
fixed (VkFence* pFencesFixed = pFences)
{
VkResult result = handle.PInvoke.vkResetFences.Invoke(handle.Handle, pFences.Length, pFencesFixed);
switch (result)
{
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkResetFences failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkResetFences failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkResetFences failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkGetFenceStatus - Return the status of a fence
///
///
///
/// :refpage: vkGetFenceStatus
///
///
/// To query the status of a fence from the host, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkGetFenceStatus(
/// VkDevice device,
/// VkFence fence);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static VkResult GetFenceStatus(
this VulkanHandleWrapper handle,
VkFence fence
)
{
VkResult result = handle.PInvoke.vkGetFenceStatus.Invoke(handle.Handle, fence);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetFenceStatus failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkGetFenceStatus failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkGetFenceStatus failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetFenceStatus failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetFenceStatus failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.NotReady:
default:
break;
}
return result;
}
///
/// vkWaitForFences - Wait for one or more fences to become signaled
///
///
///
/// :refpage: vkWaitForFences
///
///
/// To wait for one or more fences to enter the signaled state on the host,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkWaitForFences(
/// VkDevice device,
/// uint32_t fenceCount,
/// const VkFence* pFences,
/// VkBool32 waitAll,
/// uint64_t timeout);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkResult WaitForFences(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pFences,
Brutal.Bool32 waitAll,
nint timeout
)
{
fixed (VkFence* pFencesFixed = pFences)
{
VkResult result = handle.PInvoke.vkWaitForFences.Invoke(
handle.Handle,
pFences.Length,
pFencesFixed,
waitAll,
timeout
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkWaitForFences failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkWaitForFences failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkWaitForFences failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkWaitForFences failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkWaitForFences failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.Timeout:
default:
break;
}
return result;
}
}
///
/// vkCreateSemaphore - Create a new queue semaphore object
///
///
///
/// :refpage: vkCreateSemaphore
/// :objectnameplural: semaphores
/// :objectnamecamelcase: semaphore
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a semaphore, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateSemaphore(
/// VkDevice device,
/// const VkSemaphoreCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSemaphore* pSemaphore);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkSemaphore CreateSemaphore(
this VulkanHandleWrapper handle,
in VkSemaphoreCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkSemaphoreCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkSemaphore pSemaphoreLocal = default;
VkResult result = handle.PInvoke.vkCreateSemaphore.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSemaphoreLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateSemaphore failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateSemaphore failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateSemaphore failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateSemaphore failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pSemaphoreLocal;
}
}
///
/// vkDestroySemaphore - Destroy a semaphore object
///
///
///
/// To destroy a semaphore, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroySemaphore(
/// VkDevice device,
/// VkSemaphore semaphore,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroySemaphore(
this VulkanHandleWrapper handle,
VkSemaphore semaphore,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroySemaphore.Invoke(handle.Handle, semaphore, pAllocator);
}
///
/// vkCreateQueryPool - Create a new query pool object
///
///
///
/// :refpage: vkCreateQueryPool
/// :objectnameplural: query pools
/// :objectnamecamelcase: queryPool
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a query pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateQueryPool(
/// VkDevice device,
/// const VkQueryPoolCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkQueryPool* pQueryPool);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkQueryPool CreateQueryPool(
this VulkanHandleWrapper handle,
in VkQueryPoolCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkQueryPoolCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkQueryPool pQueryPoolLocal = default;
VkResult result = handle.PInvoke.vkCreateQueryPool.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pQueryPoolLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateQueryPool failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateQueryPool failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateQueryPool failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateQueryPool failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pQueryPoolLocal;
}
}
///
/// vkDestroyQueryPool - Destroy a query pool object
///
///
///
/// To destroy a query pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyQueryPool(
/// VkDevice device,
/// VkQueryPool queryPool,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyQueryPool(
this VulkanHandleWrapper handle,
VkQueryPool queryPool,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyQueryPool.Invoke(handle.Handle, queryPool, pAllocator);
}
///
/// vkGetQueryPoolResults - Copy results of queries in a query pool to a host memory region
///
///
///
/// :refpage: vkGetQueryPoolResults
///
///
/// To retrieve status and results for a set of queries, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkGetQueryPoolResults(
/// VkDevice device,
/// VkQueryPool queryPool,
/// uint32_t firstQuery,
/// uint32_t queryCount,
/// size_t dataSize,
/// void* pData,
/// VkDeviceSize stride,
/// VkQueryResultFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkResult GetQueryPoolResults(
this VulkanHandleWrapper handle,
VkQueryPool queryPool,
int firstQuery,
int queryCount,
scoped ReadOnlySpan pData,
ByteSize64 stride,
VkQueryResultFlags flags
)
{
fixed (byte* pDataFixed = pData)
{
VkResult result = handle.PInvoke.vkGetQueryPoolResults.Invoke(
handle.Handle,
queryPool,
firstQuery,
queryCount,
(nuint)pData.Length,
pDataFixed,
stride,
flags
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetQueryPoolResults failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkGetQueryPoolResults failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkGetQueryPoolResults failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetQueryPoolResults failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetQueryPoolResults failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.NotReady:
default:
break;
}
return result;
}
}
///
/// vkCreateBuffer - Create a new buffer object
///
///
///
/// :refpage: vkCreateBuffer
/// :objectnameplural: buffers
/// :objectnamecamelcase: buffer
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create buffers, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateBuffer(
/// VkDevice device,
/// const VkBufferCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkBuffer* pBuffer);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkBuffer CreateBuffer(
this VulkanHandleWrapper handle,
in VkBufferCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkBufferCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkBuffer pBufferLocal = default;
VkResult result = handle.PInvoke.vkCreateBuffer.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pBufferLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateBuffer failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateBuffer failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkCreateBuffer failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateBuffer failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateBuffer failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pBufferLocal;
}
}
///
/// vkDestroyBuffer - Destroy a buffer object
///
///
///
/// To destroy a buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyBuffer(
/// VkDevice device,
/// VkBuffer buffer,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyBuffer(
this VulkanHandleWrapper handle,
VkBuffer buffer,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyBuffer.Invoke(handle.Handle, buffer, pAllocator);
}
///
/// vkCreateImage - Create a new image object
///
///
///
/// :refpage: vkCreateImage
/// :objectnameplural: images
/// :objectnamecamelcase: image
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create images, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateImage(
/// VkDevice device,
/// const VkImageCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkImage* pImage);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkImage CreateImage(
this VulkanHandleWrapper handle,
in VkImageCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkImageCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkImage pImageLocal = default;
VkResult result = handle.PInvoke.vkCreateImage.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pImageLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorCompressionExhaustedEXT:
throw new VkResultError(
VkResult.ErrorCompressionExhaustedEXT,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_COMPRESSION_EXHAUSTED_EXT"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateImage failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pImageLocal;
}
}
///
/// vkDestroyImage - Destroy an image object
///
///
///
/// To destroy an image, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyImage(
/// VkDevice device,
/// VkImage image,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyImage(
this VulkanHandleWrapper handle,
VkImage image,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyImage.Invoke(handle.Handle, image, pAllocator);
}
///
/// vkGetImageSubresourceLayout - Retrieve information about an image subresource
///
///
///
/// :refpage: vkGetImageSubresourceLayout
///
///
/// To query the memory layout of an image subresource, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetImageSubresourceLayout(
/// VkDevice device,
/// VkImage image,
/// const VkImageSubresource* pSubresource,
/// VkSubresourceLayout* pLayout);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetImageSubresourceLayout(
this VulkanHandleWrapper handle,
VkImage image,
VkImageSubresource* pSubresource,
ref VkSubresourceLayout pLayout
)
{
fixed (VkSubresourceLayout* pLayoutFixed = &pLayout)
{
handle.PInvoke.vkGetImageSubresourceLayout.Invoke(handle.Handle, image, pSubresource, pLayoutFixed);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkSubresourceLayout.
public static unsafe VkSubresourceLayout GetImageSubresourceLayout(
this VulkanHandleWrapper handle,
VkImage image,
VkImageSubresource* pSubresource
)
{
VkSubresourceLayout outValue = new();
GetImageSubresourceLayout(handle, image, pSubresource, ref outValue);
return outValue;
}
///
/// vkCreateImageView - Create an image view from an existing image
///
///
///
/// :refpage: vkCreateImageView
/// :objectnameplural: image views
/// :objectnamecamelcase: imageView
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create an image view, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateImageView(
/// VkDevice device,
/// const VkImageViewCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkImageView* pView);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkImageView CreateImageView(
this VulkanHandleWrapper handle,
in VkImageViewCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkImageViewCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkImageView pViewLocal = default;
VkResult result = handle.PInvoke.vkCreateImageView.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pViewLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateImageView failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateImageView failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkCreateImageView failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateImageView failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateImageView failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pViewLocal;
}
}
///
/// vkDestroyImageView - Destroy an image view object
///
///
///
/// To destroy an image view, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyImageView(
/// VkDevice device,
/// VkImageView imageView,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyImageView(
this VulkanHandleWrapper handle,
VkImageView imageView,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyImageView.Invoke(handle.Handle, imageView, pAllocator);
}
///
/// vkCreateCommandPool - Create a new command pool object
///
///
///
/// :refpage: vkCreateCommandPool
/// :objectnameplural: command pools
/// :objectnamecamelcase: commandPool
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a command pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateCommandPool(
/// VkDevice device,
/// const VkCommandPoolCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkCommandPool* pCommandPool);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkCommandPool CreateCommandPool(
this VulkanHandleWrapper handle,
in VkCommandPoolCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkCommandPoolCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkCommandPool pCommandPoolLocal = default;
VkResult result = handle.PInvoke.vkCreateCommandPool.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pCommandPoolLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateCommandPool failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateCommandPool failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateCommandPool failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateCommandPool failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pCommandPoolLocal;
}
}
///
/// vkDestroyCommandPool - Destroy a command pool object
///
///
///
/// To destroy a command pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyCommandPool(
/// VkDevice device,
/// VkCommandPool commandPool,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyCommandPool(
this VulkanHandleWrapper handle,
VkCommandPool commandPool,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyCommandPool.Invoke(handle.Handle, commandPool, pAllocator);
}
///
/// vkResetCommandPool - Reset a command pool
///
///
///
/// To reset a command pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkResetCommandPool(
/// VkDevice device,
/// VkCommandPool commandPool,
/// VkCommandPoolResetFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetCommandPool(
this VulkanHandleWrapper handle,
VkCommandPool commandPool,
VkCommandPoolResetFlags flags
)
{
VkResult result = handle.PInvoke.vkResetCommandPool.Invoke(handle.Handle, commandPool, flags);
switch (result)
{
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkResetCommandPool failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkResetCommandPool failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkResetCommandPool failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkAllocateCommandBuffers - Allocate command buffers from an existing command pool
///
///
///
/// :refpage: vkAllocateCommandBuffers
///
///
/// To allocate command buffers, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkAllocateCommandBuffers(
/// VkDevice device,
/// const VkCommandBufferAllocateInfo* pAllocateInfo,
/// VkCommandBuffer* pCommandBuffers);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void AllocateCommandBuffersInternal(
this VulkanHandleWrapper handle,
in VkCommandBufferAllocateInfo pAllocateInfo,
scoped ReadOnlySpan pCommandBuffers
)
{
fixed (VkCommandBuffer* pCommandBuffersFixed = pCommandBuffers)
fixed (VkCommandBufferAllocateInfo* pAllocateInfoFixed = &pAllocateInfo)
{
VkResult result = handle.PInvoke.vkAllocateCommandBuffers.Invoke(
handle.Handle,
pAllocateInfoFixed,
pCommandBuffersFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkAllocateCommandBuffers failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkAllocateCommandBuffers failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkAllocateCommandBuffers failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkAllocateCommandBuffers failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkFreeCommandBuffers - Free command buffers
///
///
///
/// To free command buffers, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkFreeCommandBuffers(
/// VkDevice device,
/// VkCommandPool commandPool,
/// uint32_t commandBufferCount,
/// const VkCommandBuffer* pCommandBuffers);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void FreeCommandBuffersInternal(
this VulkanHandleWrapper handle,
VkCommandPool commandPool,
scoped ReadOnlySpan pCommandBuffers
)
{
fixed (VkCommandBuffer* pCommandBuffersFixed = pCommandBuffers)
{
handle.PInvoke.vkFreeCommandBuffers.Invoke(
handle.Handle,
commandPool,
pCommandBuffers.Length,
pCommandBuffersFixed
);
}
}
///
/// vkBeginCommandBuffer - Start recording a command buffer
///
///
///
/// :refpage: vkBeginCommandBuffer
///
///
/// To begin recording a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkBeginCommandBuffer(
/// VkCommandBuffer commandBuffer,
/// const VkCommandBufferBeginInfo* pBeginInfo);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void Begin(this T handle, in VkCommandBufferBeginInfo pBeginInfo)
where T : VulkanHandleWrapper
{
fixed (VkCommandBufferBeginInfo* pBeginInfoFixed = &pBeginInfo)
{
VkResult result = handle.PInvoke.vkBeginCommandBuffer.Invoke(handle.Handle, pBeginInfoFixed);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkBeginCommandBuffer failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkBeginCommandBuffer failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkBeginCommandBuffer failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkBeginCommandBuffer failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkEndCommandBuffer - Finish recording a command buffer
///
///
///
/// :refpage: vkEndCommandBuffer
///
///
/// To complete recording of a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkEndCommandBuffer(
/// VkCommandBuffer commandBuffer);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void End(this T handle)
where T : VulkanHandleWrapper
{
VkResult result = handle.PInvoke.vkEndCommandBuffer.Invoke(handle.Handle);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkEndCommandBuffer failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkEndCommandBuffer failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidVideoStdParametersKHR:
throw new VkResultError(
VkResult.ErrorInvalidVideoStdParametersKHR,
"Vulkan call to vkEndCommandBuffer failed with error: VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkEndCommandBuffer failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkEndCommandBuffer failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkResetCommandBuffer - Reset a command buffer to the initial state
///
///
///
/// To reset a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkResetCommandBuffer(
/// VkCommandBuffer commandBuffer,
/// VkCommandBufferResetFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Reset(this T handle, VkCommandBufferResetFlags flags)
where T : VulkanHandleWrapper
{
VkResult result = handle.PInvoke.vkResetCommandBuffer.Invoke(handle.Handle, flags);
switch (result)
{
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkResetCommandBuffer failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkResetCommandBuffer failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkResetCommandBuffer failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkCmdCopyBuffer - Copy data between buffer regions
///
///
///
/// :refpage: vkCmdCopyBuffer
///
///
/// To copy data between buffer objects, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdCopyBuffer(
/// VkCommandBuffer commandBuffer,
/// VkBuffer srcBuffer,
/// VkBuffer dstBuffer,
/// uint32_t regionCount,
/// const VkBufferCopy* pRegions);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void CopyBuffer(
this T handle,
VkBuffer srcBuffer,
VkBuffer dstBuffer,
scoped ReadOnlySpan pRegions
)
where T : VulkanHandleWrapper
{
fixed (VkBufferCopy* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdCopyBuffer.Invoke(
handle.Handle,
srcBuffer,
dstBuffer,
pRegions.Length,
pRegionsFixed
);
}
}
///
/// vkCmdCopyImage - Copy data between images
///
///
///
/// :refpage: vkCmdCopyImage
///
///
/// To copy data between image objects, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdCopyImage(
/// VkCommandBuffer commandBuffer,
/// VkImage srcImage,
/// VkImageLayout srcImageLayout,
/// VkImage dstImage,
/// VkImageLayout dstImageLayout,
/// uint32_t regionCount,
/// const VkImageCopy* pRegions);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void CopyImage(
this T handle,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
scoped ReadOnlySpan pRegions
)
where T : VulkanHandleWrapper
{
fixed (VkImageCopy* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdCopyImage.Invoke(
handle.Handle,
srcImage,
srcImageLayout,
dstImage,
dstImageLayout,
pRegions.Length,
pRegionsFixed
);
}
}
///
/// vkCmdCopyBufferToImage - Copy data from a buffer into an image
///
///
///
/// :refpage: vkCmdCopyBufferToImage
///
///
/// To copy data from a buffer object to an image object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdCopyBufferToImage(
/// VkCommandBuffer commandBuffer,
/// VkBuffer srcBuffer,
/// VkImage dstImage,
/// VkImageLayout dstImageLayout,
/// uint32_t regionCount,
/// const VkBufferImageCopy* pRegions);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void CopyBufferToImage(
this T handle,
VkBuffer srcBuffer,
VkImage dstImage,
VkImageLayout dstImageLayout,
scoped ReadOnlySpan pRegions
)
where T : VulkanHandleWrapper
{
fixed (VkBufferImageCopy* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdCopyBufferToImage.Invoke(
handle.Handle,
srcBuffer,
dstImage,
dstImageLayout,
pRegions.Length,
pRegionsFixed
);
}
}
///
/// vkCmdCopyImageToBuffer - Copy image data into a buffer
///
///
///
/// :refpage: vkCmdCopyImageToBuffer
///
///
/// To copy data from an image object to a buffer object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdCopyImageToBuffer(
/// VkCommandBuffer commandBuffer,
/// VkImage srcImage,
/// VkImageLayout srcImageLayout,
/// VkBuffer dstBuffer,
/// uint32_t regionCount,
/// const VkBufferImageCopy* pRegions);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void CopyImageToBuffer(
this T handle,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkBuffer dstBuffer,
scoped ReadOnlySpan pRegions
)
where T : VulkanHandleWrapper
{
fixed (VkBufferImageCopy* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdCopyImageToBuffer.Invoke(
handle.Handle,
srcImage,
srcImageLayout,
dstBuffer,
pRegions.Length,
pRegionsFixed
);
}
}
///
/// vkCmdUpdateBuffer - Update a buffer's contents from host memory
///
///
///
/// To update buffer data inline in a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdUpdateBuffer(
/// VkCommandBuffer commandBuffer,
/// VkBuffer dstBuffer,
/// VkDeviceSize dstOffset,
/// VkDeviceSize dataSize,
/// const void* pData);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void UpdateBuffer(
this T handle,
VkBuffer dstBuffer,
ByteSize64 dstOffset,
scoped ReadOnlySpan pData
)
where T : VulkanHandleWrapper
{
fixed (byte* pDataFixed = pData)
{
handle.PInvoke.vkCmdUpdateBuffer.Invoke(
handle.Handle,
dstBuffer,
dstOffset,
(ByteSize64)pData.Length,
pDataFixed
);
}
}
///
/// vkCmdFillBuffer - Fill a region of a buffer with a fixed value
///
///
///
/// To clear buffer data, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdFillBuffer(
/// VkCommandBuffer commandBuffer,
/// VkBuffer dstBuffer,
/// VkDeviceSize dstOffset,
/// VkDeviceSize size,
/// uint32_t data);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void FillBuffer(
this T handle,
VkBuffer dstBuffer,
ByteSize64 dstOffset,
ByteSize64 size,
int data
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdFillBuffer.Invoke(handle.Handle, dstBuffer, dstOffset, size, data);
}
///
/// vkCmdPipelineBarrier - Insert a memory dependency
///
///
///
/// :refpage: vkCmdPipelineBarrier
///
///
/// To record a pipeline barrier, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdPipelineBarrier(
/// VkCommandBuffer commandBuffer,
/// VkPipelineStageFlags srcStageMask,
/// VkPipelineStageFlags dstStageMask,
/// VkDependencyFlags dependencyFlags,
/// uint32_t memoryBarrierCount,
/// const VkMemoryBarrier* pMemoryBarriers,
/// uint32_t bufferMemoryBarrierCount,
/// const VkBufferMemoryBarrier* pBufferMemoryBarriers,
/// uint32_t imageMemoryBarrierCount,
/// const VkImageMemoryBarrier* pImageMemoryBarriers);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void PipelineBarrier(
this T handle,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
VkDependencyFlags dependencyFlags,
scoped ReadOnlySpan pMemoryBarriers,
scoped ReadOnlySpan pBufferMemoryBarriers,
scoped ReadOnlySpan pImageMemoryBarriers
)
where T : VulkanHandleWrapper
{
fixed (VkImageMemoryBarrier* pImageMemoryBarriersFixed = pImageMemoryBarriers)
fixed (VkBufferMemoryBarrier* pBufferMemoryBarriersFixed = pBufferMemoryBarriers)
fixed (VkMemoryBarrier* pMemoryBarriersFixed = pMemoryBarriers)
{
handle.PInvoke.vkCmdPipelineBarrier.Invoke(
handle.Handle,
srcStageMask,
dstStageMask,
dependencyFlags,
pMemoryBarriers.Length,
pMemoryBarriersFixed,
pBufferMemoryBarriers.Length,
pBufferMemoryBarriersFixed,
pImageMemoryBarriers.Length,
pImageMemoryBarriersFixed
);
}
}
///
/// vkCmdBeginQuery - Begin a query
///
///
///
/// :refpage: vkCmdBeginQuery
///
///
/// To begin a query, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBeginQuery(
/// VkCommandBuffer commandBuffer,
/// VkQueryPool queryPool,
/// uint32_t query,
/// VkQueryControlFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BeginQuery(this T handle, VkQueryPool queryPool, int query, VkQueryControlFlags flags)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdBeginQuery.Invoke(handle.Handle, queryPool, query, flags);
}
///
/// vkCmdEndQuery - Ends a query
///
///
///
/// :refpage: vkCmdEndQuery
///
///
/// To end a query after the set of desired commands is recorded, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdEndQuery(
/// VkCommandBuffer commandBuffer,
/// VkQueryPool queryPool,
/// uint32_t query);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void EndQuery(this T handle, VkQueryPool queryPool, int query)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdEndQuery.Invoke(handle.Handle, queryPool, query);
}
///
/// vkCmdResetQueryPool - Reset queries in a query pool
///
///
///
/// :refpage: vkCmdResetQueryPool
///
///
/// To reset a range of queries in a query pool on a queue, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdResetQueryPool(
/// VkCommandBuffer commandBuffer,
/// VkQueryPool queryPool,
/// uint32_t firstQuery,
/// uint32_t queryCount);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetQueryPool(this T handle, VkQueryPool queryPool, int firstQuery, int queryCount)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdResetQueryPool.Invoke(handle.Handle, queryPool, firstQuery, queryCount);
}
///
/// vkCmdWriteTimestamp - Write a device timestamp into a query object
///
///
///
/// :refpage: vkCmdWriteTimestamp
///
///
/// To request a timestamp and write the value to memory, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdWriteTimestamp(
/// VkCommandBuffer commandBuffer,
/// VkPipelineStageFlagBits pipelineStage,
/// VkQueryPool queryPool,
/// uint32_t query);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WriteTimestamp(
this T handle,
VkPipelineStageFlags pipelineStage,
VkQueryPool queryPool,
int query
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdWriteTimestamp.Invoke(handle.Handle, pipelineStage, queryPool, query);
}
///
/// vkCmdCopyQueryPoolResults - Copy the results of queries in a query pool to a buffer object
///
///
///
/// :refpage: vkCmdCopyQueryPoolResults
///
///
/// To copy query statuses and numerical results directly to buffer memory,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdCopyQueryPoolResults(
/// VkCommandBuffer commandBuffer,
/// VkQueryPool queryPool,
/// uint32_t firstQuery,
/// uint32_t queryCount,
/// VkBuffer dstBuffer,
/// VkDeviceSize dstOffset,
/// VkDeviceSize stride,
/// VkQueryResultFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void CopyQueryPoolResults(
this T handle,
VkQueryPool queryPool,
int firstQuery,
int queryCount,
VkBuffer dstBuffer,
ByteSize64 dstOffset,
ByteSize64 stride,
VkQueryResultFlags flags
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdCopyQueryPoolResults.Invoke(
handle.Handle,
queryPool,
firstQuery,
queryCount,
dstBuffer,
dstOffset,
stride,
flags
);
}
///
/// vkCmdExecuteCommands - Execute a secondary command buffer from a primary command buffer
///
///
///
/// Secondary command buffers must not be directly submitted to a queue.
/// To record a secondary command buffer to execute as part of a primary command
/// buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdExecuteCommands(
/// VkCommandBuffer commandBuffer,
/// uint32_t commandBufferCount,
/// const VkCommandBuffer* pCommandBuffers);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void CmdExecuteCommandsInternal(
this T handle,
scoped ReadOnlySpan pCommandBuffers
)
where T : VulkanHandleWrapper
{
fixed (VkCommandBuffer* pCommandBuffersFixed = pCommandBuffers)
{
handle.PInvoke.vkCmdExecuteCommands.Invoke(handle.Handle, pCommandBuffers.Length, pCommandBuffersFixed);
}
}
///
/// vkCreateEvent - Create a new event object
///
///
///
/// :refpage: vkCreateEvent
/// :objectnameplural: events
/// :objectnamecamelcase: event
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create an event, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateEvent(
/// VkDevice device,
/// const VkEventCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkEvent* pEvent);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkEvent CreateEvent(
this VulkanHandleWrapper handle,
in VkEventCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkEventCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkEvent pEventLocal = default;
VkResult result = handle.PInvoke.vkCreateEvent.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pEventLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateEvent failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateEvent failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateEvent failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateEvent failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pEventLocal;
}
}
///
/// vkDestroyEvent - Destroy an event object
///
///
///
/// To destroy an event, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyEvent(
/// VkDevice device,
/// VkEvent event,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyEvent(
this VulkanHandleWrapper handle,
VkEvent @event,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyEvent.Invoke(handle.Handle, @event, pAllocator);
}
///
/// vkGetEventStatus - Retrieve the status of an event object
///
///
///
/// :refpage: vkGetEventStatus
///
///
/// To query the state of an event from the host, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkGetEventStatus(
/// VkDevice device,
/// VkEvent event);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static VkResult GetEventStatus(
this VulkanHandleWrapper handle,
VkEvent @event
)
{
VkResult result = handle.PInvoke.vkGetEventStatus.Invoke(handle.Handle, @event);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetEventStatus failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkGetEventStatus failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorDeviceLost:
throw new VkResultError(
VkResult.ErrorDeviceLost,
"Vulkan call to vkGetEventStatus failed with error: VK_ERROR_DEVICE_LOST"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetEventStatus failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetEventStatus failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.EventSet:
case VkResult.EventReset:
default:
break;
}
return result;
}
///
/// vkSetEvent - Set an event to signaled state
///
///
///
/// :refpage: vkSetEvent
///
///
/// To set the state of an event to signaled from the host, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkSetEvent(
/// VkDevice device,
/// VkEvent event);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetEvent(this VulkanHandleWrapper handle, VkEvent @event)
{
VkResult result = handle.PInvoke.vkSetEvent.Invoke(handle.Handle, @event);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkSetEvent failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkSetEvent failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkSetEvent failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkSetEvent failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkResetEvent - Reset an event to non-signaled state
///
///
///
/// To set the state of an event to unsignaled from the host, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkResetEvent(
/// VkDevice device,
/// VkEvent event);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetEvent(this VulkanHandleWrapper handle, VkEvent @event)
{
VkResult result = handle.PInvoke.vkResetEvent.Invoke(handle.Handle, @event);
switch (result)
{
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkResetEvent failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkResetEvent failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkResetEvent failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkCreateBufferView - Create a new buffer view object
///
///
///
/// :refpage: vkCreateBufferView
/// :objectnameplural: buffer views
/// :objectnamecamelcase: bufferView
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a buffer view, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateBufferView(
/// VkDevice device,
/// const VkBufferViewCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkBufferView* pView);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkBufferView CreateBufferView(
this VulkanHandleWrapper handle,
in VkBufferViewCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkBufferViewCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkBufferView pViewLocal = default;
VkResult result = handle.PInvoke.vkCreateBufferView.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pViewLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateBufferView failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateBufferView failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateBufferView failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateBufferView failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pViewLocal;
}
}
///
/// vkDestroyBufferView - Destroy a buffer view object
///
///
///
/// To destroy a buffer view, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyBufferView(
/// VkDevice device,
/// VkBufferView bufferView,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyBufferView(
this VulkanHandleWrapper handle,
VkBufferView bufferView,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyBufferView.Invoke(handle.Handle, bufferView, pAllocator);
}
///
/// vkCreateShaderModule - Creates a new shader module object
///
///
///
/// To create a shader module, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateShaderModule(
/// VkDevice device,
/// const VkShaderModuleCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkShaderModule* pShaderModule);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkShaderModule CreateShaderModule(
this VulkanHandleWrapper handle,
in VkShaderModuleCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkShaderModuleCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkShaderModule pShaderModuleLocal = default;
VkResult result = handle.PInvoke.vkCreateShaderModule.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pShaderModuleLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateShaderModule failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateShaderModule failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidShaderNV:
throw new VkResultError(
VkResult.ErrorInvalidShaderNV,
"Vulkan call to vkCreateShaderModule failed with error: VK_ERROR_INVALID_SHADER_NV"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateShaderModule failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateShaderModule failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pShaderModuleLocal;
}
}
///
/// vkDestroyShaderModule - Destroy a shader module
///
///
///
/// To destroy a shader module, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyShaderModule(
/// VkDevice device,
/// VkShaderModule shaderModule,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyShaderModule(
this VulkanHandleWrapper handle,
VkShaderModule shaderModule,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyShaderModule.Invoke(handle.Handle, shaderModule, pAllocator);
}
///
/// vkCreatePipelineCache - Creates a new pipeline cache
///
///
///
/// :refpage: vkCreatePipelineCache
/// :objectnameplural: pipeline caches
/// :objectnamecamelcase: pipelineCache
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create pipeline cache objects, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreatePipelineCache(
/// VkDevice device,
/// const VkPipelineCacheCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkPipelineCache* pPipelineCache);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkPipelineCache CreatePipelineCache(
this VulkanHandleWrapper handle,
in VkPipelineCacheCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkPipelineCacheCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkPipelineCache pPipelineCacheLocal = default;
VkResult result = handle.PInvoke.vkCreatePipelineCache.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pPipelineCacheLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreatePipelineCache failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreatePipelineCache failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreatePipelineCache failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreatePipelineCache failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pPipelineCacheLocal;
}
}
///
/// vkDestroyPipelineCache - Destroy a pipeline cache object
///
///
///
/// To destroy a pipeline cache, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyPipelineCache(
/// VkDevice device,
/// VkPipelineCache pipelineCache,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyPipelineCache(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyPipelineCache.Invoke(handle.Handle, pipelineCache, pAllocator);
}
///
/// vkGetPipelineCacheData - Get the data store from a pipeline cache
///
///
///
/// Data can be retrieved from a pipeline cache object using the command:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkGetPipelineCacheData(
/// VkDevice device,
/// VkPipelineCache pipelineCache,
/// size_t* pDataSize,
/// void* pData);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe VkResult GetPipelineCacheData(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache,
ref nuint pDataSize,
scoped ReadOnlySpan pData
)
{
fixed (byte* pDataFixed = pData)
fixed (nuint* pDataSizeFixed = &pDataSize)
{
VkResult result = handle.PInvoke.vkGetPipelineCacheData.Invoke(
handle.Handle,
pipelineCache,
pDataSizeFixed,
pDataFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetPipelineCacheData failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkGetPipelineCacheData failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetPipelineCacheData failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetPipelineCacheData failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.Incomplete:
default:
break;
}
return result;
}
}
/// Queries the required length.
/// The required length.
public static nuint GetPipelineCacheData_Count(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache
)
{
nuint pDataSize = default;
GetPipelineCacheData(handle, pipelineCache, ref pDataSize, null);
return pDataSize;
}
/// Writes to a provided span.
/// The span to write to.
/// Return value of the underlying function.
public static VkResult GetPipelineCacheData_Write(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache,
scoped ReadOnlySpan pData
)
{
nuint pDataSize = (nuint)pData.Length;
return GetPipelineCacheData(handle, pipelineCache, ref pDataSize, pData);
}
///
/// vkMergePipelineCaches - Combine the data stores of pipeline caches
///
///
///
/// Pipeline cache objects can be merged using the command:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkMergePipelineCaches(
/// VkDevice device,
/// VkPipelineCache dstCache,
/// uint32_t srcCacheCount,
/// const VkPipelineCache* pSrcCaches);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void MergePipelineCaches(
this VulkanHandleWrapper handle,
VkPipelineCache dstCache,
scoped ReadOnlySpan pSrcCaches
)
{
fixed (VkPipelineCache* pSrcCachesFixed = pSrcCaches)
{
VkResult result = handle.PInvoke.vkMergePipelineCaches.Invoke(
handle.Handle,
dstCache,
pSrcCaches.Length,
pSrcCachesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkMergePipelineCaches failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkMergePipelineCaches failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkMergePipelineCaches failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkMergePipelineCaches failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkCreateComputePipelines - Creates a new compute pipeline object
///
///
///
/// :refpage: vkCreateComputePipelines
/// :objectnameplural: compute pipelines
/// :objectnamecamelcase: computePipeline
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: createInfoCount
///
///
/// To create compute pipelines, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateComputePipelines(
/// VkDevice device,
/// VkPipelineCache pipelineCache,
/// uint32_t createInfoCount,
/// const VkComputePipelineCreateInfo* pCreateInfos,
/// const VkAllocationCallbacks* pAllocator,
/// VkPipeline* pPipelines);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkResult CreateComputePipelines(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache,
scoped ReadOnlySpan pCreateInfos,
VkAllocator? pAllocator,
scoped ReadOnlySpan pPipelines
)
{
fixed (VkPipeline* pPipelinesFixed = pPipelines)
fixed (VkComputePipelineCreateInfo* pCreateInfosFixed = pCreateInfos)
{
VkResult result = handle.PInvoke.vkCreateComputePipelines.Invoke(
handle.Handle,
pipelineCache,
pCreateInfos.Length,
pCreateInfosFixed,
pAllocator,
pPipelinesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateComputePipelines failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateComputePipelines failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidShaderNV:
throw new VkResultError(
VkResult.ErrorInvalidShaderNV,
"Vulkan call to vkCreateComputePipelines failed with error: VK_ERROR_INVALID_SHADER_NV"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateComputePipelines failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateComputePipelines failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.PipelineCompileRequiredEXT:
default:
break;
}
return result;
}
}
///
/// vkDestroyPipeline - Destroy a pipeline object
///
///
///
/// To destroy a pipeline, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyPipeline(
/// VkDevice device,
/// VkPipeline pipeline,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyPipeline(
this VulkanHandleWrapper handle,
VkPipeline pipeline,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyPipeline.Invoke(handle.Handle, pipeline, pAllocator);
}
///
/// vkCreatePipelineLayout - Creates a new pipeline layout object
///
///
///
/// :refpage: vkCreatePipelineLayout
/// :objectnameplural: pipeline layouts
/// :objectnamecamelcase: pipelineLayout
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a pipeline layout, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreatePipelineLayout(
/// VkDevice device,
/// const VkPipelineLayoutCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkPipelineLayout* pPipelineLayout);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkPipelineLayout CreatePipelineLayout(
this VulkanHandleWrapper handle,
in VkPipelineLayoutCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkPipelineLayoutCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkPipelineLayout pPipelineLayoutLocal = default;
VkResult result = handle.PInvoke.vkCreatePipelineLayout.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pPipelineLayoutLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreatePipelineLayout failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreatePipelineLayout failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreatePipelineLayout failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreatePipelineLayout failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pPipelineLayoutLocal;
}
}
///
/// vkDestroyPipelineLayout - Destroy a pipeline layout object
///
///
///
/// To destroy a pipeline layout, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyPipelineLayout(
/// VkDevice device,
/// VkPipelineLayout pipelineLayout,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyPipelineLayout(
this VulkanHandleWrapper handle,
VkPipelineLayout pipelineLayout,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyPipelineLayout.Invoke(handle.Handle, pipelineLayout, pAllocator);
}
///
/// vkCreateSampler - Create a new sampler object
///
///
///
/// :refpage: vkCreateSampler
/// :objectnameplural: samplers
/// :objectnamecamelcase: sampler
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a sampler object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateSampler(
/// VkDevice device,
/// const VkSamplerCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSampler* pSampler);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkSampler CreateSampler(
this VulkanHandleWrapper handle,
in VkSamplerCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkSamplerCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkSampler pSamplerLocal = default;
VkResult result = handle.PInvoke.vkCreateSampler.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSamplerLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateSampler failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateSampler failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkCreateSampler failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateSampler failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateSampler failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pSamplerLocal;
}
}
///
/// vkDestroySampler - Destroy a sampler object
///
///
///
/// To destroy a sampler, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroySampler(
/// VkDevice device,
/// VkSampler sampler,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroySampler(
this VulkanHandleWrapper handle,
VkSampler sampler,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroySampler.Invoke(handle.Handle, sampler, pAllocator);
}
///
/// vkCreateDescriptorSetLayout - Create a new descriptor set layout
///
///
///
/// :refpage: vkCreateDescriptorSetLayout
/// :objectnameplural: descriptor set layouts
/// :objectnamecamelcase: descriptorSetLayout
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create descriptor set layout objects, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateDescriptorSetLayout(
/// VkDevice device,
/// const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkDescriptorSetLayout* pSetLayout);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkDescriptorSetLayout CreateDescriptorSetLayout(
this VulkanHandleWrapper handle,
in VkDescriptorSetLayoutCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkDescriptorSetLayoutCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkDescriptorSetLayout pSetLayoutLocal = default;
VkResult result = handle.PInvoke.vkCreateDescriptorSetLayout.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSetLayoutLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateDescriptorSetLayout failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateDescriptorSetLayout failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateDescriptorSetLayout failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateDescriptorSetLayout failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pSetLayoutLocal;
}
}
///
/// vkDestroyDescriptorSetLayout - Destroy a descriptor set layout object
///
///
///
/// To destroy a descriptor set layout, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyDescriptorSetLayout(
/// VkDevice device,
/// VkDescriptorSetLayout descriptorSetLayout,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyDescriptorSetLayout(
this VulkanHandleWrapper handle,
VkDescriptorSetLayout descriptorSetLayout,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyDescriptorSetLayout.Invoke(handle.Handle, descriptorSetLayout, pAllocator);
}
///
/// vkCreateDescriptorPool - Creates a descriptor pool object
///
///
///
/// :refpage: vkCreateDescriptorPool
/// :objectnameplural: descriptor pools
/// :objectnamecamelcase: descriptorPool
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a descriptor pool object, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateDescriptorPool(
/// VkDevice device,
/// const VkDescriptorPoolCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkDescriptorPool* pDescriptorPool);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkDescriptorPool CreateDescriptorPool(
this VulkanHandleWrapper handle,
in VkDescriptorPoolCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkDescriptorPoolCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkDescriptorPool pDescriptorPoolLocal = default;
VkResult result = handle.PInvoke.vkCreateDescriptorPool.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pDescriptorPoolLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateDescriptorPool failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateDescriptorPool failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorFragmentationEXT:
throw new VkResultError(
VkResult.ErrorFragmentationEXT,
"Vulkan call to vkCreateDescriptorPool failed with error: VK_ERROR_FRAGMENTATION_EXT"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateDescriptorPool failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateDescriptorPool failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pDescriptorPoolLocal;
}
}
///
/// vkDestroyDescriptorPool - Destroy a descriptor pool object
///
///
///
/// To destroy a descriptor pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyDescriptorPool(
/// VkDevice device,
/// VkDescriptorPool descriptorPool,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyDescriptorPool(
this VulkanHandleWrapper handle,
VkDescriptorPool descriptorPool,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyDescriptorPool.Invoke(handle.Handle, descriptorPool, pAllocator);
}
///
/// vkResetDescriptorPool - Resets a descriptor pool object
///
///
///
/// To return all descriptor sets allocated from a given pool to the pool,
/// rather than freeing individual descriptor sets, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkResetDescriptorPool(
/// VkDevice device,
/// VkDescriptorPool descriptorPool,
/// VkDescriptorPoolResetFlags flags);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetDescriptorPool(
this VulkanHandleWrapper handle,
VkDescriptorPool descriptorPool,
VkDescriptorPoolResetFlags flags
)
{
VkResult result = handle.PInvoke.vkResetDescriptorPool.Invoke(handle.Handle, descriptorPool, flags);
switch (result)
{
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkResetDescriptorPool failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkResetDescriptorPool failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
///
/// vkAllocateDescriptorSets - Allocate one or more descriptor sets
///
///
///
/// :refpage: vkAllocateDescriptorSets
/// :objectnameplural: descriptor sets
/// :objectnamecamelcase: descriptorSet
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: VkDescriptorSetAllocateInfo::descriptorSetCount
///
///
/// To allocate descriptor sets from a descriptor pool, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkAllocateDescriptorSets(
/// VkDevice device,
/// const VkDescriptorSetAllocateInfo* pAllocateInfo,
/// VkDescriptorSet* pDescriptorSets);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void AllocateDescriptorSets(
this VulkanHandleWrapper handle,
in VkDescriptorSetAllocateInfo pAllocateInfo,
scoped ReadOnlySpan pDescriptorSets
)
{
fixed (VkDescriptorSet* pDescriptorSetsFixed = pDescriptorSets)
fixed (VkDescriptorSetAllocateInfo* pAllocateInfoFixed = &pAllocateInfo)
{
VkResult result = handle.PInvoke.vkAllocateDescriptorSets.Invoke(
handle.Handle,
pAllocateInfoFixed,
pDescriptorSetsFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorFragmentedPool:
throw new VkResultError(
VkResult.ErrorFragmentedPool,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_FRAGMENTED_POOL"
);
case VkResult.ErrorOutOfPoolMemory:
throw new VkResultError(
VkResult.ErrorOutOfPoolMemory,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_OUT_OF_POOL_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkAllocateDescriptorSets failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkFreeDescriptorSets - Free one or more descriptor sets
///
///
///
/// To free allocated descriptor sets, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkFreeDescriptorSets(
/// VkDevice device,
/// VkDescriptorPool descriptorPool,
/// uint32_t descriptorSetCount,
/// const VkDescriptorSet* pDescriptorSets);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe void FreeDescriptorSetsInternal(
this VulkanHandleWrapper handle,
VkDescriptorPool descriptorPool,
scoped ReadOnlySpan pDescriptorSets
)
{
fixed (VkDescriptorSet* pDescriptorSetsFixed = pDescriptorSets)
{
VkResult result = handle.PInvoke.vkFreeDescriptorSets.Invoke(
handle.Handle,
descriptorPool,
pDescriptorSets.Length,
pDescriptorSetsFixed
);
switch (result)
{
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkFreeDescriptorSets failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkFreeDescriptorSets failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkUpdateDescriptorSets - Update the contents of a descriptor set object
///
///
///
/// Once allocated, descriptor sets can be updated with a combination of write
/// and copy operations.
/// To update descriptor sets, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkUpdateDescriptorSets(
/// VkDevice device,
/// uint32_t descriptorWriteCount,
/// const VkWriteDescriptorSet* pDescriptorWrites,
/// uint32_t descriptorCopyCount,
/// const VkCopyDescriptorSet* pDescriptorCopies);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void UpdateDescriptorSets(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pDescriptorWrites,
scoped ReadOnlySpan pDescriptorCopies
)
{
fixed (VkCopyDescriptorSet* pDescriptorCopiesFixed = pDescriptorCopies)
fixed (VkWriteDescriptorSet* pDescriptorWritesFixed = pDescriptorWrites)
{
handle.PInvoke.vkUpdateDescriptorSets.Invoke(
handle.Handle,
pDescriptorWrites.Length,
pDescriptorWritesFixed,
pDescriptorCopies.Length,
pDescriptorCopiesFixed
);
}
}
///
/// vkCmdBindPipeline - Bind a pipeline object to a command buffer
///
///
///
/// Once a pipeline has been created, it can be bound to the command buffer
/// using the command:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBindPipeline(
/// VkCommandBuffer commandBuffer,
/// VkPipelineBindPoint pipelineBindPoint,
/// VkPipeline pipeline);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindPipeline(this T handle, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdBindPipeline.Invoke(handle.Handle, pipelineBindPoint, pipeline);
}
///
/// vkCmdBindDescriptorSets - Binds descriptor sets to a command buffer
///
///
///
/// :refpage: vkCmdBindDescriptorSets
///
///
/// To bind one or more descriptor sets to a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBindDescriptorSets(
/// VkCommandBuffer commandBuffer,
/// VkPipelineBindPoint pipelineBindPoint,
/// VkPipelineLayout layout,
/// uint32_t firstSet,
/// uint32_t descriptorSetCount,
/// const VkDescriptorSet* pDescriptorSets,
/// uint32_t dynamicOffsetCount,
/// const uint32_t* pDynamicOffsets);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BindDescriptorSets(
this T handle,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
int firstSet,
scoped ReadOnlySpan pDescriptorSets,
scoped Span pDynamicOffsets
)
where T : VulkanHandleWrapper
{
fixed (ByteSize32* pDynamicOffsetsFixed = pDynamicOffsets)
fixed (VkDescriptorSet* pDescriptorSetsFixed = pDescriptorSets)
{
handle.PInvoke.vkCmdBindDescriptorSets.Invoke(
handle.Handle,
pipelineBindPoint,
layout,
firstSet,
pDescriptorSets.Length,
pDescriptorSetsFixed,
pDynamicOffsets.Length,
(int*)pDynamicOffsetsFixed
);
}
}
///
/// vkCmdClearColorImage - Clear regions of a color image
///
///
///
/// To clear one or more subranges of a color image, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdClearColorImage(
/// VkCommandBuffer commandBuffer,
/// VkImage image,
/// VkImageLayout imageLayout,
/// const VkClearColorValue* pColor,
/// uint32_t rangeCount,
/// const VkImageSubresourceRange* pRanges);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ClearColorImage(
this T handle,
VkImage image,
VkImageLayout imageLayout,
VkClearColorValue* pColor,
scoped ReadOnlySpan pRanges
)
where T : VulkanHandleWrapper
{
fixed (VkImageSubresourceRange* pRangesFixed = pRanges)
{
handle.PInvoke.vkCmdClearColorImage.Invoke(
handle.Handle,
image,
imageLayout,
pColor,
pRanges.Length,
pRangesFixed
);
}
}
///
/// vkCmdDispatch - Dispatch compute work items
///
///
///
/// :refpage: vkCmdDispatch
///
///
/// To record a dispatch, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDispatch(
/// VkCommandBuffer commandBuffer,
/// uint32_t groupCountX,
/// uint32_t groupCountY,
/// uint32_t groupCountZ);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Dispatch(this T handle, int groupCountX, int groupCountY, int groupCountZ)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDispatch.Invoke(handle.Handle, groupCountX, groupCountY, groupCountZ);
}
///
/// vkCmdDispatchIndirect - Dispatch compute work items with indirect parameters
///
///
///
/// :refpage: vkCmdDispatchIndirect
///
///
/// To record an indirect dispatching command, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDispatchIndirect(
/// VkCommandBuffer commandBuffer,
/// VkBuffer buffer,
/// VkDeviceSize offset);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DispatchIndirect(this T handle, VkBuffer buffer, ByteSize64 offset)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDispatchIndirect.Invoke(handle.Handle, buffer, offset);
}
///
/// vkCmdSetEvent - Set an event object to signaled state
///
///
///
/// :refpage: vkCmdSetEvent
///
///
/// To set the state of an event to signaled from a device, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetEvent(
/// VkCommandBuffer commandBuffer,
/// VkEvent event,
/// VkPipelineStageFlags stageMask);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetEvent(this T handle, VkEvent @event, VkPipelineStageFlags stageMask)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetEvent.Invoke(handle.Handle, @event, stageMask);
}
///
/// vkCmdResetEvent - Reset an event object to non-signaled state
///
///
///
/// :refpage: vkCmdResetEvent
///
///
/// To set the state of an event to unsignaled from a device, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdResetEvent(
/// VkCommandBuffer commandBuffer,
/// VkEvent event,
/// VkPipelineStageFlags stageMask);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetEvent(this T handle, VkEvent @event, VkPipelineStageFlags stageMask)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdResetEvent.Invoke(handle.Handle, @event, stageMask);
}
///
/// vkCmdWaitEvents - Wait for one or more events and insert a set of memory
///
///
///
/// :refpage: vkCmdWaitEvents
///
///
/// To wait for one or more events to enter the signaled state on a device,
/// call:
///
///
/// [[synchronization-events-waiting-device]]
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdWaitEvents(
/// VkCommandBuffer commandBuffer,
/// uint32_t eventCount,
/// const VkEvent* pEvents,
/// VkPipelineStageFlags srcStageMask,
/// VkPipelineStageFlags dstStageMask,
/// uint32_t memoryBarrierCount,
/// const VkMemoryBarrier* pMemoryBarriers,
/// uint32_t bufferMemoryBarrierCount,
/// const VkBufferMemoryBarrier* pBufferMemoryBarriers,
/// uint32_t imageMemoryBarrierCount,
/// const VkImageMemoryBarrier* pImageMemoryBarriers);
///
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WaitEvents(
this T handle,
scoped ReadOnlySpan pEvents,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
scoped ReadOnlySpan pMemoryBarriers,
scoped ReadOnlySpan pBufferMemoryBarriers,
scoped ReadOnlySpan pImageMemoryBarriers
)
where T : VulkanHandleWrapper
{
fixed (VkImageMemoryBarrier* pImageMemoryBarriersFixed = pImageMemoryBarriers)
fixed (VkBufferMemoryBarrier* pBufferMemoryBarriersFixed = pBufferMemoryBarriers)
fixed (VkMemoryBarrier* pMemoryBarriersFixed = pMemoryBarriers)
fixed (VkEvent* pEventsFixed = pEvents)
{
handle.PInvoke.vkCmdWaitEvents.Invoke(
handle.Handle,
pEvents.Length,
pEventsFixed,
srcStageMask,
dstStageMask,
pMemoryBarriers.Length,
pMemoryBarriersFixed,
pBufferMemoryBarriers.Length,
pBufferMemoryBarriersFixed,
pImageMemoryBarriers.Length,
pImageMemoryBarriersFixed
);
}
}
///
/// vkCmdPushConstants - Update the values of push constants
///
///
///
/// :refpage: vkCmdPushConstants
///
///
/// To update push constants, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdPushConstants(
/// VkCommandBuffer commandBuffer,
/// VkPipelineLayout layout,
/// VkShaderStageFlags stageFlags,
/// uint32_t offset,
/// uint32_t size,
/// const void* pValues);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void PushConstants(
this T handle,
VkPipelineLayout layout,
VkShaderStageFlags stageFlags,
int offset,
scoped ReadOnlySpan pValues
)
where T : VulkanHandleWrapper
{
fixed (byte* pValuesFixed = pValues)
{
handle.PInvoke.vkCmdPushConstants.Invoke(
handle.Handle,
layout,
stageFlags,
offset,
pValues.Length,
pValuesFixed
);
}
}
///
/// vkCreateGraphicsPipelines - Create graphics pipelines
///
///
///
/// :refpage: vkCreateGraphicsPipelines
/// :objectnameplural: graphics pipelines
/// :objectnamecamelcase: graphicsPipeline
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: createInfoCount
///
///
/// To create graphics pipelines, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateGraphicsPipelines(
/// VkDevice device,
/// VkPipelineCache pipelineCache,
/// uint32_t createInfoCount,
/// const VkGraphicsPipelineCreateInfo* pCreateInfos,
/// const VkAllocationCallbacks* pAllocator,
/// VkPipeline* pPipelines);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkResult CreateGraphicsPipelines(
this VulkanHandleWrapper handle,
VkPipelineCache pipelineCache,
scoped ReadOnlySpan pCreateInfos,
VkAllocator? pAllocator,
scoped ReadOnlySpan pPipelines
)
{
fixed (VkPipeline* pPipelinesFixed = pPipelines)
fixed (VkGraphicsPipelineCreateInfo* pCreateInfosFixed = pCreateInfos)
{
VkResult result = handle.PInvoke.vkCreateGraphicsPipelines.Invoke(
handle.Handle,
pipelineCache,
pCreateInfos.Length,
pCreateInfosFixed,
pAllocator,
pPipelinesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateGraphicsPipelines failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateGraphicsPipelines failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidShaderNV:
throw new VkResultError(
VkResult.ErrorInvalidShaderNV,
"Vulkan call to vkCreateGraphicsPipelines failed with error: VK_ERROR_INVALID_SHADER_NV"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateGraphicsPipelines failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateGraphicsPipelines failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
case VkResult.PipelineCompileRequiredEXT:
default:
break;
}
return result;
}
}
///
/// vkCreateFramebuffer - Create a new framebuffer object
///
///
///
/// :refpage: vkCreateFramebuffer
/// :objectnameplural: framebuffers
/// :objectnamecamelcase: framebuffer
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a framebuffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateFramebuffer(
/// VkDevice device,
/// const VkFramebufferCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkFramebuffer* pFramebuffer);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkFramebuffer CreateFramebuffer(
this VulkanHandleWrapper handle,
in VkFramebufferCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkFramebufferCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkFramebuffer pFramebufferLocal = default;
VkResult result = handle.PInvoke.vkCreateFramebuffer.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pFramebufferLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateFramebuffer failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateFramebuffer failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateFramebuffer failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateFramebuffer failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pFramebufferLocal;
}
}
///
/// vkDestroyFramebuffer - Destroy a framebuffer object
///
///
///
/// To destroy a framebuffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyFramebuffer(
/// VkDevice device,
/// VkFramebuffer framebuffer,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyFramebuffer(
this VulkanHandleWrapper handle,
VkFramebuffer framebuffer,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyFramebuffer.Invoke(handle.Handle, framebuffer, pAllocator);
}
///
/// vkCreateRenderPass - Create a new render pass object
///
///
///
/// :refpage: vkCreateRenderPass
/// :objectnameplural: render passes
/// :objectnamecamelcase: renderPass
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a render pass, call:
///
///
/// // Provided by VK_VERSION_1_0
/// VkResult vkCreateRenderPass(
/// VkDevice device,
/// const VkRenderPassCreateInfo* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkRenderPass* pRenderPass);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkRenderPass CreateRenderPass(
this VulkanHandleWrapper handle,
in VkRenderPassCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkRenderPassCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkRenderPass pRenderPassLocal = default;
VkResult result = handle.PInvoke.vkCreateRenderPass.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pRenderPassLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateRenderPass failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateRenderPass failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateRenderPass failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateRenderPass failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pRenderPassLocal;
}
}
///
/// vkDestroyRenderPass - Destroy a render pass object
///
///
///
/// To destroy a render pass, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkDestroyRenderPass(
/// VkDevice device,
/// VkRenderPass renderPass,
/// const VkAllocationCallbacks* pAllocator);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyRenderPass(
this VulkanHandleWrapper handle,
VkRenderPass renderPass,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyRenderPass.Invoke(handle.Handle, renderPass, pAllocator);
}
///
/// vkGetRenderAreaGranularity - Returns the granularity for optimal render area
///
///
///
/// To query the render area granularity, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkGetRenderAreaGranularity(
/// VkDevice device,
/// VkRenderPass renderPass,
/// VkExtent2D* pGranularity);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetRenderAreaGranularity(
this VulkanHandleWrapper handle,
VkRenderPass renderPass,
ref VkExtent2D pGranularity
)
{
fixed (VkExtent2D* pGranularityFixed = &pGranularity)
{
handle.PInvoke.vkGetRenderAreaGranularity.Invoke(handle.Handle, renderPass, pGranularityFixed);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkExtent2D.
public static VkExtent2D GetRenderAreaGranularity(
this VulkanHandleWrapper handle,
VkRenderPass renderPass
)
{
VkExtent2D outValue = new();
GetRenderAreaGranularity(handle, renderPass, ref outValue);
return outValue;
}
///
/// vkCmdSetViewport - Set the viewport dynamically for a command buffer
///
///
///
/// To dynamically set^ the viewport transformation
/// parameters, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetViewport(
/// VkCommandBuffer commandBuffer,
/// uint32_t firstViewport,
/// uint32_t viewportCount,
/// const VkViewport* pViewports);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void SetViewport(
this T handle,
int firstViewport,
scoped ReadOnlySpan pViewports
)
where T : VulkanHandleWrapper
{
fixed (VkViewport* pViewportsFixed = pViewports)
{
handle.PInvoke.vkCmdSetViewport.Invoke(
handle.Handle,
firstViewport,
pViewports.Length,
pViewportsFixed
);
}
}
///
/// vkCmdSetScissor - Set scissor rectangles dynamically for a command buffer
///
///
///
/// To dynamically set^ the scissor rectangles,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetScissor(
/// VkCommandBuffer commandBuffer,
/// uint32_t firstScissor,
/// uint32_t scissorCount,
/// const VkRect2D* pScissors);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void SetScissor(
this T handle,
int firstScissor,
scoped ReadOnlySpan pScissors
)
where T : VulkanHandleWrapper
{
fixed (VkRect2D* pScissorsFixed = pScissors)
{
handle.PInvoke.vkCmdSetScissor.Invoke(handle.Handle, firstScissor, pScissors.Length, pScissorsFixed);
}
}
///
/// vkCmdSetLineWidth - Set line width dynamically for a command buffer
///
///
///
/// To dynamically set^ the line width, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetLineWidth(
/// VkCommandBuffer commandBuffer,
/// float lineWidth);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetLineWidth(this T handle, float lineWidth)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetLineWidth.Invoke(handle.Handle, lineWidth);
}
///
/// vkCmdSetDepthBias - Set depth bias factors and clamp dynamically for a command buffer
///
///
///
/// To dynamically set^ the depth bias parameters,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetDepthBias(
/// VkCommandBuffer commandBuffer,
/// float depthBiasConstantFactor,
/// float depthBiasClamp,
/// float depthBiasSlopeFactor);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetDepthBias(
this T handle,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetDepthBias.Invoke(
handle.Handle,
depthBiasConstantFactor,
depthBiasClamp,
depthBiasSlopeFactor
);
}
///
/// vkCmdSetBlendConstants - Set the values of blend constants
///
///
///
/// To dynamically set and change^ the blend
/// constants, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetBlendConstants(
/// VkCommandBuffer commandBuffer,
/// const float blendConstants[4]);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void SetBlendConstants(this T handle, float* blendConstants)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetBlendConstants.Invoke(handle.Handle, blendConstants);
}
///
/// vkCmdSetDepthBounds - Set depth bounds range dynamically for a command buffer
///
///
///
/// To dynamically set^ the depth bounds range,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetDepthBounds(
/// VkCommandBuffer commandBuffer,
/// float minDepthBounds,
/// float maxDepthBounds);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetDepthBounds(this T handle, float minDepthBounds, float maxDepthBounds)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetDepthBounds.Invoke(handle.Handle, minDepthBounds, maxDepthBounds);
}
///
/// vkCmdSetStencilCompareMask - Set stencil compare mask dynamically for a command buffer
///
///
///
/// To dynamically set^ the stencil compare mask,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetStencilCompareMask(
/// VkCommandBuffer commandBuffer,
/// VkStencilFaceFlags faceMask,
/// uint32_t compareMask);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetStencilCompareMask(this T handle, VkStencilFaceFlags faceMask, int compareMask)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetStencilCompareMask.Invoke(handle.Handle, faceMask, compareMask);
}
///
/// vkCmdSetStencilWriteMask - Set stencil write mask dynamically for a command buffer
///
///
///
/// To dynamically set^ the stencil write mask,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetStencilWriteMask(
/// VkCommandBuffer commandBuffer,
/// VkStencilFaceFlags faceMask,
/// uint32_t writeMask);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetStencilWriteMask(this T handle, VkStencilFaceFlags faceMask, int writeMask)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetStencilWriteMask.Invoke(handle.Handle, faceMask, writeMask);
}
///
/// vkCmdSetStencilReference - Set stencil reference value dynamically for a command buffer
///
///
///
/// To dynamically set^ the stencil reference value,
/// call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdSetStencilReference(
/// VkCommandBuffer commandBuffer,
/// VkStencilFaceFlags faceMask,
/// uint32_t reference);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetStencilReference(this T handle, VkStencilFaceFlags faceMask, int reference)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetStencilReference.Invoke(handle.Handle, faceMask, reference);
}
///
/// vkCmdBindIndexBuffer - Bind an index buffer to a command buffer
///
///
///
/// :refpage: vkCmdBindIndexBuffer
///
///
/// To bind an index buffer to a command buffer, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBindIndexBuffer(
/// VkCommandBuffer commandBuffer,
/// VkBuffer buffer,
/// VkDeviceSize offset,
/// VkIndexType indexType);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindIndexBuffer(this T handle, VkBuffer buffer, ByteSize64 offset, VkIndexType indexType)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdBindIndexBuffer.Invoke(handle.Handle, buffer, offset, indexType);
}
///
/// vkCmdBindVertexBuffers - Bind vertex buffers to a command buffer
///
///
///
/// To bind vertex buffers to a command buffer for use in subsequent drawing
/// commands, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBindVertexBuffers(
/// VkCommandBuffer commandBuffer,
/// uint32_t firstBinding,
/// uint32_t bindingCount,
/// const VkBuffer* pBuffers,
/// const VkDeviceSize* pOffsets);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BindVertexBuffers(
this T handle,
int firstBinding,
scoped ReadOnlySpan pBuffers,
scoped ReadOnlySpan pOffsets
)
where T : VulkanHandleWrapper
{
fixed (ByteSize64* pOffsetsFixed = pOffsets)
fixed (VkBuffer* pBuffersFixed = pBuffers)
{
handle.PInvoke.vkCmdBindVertexBuffers.Invoke(
handle.Handle,
firstBinding,
pBuffers.Length,
pBuffersFixed,
pOffsetsFixed
);
}
}
///
/// vkCmdDraw - Draw primitives
///
///
///
/// :refpage: vkCmdDraw
///
///
/// To record a non-indexed draw, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDraw(
/// VkCommandBuffer commandBuffer,
/// uint32_t vertexCount,
/// uint32_t instanceCount,
/// uint32_t firstVertex,
/// uint32_t firstInstance);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Draw(
this T handle,
int vertexCount,
int instanceCount,
int firstVertex,
int firstInstance
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDraw.Invoke(handle.Handle, vertexCount, instanceCount, firstVertex, firstInstance);
}
///
/// vkCmdDrawIndexed - Draw primitives with indexed vertices
///
///
///
/// :refpage: vkCmdDrawIndexed
///
///
/// To record an indexed draw, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDrawIndexed(
/// VkCommandBuffer commandBuffer,
/// uint32_t indexCount,
/// uint32_t instanceCount,
/// uint32_t firstIndex,
/// int32_t vertexOffset,
/// uint32_t firstInstance);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DrawIndexed(
this T handle,
int indexCount,
int instanceCount,
int firstIndex,
int vertexOffset,
int firstInstance
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDrawIndexed.Invoke(
handle.Handle,
indexCount,
instanceCount,
firstIndex,
vertexOffset,
firstInstance
);
}
///
/// vkCmdDrawIndirect - Draw primitives with indirect parameters
///
///
///
/// :refpage: vkCmdDrawIndirect
///
///
/// To record a non-indexed indirect drawing command, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDrawIndirect(
/// VkCommandBuffer commandBuffer,
/// VkBuffer buffer,
/// VkDeviceSize offset,
/// uint32_t drawCount,
/// uint32_t stride);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DrawIndirect(
this T handle,
VkBuffer buffer,
ByteSize64 offset,
int drawCount,
ByteSize32 stride
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDrawIndirect.Invoke(handle.Handle, buffer, offset, drawCount, stride);
}
///
/// vkCmdDrawIndexedIndirect - Draw primitives with indirect parameters and indexed vertices
///
///
///
/// :refpage: vkCmdDrawIndexedIndirect
///
///
/// To record an indexed indirect drawing command, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdDrawIndexedIndirect(
/// VkCommandBuffer commandBuffer,
/// VkBuffer buffer,
/// VkDeviceSize offset,
/// uint32_t drawCount,
/// uint32_t stride);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DrawIndexedIndirect(
this T handle,
VkBuffer buffer,
ByteSize64 offset,
int drawCount,
ByteSize32 stride
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDrawIndexedIndirect.Invoke(handle.Handle, buffer, offset, drawCount, stride);
}
///
/// vkCmdBlitImage - Copy regions of an image, potentially performing format conversion,
///
///
///
/// :refpage: vkCmdBlitImage
///
///
/// To copy regions of a source image into a destination image, potentially
/// performing format conversion, arbitrary scaling, and filtering, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBlitImage(
/// VkCommandBuffer commandBuffer,
/// VkImage srcImage,
/// VkImageLayout srcImageLayout,
/// VkImage dstImage,
/// VkImageLayout dstImageLayout,
/// uint32_t regionCount,
/// const VkImageBlit* pRegions,
/// VkFilter filter);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BlitImage(
this T handle,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
scoped ReadOnlySpan pRegions,
VkFilter filter
)
where T : VulkanHandleWrapper
{
fixed (VkImageBlit* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdBlitImage.Invoke(
handle.Handle,
srcImage,
srcImageLayout,
dstImage,
dstImageLayout,
pRegions.Length,
pRegionsFixed,
filter
);
}
}
///
/// vkCmdClearDepthStencilImage - Fill regions of a combined depth/stencil image
///
///
///
/// To clear one or more subranges of a depth/stencil image, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdClearDepthStencilImage(
/// VkCommandBuffer commandBuffer,
/// VkImage image,
/// VkImageLayout imageLayout,
/// const VkClearDepthStencilValue* pDepthStencil,
/// uint32_t rangeCount,
/// const VkImageSubresourceRange* pRanges);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ClearDepthStencilImage(
this T handle,
VkImage image,
VkImageLayout imageLayout,
VkClearDepthStencilValue* pDepthStencil,
scoped ReadOnlySpan pRanges
)
where T : VulkanHandleWrapper
{
fixed (VkImageSubresourceRange* pRangesFixed = pRanges)
{
handle.PInvoke.vkCmdClearDepthStencilImage.Invoke(
handle.Handle,
image,
imageLayout,
pDepthStencil,
pRanges.Length,
pRangesFixed
);
}
}
///
/// vkCmdClearAttachments - Clear regions within bound framebuffer attachments
///
///
///
/// To clear one or more regions of color and depth/stencil attachments inside a
/// render pass instance, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdClearAttachments(
/// VkCommandBuffer commandBuffer,
/// uint32_t attachmentCount,
/// const VkClearAttachment* pAttachments,
/// uint32_t rectCount,
/// const VkClearRect* pRects);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ClearAttachments(
this T handle,
scoped ReadOnlySpan pAttachments,
scoped ReadOnlySpan pRects
)
where T : VulkanHandleWrapper
{
fixed (VkClearRect* pRectsFixed = pRects)
fixed (VkClearAttachment* pAttachmentsFixed = pAttachments)
{
handle.PInvoke.vkCmdClearAttachments.Invoke(
handle.Handle,
pAttachments.Length,
pAttachmentsFixed,
pRects.Length,
pRectsFixed
);
}
}
///
/// vkCmdResolveImage - Resolve regions of an image
///
///
///
/// :refpage: vkCmdResolveImage
///
///
/// To resolve a multisample color image to a non-multisample color image, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdResolveImage(
/// VkCommandBuffer commandBuffer,
/// VkImage srcImage,
/// VkImageLayout srcImageLayout,
/// VkImage dstImage,
/// VkImageLayout dstImageLayout,
/// uint32_t regionCount,
/// const VkImageResolve* pRegions);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ResolveImage(
this T handle,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
scoped ReadOnlySpan pRegions
)
where T : VulkanHandleWrapper
{
fixed (VkImageResolve* pRegionsFixed = pRegions)
{
handle.PInvoke.vkCmdResolveImage.Invoke(
handle.Handle,
srcImage,
srcImageLayout,
dstImage,
dstImageLayout,
pRegions.Length,
pRegionsFixed
);
}
}
///
/// vkCmdBeginRenderPass - Begin a new render pass
///
///
///
/// To begin a render pass instance, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdBeginRenderPass(
/// VkCommandBuffer commandBuffer,
/// const VkRenderPassBeginInfo* pRenderPassBegin,
/// VkSubpassContents contents);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BeginRenderPass(
this T handle,
in VkRenderPassBeginInfo pRenderPassBegin,
VkSubpassContents contents
)
where T : VulkanHandleWrapper
{
fixed (VkRenderPassBeginInfo* pRenderPassBeginFixed = &pRenderPassBegin)
{
handle.PInvoke.vkCmdBeginRenderPass.Invoke(handle.Handle, pRenderPassBeginFixed, contents);
}
}
///
/// vkCmdNextSubpass - Transition to the next subpass of a render pass
///
///
///
/// To transition to the next subpass in the render pass instance after
/// recording the commands for a subpass, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdNextSubpass(
/// VkCommandBuffer commandBuffer,
/// VkSubpassContents contents);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NextSubpass(this T handle, VkSubpassContents contents)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdNextSubpass.Invoke(handle.Handle, contents);
}
///
/// vkCmdEndRenderPass - End the current render pass
///
///
///
/// To record a command to end a render pass instance after recording the
/// commands for the last subpass, call:
///
///
/// // Provided by VK_VERSION_1_0
/// void vkCmdEndRenderPass(
/// VkCommandBuffer commandBuffer);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void EndRenderPass(this T handle)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdEndRenderPass.Invoke(handle.Handle);
}
///
/// vkBindBufferMemory2 - Bind device memory to buffer objects
///
///
///
/// :refpage: vkBindBufferMemory2
///
///
/// To attach memory to buffer objects for one or more buffers at a time, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BindBufferMemory2(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pBindInfos
)
{
fixed (VkBindBufferMemoryInfo* pBindInfosFixed = pBindInfos)
{
VkResult result = handle.PInvoke.vkBindBufferMemory2.Invoke(
handle.Handle,
pBindInfos.Length,
pBindInfosFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkBindBufferMemory2 failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkBindBufferMemory2 failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorInvalidOpaqueCaptureAddressKHR:
throw new VkResultError(
VkResult.ErrorInvalidOpaqueCaptureAddressKHR,
"Vulkan call to vkBindBufferMemory2 failed with error: VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkBindBufferMemory2 failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkBindBufferMemory2 failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkBindImageMemory2 - Bind device memory to image objects
///
///
///
/// :refpage: vkBindImageMemory2
///
///
/// To attach memory to image objects for one or more images at a time, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void BindImageMemory2(
this VulkanHandleWrapper handle,
scoped ReadOnlySpan pBindInfos
)
{
fixed (VkBindImageMemoryInfo* pBindInfosFixed = pBindInfos)
{
VkResult result = handle.PInvoke.vkBindImageMemory2.Invoke(
handle.Handle,
pBindInfos.Length,
pBindInfosFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkBindImageMemory2 failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkBindImageMemory2 failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkBindImageMemory2 failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkBindImageMemory2 failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
///
/// vkGetDeviceGroupPeerMemoryFeatures - Query supported peer memory features of a device
///
///
///
/// Peer memory is memory that is allocated for a given physical device and
/// then bound to a resource and accessed by a different physical device, in a
/// logical device that represents multiple physical devices.
/// Some ways of reading and writing peer memory may: not be supported by a
/// device.
///
///
/// To determine how peer memory can be accessed, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkPeerMemoryFeatureFlags GetGroupPeerMemoryFeatures(
this VulkanHandleWrapper handle,
int heapIndex,
int localDeviceIndex,
int remoteDeviceIndex
)
{
VkPeerMemoryFeatureFlags pPeerMemoryFeaturesLocal = default;
handle.PInvoke.vkGetDeviceGroupPeerMemoryFeatures.Invoke(
handle.Handle,
heapIndex,
localDeviceIndex,
remoteDeviceIndex,
&pPeerMemoryFeaturesLocal
);
return pPeerMemoryFeaturesLocal;
}
///
/// vkCmdSetDeviceMask - Modify device mask of a command buffer
///
///
///
/// To update the current device mask of a command buffer, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void SetDeviceMask(this T handle, int deviceMask)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdSetDeviceMask.Invoke(handle.Handle, deviceMask);
}
///
/// vkGetImageMemoryRequirements2 - Returns the memory requirements for specified Vulkan object
///
///
///
/// To determine the memory requirements for an image resource, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetImageMemoryRequirements2(
this VulkanHandleWrapper handle,
in VkImageMemoryRequirementsInfo2 pInfo,
ref VkMemoryRequirements2 pMemoryRequirements
)
{
fixed (VkMemoryRequirements2* pMemoryRequirementsFixed = &pMemoryRequirements)
fixed (VkImageMemoryRequirementsInfo2* pInfoFixed = &pInfo)
{
handle.PInvoke.vkGetImageMemoryRequirements2.Invoke(
handle.Handle,
pInfoFixed,
pMemoryRequirementsFixed
);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkMemoryRequirements2.
public static VkMemoryRequirements2 GetImageMemoryRequirements2(
this VulkanHandleWrapper handle,
in VkImageMemoryRequirementsInfo2 pInfo
)
{
VkMemoryRequirements2 outValue = new();
GetImageMemoryRequirements2(handle, pInfo, ref outValue);
return outValue;
}
///
/// vkGetBufferMemoryRequirements2 - Returns the memory requirements for specified Vulkan object
///
///
///
/// To determine the memory requirements for a buffer resource, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetBufferMemoryRequirements2(
this VulkanHandleWrapper handle,
in VkBufferMemoryRequirementsInfo2 pInfo,
ref VkMemoryRequirements2 pMemoryRequirements
)
{
fixed (VkMemoryRequirements2* pMemoryRequirementsFixed = &pMemoryRequirements)
fixed (VkBufferMemoryRequirementsInfo2* pInfoFixed = &pInfo)
{
handle.PInvoke.vkGetBufferMemoryRequirements2.Invoke(
handle.Handle,
pInfoFixed,
pMemoryRequirementsFixed
);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkMemoryRequirements2.
public static VkMemoryRequirements2 GetBufferMemoryRequirements2(
this VulkanHandleWrapper handle,
in VkBufferMemoryRequirementsInfo2 pInfo
)
{
VkMemoryRequirements2 outValue = new();
GetBufferMemoryRequirements2(handle, pInfo, ref outValue);
return outValue;
}
///
/// vkGetImageSparseMemoryRequirements2 - Query the memory requirements for a sparse image
///
///
///
/// To query sparse memory requirements for an image, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe void GetImageSparseMemoryRequirements2(
this VulkanHandleWrapper handle,
in VkImageSparseMemoryRequirementsInfo2 pInfo,
ref int pSparseMemoryRequirementCount,
scoped ReadOnlySpan pSparseMemoryRequirements
)
{
fixed (VkSparseImageMemoryRequirements2* pSparseMemoryRequirementsFixed = pSparseMemoryRequirements)
fixed (VkImageSparseMemoryRequirementsInfo2* pInfoFixed = &pInfo)
fixed (int* pSparseMemoryRequirementCountFixed = &pSparseMemoryRequirementCount)
{
handle.PInvoke.vkGetImageSparseMemoryRequirements2.Invoke(
handle.Handle,
pInfoFixed,
pSparseMemoryRequirementCountFixed,
pSparseMemoryRequirementsFixed
);
}
}
/// Queries the required length.
/// The required length.
public static int GetImageSparseMemoryRequirements2_Count(
this VulkanHandleWrapper handle,
in VkImageSparseMemoryRequirementsInfo2 pInfo
)
{
int pSparseMemoryRequirementCount = default;
GetImageSparseMemoryRequirements2(handle, pInfo, ref pSparseMemoryRequirementCount, null);
return pSparseMemoryRequirementCount;
}
/// Writes to a provided span.
/// The span to write to.
/// Return value of the underlying function.
public static void GetImageSparseMemoryRequirements2_Write(
this VulkanHandleWrapper handle,
in VkImageSparseMemoryRequirementsInfo2 pInfo,
scoped ReadOnlySpan pSparseMemoryRequirements
)
{
int pSparseMemoryRequirementCount = pSparseMemoryRequirements.Length;
GetImageSparseMemoryRequirements2(
handle,
pInfo,
ref pSparseMemoryRequirementCount,
pSparseMemoryRequirements
);
}
///
/// vkTrimCommandPool - Trim a command pool
///
///
///
/// To trim a command pool, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void TrimCommandPool(
this VulkanHandleWrapper handle,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags
)
{
handle.PInvoke.vkTrimCommandPool.Invoke(handle.Handle, commandPool, flags);
}
///
/// vkGetDeviceQueue2 - Get a queue handle from a device
///
///
///
/// To retrieve a handle to a VkQueue object with specific
/// VkDeviceQueueCreateFlags creation flags, call:
///
///
/// // Provided by VK_VERSION_1_1
/// void vkGetDeviceQueue2(
/// VkDevice device,
/// const VkDeviceQueueInfo2* pQueueInfo,
/// VkQueue* pQueue);
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkQueue GetQueue2(
this VulkanHandleWrapper handle,
in VkDeviceQueueInfo2 pQueueInfo
)
{
fixed (VkDeviceQueueInfo2* pQueueInfoFixed = &pQueueInfo)
{
VkQueue pQueueLocal = default;
handle.PInvoke.vkGetDeviceQueue2.Invoke(handle.Handle, pQueueInfoFixed, &pQueueLocal);
return pQueueLocal;
}
}
///
/// vkCmdDispatchBase - Dispatch compute work items with non-zero base values for the workgroup IDs
///
///
///
/// :refpage: vkCmdDispatchBase
///
///
/// To record a dispatch using non-zero base values for the components of
/// WorkgroupId, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DispatchBase(
this T handle,
int baseGroupX,
int baseGroupY,
int baseGroupZ,
int groupCountX,
int groupCountY,
int groupCountZ
)
where T : VulkanHandleWrapper
{
handle.PInvoke.vkCmdDispatchBase.Invoke(
handle.Handle,
baseGroupX,
baseGroupY,
baseGroupZ,
groupCountX,
groupCountY,
groupCountZ
);
}
///
/// vkCreateDescriptorUpdateTemplate - Create a new descriptor update template
///
///
///
/// Updating a large VkDescriptorSet array can be an expensive operation
/// since an application must specify one VkWriteDescriptorSet structure
/// for each descriptor or descriptor array to update, each of which
/// re-specifies the same state when updating the same descriptor in multiple
/// descriptor sets.
/// For cases when an application wishes to update the same set of descriptors
/// in multiple descriptor sets allocated using the same
/// VkDescriptorSetLayout, vkUpdateDescriptorSetWithTemplate can be
/// used as a replacement for vkUpdateDescriptorSets.
///
///
/// VkDescriptorUpdateTemplate allows implementations to convert a set of
/// descriptor update operations on a single descriptor set to an internal
/// format.
/// In conjunction with
/// vkUpdateDescriptorSetWithTemplate, this can be more efficient
/// compared to calling
/// vkUpdateDescriptorSets.
/// The descriptors themselves are not specified in the
/// VkDescriptorUpdateTemplate, rather, offsets into an application
/// provided pointer to host memory are specified, which are combined with a
/// pointer passed to
/// vkUpdateDescriptorSetWithTemplate.
/// This allows large batches of updates to be executed without having to
/// convert application data structures into a strictly-defined Vulkan data
/// structure.
///
///
/// To create a descriptor update template, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkDescriptorUpdateTemplate CreateDescriptorUpdateTemplate(
this VulkanHandleWrapper handle,
in VkDescriptorUpdateTemplateCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkDescriptorUpdateTemplateCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkDescriptorUpdateTemplate pDescriptorUpdateTemplateLocal = default;
VkResult result = handle.PInvoke.vkCreateDescriptorUpdateTemplate.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pDescriptorUpdateTemplateLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateDescriptorUpdateTemplate failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateDescriptorUpdateTemplate failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateDescriptorUpdateTemplate failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateDescriptorUpdateTemplate failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pDescriptorUpdateTemplateLocal;
}
}
///
/// vkDestroyDescriptorUpdateTemplate - Destroy a descriptor update template object
///
///
///
/// To destroy a descriptor update template, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroyDescriptorUpdateTemplate(
this VulkanHandleWrapper handle,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroyDescriptorUpdateTemplate.Invoke(
handle.Handle,
descriptorUpdateTemplate,
pAllocator
);
}
///
/// vkUpdateDescriptorSetWithTemplate - Update the contents of a descriptor set object using an update template
///
///
///
/// Once a VkDescriptorUpdateTemplate has been created, descriptor sets
/// can be updated by calling:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void UpdateDescriptorSetWithTemplate(
this VulkanHandleWrapper handle,
VkDescriptorSet descriptorSet,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
void* pData
)
{
handle.PInvoke.vkUpdateDescriptorSetWithTemplate.Invoke(
handle.Handle,
descriptorSet,
descriptorUpdateTemplate,
pData
);
}
///
/// vkGetDescriptorSetLayoutSupport - Query whether a descriptor set layout can be created
///
///
///
/// To query information about whether a descriptor set layout can be created,
/// call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void GetDescriptorSetLayoutSupport(
this VulkanHandleWrapper handle,
in VkDescriptorSetLayoutCreateInfo pCreateInfo,
ref VkDescriptorSetLayoutSupport pSupport
)
{
fixed (VkDescriptorSetLayoutSupport* pSupportFixed = &pSupport)
fixed (VkDescriptorSetLayoutCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
handle.PInvoke.vkGetDescriptorSetLayoutSupport.Invoke(handle.Handle, pCreateInfoFixed, pSupportFixed);
}
}
/// Wrapper that returns the struct instead of taking it as a ref parameter.
/// The VkDescriptorSetLayoutSupport.
public static VkDescriptorSetLayoutSupport GetDescriptorSetLayoutSupport(
this VulkanHandleWrapper handle,
in VkDescriptorSetLayoutCreateInfo pCreateInfo
)
{
VkDescriptorSetLayoutSupport outValue = new();
GetDescriptorSetLayoutSupport(handle, pCreateInfo, ref outValue);
return outValue;
}
///
/// vkCreateSamplerYcbcrConversion - Create a new {YCbCr} conversion
///
///
///
/// :refpage: vkCreateSamplerYcbcrConversion
/// :objectnameplural: sampler conversions
/// :objectnamecamelcase: samplerYcbcrConversion
/// :objectnamestruct: VkDeviceObjectReservationCreateInfo
/// :objectcount: 1
///
///
/// To create a VkSamplerYcbcrConversion, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe VkSamplerYCbCrConversion CreateSamplerYcbcrConversion(
this VulkanHandleWrapper handle,
in VkSamplerYCbCrConversionCreateInfo pCreateInfo,
VkAllocator? pAllocator
)
{
fixed (VkSamplerYCbCrConversionCreateInfo* pCreateInfoFixed = &pCreateInfo)
{
VkSamplerYCbCrConversion pYcbcrConversionLocal = default;
VkResult result = handle.PInvoke.vkCreateSamplerYcbcrConversion.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pYcbcrConversionLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateSamplerYcbcrConversion failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateSamplerYcbcrConversion failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateSamplerYcbcrConversion failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateSamplerYcbcrConversion failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pYcbcrConversionLocal;
}
}
///
/// vkDestroySamplerYcbcrConversion - Destroy a created {YCbCr} conversion
///
///
///
/// To destroy a sampler {YCbCr} conversion, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void DestroySamplerYcbcrConversion(
this VulkanHandleWrapper handle,
VkSamplerYCbCrConversion ycbcrConversion,
VkAllocator? pAllocator
)
{
handle.PInvoke.vkDestroySamplerYcbcrConversion.Invoke(handle.Handle, ycbcrConversion, pAllocator);
}
///
/// vkResetQueryPool - Reset queries in a query pool
///
///
///
/// :refpage: vkResetQueryPool
///
///
/// To reset a range of queries in a query pool on the host, call:
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ResetQueryPool(
this VulkanHandleWrapper handle,
VkQueryPool queryPool,
int firstQuery,
int queryCount
)
{
handle.PInvoke.vkResetQueryPool.Invoke(handle.Handle, queryPool, firstQuery, queryCount);
}
///
///