IRSMsoso
Topic Author
Posts: 4
Joined: 22 Oct 2023, 01:08

Vulkan Confusion

01 Nov 2023, 04:29

I'm having some trouble integrating with Vulkan & GLFW using the VKRenderDevice implementation provided in NoesisApp/Render. Is there some kind of documentation or example on how to do this? So far I've just kind of been stumbling and guessing as to how to use it, mostly based on what's available in VKFactory. Here's what I'm currently doing:

Initialization:
  • Initialize GLFW with window
  • Initialize Vulkan (Instance, Surface, Physical Device, Device, Graphics Queue/Index, Render Queue/Index, Swapchain, Renderpass, Swapchain Images/Views/Buffers, Command pool, Command Buffers, Semaphores/Fences, with 2 frames in flight. It works with an empty render pass that just clears the screen.
  • Initialize Noesis (Set handler, Set license, Init, set theme providers with embedded xaml and font, loaded a default theme application resources, Create view from that xaml, set flags). After these I fill in VKFactory::InstanceInfo and VKFactory::CreateDevice. Then VKFactory::SetRenderPass(), and finally view->GetRenderer()->Init(renderDevice).
  • Spawn a renderThread that continually calls DrawFrame(), then in the main loop I continually glfwPollEvents() and view->Update(glfwGetTime()).
Rendering:
  • View->update() is being called from main thread.
  • For Vulkan drawing (DrawFrame) I wait for fences, acquire next swapchain image, reset my fence, reset my command buffer, then call the following:
    VkFactory::SetCommandBuffer() with command buffer that I reset, frame number that ticks up every pass, and a safeFrameNumber that is equal to frameNumber - framesInFlight.
    view->GetRenderer()->UpdateRenderTree();
    view->GetRenderer()->RenderOffscreen();
    view->GetRenderer()->Render();
    Finally, vkQueueSubmit() and vkQueuePresentKHR().
This is yielding a ton of validation layers and nothing drawn, so I must have some misunderstanding on how to use the Vulkan implementation given. Any and all info/advice/resources is super appreciated!

Thanks.
 
User avatar
jsantos
Site Admin
Posts: 3938
Joined: 20 Jan 2012, 17:18
Contact:

Re: Vulkan Confusion

01 Nov 2023, 10:27

All our examples (with the exception of IntegrationGLUT that is only GL) render using Vulkan with the command line --render VK.

You can for example try with HelloWorld and debug how the context and renderer are being used.

Have you tried that?
 
IRSMsoso
Topic Author
Posts: 4
Joined: 22 Oct 2023, 01:08

Re: Vulkan Confusion

01 Nov 2023, 13:37

Ah, not sure how I missed that. I now see where it chooses which context to use, and the VKRenderContext has the info about implementation that I want. Thanks!
 
IRSMsoso
Topic Author
Posts: 4
Joined: 22 Oct 2023, 01:08

Re: Vulkan Confusion

02 Nov 2023, 09:16

I now have a setup very similar to VKRenderContext, and the validation errors are gone, but I'm not getting anything drawn. I can see by stepping through that I'm not getting any calls to VKRenderDevice::DrawBatch like the examples are. I'm guessing I'm doing something aside from vulkan-specific stuff wrong but it's hard to tell since I can't step through Noesis.dll code like I can NoesisApp.dll. Is there an obvious reason why this would happen?
 
User avatar
jsantos
Site Admin
Posts: 3938
Joined: 20 Jan 2012, 17:18
Contact:

Re: Vulkan Confusion

02 Nov 2023, 13:35

Are you resizing the view?
 
IRSMsoso
Topic Author
Posts: 4
Joined: 22 Oct 2023, 01:08

Re: Vulkan Confusion

02 Nov 2023, 21:17

Yep, that was it. Thanks!

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests