[virglrenderer-devel] [PATCH] vrend: specify correct offset in resource copy fallback path

Gurchetan Singh gurchetansingh at chromium.org
Fri Mar 16 00:05:05 UTC 2018


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
---
 src/vrend_renderer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 68bc932..3496ebf 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -5737,8 +5737,10 @@ static void vrend_resource_copy_fallback(struct vrend_context *ctx,
    }
 
    glBindTexture(dst_res->target, dst_res->id);
-   slice_offset = 0;
-   for (i = 0; i < cube_slice; i++) {
+   slice_offset = dstz * slice_size;
+   cube_slice = (src_res->target == GL_TEXTURE_CUBE_MAP) ? dstz + src_box->depth : cube_slice;
+   i = (src_res->target == GL_TEXTURE_CUBE_MAP) ? dstz : 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;
       if (compressed) {
          if (ctarget == GL_TEXTURE_1D) {
-- 
2.16.2.804.g6dcf76e118-goog



More information about the virglrenderer-devel mailing list