mirror of
https://github.com/InstanceBrick/nightcap.git
synced 2026-10-17 18:02:19 +02:00
Roblox's VR debug device renders both eyes into single-sample textures, so edges were jagged in the headset. When the eyes go to the runtime's swapchain, an FXAA draw now replaces the plain copy. It samples the eye directly, and re-encodes for sRGB swapchains so the guest's bytes round-trip exactly. Anything it cannot set up falls back to the copy. vr.anti_aliasing (fxaa, the default, or off) controls it. The SPIR-V is generated from shaders/vr by scripts/generate_vr_shaders.py and checked in, so builds need no shader compiler; a test checks it against the sources when glslc is installed. On a Quest 2 through SteamVR at 90 Hz (2244x2352 per eye) frame times did not change. Captured output keeps 97 to 98 percent of pixels byte-identical and the average brightness unchanged, and smooths the edges.
9 lines
245 B
GLSL
9 lines
245 B
GLSL
#version 450
|
|
// One triangle that covers the viewport; uv spans 0..1 over the target.
|
|
layout(location = 0) out vec2 uv;
|
|
|
|
void main() {
|
|
uv = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
|
gl_Position = vec4(uv * 2.0 - 1.0, 0.0, 1.0);
|
|
}
|