summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_state.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-06-29 21:57:00 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-07-06 10:43:51 +0200
commit18cc825fb9c599781074c3b008814714e8efd7a7 (patch)
tree7a04b88b37db813a96aab00a8acb3fdb8d9fc686 /src/gallium/drivers/radeonsi/si_state.c
parentf2eb34f82f074284b691d568d26426a1f633d5f0 (diff)
downloadexternal_mesa3d-18cc825fb9c599781074c3b008814714e8efd7a7.zip
external_mesa3d-18cc825fb9c599781074c3b008814714e8efd7a7.tar.gz
external_mesa3d-18cc825fb9c599781074c3b008814714e8efd7a7.tar.bz2
radeonsi: sample from flushed depth texture when required
Note that this has no effect yet. A case where can_sample_z/s can be false in radeonsi will be added in a later patch. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index ad63dab..4182906 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2978,6 +2978,25 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
/* Texturing with separate depth and stencil. */
pipe_format = state->format;
+
+ /* Depth/stencil texturing sometimes needs separate texture. */
+ if (tmp->is_depth && !r600_can_sample_zs(tmp, view->is_stencil_sampler)) {
+ if (!tmp->flushed_depth_texture &&
+ !r600_init_flushed_depth_texture(ctx, texture, NULL)) {
+ pipe_resource_reference(&view->base.texture, NULL);
+ FREE(view);
+ return NULL;
+ }
+
+ /* Override format for the case where the flushed texture
+ * contains only Z or only S.
+ */
+ if (tmp->flushed_depth_texture->resource.b.b.format != tmp->resource.b.b.format)
+ pipe_format = tmp->flushed_depth_texture->resource.b.b.format;
+
+ tmp = tmp->flushed_depth_texture;
+ }
+
surflevel = tmp->surface.level;
if (tmp->db_compatible) {