diff options
author | Roland Scheidegger <[email protected]> | 2014-08-28 05:13:35 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-08-30 01:34:16 +0200 |
commit | 3d29e75a5f59639c3b9dfed26cd41ab13c0d60fc (patch) | |
tree | dc790305a13bb0f46f3dc464db8ab2c42d40e9fc /src/gallium/drivers/softpipe/sp_texture.c | |
parent | 62fd87198432f3eac7b36fee4dfa2568cc1a5aad (diff) |
softpipe: handle vertex texture sampling when using llvm for draw
Pretty trivial, just fill in the offsets and such. The implementation
is near 100% copy and paste from llvmpipe. Should be useful for debugging.
No piglit change when not using SOFTPIPE_USE_LLVM=1.
Now that it can do the same tests with and without using llvm for vs/gs,
with llvm more pass, the only things failing only with llvm seems to be
edgeflags tests and vs/gs-pow-float-float (and for the latter I'm not
convinced the zero tolerance it requires is somehow mandated by glsl).
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_texture.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_texture.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 6538e46db09..c2df71e41a5 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -63,7 +63,9 @@ softpipe_resource_layout(struct pipe_screen *screen, uint64_t buffer_size = 0; for (level = 0; level <= pt->last_level; level++) { - unsigned slices; + unsigned slices, nblocksy; + + nblocksy = util_format_get_nblocksy(pt->format, height); if (pt->target == PIPE_TEXTURE_CUBE) slices = 6; @@ -76,8 +78,15 @@ softpipe_resource_layout(struct pipe_screen *screen, spr->level_offset[level] = buffer_size; - buffer_size += (uint64_t) util_format_get_nblocksy(pt->format, height) * - slices * spr->stride[level]; + /* if row_stride * height > SP_MAX_TEXTURE_SIZE */ + if ((uint64_t)spr->stride[level] * nblocksy > SP_MAX_TEXTURE_SIZE) { + /* image too large */ + return FALSE; + } + + spr->img_stride[level] = spr->stride[level] * nblocksy; + + buffer_size += (uint64_t) spr->img_stride[level] * slices; width = u_minify(width, 1); height = u_minify(height, 1); @@ -253,22 +262,9 @@ static unsigned sp_get_tex_image_offset(const struct softpipe_resource *spr, unsigned level, unsigned layer) { - const unsigned hgt = u_minify(spr->base.height0, level); - const unsigned nblocksy = util_format_get_nblocksy(spr->base.format, hgt); unsigned offset = spr->level_offset[level]; - if (spr->base.target == PIPE_TEXTURE_CUBE || - spr->base.target == PIPE_TEXTURE_CUBE_ARRAY || - spr->base.target == PIPE_TEXTURE_3D || - spr->base.target == PIPE_TEXTURE_2D_ARRAY) { - offset += layer * nblocksy * spr->stride[level]; - } - else if (spr->base.target == PIPE_TEXTURE_1D_ARRAY) { - offset += layer * spr->stride[level]; - } - else { - assert(layer == 0); - } + offset += layer * spr->img_stride[level]; return offset; } @@ -354,8 +350,6 @@ softpipe_transfer_map(struct pipe_context *pipe, struct softpipe_transfer *spt; struct pipe_transfer *pt; enum pipe_format format = resource->format; - const unsigned hgt = u_minify(spr->base.height0, level); - const unsigned nblocksy = util_format_get_nblocksy(format, hgt); uint8_t *map; assert(resource); @@ -414,7 +408,7 @@ softpipe_transfer_map(struct pipe_context *pipe, pt->usage = usage; pt->box = *box; pt->stride = spr->stride[level]; - pt->layer_stride = pt->stride * nblocksy; + pt->layer_stride = spr->img_stride[level]; spt->offset = sp_get_tex_image_offset(spr, level, box->z); |