mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-21 10:09:59 -04:00
Run DLAA with native HDR too.
With hdr = native the game's output pass writes a 10-bit PQ target (A2B10G10R10), not the 8-bit sRGB one vk_dlaa_pass looked for, so DLAA never ran and frame generation had no depth or motion vectors for most frames. The native HDR picture's format is now named once (vk_hdr_native_picture) and taken by both DLAA and the HDR present. From a tester's fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,7 @@ void vk_hdr_metadata(VkSwapchainKHR sc, int new_sc);
|
|||||||
void vk_hdr_set_active(int on);
|
void vk_hdr_set_active(int on);
|
||||||
int vk_hdr_active(void);
|
int vk_hdr_active(void);
|
||||||
VkImage vk_hdr_encode(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]);
|
VkImage vk_hdr_encode(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]);
|
||||||
|
int vk_hdr_native_picture(VkFormat f); // vk_hdr_native, and f is the format of the game's PQ picture
|
||||||
VkImageView vk_hdr_ui_target(VkCommandBuffer cb, uint32_t w, uint32_t h);
|
VkImageView vk_hdr_ui_target(VkCommandBuffer cb, uint32_t w, uint32_t h);
|
||||||
void vk_hdr_ui_compose(VkCommandBuffer cb, VkImageView dst_view, VkFormat fmt, uint32_t w, uint32_t h);
|
void vk_hdr_ui_compose(VkCommandBuffer cb, VkImageView dst_view, VkFormat fmt, uint32_t w, uint32_t h);
|
||||||
void vk_hdr_to_srgb8(const uint8_t *in, uint8_t *out, size_t px, int a2r);
|
void vk_hdr_to_srgb8(const uint8_t *in, uint8_t *out, size_t px, int a2r);
|
||||||
|
|||||||
@@ -1370,6 +1370,12 @@ static int scene_color(VkFormat f) {
|
|||||||
// DLAA (DLSS's picture goes back into the light target, which the tonemap then reads).
|
// DLAA (DLSS's picture goes back into the light target, which the tonemap then reads).
|
||||||
static int srgb8(VkFormat f) { return f == VK_FORMAT_R8G8B8A8_SRGB || f == VK_FORMAT_B8G8R8A8_SRGB; }
|
static int srgb8(VkFormat f) { return f == VK_FORMAT_R8G8B8A8_SRGB || f == VK_FORMAT_B8G8R8A8_SRGB; }
|
||||||
|
|
||||||
|
// The output target DLAA runs at. With the game's own HDR (vk_hdr.c vk_hdr_native) the same pass, at the same point of
|
||||||
|
// the frame, tonemaps into its PQ picture (vk_hdr.c vk_hdr_native_picture) instead of the 8-bit sRGB one; matching sRGB
|
||||||
|
// alone left DLAA off for the whole run there (no frame anti-aliased) and with it the frame generation that takes
|
||||||
|
// DLAA's depth and motion.
|
||||||
|
static int output_target(VkFormat f) { return srgb8(f) || vk_hdr_native_picture(f); }
|
||||||
|
|
||||||
void vk_dlaa_pass(VkExec *ex) {
|
void vk_dlaa_pass(VkExec *ex) {
|
||||||
const VkExecTarget *c = &ex->color[0], *z = &ex->depth;
|
const VkExecTarget *c = &ex->color[0], *z = &ex->depth;
|
||||||
if (!dl_active() || D.done) return;
|
if (!dl_active() || D.done) return;
|
||||||
@@ -1420,7 +1426,7 @@ void vk_dlaa_pass(VkExec *ex) {
|
|||||||
if (one && c->width > D.color.width && c->height > D.color.height) {
|
if (one && c->width > D.color.width && c->height > D.color.height) {
|
||||||
D.ended = D.done = D.up = 1;
|
D.ended = D.done = D.up = 1;
|
||||||
evaluate(ex, c);
|
evaluate(ex, c);
|
||||||
} else if (one && srgb8(c->format) && c->width == D.color.width &&
|
} else if (one && output_target(c->format) && c->width == D.color.width &&
|
||||||
c->height == D.color.height) {
|
c->height == D.color.height) {
|
||||||
D.ended = D.done = 1;
|
D.ended = D.done = 1;
|
||||||
evaluate(ex, NULL);
|
evaluate(ex, NULL);
|
||||||
|
|||||||
@@ -667,10 +667,14 @@ static int init(VkCtx *c) {
|
|||||||
return H.ok = 1;
|
return H.ok = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The game's own HDR picture: PQ codes in A2B10G10R10, the format of NVN's RGB10A2 (vk_formats.c); no guest format
|
||||||
|
// becomes A2R10G10B10.
|
||||||
|
int vk_hdr_native_picture(VkFormat f) { return vk_hdr_native() && f == VK_FORMAT_A2B10G10R10_UNORM_PACK32; }
|
||||||
|
|
||||||
VkImage vk_hdr_encode(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]) {
|
VkImage vk_hdr_encode(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, const int crop[4]) {
|
||||||
VkCtx *c = vk_ctx();
|
VkCtx *c = vk_ctx();
|
||||||
// native HDR: the game's picture holds PQ codes already; the present scales it into the swapchain as it is
|
// native HDR: the game's picture holds PQ codes already; the present scales it into the swapchain as it is
|
||||||
if (vk_hdr_native() && (fmt == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || fmt == VK_FORMAT_A2R10G10B10_UNORM_PACK32)) {
|
if (vk_hdr_native_picture(fmt)) {
|
||||||
static int told;
|
static int told;
|
||||||
if (!told++) rt_log("hdr: native: the game's own HDR10 picture goes to the swapchain as it is");
|
if (!told++) rt_log("hdr: native: the game's own HDR10 picture goes to the swapchain as it is");
|
||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user