mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
On Mesa's ANV, put a by-region barrier before a draw in a pass whose vertex shader reads a storage buffer (#927)
On an Iris Xe with ANV the half-resolution particle pass drew campfire smoke and clouds as white or dark blobs and turned the sky white for single frames. Such draws read stale data inside the pass unless the sampler cache is invalidated first; a stall alone or the attachment flush alone does not help. The barrier is feedback_barrier, which the feedback loops already record inside passes. TOTK_ANV_VS_BARRIER (anv_vs_barrier) turns it off or on elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f17cad783
commit
4c95df372a
3 files changed
+19
-1
No files matched your search
+1
-1
@@ -33,7 +33,7 @@ static int save_ok = 1; // the last cfg_save_to wrote (o
|
||||
// logged as unknown. A new variable goes here too, or its ini key logs a harmless "unknown key" line, and gets a
|
||||
// description in totk.ini.example or docs/settings.md (tests/settings_doc_check.py checks both).
|
||||
static const char *const known[] = {
|
||||
"AB", "ABILITY_GUARD", "ADDR_REPORT", "AMIIBO_DIR", "ANISO", "APP_POOL", "ASPECT", "ASPECT_PATCH", "ASSUME_FOCUS", "ASTC", "ASTC_BC", "ASTC_TIME", "ASYNC_PREEMPT", "AUDIO", "AUDIO_CHANNELS", "AUDIO_DEVICE", "AUDIO_DRAIN_FIX", "AUDIO_OFF", "AUDIO_PREFILL_MS",
|
||||
"AB", "ABILITY_GUARD", "ADDR_REPORT", "AMIIBO_DIR", "ANISO", "ANV_VS_BARRIER", "APP_POOL", "ASPECT", "ASPECT_PATCH", "ASSUME_FOCUS", "ASTC", "ASTC_BC", "ASTC_TIME", "ASYNC_PREEMPT", "AUDIO", "AUDIO_CHANNELS", "AUDIO_DEVICE", "AUDIO_DRAIN_FIX", "AUDIO_OFF", "AUDIO_PREFILL_MS",
|
||||
"BACKGROUND_WINDOW", "BIND_A", "BIND_B", "BIND_DOWN", "BIND_L", "BIND_LCLICK", "BIND_LEFT", "BIND_LSTICK_DOWN", "BIND_LSTICK_LEFT",
|
||||
"BIND_LSTICK_RIGHT", "BIND_LSTICK_UP", "BIND_MINUS",
|
||||
"BIND_PLUS", "BIND_R", "BIND_RCLICK", "BIND_RIGHT", "BIND_RSTICK_DOWN", "BIND_RSTICK_LEFT", "BIND_RSTICK_RIGHT", "BIND_RSTICK_UP",
|
||||
|
||||
@@ -3328,6 +3328,21 @@ static void bi_done(VkExec *ex, const VkPipeInfo *info, const VkPipeState *s, co
|
||||
D->B.bi_valid = 1;
|
||||
}
|
||||
|
||||
// Mesa ANV (Intel iGPU, Linux): a draw whose vertex shader reads a storage buffer reads stale data inside a pass unless
|
||||
// the sampler cache is invalidated first: the half-resolution particle pass drew campfire smoke and clouds as white or
|
||||
// dark blobs and turned the sky white for single frames (#927). A by-region barrier before such a draw removes it
|
||||
// (0 of 1460 frames broken against 57 of 779, about 2 fps of 40 on an Iris Xe); a stall alone or the attachment flush
|
||||
// alone does not. TOTK_ANV_VS_BARRIER=0/1 forces it off or on.
|
||||
static int anv_vs_barrier(void) {
|
||||
static int on = -1;
|
||||
if (on < 0) {
|
||||
const char *e = cfg_get("TOTK_ANV_VS_BARRIER");
|
||||
on = e && *e ? strcmp(e, "0") != 0 : vk_caps.mesa && vk_ctx()->props.vendorID == 0x8086;
|
||||
rt_log("vk_exec: barrier before vertex-stage storage reads in a pass %s", on ? "on" : "off");
|
||||
}
|
||||
return on;
|
||||
}
|
||||
|
||||
// Pass, shaders, pipeline, fixed state and resources for a draw. 0: the draw is skipped.
|
||||
static int prepare_draw(VkExec *ex, int prim, int32_t count, int restart) {
|
||||
VkExecDraw *D = ex->draw;
|
||||
@@ -3540,6 +3555,8 @@ static int prepare_draw(VkExec *ex, int prim, int32_t count, int restart) {
|
||||
if (bim == 2) bi_census(ex, info, sp, bgt, bgb, bsg, sm_hit); // on counts nothing: it is what gets timed
|
||||
bind_resources(ex, info, bim ? bgt : NULL, bgb);
|
||||
if (fbl & ex->fb_dirty) feedback_barrier(ex);
|
||||
else if (ex->in_pass && anv_vs_barrier() && gfx_shader_resources(vs, GFX_RES_SSBO, &(const GfxShaderRes *){0}))
|
||||
feedback_barrier(ex);
|
||||
feedback_written(ex, sp);
|
||||
bind_vertex_buffers(ex);
|
||||
if (vk_dump_armed) vk_dump_draw(ex, sp, p, info);
|
||||
|
||||
Reference in new issue
Block a user