Mesa (master): vc4: Fix write-only texsubimage when we had to align.

Eric Anholt anholt at kemper.freedesktop.org
Sat Jun 20 07:20:25 UTC 2015


Module: Mesa
Branch: master
Commit: bb107110a4d97191841985076dd9f2fbd0937dfc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb107110a4d97191841985076dd9f2fbd0937dfc

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jun 19 19:41:25 2015 -0700

vc4: Fix write-only texsubimage when we had to align.

We need to make sure that when we store the aligned box, we've got
initialized contents in the border.  We could potentially just load the
border area, but for now let's get text rendering working in X (and fix
the GL_TEXTURE_2D errors in piglit's texsubimage test and
gl-2.1-pbo/test_tex_image)

---

 src/gallium/drivers/vc4/vc4_resource.c |    6 +++++-
 src/mesa/main/extensions.c             |    1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 14b135e..cab7640 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -162,6 +162,8 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
                 /* We need to align the box to utile boundaries, since that's
                  * what load/store operate on.
                  */
+                uint32_t orig_width = ptrans->box.width;
+                uint32_t orig_height = ptrans->box.height;
                 uint32_t box_start_x = ptrans->box.x & (utile_w - 1);
                 uint32_t box_start_y = ptrans->box.y & (utile_h - 1);
                 ptrans->box.width += box_start_x;
@@ -175,7 +177,9 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
                 ptrans->layer_stride = ptrans->stride;
 
                 trans->map = malloc(ptrans->stride * ptrans->box.height);
-                if (usage & PIPE_TRANSFER_READ) {
+                if (usage & PIPE_TRANSFER_READ ||
+                    ptrans->box.width != orig_width ||
+                    ptrans->box.height != orig_height) {
                         vc4_load_tiled_image(trans->map, ptrans->stride,
                                              buf + slice->offset +
                                              box->z * rsc->cube_map_stride,
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 4176a69..b747aba 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -218,6 +218,7 @@ static const struct extension extension_table[] = {
    { "GL_EXT_discard_framebuffer",                 o(dummy_true),                                    ES1 | ES2, 2009 },
    { "GL_EXT_blend_minmax",                        o(EXT_blend_minmax),                        GLL | ES1 | ES2, 1995 },
    { "GL_EXT_blend_subtract",                      o(dummy_true),                              GLL,            1995 },
+   { "GL_EXT_buffer_storage",                      o(ARB_buffer_storage),                                  ES2, 2015 },
    { "GL_EXT_compiled_vertex_array",               o(dummy_true),                              GLL,            1996 },
    { "GL_EXT_copy_texture",                        o(dummy_true),                              GLL,            1995 },
    { "GL_EXT_depth_bounds_test",                   o(EXT_depth_bounds_test),                   GL,             2002 },




More information about the mesa-commit mailing list