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 <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-31 09:08:07 -07:00
parent cf6cad3922
commit 3e47a1181b
3 changed files with 8 additions and 3 deletions

View File

@ -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),

View File

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

View File

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