mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-19 16:20:01 -04:00
Triforce v0.3.6
This commit is contained in:
@@ -46,9 +46,41 @@ struct SkinnedDraw {
|
||||
int itype = 0, count = 0, base_vertex = 0;
|
||||
uint64_t bones = 0, bones_size = 0; // (the palette: 3 x 4 row-major matrices, model space to the camera's world)
|
||||
uint64_t object = 0, object_size = 0; // (the object's buffer: its origin at 0x40)
|
||||
uint64_t camera = 0, camera_size = 0; // (the camera it was drawn with, the vertex stage's buffer 3: its view at 0, projection
|
||||
// at 0x70. Characters need not be drawn with the scene's: theirs is used for them)
|
||||
uint64_t program = 0;
|
||||
};
|
||||
void temporal_note_skinned_draw(const SkinnedDraw& k);
|
||||
/// nullptr: taken; else why not (vk_draw.cpp's RX_VK_DLSS_TRACE says it)
|
||||
const char* temporal_note_skinned_draw(const SkinnedDraw& k);
|
||||
|
||||
/// A draw into a scene-sized target whose vertex stage stores its positions (vk_shader.cpp's capture_position): what the
|
||||
/// motion needs to draw it again from the positions it stored this frame and the frame before (vk_temporal.cpp
|
||||
/// capture_motion: everything the game moves in its vertex shaders, bones or not)
|
||||
struct CaptureDraw {
|
||||
const Texture* depth = nullptr; // (its depth target: only the scene's are drawn again)
|
||||
uint64_t vbuf = 0; // (vertex stream 0's address: the draw's name across frames, with the rest)
|
||||
uint64_t ibuf = 0; // (its indices; itype dlss_actor::kNoIndices: none, vertex i is base_vertex + i)
|
||||
int itype = 0, count = 0, base_vertex = 0;
|
||||
uint64_t program = 0;
|
||||
uint64_t camera = 0, camera_size = 0; // (the vertex stage's uniform buffer 3: the camera it is drawn with, its jitter)
|
||||
VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
bool restart = false; // (primitive restart, as the draw has it)
|
||||
};
|
||||
/// Where such a draw's vertex stage stores its positions: CAPTURE_PUSH_OFFSET's push constants (address 0: nowhere)
|
||||
struct CaptureSlot {
|
||||
uint64_t address = 0;
|
||||
uint32_t first = 0, count = 0; // (the vertex index of the first slot, the slots)
|
||||
};
|
||||
/// The slot for a draw about to be recorded, when the chain wants its positions (*out left zero when not); the draw must be
|
||||
/// recorded after it, as it is described
|
||||
void temporal_capture_draw(const CaptureDraw& k, CaptureSlot* out);
|
||||
/// Whether draws are to store their positions at all now (an engine wanted, RX_VK_DLSS_ACTORS not 0 or bones): a draw
|
||||
/// that is not asks nothing more
|
||||
bool temporal_capture_wanted();
|
||||
|
||||
/// (local, RenoDX port) Whether f is the scene's colour format: the game's B10G11R11, or the RGBA16F the host chose for the
|
||||
/// run once an upscale's input was RGBA16F
|
||||
bool temporal_scene_format(VkFormat f);
|
||||
|
||||
/// A gameplay upscale's dispatch (program `key`; vk_draw.cpp's temporal_stand_in finds them: the 4/3 network fd029a317a9a4b94
|
||||
/// at the game's usual 3/4, the same-size pass 9dc98871eb7fc101 at full size, and one network of its own for each other
|
||||
@@ -59,6 +91,43 @@ void temporal_note_skinned_draw(const SkinnedDraw& k);
|
||||
bool temporal_upscale(VkCommandBuffer cmd, uint64_t key, bool known, Texture* in, VkImageView in_view, Texture* out,
|
||||
VkImageView out_view, uint32_t out_level);
|
||||
|
||||
/// NVIDIA DLAA before the game's bloom and tone mapping (RX_VK_DLSS_PRE=0: not). OoT's frame after the scene's last draw:
|
||||
/// the bloom's first pass samples the scene's colour target, the bloom's pyramid, one draw that adds the bloom and tone
|
||||
/// maps into another target, and the upscale's dispatch. Each draw (vk_draw.cpp) is asked here with its colour target 0
|
||||
/// and its program: true at the first draw after the scene's last (found by its program, as the frame before had it),
|
||||
/// where temporal_pre_tonemap is then to run, outside a pass. *late: a draw into the scene after the engine drew there, in
|
||||
/// a frame worth a dump (the first few such frames)
|
||||
bool temporal_pre_point(const Texture* color0, uint64_t program, bool* late = nullptr);
|
||||
/// The engine's frame there: the scene's linear HDR colour, the camera's depth and motion in, its picture back into the
|
||||
/// scene's colour target (returned: it was written), so the bloom and the tone mapping work from the anti-aliased scene.
|
||||
/// The upscale's dispatch of that frame then only copies (temporal_upscale). nullptr: nothing drawn, the dispatch draws
|
||||
Texture* temporal_pre_tonemap(VkCommandBuffer cmd);
|
||||
/// After it, each draw with one colour target (its size): true at the game's tone mapping draw (the first into a target
|
||||
/// of the scene's size and format that is not the scene: it samples the scene and the bloom) when the engine scaled up.
|
||||
/// The draw is then to be recorded once more before its own: into k's target at its size, sampling k->to_view (the
|
||||
/// engine's picture) wherever it samples k->from (the scene), so the tone mapped picture is made at the output's size.
|
||||
/// Its own recording still follows, for what the game reads of its target (its edge anti-aliasing, its light meter).
|
||||
/// false: nothing more to do (DLAA: the draw's own target is the picture, taken by the upscale's dispatch)
|
||||
struct TemporalRetarget {
|
||||
Texture* target = nullptr;
|
||||
VkImageView target_view = VK_NULL_HANDLE;
|
||||
uint32_t width = 0, height = 0;
|
||||
const Texture* from = nullptr;
|
||||
VkImageView to_view = VK_NULL_HANDLE;
|
||||
};
|
||||
bool temporal_pre_composite(const Texture* color0, uint32_t width, uint32_t height, TemporalRetarget* k);
|
||||
/// The upscale's dispatch as AMD FSR 3.1 has it (vk_fsr3.cpp fsr3_upscale; the chain's own engines are asked inside
|
||||
/// temporal_upscale): true when the output is written, because the picture was drawn before the bloom this frame. In a
|
||||
/// frame it was not, the point is learnt for the next (learn: this dispatch is known to be the scene's upscale), and false
|
||||
bool temporal_pre_dispatch(VkCommandBuffer cmd, Texture* in, VkImageView in_view, Texture* out, VkImageView out_view,
|
||||
uint32_t out_level, bool learn);
|
||||
/// Before that recording, outside a pass: the view it is to sample in place of k->to_view. The engine's picture, or that
|
||||
/// with what the game drew into the scene after the engine's pass added (OoT's lens flare is drawn there after the
|
||||
/// bloom's passes: shaders/dlss_merge.comp), which this records
|
||||
VkImageView temporal_pre_merged(VkCommandBuffer cmd);
|
||||
/// Whether that recording drew (not when its pipeline was not ready): the upscale's dispatch then has nothing to copy
|
||||
void temporal_pre_composited(bool drawn);
|
||||
|
||||
/// Once a frame (the game's present): after 120 frames without an upscale by an engine (off, or the upscale not taken) the
|
||||
/// engine's own state, the chain's images and deferred frees are let go, so their video memory comes back. Nothing to do
|
||||
/// costs one atomic load
|
||||
@@ -101,9 +170,10 @@ struct TemporalEngine {
|
||||
bool (*start)();
|
||||
/// Ready to scale rw x rh into ow x oh, made again when its sizes or settings changed (cmd: what that records). in_w and
|
||||
/// in_h: how large the inputs are to be (the most the render size can be for what it made). 1 ready, 2 ready and made
|
||||
/// just now (a new history), 0 not this frame (*why: the reason), -1 failed for good (*why too)
|
||||
int (*prepare)(VkCommandBuffer cmd, uint32_t rw, uint32_t rh, uint32_t ow, uint32_t oh, uint32_t* in_w, uint32_t* in_h,
|
||||
const char** why);
|
||||
/// just now (a new history), 0 not this frame (*why: the reason), -1 failed for good (*why too). hdr: the colour holds
|
||||
/// linear HDR values (an RGBA16F scene), not the LDR of TemporalFrame's color
|
||||
int (*prepare)(VkCommandBuffer cmd, uint32_t rw, uint32_t rh, uint32_t ow, uint32_t oh, bool hdr, uint32_t* in_w,
|
||||
uint32_t* in_h, const char** why);
|
||||
/// Records the frame: false when it failed (for good: the game's upscale from then on)
|
||||
bool (*evaluate)(VkCommandBuffer cmd, const TemporalFrame& f);
|
||||
/// What it made, let go (its feature or context): the chain unused for a while, or another engine chosen. Work in flight
|
||||
|
||||
Reference in New Issue
Block a user