diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-08-08 18:43:42 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2010-08-08 22:53:31 +0200 |
commit | 4f5e51068bce4e32a9561b4b4d6f3feca33642bf (patch) | |
tree | c4cebb02d8437bfe405e458dfbd83c78a323dbad /src/gallium/drivers/r300/r300_state_derived.c | |
parent | 363b74f132a5a329fac25322f3c5c227c55b94a8 (diff) | |
download | external_mesa3d-4f5e51068bce4e32a9561b4b4d6f3feca33642bf.zip external_mesa3d-4f5e51068bce4e32a9561b4b4d6f3feca33642bf.tar.gz external_mesa3d-4f5e51068bce4e32a9561b4b4d6f3feca33642bf.tar.bz2 |
r300g: flush zmasks of zbuffers we are going to use as samplers
It sometimes works, sometimes not. I guess we have the zmask offsets wrong.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_derived.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_state_derived.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index a85b46f..693b1e2 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -677,8 +677,44 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) } } +/* We can't use compressed zbuffers as samplers. */ +static void r300_flush_depth_textures(struct r300_context *r300) +{ + struct r300_textures_state *state = + (struct r300_textures_state*)r300->textures_state.state; + unsigned i, level; + unsigned count = MIN2(state->sampler_view_count, + state->sampler_state_count); + + if (r300->z_decomp_rd) + return; + + for (i = 0; i < count; i++) + if (state->sampler_views[i] && state->sampler_states[i]) { + struct pipe_resource *tex = state->sampler_views[i]->base.texture; + + if (tex->target == PIPE_TEXTURE_3D || + tex->target == PIPE_TEXTURE_CUBE) + continue; + + /* Ignore non-depth textures. + * Also ignore reinterpreted depth textures, e.g. resource_copy. */ + if (!util_format_is_depth_or_stencil(tex->format)) + continue; + + for (level = 0; level <= tex->last_level; level++) + if (r300_texture(tex)->dirty_zmask[level]) { + /* We don't handle 3D textures and cubemaps yet. */ + r300_flush_depth_stencil(&r300->context, tex, + u_subresource(0, level), 0); + } + } +} + void r300_update_derived_state(struct r300_context* r300) { + r300_flush_depth_textures(r300); + if (r300->textures_state.dirty) { r300_merge_textures_and_samplers(r300); } |