r600g: move depth texture flushing out of line.
this needs a piglit run. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
296e6b9038
commit
2743851c1a
|
@ -482,19 +482,27 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou
|
|||
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
|
||||
struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
|
||||
int i;
|
||||
int has_depth = 0;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (&rctx->ps_samplers.views[i]->base != views[i]) {
|
||||
if (resource[i])
|
||||
if (resource[i]) {
|
||||
if (((struct r600_resource_texture *)resource[i]->base.texture)->depth)
|
||||
has_depth = 1;
|
||||
evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state,
|
||||
i + R600_MAX_CONST_BUFFERS);
|
||||
else
|
||||
} else
|
||||
evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL,
|
||||
i + R600_MAX_CONST_BUFFERS);
|
||||
|
||||
pipe_sampler_view_reference(
|
||||
(struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
|
||||
views[i]);
|
||||
} else {
|
||||
if (resource[i]) {
|
||||
if (((struct r600_resource_texture *)resource[i]->base.texture)->depth)
|
||||
has_depth = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = count; i < NUM_TEX_UNITS; i++) {
|
||||
|
@ -504,6 +512,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou
|
|||
pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
|
||||
}
|
||||
}
|
||||
rctx->have_depth_texture = has_depth;
|
||||
rctx->ps_samplers.n_views = count;
|
||||
}
|
||||
|
||||
|
@ -689,6 +698,9 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
|
|||
surf = (struct r600_surface *)state->cbufs[cb];
|
||||
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
|
||||
|
||||
if (rtex->depth)
|
||||
rctx->have_depth_fb = TRUE;
|
||||
|
||||
if (rtex->depth && !rtex->is_flushing_texture) {
|
||||
r600_texture_depth_flush(&rctx->context, state->cbufs[cb]->texture, TRUE);
|
||||
rtex = rtex->flushed_depth_texture;
|
||||
|
@ -870,6 +882,7 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
|
|||
util_copy_framebuffer_state(&rctx->framebuffer, state);
|
||||
|
||||
/* build states */
|
||||
rctx->have_depth_fb = 0;
|
||||
for (int i = 0; i < state->nr_cbufs; i++) {
|
||||
evergreen_cb(rctx, rstate, state, i);
|
||||
}
|
||||
|
|
|
@ -261,6 +261,7 @@ struct r600_context {
|
|||
struct r600_range vs_resources;
|
||||
struct r600_range fs_resources;
|
||||
int num_ps_resources, num_vs_resources, num_fs_resources;
|
||||
boolean have_depth_texture, have_depth_fb;
|
||||
};
|
||||
|
||||
struct r600_draw {
|
||||
|
|
|
@ -121,8 +121,6 @@ void r600_flush_depth_textures(struct r600_pipe_context *rctx)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
if (rctx->blit) return;
|
||||
|
||||
/* FIXME: This handles fragment shader textures only. */
|
||||
|
||||
for (i = 0; i < rctx->ps_samplers.n_views; ++i) {
|
||||
|
|
|
@ -204,6 +204,7 @@ struct r600_pipe_context {
|
|||
struct u_vbuf_mgr *vbuf_mgr;
|
||||
struct util_slab_mempool pool_transfers;
|
||||
boolean blit;
|
||||
boolean have_depth_texture, have_depth_fb;
|
||||
|
||||
unsigned default_ps_gprs, default_vs_gprs;
|
||||
};
|
||||
|
|
|
@ -518,13 +518,16 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
|
|||
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
|
||||
struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
|
||||
int i;
|
||||
int has_depth = 0;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (&rctx->ps_samplers.views[i]->base != views[i]) {
|
||||
if (resource[i])
|
||||
if (resource[i]) {
|
||||
if (((struct r600_resource_texture *)resource[i]->base.texture)->depth)
|
||||
has_depth = 1;
|
||||
r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state,
|
||||
i + R600_MAX_CONST_BUFFERS);
|
||||
else
|
||||
} else
|
||||
r600_context_pipe_state_set_ps_resource(&rctx->ctx, NULL,
|
||||
i + R600_MAX_CONST_BUFFERS);
|
||||
|
||||
|
@ -532,6 +535,11 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
|
|||
(struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
|
||||
views[i]);
|
||||
|
||||
} else {
|
||||
if (resource[i]) {
|
||||
if (((struct r600_resource_texture *)resource[i]->base.texture)->depth)
|
||||
has_depth = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = count; i < NUM_TEX_UNITS; i++) {
|
||||
|
@ -541,6 +549,7 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
|
|||
pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
|
||||
}
|
||||
}
|
||||
rctx->have_depth_texture = has_depth;
|
||||
rctx->ps_samplers.n_views = count;
|
||||
}
|
||||
|
||||
|
@ -724,6 +733,9 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
|
|||
surf = (struct r600_surface *)state->cbufs[cb];
|
||||
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
|
||||
|
||||
if (rtex->depth)
|
||||
rctx->have_depth_fb = TRUE;
|
||||
|
||||
if (rtex->depth && !rtex->is_flushing_texture) {
|
||||
r600_texture_depth_flush(&rctx->context, state->cbufs[cb]->texture, TRUE);
|
||||
rtex = rtex->flushed_depth_texture;
|
||||
|
@ -886,6 +898,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
|
|||
util_copy_framebuffer_state(&rctx->framebuffer, state);
|
||||
|
||||
/* build states */
|
||||
rctx->have_depth_fb = 0;
|
||||
for (int i = 0; i < state->nr_cbufs; i++) {
|
||||
r600_cb(rctx, rstate, state, i);
|
||||
}
|
||||
|
|
|
@ -530,7 +530,10 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
|
|||
struct r600_drawl draw = {};
|
||||
unsigned prim;
|
||||
|
||||
r600_flush_depth_textures(rctx);
|
||||
if (!rctx->blit) {
|
||||
if (rctx->have_depth_fb || rctx->have_depth_texture)
|
||||
r600_flush_depth_textures(rctx);
|
||||
}
|
||||
u_vbuf_mgr_draw_begin(rctx->vbuf_mgr, info, NULL, NULL);
|
||||
r600_vertex_buffer_update(rctx);
|
||||
|
||||
|
|
Loading…
Reference in New Issue