Files
AC6_recomp/thirdparty/rexglue-sdk/src/graphics/flags.cpp
T
Dipshet bb4f4855ac Fix invisible missile/jet trails (stale vertex-buffer residency)
Missile/jet trail position history is a fixed guest-address ring, so its
vertex fetch constants never change and the command processor's
vertex_buffer_states_ address cache skipped RequestRange forever, the GPU
copy of the trail history froze at zero (trails invisible) while CPU memory was
correct.

Register a physical-memory invalidation callback that flags when the CPU writes
watched GPU-visible memory, and drop the cached vertex-buffer states at the next
draw so the ring's pages get re-uploaded. Also notify those callbacks from the
access-violation page-recovery path (xmemory), since a recovered page becomes
read-write and would otherwise never fault again to report the write. Gated by
ac6_fix_trails (default ON).
2026-07-08 02:14:02 +03:00

63 lines
3.0 KiB
C++

/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*
* @modified Tom Clay, 2026 - Adapted for ReXGlue runtime
*/
#include <rex/graphics/flags.h>
#include <rex/logging.h>
#include <rex/ui/renderdoc_api.h>
REXCVAR_DEFINE_BOOL(gpu_allow_invalid_fetch_constants, false, "GPU",
"Allow invalid fetch constants");
REXCVAR_DEFINE_BOOL(native_2x_msaa, true, "GPU", "Enable native 2x MSAA");
REXCVAR_DEFINE_BOOL(depth_float24_round, false, "GPU", "Round float24 depth values");
REXCVAR_DEFINE_BOOL(depth_float24_convert_in_pixel_shader, false, "GPU",
"Convert float24 depth in pixel shader");
REXCVAR_DEFINE_BOOL(depth_transfer_not_equal_test, true, "GPU",
"Use not-equal test for depth transfer");
REXCVAR_DEFINE_BOOL(gamma_render_target_as_unorm16, true, "GPU",
"Use R16G16B16A16_UNORM for gamma render targets (more accurate than sRGB)")
.lifecycle(rex::cvar::Lifecycle::kHotReload);
REXCVAR_DEFINE_STRING(dump_shaders, "", "GPU", "Path to dump shaders to");
REXCVAR_DEFINE_BOOL(use_fuzzy_alpha_epsilon, true, "GPU",
"Use approximate compare for alpha test values to prevent "
"flickering on NVIDIA graphics cards");
REXCVAR_DEFINE_BOOL(vfetch_index_rounding_bias, false, "GPU/Shader",
"Apply small epsilon bias to vertex fetch indices before "
"flooring to fix black triangles caused by RCP precision");
REXCVAR_DEFINE_BOOL(draw_resolution_scaled_texture_offsets, true, "GPU/Shader",
"Scale texture offsets with draw resolution");
REXCVAR_DEFINE_BOOL(gpu_debug_markers, false, "GPU",
"Insert debug markers into GPU command streams for tools "
"like PIX and RenderDoc. Automatically enabled when "
"RenderDoc is detected.");
REXCVAR_DEFINE_BOOL(ac6_fix_trails, true, "AC6",
"Fix invisible missile/jet trails: drop stale cached vertex-buffer "
"residency so the GPU copy of AC6's fixed-address trail history ring "
"refreshes when the CPU writes it. On by default.");
bool IsGpuDebugMarkersEnabled() {
static bool cached = false;
static bool result = false;
if (!cached) {
cached = true;
if (REXCVAR_GET(gpu_debug_markers)) {
result = true;
REXLOG_INFO("GPU debug markers enabled via CVar");
} else {
auto renderdoc_api = rex::ui::RenderDocAPI::CreateIfConnected();
if (renderdoc_api) {
result = true;
REXLOG_INFO("GPU debug markers auto-enabled (RenderDoc detected)");
}
}
}
return result;
}