diff options
author | Nicolai Hähnle <[email protected]> | 2016-02-10 11:19:55 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-02-15 22:22:33 -0500 |
commit | ef27190a34ab06ffe14fb6bdc0e366b564fa5ead (patch) | |
tree | 3c5d483a50caa0d8b1ee9407a8a1cabd99ca5452 /src/mesa/state_tracker | |
parent | f1b0bda6bcac312c42caafbc753e476c64715eea (diff) |
st/mesa: set pipe_image_view layers correctly for 3D textures
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_image.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c index ff365377ac8..4b48bc30b69 100644 --- a/src/mesa/state_tracker/st_atom_image.c +++ b/src/mesa/state_tracker/st_atom_image.c @@ -84,13 +84,23 @@ st_bind_images(struct st_context *st, struct gl_shader *shader, img->u.buf.last_element = f + (n - 1); } else { img->u.tex.level = u->Level + stObj->base.MinLevel; - img->u.tex.first_layer = u->_Layer + stObj->base.MinLayer; - img->u.tex.last_layer = u->_Layer + stObj->base.MinLayer; - if (u->Layered && img->resource->array_size > 1) { - if (stObj->base.Immutable) - img->u.tex.last_layer += stObj->base.NumLayers - 1; - else - img->u.tex.last_layer += img->resource->array_size - 1; + if (stObj->pt->target == PIPE_TEXTURE_3D) { + if (u->Layered) { + img->u.tex.first_layer = 0; + img->u.tex.last_layer = u_minify(stObj->pt->depth0, img->u.tex.level) - 1; + } else { + img->u.tex.first_layer = u->_Layer; + img->u.tex.last_layer = u->_Layer; + } + } else { + img->u.tex.first_layer = u->_Layer + stObj->base.MinLayer; + img->u.tex.last_layer = u->_Layer + stObj->base.MinLayer; + if (u->Layered && img->resource->array_size > 1) { + if (stObj->base.Immutable) + img->u.tex.last_layer += stObj->base.NumLayers - 1; + else + img->u.tex.last_layer += img->resource->array_size - 1; + } } } } |