Define SDL_PLATFORM_* macros instead of underscored ones (#8875)

This commit is contained in:
Anonymous Maarten
2024-01-24 02:40:51 +01:00
committed by GitHub
parent ceccf24519
commit 31d133db40
208 changed files with 1293 additions and 1138 deletions

View File

@@ -45,14 +45,14 @@
#endif
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#include "testffmpeg_videotoolbox.h"
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
#define COBJMACROS
#include <libavutil/hwcontext_d3d11va.h>
#endif /* __WIN32__ */
#endif /* SDL_PLATFORM_WIN32 */
#include "icon.h"
@@ -74,10 +74,10 @@ static SDL_bool has_EGL_EXT_image_dma_buf_import;
static PFNGLACTIVETEXTUREARBPROC glActiveTextureARBFunc;
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESFunc;
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
static SDL_bool has_videotoolbox_output;
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
static ID3D11Device *d3d11_device;
static ID3D11DeviceContext *d3d11_context;
static const GUID SDL_IID_ID3D11Resource = { 0xdc8e63f3, 0xd12b, 0x4952, { 0xb4, 0x7b, 0x5e, 0x45, 0x02, 0x6a, 0x86, 0x2d } };
@@ -140,11 +140,11 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
}
#endif /* HAVE_EGL */
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
has_videotoolbox_output = SetupVideoToolboxOutput(renderer);
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
d3d11_device = (ID3D11Device *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, NULL);
if (d3d11_device) {
ID3D11Device_AddRef(d3d11_device);
@@ -259,12 +259,12 @@ static SDL_bool SupportedPixelFormat(enum AVPixelFormat format)
(format == AV_PIX_FMT_VAAPI || format == AV_PIX_FMT_DRM_PRIME)) {
return SDL_TRUE;
}
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
if (has_videotoolbox_output && format == AV_PIX_FMT_VIDEOTOOLBOX) {
return SDL_TRUE;
}
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
if (d3d11_device && format == AV_PIX_FMT_D3D11) {
return SDL_TRUE;
}
@@ -351,7 +351,7 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV
continue;
}
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
if (d3d11_device && type == AV_HWDEVICE_TYPE_D3D11VA) {
AVD3D11VADeviceContext *device_context;
@@ -598,7 +598,7 @@ static SDL_bool GetTextureForVAAPIFrame(AVFrame *frame, SDL_Texture **texture)
static SDL_bool GetTextureForD3D11Frame(AVFrame *frame, SDL_Texture **texture)
{
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
int texture_width = 0, texture_height = 0;
ID3D11Texture2D *pTexture = (ID3D11Texture2D *)frame->data[0];
UINT iSliceIndex = (UINT)(uintptr_t)frame->data[1];
@@ -672,7 +672,7 @@ static void DisplayVideoTexture(AVFrame *frame)
static void DisplayVideoToolbox(AVFrame *frame)
{
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
SDL_Rect viewport;
SDL_GetRenderViewport(renderer, &viewport);
DisplayVideoToolboxFrame(renderer, frame->data[3], 0, 0, frame->width, frame->height, viewport.x, viewport.y, viewport.w, viewport.h);
@@ -908,9 +908,9 @@ int main(int argc, char *argv[])
}
window_flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY;
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
window_flags |= SDL_WINDOW_METAL;
#elif !defined(__WIN32__)
#elif !defined(SDL_PLATFORM_WIN32)
window_flags |= SDL_WINDOW_OPENGL;
#endif
#ifdef HAVE_EGL
@@ -919,12 +919,12 @@ int main(int argc, char *argv[])
CreateWindowAndRenderer(window_flags, "opengles2");
}
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
if (!window) {
CreateWindowAndRenderer(window_flags, "metal");
}
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
if (!window) {
CreateWindowAndRenderer(window_flags, "direct3d11");
}
@@ -1111,10 +1111,10 @@ int main(int argc, char *argv[])
}
return_code = 0;
quit:
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
CleanupVideoToolboxOutput();
#endif
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
if (d3d11_context) {
ID3D11DeviceContext_Release(d3d11_device);
d3d11_context = NULL;