freedreno: fix staging resource size for arrays

A 2d-array texture (for example), should get the # of array elements
from box->depth, rather than depth0 which is minified.

Fixes dEQP-GLES3.functional.shaders.texture_functions.texture.sampler2darray_bias_float_fragment
with tiled textures.

Reported-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Rob Clark 2019-01-02 13:24:31 -05:00
parent 67a7f6f244
commit e869481ef3
1 changed files with 10 additions and 2 deletions

View File

@ -294,8 +294,16 @@ fd_alloc_staging(struct fd_context *ctx, struct fd_resource *rsc,
tmpl.width0 = box->width;
tmpl.height0 = box->height;
tmpl.depth0 = box->depth;
tmpl.array_size = 1;
/* for array textures, box->depth is the array_size, otherwise
* for 3d textures, it is the depth:
*/
if (tmpl.array_size > 1) {
tmpl.array_size = box->depth;
tmpl.depth0 = 1;
} else {
tmpl.array_size = 1;
tmpl.depth0 = box->depth;
}
tmpl.last_level = 0;
tmpl.bind |= PIPE_BIND_LINEAR;