Define independent temporal motion metadata and UV oracle

This commit is contained in:
Emil
2026-09-24 02:56:51 +03:00
parent 068f2e9af9
commit 17177357fb
6 changed files with 116 additions and 5 deletions
+7
View File
@@ -74,4 +74,11 @@ std::array<float, 2> temporal_jitter(std::uint64_t frame_index,
std::uint32_t viewport_width,
std::uint32_t viewport_height);
// Scene-local normalized UV motion, current minus previous. Both clips use
// their own jittered scene VP and the same local vertex. Invalid/behind-eye
// clips have no usable history; the shader writes velocity validity zero.
std::optional<std::array<float, 2>>
project_motion(const std::array<float, 4>& current_clip,
const std::array<float, 4>& previous_clip) noexcept;
} // namespace faset::render
+11 -3
View File
@@ -37,11 +37,19 @@ struct InstanceUpdate {
bool previous_valid{};
};
// GPU instance metadata: history valid, stable slot, then generation low/high.
// GPU instance metadata: x bits 0/1 separately mark previous HZB bounds and
// previous temporal transform; the other lanes carry stable slot/generation.
// A zero generation identifies an anonymous, untracked draw.
inline constexpr std::uint32_t gpu_hzb_history_bit = 1U;
inline constexpr std::uint32_t gpu_temporal_history_bit = 2U;
constexpr std::array<std::uint32_t, 4>
gpu_instance_metadata(const InstanceUpdate& update, bool history_compatible) noexcept {
return {update.previous_valid && history_compatible ? 1U : 0U, update.slot,
gpu_instance_metadata(const InstanceUpdate& update, bool hzb_compatible,
bool temporal_compatible = false) noexcept {
return {update.previous_valid
? (hzb_compatible ? gpu_hzb_history_bit : 0U) |
(temporal_compatible ? gpu_temporal_history_bit : 0U)
: 0U,
update.slot,
static_cast<std::uint32_t>(update.generation),
static_cast<std::uint32_t>(update.generation >> 32)};
}