Mesa (master): radeonsi: use #pragma pack to pack si_shader_key

Marek Olšák mareko at kemper.freedesktop.org
Tue Jun 27 17:02:18 UTC 2017


Module: Mesa
Branch: master
Commit: f9a7e7fe144767219d6722d79cc75330dc888106
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9a7e7fe144767219d6722d79cc75330dc888106

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Jun 20 01:21:19 2017 +0200

radeonsi: use #pragma pack to pack si_shader_key

sizeof(struct si_shader_key):
  Before reverting the 2 commits: 120 bytes
  After reverting the 2 commits: 128 bytes
  With #pragma pack: 107 bytes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/drivers/radeonsi/si_shader.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 185bb8d625..64321265cf 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -378,6 +378,11 @@ struct si_shader_selector {
  * -> = merged with the next stage
  */
 
+/* Use the byte alignment for all following structure members for optimal
+ * shader key memory footprint.
+ */
+#pragma pack(push, 1)
+
 /* Common VS bits between the shader key and the prolog key. */
 struct si_vs_prolog_bits {
 	unsigned	instance_divisors[SI_MAX_ATTRIBS];
@@ -514,6 +519,9 @@ struct si_shader_key {
 	} opt;
 };
 
+/* Restore the pack alignment to default. */
+#pragma pack(pop)
+
 struct si_shader_config {
 	unsigned			num_sgprs;
 	unsigned			num_vgprs;




More information about the mesa-commit mailing list