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 | 325379096f54dde39171d1b8804e29a8003bb3c7 (patch) | |
tree | a9a2dad63270175b9839edbd81af66c9d03a7eed /src/mesa | |
parent | 7cd256ce7e4bad680bb77d033cf5dd662abab2dd (diff) |
gallium: change pipe_image_view::first_element/last_element -> offset/size
This is required by OpenGL. Our hardware supports this.
Example: Bind RGBA32F with offset = 4 bytes.
Acked-by: Ilia Mirkin <[email protected]>
Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_atom_image.c | 10 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_readpixels.c | 5 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c index e80fc14bf41..4d76ac972d9 100644 --- a/src/mesa/state_tracker/st_atom_image.c +++ b/src/mesa/state_tracker/st_atom_image.c @@ -88,19 +88,13 @@ st_bind_images(struct st_context *st, struct gl_linked_shader *shader, if (stObj->pt->target == PIPE_BUFFER) { unsigned base, size; - unsigned f, n; - const struct util_format_description *desc - = util_format_description(img->format); base = stObj->base.BufferOffset; assert(base < stObj->pt->width0); size = MIN2(stObj->pt->width0 - base, (unsigned)stObj->base.BufferSize); - f = (base / (desc->block.bits / 8)) * desc->block.width; - n = (size / (desc->block.bits / 8)) * desc->block.width; - assert(n > 0); - img->u.buf.first_element = f; - img->u.buf.last_element = f + (n - 1); + img->u.buf.offset = base; + img->u.buf.size = size; } else { img->u.tex.level = u->Level + stObj->base.MinLevel; if (stObj->pt->target == PIPE_TEXTURE_3D) { diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 8eb839d16a9..3cfdf78f190 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -192,8 +192,9 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb, image.resource = addr.buffer; image.format = dst_format; image.access = PIPE_IMAGE_ACCESS_WRITE; - image.u.buf.first_element = addr.first_element; - image.u.buf.last_element = addr.last_element; + image.u.buf.offset = addr.first_element * addr.bytes_per_pixel; + image.u.buf.size = (addr.last_element - addr.first_element + 1) * + addr.bytes_per_pixel; cso_set_shader_images(cso, PIPE_SHADER_FRAGMENT, 0, 1, &image); } |