[Mesa-dev] [PATCH 08/13] mesa: reduce the size of gl_texture_object
Marek Olšák
maraeo at gmail.com
Fri Feb 9 01:18:43 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/mtypes.h | 58 ++++++++++++++++++++++++------------------------
src/mesa/main/texparam.c | 2 +-
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c80d3b9..d8cb8f8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1014,109 +1014,109 @@ typedef enum
/**
* Sampler object state. These objects are new with GL_ARB_sampler_objects
* and OpenGL 3.3. Legacy texture objects also contain a sampler object.
*/
struct gl_sampler_object
{
simple_mtx_t Mutex;
GLuint Name;
- GLint RefCount;
GLchar *Label; /**< GL_KHR_debug */
+ GLint RefCount;
GLenum16 WrapS; /**< S-axis texture image wrap mode */
GLenum16 WrapT; /**< T-axis texture image wrap mode */
GLenum16 WrapR; /**< R-axis texture image wrap mode */
GLenum16 MinFilter; /**< minification filter */
GLenum16 MagFilter; /**< magnification filter */
+ GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
union gl_color_union BorderColor; /**< Interpreted according to texture format */
GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */
GLfloat LodBias; /**< OpenGL 1.4 */
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLenum16 CompareMode; /**< GL_ARB_shadow */
GLenum16 CompareFunc; /**< GL_ARB_shadow */
- GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
/** GL_ARB_bindless_texture */
bool HandleAllocated;
struct util_dynarray Handles;
};
/**
* Texture object state. Contains the array of mipmap images, border color,
* wrap modes, filter modes, and shadow/texcompare state.
*/
struct gl_texture_object
{
- simple_mtx_t Mutex; /**< for thread safety */
- GLint RefCount; /**< reference count */
- GLuint Name; /**< the user-visible texture object ID */
- GLchar *Label; /**< GL_KHR_debug */
- GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
- gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
- Only valid when Target is valid. */
+ simple_mtx_t Mutex; /**< for thread safety */
+ GLint RefCount; /**< reference count */
+ GLuint Name; /**< the user-visible texture object ID */
+ GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+ GLenum16 DepthMode; /**< GL_ARB_depth_texture */
+ GLchar *Label; /**< GL_KHR_debug */
struct gl_sampler_object Sampler;
- GLenum16 DepthMode; /**< GL_ARB_depth_texture */
-
+ gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
+ Only valid when Target is valid. */
GLfloat Priority; /**< in [0,1] */
- GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
- GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
- GLint ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
- GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
+ GLint MaxLevel; /**< max mipmap level (max=1000), OpenGL 1.2 */
+ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
+ GLbyte _MaxLevel; /**< actual max mipmap level (q in the spec) */
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - p in spec) */
GLint CropRect[4]; /**< GL_OES_draw_texture */
GLenum16 Swizzle[4]; /**< GL_EXT_texture_swizzle */
- GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLushort _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLbyte ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLboolean _BaseComplete; /**< Is the base texture level valid? */
GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
GLboolean _IsIntegerFormat; /**< Does the texture store integer values? */
GLboolean _RenderToTexture; /**< Any rendering to this texture? */
GLboolean Purgeable; /**< Is the buffer purgeable under memory
pressure? */
GLboolean Immutable; /**< GL_ARB_texture_storage */
GLboolean _IsFloat; /**< GL_OES_float_texture */
GLboolean _IsHalfFloat; /**< GL_OES_half_float_texture */
bool StencilSampling; /**< Should we sample stencil instead of depth? */
bool HandleAllocated; /**< GL_ARB_bindless_texture */
- GLuint MinLevel; /**< GL_ARB_texture_view */
- GLuint MinLayer; /**< GL_ARB_texture_view */
- GLuint NumLevels; /**< GL_ARB_texture_view */
- GLuint NumLayers; /**< GL_ARB_texture_view */
+ /** GL_OES_EGL_image_external */
+ GLubyte RequiredTextureImageUnits;
+
+ GLubyte MinLevel; /**< GL_ARB_texture_view */
+ GLubyte NumLevels; /**< GL_ARB_texture_view */
+ GLushort MinLayer; /**< GL_ARB_texture_view */
+ GLushort NumLayers; /**< GL_ARB_texture_view */
/** GL_EXT_memory_object */
GLenum16 TextureTiling;
- /** Actual texture images, indexed by [cube face] and [mipmap level] */
- struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
+ /** GL_ARB_shader_image_load_store */
+ GLenum16 ImageFormatCompatibilityType;
/** GL_ARB_texture_buffer_object */
- struct gl_buffer_object *BufferObject;
GLenum16 BufferObjectFormat;
/** Equivalent Mesa format for BufferObjectFormat. */
mesa_format _BufferObjectFormat;
+ struct gl_buffer_object *BufferObject;
+
/** GL_ARB_texture_buffer_range */
GLintptr BufferOffset;
GLsizeiptr BufferSize; /**< if this is -1, use BufferObject->Size instead */
- /** GL_OES_EGL_image_external */
- GLint RequiredTextureImageUnits;
-
- /** GL_ARB_shader_image_load_store */
- GLenum16 ImageFormatCompatibilityType;
+ /** Actual texture images, indexed by [cube face] and [mipmap level] */
+ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
/** GL_ARB_bindless_texture */
struct util_dynarray SamplerHandles;
struct util_dynarray ImageHandles;
};
/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */
#define MAX_COMBINER_TERMS 4
@@ -3665,21 +3665,21 @@ struct gl_program_constants
GLuint MaxShaderStorageBlocks;
};
/**
* Constants which may be overridden by device driver during context creation
* but are never changed after that.
*/
struct gl_constants
{
GLuint MaxTextureMbytes; /**< Max memory per image, in MB */
- GLuint MaxTextureLevels; /**< Max mipmap levels. */
+ GLuint MaxTextureLevels; /**< Max mipmap levels. */
GLuint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
GLuint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
GLuint MaxArrayTextureLayers; /**< Max layers in array textures */
GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */
GLuint MaxTextureCoordUnits;
GLuint MaxCombinedTextureImageUnits;
GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */
GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */
GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 4a0f61e..7cc9d9e 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -201,21 +201,21 @@ comp_to_swizzle(GLenum comp)
return SWIZZLE_ZERO;
case GL_ONE:
return SWIZZLE_ONE;
default:
return -1;
}
}
static void
-set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz)
+set_swizzle_component(GLushort *swizzle, GLuint comp, GLuint swz)
{
assert(comp < 4);
assert(swz <= SWIZZLE_NIL);
{
GLuint mask = 0x7 << (3 * comp);
GLuint s = (*swizzle & ~mask) | (swz << (3 * comp));
*swizzle = s;
}
}
--
2.7.4
More information about the mesa-dev
mailing list