This fixes the issue with have_depth_texture never being set to false.
r600_atom_dirty(rctx, &rctx->db_misc_state.atom);
}
-static void r600_flush_depth_textures(struct r600_context *rctx,
- struct r600_textures_info *textures)
+void r600_flush_depth_textures(struct r600_context *rctx,
+ struct r600_textures_info *textures)
{
unsigned i;
+ unsigned depth_texture_mask = textures->depth_texture_mask;
- for (i = 0; i < textures->n_views; ++i) {
+ while (depth_texture_mask) {
struct pipe_sampler_view *view;
struct r600_resource_texture *tex;
+ i = u_bit_scan(&depth_texture_mask);
+
view = &textures->views[i]->base;
- if (!view) continue;
+ assert(view);
tex = (struct r600_resource_texture *)view->texture;
- if (!tex->is_depth || tex->is_flushing_texture)
- continue;
+ assert(tex->is_depth && !tex->is_flushing_texture);
r600_blit_uncompress_depth(&rctx->context, tex, NULL,
view->u.tex.first_level,
}
}
-void r600_flush_all_depth_textures(struct r600_context *rctx)
-{
- r600_flush_depth_textures(rctx, &rctx->ps_samplers);
- r600_flush_depth_textures(rctx, &rctx->vs_samplers);
-}
-
static void r600_clear(struct pipe_context *ctx, unsigned buffers,
const union pipe_color_union *color,
double depth, unsigned stencil)
struct r600_pipe_sampler_view *views[NUM_TEX_UNITS];
struct r600_pipe_sampler_state *samplers[NUM_TEX_UNITS];
unsigned n_views;
+ uint32_t depth_texture_mask; /* which textures are depth */
unsigned n_samplers;
bool samplers_dirty;
bool is_array_sampler[NUM_TEX_UNITS];
struct u_upload_mgr *uploader;
struct util_slab_mempool pool_transfers;
- boolean have_depth_texture;
unsigned default_ps_gprs, default_vs_gprs;
struct r600_resource_texture *staging,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer);
-void r600_flush_all_depth_textures(struct r600_context *rctx);
-
+void r600_flush_depth_textures(struct r600_context *rctx,
+ struct r600_textures_info *textures);
/* r600_buffer.c */
bool r600_init_resource(struct r600_screen *rscreen,
struct r600_resource *res,
}
if (rviews[i]) {
- if (((struct r600_resource_texture *)rviews[i]->base.texture)->is_depth)
- rctx->have_depth_texture = true;
+ struct r600_resource_texture *rtex =
+ (struct r600_resource_texture*)rviews[i]->base.texture;
+
+ if (rtex->is_depth && !rtex->is_flushing_texture) {
+ dst->depth_texture_mask |= 1 << i;
+ } else {
+ dst->depth_texture_mask &= ~(1 << i);
+ }
/* Changing from array to non-arrays textures and vice
* versa requires updating TEX_ARRAY_OVERRIDE on R6xx-R7xx. */
set_resource(rctx, &rviews[i]->state, i + R600_MAX_CONST_BUFFERS);
} else {
set_resource(rctx, NULL, i + R600_MAX_CONST_BUFFERS);
+ dst->depth_texture_mask &= ~(1 << i);
}
pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views[i], views[i]);
unsigned ps_dirty = 0;
if (!rctx->blitter->running) {
- if (rctx->have_depth_texture) {
- r600_flush_all_depth_textures(rctx);
+ /* Flush depth textures which need to be flushed. */
+ if (rctx->vs_samplers.depth_texture_mask) {
+ r600_flush_depth_textures(rctx, &rctx->vs_samplers);
+ }
+ if (rctx->ps_samplers.depth_texture_mask) {
+ r600_flush_depth_textures(rctx, &rctx->ps_samplers);
}
}