VkImageCreateInfo imageCreateInfo = new VkImageCreateInfo() VkDedicatedAllocationImageCreateInfoNV dedicatedImageCreateInfo = new VkDedicatedAllocationImageCreateInfoNV() ĭedicatedImageCreateInfo.sType = VkStructureType.VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV ĭdicatedAllocation = false ĮxtMemoryImageInfo.pNext = &dedicatedImageCreateInfo ĭdicatedAllocation = true VkExternalMemoryImageCreateInfoNV extMemoryImageInfo = new VkExternalMemoryImageCreateInfoNV() ĮxtMemoryImageInfo.sType = VkStructureType.VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV ĮxtMemoryImageInfo.handleTypes = VkExternalMemoryHandleTypeFlagsNV.VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV Var vkGraphicsContext = graphicsContext as VKGraphicsContext īool dedicateMemoryExtension = true //extProperties.externalMemoryFeatures & VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV And wrote a method in Evergine to do use it. I found an interesting post by James Jones and Mathias Schott from Nvidia about how to use the VK_NV_external_memory Vulkan extension to open a DirectX11 shared texture. On the other hand, if you want to share the texture with a Vulkan context it is a little bit harder. So, you obtain the shared texture from the first app, and you can use it as a common texture in your app. This.SharedTexture = DX11Texture.FromDirectXTexture(dxGraphicsContext, sharedNativeTexture) Var sharedNativeTexture = (surfaceHandle) Var dxGraphicsContext = aphicsContext as DX11GraphicsContext Now is easy to use this texture from other DirectX 11 or 12 graphic contexts (second app) and open the texture the following way. Var sharedHandle = resource.SharedHandle ![]() Var resource = renderTarget.QueryInterface() Once you have the DirectX shared texture, you need to get his shared handle to reference from another graphic context. RenderTarget = ((DX11GraphicsContext)dx11GraphicsContext).DXDevice.CreateTexture2D(renderTargetDescription) SampleDescription = new SampleDescription(1, 0), OptionFlags = ResourceOptionFlags.Shared, Var renderTargetDescription = new Texture2DDescription DirectX shared resources are a special resource type that allows you to share a resource with another DirectX graphics context, even other processes. ![]() To achieve this goal, you need to use the DirectX graphics context in WPF app process and create a texture shared resource that use to draw in your WPF custom control. ![]() That allows us to reload or restart only the render process without closing the WPF app. Additionally, Evergine Studio architecture is compound by two applications, one WPF app only for UI purposes and another render process with the backend. WPF is a Microsoft user interface technology that uses DirectX9 to render its controls, so if you want to create an Evergine control in WPF it must render with DirectX. Evergine supports Vulkan and DirectX12 from its first official release 2021.11.17.2-preview, but the problem with adding them to Evergine Studio is that it is a WPF application. In the last weeks, I have been working on adding Vulkan and DirectX12 available backends to Evergine Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |