nir: fix setting varying from uniform as flat

Here we just make sure we match the interpolation type on both
sides of the shader interface. Drivers like d3d12 are expecting
this.

Fixes: 9401990e6f ("nir/linker: set varying from uniform as flat")

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16003>
(cherry picked from commit 4b4bb46af4)
This commit is contained in:
Timothy Arceri 2022-04-18 13:53:21 +10:00 committed by Dylan Baker
parent 424c960492
commit a27af70c1b
2 changed files with 4 additions and 2 deletions

View file

@ -1291,7 +1291,7 @@
"description": "nir: fix setting varying from uniform as flat",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "9401990e6f7a4b024b3a62055339f71477b508d0"
},

View file

@ -1391,8 +1391,10 @@ nir_link_opt_varyings(nir_shader *producer, nir_shader *consumer)
/* The varying is loaded from same uniform, so no need to do any
* interpolation. Mark it as flat explicitly.
*/
if (in_var && in_var->data.interpolation <= INTERP_MODE_NOPERSPECTIVE)
if (in_var && in_var->data.interpolation <= INTERP_MODE_NOPERSPECTIVE) {
in_var->data.interpolation = INTERP_MODE_FLAT;
out_var->data.interpolation = INTERP_MODE_FLAT;
}
}
}