vrend: specify correct offset in resource copy fallback path

glGetTexImage returns the entire texture, and we always copy from
the beginning of the texture. Instead, we should start copying
from the offset specified by the bounding box.

Fixes:
    dEQP-GLES3.functional.texture.shadow.2d_array.*.*depth*

Example test cases:
    dEQP-GLES3.functional.texture.shadow.2d_array.linear.not_equal_depth_component32f
    dEQP-GLES3.functional.texture.shadow.2d_array.nearest_mipmap_nearest.less_or_equal_depth_component16
    dEQP-GLES3.functional.texture.shadow.2d_array.nearest_mipmap_nearest.greater_or_equal_depth_component16

v2: Cubemap textures seem to suffer from the same issue:

Fixes:
   dEQP-GLES3.functional.texture.shadow.cube.nearest.*

Example test cases:
    dEQP-GLES3.functional.texture.shadow.cube.nearest.less_or_equal_depth_component16
    dEQP-GLES3.functional.texture.shadow.cube.nearest.less_or_equal_depth24_stencil8

v3: Make sure we still make only 1 glTexSubImage3D call in the non-cubemap case
v4: Fix slice size and texture size calculations.

Fixes:
    dEQP-GLES3.functional.texture.filtering.3d.formats.rgb9_e5_nearest
    dEQP-GLES3.functional.texture.filtering.3d.formats.rgb9_e5_linear
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gurchetan Singh 7 years ago committed by Dave Airlie
parent b070fa2dd9
commit b3296a37e1
  1. 10
      src/vrend_renderer.c

@ -5680,8 +5680,8 @@ static void vrend_resource_copy_fallback(struct vrend_context *ctx,
/* this is ugly need to do a full GetTexImage */ /* this is ugly need to do a full GetTexImage */
slice_size = util_format_get_nblocks(src_res->base.format, u_minify(src_res->base.width0, src_level), u_minify(src_res->base.height0, src_level)) * slice_size = util_format_get_nblocks(src_res->base.format, u_minify(src_res->base.width0, src_level), u_minify(src_res->base.height0, src_level)) *
u_minify(src_res->base.depth0, src_level) * util_format_get_blocksize(src_res->base.format); util_format_get_blocksize(src_res->base.format);
transfer_size = slice_size * src_res->base.array_size; transfer_size = slice_size * vrend_get_texture_depth(src_res, src_level);
tptr = malloc(transfer_size); tptr = malloc(transfer_size);
if (!tptr) if (!tptr)
@ -5749,8 +5749,10 @@ static void vrend_resource_copy_fallback(struct vrend_context *ctx,
} }
glBindTexture(dst_res->target, dst_res->id); glBindTexture(dst_res->target, dst_res->id);
slice_offset = 0; slice_offset = src_box->z * slice_size;
for (i = 0; i < cube_slice; i++) { cube_slice = (src_res->target == GL_TEXTURE_CUBE_MAP) ? src_box->z + src_box->depth : cube_slice;
i = (src_res->target == GL_TEXTURE_CUBE_MAP) ? src_box->z : 0;
for (; i < cube_slice; i++) {
GLenum ctarget = dst_res->target == GL_TEXTURE_CUBE_MAP ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + i : dst_res->target; GLenum ctarget = dst_res->target == GL_TEXTURE_CUBE_MAP ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + i : dst_res->target;
if (compressed) { if (compressed) {
if (ctarget == GL_TEXTURE_1D) { if (ctarget == GL_TEXTURE_1D) {

Loading…
Cancel
Save