diff options
author | Marek Olšák <[email protected]> | 2016-08-12 02:33:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-08-17 14:15:33 +0200 |
commit | 7cd256ce7e4bad680bb77d033cf5dd662abab2dd (patch) | |
tree | 3b4a190876c076129e01792f0e3f4a087a820988 /src/gallium/drivers/svga | |
parent | 1ac23a9359556091b12ed1345737084e3a2f6ae3 (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/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_state_sampler.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/drivers/svga/svga_state_sampler.c b/src/gallium/drivers/svga/svga_state_sampler.c index 00e8fc0e6c8..2f0f838f1d3 100644 --- a/src/gallium/drivers/svga/svga_state_sampler.c +++ b/src/gallium/drivers/svga/svga_state_sampler.c @@ -30,6 +30,7 @@ #include "pipe/p_defines.h" #include "util/u_bitmask.h" +#include "util/u_format.h" #include "util/u_inlines.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -125,9 +126,10 @@ svga_validate_pipe_sampler_view(struct svga_context *svga, format = svga_sampler_format(format); if (texture->target == PIPE_BUFFER) { - viewDesc.buffer.firstElement = sv->base.u.buf.first_element; - viewDesc.buffer.numElements = (sv->base.u.buf.last_element - - sv->base.u.buf.first_element + 1); + unsigned elem_size = util_format_get_blocksize(sv->base.format); + + viewDesc.buffer.firstElement = sv->base.u.buf.offset / elem_size; + viewDesc.buffer.numElements = sv->base.u.buf.size / elem_size; } else { viewDesc.tex.mostDetailedMip = sv->base.u.tex.first_level; |