mesa: reduce the size of gl_image_unit (v2)

gl_context::ImageUnits: 6144 -> 4608 bytes

v2: use ASSERT_BITFIELD_SIZE

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2017-11-16 00:44:43 +01:00
parent ca5c5d96d8
commit 78f1decc95
2 changed files with 8 additions and 7 deletions

View File

@ -4685,7 +4685,7 @@ struct gl_image_unit
/** /**
* Level of the texture object bound to this 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 * \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 * Layer of the texture object bound to this unit as specified by the
* application. * application.
*/ */
GLuint Layer; GLushort Layer;
/** /**
* Layer of the texture object bound to this unit, or zero if the * Layer of the texture object bound to this unit, or zero if
* whole level is bound. * Layered == false.
*/ */
GLuint _Layer; GLushort _Layer;
/** /**
* Access allowed to this texture image. Either \c GL_READ_ONLY, * 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 corresponding to \c Format.
*/ */
mesa_format _ActualFormat; mesa_format _ActualFormat:16;
}; };
/** /**

View File

@ -464,6 +464,8 @@ _mesa_init_image_units(struct gl_context *ctx)
{ {
unsigned i; unsigned i;
ASSERT_BITFIELD_SIZE(struct gl_image_unit, Format, MESA_FORMAT_COUNT);
for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i) for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i)
ctx->ImageUnits[i] = _mesa_default_image_unit(ctx); ctx->ImageUnits[i] = _mesa_default_image_unit(ctx);
} }