summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-08-12 02:33:41 +0200
committerMarek Olšák <[email protected]>2016-08-17 14:15:33 +0200
commit7cd256ce7e4bad680bb77d033cf5dd662abab2dd (patch)
tree3b4a190876c076129e01792f0e3f4a087a820988 /src/gallium/drivers/llvmpipe
parent1ac23a9359556091b12ed1345737084e3a2f6ae3 (diff)
gallium: change pipe_sampler_view::first_element/last_element -> offset/size
This is required by OpenGL. Our hardware supports this. Example: Bind RGBA32F with offset = 4 bytes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97305 Acked-by: Ilia Mirkin <[email protected]> Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c8
2 files changed, 8 insertions, 12 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 0a45db94723..f622b192718 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -889,8 +889,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
}
else {
/*
- * For buffers, we don't have first_element, instead adjust
- * last_element (stored as width) plus the base pointer.
+ * For buffers, we don't have "offset", instead adjust
+ * the size (stored as width) plus the base pointer.
*/
unsigned view_blocksize = util_format_get_blocksize(view->format);
/* probably don't really need to fill that out */
@@ -899,12 +899,10 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->img_stride[0] = 0;
/* everything specified in number of elements here. */
- jit_tex->width = view->u.buf.last_element - view->u.buf.first_element + 1;
- jit_tex->base = (uint8_t *)jit_tex->base + view->u.buf.first_element *
- view_blocksize;
+ jit_tex->width = view->u.buf.size / view_blocksize;
+ jit_tex->base = (uint8_t *)jit_tex->base + view->u.buf.offset;
/* XXX Unsure if we need to sanitize parameters? */
- assert(view->u.buf.first_element <= view->u.buf.last_element);
- assert(view->u.buf.last_element * view_blocksize < res->width0);
+ assert(view->u.buf.offset + view->u.buf.size <= res->width0);
}
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 4441f2a40d6..665cd9ed475 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -308,11 +308,9 @@ prepare_shader_sampling(
img_stride[0] = 0;
/* everything specified in number of elements here. */
- width0 = view->u.buf.last_element - view->u.buf.first_element + 1;
- addr = (uint8_t *)addr + view->u.buf.first_element *
- view_blocksize;
- assert(view->u.buf.first_element <= view->u.buf.last_element);
- assert(view->u.buf.last_element * view_blocksize < res->width0);
+ width0 = view->u.buf.size / view_blocksize;
+ addr = (uint8_t *)addr + view->u.buf.offset;
+ assert(view->u.buf.offset + view->u.buf.size <= res->width0);
}
}
else {