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

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Thu Nov 16 00:44:43 2017 +0100

mesa: reduce the size of gl_image_unit (v2)

gl_context::ImageUnits: 6144 -> 4608 bytes

v2: use ASSERT_BITFIELD_SIZE

Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/mesa/main/mtypes.h      | 13 ++++++-------
 src/mesa/main/shaderimage.c |  2 ++
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 23fe45920c..f829fa3ff0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4685,7 +4685,7 @@ struct gl_image_unit
    /**
     * Level of the texture object bound to this unit.
     */
-   GLuint Level;
+   GLubyte Level;
 
    /**
     * \c GL_TRUE if the whole level is bound as an array of layers, \c
@@ -4698,13 +4698,13 @@ struct gl_image_unit
     * Layer of the texture object bound to this unit as specified by the
     * application.
     */
-   GLuint Layer;
+   GLushort Layer;
 
    /**
-    * Layer of the texture object bound to this unit, or zero if the
-    * whole level is bound.
+    * Layer of the texture object bound to this unit, or zero if
+    * Layered == false.
     */
-   GLuint _Layer;
+   GLushort _Layer;
 
    /**
     * Access allowed to this texture image.  Either \c GL_READ_ONLY,
@@ -4722,8 +4722,7 @@ struct gl_image_unit
    /**
     * Mesa format corresponding to \c Format.
     */
-   mesa_format _ActualFormat;
-
+   mesa_format _ActualFormat:16;
 };
 
 /**
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index c722b327de..596eadd4f8 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -464,6 +464,8 @@ _mesa_init_image_units(struct gl_context *ctx)
 {
    unsigned i;
 
+   ASSERT_BITFIELD_SIZE(struct gl_image_unit, Format, MESA_FORMAT_COUNT);
+
    for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i)
       ctx->ImageUnits[i] = _mesa_default_image_unit(ctx);
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to