-
Notifications
You must be signed in to change notification settings - Fork 133
feat(vr): optimize SSGI VR #2005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| #include "Common/Color.hlsli" | ||
| #include "Common/FrameBuffer.hlsli" | ||
| #include "Common/GBuffer.hlsli" | ||
| #include "Common/Math.hlsli" | ||
| #include "Common/VR.hlsli" | ||
| #include "ScreenSpaceGI/common.hlsli" | ||
|
|
||
|
|
@@ -16,6 +15,10 @@ Texture2D<half4> srcPrevIlY : register(t7); // maybe half-res | |
| Texture2D<half2> srcPrevIlCoCg : register(t8); // maybe half-res | ||
| Texture2D<half4> srcPrevGISpecular : register(t9); // maybe half-res | ||
|
|
||
| #if defined(VR_STEREO_OPT) | ||
| Texture2D<uint> StereoOptModeTexture : register(t16); | ||
| #endif | ||
|
|
||
| RWTexture2D<float3> outRadianceDisocc : register(u0); | ||
| RWTexture2D<unorm float> outAccumFrames : register(u1); | ||
| RWTexture2D<float> outRemappedAo : register(u2); | ||
|
|
@@ -76,6 +79,16 @@ void readHistory( | |
|
|
||
| const float2 uv = (pixCoord + .5) * RCP_OUT_FRAME_DIM; | ||
| const uint eyeIndex = Stereo::GetEyeIndexFromTexCoord(uv); | ||
|
|
||
| #if defined(VR_STEREO_OPT) | ||
| if (eyeIndex == 1) { | ||
| uint2 fullResPx = uint2(uv * FrameDim); | ||
| uint mode = StereoOptModeTexture[fullResPx]; | ||
| if (mode == 1 || mode == 2) | ||
| return; | ||
| } | ||
|
Comment on lines
+83
to
+89
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reset the temporal outputs before taking this Eye 1 fast path. Unlike the 💡 Proposed fix `#if` defined(VR_STEREO_OPT)
if (eyeIndex == 1) {
uint2 fullResPx = uint2(uv * FrameDim);
uint mode = StereoOptModeTexture[fullResPx];
- if (mode == 1 || mode == 2)
- return;
+ if (mode == 1 || mode == 2) {
+#ifdef GI
+ outRadianceDisocc[pixCoord] = 0;
+#endif
+#ifdef TEMPORAL_DENOISER
+ outAccumFrames[pixCoord] = 1.0 / 255.0;
+ outRemappedAo[pixCoord] = 0;
+ outRemappedIlY[pixCoord] = 0;
+ outRemappedIlCoCg[pixCoord] = 0;
+ outRemappedPrevGISpecular[pixCoord] = 0;
+#endif
+ return;
+ }
}
`#endif`🤖 Prompt for AI Agents |
||
| #endif | ||
|
|
||
| const float2 screen_pos = Stereo::ConvertFromStereoUV(uv, eyeIndex); | ||
|
|
||
| float2 prev_screen_pos = screen_pos; | ||
|
|
@@ -127,7 +140,7 @@ void readHistory( | |
| prev_ao, prev_y, prev_co_cg, prev_ambient, accum_frames, prev_gi_specular, wsum); | ||
|
|
||
| if (wsum > 1e-2) { | ||
| float rcpWsum = rcp(wsum + EPSILON_WEIGHT_SUM); | ||
| float rcpWsum = rcp(wsum + 1e-10); | ||
| # ifdef TEMPORAL_DENOISER | ||
| prev_ao *= rcpWsum; | ||
| prev_y *= rcpWsum; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.