From 32ee42d26122f512762b0e4680f9f1307ce5f3eb Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 28 Apr 2022 01:33:15 +0100 Subject: [PATCH] gl-renderer: Remove useless texture_type enum This was just a duplicate of shader variants, for historical reasons. Signed-off-by: Daniel Stone --- libweston/renderer-gl/gl-renderer.c | 37 ++++++----------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 7fcf1f9d..2eeefcbb 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -125,18 +125,11 @@ struct yuv_plane_descriptor { int plane_index; }; -enum texture_type { - TEXTURE_Y_XUXV_WL, - TEXTURE_Y_UV_WL, - TEXTURE_Y_U_V_WL, - TEXTURE_XYUV_WL -}; - struct yuv_format_descriptor { uint32_t format; int input_planes; int output_planes; - enum texture_type texture_type; + enum gl_shader_texture_variant shader_variant; struct yuv_plane_descriptor plane[4]; }; @@ -2298,7 +2291,7 @@ struct yuv_format_descriptor yuv_formats[] = { .format = DRM_FORMAT_YUYV, .input_planes = 1, .output_planes = 2, - .texture_type = TEXTURE_Y_XUXV_WL, + .shader_variant = SHADER_VARIANT_Y_XUXV, {{ .width_divisor = 1, .height_divisor = 1, @@ -2314,7 +2307,7 @@ struct yuv_format_descriptor yuv_formats[] = { .format = DRM_FORMAT_NV12, .input_planes = 2, .output_planes = 2, - .texture_type = TEXTURE_Y_UV_WL, + .shader_variant = SHADER_VARIANT_Y_UV, {{ .width_divisor = 1, .height_divisor = 1, @@ -2330,7 +2323,7 @@ struct yuv_format_descriptor yuv_formats[] = { .format = DRM_FORMAT_YUV420, .input_planes = 3, .output_planes = 3, - .texture_type = TEXTURE_Y_U_V_WL, + .shader_variant = SHADER_VARIANT_Y_U_V, {{ .width_divisor = 1, .height_divisor = 1, @@ -2351,7 +2344,7 @@ struct yuv_format_descriptor yuv_formats[] = { .format = DRM_FORMAT_YUV444, .input_planes = 3, .output_planes = 3, - .texture_type = TEXTURE_Y_U_V_WL, + .shader_variant = SHADER_VARIANT_Y_U_V, {{ .width_divisor = 1, .height_divisor = 1, @@ -2372,7 +2365,7 @@ struct yuv_format_descriptor yuv_formats[] = { .format = DRM_FORMAT_XYUV8888, .input_planes = 1, .output_planes = 1, - .texture_type = TEXTURE_XYUV_WL, + .shader_variant = SHADER_VARIANT_XYUV, {{ .width_divisor = 1, .height_divisor = 1, @@ -2458,23 +2451,7 @@ import_yuv_dmabuf(struct gl_renderer *gr, struct gl_buffer_state *gb, } gb->num_images = format->output_planes; - - switch (format->texture_type) { - case TEXTURE_Y_XUXV_WL: - gb->shader_variant = SHADER_VARIANT_Y_XUXV; - break; - case TEXTURE_Y_UV_WL: - gb->shader_variant = SHADER_VARIANT_Y_UV; - break; - case TEXTURE_Y_U_V_WL: - gb->shader_variant = SHADER_VARIANT_Y_U_V; - break; - case TEXTURE_XYUV_WL: - gb->shader_variant = SHADER_VARIANT_XYUV; - break; - default: - assert(false); - } + gb->shader_variant = format->shader_variant; target = gl_shader_texture_variant_get_target(gb->shader_variant); ensure_textures(gb, target, gb->num_images);