Skip to content

Commit 075610e

Browse files
committed
small fixes
1 parent 8abf48c commit 075610e

2 files changed

Lines changed: 0 additions & 59 deletions

File tree

sources/Spectrum/main.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ import Core;
1010
import FrameGraph;
1111
import FrameGraphDebug;
1212

13-
// FSR math headers required by PassDefault<Passes::FSR>
14-
#define A_CPU
15-
#include "../RenderSystem/Effects/FSR/ffx_a.h"
16-
#include "../RenderSystem/Effects/FSR/ffx_fsr1.h"
17-
18-
#include "../RenderSystem/FrameGraph/autogen/pass_defaults.h"
19-
2013
using namespace FrameGraph;
2114

2215
using namespace HAL;
@@ -560,58 +553,6 @@ class GraphRender : public Window, public GUI::user_interface
560553

561554
auto fence = graph.commit_command_lists();
562555

563-
// ---- One-shot debug screenshot ----------------------------------------
564-
// Fires on the first rendered frame. Uses HAL::texture_data::from_readback
565-
// + to_png() (same pattern as Test.HAL.TextureUtils) to write screenshot.png
566-
// in the working directory. Lets us verify GPU pixel output independently
567-
// of any swapchain-presentation issues.
568-
{
569-
static int screenshot_countdown = 1;
570-
if (screenshot_countdown > 0 && --screenshot_countdown == 0)
571-
{
572-
Log::get() << "[Screenshot] Starting readback on frame " << frame_counter << Log::endl;
573-
fence.wait(); // ensure GPU finished rendering + PRESENT transition
574-
575-
const auto& sc_res = swap_chain->get_current_frame();
576-
const auto& tex_desc = sc_res->get_desc().as_texture();
577-
const uint32_t w = tex_desc.Dimensions.x;
578-
const uint32_t h = tex_desc.Dimensions.y ? tex_desc.Dimensions.y : 1;
579-
const HAL::Format fmt = tex_desc.Format;
580-
581-
HAL::texture_data::ptr result;
582-
auto ss_list = HAL::Device::get().get_upload_list();
583-
auto fut = ss_list->get_copy().read_texture(
584-
sc_res.get(), 0,
585-
[&](std::span<std::byte> data, HAL::texture_layout layout)
586-
{
587-
result = HAL::texture_data::from_readback(w, h, fmt, data, layout);
588-
});
589-
// Restore swapchain to PRESENT layout so present() works correctly.
590-
// On Vulkan this barrier is deferred to end() so it always fires
591-
// after the copy regardless of recording order.
592-
ss_list->transition_present(sc_res.get());
593-
ss_list->execute_and_wait();
594-
fut.wait();
595-
596-
if (result)
597-
{
598-
auto png = result->to_png();
599-
if (!png.empty())
600-
{
601-
std::string png_str(reinterpret_cast<const char*>(png.data()), png.size());
602-
FileSystem::get().save_data("screenshot.png", png_str);
603-
Log::get() << "[Screenshot] Saved screenshot.png "
604-
<< w << "x" << h << Log::endl;
605-
}
606-
else
607-
Log::get() << "[Screenshot] to_png() returned empty" << Log::endl;
608-
}
609-
else
610-
Log::get() << "[Screenshot] from_readback() returned null" << Log::endl;
611-
}
612-
}
613-
// -----------------------------------------------------------------------
614-
615556
{
616557
PROFILE(L"reset");
617558
graph.reset();

workdir/screenshot.png

-156 KB
Binary file not shown.

0 commit comments

Comments
 (0)