mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-06 13:30:00 +00:00
A draw served through a relocated entry can also be a stage data hit on the same stage. lookupDraw builds the stage data result first: patchDataWords copies the variant's compiled result and refreshes the flattened SRT data words. Only afterwards does draw apply the relocation's shaderDataPatches, and only to matched[i]->compiled. programResults[i] prefers stageData[i].compiled, so the stage was drawn with the push constants and ShaderData user-word slots of the donor draw. Pointers the shader reads at run time, which relocation had moved, kept the donor's old values. After applying a variant's shaderDataPatches, the stage data result of the same stage is now rebuilt from the patched variant with the words the lookup refreshed, so it carries both the new user words and the refreshed data words. Variants without pending patches are skipped as before. Found by reading the hit path: patchDataWords copies *variant.compiled (VariantValidation.cpp) before applyShaderDataPatches replaces it (DrawRelocate.cpp), and Draw.cpp selects the stage data copy when one exists. Builds on Windows (MinGW GCC 15.2). A regression test that drives a relocated stage data hit is still to be added.