radeonsi: fix a regression in si_rebind_buffer
authorMarek Olšák <marek.olsak@amd.com>
Tue, 21 May 2019 18:26:13 +0000 (14:26 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 21 May 2019 22:58:03 +0000 (18:58 -0400)
Don't update non-buffer images.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110701
Fixes: 78e35df52aa2f7d770f929a0866a0faa89c261a9 "radeonsi: update buffer descriptors in all contexts after buffer invalidation"
Cc: 19.1 <mesa-stable@lists.freedesktop.org>
Tested-By: Gert Wollny <gert.wollny@collabora..com>
src/gallium/drivers/radeonsi/si_descriptors.c

index 501f4c1405ae7cd1356f6b90294001244ca68557..4cb6a1abb9a719cf59000788f0989e5450f5c461 100644 (file)
@@ -1705,7 +1705,8 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
                                unsigned i = u_bit_scan(&mask);
                                struct pipe_resource *buffer = samplers->views[i]->texture;
 
-                               if (buffer && (!buf || buffer == buf)) {
+                               if (buffer && buffer->target == PIPE_BUFFER &&
+                                   (!buf || buffer == buf)) {
                                        unsigned desc_slot = si_get_sampler_slot(i);
 
                                        si_set_buf_desc_address(si_resource(buffer),
@@ -1735,7 +1736,8 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
                                unsigned i = u_bit_scan(&mask);
                                struct pipe_resource *buffer = images->views[i].resource;
 
-                               if (buffer && (!buf || buffer == buf)) {
+                               if (buffer && buffer->target == PIPE_BUFFER &&
+                                   (!buf || buffer == buf)) {
                                        unsigned desc_slot = si_get_image_slot(i);
 
                                        if (images->views[i].access & PIPE_IMAGE_ACCESS_WRITE)
@@ -1766,7 +1768,8 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
                        unsigned desc_slot = (*tex_handle)->desc_slot;
                        struct pipe_resource *buffer = view->texture;
 
-                       if (buffer && (!buf || buffer == buf)) {
+                       if (buffer && buffer->target == PIPE_BUFFER &&
+                           (!buf || buffer == buf)) {
                                si_set_buf_desc_address(si_resource(buffer),
                                                        view->u.buf.offset,
                                                        descs->list +
@@ -1793,7 +1796,8 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
                        unsigned desc_slot = (*img_handle)->desc_slot;
                        struct pipe_resource *buffer = view->resource;
 
-                       if (buffer && (!buf || buffer == buf)) {
+                       if (buffer && buffer->target == PIPE_BUFFER &&
+                           (!buf || buffer == buf)) {
                                if (view->access & PIPE_IMAGE_ACCESS_WRITE)
                                        si_mark_image_range_valid(view);