summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-31 08:50:02 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-31 10:56:11 -0700
commitcf6cad3922f85127a29a8c1e49f980efcc5e9bac (patch)
tree1f5f941edd7030fcc00eb4e23cd07be976e6a9bd /src/gallium/drivers/panfrost
parent160795429d62d6eedcd2b8dc0c26887509b58e3e (diff)
panfrost: Simplify filter_mode definition
It's just a bit field containing some flags; there's no need for all the macro magic. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 8c2953cc219..1915549f251 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -315,27 +315,6 @@ translate_tex_wrap(enum pipe_tex_wrap w)
}
static unsigned
-translate_tex_filter(enum pipe_tex_filter f)
-{
- switch (f) {
- case PIPE_TEX_FILTER_NEAREST:
- return MALI_NEAREST;
-
- case PIPE_TEX_FILTER_LINEAR:
- return MALI_LINEAR;
-
- default:
- unreachable("Invalid filter");
- }
-}
-
-static unsigned
-translate_mip_filter(enum pipe_tex_mipfilter f)
-{
- return (f == PIPE_TEX_MIPFILTER_LINEAR) ? MALI_MIP_LINEAR : 0;
-}
-
-static unsigned
panfrost_translate_compare_func(enum pipe_compare_func in)
{
switch (in) {
@@ -1959,10 +1938,17 @@ panfrost_create_sampler_state(
/* sampler_state corresponds to mali_sampler_descriptor, which we can generate entirely here */
+ bool min_nearest = cso->min_img_filter == PIPE_TEX_FILTER_NEAREST;
+ bool mag_nearest = cso->mag_img_filter == PIPE_TEX_FILTER_NEAREST;
+ bool mip_linear = cso->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR;
+
+ unsigned min_filter = min_nearest ? MALI_SAMP_MIN_NEAREST : 0;
+ unsigned mag_filter = mag_nearest ? MALI_SAMP_MAG_NEAREST : 0;
+ unsigned mip_filter = mip_linear ?
+ (MALI_SAMP_MIP_LINEAR_1 | MALI_SAMP_MIP_LINEAR_2) : 0;
+
struct mali_sampler_descriptor sampler_descriptor = {
- .filter_mode = MALI_TEX_MIN(translate_tex_filter(cso->min_img_filter))
- | MALI_TEX_MAG(translate_tex_filter(cso->mag_img_filter))
- | translate_mip_filter(cso->min_mip_filter)
+ .filter_mode = min_filter | mag_filter | mip_filter
| 0x20,
.wrap_s = translate_tex_wrap(cso->wrap_s),