/// <summary> /// /// </summary> public unsafe byte[] GetHandle(HostSize dataSize) { try { byte[] result = default(byte[]); HostSize marshalledDataSize = default(HostSize); byte * marshalledData = default(byte *); marshalledDataSize = dataSize; marshalledData = (byte *)(Interop.HeapUtil.Allocate <byte>(marshalledDataSize)); SharpVk.Interop.NVidia.VkAccelerationStructureNVGetHandleDelegate commandDelegate = commandCache.Cache.vkGetAccelerationStructureHandleNV; Result methodResult = commandDelegate(this.parent.handle, this.handle, marshalledDataSize, marshalledData); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } if (marshalledData != null) { var fieldPointer = new byte[(uint)(marshalledDataSize)]; for (int index = 0; index < (uint)(marshalledDataSize); index++) { fieldPointer[index] = marshalledData[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe byte[] GetData() { try { byte[] result = default(byte[]); HostSize dataSize = default(HostSize); byte * marshalledData = default(byte *); SharpVk.Interop.Multivendor.VkValidationCacheEXTGetDataDelegate commandDelegate = commandCache.Cache.vkGetValidationCacheDataEXT; Result methodResult = commandDelegate(this.parent.handle, this.handle, &dataSize, marshalledData); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledData = (byte *)(Interop.HeapUtil.Allocate <byte>((uint)(dataSize))); commandDelegate(this.parent.handle, this.handle, &dataSize, marshalledData); if (marshalledData != null) { var fieldPointer = new byte[(uint)(dataSize)]; for (int index = 0; index < (uint)(dataSize); index++) { fieldPointer[index] = marshalledData[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
public static Bool32 _DebugReport(DebugReportFlags flags, DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string layerPrefix, string message, IntPtr userData) { Console.WriteLine(message); return(false); }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Pipeline handle to extend. /// </param> public static unsafe byte[] GetShaderInfo(this SharpVk.Pipeline extendedHandle, SharpVk.ShaderStageFlags shaderStage, SharpVk.Amd.ShaderInfoType infoType) { try { byte[] result = default(byte[]); HostSize infoSize = default(HostSize); CommandCache commandCache = default(CommandCache); byte * marshalledInfo = default(byte *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Amd.VkPipelineGetShaderInfoDelegate commandDelegate = commandCache.Cache.vkGetShaderInfoAMD; Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, shaderStage, infoType, &infoSize, marshalledInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledInfo = (byte *)(Interop.HeapUtil.Allocate <byte>((uint)(infoSize))); commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, shaderStage, infoType, &infoSize, marshalledInfo); if (marshalledInfo != null) { var fieldPointer = new byte[(uint)(infoSize)]; for (int index = 0; index < (uint)(infoSize); index++) { fieldPointer[index] = marshalledInfo[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Pipeline handle to extend. /// </param> public static unsafe byte[] GetRayTracingShaderGroupHandles(this SharpVk.Pipeline extendedHandle, uint firstGroup, uint groupCount, HostSize dataSize) { try { byte[] result = default(byte[]); CommandCache commandCache = default(CommandCache); HostSize marshalledDataSize = default(HostSize); byte * marshalledData = default(byte *); commandCache = extendedHandle.commandCache; marshalledDataSize = dataSize; marshalledData = (byte *)(Interop.HeapUtil.Allocate <byte>(dataSize)); SharpVk.Interop.NVidia.VkPipelineGetRayTracingShaderGroupHandlesDelegate commandDelegate = commandCache.Cache.vkGetRayTracingShaderGroupHandlesNV; Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, firstGroup, groupCount, marshalledDataSize, marshalledData); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } if (marshalledData != null) { var fieldPointer = new byte[(uint)(dataSize)]; for (int index = 0; index < (uint)(dataSize); index++) { fieldPointer[index] = marshalledData[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> public static unsafe void DebugReportMessage(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugReportFlags flags, SharpVk.Multivendor.DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string layerPrefix, string message) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkInstanceDebugReportMessageDelegate commandDelegate = commandCache.Cache.vkDebugReportMessageEXT; commandDelegate(extendedHandle.handle, flags, objectType, @object, location, messageCode, Interop.HeapUtil.MarshalTo(layerPrefix), Interop.HeapUtil.MarshalTo(message)); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public ShaderResourceUsage(uint numUsedVgprs, uint numUsedSgprs, uint ldsSizePerLocalWorkGroup, HostSize ldsUsageSizeInBytes, HostSize scratchMemUsageInBytes) { this.NumUsedVgprs = numUsedVgprs; this.NumUsedSgprs = numUsedSgprs; this.LdsSizePerLocalWorkGroup = ldsSizePerLocalWorkGroup; this.LdsUsageSizeInBytes = ldsUsageSizeInBytes; this.ScratchMemUsageInBytes = scratchMemUsageInBytes; }
/// <summary> /// /// </summary> public DescriptorUpdateTemplateEntry(uint destinationBinding, uint destinationArrayElement, uint descriptorCount, SharpVk.DescriptorType descriptorType, HostSize offset, HostSize stride) { this.DestinationBinding = destinationBinding; this.DestinationArrayElement = destinationArrayElement; this.DescriptorCount = descriptorCount; this.DescriptorType = descriptorType; this.Offset = offset; this.Stride = stride; }
internal static IntPtr Allocate <T>(HostSize count) { return(Allocate <T>((uint)count)); }
public Bool32 DebugReport(DebugReportFlags flags, DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string layerPrefix, string message, IntPtr userData) { return(VkHelperFunctions._DebugReport(flags, objectType, @object, location, messageCode, layerPrefix, message, userData)); }
/// <summary> /// Vulkan debug callback. /// </summary> private Bool32 DebugCallback(DebugReportFlags flags, DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string pLayerPrefix, string pMessage, IntPtr pUserData) { Console.WriteLine(pMessage); return(false); }
public static extern SharpVk.Result vkGetQueryPoolResults(SharpVk.Interop.Device device, SharpVk.Interop.QueryPool queryPool, uint firstQuery, uint queryCount, HostSize dataSize, void *data, DeviceSize stride, SharpVk.QueryResultFlags flags);
private static Bool32 DebugCallback(DebugReportFlags flags, DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string pLayerPrefix, string pMessage, IntPtr pUserData) { string logMessage = $"{pLayerPrefix}: {pMessage}"; Console.WriteLine(logMessage); System.Diagnostics.Debug.WriteLine(logMessage); return(false); }
private static unsafe Bool32 DebugReportCallbackWrapperCallback(DebugReportFlags flags, DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string pLayerPrefix, string pMessage, IntPtr pUserData) { if (pUserData == IntPtr.Zero) { return(false); } System.Runtime.InteropServices.GCHandle gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(pUserData); DebugReportCallbackWrapper callback = (DebugReportCallbackWrapper)gch.Target; if (callback == null) { return(false); } return(callback.callback_(flags, objectType, @object, location, messageCode, pLayerPrefix, pMessage) && callback.ValidationLayerTesting); }