[Mesa-dev] [PATCH 6/6] radeonsi: Actually keep track if we are using depth textures for samplers.
Marek Olšák
maraeo at gmail.com
Thu Jan 17 08:56:02 PST 2013
This is a pretty ugly hack. It won't work if a depth texture is set in
a fragment shader and a non-depth texture is later set in a vertex
shader. That will cause have_depth_texture to be false.
The proper solution is to port the depth-texture tracking from r600g,
well, ideally the whole r600_textures_info structure and all code
which uses it. The structure tracks all sampler views and states for
each shader stage. For example:
// set that the i-th vertex texture is depth:
rctx->samplers[PIPE_SHADER_VERTEX].views.compressed_depthtex_mask |= 1 << i;
The decompression code then knows it should decompress the i-th vertex texture.
Forking r600g was obviously a bad idea, because now radeonsi is just
as horrible as r600g used to be.
Marek
On Wed, Jan 16, 2013 at 11:55 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> 20-odd more piglits.
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
> src/gallium/drivers/radeonsi/si_state.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index cc9f7ae..f7fe603 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -2197,7 +2197,8 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx,
> struct si_pipe_sampler_view **resource = (struct si_pipe_sampler_view **)views;
> struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
> int i, j;
> - int has_depth = 0;
> +
> + rctx->have_depth_texture = FALSE;
>
> if (!count)
> goto out;
> @@ -2210,8 +2211,12 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx,
> (struct pipe_sampler_view **)&samplers->views[i],
> views[i]);
>
> - if (views[i])
> + if (resource[i]) {
> + struct r600_resource_texture *rtex =
> + (struct r600_resource_texture *)views[i]->texture;
> + rctx->have_depth_texture |= rtex->depth && !rtex->is_flushing_texture;
> si_pm4_add_bo(pm4, resource[i]->resource, RADEON_USAGE_READ);
> + }
>
> for (j = 0; j < Elements(resource[i]->state); ++j) {
> si_pm4_sh_data_add(pm4, resource[i] ? resource[i]->state[j] : 0);
> @@ -2226,7 +2231,6 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx,
> si_pm4_sh_data_end(pm4, user_data_reg, SI_SGPR_RESOURCE);
>
> out:
> - rctx->have_depth_texture = has_depth;
> rctx->ps_samplers.n_views = count;
> return pm4;
> }
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list