Skip to content

Commit 2025f7e

Browse files
committed
Centralize and expand SDL3 SIMD compat
1 parent a53bfb2 commit 2025f7e

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

src_c/_surface.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,28 @@
2727
#include "_pygame.h"
2828
#include "surface.h"
2929

30+
// Some simd compat stuff going here for now.
31+
#if PG_SDL3
32+
// SDL3 no longer includes intrinsics by default, we need to do it explicitly
33+
#include <SDL3/SDL_intrin.h>
34+
35+
/* If SDL_AVX2_INTRINSICS is defined by SDL3, we need to set macros that our
36+
* code checks for avx2 build time support */
37+
#ifdef SDL_AVX2_INTRINSICS
38+
#ifndef HAVE_IMMINTRIN_H
39+
#define HAVE_IMMINTRIN_H 1
40+
#endif /* HAVE_IMMINTRIN_H*/
41+
#ifndef __AVX2__
42+
#define __AVX2__
43+
#endif /* __AVX2__*/
44+
#endif /* SDL_AVX2_INTRINSICS*/
45+
46+
// TODO reenable this to test best
47+
#ifdef SDL_SSE2_INTRINSICS
48+
#ifndef __SSE2__
49+
#define __SSE2__
50+
#endif /* __SSE2__*/
51+
#endif /* SDL_SSE2_INTRINSICS*/
52+
#endif /* PG_SDL3 */
53+
3054
#endif

src_c/simd_transform.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
11
#define NO_PYGAME_C_API
22
#include "_surface.h"
33

4-
/* TODO: This compat code should probably go in some place like simd_shared.h
5-
* That header file however is inconsistently used at the moment and not
6-
* included wherever it should be.
7-
* this block will be needed by simd_blitters and simd_fill */
8-
9-
#if PG_SDL3
10-
// SDL3 no longer includes intrinsics by default, we need to do it explicitly
11-
#include <SDL3/SDL_intrin.h>
12-
13-
/* If SDL_AVX2_INTRINSICS is defined by SDL3, we need to set macros that our
14-
* code checks for avx2 build time support */
15-
#ifdef SDL_AVX2_INTRINSICS
16-
#ifndef HAVE_IMMINTRIN_H
17-
#define HAVE_IMMINTRIN_H 1
18-
#endif /* HAVE_IMMINTRIN_H*/
19-
#endif /* SDL_AVX2_INTRINSICS*/
20-
#endif /* PG_SDL3 */
21-
224
/**
235
* MACRO borrowed from SSE2NEON - useful for making the shuffling family of
246
* intrinsics easier to understand by indicating clearly what will go where.

0 commit comments

Comments
 (0)