Mesa (staging/21.2): nine: Fix assert in tx_src_param

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 30 17:14:46 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 8b4a8972a88794ab12b2046865821dc973d71039
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b4a8972a88794ab12b2046865821dc973d71039

Author: Thomas H.P. Andersen <phomes at gmail.com>
Date:   Wed Jul 14 14:51:26 2021 +0200

nine: Fix assert in tx_src_param

A previous commit cleaned up the asserts but the last part of
this assert looks like it got mixed up. It should have allowed
param->rel for D3DSPR_INPUT if version is 3.0. Instead it does
&& on the enum value D3DSPR_ADDR which is of course always true,
with the version check. The result is that we miss input
validation with version 3.0.

Spotted by a compile warning

Fixes: 5974401a4ad ("st/nine: Regroup param->rel tests")
Reviewed-by: Axel Davy davyaxel0 at gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11880>
(cherry picked from commit 71a5bcb8658491dd62b9e620a9ce7f3bf7c8952b)

---

 .pick_status.json                        | 2 +-
 src/gallium/frontends/nine/nine_shader.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7aa82eb81fb..2c8d2f0a30a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -292,7 +292,7 @@
         "description": "nine: Fix assert in tx_src_param",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "5974401a4adba2373232fc72940db96c32bbb4b6"
     },
diff --git a/src/gallium/frontends/nine/nine_shader.c b/src/gallium/frontends/nine/nine_shader.c
index 6e1d470b404..613fe1ff3b6 100644
--- a/src/gallium/frontends/nine/nine_shader.c
+++ b/src/gallium/frontends/nine/nine_shader.c
@@ -1010,7 +1010,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
     struct ureg_dst tmp;
 
     assert(!param->rel || (IS_VS && param->file == D3DSPR_CONST) ||
-        (D3DSPR_ADDR && tx->version.major == 3));
+        (param->file == D3DSPR_INPUT && tx->version.major == 3));
 
     switch (param->file)
     {



More information about the mesa-commit mailing list