Broken geometry on macOS Intel

Moderator: GZDoom Developers

_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Broken geometry on macOS Intel

Post by _mental_ »

I encountered a very specific hardware/driver issue, and I unable to fix it.

In very specific map spots with complex geometry, sector's floor and/or ceiling is rendered incorrectly.
The bug is limited to Intel Iris Pro integrated GPU and macOS. NVIDIA GPU in the same Mac isn't affected.
Screenshot_Doom_20190615_163522.jpg
Somehow, it's tightly coupled with sky rendering. When sky is visible, everything is correct.
Both screenshots were taken in the same map spot with slightly different angle.
Screenshot_Doom_20190615_163526.jpg
It's this map from Vinesauce Doom Mapping Contest II: Hellectric Boogaloo.

Code: Select all

-iwad doom2 -file bloodmind90x.-.Fists.in.Blood.2.by.Bloodmind90x.aka.Hevn.Demonic.pk3 +map map01 +warp 540 920 -nomonsters +noclip +god
With gl_no_skyclear CVAR set, broken geometry persists regardless of sky portal in view.
Curiously enough, Metal GPU capture in Xcode shows recorded frame without an issue.

At the moment, I have no idea what else I can check. Any advice will greatly appreciated.
You do not have the required permissions to view the files attached to this post.
dpJudas
 
 
Posts: 2890
Joined: Sat May 28, 2016 1:01 pm

Re: Broken geometry on macOS Intel

Post by dpJudas »

I'm not really sure what could be causing this. It renders the entire scene in one render pass where it switches between pipeline objects (unless flushed, but then its starts a new immediately after). Inside a single subpass (which we only have one) the render order is guaranteed without a need for the application to set up any barriers.

My best bet would be an uninitialized variable, or a state variable that doesn't get reset properly. But which one? It looks like on the first screenshot that some vertex gets the wrong position as the textures don't match. It doesn't look completely corrupted though as the texture change makes it seem like a different valid vertex got used instead. Which primitive draw type does the ceiling use?
dpJudas
 
 
Posts: 2890
Joined: Sat May 28, 2016 1:01 pm

Re: Broken geometry on macOS Intel

Post by dpJudas »

If the draw type for the ceiling is DT_TriangleFan there's also the possibility that this line doesn't get executed. It could perhaps leave it in a situation where the drawIndexed call isn't using DT_Triangles as expected. It might be worth extending it with a mPipelineKey.DrawType != DT_Triangles check, just in case that's the reason.
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Re: Broken geometry on macOS Intel

Post by _mental_ »

That broken ceiling is rendered via triangle list. Also, floor of the same sector uses triangles too, but it's rendered properly.

At first, I suspected a bug in MoltenVK or in specific render state we have for it.
Although, it's not the case as everything is rendered correctly on the same Mac using NVIDIA GPU.
Validation layers are silent regardless of active graphics hardware.
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Re: Broken geometry on macOS Intel

Post by _mental_ »

I tested with Vulkan Portability Implementation instead of MoltenVK, and the bug still persist.
The issue isn't caused by particular Vulkan implementation but most likely by Intel Metal driver.

Curiously enough, I found a workaround by occasional. Addition of the following code after this line fixes broken geometry.

Code: Select all

GetRenderState()->EnableTexture(false);
GetRenderState()->Draw(DT_TriangleStrip, 0, 0, false);
Calling VkRenderState::Apply() without "drawing" zero primitives didn't do the trick. Honestly, I have no idea what's going on here.
dpJudas
 
 
Posts: 2890
Joined: Sat May 28, 2016 1:01 pm

Re: Broken geometry on macOS Intel

Post by dpJudas »

My best theory right now is unfortunately still that VkRenderStateMolten::Draw might be messing up some state. It doesn't really match well with the evidence you've presented so far though. Only other theory I got is driver error, but that doesn't help us much. :(
_mental_
 
 
Posts: 3784
Joined: Sun Aug 07, 2011 4:32 am

Re: Broken geometry on macOS Intel

Post by _mental_ »

Overridden Draw() in VkRenderStateMolten doesn’t explain why it works correctly with NVIDIA GPU.
Actually, I can play with this function, I’m not sure what should be changed here exactly.

Return to “Vulkan Renderer Bugs”