swrast: Remove 'inline' from tex filter functions.

Reduces .text size of mesa_dri_drivers.so (i965-only) by 62k, or 1.4%.

Note that we don't remove inline from lerp_2d(), which has a comment
above it saying it definitely should be inlined. Though, removing the
inline keyword from it doesn't actually change the compiled code for me.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Matt Turner 2014-12-04 11:34:35 -08:00
parent 8af4aaf351
commit 811a1836c8

View file

@ -73,7 +73,7 @@ lerp_2d(GLfloat a, GLfloat b,
* Do 3D/trilinear interpolation of float values. * Do 3D/trilinear interpolation of float values.
* \sa lerp_2d * \sa lerp_2d
*/ */
static inline GLfloat static GLfloat
lerp_3d(GLfloat a, GLfloat b, GLfloat c, lerp_3d(GLfloat a, GLfloat b, GLfloat c,
GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110,
GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111)
@ -91,7 +91,7 @@ lerp_3d(GLfloat a, GLfloat b, GLfloat c,
/** /**
* Do linear interpolation of colors. * Do linear interpolation of colors.
*/ */
static inline void static void
lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4])
{ {
result[0] = LERP(t, a[0], b[0]); result[0] = LERP(t, a[0], b[0]);
@ -104,7 +104,7 @@ lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4])
/** /**
* Do bilinear interpolation of colors. * Do bilinear interpolation of colors.
*/ */
static inline void static void
lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b,
const GLfloat t00[4], const GLfloat t10[4], const GLfloat t00[4], const GLfloat t10[4],
const GLfloat t01[4], const GLfloat t11[4]) const GLfloat t01[4], const GLfloat t11[4])
@ -119,7 +119,7 @@ lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b,
/** /**
* Do trilinear interpolation of colors. * Do trilinear interpolation of colors.
*/ */
static inline void static void
lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c,
const GLfloat t000[4], const GLfloat t100[4], const GLfloat t000[4], const GLfloat t100[4],
const GLfloat t010[4], const GLfloat t110[4], const GLfloat t010[4], const GLfloat t110[4],
@ -155,7 +155,7 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c,
* i0, i1 = returns two nearest texel indexes * i0, i1 = returns two nearest texel indexes
* weight = returns blend factor between texels * weight = returns blend factor between texels
*/ */
static inline void static void
linear_texel_locations(GLenum wrapMode, linear_texel_locations(GLenum wrapMode,
const struct gl_texture_image *img, const struct gl_texture_image *img,
GLint size, GLfloat s, GLint size, GLfloat s,
@ -285,7 +285,7 @@ linear_texel_locations(GLenum wrapMode,
/** /**
* Used to compute texel location for nearest sampling. * Used to compute texel location for nearest sampling.
*/ */
static inline GLint static GLint
nearest_texel_location(GLenum wrapMode, nearest_texel_location(GLenum wrapMode,
const struct gl_texture_image *img, const struct gl_texture_image *img,
GLint size, GLfloat s) GLint size, GLfloat s)
@ -410,7 +410,7 @@ nearest_texel_location(GLenum wrapMode,
/* Power of two image sizes only */ /* Power of two image sizes only */
static inline void static void
linear_repeat_texel_location(GLuint size, GLfloat s, linear_repeat_texel_location(GLuint size, GLfloat s,
GLint *i0, GLint *i1, GLfloat *weight) GLint *i0, GLint *i1, GLfloat *weight)
{ {
@ -424,7 +424,7 @@ linear_repeat_texel_location(GLuint size, GLfloat s,
/** /**
* Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode.
*/ */
static inline GLint static GLint
clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
{ {
switch (wrapMode) { switch (wrapMode) {
@ -444,7 +444,7 @@ clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
/** /**
* As above, but GL_LINEAR filtering. * As above, but GL_LINEAR filtering.
*/ */
static inline void static void
clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
GLint *i0out, GLint *i1out, GLfloat *weight) GLint *i0out, GLint *i1out, GLfloat *weight)
{ {
@ -486,7 +486,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
/** /**
* Compute slice/image to use for 1D or 2D array texture. * Compute slice/image to use for 1D or 2D array texture.
*/ */
static inline GLint static GLint
tex_array_slice(GLfloat coord, GLsizei size) tex_array_slice(GLfloat coord, GLsizei size)
{ {
GLint slice = IFLOOR(coord + 0.5f); GLint slice = IFLOOR(coord + 0.5f);
@ -499,7 +499,7 @@ tex_array_slice(GLfloat coord, GLsizei size)
* Compute nearest integer texcoords for given texobj and coordinate. * Compute nearest integer texcoords for given texobj and coordinate.
* NOTE: only used for depth texture sampling. * NOTE: only used for depth texture sampling.
*/ */
static inline void static void
nearest_texcoord(const struct gl_sampler_object *samp, nearest_texcoord(const struct gl_sampler_object *samp,
const struct gl_texture_object *texObj, const struct gl_texture_object *texObj,
GLuint level, GLuint level,
@ -548,7 +548,7 @@ nearest_texcoord(const struct gl_sampler_object *samp,
* Compute linear integer texcoords for given texobj and coordinate. * Compute linear integer texcoords for given texobj and coordinate.
* NOTE: only used for depth texture sampling. * NOTE: only used for depth texture sampling.
*/ */
static inline void static void
linear_texcoord(const struct gl_sampler_object *samp, linear_texcoord(const struct gl_sampler_object *samp,
const struct gl_texture_object *texObj, const struct gl_texture_object *texObj,
GLuint level, GLuint level,
@ -607,7 +607,7 @@ linear_texcoord(const struct gl_sampler_object *samp,
* For linear interpolation between mipmap levels N and N+1, this function * For linear interpolation between mipmap levels N and N+1, this function
* computes N. * computes N.
*/ */
static inline GLint static GLint
linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
{ {
if (lambda < 0.0F) if (lambda < 0.0F)
@ -622,7 +622,7 @@ linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
/** /**
* Compute the nearest mipmap level to take texels from. * Compute the nearest mipmap level to take texels from.
*/ */
static inline GLint static GLint
nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
{ {
GLfloat l; GLfloat l;
@ -658,7 +658,7 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
* will be minified, magnified, or split between the two. This function * will be minified, magnified, or split between the two. This function
* determines the subranges in [0, n-1] that are to be minified or magnified. * determines the subranges in [0, n-1] that are to be minified or magnified.
*/ */
static inline void static void
compute_min_mag_ranges(const struct gl_sampler_object *samp, compute_min_mag_ranges(const struct gl_sampler_object *samp,
GLuint n, const GLfloat lambda[], GLuint n, const GLfloat lambda[],
GLuint *minStart, GLuint *minEnd, GLuint *minStart, GLuint *minEnd,
@ -767,7 +767,7 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp,
* the base texture format. Ex: if the texture base format it GL_ALPHA, * the base texture format. Ex: if the texture base format it GL_ALPHA,
* we return (0,0,0,BorderAlpha). * we return (0,0,0,BorderAlpha).
*/ */
static inline void static void
get_border_color(const struct gl_sampler_object *samp, get_border_color(const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
GLfloat rgba[4]) GLfloat rgba[4])
@ -804,7 +804,7 @@ get_border_color(const struct gl_sampler_object *samp,
/** /**
* Put z into texel according to GL_DEPTH_MODE. * Put z into texel according to GL_DEPTH_MODE.
*/ */
static inline void static void
apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4]) apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4])
{ {
switch (depthMode) { switch (depthMode) {
@ -844,7 +844,7 @@ is_depth_texture(const struct gl_texture_object *tObj)
/** /**
* Return the texture sample for coordinate (s) using GL_NEAREST filter. * Return the texture sample for coordinate (s) using GL_NEAREST filter.
*/ */
static inline void static void
sample_1d_nearest(struct gl_context *ctx, sample_1d_nearest(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -869,7 +869,7 @@ sample_1d_nearest(struct gl_context *ctx,
/** /**
* Return the texture sample for coordinate (s) using GL_LINEAR filter. * Return the texture sample for coordinate (s) using GL_LINEAR filter.
*/ */
static inline void static void
sample_1d_linear(struct gl_context *ctx, sample_1d_linear(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -1110,7 +1110,7 @@ sample_lambda_1d( struct gl_context *ctx,
/** /**
* Return the texture sample for coordinate (s,t) using GL_NEAREST filter. * Return the texture sample for coordinate (s,t) using GL_NEAREST filter.
*/ */
static inline void static void
sample_2d_nearest(struct gl_context *ctx, sample_2d_nearest(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -1144,7 +1144,7 @@ sample_2d_nearest(struct gl_context *ctx,
* Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * Return the texture sample for coordinate (s,t) using GL_LINEAR filter.
* New sampling code contributed by Lynn Quam <quam@ai.sri.com>. * New sampling code contributed by Lynn Quam <quam@ai.sri.com>.
*/ */
static inline void static void
sample_2d_linear(struct gl_context *ctx, sample_2d_linear(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -1209,7 +1209,7 @@ sample_2d_linear(struct gl_context *ctx,
* As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT.
* We don't have to worry about the texture border. * We don't have to worry about the texture border.
*/ */
static inline void static void
sample_2d_linear_repeat(struct gl_context *ctx, sample_2d_linear_repeat(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -1830,7 +1830,7 @@ sample_2d_footprint(struct gl_context *ctx,
* Returns the index of the specified texture object in the * Returns the index of the specified texture object in the
* gl_context texture unit array. * gl_context texture unit array.
*/ */
static inline GLuint static GLuint
texture_unit_index(const struct gl_context *ctx, texture_unit_index(const struct gl_context *ctx,
const struct gl_texture_object *tObj) const struct gl_texture_object *tObj)
{ {
@ -2012,7 +2012,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
/** /**
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/ */
static inline void static void
sample_3d_nearest(struct gl_context *ctx, sample_3d_nearest(struct gl_context *ctx,
const struct gl_sampler_object *samp, const struct gl_sampler_object *samp,
const struct gl_texture_image *img, const struct gl_texture_image *img,
@ -3416,7 +3416,7 @@ sample_lambda_1d_array(struct gl_context *ctx,
/** /**
* Compare texcoord against depth sample. Return 1.0 or 0.0 value. * Compare texcoord against depth sample. Return 1.0 or 0.0 value.
*/ */
static inline GLfloat static GLfloat
shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample)
{ {
switch (function) { switch (function) {
@ -3448,7 +3448,7 @@ shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample)
/** /**
* Compare texcoord against four depth samples. * Compare texcoord against four depth samples.
*/ */
static inline GLfloat static GLfloat
shadow_compare4(GLenum function, GLfloat coord, shadow_compare4(GLenum function, GLfloat coord,
GLfloat depth00, GLfloat depth01, GLfloat depth00, GLfloat depth01,
GLfloat depth10, GLfloat depth11, GLfloat depth10, GLfloat depth11,