Mesa (master): v3d: add color formats and swizzles to the fragment shader key

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 12 07:19:04 UTC 2019


Module: Mesa
Branch: master
Commit: 0279ac6e51e772bf9c374f4eb736d5f11d97d5f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0279ac6e51e772bf9c374f4eb736d5f11d97d5f9

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed Jul  3 09:14:25 2019 +0200

v3d: add color formats and swizzles to the fragment shader key

We are going to need these very soon to emit correct reads from the tlb
to implement logic operations.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/broadcom/compiler/v3d_compiler.h  |  9 +++++++++
 src/gallium/drivers/v3d/v3d_program.c | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 5c4e3046f50..c7463540850 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -355,6 +355,15 @@ struct v3d_fs_key {
          */
         uint8_t int_color_rb;
         uint8_t uint_color_rb;
+
+        /* Color format information per render target. Only set when logic
+         * operations are enabled.
+         */
+        struct {
+                enum pipe_format format;
+                const uint8_t *swizzle;
+        } color_fmt[V3D_MAX_DRAW_BUFFERS];
+
         uint8_t alpha_test_func;
         uint8_t logicop_func;
         uint32_t point_sprite_mask;
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index cdacb5dbb80..78c41c8efd1 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -537,6 +537,17 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
                  */
                 key->cbufs |= 1 << i;
 
+                /* If logic operations are enabled then we might emit color
+                 * reads and we need to know the color buffer format and
+                 * swizzle for that.
+                 */
+                if (key->logicop_func != PIPE_LOGICOP_COPY) {
+                        key->color_fmt[i].format = cbuf->format;
+                        key->color_fmt[i].swizzle =
+                                v3d_get_format_swizzle(&v3d->screen->devinfo,
+                                                       cbuf->format);
+                }
+
                 const struct util_format_description *desc =
                         util_format_description(cbuf->format);
 




More information about the mesa-commit mailing list