Ralith/openxrs

Clarify expected "output" of vulkan example

str4d opened this issue · 1 comments

str4d commented

It's not entirely clear to me what the vulkan example is supposed to be rendering. When I run it with my Oculus Rift (OpenXR runtime: Oculus 1.52.0), I see the left eye viewport rendered entirely green, and the right eye viewport rendered entirely white. This suggests that at a minimum, multiview isn't working correctly (as IIUC that should cause the same image to be rendered across all viewports).

str4d commented

IIUC that should cause the same image to be rendered across all viewports

My understanding is incorrect, somewhat expectedly 😅 Multiview runs the same shaders twice, with gl_ViewIndex set to 0 or 1 depending on the particular viewport. Looking at the debug_pattern.frag shader:

color = vec4(screen_coords, gl_ViewIndex, 1);

The screen coordinates are being used as the (red, green) components of the colour, and gl_ViewIndex is being used as the blue component (I think, based on what I'm observing through the lenses; I'm new to shaders, and haven't yet learned how they connect to the pipeline settings). This generates a distinct colour gradient across each viewport.

The reason I didn't realise this earlier is that I thought the faint green->yellow (left) and blue->white (right) gradients were the lenses playing tricks on my eyes; the viewports are large enough that the intense portions of the gradient at the edges were obscured from the actual field of vision through the lens when wearing the headset.