r600g: flush depth textures bound to vertex shaders
authorMarek Olšák <maraeo@gmail.com>
Sun, 8 Jul 2012 00:14:18 +0000 (02:14 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 00:08:31 +0000 (02:08 +0200)
This was missing/broken. There are also minor code cleanups.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c

index 1d838bdc7884d269db6df06e6a492bf20b5146b1..23e3190b744b846ee907151a6279aefc68373dc2 100644 (file)
@@ -186,24 +186,20 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx,
        }
 }
 
-void r600_flush_depth_textures(struct r600_context *rctx)
+static void r600_flush_depth_textures(struct r600_context *rctx,
+                                     struct r600_textures_info *textures)
 {
-       unsigned int i;
+       unsigned i;
 
-       /* XXX: This handles fragment shader textures only. */
-
-       for (i = 0; i < rctx->ps_samplers.n_views; ++i) {
+       for (i = 0; i < textures->n_views; ++i) {
                struct pipe_sampler_view *view;
                struct r600_resource_texture *tex;
 
-               view = &rctx->ps_samplers.views[i]->base;
+               view = &textures->views[i]->base;
                if (!view) continue;
 
                tex = (struct r600_resource_texture *)view->texture;
-               if (!tex->is_depth)
-                       continue;
-
-               if (tex->is_flushing_texture)
+               if (!tex->is_depth || tex->is_flushing_texture)
                        continue;
 
                r600_blit_uncompress_depth(&rctx->context, tex, NULL,
@@ -212,6 +208,14 @@ void r600_flush_depth_textures(struct r600_context *rctx)
                                           0,
                                           u_max_layer(&tex->resource.b.b, view->u.tex.first_level));
        }
+}
+
+void r600_flush_all_depth_textures(struct r600_context *rctx)
+{
+       unsigned i;
+
+       r600_flush_depth_textures(rctx, &rctx->ps_samplers);
+       r600_flush_depth_textures(rctx, &rctx->vs_samplers);
 
        /* also check CB here */
        for (i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
@@ -219,10 +223,7 @@ void r600_flush_depth_textures(struct r600_context *rctx)
                struct pipe_surface *surf = rctx->framebuffer.cbufs[i];
                tex = (struct r600_resource_texture *)surf->texture;
 
-               if (!tex->is_depth)
-                       continue;
-
-               if (tex->is_flushing_texture)
+               if (!tex->is_depth || tex->is_flushing_texture)
                        continue;
 
                r600_blit_uncompress_depth(&rctx->context, tex, NULL,
index 1ee5604b011187aea01cf30220d3b230a3e574b4..7843579207a3b71d659c0dcca679a2eb6a33b956 100644 (file)
@@ -444,7 +444,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx,
                struct r600_resource_texture *staging,
                unsigned first_level, unsigned last_level,
                unsigned first_layer, unsigned last_layer);
-void r600_flush_depth_textures(struct r600_context *rctx);
+void r600_flush_all_depth_textures(struct r600_context *rctx);
 
 /* r600_buffer.c */
 bool r600_init_resource(struct r600_screen *rscreen,
index e62cd2e9280abb289e68c31aa0df687dc9ce78dd..d95222072ca22b9b72233021da5fec476a3c7528 100644 (file)
@@ -805,7 +805,7 @@ static void r600_update_derived_state(struct r600_context *rctx)
 
        if (!rctx->blitter->running) {
                if (rctx->have_depth_fb || rctx->have_depth_texture)
-                       r600_flush_depth_textures(rctx);
+                       r600_flush_all_depth_textures(rctx);
        }
 
        if (rctx->chip_class < EVERGREEN) {