From da3375d5a4ce7a6ae172b4f922e08b40b37ef02d Mon Sep 17 00:00:00 2001 From: jpark37 Date: Tue, 6 Jul 2021 21:59:10 -0700 Subject: [PATCH] libobs: Add gs_generalize_format helper --- libobs/graphics/graphics.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libobs/graphics/graphics.h b/libobs/graphics/graphics.h index b43bd7b15..49cf12d62 100644 --- a/libobs/graphics/graphics.h +++ b/libobs/graphics/graphics.h @@ -1005,6 +1005,24 @@ static inline bool gs_is_srgb_format(enum gs_color_format format) } } +static inline enum gs_color_format +gs_generalize_format(enum gs_color_format format) +{ + switch (format) { + case GS_RGBA_UNORM: + format = GS_RGBA; + break; + case GS_BGRX_UNORM: + format = GS_BGRX; + break; + case GS_BGRA_UNORM: + format = GS_BGRA; + default:; + } + + return format; +} + static inline uint32_t gs_get_total_levels(uint32_t width, uint32_t height, uint32_t depth) {