| 245 | } |
| 246 | |
| 247 | static glm::vec2 getFrameJitter() |
| 248 | { |
| 249 | ZoneScopedN(__FUNCTION__); |
| 250 | |
| 251 | if (g_frameConstants.taaRanThisFrame) |
| 252 | { |
| 253 | // We're post TAA in the frame. Must not add jitter or stuff will shake. |
| 254 | return glm::vec2(0, 0); |
| 255 | } |
| 256 | |
| 257 | glm::vec2 sampleOffset = hammersley2d((g_frameConstants.taaSampleIdx * 7u) % 16u, 16, 238308531); |
| 258 | sampleOffset -= 0.5f; |
| 259 | sampleOffset.x *= 2.0f / g_frameConstants.screenWidth; |
| 260 | sampleOffset.y *= 2.0f / g_frameConstants.screenHeight; |
| 261 | return sampleOffset; |
| 262 | } |
| 263 | |
| 264 | // Cache of jittered projection matrices calculated for the shared pixel and vertex constant buffers. |
| 265 | // The math to calculate them is quite expensive, so we cache them and only update when needed. |
no test coverage detected