mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
nir/format_convert: Smash NaN to 0 in pack_r9g9b9e5()
I have no idea why I flipped the order of these to checks vs. the C code when I wrote the NIR helper. We need to deal with NaN first or else the fmin will smash NaN to MAX_RGB9E5 and it won't get handled as NaN. Fixes:9981709d8f("nir/format_convert: Add a function to pack RGB9_E5 formats") Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28793> (cherry picked from commit86aad90e2a) [Eric] swap `color` and `clamped`, see https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28793#note_2459681
This commit is contained in:
parent
78a1fdbb97
commit
2afbeefc47
2 changed files with 6 additions and 6 deletions
|
|
@ -304,7 +304,7 @@
|
|||
"description": "nir/format_convert: Smash NaN to 0 in pack_r9g9b9e5()",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "9981709d8f3cadf04950fae3ac6f34afdfd2d3fb",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -408,12 +408,12 @@ nir_format_pack_r9g9b9e5(nir_builder *b, nir_def *color)
|
|||
{
|
||||
/* See also float3_to_rgb9e5 */
|
||||
|
||||
/* First, we need to clamp it to range. */
|
||||
nir_def *clamped = nir_fmin(b, color, nir_imm_float(b, MAX_RGB9E5));
|
||||
/* First, get rid of negatives and NaN */
|
||||
nir_def *clamped = nir_bcsel(b, nir_ugt_imm(b, color, 0x7f800000),
|
||||
nir_imm_float(b, 0), color);
|
||||
|
||||
/* Get rid of negatives and NaN */
|
||||
clamped = nir_bcsel(b, nir_ugt_imm(b, color, 0x7f800000),
|
||||
nir_imm_float(b, 0), clamped);
|
||||
/* Clamp it to range. */
|
||||
clamped = nir_fmin(b, clamped, nir_imm_float(b, MAX_RGB9E5));
|
||||
|
||||
/* maxrgb.u = MAX3(rc.u, gc.u, bc.u); */
|
||||
nir_def *maxu = nir_umax(b, nir_channel(b, clamped, 0),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue