Mesa (revert-f611af35): Revert "st/mesa: use fragment shader to copy stencil buffer"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 16 15:43:33 UTC 2020


Module: Mesa
Branch: revert-f611af35
Commit: 7a952efc08d7f29f270b06430a57c82597353d24
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a952efc08d7f29f270b06430a57c82597353d24

Author: Karol Herbst <karolherbst at gmail.com>
Date:   Thu Jul 16 15:43:29 2020 +0000

Revert "st/mesa: use fragment shader to copy stencil buffer"

This reverts commit f611af35948e4d1d56daa94f59d5feb7d44d24ce

---

 src/mesa/state_tracker/st_cb_drawpixels.c | 47 ++++++++-----------------------
 1 file changed, 12 insertions(+), 35 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 0537c6d24c8..3f84b22154d 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1704,8 +1704,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    GLboolean invertTex = GL_FALSE;
    GLint readX, readY, readW, readH;
    struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
-   GLboolean write_stencil = GL_FALSE;
-   GLboolean write_depth = GL_FALSE;
 
    _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
 
@@ -1724,6 +1722,12 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       return;
    }
 
+   if (type == GL_STENCIL) {
+      /* can't use texturing to do stencil */
+      copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty);
+      return;
+   }
+
    /*
     * The subsequent code implements glCopyPixels by copying the source
     * pixels into a temporary texture that's then applied to a textured quad.
@@ -1753,15 +1757,13 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
        * into the constant buffer, we need to update them
        */
       st_upload_constants(st, &st->fp->Base);
-   } else if (type == GL_DEPTH) {
+   }
+   else {
+      assert(type == GL_DEPTH);
       rbRead = st_renderbuffer(ctx->ReadBuffer->
                                Attachment[BUFFER_DEPTH].Renderbuffer);
+
       driver_fp = get_drawpix_z_stencil_program(st, GL_TRUE, GL_FALSE);
-   } else {
-      assert(type == GL_STENCIL);
-      rbRead = st_renderbuffer(ctx->ReadBuffer->
-                               Attachment[BUFFER_STENCIL].Renderbuffer);
-      driver_fp = get_drawpix_z_stencil_program(st, GL_FALSE, GL_TRUE);
    }
 
    /* Choose the format for the temporary texture. */
@@ -1777,11 +1779,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
                                       GL_NONE, st->internal_target, 0, 0,
                                       srcBind, false, false);
       }
-      else if (type == GL_STENCIL) {
-         /* can't use texturing, fallback to copy */
-         copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty);
-         return;
-      }
       else {
          assert(type == GL_COLOR);
 
@@ -1857,23 +1854,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       return;
    }
 
-   /* Create a second sampler view to read stencil */
-   if (type == GL_STENCIL) {
-      write_stencil = GL_TRUE;
-      enum pipe_format stencil_format =
-         util_format_stencil_only(pt->format);
-      /* we should not be doing pixel map/transfer (see above) */
-      assert(num_sampler_view == 1);
-      sv[1] = st_create_texture_sampler_view_format(st->pipe, pt,
-                                                    stencil_format);
-      if (!sv[1]) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
-         pipe_resource_reference(&pt, NULL);
-         pipe_sampler_view_reference(&sv[0], NULL);
-         return;
-      }
-      num_sampler_view++;
-   }
    /* Copy the src region to the temporary texture. */
    {
       struct pipe_blit_info blit;
@@ -1897,10 +1877,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       blit.dst.box.width = readW;
       blit.dst.box.height = readH;
       blit.dst.box.depth = 1;
-      if (type != GL_STENCIL)
-         blit.mask = util_format_get_mask(pt->format) & ~PIPE_MASK_S;
-      else
-         blit.mask = util_format_get_mask(pt->format) & ~PIPE_MASK_Z;
+      blit.mask = util_format_get_mask(pt->format) & ~PIPE_MASK_S;
       blit.filter = PIPE_TEX_FILTER_NEAREST;
 
       pipe->blit(pipe, &blit);
@@ -1917,7 +1894,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
                       st->passthrough_vs,
                       driver_fp, fpv,
                       ctx->Current.Attrib[VERT_ATTRIB_COLOR0],
-                      invertTex, write_depth, write_stencil);
+                      invertTex, GL_FALSE, GL_FALSE);
 
    pipe_resource_reference(&pt, NULL);
    pipe_sampler_view_reference(&sv[0], NULL);



More information about the mesa-commit mailing list