internal VulkanGraphicsFence(VulkanGraphicsDevice device) : base(device) { _vulkanFence = new ValueLazy <VkFence>(CreateVulkanFence); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsBuffer(GraphicsBufferKind kind, D3D12GraphicsHeap graphicsHeap, ulong offset, ulong size, ulong stride) : base(kind, graphicsHeap, offset, size, stride) { _d3d12Resource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12Resource); _d3d12ResourceState = new ValueLazy <D3D12_RESOURCE_STATES>(GetD3D12ResourceState); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsBuffer(D3D12GraphicsDevice graphicsDevice, GraphicsBufferKind kind, ulong size, ulong stride) : base(graphicsDevice, kind, size, stride) { _d3d12Resource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12Resource); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsPipeline(VulkanGraphicsDevice device, VulkanGraphicsPipelineSignature signature, VulkanGraphicsShader?vertexShader, VulkanGraphicsShader?pixelShader) : base(device, signature, vertexShader, pixelShader) { _vulkanPipeline = new ValueLazy <VkPipeline>(CreateVulkanPipeline); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsTexture(GraphicsTextureKind kind, D3D12GraphicsHeap graphicsHeap, ulong offset, ulong size, ulong width, uint height, ushort depth) : base(kind, graphicsHeap, offset, size, width, height, depth) { _d3d12Resource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12Resource); _d3d12ResourceState = new ValueLazy <D3D12_RESOURCE_STATES>(GetD3D12ResourceState); _ = _state.Transition(to: Initialized); }
public VulkanGraphicsProvider() { if (DebugModeEnabled) { var optionalExtensionNamesData = AppContext.GetData(OptionalExtensionNamesDataName) as string; optionalExtensionNamesData += ";VK_EXT_debug_report"; AppDomain.CurrentDomain.SetData(OptionalExtensionNamesDataName, optionalExtensionNamesData); var optionalLayerNamesData = AppContext.GetData(OptionalLayerNamesDataName) as string; optionalLayerNamesData += ";VK_LAYER_LUNARG_standard_validation"; AppDomain.CurrentDomain.SetData(OptionalLayerNamesDataName, optionalLayerNamesData); } _engineName = GetEngineName(); _requiredExtensionNames = GetNames(RequiredExtensionNamesDataName); _optionalExtensionNames = GetNames(OptionalExtensionNamesDataName); _requiredLayerNames = GetNames(RequiredLayerNamesDataName); _optionalLayerNames = GetNames(OptionalLayerNamesDataName); _vulkanInstance = new ValueLazy <VkInstance>(CreateVulkanInstance); _graphicsAdapters = new ValueLazy <ImmutableArray <VulkanGraphicsAdapter> >(GetGraphicsAdapters); _ = _state.Transition(to: Initialized);
internal D3D12GraphicsPipeline(D3D12GraphicsDevice graphicsDevice, D3D12GraphicsPipelineSignature signature, D3D12GraphicsShader?vertexShader, D3D12GraphicsShader?pixelShader) : base(graphicsDevice, signature, vertexShader, pixelShader) { _d3d12PipelineState = new ValueLazy <Pointer <ID3D12PipelineState> >(CreateD3D12GraphicsPipelineState); _ = _state.Transition(to: Initialized); }
public D3D12GraphicsProvider() { _dxgiFactory = new ValueLazy <Pointer <IDXGIFactory2> >(CreateDxgiFactory); _graphicsAdapters = new ValueLazy <ImmutableArray <D3D12GraphicsAdapter> >(GetGraphicsAdapters); _ = _state.Transition(to: Initialized); }
public void ValueLazy() { for (int i = 0; i < N; i++) { _ = new ValueLazy <int>(() => i); } }
internal D3D12GraphicsPipelineSignature(D3D12GraphicsDevice device, ReadOnlySpan <GraphicsPipelineInput> inputs, ReadOnlySpan <GraphicsPipelineResource> resources) : base(device, inputs, resources) { _d3d12RootSignature = new ValueLazy <Pointer <ID3D12RootSignature> >(CreateD3D12RootSignature); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsBuffer(VulkanGraphicsDevice graphicsDevice, GraphicsBufferKind kind, ulong size, ulong stride) : base(graphicsDevice, kind, size, stride) { _vulkanBuffer = new ValueLazy <VkBuffer>(CreateVulkanBuffer); _vulkanDeviceMemory = new ValueLazy <VkDeviceMemory>(CreateVulkanDeviceMemory); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsTexture(GraphicsTextureKind kind, VulkanGraphicsHeap graphicsHeap, ulong offset, ulong size, ulong width, uint height, ushort depth) : base(kind, graphicsHeap, offset, size, width, height, depth) { _vulkanImage = new ValueLazy <VkImage>(CreateVulkanImage); _vulkanImageView = new ValueLazy <VkImageView>(CreateVulkanImageView); _vulkanSampler = new ValueLazy <VkSampler>(CreateVulkanSampler); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsFence(D3D12GraphicsDevice graphicsDevice) : base(graphicsDevice) { _d3d12Fence = new ValueLazy <Pointer <ID3D12Fence> >(CreateD3D12Fence); _d3d12FenceSignalEvent = new ValueLazy <HANDLE>(CreateEventHandle); _ = _state.Transition(to: Initialized); }
/// <summary>Initializes a new instance of the <see cref="Application" /> class.</summary> /// <param name="compositionAssemblies">The <see cref="Assembly" /> instances to search for type exports.</param> /// <exception cref="ArgumentNullException"><paramref name="compositionAssemblies" /> is <c>null</c>.</exception> public Application(params Assembly[] compositionAssemblies) { ThrowIfNull(compositionAssemblies, nameof(compositionAssemblies)); _compositionAssemblies = compositionAssemblies; _parentThread = Thread.CurrentThread; _compositionHost = new ValueLazy <CompositionHost>(CreateCompositionHost); _ = _state.Transition(to: Stopped); }
internal VulkanGraphicsPipelineSignature(VulkanGraphicsDevice device, ReadOnlySpan <GraphicsPipelineInput> inputs, ReadOnlySpan <GraphicsPipelineResource> resources) : base(device, inputs, resources) { _vulkanDescriptorPool = new ValueLazy <VkDescriptorPool>(CreateVulkanDescriptorPool); _vulkanDescriptorSet = new ValueLazy <VkDescriptorSet>(CreateVulkanDescriptorSet); _vulkanDescriptorSetLayout = new ValueLazy <VkDescriptorSetLayout>(CreateVulkanDescriptorSetLayout); _vulkanPipelineLayout = new ValueLazy <VkPipelineLayout>(CreateVulkanPipelineLayout); _ = _state.Transition(to: Initialized); }
public XlibWindowProvider() { var vulkanRequiredExtensionNamesDataName = AppContext.GetData(VulkanRequiredExtensionNamesDataName) as string; vulkanRequiredExtensionNamesDataName += ";VK_KHR_surface;VK_KHR_xlib_surface"; AppDomain.CurrentDomain.SetData(VulkanRequiredExtensionNamesDataName, vulkanRequiredExtensionNamesDataName); _nativeHandle = new ValueLazy <GCHandle>(() => GCHandle.Alloc(this, GCHandleType.Normal)); _windows = new ThreadLocal <Dictionary <UIntPtr, XlibWindow> >(trackAllValues: true); _ = _state.Transition(to: Initialized); }
private XlibDispatchProvider() { _dispatchers = new ConcurrentDictionary <Thread, XlibDispatcher>(); _display = new ValueLazy <IntPtr>(CreateDisplayHandle); _defaultRootWindow = new ValueLazy <nuint>(GetDefaultRootWindow); _defaultScreen = new ValueLazy <Pointer <Screen> >(GetDefaultScreen); _atoms = new ValueLazy <nuint[]>(CreateAtoms); _supportedAtoms = new ValueLazy <nuint[]>(GetSupportedAtoms); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsAdapter(VulkanGraphicsProvider graphicsProvider, VkPhysicalDevice vulkanPhysicalDevice) : base(graphicsProvider) { AssertNotNull(vulkanPhysicalDevice, nameof(vulkanPhysicalDevice)); _vulkanPhysicalDevice = vulkanPhysicalDevice; _vulkanPhysicalDeviceProperties = new ValueLazy <VkPhysicalDeviceProperties>(GetVulkanPhysicalDeviceProperties); _name = new ValueLazy <string>(GetName); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsAdapter(D3D12GraphicsProvider provider, IDXGIAdapter1 *dxgiAdapter) : base(provider) { ThrowIfNull(dxgiAdapter, nameof(dxgiAdapter)); _dxgiAdapter = dxgiAdapter; _dxgiAdapterDesc = new ValueLazy <DXGI_ADAPTER_DESC1>(GetDxgiAdapterDesc); _name = new ValueLazy <string>(GetName); _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsContext(D3D12GraphicsDevice graphicsDevice, int index) : base(graphicsDevice, index) { _graphicsFence = new D3D12GraphicsFence(graphicsDevice); _waitForExecuteCompletionGraphicsFence = new D3D12GraphicsFence(graphicsDevice); _d3d12CommandAllocator = new ValueLazy <Pointer <ID3D12CommandAllocator> >(CreateD3D12CommandAllocator); _d3d12GraphicsCommandList = new ValueLazy <Pointer <ID3D12GraphicsCommandList> >(CreateD3D12GraphicsCommandList); _d3d12RenderTargetView = new ValueLazy <D3D12_CPU_DESCRIPTOR_HANDLE>(CreateD3D12RenderTargetDescriptor); _d3d12RenderTargetResource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12RenderTargetResource); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsContext(VulkanGraphicsDevice device, int index) : base(device, index) { _fence = new VulkanGraphicsFence(device); _waitForExecuteCompletionFence = new VulkanGraphicsFence(device); _vulkanCommandBuffer = new ValueLazy <VkCommandBuffer>(CreateVulkanCommandBuffer); _vulkanCommandPool = new ValueLazy <VkCommandPool>(CreateVulkanCommandPool); _vulkanFramebuffer = new ValueLazy <VkFramebuffer>(CreateVulkanFramebuffer); _vulkanSwapChainImageView = new ValueLazy <VkImageView>(CreateVulkanSwapChainImageView); _ = _state.Transition(to: Initialized); }
internal VulkanGraphicsAdapter(VulkanGraphicsService service, VkPhysicalDevice vulkanPhysicalDevice) : base(service) { AssertNotNull(vulkanPhysicalDevice); _vulkanPhysicalDevice = vulkanPhysicalDevice; _vulkanPhysicalDeviceMemoryProperties = new ValueLazy <VkPhysicalDeviceMemoryProperties>(GetVulkanPhysicalDeviceMemoryProperties); _vulkanPhysicalDeviceProperties = new ValueLazy <VkPhysicalDeviceProperties>(GetVulkanPhysicalDeviceProperties); _name = new ValueLazy <string>(GetName); _ = _state.Transition(to: Initialized); }
public Win32WindowProvider() { var vulkanRequiredExtensionNamesDataName = AppContext.GetData(VulkanRequiredExtensionNamesDataName) as string; vulkanRequiredExtensionNamesDataName += ";VK_KHR_surface;VK_KHR_win32_surface"; AppDomain.CurrentDomain.SetData(VulkanRequiredExtensionNamesDataName, vulkanRequiredExtensionNamesDataName); _classAtom = new ValueLazy <ushort>(CreateClassAtom); _nativeHandle = new ValueLazy <GCHandle>(CreateNativeHandle); _windows = new ThreadLocal <Dictionary <HWND, Win32Window> >(trackAllValues: true); _ = _state.Transition(to: Initialized); }
private XlibDispatchProvider() { _dispatchers = new ConcurrentDictionary <Thread, Dispatcher>(); _dispatcherExitRequestedAtom = new ValueLazy <UIntPtr>(CreateDispatcherExitRequestedAtom); _display = new ValueLazy <UIntPtr>(CreateDisplay); _systemIntPtrAtom = new ValueLazy <UIntPtr>(CreateSystemIntPtrAtom); _windowProviderCreateWindowAtom = new ValueLazy <UIntPtr>(CreateWindowProviderCreateWindowAtom); _windowWindowProviderAtom = new ValueLazy <UIntPtr>(CreateWindowWindowProviderAtom); _wmProtocolsAtom = new ValueLazy <UIntPtr>(CreateWmProtocolsAtom); _wmDeleteWindowAtom = new ValueLazy <UIntPtr>(CreateWmDeleteWindowAtom); _ = _state.Transition(to: Initialized); }
internal XlibWindow(XlibWindowProvider windowProvider) : base(windowProvider, Thread.CurrentThread) { _handle = new ValueLazy <nuint>(CreateWindowHandle); _properties = new PropertySet(); _title = typeof(XlibWindow).FullName !; _bounds = new Rectangle(float.NaN, float.NaN, float.NaN, float.NaN); _flowDirection = FlowDirection.TopToBottom; _readingDirection = ReadingDirection.LeftToRight; _isEnabled = true; _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsDevice(D3D12GraphicsAdapter graphicsAdapter, IGraphicsSurface graphicsSurface, int graphicsContextCount) : base(graphicsAdapter, graphicsSurface) { _idleGraphicsFence = new D3D12GraphicsFence(this); _d3d12CommandQueue = new ValueLazy <Pointer <ID3D12CommandQueue> >(CreateD3D12CommandQueue); _d3d12Device = new ValueLazy <Pointer <ID3D12Device> >(CreateD3D12Device); _d3d12RenderTargetDescriptorHeap = new ValueLazy <Pointer <ID3D12DescriptorHeap> >(CreateD3D12RenderTargetDescriptorHeap); _dxgiSwapChain = new ValueLazy <Pointer <IDXGISwapChain3> >(CreateDxgiSwapChain); _graphicsContexts = CreateGraphicsContexts(this, graphicsContextCount); _ = _state.Transition(to: Initialized); WaitForIdleGraphicsFence.Reset(); graphicsSurface.SizeChanged += OnGraphicsSurfaceSizeChanged;
internal VulkanGraphicsShader(VulkanGraphicsDevice device, GraphicsShaderKind kind, ReadOnlySpan <byte> bytecode, string entryPointName) : base(device, kind, entryPointName) { var bytecodeLength = (nuint)bytecode.Length; _vulkanShaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; _vulkanShaderModuleCreateInfo.codeSize = bytecodeLength; _vulkanShaderModuleCreateInfo.pCode = (uint *)Allocate(bytecodeLength); var destination = new Span <byte>(_vulkanShaderModuleCreateInfo.pCode, (int)bytecodeLength); bytecode.CopyTo(destination); _vulkanShaderModule = new ValueLazy <VkShaderModule>(CreateVulkanShaderModule); _ = _state.Transition(to: Initialized); }
internal Win32Window(Win32WindowService windowService) : base(windowService, Thread.CurrentThread) { _flowDirection = FlowDirection.TopToBottom; _readingDirection = ReadingDirection.LeftToRight; _handle = new ValueLazy <IntPtr>(CreateWindowHandle); _properties = new ValueLazy <PropertySet>(CreateProperties); _title = typeof(Win32Window).FullName !; _bounds = new Rectangle(float.NaN, float.NaN, float.NaN, float.NaN); _clientBounds = new Rectangle(float.NaN, float.NaN, float.NaN, float.NaN); _extendedStyle = WS_EX_OVERLAPPEDWINDOW; _style = WS_OVERLAPPEDWINDOW; _ = _state.Transition(to: Initialized); }
internal D3D12GraphicsDevice(D3D12GraphicsAdapter adapter, IGraphicsSurface surface, int contextCount) : base(adapter, surface) { _idleFence = new D3D12GraphicsFence(this); _d3d12CommandQueue = new ValueLazy <Pointer <ID3D12CommandQueue> >(CreateD3D12CommandQueue); _d3d12Device = new ValueLazy <Pointer <ID3D12Device> >(CreateD3D12Device); _d3d12Options = new ValueLazy <D3D12_FEATURE_DATA_D3D12_OPTIONS>(GetD3D12Options); _d3d12RenderTargetDescriptorHeap = new ValueLazy <Pointer <ID3D12DescriptorHeap> >(CreateD3D12RenderTargetDescriptorHeap); _dxgiSwapChain = new ValueLazy <Pointer <IDXGISwapChain3> >(CreateDxgiSwapChain); _memoryAllocator = new ValueLazy <D3D12GraphicsMemoryAllocator>(CreateMemoryAllocator); _cbvSrvUavDescriptorHandleIncrementSize = new ValueLazy <uint>(GetCbvSrvUavDescriptorHandleIncrementSize); _contexts = CreateContexts(this, contextCount); _ = _state.Transition(to: Initialized); WaitForIdleGraphicsFence.Reset(); surface.SizeChanged += OnGraphicsSurfaceSizeChanged;
internal VulkanGraphicsDevice(VulkanGraphicsAdapter graphicsAdapter, IGraphicsSurface graphicsSurface, int graphicsContextCount) : base(graphicsAdapter, graphicsSurface) { _presentCompletionGraphicsFence = new VulkanGraphicsFence(this); _vulkanCommandQueue = new ValueLazy <VkQueue>(GetVulkanCommandQueue); _vulkanCommandQueueFamilyIndex = new ValueLazy <uint>(GetVulkanCommandQueueFamilyIndex); _vulkanDevice = new ValueLazy <VkDevice>(CreateVulkanDevice); _vulkanRenderPass = new ValueLazy <VkRenderPass>(CreateVulkanRenderPass); _vulkanSurface = new ValueLazy <VkSurfaceKHR>(CreateVulkanSurface); _vulkanSwapchain = new ValueLazy <VkSwapchainKHR>(CreateVulkanSwapchain); _vulkanSwapchainImages = new ValueLazy <VkImage[]>(GetVulkanSwapchainImages); _graphicsContexts = CreateGraphicsContexts(this, graphicsContextCount); _ = _state.Transition(to: Initialized); PresentCompletionGraphicsFence.Reset(); graphicsSurface.SizeChanged += OnGraphicsSurfaceSizeChanged;