phr00t / FocusEngine

Focus Game Engine. This is Stride/Xenko fast-tracked for Phr00t's Software games. Improvements over the original Focus on Vulkan support, PC platforms, VR, performance & ease. Cherry-picks commits from other forks as needed.
MIT License
97 stars 11 forks source link

Minimized Vulkan Rendering with Intel HD 630 #51

Closed phr00t closed 5 years ago

phr00t commented 5 years ago

Rendering seems to be almost completely empty when using an Intel HD GPU & the Vulkan API. Oddly enough, a very small section in the upper left seems to render colors related to the scene, like if the buffer is a few pixels wide. However, I didn't see any obvious problems with render texture sizes while debugging (but I could have missed something). Empty areas are set to the clear color.

phr00t commented 5 years ago

When post processing filters are disabled, the screen is grey (seems to be the background color). There is still a small rectangle of scene-rendered pixels in the upper left:

small-render

phr00t commented 5 years ago

Might be related to image layouts?

https://www.reddit.com/r/vulkan/comments/8p5hye/intel_vs_nvidia_issue/

phr00t commented 5 years ago

RenderDoc captures of Intel HD frame & NVIDIA frame. Obvious problems arise during the first draw color pass. NVIDIA renders the scene fine at that step, while Intel makes the little dark rectangle in the corner:

RenderDoc-captures.zip

phr00t commented 5 years ago

Asking for help on Reddit here: https://www.reddit.com/r/vulkan/comments/bab4hc/small_rectangle_rendered_on_intel_hd_works_fine/

Khronos forum: https://community.khronos.org/t/small-rectangle-with-intel-hd-amd-nvidia-fine-please-help/103879

phr00t commented 5 years ago

Reddit to the rescue: "You appear to be ignoring Out Of Date / Sub Optimal returns from presentation.

Are you actually getting these return codes at all? Because if so you need to recreate your framebuffers etc. at the new size."

https://vulkan-tutorial.com/Drawing_a_triangle/Swap_chain_recreation#page_Suboptimal_or_out_of_date_swap_chain

phr00t commented 5 years ago

The result of presenting & getting the next image is masked if it isn't an error here:

https://github.com/phr00t/xenko/blob/master/sources/engine/Xenko.Graphics/Vulkan/SwapChainGraphicsPresenter.Vulkan.cs#L154

... and "suboptimal" swap chains are not errors. So, I modified SharpVulkan to see the result of these functions on Intel HD hoping for an answer -- unfortunately, these functions are returning "Success".

The idea was to recreate the swap buffers if there was a problem.. so I've been trying to recreate them anyway. Also unfortunately, recreating the swap buffers doesn't help (nothing changes in the rendering behavior).

wozeparrot commented 5 years ago

I can confirm that this also happens on a intel uhd 620.

phr00t commented 5 years ago

Fixed with https://github.com/phr00t/xenko/commit/44b9dee8ec2cc8df9de193e52ad3ef98b16a9ef5