aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-04-07 08:37:45 +0200
committerGert Wollny <[email protected]>2019-04-09 08:17:44 +0000
commit8cf8dfe408a7dda5121cefc2fd5d772186484f76 (patch)
tree479582b1849e00f16e8d4cc7f597b808bcca6b8d /src/gallium/drivers/softpipe
parent47dd7c40544e00888ca8942af2914b2fcdcd94f0 (diff)
softpipe: Add an extra code path for the buffer texel lookup
With buffers the addressing is done on a per-byte bases so the code path for normal textures doesn't work properly. Also add an assert to make sure that the bit cound for storing the X coordinate is large enough. Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index d20b7f9e518..5b6274e2ba4 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -574,6 +574,21 @@ compute_lambda_vert(const struct sp_sampler_view *sview,
+static inline const float *
+get_texel_buffer_no_border(const struct sp_sampler_view *sp_sview,
+ union tex_tile_address addr, int x, unsigned elmsize)
+{
+ const struct softpipe_tex_cached_tile *tile;
+ addr.bits.x = x * elmsize / TEX_TILE_SIZE;
+ assert(x * elmsize / TEX_TILE_SIZE == addr.bits.x);
+
+ x %= TEX_TILE_SIZE / elmsize;
+
+ tile = sp_get_cached_tile_tex(sp_sview->cache, addr);
+
+ return &tile->data.color[0][x][0];
+}
+
static inline const float *
get_texel_2d_no_border(const struct sp_sampler_view *sp_sview,
@@ -3264,7 +3279,7 @@ sp_get_texels(const struct sp_sampler_view *sp_sview,
first_element,
first_element,
last_element);
- tx = get_texel_2d_no_border(sp_sview, addr, x, 0);
+ tx = get_texel_buffer_no_border(sp_sview, addr, x, elem_size);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}