From 3e47a1181b7c5bc962380553c8c99a49a49f45d9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 31 Jul 2019 09:08:07 -0700 Subject: [PATCH] panfrost: Add MALI_SAMP_NORM_COORDS flag Corresponds to the normalized coordinates? flag on images in OpenCL and evidently also shows up in GL, so let's wire it in. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_context.c | 5 ++--- src/panfrost/include/panfrost-job.h | 5 +++++ src/panfrost/pandecode/decode.c | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 1915549f251..a72432de239 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1946,11 +1946,10 @@ panfrost_create_sampler_state( 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; + unsigned normalized = cso->normalized_coords ? MALI_SAMP_NORM_COORDS : 0; struct mali_sampler_descriptor sampler_descriptor = { - .filter_mode = min_filter | mag_filter | mip_filter - | 0x20, - + .filter_mode = min_filter | mag_filter | mip_filter | normalized, .wrap_s = translate_tex_wrap(cso->wrap_s), .wrap_t = translate_tex_wrap(cso->wrap_t), .wrap_r = translate_tex_wrap(cso->wrap_r), diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 0b633b02c2f..ffe1bf25aa4 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1198,6 +1198,11 @@ struct mali_texture_descriptor { #define MALI_SAMP_MIP_LINEAR_1 (1 << 3) #define MALI_SAMP_MIP_LINEAR_2 (1 << 4) +/* Flag in filter_mode, corresponding to OpenCL's NORMALIZED_COORDS_TRUE + * sampler_t flag. For typical OpenGL textures, this is always set. */ + +#define MALI_SAMP_NORM_COORDS (1 << 5) + /* Used for lod encoding. Thanks @urjaman for pointing out these routines can * be cleaned up a lot. */ diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index a556776b38b..2df3cbdc986 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -251,6 +251,7 @@ static const struct pandecode_flag_info sampler_flag_info [] = { FLAG_INFO(MIN_NEAREST), FLAG_INFO(MIP_LINEAR_1), FLAG_INFO(MIP_LINEAR_2), + FLAG_INFO(NORM_COORDS), {} }; #undef FLAG_INFO -- 2.30.2