nir/lower_blend: Make sure we're not passed scaled formats

SCALED formats are interpreted as floats, but not in the usual [0, 1]
or [-1, 1] range, meaning that the blend lowering logic can't directly
apply to those. Assert that the format being passed is not a scaled
format.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13060>
This commit is contained in:
Boris Brezillon 2021-09-06 12:24:29 +02:00
parent 15b4cab4d5
commit 3e07b8d4f8

View file

@ -364,10 +364,12 @@ nir_lower_blend_instr(nir_builder *b, nir_instr *instr, void *data)
/* Blend the two colors per the passed options */
nir_ssa_def *blended = src;
if (options->logicop_enable)
if (options->logicop_enable) {
blended = nir_blend_logicop(b, *options, rt, src, dst);
else if (!util_format_is_pure_integer(options->format[rt]))
} else if (!util_format_is_pure_integer(options->format[rt])) {
assert(!util_format_is_scaled(options->format[rt]));
blended = nir_blend(b, *options, rt, src, options->src1, dst);
}
/* Apply a colormask */
blended = nir_color_mask(b, options->rt[rt].colormask, blended, dst);