Handle_cast not working using mResourceAllocator; offscreen rendering and VkImage, VkImageView #8134
Replies: 4 comments 7 replies
-
I also implemented a function directly in the VulkanDriver.cpp file using DriverApi.inc definition in case the stream command processor had some background mechanisms or whatnot, like it needed to be used in order to get the object pointer from handle ID. `void VulkanDriver::getNativeTextureFromHandle(HwTexture* nativeTexture, backend::TextureHandle textureHandle) {
} |
Beta Was this translation helpful? Give feedback.
-
currently i'm keeping a map of textures in VulkanDriver.cpp that I can access correctly from the application facing side, using the handleId; I"m guessing this is what mResourceAllocator accomplishes, but wasn't getting the correct texture between beginFrame, endFrame |
Beta Was this translation helpful? Give feedback.
-
I think the custom "platform/swapchain" is your best bet here. We don't really expose the VkImage to the "frontend" (i.e. client API). What issue did you run into with the semaphores? It could be something we could address. (Whereas passing VkImage through to the client is much less likely to be a formal API). |
Beta Was this translation helpful? Give feedback.
-
@poweifeng I'd like to ask a similar question - do you plan to add Vulkan support for @aguerrieri82 provided a sample implementation at #7617, but there was never any follow up. Is this feasible? |
Beta Was this translation helpful? Give feedback.
-
I am attempting to get Skia and Filament working together; I have been modifying the source code slightly here and there and making progress to understand how the modules and mechanisms are engineered. Super appreciate the interesting programming, lots of great security practices!
I was able to get something working with swapchain custom backend context being passed in, though ran into an issue with accessing Semaphores of drawing completion on filament end. I did a search and decided to try offscreen render textures as that seems a great long term and simplified solution.
I am able to create a render target and assign it a texture. What is the best way to get the underlying VkImage or resource ... originally I thought downcast<> would solve the issue, though it still requires an addition getHandle to get to the Vulkan implementation of that resource. I modified some source to get access to the mResourceAllocator to handle_cast<> as I seen in the DriverApi, VulkanDriver implementation.
The goal being to render the offscreen render target using a separate external vulkan implementation. Like I mentioned previously I have been able to have it working when rendering directly to the swapchains that are being passed using a custom backend context, though would like to learn as much as I can.
VulkanTexture* vulkanTexture = vulkan_driver->mResourceAllocator.handle_cast<VulkanTexture*>(texture_->getHwHandle());
This returns a vulkanTexture incorrectly; I also tried HwTexture*. I verified the vulkan_driver is correct and so is the mResourceAllocator it points to.
Is there a system way of using a handle_cast?? Also, my understanding of how mResourceAllocator is working with the handle id, led me to verify that the VulkanResources in this case, VulkanTextures are being created in VulkanDriver.
any help is appreciated, I hope I can learn enough to start contributing down the road, so excuse me if my questions are out of line or not clear.
Beta Was this translation helpful? Give feedback.
All reactions