summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_tex_sample.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-08-30 12:36:03 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-08-30 12:37:03 +0100
commitc28f253ac26e2d5a8cc7befa35e754515d4510dd (patch)
tree863fc12797f182883199374b5da2da6d6d9b7470 /src/gallium/drivers/llvmpipe/lp_tex_sample.c
parent62b586fce43ac117dcb553baa1fe884053fdef12 (diff)
llvmpipe: Texture cache in 4 ubytes instead of 4 floats.
This is more a short term experiment than a long term commitment, as we'll need to support higher precision textures too, as this will all be be replaced by runtime generated code. With this change most Mesa demos fps increased around 10%. Not a huge improvement, but not a negligible one either.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_tex_sample.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 13e1780f9a..94eb6dad5a 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
@@ -666,7 +666,7 @@ choose_mipmap_levels(struct tgsi_sampler *tgsi_sampler,
static void
get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler,
unsigned face, unsigned level, int x, int y,
- const float *out[4])
+ const uint8_t *out[4])
{
const struct lp_shader_sampler *samp = lp_shader_sampler(tgsi_sampler);
@@ -683,7 +683,7 @@ get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler,
out[3] = &tile->color[y+1][x+1][0];
}
-static INLINE const float *
+static INLINE const uint8_t *
get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler,
unsigned face, unsigned level, int x, int y)
{
@@ -705,7 +705,7 @@ get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler,
unsigned face, unsigned level,
int x0, int y0,
int x1, int y1,
- const float *out[4])
+ const uint8_t *out[4])
{
unsigned i;
@@ -742,10 +742,10 @@ get_texel(const struct tgsi_sampler *tgsi_sampler,
tile = lp_get_cached_tex_tile(samp->cache,
tex_tile_address(x, y, z, face, level));
- rgba[0][j] = tile->color[ty][tx][0];
- rgba[1][j] = tile->color[ty][tx][1];
- rgba[2][j] = tile->color[ty][tx][2];
- rgba[3][j] = tile->color[ty][tx][3];
+ rgba[0][j] = ubyte_to_float(tile->color[ty][tx][0]);
+ rgba[1][j] = ubyte_to_float(tile->color[ty][tx][1]);
+ rgba[2][j] = ubyte_to_float(tile->color[ty][tx][2]);
+ rgba[3][j] = ubyte_to_float(tile->color[ty][tx][3]);
if (0)
{
debug_printf("Get texel %f %f %f %f from %s\n",
@@ -912,7 +912,7 @@ lp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
int x0 = uflr & (xpot - 1);
int y0 = vflr & (ypot - 1);
- const float *tx[4];
+ const uint8_t *tx[4];
/* Can we fetch all four at once:
@@ -933,8 +933,8 @@ lp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
/* interpolate R, G, B, A */
for (c = 0; c < 4; c++) {
rgba[c][j] = lerp_2d(xw, yw,
- tx[0][c], tx[1][c],
- tx[2][c], tx[3][c]);
+ ubyte_to_float(tx[0][c]), ubyte_to_float(tx[1][c]),
+ ubyte_to_float(tx[2][c]), ubyte_to_float(tx[3][c]));
}
}
}
@@ -966,10 +966,10 @@ lp_get_samples_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler,
int x0 = uflr & (xpot - 1);
int y0 = vflr & (ypot - 1);
- const float *out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0);
+ const uint8_t *out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0);
for (c = 0; c < 4; c++) {
- rgba[c][j] = out[c];
+ rgba[c][j] = ubyte_to_float(out[c]);
}
}
}
@@ -996,7 +996,7 @@ lp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
float v = t[j] * ypot;
int x0, y0;
- const float *out;
+ const uint8_t *out;
x0 = util_ifloor(u);
if (x0 < 0)
@@ -1013,7 +1013,7 @@ lp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0);
for (c = 0; c < 4; c++) {
- rgba[c][j] = out[c];
+ rgba[c][j] = ubyte_to_float(out[c]);
}
}
}