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/radeonsi | |
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/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index f03a8958d15..a3e456410f9 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -641,8 +641,11 @@ static void si_set_shader_image(struct si_context *ctx, si_make_buffer_descriptor(screen, res, view->format, - view->u.buf.first_element, - view->u.buf.last_element, + view->u.buf.first_element * + util_format_get_blocksize(view->format), + (view->u.buf.last_element - + view->u.buf.first_element + 1) * + util_format_get_blocksize(view->format), descs->list + slot * 8); images->compressed_colortex_mask &= ~(1 << slot); } else { diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 8d9fe539922..7e63d487377 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2644,7 +2644,7 @@ static void si_set_min_samples(struct pipe_context *ctx, unsigned min_samples) void si_make_buffer_descriptor(struct si_screen *screen, struct r600_resource *buf, enum pipe_format format, - unsigned first_element, unsigned last_element, + unsigned offset, unsigned size, uint32_t *state) { const struct util_format_description *desc; @@ -2657,11 +2657,11 @@ si_make_buffer_descriptor(struct si_screen *screen, struct r600_resource *buf, desc = util_format_description(format); first_non_void = util_format_get_first_non_void_channel(format); stride = desc->block.bits / 8; - va = buf->gpu_address + first_element * stride; + va = buf->gpu_address + offset; num_format = si_translate_buffer_numformat(&screen->b.b, desc, first_non_void); data_format = si_translate_buffer_dataformat(&screen->b.b, desc, first_non_void); - num_records = last_element + 1 - first_element; + num_records = size / stride; num_records = MIN2(num_records, buf->b.b.width0 / stride); if (screen->b.chip_class >= VI) @@ -2960,8 +2960,8 @@ si_create_sampler_view_custom(struct pipe_context *ctx, si_make_buffer_descriptor(sctx->screen, (struct r600_resource *)texture, state->format, - state->u.buf.first_element, - state->u.buf.last_element, + state->u.buf.offset, + state->u.buf.size, view->state); LIST_ADDTAIL(&view->list, &sctx->b.texture_buffers); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index b574c2e9eae..f4f75758dbf 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -313,7 +313,7 @@ void si_init_screen_state_functions(struct si_screen *sscreen); void si_make_buffer_descriptor(struct si_screen *screen, struct r600_resource *buf, enum pipe_format format, - unsigned first_element, unsigned last_element, + unsigned offset, unsigned size, uint32_t *state); void si_make_texture_descriptor(struct si_screen *screen, |