gallium/postprocess: Fix depth logic
authorLauri Kasanen <cand@gmx.com>
Tue, 24 Jan 2012 19:37:07 +0000 (21:37 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 Feb 2012 21:42:06 +0000 (16:42 -0500)
This prevents a possible lapse of the depth buffer - the situation where
the app and pp have different depth buffers.

NOTE: This is a candidate for the 8.0 stable branch.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
src/gallium/auxiliary/postprocess/postprocess.h
src/gallium/auxiliary/postprocess/pp_init.c
src/gallium/auxiliary/postprocess/pp_run.c
src/gallium/state_trackers/dri/common/dri_context.c

index ef94f79997ac52cbf9bfa9804d1196ec86bbbc88..dfa15f713ac56b7ac22bb38301110b710967bb3e 100644 (file)
@@ -72,8 +72,7 @@ void pp_free(struct pp_queue_t *);
 void pp_free_fbos(struct pp_queue_t *);
 void pp_debug(const char *, ...);
 struct program *pp_init_prog(struct pp_queue_t *, struct pipe_screen *);
-void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int,
-                  struct pipe_resource *);
+void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int);
 
 /* The filters */
 
index 740d230a1e8edb5cf35e1c53766958455186c9d5..e2068c25e5bb69851ca8755d22b67579ebba1ac7 100644 (file)
@@ -135,7 +135,6 @@ pp_free_fbos(struct pp_queue_t *ppq)
       pipe_surface_reference(&ppq->inner_tmps[i], NULL);
       pipe_resource_reference(&ppq->inner_tmp[i], NULL);
    }
-   pipe_resource_reference(&ppq->depth, NULL);
    pipe_surface_reference(&ppq->stencils, NULL);
    pipe_resource_reference(&ppq->stencil, NULL);
 
@@ -196,7 +195,7 @@ pp_debug(const char *fmt, ...)
 /** Allocate the temp FBOs. Called on makecurrent and resize. */
 void
 pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
-             unsigned int h, struct pipe_resource *indepth)
+             unsigned int h)
 {
 
    struct program *p = ppq->p;  /* The lazy will inherit the earth */
@@ -243,11 +242,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
          goto error;
    }
 
-   tmp_res.format = p->surf.format = indepth->format;
    tmp_res.bind = p->surf.usage = PIPE_BIND_DEPTH_STENCIL;
-   pipe_resource_reference(&ppq->depth, indepth);
-   if (!ppq->depth)
-      goto error;
 
    tmp_res.format = p->surf.format = PIPE_FORMAT_S8_UINT_Z24_UNORM;
 
index ab09a5645cc87d6c65a040225e4771dd53dea49e..be52051ed65771b1c857ec1f48ec07693b4cb23c 100644 (file)
@@ -49,7 +49,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
        in->height0 != ppq->p->framebuffer.height) {
       pp_debug("Resizing the temp pp buffers\n");
       pp_free_fbos(ppq);
-      pp_init_fbos(ppq, in->width0, in->height0, indepth);
+      pp_init_fbos(ppq, in->width0, in->height0);
    }
 
    if (in == out && ppq->n_filters == 1) {
index 52c8f4a254b7aec9fe9412a1df39e9ee3ece8119..e07e16833a7ac9850ff82c0c9195b512b6e125f0 100644 (file)
@@ -237,8 +237,7 @@ dri_make_current(__DRIcontext * cPriv,
    if (draw->textures[ST_ATTACHMENT_BACK_LEFT] && draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]
       && ctx->pp)
          pp_init_fbos(ctx->pp, draw->textures[ST_ATTACHMENT_BACK_LEFT]->width0,
-            draw->textures[ST_ATTACHMENT_BACK_LEFT]->height0,
-            draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+            draw->textures[ST_ATTACHMENT_BACK_LEFT]->height0);
 
    return GL_TRUE;
 }