Browse Source

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 <alyssa.rosenzweig@collabora.com>
master
Alyssa Rosenzweig 7 years ago
parent
commit
5fe58271b2

+ 11
- 1
src/gallium/drivers/panfrost/pan_context.c View File

@@ -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");
}

+ 4
- 0
src/gallium/drivers/panfrost/pan_screen.c View File

@@ -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;

+ 9
- 5
src/panfrost/include/panfrost-job.h View File

@@ -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 */

Loading…
Cancel
Save