Mesa (master): gallium: extract out logicop helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 30 04:04:12 UTC 2020
Module: Mesa
Branch: master
Commit: f78af3372131e4c2f0344396d3490abe816992cf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f78af3372131e4c2f0344396d3490abe816992cf
Author: Rob Clark <robdclark at chromium.org>
Date: Wed Apr 29 17:31:56 2020 -0700
gallium: extract out logicop helper
Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4826>
---
src/gallium/auxiliary/util/u_inlines.h | 26 ++++++++++++++++++++++++++
src/gallium/drivers/freedreno/a3xx/fd3_blend.c | 18 +-----------------
src/gallium/drivers/freedreno/a4xx/fd4_blend.c | 18 +-----------------
src/gallium/drivers/freedreno/a5xx/fd5_blend.c | 18 +-----------------
src/gallium/drivers/freedreno/a6xx/fd6_blend.c | 18 +-----------------
5 files changed, 30 insertions(+), 68 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 8adf343cf8a..8d656f63fa3 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -736,6 +736,32 @@ util_texrange_covers_whole_level(const struct pipe_resource *tex,
depth == util_num_layers(tex, level);
}
+static inline bool
+util_logicop_reads_dest(enum pipe_logicop op)
+{
+ switch (op) {
+ case PIPE_LOGICOP_NOR:
+ case PIPE_LOGICOP_AND_INVERTED:
+ case PIPE_LOGICOP_AND_REVERSE:
+ case PIPE_LOGICOP_INVERT:
+ case PIPE_LOGICOP_XOR:
+ case PIPE_LOGICOP_NAND:
+ case PIPE_LOGICOP_AND:
+ case PIPE_LOGICOP_EQUIV:
+ case PIPE_LOGICOP_NOOP:
+ case PIPE_LOGICOP_OR_INVERTED:
+ case PIPE_LOGICOP_OR_REVERSE:
+ case PIPE_LOGICOP_OR:
+ return true;
+ case PIPE_LOGICOP_CLEAR:
+ case PIPE_LOGICOP_COPY_INVERTED:
+ case PIPE_LOGICOP_COPY:
+ case PIPE_LOGICOP_SET:
+ return false;
+ }
+ unreachable("bad logicop");
+}
+
static inline struct pipe_context *
pipe_create_multimedia_context(struct pipe_screen *screen)
{
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_blend.c b/src/gallium/drivers/freedreno/a3xx/fd3_blend.c
index 383e557f18e..5773ed2eef4 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_blend.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_blend.c
@@ -66,23 +66,7 @@ fd3_blend_state_create(struct pipe_context *pctx,
if (cso->logicop_enable) {
rop = cso->logicop_func; /* maps 1:1 */
-
- switch (cso->logicop_func) {
- case PIPE_LOGICOP_NOR:
- case PIPE_LOGICOP_AND_INVERTED:
- case PIPE_LOGICOP_AND_REVERSE:
- case PIPE_LOGICOP_INVERT:
- case PIPE_LOGICOP_XOR:
- case PIPE_LOGICOP_NAND:
- case PIPE_LOGICOP_AND:
- case PIPE_LOGICOP_EQUIV:
- case PIPE_LOGICOP_NOOP:
- case PIPE_LOGICOP_OR_INVERTED:
- case PIPE_LOGICOP_OR_REVERSE:
- case PIPE_LOGICOP_OR:
- reads_dest = true;
- break;
- }
+ reads_dest = util_logicop_reads_dest(cso->logicop_func);
}
so = CALLOC_STRUCT(fd3_blend_stateobj);
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_blend.c b/src/gallium/drivers/freedreno/a4xx/fd4_blend.c
index 9a728088192..9b067e0e07b 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_blend.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_blend.c
@@ -64,23 +64,7 @@ fd4_blend_state_create(struct pipe_context *pctx,
if (cso->logicop_enable) {
rop = cso->logicop_func; /* maps 1:1 */
-
- switch (cso->logicop_func) {
- case PIPE_LOGICOP_NOR:
- case PIPE_LOGICOP_AND_INVERTED:
- case PIPE_LOGICOP_AND_REVERSE:
- case PIPE_LOGICOP_INVERT:
- case PIPE_LOGICOP_XOR:
- case PIPE_LOGICOP_NAND:
- case PIPE_LOGICOP_AND:
- case PIPE_LOGICOP_EQUIV:
- case PIPE_LOGICOP_NOOP:
- case PIPE_LOGICOP_OR_INVERTED:
- case PIPE_LOGICOP_OR_REVERSE:
- case PIPE_LOGICOP_OR:
- reads_dest = true;
- break;
- }
+ reads_dest = util_logicop_reads_dest(cso->logicop_func);
}
so = CALLOC_STRUCT(fd4_blend_stateobj);
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blend.c b/src/gallium/drivers/freedreno/a5xx/fd5_blend.c
index a7efcca6187..c98d7c5863a 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_blend.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_blend.c
@@ -65,23 +65,7 @@ fd5_blend_state_create(struct pipe_context *pctx,
if (cso->logicop_enable) {
rop = cso->logicop_func; /* maps 1:1 */
-
- switch (cso->logicop_func) {
- case PIPE_LOGICOP_NOR:
- case PIPE_LOGICOP_AND_INVERTED:
- case PIPE_LOGICOP_AND_REVERSE:
- case PIPE_LOGICOP_INVERT:
- case PIPE_LOGICOP_XOR:
- case PIPE_LOGICOP_NAND:
- case PIPE_LOGICOP_AND:
- case PIPE_LOGICOP_EQUIV:
- case PIPE_LOGICOP_NOOP:
- case PIPE_LOGICOP_OR_INVERTED:
- case PIPE_LOGICOP_OR_REVERSE:
- case PIPE_LOGICOP_OR:
- reads_dest = true;
- break;
- }
+ reads_dest = util_logicop_reads_dest(cso->logicop_func);
}
so = CALLOC_STRUCT(fd5_blend_stateobj);
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
index 734f1868b01..40a99822297 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
@@ -68,23 +68,7 @@ fd6_blend_state_create(struct pipe_context *pctx,
if (cso->logicop_enable) {
rop = cso->logicop_func; /* maps 1:1 */
-
- switch (cso->logicop_func) {
- case PIPE_LOGICOP_NOR:
- case PIPE_LOGICOP_AND_INVERTED:
- case PIPE_LOGICOP_AND_REVERSE:
- case PIPE_LOGICOP_INVERT:
- case PIPE_LOGICOP_XOR:
- case PIPE_LOGICOP_NAND:
- case PIPE_LOGICOP_AND:
- case PIPE_LOGICOP_EQUIV:
- case PIPE_LOGICOP_NOOP:
- case PIPE_LOGICOP_OR_INVERTED:
- case PIPE_LOGICOP_OR_REVERSE:
- case PIPE_LOGICOP_OR:
- reads_dest = true;
- break;
- }
+ reads_dest = util_logicop_reads_dest(cso->logicop_func);
}
so = CALLOC_STRUCT(fd6_blend_stateobj);
More information about the mesa-commit
mailing list