Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> --- src/gallium/auxiliary/util/u_format.c | 20 ++++++++++++++++++++ src/gallium/auxiliary/util/u_format.h | 11 +++++++++++ 2 files changed, 31 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index a8aa571..8b9fb15 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -208,6 +208,26 @@ util_format_is_supported(enum pipe_format format, unsigned bind) } +boolean +util_format_same_cbuf_formats( + const struct pipe_screen *screen, + int num_color_formats, + const enum pipe_format *color_formats, + enum pipe_format zsformat) +{ + enum pipe_format color = PIPE_FORMAT_NONE; + int i; + + for (i = 0; i < num_color_formats; i++) { + if (color == PIPE_FORMAT_NONE) + color = color_formats[i]; + if (color != color_formats[i]) + return FALSE; + } + + return TRUE; +} + void util_format_read_4f(enum pipe_format format, float *dst, unsigned dst_stride, diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 84f16d5..49b5656 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -35,6 +35,7 @@ #include "util/u_debug.h" union pipe_color_union; +struct pipe_screen; #ifdef __cplusplus @@ -665,6 +666,16 @@ boolean util_format_is_supported(enum pipe_format format, unsigned bind); /** + * Whether all the color buffers are the same. + */ +boolean +util_format_same_cbuf_formats( + const struct pipe_screen *screen, + int num_color_formats, + const enum pipe_format *color_formats, + enum pipe_format zsformat); + +/** * Whether this format is a rgab8 variant. * * That is, any format that matches the -- 1.8.1.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev