From 8d66c452900915f9086d18e2deffc6a64607bdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 20 Sep 2022 10:59:25 +0300 Subject: [PATCH] intel/common: clamp sample location coordinate range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applications may use out-of-range values, driver is responsible for clamping to implementation-dependent sample location coordinate range. Without clamp we hit assert when packing 3DSTATE_SAMPLE_PATTERN if application attempts to use bigger value than 0.9375. util_bitpack_ufixed: Assertion `min <= v && v <= max' failed. Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/common/intel_sample_positions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/common/intel_sample_positions.h b/src/intel/common/intel_sample_positions.h index b8d09a5bdb1..66ce0d0786b 100644 --- a/src/intel/common/intel_sample_positions.h +++ b/src/intel/common/intel_sample_positions.h @@ -67,8 +67,8 @@ intel_get_sample_positions(int samples) */ #define INTEL_SAMPLE_POS_ELEM(prefix, arr, sample_idx) \ -prefix##sample_idx##XOffset = arr[sample_idx].x; \ -prefix##sample_idx##YOffset = arr[sample_idx].y; +prefix##sample_idx##XOffset = CLAMP(arr[sample_idx].x, 0.0, 0.9375); \ +prefix##sample_idx##YOffset = CLAMP(arr[sample_idx].y, 0.0, 0.9375); #define INTEL_SAMPLE_POS_1X_ARRAY(prefix, arr)\ INTEL_SAMPLE_POS_ELEM(prefix, arr, 0);