mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
panfrost: disable round_to_nearest_even for NEAREST samplers
When round_to_nearest_even is enabled with NEAREST filtering, texture
coordinates near texel boundaries (e.g. 0.9999999404) can be incorrectly
rounded up to the next texel instead of being floor()'d.
According to OpenCL spec section 8.2, for CLK_FILTER_NEAREST:
i = address_mode((int)floor(u))
Backport-to: *
Signed-off-by: Eric Guo <eric.guo@nxp.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
(cherry picked from commit c415134454)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
parent
1ed1dcb9db
commit
d6ef5d4882
2 changed files with 9 additions and 1 deletions
|
|
@ -934,7 +934,7 @@
|
|||
"description": "panfrost: disable round_to_nearest_even for NEAREST samplers",
|
||||
"nominated": true,
|
||||
"nomination_type": 4,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -227,6 +227,14 @@ panfrost_create_sampler_state(struct pipe_context *pctx,
|
|||
cfg.border_color_a = so->base.border_color.ui[3];
|
||||
|
||||
#if PAN_ARCH >= 6
|
||||
/*
|
||||
* Disabling round_to_nearest_even for NEAREST filters ensures proper
|
||||
* floor() behavior as required by OpenCL_C spec section 8.2.
|
||||
*/
|
||||
if (cso->mag_img_filter == PIPE_TEX_FILTER_NEAREST &&
|
||||
cso->min_img_filter == PIPE_TEX_FILTER_NEAREST)
|
||||
cfg.round_to_nearest_even = false;
|
||||
|
||||
if (cso->max_anisotropy > 1) {
|
||||
cfg.maximum_anisotropy = cso->max_anisotropy;
|
||||
cfg.lod_algorithm = MALI_LOD_ALGORITHM_ANISOTROPIC;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue