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