From: Alyssa Rosenzweig Date: Fri, 27 Dec 2019 17:42:53 +0000 (-0500) Subject: panfrost: Implement remaining texture wrap modes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5fe58271b290ae747b2517bd223ebe9b682769ee;p=mesa.git panfrost: Implement remaining texture wrap modes Somehow we have native hardware for all of these. Suspected by staring at the bit pattern; confirmed by poking in various texture wrap modes into the textures mesa demo and seeing what happens. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 4c5308c8238..7421d54c42f 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -221,8 +221,9 @@ translate_tex_wrap(enum pipe_tex_wrap w) case PIPE_TEX_WRAP_REPEAT: return MALI_WRAP_REPEAT; - /* TODO: lower GL_CLAMP? */ case PIPE_TEX_WRAP_CLAMP: + return MALI_WRAP_CLAMP; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: return MALI_WRAP_CLAMP_TO_EDGE; @@ -232,6 +233,15 @@ translate_tex_wrap(enum pipe_tex_wrap w) case PIPE_TEX_WRAP_MIRROR_REPEAT: return MALI_WRAP_MIRRORED_REPEAT; + case PIPE_TEX_WRAP_MIRROR_CLAMP: + return MALI_WRAP_MIRRORED_CLAMP; + + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return MALI_WRAP_MIRRORED_CLAMP_TO_EDGE; + + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return MALI_WRAP_MIRRORED_CLAMP_TO_BORDER; + default: unreachable("Invalid wrap"); } diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 8c7672d3541..b2954c0751d 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -119,6 +119,10 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_SWIZZLE: return 1; + case PIPE_CAP_TEXTURE_MIRROR_CLAMP: + case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE: + return 1; + case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: return is_deqp ? 1 : 0; diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 8af66a8a306..6ec5a94199c 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1151,13 +1151,17 @@ struct bifrost_payload_fused { #define MALI_POSITIVE(dim) (dim - 1) -/* Used with wrapping. Incomplete (this is a 4-bit field...) */ +/* Used with wrapping. Unclear what top bit conveys */ enum mali_wrap_mode { - MALI_WRAP_REPEAT = 0x8, - MALI_WRAP_CLAMP_TO_EDGE = 0x9, - MALI_WRAP_CLAMP_TO_BORDER = 0xB, - MALI_WRAP_MIRRORED_REPEAT = 0xC + MALI_WRAP_REPEAT = 0x8 | 0x0, + MALI_WRAP_CLAMP_TO_EDGE = 0x8 | 0x1, + MALI_WRAP_CLAMP = 0x8 | 0x2, + MALI_WRAP_CLAMP_TO_BORDER = 0x8 | 0x3, + MALI_WRAP_MIRRORED_REPEAT = 0x8 | 0x4 | 0x0, + MALI_WRAP_MIRRORED_CLAMP_TO_EDGE = 0x8 | 0x4 | 0x1, + MALI_WRAP_MIRRORED_CLAMP = 0x8 | 0x4 | 0x2, + MALI_WRAP_MIRRORED_CLAMP_TO_BORDER = 0x8 | 0x4 | 0x3, }; /* Shared across both command stream and Midgard, and even with Bifrost */