[GPU] Implement ZPD occlusion queries
Implements EVENT_WRITE_ZPD handling across shared CommandProcessor, D3D12, and Vulkan backends. This adds a shared report lifecycle. Reports can span submissions/render passes, split into multiple segments, and asynchronously retire. Reports can also survive same-slot reuse, which is critical for titles that aggressively recycle against a small pool. RTV/FBO use their respective host occlusion queries, whereas ROV/FSI use counter buffers instead, with shader helpers that are called from the translated PS, accumulating surviving MSAA sample coverage into active slots. Regardless of approach, results are copied to small, dedicated readbacks and fed through shared retirement. Fast mode writes speculative values and patches in resolved results later. Strict mode waits for real results with a small retire backstop so it doesn't spin forever when a report gets weird. Fake mode's fundamentals are unchanged, it just now uses XenosZPDReport memory helpers like all the modes do. Also adds optional sample count saturation for instances when attenuation isn't a one-for-one with real hardware, an optional alternate fast behavior that preserves cached zeroes (that can improve flare-heavy titles but might regress occlusion culling), and normalization for upscaling. QueryBatch is still unsupported other than a fake path that's enabled when a range is set via cvar.
This commit is contained in:
committed by
Radosław Gliński
parent
29311ddcdd
commit
fbd620c22b
@@ -59,21 +59,39 @@ DEFINE_bool(
|
||||
"when MSAA is used with fullscreen passes.",
|
||||
"GPU");
|
||||
|
||||
DEFINE_int32(query_occlusion_querybatch_range, 0,
|
||||
"Range of fake ZPD sample count values to cycle for titles that "
|
||||
"use D3D QueryBatch. 0 disables this behavior entirely. Any non-"
|
||||
"zero values should only be used if required for specific titles.",
|
||||
DEFINE_int32(occlusion_query_fake_lower_threshold, 80,
|
||||
"Lower end of the fake sample count value written on "
|
||||
"EVENT_WRITE_ZPD when real occlusion queries are disabled.\n"
|
||||
"-1 writes nothing, resulting in some games that sit and hang.\n"
|
||||
"0 means the fake result stays fully occluded.",
|
||||
"GPU");
|
||||
DEFINE_int32(query_occlusion_sample_lower_threshold, 80,
|
||||
"If set to -1 no sample counts are written, games may hang. Else, "
|
||||
"the sample count of every tile will be incremented on every "
|
||||
"EVENT_WRITE_ZPD by this number. Setting this to 0 means "
|
||||
"everything is reported as occluded.",
|
||||
DEFINE_int32(occlusion_query_fake_upper_threshold, 100,
|
||||
"Upper end of the fake sample count value written on "
|
||||
"EVENT_WRITE_ZPD when real occlusion queries are disabled.\n"
|
||||
"Keep this higher than occlusion_query_fake_lower_threshold.\n"
|
||||
"Ignored if occlusion_query_fake_lower_threshold is -1.",
|
||||
"GPU");
|
||||
DEFINE_int32(
|
||||
query_occlusion_sample_upper_threshold, 100,
|
||||
"Set to higher number than query_occlusion_sample_lower_threshold. This "
|
||||
"value is ignored if query_occlusion_sample_lower_threshold is set to -1.",
|
||||
DEFINE_bool(occlusion_query_fast_preserve_cached_zero, false,
|
||||
"Alternate fast ZPD behavior that allows saved zero results to be "
|
||||
"used for unresolved fast writes instead of forcing them visible.\n"
|
||||
"This can materially improve flare accuracy in titles that might "
|
||||
"otherwise need strict mode, but it also tends to break occlusion "
|
||||
"culling in some titles.",
|
||||
"GPU");
|
||||
DEFINE_int32(occlusion_query_querybatch_range, 0,
|
||||
"Range of fake sample count values to walk for titles using the "
|
||||
"D3D QueryBatch standard before wrapping back to "
|
||||
"occlusion_query_fake_lower_threshold.\n"
|
||||
"This shouldn't be changed from the default value of 0 (disabled) "
|
||||
"unless necessary for a specific title.",
|
||||
"GPU");
|
||||
DEFINE_double(
|
||||
occlusion_query_sample_count_saturation, 1.0,
|
||||
"Compress higher occlusion query sample counts before guest writeback.\n"
|
||||
"This can be useful if effects such as lens flares appear too strong.\n"
|
||||
"1.0 = default behavior\n"
|
||||
"0.0 = collapse all nonzero sample counts to 1\n"
|
||||
"Values around 0.90 are a good starting point for subtle tuning.",
|
||||
"GPU");
|
||||
|
||||
DEFINE_int32(anisotropic_override, -1,
|
||||
|
||||
Reference in New Issue
Block a user