Minor issue with clearing multiple viewports and some render bundle musings...

19 views
Skip to first unread message

Mark Sibly

unread,
Aug 9, 2023, 11:48:38 PM8/9/23
to Dawn Graphics
Hi,

I'm having a slight problem with drawing to multiple viewports (for VR): The 'clear' pass always clears the entire window, regardless of renderpass viewport, so by default, the right eye always ends up clearing whatever the left eye drew because it's drawn second!

It seems that setting the color and depth LoadOps to 'Load' instead of 'Clear' for the second clear pass fixes the problem, but this seems a little clunky - is this the right way to deal with this?

This is actually sort of related to render bundles - I didn't use to have this issue because before render bundles my render loop looked like this:

create command encoder
for each renderpass {
   for each camera {
      SetBindGroup 0,camera...
   }
}
end command encoder

...so there was only one clear pass anyway. But I have recently switched to 100% render bundles which has meant I've had to rewrite the render loop like this:

for each camera {
    upload camera uniforms  // Coz you can't use SetBindGroup with render bundles.
    create command encoder
    for each render pass {
        SetViewport...
        ExecuteBundles...
    }
    end command encoder
}

This is pretty awesome as it means I now have just *4*  render calls per render pass, but it does mean I have to upload camera uniforms instead of simply switching bind groups, which means the render passes have to go in the inner loop AFAICT which causes the problem with clearing above.

It also means I have to use writeBuffer to upload instance data instead of MapAsync and buffer staging, because again I'd need to use SetBindGroup to switch between double buffered staging buffers and I can't with render bundles. I have no complaints about the performance of writeBuffer as yet so perhaps it's a non issue, but I did get the impression staging buffers were the preferred way to go for performance. There used to be some docs in the repository about staging buffers but I can't find them now, perhaps the situation has changed?

Bye!
Mark

Corentin Wallez

unread,
Aug 11, 2023, 4:43:11 AM8/11/23
to Mark Sibly, Dawn Graphics
Hey Mark,

That's very good feedback, indeed there doesn't seem to be a way to use bundles for VR rendering without loading the render target and storing it again, which is wasteful. Using writeBuffer for small amounts of data should be fine for performance, but it'd definitely be better to not break the render pass. There is this idea that bundles should be able to inherit state but it's not done yet https://github.com/gpuweb/gpuweb/issues/382 maybe it's worth commenting with your usecase on the issue to put it on the group's radar.

Cheers,

Corentin

--
You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/72e6b853-5663-4b4e-8dd0-ff3019e13804n%40googlegroups.com.

Dominic Cerisano

unread,
Aug 11, 2023, 6:17:38 PM8/11/23
to Corentin Wallez, Mark Sibly, Dawn Graphics
In Rajawali (for Android) I was able to create a single orthonormalized screen quad (two tris) and perform left/right camera rendering in a single frame (60fps 5 years ago).
That, plus some spherical slerping to smooth out the camera quaternions resulted in a pretty good mobile VR experience.  But that was before Hooli-Con :(


Dominic Cerisano




NOTICE: Confidential message which may be privileged. Unauthorized use/disclosure prohibited. 
AVIS : Message confidentiel dont le contenu peut être privilégié. Utilisation/divulgation interdites sans permission. 


Reply all
Reply to author
Forward
0 new messages