feat(agc): sample border colors from the border color table #1221
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1221"
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?
Imported from boykopovar/AnyPS5. Originally posted by awake-devel on 2026-10-07T18:07:09Z.
What
Closes #665.
A sampler with
BORDER_COLOR_TYPE3 whose clamp mode reads the border now takes its color from the border color table instead of throwing.DecodeSamplerResourcedecodesBORDER_COLOR_PTR(S# word 3, bits 0–11). A table-type sampler that never reads its border decodes as before (#941).BORDER_COLOR_PTR× 16 (the radeonsi and radv layout), read from guest memory when the resources are built and passed toVK_EXT_custom_border_coloras a float custom color withVK_FORMAT_UNDEFINED. The extension is enabled when the device hascustomBorderColorsandcustomBorderColorWithoutFormat; without them such a sampler throws. Live custom-color samplers are counted againstmaxCustomBorderColorSamplers.TA_BC_BASE_ADDR/_HI(context 0x20/0x21, added toDrawKeyRegisters), dispatches takeTA_CS_BC_BASE_ADDR/_HI(user config 0x380/0x381), the pairs Mesa programs. A dispatch that reads a table color with the compute pair unset throws, with no fallback to the graphics pair, as agreed in #665.SamplerCachekey. AShaderResourcesthat holds such a sampler is not reusable, so it is never cached or recorded as a recipe, and a rewritten table or a moved base is read again by the next draw or dispatch.SamplerCacheis edited to name the entry as part of the key; no comment is added.#757 adds runtime-indexed sampler tables that create samplers without the entry. If both land, such a sampler throws instead of using a zero color: the decoded entry is an optional that
Samplerrequires.Tested
Linux (Arch, GCC 16.2.1), GeForce GTX 1050 Ti Max-Q, NVIDIA 580.178.04. Full
ctest: 400/400 pass.agc_driver_image_sample_border_color_table: compute dispatches sample a 13×7 RGBA8 image withimage_sample_lz,image_sample_landimage_samplethrough point clamp-to-border table samplers, with unnormalized and normalized coordinates: table entries 0–3 (entry 3 holds the words ThisIsAkill dumped from PPSA21567 in #665), an entry rewritten between dispatches, a second table, and the rejections (no base, base past 48 bits, integer texture). Also passes withAPS5_NO_SAMPLER_CACHE=1. NVIDIA rounds the border color to the image's 8-bit precision (0.25 reads as 64/255), so the test allows half a step.agc_driver_graphics: decode tests for the pointer (bits 0–11, recorded only when a border mode reads it) and the captured PPSA21567 sampler; mock Vulkan tests that the entry reachesvkCreateSamplerbit for bit withVK_FORMAT_UNDEFINED, that a table-color build is not reusable while a fixed-color one is, and the device limit, missing extension and missing base. Each of these tests fails when the rule it covers is removed.VK_LAYER_KHRONOS_validation1.4.363.0 (core validation, errors and warnings): the full suite passes 400/400, and nothing this PR touches reports a message: the new test (with and withoutAPS5_NO_SAMPLER_CACHE=1),agc_driver_graphicsandagc_driver_emulated_color_compareare clean. As a control, leavingcustomBorderColorsandcustomBorderColorWithoutFormatout of device creation makes the new test reportVUID-VkSamplerCreateInfo-customBorderColors-04085andVUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04014(the test itself still passes on NVIDIA), so the layer does check these samplers.bvh64_intersect_ray,scalar_wide_loads,view_past_last_mip) report oneVUID-vkDestroyDevice-device-05137each: one or twoVkBuffer/VkDeviceMemorypairs still alive atvkDestroyDevice. They report the same onmain(cea1ef13) with the same object counts, so they predate this PR.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_018RNrNcixatky8U4LfC7Ew5
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T05:12:28Z.
Closing: no title samples through a table border colour on main. The table sampler from #665 clamps to the edge, and #941 already handles that. Please reopen when a title stops at the table border throw.
Pull request closed