[Mesa-dev] [PATCH 05/13] mesa: further reduce the size of ctx->Texture
Marek Olšák
maraeo at gmail.com
Fri Feb 9 01:18:40 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/glheader.h | 5 ++++-
src/mesa/main/mtypes.h | 44 ++++++++++++++++++++++----------------------
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 7a4b4a0..a6e6b6a 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -35,22 +35,25 @@
#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"
#ifdef __cplusplus
extern "C" {
#endif
+/* Custom Mesa types to save space. */
+typedef unsigned short GLenum16;
+typedef unsigned char GLbitfield8;
+typedef unsigned short GLbitfield16;
-typedef unsigned short GLenum16; /* custom Mesa type to save space */
typedef int GLclampx;
#ifndef GL_OES_EGL_image
typedef void *GLeglImageOES;
#endif
#ifndef GL_OES_EGL_image_external
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3a4fdb5..23fe459 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1127,24 +1127,24 @@ struct gl_texture_object
struct gl_tex_env_combine_state
{
GLenum16 ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
GLenum16 ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
/** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */
GLenum16 SourceRGB[MAX_COMBINER_TERMS];
GLenum16 SourceA[MAX_COMBINER_TERMS];
/** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */
GLenum16 OperandRGB[MAX_COMBINER_TERMS];
GLenum16 OperandA[MAX_COMBINER_TERMS];
- GLuint ScaleShiftRGB; /**< 0, 1 or 2 */
- GLuint ScaleShiftA; /**< 0, 1 or 2 */
- GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */
- GLuint _NumArgsA; /**< Number of inputs used for the A combiner */
+ GLubyte ScaleShiftRGB; /**< 0, 1 or 2 */
+ GLubyte ScaleShiftA; /**< 0, 1 or 2 */
+ GLubyte _NumArgsRGB; /**< Number of inputs used for the RGB combiner */
+ GLubyte _NumArgsA; /**< Number of inputs used for the A combiner */
};
/** Compressed TexEnv effective Combine mode */
enum gl_tex_env_mode
{
TEXENV_MODE_REPLACE, /* r = a0 */
TEXENV_MODE_MODULATE, /* r = a0 * a1 */
TEXENV_MODE_ADD, /* r = a0 + a1 */
TEXENV_MODE_ADD_SIGNED, /* r = a0 + a1 - 0.5 */
@@ -1261,21 +1261,21 @@ struct gl_tex_env_combine_packed
/** Non-identity texture matrix for texture unit? */
#define ENABLE_TEXMAT(unit) (1 << (unit))
/**
* Texture coord generation state.
*/
struct gl_texgen
{
GLenum16 Mode; /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */
- GLbitfield _ModeBit; /**< TEXGEN_x bit corresponding to Mode */
+ GLbitfield8 _ModeBit; /**< TEXGEN_x bit corresponding to Mode */
GLfloat ObjectPlane[4];
GLfloat EyePlane[4];
};
/**
* Sampler-related subset of a texture unit, like current texture objects.
*/
struct gl_texture_unit
{
@@ -1294,87 +1294,87 @@ struct gl_texture_unit
struct gl_texture_object *_Current;
};
/**
* Fixed-function-related subset of a texture unit, like enable flags,
* texture environment/function/combiners, and texgen state.
*/
struct gl_fixedfunc_texture_unit
{
- GLbitfield Enabled; /**< bitmask of TEXTURE_*_BIT flags */
+ GLbitfield16 Enabled; /**< bitmask of TEXTURE_*_BIT flags */
GLenum16 EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLclampf EnvColor[4];
GLfloat EnvColorUnclamped[4];
struct gl_texgen GenS;
struct gl_texgen GenT;
struct gl_texgen GenR;
struct gl_texgen GenQ;
- GLbitfield TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
- GLbitfield _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
+ GLbitfield8 TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
+ GLbitfield8 _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
/**
* \name GL_EXT_texture_env_combine
*/
struct gl_tex_env_combine_state Combine;
/**
* Derived state based on \c EnvMode and the \c BaseFormat of the
* currently enabled texture.
*/
struct gl_tex_env_combine_state _EnvMode;
+ /** Current compressed TexEnv & Combine state */
+ struct gl_tex_env_combine_packed _CurrentCombinePacked;
+
/**
* Currently enabled combiner state. This will point to either
* \c Combine or \c _EnvMode.
*/
struct gl_tex_env_combine_state *_CurrentCombine;
-
- /** Current compressed TexEnv & Combine state */
- struct gl_tex_env_combine_packed _CurrentCombinePacked;
};
/**
* Texture attribute group (GL_TEXTURE_BIT).
*/
struct gl_texture_attrib
{
- GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */
-
- /** GL_ARB_seamless_cubemap */
- GLboolean CubeMapSeamless;
-
struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
/** GL_ARB_texture_buffer_object */
struct gl_buffer_object *BufferObject;
+ GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */
+
/** Texture coord units/sets used for fragment texturing */
- GLbitfield _EnabledCoordUnits;
+ GLbitfield8 _EnabledCoordUnits;
/** Texture coord units that have texgen enabled */
- GLbitfield _TexGenEnabled;
+ GLbitfield8 _TexGenEnabled;
/** Texture coord units that have non-identity matrices */
- GLbitfield _TexMatEnabled;
+ GLbitfield8 _TexMatEnabled;
/** Bitwise-OR of all Texture.Unit[i]._GenFlags */
- GLbitfield _GenFlags;
+ GLbitfield8 _GenFlags;
/** Largest index of a texture unit with _Current != NULL. */
- GLint _MaxEnabledTexImageUnit;
+ GLshort _MaxEnabledTexImageUnit;
/** Largest index + 1 of texture units that have had any CurrentTex set. */
- GLint NumCurrentTexUsed;
+ GLubyte NumCurrentTexUsed;
+
+ /** GL_ARB_seamless_cubemap */
+ GLboolean CubeMapSeamless;
struct gl_texture_unit Unit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_TEXTURE_COORD_UNITS];
};
/**
* Data structure representing a single clip plane (e.g. one of the elements
* of the ctx->Transform.EyeUserPlane or ctx->Transform._ClipUserPlane array).
*/
--
2.7.4
More information about the mesa-dev
mailing list