Use #ifdef/#ifndef instead of #if defined/#if \!defined

This commit is contained in:
Anonymous Maarten
2023-03-30 20:26:31 +02:00
committed by Anonymous Maarten
parent 308bcbbe76
commit b6ae281e97
129 changed files with 450 additions and 450 deletions

View File

@@ -112,7 +112,7 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface);
* Useful macros for blitting routines
*/
#if defined(__GNUC__)
#ifdef __GNUC__
#define DECLARE_ALIGNED(t, v, a) t __attribute__((aligned(a))) v
#elif defined(_MSC_VER)
#define DECLARE_ALIGNED(t, v, a) __declspec(align(a)) t v

View File

@@ -166,7 +166,7 @@ static void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info)
}
}
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
/* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
static void SDL_TARGETING("mmx") BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info)
@@ -441,7 +441,7 @@ static void BlitRGBtoRGBPixelAlphaARMSIMD(SDL_BlitInfo *info)
}
#endif
#if defined(SDL_ARM_NEON_BLITTERS)
#ifdef SDL_ARM_NEON_BLITTERS
void BlitARGBto565PixelAlphaARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride);
static void BlitARGBto565PixelAlphaARMNEON(SDL_BlitInfo *info)
@@ -750,7 +750,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask)
}
}
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
/* fast RGB565->RGB565 blending with surface alpha */
static void SDL_TARGETING("mmx") Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
@@ -1337,12 +1337,12 @@ SDL_CalculateBlitA(SDL_Surface *surface)
case 2:
#if defined(SDL_ARM_NEON_BLITTERS) || defined(SDL_ARM_SIMD_BLITTERS)
if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && df->Gmask == 0x7e0 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
#if defined(SDL_ARM_NEON_BLITTERS)
#ifdef SDL_ARM_NEON_BLITTERS
if (SDL_HasNEON()) {
return BlitARGBto565PixelAlphaARMNEON;
}
#endif
#if defined(SDL_ARM_SIMD_BLITTERS)
#ifdef SDL_ARM_SIMD_BLITTERS
if (SDL_HasARMSIMD()) {
return BlitARGBto565PixelAlphaARMSIMD;
}
@@ -1360,7 +1360,7 @@ SDL_CalculateBlitA(SDL_Surface *surface)
case 4:
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
if (SDL_HasMMX()) {
return BlitRGBtoRGBPixelAlphaMMX;
@@ -1368,12 +1368,12 @@ SDL_CalculateBlitA(SDL_Surface *surface)
}
#endif /* SDL_MMX_INTRINSICS */
if (sf->Amask == 0xff000000) {
#if defined(SDL_ARM_NEON_BLITTERS)
#ifdef SDL_ARM_NEON_BLITTERS
if (SDL_HasNEON()) {
return BlitRGBtoRGBPixelAlphaARMNEON;
}
#endif
#if defined(SDL_ARM_SIMD_BLITTERS)
#ifdef SDL_ARM_SIMD_BLITTERS
if (SDL_HasARMSIMD()) {
return BlitRGBtoRGBPixelAlphaARMSIMD;
}
@@ -1408,7 +1408,7 @@ SDL_CalculateBlitA(SDL_Surface *surface)
case 2:
if (surface->map->identity) {
if (df->Gmask == 0x7e0) {
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
if (SDL_HasMMX()) {
return Blit565to565SurfaceAlphaMMX;
} else
@@ -1417,7 +1417,7 @@ SDL_CalculateBlitA(SDL_Surface *surface)
return Blit565to565SurfaceAlpha;
}
} else if (df->Gmask == 0x3e0) {
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
if (SDL_HasMMX()) {
return Blit555to555SurfaceAlphaMMX;
} else
@@ -1431,7 +1431,7 @@ SDL_CalculateBlitA(SDL_Surface *surface)
case 4:
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) {
return BlitRGBtoRGBSurfaceAlphaMMX;
}

View File

@@ -29,7 +29,7 @@
#define HAVE_FAST_WRITE_INT8 1
/* On some CPU, it's slower than combining and write a word */
#if defined(__MIPS__)
#ifdef __MIPS__
#undef HAVE_FAST_WRITE_INT8
#define HAVE_FAST_WRITE_INT8 0
#endif
@@ -904,7 +904,7 @@ static enum blit_features GetBlitFeatures(void)
#define GetBlitFeatures() ((SDL_HasMMX() ? BLIT_FEATURE_HAS_MMX : 0) | (SDL_HasARMSIMD() ? BLIT_FEATURE_HAS_ARM_SIMD : 0))
#endif
#if defined(SDL_ARM_SIMD_BLITTERS)
#ifdef SDL_ARM_SIMD_BLITTERS
void Blit_BGR888_RGB888ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride);
static void Blit_BGR888_RGB888ARMSIMD(SDL_BlitInfo *info)

View File

@@ -23,7 +23,7 @@
#include "SDL_blit.h"
#include "SDL_blit_copy.h"
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
/* This assumes 16-byte aligned src and dst */
static SDL_INLINE void SDL_TARGETING("sse") SDL_memcpySSE(Uint8 *dst, const Uint8 *src, int len)
{
@@ -50,7 +50,7 @@ static SDL_INLINE void SDL_TARGETING("sse") SDL_memcpySSE(Uint8 *dst, const Uint
}
#endif /* SDL_SSE_INTRINSICS */
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
#ifdef _MSC_VER
#pragma warning(disable : 4799)
#endif
@@ -136,7 +136,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info)
return;
}
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
if (SDL_HasSSE() &&
!((uintptr_t)src & 15) && !(srcskip & 15) &&
!((uintptr_t)dst & 15) && !(dstskip & 15)) {
@@ -149,7 +149,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info)
}
#endif
#if defined(SDL_MMX_INTRINSICS)
#ifdef SDL_MMX_INTRINSICS
if (SDL_HasMMX() && !(srcskip & 7) && !(dstskip & 7)) {
SDL_BlitCopyMMX(dst, src, dstskip, srcskip, w, h);
return;

View File

@@ -58,7 +58,7 @@
#define EGL_PRESENT_OPAQUE_EXT 0x31DF
#endif /* EGL_EXT_present_opaque */
#if defined(SDL_VIDEO_DRIVER_RPI)
#ifdef SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
#define DEFAULT_EGL (vc4 ? "libEGL.so.1" : "libbrcmEGL.so")
#define DEFAULT_OGL_ES2 (vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so")
@@ -304,7 +304,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT)
const char *d3dcompiler;
#endif
#if defined(SDL_VIDEO_DRIVER_RPI)
#ifdef SDL_VIDEO_DRIVER_RPI
SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
#endif
@@ -425,7 +425,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
#endif
_this->egl_data->egl_dll_handle = egl_dll_handle;
#if defined(SDL_VIDEO_DRIVER_VITA)
#ifdef SDL_VIDEO_DRIVER_VITA
_this->egl_data->opengl_dll_handle = opengl_dll_handle;
#endif
@@ -512,8 +512,8 @@ int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_di
_this->egl_data->egl_display = EGL_NO_DISPLAY;
#if !defined(__WINRT__)
#if !defined(SDL_VIDEO_DRIVER_VITA)
#ifndef __WINRT__
#ifndef SDL_VIDEO_DRIVER_VITA
if (platform) {
/* EGL 1.5 allows querying for client version with EGL_NO_DISPLAY
* --

View File

@@ -22,7 +22,7 @@
#include "SDL_blit.h"
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
/* *INDENT-OFF* */ /* clang-format off */
#if defined(_MSC_VER) && !defined(__clang__)
@@ -247,7 +247,7 @@ int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
return SDL_FillSurfaceRects(dst, rect, 1, color);
}
#if defined(SDL_ARM_NEON_BLITTERS)
#ifdef SDL_ARM_NEON_BLITTERS
void FillSurfaceRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src);
void FillSurfaceRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src);
void FillSurfaceRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src);
@@ -339,7 +339,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
return SDL_SetError("SDL_FillSurfaceRects(): Unsupported surface format");
}
#if defined(SDL_ARM_NEON_BLITTERS)
#ifdef SDL_ARM_NEON_BLITTERS
if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && fill_function == NULL) {
switch (dst->format->BytesPerPixel) {
case 1:
@@ -376,7 +376,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
{
color |= (color << 8);
color |= (color << 16);
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
if (SDL_HasSSE()) {
fill_function = SDL_FillSurfaceRect1SSE;
break;
@@ -389,7 +389,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
case 2:
{
color |= (color << 16);
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
if (SDL_HasSSE()) {
fill_function = SDL_FillSurfaceRect2SSE;
break;
@@ -408,7 +408,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
case 4:
{
#if defined(SDL_SSE_INTRINSICS)
#ifdef SDL_SSE_INTRINSICS
if (SDL_HasSSE()) {
fill_function = SDL_FillSurfaceRect4SSE;
break;

View File

@@ -183,7 +183,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect,
left_pad_w = left_pad_w_init; \
middle = middle_init;
#if defined(__clang__)
#ifdef __clang__
// Remove inlining of this function
// Compiler crash with clang 9.0.8 / android-ndk-r21d
// Compiler crash with clang 11.0.3 / Xcode
@@ -346,7 +346,7 @@ static int scale_mat(const Uint32 *src, int src_w, int src_h, int src_pitch,
#endif
#endif
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
#if 0
static void SDL_TARGETING("sse2") printf_128(const char *str, __m128i var)
@@ -524,7 +524,7 @@ static int SDL_TARGETING("sse2") scale_mat_SSE(const Uint32 *src, int src_w, int
}
#endif
#if defined(SDL_NEON_INTRINSICS)
#ifdef SDL_NEON_INTRINSICS
static SDL_INLINE int hasNEON(void)
{
@@ -800,13 +800,13 @@ int SDL_LowerSoftStretchLinear(SDL_Surface *s, const SDL_Rect *srcrect,
Uint32 *src = (Uint32 *)((Uint8 *)s->pixels + srcrect->x * 4 + srcrect->y * src_pitch);
Uint32 *dst = (Uint32 *)((Uint8 *)d->pixels + dstrect->x * 4 + dstrect->y * dst_pitch);
#if defined(SDL_NEON_INTRINSICS)
#ifdef SDL_NEON_INTRINSICS
if (ret == -1 && hasNEON()) {
ret = scale_mat_NEON(src, src_w, src_h, src_pitch, dst, dst_w, dst_h, dst_pitch);
}
#endif
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (ret == -1 && hasSSE2()) {
ret = scale_mat_SSE(src, src_w, src_h, src_pitch, dst, dst_w, dst_h, dst_pitch);
}

View File

@@ -46,7 +46,7 @@
#include <SDL3/SDL_opengles2.h>
#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
#if !defined(SDL_VIDEO_OPENGL)
#ifndef SDL_VIDEO_OPENGL
#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
#endif
@@ -1536,7 +1536,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
}
display->fullscreen_window = window;
#if defined(__ANDROID__)
#ifdef __ANDROID__
/* Android may not resize the window to exactly what our fullscreen mode is,
* especially on windowed Android environments like the Chromebook or Samsung DeX.
* Given this, we shouldn't use the mode size. Android's SetWindowFullscreen
@@ -2901,7 +2901,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window)
attempt_texture_framebuffer = SDL_FALSE;
}
#if defined(__LINUX__)
#ifdef __LINUX__
/* On WSL, direct X11 is faster than using OpenGL for window framebuffers, so try to detect WSL and avoid texture framebuffer. */
else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "x11") == 0)) {
struct stat sb;
@@ -2915,7 +2915,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window)
attempt_texture_framebuffer = SDL_FALSE;
}
#endif
#if defined(__EMSCRIPTEN__)
#ifdef __EMSCRIPTEN__
else {
attempt_texture_framebuffer = SDL_FALSE;
}
@@ -3672,7 +3672,7 @@ void SDL_GL_UnloadLibrary(void)
typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void);
typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params);
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name);
#if !defined(SDL_VIDEO_OPENGL)
#ifndef SDL_VIDEO_OPENGL
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
#endif
@@ -3839,7 +3839,7 @@ void SDL_GL_ResetAttributes(void)
_this->gl_config.retained_backing = 1;
_this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
#if defined(SDL_VIDEO_OPENGL)
#ifdef SDL_VIDEO_OPENGL
_this->gl_config.major_version = 2;
_this->gl_config.minor_version = 1;
_this->gl_config.profile_mask = 0;
@@ -4102,7 +4102,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
attrib = GL_SAMPLES;
break;
case SDL_GL_CONTEXT_RELEASE_BEHAVIOR:
#if defined(SDL_VIDEO_OPENGL)
#ifdef SDL_VIDEO_OPENGL
attrib = GL_CONTEXT_RELEASE_BEHAVIOR;
#else
attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR;

View File

@@ -303,7 +303,7 @@ static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, i
return 0;
}
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
static SDL_bool SDL_TARGETING("sse2") yuv_rgb_sse(
Uint32 src_format, Uint32 dst_format,
Uint32 width, Uint32 height,
@@ -1122,7 +1122,7 @@ static int SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src
return 0;
}
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
static int SDL_TARGETING("sse2") SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{
int x, y;
@@ -1441,7 +1441,7 @@ static int SDL_ConvertPixels_SwapNV_std(int width, int height, const void *src,
static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
}
@@ -1451,7 +1451,7 @@ static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const voi
static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_SplitNV_to_UVPlanes_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
}
@@ -1461,7 +1461,7 @@ static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const vo
static int SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_SwapNV_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -1541,7 +1541,7 @@ static int SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height,
SDL_GetPixelFormatName(dst_format));
}
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \
while (x >= 4) { \
__m128i yuv = _mm_loadu_si128((__m128i *)srcYUV); \
@@ -1969,7 +1969,7 @@ static int SDL_ConvertPixels_YVYU_to_UYVY_std(int width, int height, const void
static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YUY2_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -1979,7 +1979,7 @@ static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src
static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YUY2_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -1989,7 +1989,7 @@ static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src
static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_UYVY_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -1999,7 +1999,7 @@ static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src
static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_UYVY_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -2009,7 +2009,7 @@ static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src
static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YVYU_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}
@@ -2019,7 +2019,7 @@ static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src
static int SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YVYU_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch);
}

View File

@@ -448,7 +448,7 @@ extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlob
void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
{
#if defined(SDL_MAC_NO_SANDBOX)
#ifdef SDL_MAC_NO_SANDBOX
CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable);
#endif
}

View File

@@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef SDL_VIDEO_DRIVER_COCOA
#include "SDL_cocoavideo.h"

View File

@@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef SDL_VIDEO_DRIVER_COCOA
#include "SDL_cocoamouse.h"
#include "SDL_cocoavideo.h"

View File

@@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef SDL_VIDEO_DRIVER_COCOA
#include "SDL_cocoavideo.h"
#include "SDL_cocoashape.h"

View File

@@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef SDL_VIDEO_DRIVER_COCOA
#if !__has_feature(objc_arc)
#error SDL must be built with Objective-C ARC (automatic reference counting) enabled

View File

@@ -48,7 +48,7 @@
* implementations.
*/
#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
#ifdef EGL_NO_PLATFORM_SPECIFIC_TYPES
typedef void *EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
@@ -160,7 +160,7 @@ typedef khronos_int32_t EGLint;
/* C++ / C typecast macros for special EGL handle values */
#if defined(__cplusplus)
#ifdef __cplusplus
#define EGL_CAST(type, value) (static_cast<type>(value))
#else
#define EGL_CAST(type, value) ((type) (value))

View File

@@ -99,7 +99,7 @@
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
#ifdef KHRONOS_STATIC
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
@@ -260,7 +260,7 @@ typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
#ifdef _WIN64
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else

View File

@@ -36,7 +36,7 @@
#include <sys/ioctl.h>
#if defined(__OpenBSD__)
#ifdef __OpenBSD__
#define DEFAULT_VULKAN "libvulkan.so"
#else
#define DEFAULT_VULKAN "libvulkan.so.1"

View File

@@ -265,7 +265,7 @@ void UIKit_ForceUpdateHomeIndicator()
* identical!
*/
#if !defined(SDL_VIDEO_DRIVER_COCOA)
#ifndef SDL_VIDEO_DRIVER_COCOA
void SDL_NSLog(const char *prefix, const char *text)
{
@autoreleasepool {

View File

@@ -39,7 +39,7 @@ Uint8 lock_key_down = 0;
void VITA_InitKeyboard(void)
{
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
sceSysmoduleLoadModule(SCE_SYSMODULE_IME); /** For PVR OSK Support **/
#endif
sceHidKeyboardEnumerate(&keyboard_hid_handle, 1);

View File

@@ -38,11 +38,11 @@
#include "SDL_vitamouse_c.h"
#include "SDL_vitaframebuffer.h"
#if defined(SDL_VIDEO_VITA_PIB)
#ifdef SDL_VIDEO_VITA_PIB
#include "SDL_vitagles_c.h"
#elif defined(SDL_VIDEO_VITA_PVR)
#include "SDL_vitagles_pvr_c.h"
#if defined(SDL_VIDEO_VITA_PVR_OGL)
#ifdef SDL_VIDEO_VITA_PVR_OGL
#include "SDL_vitagl_pvr_c.h"
#endif
#define VITA_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
@@ -64,7 +64,7 @@ static SDL_VideoDevice *VITA_Create()
{
SDL_VideoDevice *device;
SDL_VideoData *phdata;
#if defined(SDL_VIDEO_VITA_PIB)
#ifdef SDL_VIDEO_VITA_PIB
SDL_GLDriverData *gldata;
#endif
/* Initialize SDL_VideoDevice structure */
@@ -81,7 +81,7 @@ static SDL_VideoDevice *VITA_Create()
SDL_free(device);
return NULL;
}
#if defined(SDL_VIDEO_VITA_PIB)
#ifdef SDL_VIDEO_VITA_PIB
gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData));
if (gldata == NULL) {
@@ -129,7 +129,7 @@ static SDL_VideoDevice *VITA_Create()
*/
#if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR)
#if defined(SDL_VIDEO_VITA_PVR_OGL)
#ifdef SDL_VIDEO_VITA_PVR_OGL
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
device->GL_LoadLibrary = VITA_GL_LoadLibrary;
device->GL_CreateContext = VITA_GL_CreateContext;
@@ -139,7 +139,7 @@ static SDL_VideoDevice *VITA_Create()
device->GL_LoadLibrary = VITA_GLES_LoadLibrary;
device->GL_CreateContext = VITA_GLES_CreateContext;
device->GL_GetProcAddress = VITA_GLES_GetProcAddress;
#if defined(SDL_VIDEO_VITA_PVR_OGL)
#ifdef SDL_VIDEO_VITA_PVR_OGL
}
#endif
@@ -173,12 +173,12 @@ VideoBootStrap VITA_bootstrap = {
int VITA_VideoInit(_THIS)
{
SDL_DisplayMode mode;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
char *res = SDL_getenv("VITA_RESOLUTION");
#endif
SDL_zero(mode);
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
if (res) {
/* 1088i for PSTV (Or Sharpscale) */
if (!SDL_strncmp(res, "1080", 4)) {
@@ -196,7 +196,7 @@ int VITA_VideoInit(_THIS)
#endif
mode.pixel_w = 960;
mode.pixel_h = 544;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
}
#endif
@@ -224,7 +224,7 @@ void VITA_VideoQuit(_THIS)
int VITA_CreateWindow(_THIS, SDL_Window *window)
{
SDL_WindowData *wdata;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
Psp2NativeWindow win;
int temp_major = 2;
int temp_minor = 1;
@@ -247,7 +247,7 @@ int VITA_CreateWindow(_THIS, SDL_Window *window)
Vita_Window = window;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
win.type = PSP2_DRAWABLE_TYPE_WINDOW;
win.numFlipBuffers = 2;
win.flipChainThrdAffinity = 0x20000;
@@ -350,7 +350,7 @@ SDL_bool VITA_HasScreenKeyboardSupport(_THIS)
return SDL_TRUE;
}
#if !defined(SCE_IME_LANGUAGE_ENGLISH_US)
#ifndef SCE_IME_LANGUAGE_ENGLISH_US
#define SCE_IME_LANGUAGE_ENGLISH_US SCE_IME_LANGUAGE_ENGLISH
#endif
@@ -379,7 +379,7 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst)
*dst = '\0';
}
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
SceWChar16 libime_out[SCE_IME_MAX_PREEDIT_LENGTH + SCE_IME_MAX_TEXT_LENGTH + 1];
char libime_initval[8] = { 1 };
SceImeCaret caret_rev;
@@ -424,7 +424,7 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
SDL_VideoData *videodata = _this->driverdata;
SceInt32 res;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
SceUInt32 libime_work[SCE_IME_WORK_BUFFER_SIZE / sizeof(SceInt32)];
SceImeParam param;
@@ -482,7 +482,7 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
void VITA_HideScreenKeyboard(_THIS, SDL_Window *window)
{
#if !defined(SDL_VIDEO_VITA_PVR)
#ifndef SDL_VIDEO_VITA_PVR
SDL_VideoData *videodata = _this->driverdata;
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
@@ -503,7 +503,7 @@ void VITA_HideScreenKeyboard(_THIS, SDL_Window *window)
SDL_bool VITA_IsScreenKeyboardShown(_THIS, SDL_Window *window)
{
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
SDL_VideoData *videodata = _this->driverdata;
return videodata->ime_active;
#else
@@ -514,7 +514,7 @@ SDL_bool VITA_IsScreenKeyboardShown(_THIS, SDL_Window *window)
void VITA_PumpEvents(_THIS)
{
#if !defined(SDL_VIDEO_VITA_PVR)
#ifndef SDL_VIDEO_VITA_PVR
SDL_VideoData *videodata = _this->driverdata;
#endif
@@ -527,7 +527,7 @@ void VITA_PumpEvents(_THIS)
VITA_PollKeyboard();
VITA_PollMouse();
#if !defined(SDL_VIDEO_VITA_PVR)
#ifndef SDL_VIDEO_VITA_PVR
if (videodata->ime_active == SDL_TRUE) {
// update IME status. Terminate, if finished
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();

View File

@@ -45,7 +45,7 @@ struct SDL_WindowData
SDL_bool uses_gles;
SceUID buffer_uid;
void *buffer;
#if defined(SDL_VIDEO_VITA_PVR)
#ifdef SDL_VIDEO_VITA_PVR
EGLSurface egl_surface;
EGLContext egl_context;
#endif
@@ -77,7 +77,7 @@ void VITA_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed);
void VITA_DestroyWindow(_THIS, SDL_Window *window);
#ifdef SDL_VIDEO_DRIVER_VITA
#if defined(SDL_VIDEO_VITA_PVR_OGL)
#ifdef SDL_VIDEO_VITA_PVR_OGL
/* OpenGL functions */
int VITA_GL_LoadLibrary(_THIS, const char *path);
SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window *window);

View File

@@ -27,7 +27,7 @@
#include "SDL_vivantevideo.h"
#if defined(CAVIUM)
#ifdef CAVIUM
#define VIVANTE_PLATFORM_CAVIUM
#elif defined(MARVELL)
#define VIVANTE_PLATFORM_MARVELL

View File

@@ -54,7 +54,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
sigemptyset(&sig_set);
sigaddset(&sig_set, SIGPIPE);
#if defined(SDL_THREADS_DISABLED)
#ifdef SDL_THREADS_DISABLED
sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set);
#else
pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set);
@@ -76,7 +76,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
sigtimedwait(&sig_set, 0, &zerotime);
#if defined(SDL_THREADS_DISABLED)
#ifdef SDL_THREADS_DISABLED
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
#else
pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);

View File

@@ -22,7 +22,7 @@
#include "SDL_internal.h"
#include "SDL_waylandvideo.h"
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
#ifdef SDL_VIDEO_DRIVER_WAYLAND
extern void Wayland_InitMouse(void);
extern void Wayland_FiniMouse(SDL_VideoData *data);

View File

@@ -101,7 +101,7 @@ static char *get_classname(void)
/* Next look at the application's executable name */
#if defined(__LINUX__) || defined(__FREEBSD__)
#if defined(__LINUX__)
#ifdef __LINUX__
(void)SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
(void)SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file", getpid());

View File

@@ -35,7 +35,7 @@
#include <SDL3/SDL_syswm.h>
#if defined(__OpenBSD__)
#ifdef __OpenBSD__
#define DEFAULT_VULKAN "libvulkan.so"
#else
#define DEFAULT_VULKAN "libvulkan.so.1"

View File

@@ -737,7 +737,7 @@ static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = {
*/
static void OverrideLibdecorLimits(SDL_Window *window)
{
#if defined(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR)
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
if (libdecor_frame_get_min_content_size == NULL) {
SetMinMaxDimensions(window, SDL_FALSE);
}
@@ -756,7 +756,7 @@ static void OverrideLibdecorLimits(SDL_Window *window)
*/
static void LibdecorGetMinContentSize(struct libdecor_frame *frame, int *min_w, int *min_h)
{
#if defined(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR)
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
if (libdecor_frame_get_min_content_size != NULL) {
libdecor_frame_get_min_content_size(frame, min_w, min_h);
}

View File

@@ -604,7 +604,7 @@ static SDL_bool DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory)
SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex)
{
#if !defined(HAVE_DXGI_H)
#ifndef HAVE_DXGI_H
if (adapterIndex) {
*adapterIndex = -1;
}

View File

@@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
#ifdef SDL_VIDEO_DRIVER_WINDOWS
#include "../../core/windows/SDL_windows.h"

View File

@@ -413,7 +413,7 @@ static Uint32 X11_GetGlobalMouseState(float *x, float *y)
/* !!! FIXME: should we XSync() here first? */
#if !defined(SDL_VIDEO_DRIVER_X11_XINPUT2)
#ifndef SDL_VIDEO_DRIVER_X11_XINPUT2
videodata->global_mouse_changed = SDL_TRUE;
#else
if (!SDL_X11_HAVE_XINPUT2)

View File

@@ -232,7 +232,7 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
/*
* These only show up on some variants of Unix.
*/
#if defined(__osf__)
#ifdef __osf__
SDL_X11_MODULE(OSF_ENTRY_POINTS)
SDL_X11_SYM(void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr p),(dpy,p),)
SDL_X11_SYM(void,_SmtIpError,(Display *dpy,register smtDisplayPtr p,int i),(dpy,p,i),)

View File

@@ -63,7 +63,7 @@ static char *get_classname(void)
/* Next look at the application's executable name */
#if defined(__LINUX__) || defined(__FREEBSD__)
#if defined(__LINUX__)
#ifdef __LINUX__
(void)SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
(void)SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file", getpid());

View File

@@ -29,7 +29,7 @@
#include <X11/Xlib.h>
/*#include <xcb/xcb.h>*/
#if defined(__OpenBSD__)
#ifdef __OpenBSD__
#define DEFAULT_VULKAN "libvulkan.so"
#else
#define DEFAULT_VULKAN "libvulkan.so.1"

View File

@@ -239,7 +239,7 @@ void rgb24_yuv420_std(
}
}
#if defined(SDL_SSE2_INTRINSICS)
#ifdef SDL_SSE2_INTRINSICS
#define SSE_FUNCTION_NAME yuv420_rgb565_sse
#define STD_FUNCTION_NAME yuv420_rgb565_std