update sdl Merge commit '644725478f4de0f074a6834e8423ac36dce3974f'

This commit is contained in:
2023-09-23 18:53:11 +02:00
172 changed files with 7495 additions and 4062 deletions

View File

@ -2534,7 +2534,7 @@ int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
int retval;
CHECK_RENDERER_MAGIC(renderer, -1)
if (rect && rect->w > 0 && rect->h > 0) {
if (rect && rect->w >= 0 && rect->h >= 0) {
renderer->view->clipping_enabled = SDL_TRUE;
renderer->view->clip_rect.x = rect->x;
renderer->view->clip_rect.y = rect->y;

View File

@ -1754,8 +1754,22 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, Uint32 flags)
return NULL;
}
// !!! FIXME: MTLCopyAllDevices() can find other GPUs on macOS...
mtldevice = MTLCreateSystemDefaultDevice();
#ifdef __MACOS__
if (SDL_GetHintBoolean(SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE, SDL_TRUE)) {
NSArray<id<MTLDevice>> *devices = MTLCopyAllDevices();
for (id<MTLDevice> device in devices) {
if (device.isLowPower) {
mtldevice = device;
break;
}
}
}
#endif
if (mtldevice == nil) {
mtldevice = MTLCreateSystemDefaultDevice();
}
if (mtldevice == nil) {
SDL_free(renderer);