/// <summary> /// Query physical device for presentation to Wayland. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> /// <param name="queueFamilyIndex"> /// </param> /// <param name="display"> /// </param> public static unsafe void GetWaylandPresentationSupport(this SharpVk.PhysicalDevice extendedHandle, uint queueFamilyIndex, IntPtr display) { try { CommandCache commandCache = default(CommandCache); IntPtr * marshalledDisplay = default(IntPtr *); commandCache = extendedHandle.commandCache; marshalledDisplay = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledDisplay = display; SharpVk.Interop.Khronos.VkPhysicalDeviceGetWaylandPresentationSupportDelegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceWaylandPresentationSupportKHR; commandDelegate(extendedHandle.handle, queueFamilyIndex, marshalledDisplay); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> public static unsafe SharpVk.Khronos.Surface CreateImagePipeSurface(this SharpVk.Instance extendedHandle, uint imagePipeHandle, SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags?flags = default(SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *); void *nextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.ImagepipeSurfaceCreateInfo; marshalledCreateInfo->Next = nextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags); } marshalledCreateInfo->ImagePipeHandle = imagePipeHandle; if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.Fuchsia.VkInstanceCreateImagePipeSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateImagePipeSurfaceFUCHSIA; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void BuildAccelerationStructure(this SharpVk.CommandBuffer extendedHandle, SharpVk.NVidia.AccelerationStructureInfo info, SharpVk.Buffer instanceData, ulong instanceOffset, bool update, SharpVk.NVidia.AccelerationStructure destination, SharpVk.NVidia.AccelerationStructure source, SharpVk.Buffer scratch, ulong scratchOffset) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.AccelerationStructureInfo *marshalledInfo = default(SharpVk.Interop.NVidia.AccelerationStructureInfo *); commandCache = extendedHandle.commandCache; marshalledInfo = (SharpVk.Interop.NVidia.AccelerationStructureInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructureInfo>()); info.MarshalTo(marshalledInfo); SharpVk.Interop.NVidia.VkCommandBufferBuildAccelerationStructureDelegate commandDelegate = commandCache.Cache.vkCmdBuildAccelerationStructureNV; commandDelegate(extendedHandle.handle, marshalledInfo, instanceData?.handle ?? default(SharpVk.Interop.Buffer), instanceOffset, update, destination?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure), source?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure), scratch?.handle ?? default(SharpVk.Interop.Buffer), scratchOffset); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a display mode. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> /// <param name="display"> /// </param> /// <param name="flags"> /// Reserved for future use, and must be zero. /// </param> /// <param name="parameters"> /// A DisplayModeParametersKHR structure describing the display /// parameters to use in creating the new mode. If the parameters are /// not compatible with the specified display, the implementation must /// return Result.ErrorINITIALIZATION_FAILED. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.DisplayMode CreateDisplayMode(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display, SharpVk.Khronos.DisplayModeParameters parameters, SharpVk.Khronos.DisplayModeCreateFlags?flags = default(SharpVk.Khronos.DisplayModeCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.DisplayMode result = default(SharpVk.Khronos.DisplayMode); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayModeCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplayModeCreateInfo *); void *vkDisplayModeCreateInfoKHRNextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.DisplayMode marshalledMode = default(SharpVk.Interop.Khronos.DisplayMode); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.DisplayModeCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeCreateInfo>()); marshalledCreateInfo->SType = StructureType.DisplayModeCreateInfo; marshalledCreateInfo->Next = vkDisplayModeCreateInfoKHRNextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplayModeCreateFlags); } marshalledCreateInfo->Parameters = parameters; if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.Khronos.VkPhysicalDeviceCreateDisplayModeDelegate commandDelegate = commandCache.Cache.vkCreateDisplayModeKHR; Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledCreateInfo, marshalledAllocator, &marshalledMode); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.DisplayMode(extendedHandle, marshalledMode); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void GetXcbPresentationSupport(this SharpVk.PhysicalDevice extendedHandle, uint queueFamilyIndex, IntPtr connection, IntPtr visualId) { try { CommandCache commandCache = default(CommandCache); IntPtr * marshalledConnection = default(IntPtr *); commandCache = extendedHandle.commandCache; marshalledConnection = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledConnection = connection; SharpVk.Interop.Khronos.VkPhysicalDeviceGetXcbPresentationSupportDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkPhysicalDeviceGetXcbPresentationSupportDelegate>("vkGetPhysicalDeviceXcbPresentationSupportKHR", "instance"); commandDelegate(extendedHandle.handle, queueFamilyIndex, marshalledConnection, visualId); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> public static unsafe void SubmitDebugUtilsMessage(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageTypes, SharpVk.Multivendor.DebugUtilsMessengerCallbackData callbackData) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *marshalledCallbackData = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *); commandCache = extendedHandle.commandCache; marshalledCallbackData = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData>()); callbackData.MarshalTo(marshalledCallbackData); SharpVk.Interop.Multivendor.VkInstanceSubmitDebugUtilsMessageDelegate commandDelegate = commandCache.Cache.vkSubmitDebugUtilsMessageEXT; commandDelegate(extendedHandle.handle, messageSeverity, messageTypes, marshalledCallbackData); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a SurfaceKHR object for a Wayland window. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use. /// </param> /// <param name="display"> /// display and surface are pointers to the Wayland wl_display and /// wl_surface to associate the surface with. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateWaylandSurface(this SharpVk.Instance extendedHandle, IntPtr display, IntPtr surface, SharpVk.Khronos.WaylandSurfaceCreateFlags?flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.WaylandSurfaceCreateInfoKhr; marshalledCreateInfo->Next = null; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags); } marshalledCreateInfo->Display = display; marshalledCreateInfo->Surface = surface; if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.Khronos.VkInstanceCreateWaylandSurfaceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkInstanceCreateWaylandSurfaceDelegate>("vkCreateWaylandSurfaceKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Perform a reservation of command buffer space. /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void ReserveSpaceForCommands(this SharpVk.CommandBuffer extendedHandle, SharpVk.NVidia.Experimental.CommandReserveSpaceForCommandsInfo reserveSpaceInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.Experimental.CommandReserveSpaceForCommandsInfo *marshalledReserveSpaceInfo = default(SharpVk.Interop.NVidia.Experimental.CommandReserveSpaceForCommandsInfo *); commandCache = extendedHandle.commandCache; marshalledReserveSpaceInfo = (SharpVk.Interop.NVidia.Experimental.CommandReserveSpaceForCommandsInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.CommandReserveSpaceForCommandsInfo>()); reserveSpaceInfo.MarshalTo(marshalledReserveSpaceInfo); SharpVk.Interop.NVidia.Experimental.VkCommandBufferReserveSpaceForCommandsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkCommandBufferReserveSpaceForCommandsDelegate>("vkCmdReserveSpaceForCommandsNVX", "device"); commandDelegate(extendedHandle.handle, marshalledReserveSpaceInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void InsertDebugUtilsLabel(this SharpVk.Queue extendedHandle, SharpVk.Multivendor.DebugUtilsLabel labelInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugUtilsLabel *marshalledLabelInfo = default(SharpVk.Interop.Multivendor.DebugUtilsLabel *); commandCache = extendedHandle.commandCache; marshalledLabelInfo = (SharpVk.Interop.Multivendor.DebugUtilsLabel *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsLabel>()); labelInfo.MarshalTo(marshalledLabelInfo); SharpVk.Interop.Multivendor.VkQueueInsertDebugUtilsLabelDelegate commandDelegate = commandCache.Cache.vkQueueInsertDebugUtilsLabelEXT; commandDelegate(extendedHandle.handle, marshalledLabelInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Insert a marker label into a command buffer. /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void DebugMarkerInsert(this SharpVk.CommandBuffer extendedHandle, SharpVk.Multivendor.DebugMarkerMarkerInfo markerInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugMarkerMarkerInfo *marshalledMarkerInfo = default(SharpVk.Interop.Multivendor.DebugMarkerMarkerInfo *); commandCache = extendedHandle.commandCache; marshalledMarkerInfo = (SharpVk.Interop.Multivendor.DebugMarkerMarkerInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugMarkerMarkerInfo>()); markerInfo.MarshalTo(marshalledMarkerInfo); SharpVk.Interop.Multivendor.VkCommandBufferDebugMarkerInsertDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkCommandBufferDebugMarkerInsertDelegate>("vkCmdDebugMarkerInsertEXT", "device"); commandDelegate(extendedHandle.handle, marshalledMarkerInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void SetSampleLocations(this SharpVk.CommandBuffer extendedHandle, SharpVk.Multivendor.SampleLocationsInfo sampleLocationsInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.SampleLocationsInfo *marshalledSampleLocationsInfo = default(SharpVk.Interop.Multivendor.SampleLocationsInfo *); commandCache = extendedHandle.commandCache; marshalledSampleLocationsInfo = (SharpVk.Interop.Multivendor.SampleLocationsInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.SampleLocationsInfo>()); sampleLocationsInfo.MarshalTo(marshalledSampleLocationsInfo); SharpVk.Interop.Multivendor.VkCommandBufferSetSampleLocationsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkCommandBufferSetSampleLocationsDelegate>("vkCmdSetSampleLocationsEXT", "device"); commandDelegate(extendedHandle.handle, marshalledSampleLocationsInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Performs the generation of commands on the device. /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void ProcessCommands(this SharpVk.CommandBuffer extendedHandle, SharpVk.NVidia.Experimental.CommandProcessCommandsInfo processCommandsInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.Experimental.CommandProcessCommandsInfo *marshalledProcessCommandsInfo = default(SharpVk.Interop.NVidia.Experimental.CommandProcessCommandsInfo *); commandCache = extendedHandle.commandCache; marshalledProcessCommandsInfo = (SharpVk.Interop.NVidia.Experimental.CommandProcessCommandsInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.CommandProcessCommandsInfo>()); processCommandsInfo.MarshalTo(marshalledProcessCommandsInfo); SharpVk.Interop.NVidia.Experimental.VkCommandBufferProcessCommandsDelegate commandDelegate = commandCache.Cache.vkCmdProcessCommandsNVX; commandDelegate(extendedHandle.handle, marshalledProcessCommandsInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Query an address of a buffer /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="info"> /// An instance of the VkBufferDeviceAddressInfoEXT structure /// specifying the buffer to retrieve an address for. /// </param> public static unsafe void GetBufferDeviceAddress(this SharpVk.Device extendedHandle, SharpVk.Multivendor.BufferDeviceAddressInfo info) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.BufferDeviceAddressInfo *marshalledInfo = default(SharpVk.Interop.Multivendor.BufferDeviceAddressInfo *); commandCache = extendedHandle.commandCache; marshalledInfo = (SharpVk.Interop.Multivendor.BufferDeviceAddressInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.BufferDeviceAddressInfo>()); info.MarshalTo(marshalledInfo); SharpVk.Interop.Multivendor.VkDeviceGetBufferDeviceAddressDelegate commandDelegate = commandCache.Cache.vkGetBufferDeviceAddressEXT; commandDelegate(extendedHandle.handle, marshalledInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe SharpVk.Khronos.PhysicalDeviceMemoryProperties2 GetMemoryProperties2(this SharpVk.PhysicalDevice extendedHandle) { try { SharpVk.Khronos.PhysicalDeviceMemoryProperties2 result = default(SharpVk.Khronos.PhysicalDeviceMemoryProperties2); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PhysicalDeviceMemoryProperties2 marshalledMemoryProperties = default(SharpVk.Interop.Khronos.PhysicalDeviceMemoryProperties2); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceGetMemoryProperties2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkPhysicalDeviceGetMemoryProperties2Delegate>("vkGetPhysicalDeviceMemoryProperties2KHR", "instance"); commandDelegate(extendedHandle.handle, &marshalledMemoryProperties); result = SharpVk.Khronos.PhysicalDeviceMemoryProperties2.MarshalFrom(&marshalledMemoryProperties); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Swapchain handle to extend. /// </param> public static unsafe void ReleaseFullScreenExclusiveMode(this SharpVk.Khronos.Swapchain extendedHandle) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkSwapchainKHRReleaseFullScreenExclusiveModeDelegate commandDelegate = commandCache.Cache.vkReleaseFullScreenExclusiveModeEXT; Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Queue handle to extend. /// </param> public static unsafe void SetPerformanceConfiguration(this SharpVk.Queue extendedHandle, SharpVk.Intel.PerformanceConfiguration configuration) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Intel.VkQueueSetPerformanceConfigurationDelegate commandDelegate = commandCache.Cache.vkQueueSetPerformanceConfigurationINTEL; Result methodResult = commandDelegate(extendedHandle.handle, configuration?.handle ?? default(SharpVk.Interop.Intel.PerformanceConfiguration)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
public void GetOutput_with_cache_hit() { const string arguments = "abc"; var cache = new CommandCache(); cache.Add( arguments, output: GitModule.SystemEncoding.GetBytes("Hello"), error: GitModule.SystemEncoding.GetBytes("World!")); var output = _executable.GetOutput(arguments, cache: cache); Assert.AreEqual($"Hello{Environment.NewLine}World!", output); // Cache should still have a single item Assert.AreEqual(1, cache.GetCachedCommands().Count); }
/// <summary> /// /// </summary> public static unsafe SharpVk.Khronos.Experimental.PeerMemoryFeatureFlags GetGroupPeerMemoryFeatures(this SharpVk.Device extendedHandle, uint heapIndex, uint localDeviceIndex, uint remoteDeviceIndex) { try { SharpVk.Khronos.Experimental.PeerMemoryFeatureFlags result = default(SharpVk.Khronos.Experimental.PeerMemoryFeatureFlags); CommandCache commandCache = default(CommandCache); SharpVk.Khronos.Experimental.PeerMemoryFeatureFlags marshalledPeerMemoryFeatures = default(SharpVk.Khronos.Experimental.PeerMemoryFeatureFlags); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.Experimental.VkDeviceGetGroupPeerMemoryFeaturesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceGetGroupPeerMemoryFeaturesDelegate>("vkGetDeviceGroupPeerMemoryFeaturesKHX", "instance"); commandDelegate(extendedHandle.handle, heapIndex, localDeviceIndex, remoteDeviceIndex, &marshalledPeerMemoryFeatures); result = marshalledPeerMemoryFeatures; return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Release access to an acquired Display. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe void ReleaseDisplay(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkPhysicalDeviceReleaseDisplayDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceReleaseDisplayDelegate>("vkReleaseDisplayEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
public void GetCommandFromCacheAfterRewrite() { CommandCache sut = new CommandCache(); ProcessingCommand command1 = new ProcessingCommand(); sut.Set("testUser", command1); ProcessingCommand cachedCommand1 = sut.Get("testUser"); Assert.Equal(command1, cachedCommand1); ProcessingCommand command2 = new ProcessingCommand(); sut.Set("testUser", command2); ProcessingCommand cachedCommand2 = sut.Get("testUser"); Assert.Equal(command2, cachedCommand2); }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Multivendor.MultisampleProperties GetMultisampleProperties(this SharpVk.PhysicalDevice extendedHandle, SharpVk.SampleCountFlags samples) { try { SharpVk.Multivendor.MultisampleProperties result = default(SharpVk.Multivendor.MultisampleProperties); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.MultisampleProperties marshalledMultisampleProperties = default(SharpVk.Interop.Multivendor.MultisampleProperties); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkPhysicalDeviceGetMultisamplePropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceGetMultisamplePropertiesDelegate>("vkGetPhysicalDeviceMultisamplePropertiesEXT", "device"); commandDelegate(extendedHandle.handle, samples, &marshalledMultisampleProperties); result = SharpVk.Multivendor.MultisampleProperties.MarshalFrom(&marshalledMultisampleProperties); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Pipeline handle to extend. /// </param> public static unsafe void CompileDeferred(this SharpVk.Pipeline extendedHandle, uint shader) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.NVidia.VkPipelineCompileDeferredDelegate commandDelegate = commandCache.Cache.vkCompileDeferredNV; Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, shader); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void EndRenderPass2(this SharpVk.CommandBuffer extendedHandle) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.SubpassEndInfo *marshalledSubpassEndInfo = default(SharpVk.Interop.Khronos.SubpassEndInfo *); void *nextPointer = default(void *); commandCache = extendedHandle.commandCache; marshalledSubpassEndInfo = (SharpVk.Interop.Khronos.SubpassEndInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SubpassEndInfo>()); marshalledSubpassEndInfo->SType = StructureType.SubpassEndInfo; marshalledSubpassEndInfo->Next = nextPointer; SharpVk.Interop.Khronos.VkCommandBufferEndRenderPass2Delegate commandDelegate = commandCache.Cache.vkCmdEndRenderPass2KHR; commandDelegate(extendedHandle.handle, marshalledSubpassEndInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Handles enter /// </summary> private async Task HandleEnter() { var command = Sb.ToString(); //cache the executing command if (!string.IsNullOrWhiteSpace(command) && (CommandCache.Count == 0 || CommandCache[CommandCache.Count - 1] != command)) { CommandCache.Add(command); } ResetPreviousCommandCacheIndex(); //finalise the line with Prompt and command as it was... Console.Write(Environment.NewLine); //and redirect the command handling to the cmd handler try { await CmdHandler.HandleCommand(command); } catch (Exception ex) { Console.WriteLine(); ConsoleEx.WriteErr("Uncaught exception occurred:"); while (ex != null) { ConsoleEx.WriteLine(ex.Message, ConsoleColor.DarkMagenta); ConsoleEx.WriteLine(new string('-', 25), ConsoleColor.DarkMagenta); ex = ex.InnerException; } Console.WriteLine(); } //check if should continue watching cmd or can quit if (!CmdHandler.Exit()) { //wipe out string builder Sb.Clear(); PrintPrompt(); } }
/// <summary> /// 查询并根据结果创建目标类型的实例。 /// SQL命中的记录必须为1行,否则抛出异常。 /// </summary> /// <typeparam name="T">查询的目标类型。</typeparam> /// <param name="client"><see cref="IDbClient"/>的实例。</param> /// <param name="sql">SQL语句。</param> /// <param name="param">记录SQL参数的对象。</param> /// <param name="commandType">命令的类型。</param> /// <param name="timeout">命令的超时时间,单位毫秒。0为不指定。</param> /// <returns>目标类型的实例。</returns> /// <exception cref="IncorrectResultSizeException">当SQL命中的记录行数不为 1。</exception> public static T ForceGet <T>(this IDbClient client, string sql, object param = null, CommandType commandType = CommandType.Text, int timeout = 0) { var paramType = param == null ? null : param.GetType(); var id = new CommandIdentity(client.ConnectionString, sql, commandType, paramType, typeof(T)); var cache = CommandCache.Get(id); if (cache != null) { return(client.ForceGet((IMapper <T>)cache.Mapper, cache.Sql, cache.Params(client, param), commandType, timeout)); } cache = CreateCacheItem(sql, commandType, param); var dbParam = cache.Params(client, param); var rows = client.Rows(sql, dbParam, commandType, timeout); var rowCount = 0; var res = default(T); using (var iter = rows.GetEnumerator()) { if (iter.MoveNext()) { var mapper = MapperParser.Parse <T>(iter.Current); cache.Mapper = mapper; CommandCache.Set(id, cache); res = mapper.MapRow(iter.Current, 1); rowCount++; } while (iter.MoveNext()) { rowCount++; } } if (rowCount == 1) { return(res); } throw new IncorrectResultSizeException(sql, CommandType.Text, dbParam, 1, rowCount); }
public override ICommand CreateGetListCommand <T>(IFilterCriteria criteria) { Type typeT = typeof(T); string uniqueId = "232FDED0-6C97-40B4-930F-FC190124D181"; if (!CommandCache.ContainsKey(string.Format(CACHE_KEY, uniqueId, typeT.FullName))) { Anito.Data.Schema.TypeTable schemaTable = Provider.GetSchema(typeT); Command sqlCommand = new Command(); sqlCommand.SqlCommand.CommandText = string.Format( "{0} {1} {2} {3}", SELECT, SelectColumnsStatement(typeT), FROM, schemaTable.ViewSource ); CommandCache.Add(string.Format(CACHE_KEY, uniqueId, typeT.FullName), sqlCommand); } return(CommandCache[string.Format(CACHE_KEY, uniqueId, typeT.FullName)]); }
/// <summary> /// /// </summary> public static unsafe void SetHdrMetadata(this SharpVk.Device extendedHandle, SharpVk.Khronos.Swapchain[] swapchains, SharpVk.Multivendor.HdrMetadata[] metadata) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Swapchain * marshalledSwapchains = default(SharpVk.Interop.Khronos.Swapchain *); SharpVk.Interop.Multivendor.HdrMetadata *marshalledMetadata = default(SharpVk.Interop.Multivendor.HdrMetadata *); commandCache = extendedHandle.commandCache; if (swapchains != null) { var fieldPointer = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Swapchain>(swapchains.Length).ToPointer()); for (int index = 0; index < (uint)(swapchains.Length); index++) { fieldPointer[index] = swapchains[index]?.handle ?? default(SharpVk.Interop.Khronos.Swapchain); } marshalledSwapchains = fieldPointer; } else { marshalledSwapchains = null; } if (metadata != null) { var fieldPointer = (SharpVk.Interop.Multivendor.HdrMetadata *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Multivendor.HdrMetadata>(metadata.Length).ToPointer()); for (int index = 0; index < (uint)(metadata.Length); index++) { metadata[index].MarshalTo(&fieldPointer[index]); } marshalledMetadata = fieldPointer; } else { marshalledMetadata = null; } SharpVk.Interop.Multivendor.VkDeviceSetHdrMetadataDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceSetHdrMetadataDelegate>("vkSetHdrMetadataEXT", "instance"); commandDelegate(extendedHandle.handle, (uint)(swapchains?.Length ?? 0), marshalledSwapchains, marshalledMetadata); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> public static unsafe void NextSubpass2(this SharpVk.CommandBuffer extendedHandle, SharpVk.Khronos.SubpassBeginInfo subpassBeginInfo, SharpVk.Khronos.SubpassEndInfo subpassEndInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.SubpassBeginInfo *marshalledSubpassBeginInfo = default(SharpVk.Interop.Khronos.SubpassBeginInfo *); SharpVk.Interop.Khronos.SubpassEndInfo * marshalledSubpassEndInfo = default(SharpVk.Interop.Khronos.SubpassEndInfo *); commandCache = extendedHandle.commandCache; marshalledSubpassBeginInfo = (SharpVk.Interop.Khronos.SubpassBeginInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SubpassBeginInfo>()); subpassBeginInfo.MarshalTo(marshalledSubpassBeginInfo); marshalledSubpassEndInfo = (SharpVk.Interop.Khronos.SubpassEndInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SubpassEndInfo>()); subpassEndInfo.MarshalTo(marshalledSubpassEndInfo); SharpVk.Interop.Khronos.VkCommandBufferNextSubpass2Delegate commandDelegate = commandCache.Cache.vkCmdNextSubpass2KHR; commandDelegate(extendedHandle.handle, marshalledSubpassBeginInfo, marshalledSubpassEndInfo); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void DisplayPowerControl(this SharpVk.Device extendedHandle, SharpVk.Khronos.Display display, SharpVk.Multivendor.DisplayPowerInfo displayPowerInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DisplayPowerInfo *marshalledDisplayPowerInfo = default(SharpVk.Interop.Multivendor.DisplayPowerInfo *); commandCache = extendedHandle.commandCache; marshalledDisplayPowerInfo = (SharpVk.Interop.Multivendor.DisplayPowerInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DisplayPowerInfo>()); displayPowerInfo.MarshalTo(marshalledDisplayPowerInfo); SharpVk.Interop.Multivendor.VkDeviceDisplayPowerControlDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceDisplayPowerControlDelegate>("vkDisplayPowerControlEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledDisplayPowerInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void DebugMarkerSetObjectTag(this SharpVk.Device extendedHandle, SharpVk.Multivendor.DebugMarkerObjectTagInfo tagInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugMarkerObjectTagInfo *marshalledTagInfo = default(SharpVk.Interop.Multivendor.DebugMarkerObjectTagInfo *); commandCache = extendedHandle.commandCache; marshalledTagInfo = (SharpVk.Interop.Multivendor.DebugMarkerObjectTagInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugMarkerObjectTagInfo>()); tagInfo.MarshalTo(marshalledTagInfo); SharpVk.Interop.Multivendor.VkDeviceDebugMarkerSetObjectTagDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceDebugMarkerSetObjectTagDelegate>("vkDebugMarkerSetObjectTagEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledTagInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
public ConsoleBase(ILineColorProvider colorProvider, ILogger logger = null) { if (colorProvider == null) throw new ArgumentNullException("colorProvider"); this.colorProvider = colorProvider; Header = new ConsoleLabelCollection(); logBuffer = new CircularBuffer<string>(256); AttachLogger(logger); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true); Editor = new TextEditor(512); if (!DesignMode) { scroller = new ScrollHelper(ScrollUp, ScrollDown); } CmdCache = new CommandCache(); }
public void SetUp() { theCache = new CommandCache(); }