summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2022-03-16 19:50:43 +0100
committerOneric <oneric@oneric.stub>2022-03-17 23:58:33 +0100
commit9608c8c838e1046601c27f6473e23654fedf1716 (patch)
treeb1d4c88bc34b9db0899743af58cd3628a22b89b1 /libass/ass_render.c
parent5f0e8450f834894b2745238e3d32ff4878710ec8 (diff)
downloadlibass-9608c8c838e1046601c27f6473e23654fedf1716.tar.bz2
libass-9608c8c838e1046601c27f6473e23654fedf1716.tar.xz
asm/x86: check highest supported leaf for cpuid
If a higher then supported leaf is requested, at least Intel processors will silently return the data of the highest supported leaf, invalidating the following feature tests. Reported in: https://github.com/libass/libass/pull/603
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 40b6d5d..cf22bec 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -75,9 +75,11 @@ ASS_Renderer *ass_renderer_init(ASS_Library *library)
// images_root and related stuff is zero-filled in calloc
#if CONFIG_ASM && ARCH_X86
- if (has_avx2())
+ bool sse2, avx2;
+ ass_cpu_capabilities(&sse2, &avx2);
+ if (avx2)
priv->engine = &ass_bitmap_engine_avx2;
- else if (has_sse2())
+ else if (sse2)
priv->engine = &ass_bitmap_engine_sse2;
else
priv->engine = &ass_bitmap_engine_c;