intel/common: clamp sample location coordinate range

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 <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18696>
This commit is contained in:
Tapani Pälli
2022-09-20 10:59:25 +03:00
committed by Marge Bot
parent 3ce1db339d
commit 8d66c45290
+2 -2
View File
@@ -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);