Fix clamp-to-border addressing mode
Previously we would check for out-of-range coordinates after filtering
to replace the sampled color with the border color. This is incorrect
as according to Vulkan 1.1 spec section 15.3.3. Texel Replacement the
replacement happens per texel, before filtering.
This is achieved by replacing out-of-range coordinates with -1, which
will get multiplied by pitch and slice for the second and third
coordinate respectively, but will remain negative. These negative
coordinates are then detected during sample fetch to look up the
texel at 0 instead, and then replace it with the border color.
Bug: b/129523279
Test: dEQP-VK.pipeline.image.*
Test: dEQP-VK.pipeline.sampler.*
Change-Id: I0949e6a4701285f7511bf2b1579bd8a303f2ddb6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30710
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Chris Forbes <chrisforbes@google.com>
Showing
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment