Mesa (staging/20.0): intel: Add _const versions of prog_data cast helpers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 20 18:56:31 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: e16cb98ce2e8c2b3396d179532f1351f927078ea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e16cb98ce2e8c2b3396d179532f1351f927078ea

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Apr 15 16:05:43 2020 -0500

intel: Add _const versions of prog_data cast helpers

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4597>
(cherry picked from commit e003104605f506333d2ac8a9c2baf9f04eaebb81)

---

 .pick_status.json                 |  2 +-
 src/intel/compiler/brw_compiler.h | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4f3fd2dc2b9..ca7d4d1554b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1021,7 +1021,7 @@
         "description": "intel: Add _const versions of prog_data cast helpers",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 35977475406..3b7a599c337 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -1245,11 +1245,16 @@ union brw_any_prog_data {
    struct brw_cs_prog_data cs;
 };
 
-#define DEFINE_PROG_DATA_DOWNCAST(stage)                       \
-static inline struct brw_##stage##_prog_data *                 \
-brw_##stage##_prog_data(struct brw_stage_prog_data *prog_data) \
-{                                                              \
-   return (struct brw_##stage##_prog_data *) prog_data;        \
+#define DEFINE_PROG_DATA_DOWNCAST(stage)                                   \
+static inline struct brw_##stage##_prog_data *                             \
+brw_##stage##_prog_data(struct brw_stage_prog_data *prog_data)             \
+{                                                                          \
+   return (struct brw_##stage##_prog_data *) prog_data;                    \
+}                                                                          \
+static inline const struct brw_##stage##_prog_data *                       \
+brw_##stage##_prog_data_const(const struct brw_stage_prog_data *prog_data) \
+{                                                                          \
+   return (const struct brw_##stage##_prog_data *) prog_data;              \
 }
 DEFINE_PROG_DATA_DOWNCAST(vue)
 DEFINE_PROG_DATA_DOWNCAST(vs)



More information about the mesa-commit mailing list