Repository navigation
fix(agc): pick float or integer sampler border colours from the paired images - #3220
Merged
adriadam10 merged 2 commits intoOct 11, 2026
Merged
Conversation
…d images Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…Border Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
|
Checked the binding builder, sampler cache key, disk cache and tests; the S# border behaviour matches hardware (measured on gfx1035: UNORM opaque black → alpha 1.0f, UINT opaque white → 1,1,1,1). One fix added as a separate commit: Merging once CI is green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DecodeSamplerResourcemaps the S#BORDER_COLOR_TYPEvalues 0, 1 and 2 toVK_BORDER_COLOR_INT_TRANSPARENT_BLACK,INT_OPAQUE_BLACKandINT_OPAQUE_WHITE, whatever the sampler is used with. Vulkan returns poison when the border colour class doesn't match the view (Instruction/Format/Sampler/Image View Validation): "The samplerborderColoris an integer type and the image viewformatis not one of theVkFormatinteger types or a stencil component of a depth/stencil format", and the reverse for a float border on a non-float view. On GFX10 the hardware field doesn't depend on the format; radv maps the FLOAT and INT variants to the sameBORDER_COLOR_TYPE.The problem shows on real devices. On main, sampling a black
8_8_8_8_UNORMtexture outside [0, 1] withCLAMP_BORDERand an opaque black border returns alpha 0 instead of 1.0. This happens on an RTX 4070 and on an Intel Raptor Lake-S iGPU:Shadow maps are the usual case, since they clamp to a white border so that lookups outside the map read as lit.
Each sampler descriptor now carries
samplerIntegerBorder, which picks between the FLOAT and INT border colours:DescriptorBindingBuilderalready sorts the images paired with a guest sampler into the two physical sampler elements (samplerModes). It now also notes whether those images have an integer numeric class.DecodeSamplerResource,SamplerCache::Get, the binding pack and the shader disk cache.FormatVersionmoves to 25.ShaderResources::applyAnisoOverriderebuilds samplers for single-level images, soSamplerSourcekeeps the flag and passes it again there.Tests:
agc_driver_image_sample_border_color(new) samples outside a8_8_8_8_UNORMand a8_8_8_8_UINTtexture with each border type and checks (0,0,0,0), (0,0,0,1) and (1,1,1,1) as floats and as integers. Two more cases sample withANISO_OVERRIDEand anisotropic filters, which go throughapplyAnisoOverride.RunGuestSamplerResourceTestsexpects FLOAT borders by default and INT withintegerBorder.ShaderDiskCacheround trip covers the new flag.Found while comparing AnyPS5's S# decoding with Mesa's
gfx10-rsrc.json/navi10_enum.hand the Vulkan spec. The field decode itself is right; only the Vulkan colour class is wrong.This is #2392 again, which was closed by the intake pause. Rebased onto current main: it now sits beside #1487's
forceDegammaPairedparameter and theapplyAnisoOverridefrom 17d9efc.Overlap:
VK_BORDER_COLOR_INT_OPAQUE_BLACKandVK_BORDER_COLOR_FLOAT_OPAQUE_BLACK, so the two fit together.samplerModesloop inDescriptorBindingBuilderand theShaderDiskCachetest binding, and feat(agc): accept texel offsets with unnormalized sampler coordinates #822 also bumpsFormatVersion. All three already conflict with main; this adds conflicts on neighbouring lines, so whichever lands second needs a short rebase. With feat(agc): implement image and sampler tables indexed at runtime offsets #757, a sampler paired with an image table doesn't know the images' class; leaving it out ofpairSamplerkeeps the FLOAT border there.Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7, CI configure flags, main at d31b57a (rebased onto 6040a96, which only splits
agc_driver_flat_apertures):agc_driver_image_sample_border_color,agc_driver_image_sample_aniso_override,agc_driver_image_sample_shared_sampler,agc_driver_graphicsandagc_shader_disk_cachepass with--repeat until-fail:3on an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU.agc_driver_image_sample_border_colorfail on both GPUs:8_8_8_8_UNORM opaque white border: thread 0 component 0 is 0x00000000, expected 0x3f800000.agc_driver_graphicsalso fails, withunnormalized clamp-to-border S# decoded incorrectly.8_8_8_8_UINT opaque black border: thread 0 component 3 is 0x00000000, expected 0x00000001(0x000000ffon the Intel iGPU).applyAnisoOverridewithout the flag:8_8_8_8_UINT opaque white border under ANISO_OVERRIDE: thread 0 component 0 is 0x00000000, expected 0x00000001.-j 8: 759/759 passed in three runs.guest_filesystemneeds Developer Mode for its symlinks, which this machine doesn't have. In a fourth run,agc_driver_draw_cache_reuseexited with0xc0000374once. It binds no samplers, and it passed 35 times on its own.tools/check_conventions.pypasses.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