Renamed SDL_SIMDGetAlignment() to SDL_GetSIMDAlignment()

pull/9816/head
Sam Lantinga 2024-05-16 10:07:02 -07:00
parent 4609af618a
commit 02ff85f2f3
19 changed files with 41 additions and 27 deletions

View File

@ -3179,3 +3179,8 @@ typedef SDL_Colour, SDL_Color;
- SDL_LogResetPriorities
+ SDL_ResetLogPriorities
(...)
@@
@@
- SDL_SIMDGetAlignment
+ SDL_GetSIMDAlignment
(...)

View File

@ -302,7 +302,10 @@ SDL_Has3DNow() has been removed; there is no replacement.
SDL_HasRDTSC() has been removed; there is no replacement. Don't use the RDTSC opcode in modern times, use SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency instead.
SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() have been removed. You can use SDL_aligned_alloc() and SDL_aligned_free() with SDL_SIMDGetAlignment() to get the same functionality.
SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() have been removed. You can use SDL_aligned_alloc() and SDL_aligned_free() with SDL_GetSIMDAlignment() to get the same functionality.
The following functions have been renamed:
* SDL_SIMDGetAlignment() => SDL_GetSIMDAlignment()
## SDL_error.h

View File

@ -302,7 +302,7 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
* \sa SDL_aligned_alloc
* \sa SDL_aligned_free
*/
extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
extern DECLSPEC size_t SDLCALL SDL_GetSIMDAlignment(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -70,6 +70,9 @@
#define SDL_LoadWAV_RW SDL_LoadWAV_IO
#define SDL_NewAudioStream SDL_CreateAudioStream
/* ##SDL_cpuinfo.h */
#define SDL_SIMDGetAlignment SDL_GetSIMDAlignment
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_EVENT_DID_ENTER_FOREGROUND
@ -583,6 +586,9 @@
#define SDL_LoadWAV_RW SDL_LoadWAV_RW_renamed_SDL_LoadWAV_IO
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
/* ##SDL_cpuinfo.h */
#define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_renamed_SDL_GetSIMDAlignment
/* ##SDL_events.h */
#define SDL_APP_DIDENTERBACKGROUND SDL_APP_DIDENTERBACKGROUND_renamed_SDL_EVENT_DID_ENTER_BACKGROUND
#define SDL_APP_DIDENTERFOREGROUND SDL_APP_DIDENTERFOREGROUND_renamed_SDL_EVENT_DID_ENTER_FOREGROUND

View File

@ -1617,14 +1617,14 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
SDL_UpdatedAudioDeviceFormat(device); // in case the backend changed things and forgot to call this.
// Allocate a scratch audio buffer
device->work_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->work_buffer = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->work_buffer) {
ClosePhysicalAudioDevice(device);
return -1;
}
if (device->spec.format != SDL_AUDIO_F32) {
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->mix_buffer) {
ClosePhysicalAudioDevice(device);
return -1;
@ -1748,7 +1748,7 @@ int SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallbac
int retval = 0;
if (logdev) {
if (callback && !device->postmix_buffer) {
device->postmix_buffer = (float *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->postmix_buffer = (float *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->postmix_buffer) {
retval = -1;
}
@ -2214,14 +2214,14 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
SDL_UpdatedAudioDeviceFormat(device);
if (device->work_buffer && (device->work_buffer_size > orig_work_buffer_size)) {
SDL_aligned_free(device->work_buffer);
device->work_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->work_buffer = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->work_buffer) {
kill_device = SDL_TRUE;
}
if (device->postmix_buffer) {
SDL_aligned_free(device->postmix_buffer);
device->postmix_buffer = (float *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->postmix_buffer = (float *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->postmix_buffer) {
kill_device = SDL_TRUE;
}
@ -2230,7 +2230,7 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
SDL_aligned_free(device->mix_buffer);
device->mix_buffer = NULL;
if (device->spec.format != SDL_AUDIO_F32) {
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), device->work_buffer_size);
if (!device->mix_buffer) {
kill_device = SDL_TRUE;
}

View File

@ -655,7 +655,7 @@ static Uint8 *EnsureAudioStreamWorkBufferSize(SDL_AudioStream *stream, size_t ne
return stream->work_buffer;
}
Uint8 *ptr = (Uint8 *) SDL_aligned_alloc(SDL_SIMDGetAlignment(), newlen);
Uint8 *ptr = (Uint8 *) SDL_aligned_alloc(SDL_GetSIMDAlignment(), newlen);
if (!ptr) {
return NULL; // previous work buffer is still valid!
}
@ -838,7 +838,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
work_buffer_capacity = SDL_max(work_buffer_capacity, resample_convert_bytes);
// SIMD-align the buffer
int simd_alignment = (int) SDL_SIMDGetAlignment();
int simd_alignment = (int) SDL_GetSIMDAlignment();
work_buffer_capacity += simd_alignment - 1;
work_buffer_capacity -= work_buffer_capacity % simd_alignment;

View File

@ -625,7 +625,7 @@ int SDL_ResetAudioQueueHistory(SDL_AudioQueue *queue, int num_frames)
Uint8 *history_buffer = queue->history_buffer;
if (queue->history_capacity < length) {
history_buffer = SDL_aligned_alloc(SDL_SIMDGetAlignment(), length);
history_buffer = SDL_aligned_alloc(SDL_GetSIMDAlignment(), length);
if (!history_buffer) {
return -1;
}

View File

@ -353,7 +353,7 @@ static int BuildAAudioStream(SDL_AudioDevice *device)
// Allocate a double buffered mixing buffer
hidden->num_buffers = 2;
hidden->mixbuf_bytes = (hidden->num_buffers * device->buffer_size);
hidden->mixbuf = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), hidden->mixbuf_bytes);
hidden->mixbuf = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), hidden->mixbuf_bytes);
if (!hidden->mixbuf) {
return -1;
}

View File

@ -151,7 +151,7 @@ static int ZombieAcquireFrame(SDL_CameraDevice *device, SDL_Surface *frame, Uint
if (!device->zombie_pixels) {
// attempt to allocate and initialize a fake frame of pixels.
const size_t buflen = GetFrameBufLen(&device->actual_spec);
device->zombie_pixels = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
device->zombie_pixels = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (!device->zombie_pixels) {
*timestampNS = 0;
return 0; // oh well, say there isn't a frame yet, so we'll go back to waiting. Maybe allocation will succeed later...?

View File

@ -335,7 +335,7 @@ static int ANDROIDCAMERA_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *fra
buflen += (int) datalen;
}
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {

View File

@ -175,7 +175,7 @@ static int COREMEDIA_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *frame,
if ((planar == 0) && (numPlanes == 0)) {
const int pitch = (int) CVPixelBufferGetBytesPerRow(image);
const size_t buflen = pitch * frame->h;
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {
@ -190,7 +190,7 @@ static int COREMEDIA_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *frame,
}
buflen *= frame->h;
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {

View File

@ -368,7 +368,7 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
if (FAILED(ret)) {
retval = -1;
} else {
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {
@ -388,7 +388,7 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
if (pitch < 0) { // image rows are reversed.
bufstart += -pitch * (frame->h - 1);
}
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {
@ -410,7 +410,7 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
if (pitch < 0) { // image rows are reversed.
bufstart += -pitch * (frame->h - 1);
}
frame->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), buflen);
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), buflen);
if (frame->pixels == NULL) {
retval = -1;
} else {

View File

@ -1158,7 +1158,7 @@ int SDL_GetSystemRAM(void)
return SDL_SystemRAM;
}
size_t SDL_SIMDGetAlignment(void)
size_t SDL_GetSIMDAlignment(void)
{
if (SDL_SIMDAlignment == 0xFFFFFFFF) {
SDL_GetCPUFeatures(); /* make sure this has been calculated */

View File

@ -672,7 +672,7 @@ SDL3_0.0.0 {
SDL_RumbleJoystickTriggers;
SDL_RunApp;
SDL_RunHapticEffect;
SDL_SIMDGetAlignment;
SDL_GetSIMDAlignment;
SDL_SaveBMP;
SDL_SaveBMP_IO;
SDL_ScreenKeyboardShown;

View File

@ -697,7 +697,7 @@
#define SDL_RumbleJoystickTriggers SDL_RumbleJoystickTriggers_REAL
#define SDL_RunApp SDL_RunApp_REAL
#define SDL_RunHapticEffect SDL_RunHapticEffect_REAL
#define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_REAL
#define SDL_GetSIMDAlignment SDL_GetSIMDAlignment_REAL
#define SDL_SaveBMP SDL_SaveBMP_REAL
#define SDL_SaveBMP_IO SDL_SaveBMP_IO_REAL
#define SDL_ScreenKeyboardShown SDL_ScreenKeyboardShown_REAL

View File

@ -718,7 +718,7 @@ SDL_DYNAPI_PROC(int,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uin
SDL_DYNAPI_PROC(int,SDL_RumbleJoystickTriggers,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_RunApp,(int a, char *b[], SDL_main_func c, void *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_RunHapticEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(size_t,SDL_SIMDGetAlignment,(void),(),return)
SDL_DYNAPI_PROC(size_t,SDL_GetSIMDAlignment,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, SDL_bool c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return)

View File

@ -60,7 +60,7 @@ SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormatEnum format, int w, in
SDL_SW_DestroyYUVTexture(swdata);
return NULL;
}
swdata->pixels = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), dst_size);
swdata->pixels = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), dst_size);
if (!swdata->pixels) {
SDL_SW_DestroyYUVTexture(swdata);
return NULL;

View File

@ -1495,7 +1495,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface)
return SDL_FALSE;
}
surface->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), size);
surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
if (!surface->pixels) {
return SDL_FALSE;
}
@ -1567,7 +1567,7 @@ void SDL_UnRLESurface(SDL_Surface *surface, int recode)
surface->flags |= SDL_RLEACCEL;
return;
}
surface->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), size);
surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
if (!surface->pixels) {
/* Oh crap... */
surface->flags |= SDL_RLEACCEL;

View File

@ -171,7 +171,7 @@ SDL_Surface *SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format
/* Get the pixels */
if (surface->w && surface->h) {
surface->pixels = SDL_aligned_alloc(SDL_SIMDGetAlignment(), size);
surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
if (!surface->pixels) {
SDL_DestroySurface(surface);
return NULL;