graphics: resolve table border colors from the guest border color table #431
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!431
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/431/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@brandostrong on GitHub · 2026-08-31 21:54 UTC · original
brandostrong:fix/border-color-table-v2→main· +114 −34 · 7 files · 1 commits · closed without mergingSummary
TA_BC_BASE_ADDR/TA_CS_BC_BASE_ADDRinstead of discarding it.border_color_type == 3by reading that table and creating the sampler throughVK_EXT_custom_border_color.Problem
The sampler descriptor's border color type selects opaque black, transparent black, opaque white, or a color at an index into a guest-resident table. Kyty handled the first three and substituted transparent black for the fourth:
The registers holding the table base were already being parsed and then thrown away by
HwCtxIgnoreBorderColorTableAddr/HwUcIgnoreBorderColorTableAddr, so everything needed to do this properly was already reaching the command processor.Separately, every sampler was created with
VK_BORDER_COLOR_INT_*. Those are only valid for a sampler used with an integer-format image, and the surfaces sampled through this path are float or normalized. On the driver I tested it happens not to matter, since the int and float constants carry the same values, but the combination is unspecified.Implementation
TA_BC_BASE_ADDR/_HI(graphics) andTA_CS_BC_BASE_ADDR/_HI(compute) now store the table base, on both the direct and indirect paths. The two are kept as separate state and selected by shader stage, matching the register split.(lo << 8) | ((hi & 0xff) << 40). The remaining bits of the high register are reserved and masked off.kFromTablereads four floats atbase + border_color_ptr * 16and setsVK_BORDER_COLOR_FLOAT_CUSTOM_EXT.VK_EXT_custom_border_coloris enabled when the device exposes it with bothcustomBorderColorsandcustomBorderColorWithoutFormat; without it the transparent-black approximation stays, now rate-limited to four lines instead of one per sampler.FLOATconstants. Happy to split that into its own PR if you would rather keep the two apart.Sources
107:96 border color ptr,127:126 border color type— "Opaque-black, transparent-black, white, use border color ptr".gpu_defs.h(kTransBlack= 0 throughkFromTable= 3); the guide lists the kinds without assigning values.Testing
6453baf.RenderExecutorStencilBindingDiscovery, which fails identically on cleanorigin/main, so this adds no new failure.border_color_type == 3never occurs — a run with warnings unsuppressed logged zero "approximating table border color" lines. So the read is correct against the descriptor layout and by construction, not by observation. Titles that do not use the table are unaffected apart from the int-to-float constant change.Not covered
bc_swizzle(T#123:121), which reorders border color channels independently of thedst_sel_*fields, is not applied — identity ordering is assumed. Worth adding if a title turns up that both uses the table and sets it.AI assistance
Entirely
Pull request closed