Files
ReSkate/Engine/Core/Debug/protocol.h
T
AyeZeeBB f92d405979 GPU: after the GPU stops, the next three launches record its breadcrumbs (DRED) for the crash report
The device-removal watcher always runs, and the fatal handler notes a DXGI stop in gpu-breadcrumbs.txt. Crash reports carry a gpu.breadcrumbs tag (protocol 5).
2026-10-18 16:33:52 -05:00

47 lines
2.2 KiB
C++

#pragma once
#include <Windows.h>
#include <array>
#include <string>
namespace dingosdk::crash_report {
inline constexpr DWORD protocol_version = 5;
// Who asked for the dump: ReSkate's last-chance filter, or the game's own fatal handler about to
// write its dump (which it does without ever reaching that filter).
enum class CaptureSource : DWORD { unhandled_exception, game_fatal_handler };
inline constexpr DWORD capture_timeout_ms = 15000;
struct SharedReport {
DWORD version{protocol_version};
DWORD thread_id{};
EXCEPTION_POINTERS* exception{}; // Address in the parent; MiniDumpWriteDump uses ClientPointers=TRUE.
std::array<wchar_t, 4096> url{};
std::array<wchar_t, 32768> directory{};
std::array<wchar_t, 260> application{};
std::array<wchar_t, 32768> native_directory{};
// What the game was doing, for the report's tags: the level it loaded last, and the graphics
// card it renders on with its driver's version. Written by the game as they change, read by
// the helper after a crash (a torn read only spoils a tag).
std::array<wchar_t, 512> destination{};
std::array<wchar_t, 128> gpu_name{};
std::array<wchar_t, 32> gpu_driver{};
CaptureSource source{};
// Whether D3D12's record of the GPU's work (DRED) is on for this launch (gpu_breadcrumbs()).
DWORD gpu_breadcrumbs{};
};
// Explicitly inherited unnamed handles; no token or paths on the command line.
enum HandleIndex : std::size_t { mapping, requested, captured, stopping, ready, parent, handle_count };
struct Handle {
HANDLE value{};
Handle() = default;
explicit Handle(HANDLE handle) : value(handle) {}
~Handle() { if (value && value != INVALID_HANDLE_VALUE) CloseHandle(value); }
Handle(const Handle&) = delete;
Handle& operator=(const Handle&) = delete;
HANDLE release() { const auto result = value; value = nullptr; return result; }
};
inline std::wstring environment(const wchar_t* name) {
std::array<wchar_t, 32768> buffer{};
const auto size = GetEnvironmentVariableW(name, buffer.data(), static_cast<DWORD>(buffer.size()));
return size && size < buffer.size() ? std::wstring(buffer.data(), size) : std::wstring{};
}
}